/*!
 * Veg-Nourish — ERRERLabs. MIT licensed.
 * One stylesheet, no framework. Mobile-first, light and dark, print-aware.
 */

:root {
  --green-900: #0f2e21;
  --green-700: #1f6f4a;
  --green-600: #2b8a5e;
  --green-300: #7fcaa4;
  --green-050: #eaf6f0;

  --clay-600: #a85536;
  --clay-300: #e0a98f;
  --amber-500: #b8860f;

  --ink: #17201b;
  --ink-soft: #55635b;
  --ink-faint: #8b9a92;
  --line: #e4eae6;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --bg: #f4f7f5;

  --radius: 16px;
  --radius-sm: 10px;
  /* Barely-there elevation. Heavy shadows are what make an interface feel busy. */
  --shadow: 0 1px 2px rgba(16, 40, 30, .04), 0 2px 10px rgba(16, 40, 30, .035);
  --shadow-lift: 0 2px 8px rgba(16, 40, 30, .07), 0 18px 40px rgba(16, 40, 30, .10);

  /* One spacing scale, used everywhere. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --ease: cubic-bezier(.2, .7, .3, 1);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;

  --tabbar-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8efea;
    --ink-soft: #a8b8b0;
    --ink-faint: #7e908a;
    --line: #24312a;
    --surface: #17221c;
    --surface-2: #1d2922;
    --bg: #101a15;
    --green-050: #16302340;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .28);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 14px 34px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --ink: #e8efea;
  --ink-soft: #a8b8b0;
  --ink-faint: #7e908a;
  --line: #24312a;
  --surface: #17221c;
  --surface-2: #1d2922;
  --bg: #101a15;
  --green-050: #16302340;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .28);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .5), 0 14px 34px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
a { color: var(--green-600); }

/* ---------- app chrome ---------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.appbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-decoration: none;
  color: var(--ink);
}
.appbar__mark { font-size: 20px; }
.appbar__by { color: var(--ink-faint); font-weight: 400; font-size: .82em; }

.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--green-050);
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.install-banner span { flex: 1; }

.main { max-width: 860px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-7); }

.splash { text-align: center; padding: 22vh 0; color: var(--ink-faint); }
.splash__mark { font-size: 44px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
  text-decoration: none;
  font-size: .68rem;
  min-width: 0;
}
.tabbar__icon { font-size: 19px; line-height: 1; }
.tabbar__item.is-active { color: var(--green-600); background: var(--green-050); font-weight: 600; }

/* ---------- layout blocks ---------- */

.view { display: flex; flex-direction: column; gap: var(--sp-4); }
.view__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.view__title { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.15; letter-spacing: -.022em; margin: 0; }
.view__sub { color: var(--ink-soft); font-size: .9rem; margin: 4px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5);
  box-shadow: var(--shadow);
}
@media (max-width: 480px) { .card { padding: var(--sp-4); } }
.block__title { font-family: var(--font-display); font-size: 1.16rem; letter-spacing: -.012em; margin-bottom: .55em; }
.step__sub { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin: 14px 0 6px; }

.card-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .card-grid { grid-template-columns: 1fr 1fr; } }

.muted { color: var(--ink-soft); }
.small, .muted.small { font-size: .85rem; }
.fine-print { font-size: .78rem; color: var(--ink-faint); line-height: 1.45; }
.lede { font-size: 1.03rem; line-height: 1.6; color: var(--ink-soft); }
.empty { color: var(--ink-faint); text-align: center; padding: 24px 0; }
.tight { margin: 0 0 .6em; padding-left: 1.1em; }
.tight li { margin-bottom: .3em; }

.empty-state { text-align: center; padding: 34px 12px; }
.empty-state__dice { font-size: 46px; margin-bottom: 8px; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover { border-color: var(--green-300); }
.btn:active { transform: scale(.96); }
.btn--primary { box-shadow: 0 1px 2px rgba(16,40,30,.10); }
.btn--primary:active { box-shadow: none; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn--primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn--primary:hover { background: var(--green-600); }
.btn--danger { background: transparent; border-color: var(--clay-600); color: var(--clay-600); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--green-700); }
.btn--small { min-height: 32px; padding: 5px 10px; font-size: .82rem; }
.btn--big { width: 100%; min-height: 52px; font-size: 1.05rem; margin-top: 6px; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1;
  padding: 7px 9px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
  min-width: 36px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.linkish {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--green-700);
  font: inherit;
  font-size: .88rem;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.chip-row--tight { gap: 5px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.chip:hover { border-color: var(--green-300); }
.chip.is-on { background: var(--green-700); border-color: var(--green-700); color: #fff; font-weight: 550; }
.chip--taste.is-love { background: var(--green-050); border-color: var(--green-600); color: var(--green-700); font-weight: 600; }
.chip--taste.is-never { background: transparent; border-color: var(--clay-300); color: var(--clay-600); text-decoration: line-through; }

.pill-row { display: flex; flex-wrap: wrap; gap: var(--sp-1) 6px; margin: var(--sp-2) 0 var(--sp-3); }
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: .73rem;
  letter-spacing: .005em;
  white-space: nowrap;
}
.pill--green { background: var(--green-050); border-color: var(--green-300); color: var(--green-700); }
.pill--meat { background: color-mix(in srgb, var(--clay-300) 25%, transparent); border-color: var(--clay-300); color: var(--clay-600); }
.pill--warn { background: color-mix(in srgb, var(--amber-500) 18%, transparent); border-color: var(--amber-500); color: var(--amber-500); }
.pill--muted { opacity: .7; }

.input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .95rem;
}
.input:focus-visible { outline: 2px solid var(--green-600); outline-offset: 1px; }
.textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.input--name { font-weight: 600; }
.range { width: 100%; accent-color: var(--green-700); }
.range-legend { display: flex; justify-content: space-between; font-size: .75rem; color: var(--ink-faint); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.field__label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
@media (min-width: 620px) { .field-grid { grid-template-columns: repeat(3, 1fr); } }
.form-grid { display: grid; gap: 12px; }
.height-input { display: flex; gap: 6px; }

.switch-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.switch-row:last-child { border-bottom: none; }
.switch-row input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--green-700); flex: none; }
.switch-row p { margin: 2px 0 0; font-size: .86rem; }
.switch-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink-soft); }
.switch-inline input { width: 18px; height: 18px; accent-color: var(--green-700); }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.stepper__value { min-width: 30px; text-align: center; font-weight: 650; }

/* ---------- onboarding ---------- */

.onboarding { gap: 18px; }
.progress-dots { display: flex; gap: 6px; justify-content: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dot.is-done { background: var(--green-300); }
.dot.is-on { background: var(--green-700); width: 20px; border-radius: 999px; }
.step { display: flex; flex-direction: column; gap: 4px; }
.step__title { font-family: var(--font-display); font-size: 1.85rem; letter-spacing: -.02em; }
.onboarding__nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }

.feature-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 14px; }
.feature { display: flex; gap: 12px; }
.feature__icon { font-size: 22px; line-height: 1.2; }
.feature p { margin: 2px 0 0; font-size: .88rem; }

.member { padding: 12px; }
.member__row { display: flex; gap: 8px; align-items: center; }
.member__est { margin: 8px 0 0; font-size: .84rem; color: var(--ink-soft); }
.member-list { display: grid; gap: 10px; }

.summary { display: grid; gap: 8px; }
.summary__row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; font-size: .9rem; }
.summary__row:last-child { border-bottom: none; }
.summary__label { color: var(--ink-faint); }
.summary__value { text-align: right; font-weight: 550; }

.info { background: var(--green-050); border-color: var(--green-300); }

/* ---------- roll ---------- */

.roller { display: flex; flex-direction: column; gap: 10px; }
.roller__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.roller__row--filters { gap: 6px; }
.roller__label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); min-width: 92px; }
.roller .chip-row { margin-bottom: 0; }

.results__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seed { font-size: .72rem; color: var(--ink-faint); font-family: ui-monospace, monospace; margin-left: auto; }

.recipe-card { display: flex; flex-direction: column; }
.recipe-card.is-locked { border-color: var(--green-600); box-shadow: var(--shadow-lift); }
.recipe-card__head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.recipe-card__title { font-family: var(--font-display); font-size: 1.15rem; margin: 0 0 4px; cursor: pointer; }
.recipe-card__title:hover { color: var(--green-700); }
.recipe-card__blurb { font-size: .87rem; color: var(--ink-soft); margin: 0; }
.recipe-card__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }
.recipe-card__actions .btn { font-size: .82rem; padding: 6px 12px; min-height: 34px; }
.recipe-card__actions { gap: var(--sp-2); }

.why { font-size: .82rem; color: var(--ink-soft); padding: 2px 0 6px; margin: 0; border-left: 2px solid var(--green-300); padding-left: 10px; }
.why__label { color: var(--ink-faint); }
.fork { font-size: .84rem; color: var(--ink-soft); background: color-mix(in srgb, var(--clay-300) 10%, transparent); border-radius: var(--radius-sm); padding: 9px 11px; margin: var(--sp-2) 0; }

.score {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  background: var(--ink-faint);
}
.score--A { background: var(--green-600); }
.score--B { background: #58a06f; }
.score--C { background: var(--amber-500); }
.score--D { background: #cf7a3f; }
.score--F { background: var(--clay-600); }

/* ---------- recipe ---------- */

.recipe__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.servings__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.ing-list { list-style: none; margin: 0; padding: 0; }
.ing {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.ing:last-child { border-bottom: none; }
.ing__main { display: flex; align-items: baseline; gap: 8px; flex: 1; cursor: pointer; min-width: 60%; }
.ing__main input { width: 19px; height: 19px; accent-color: var(--green-700); flex: none; align-self: center; }
.ing__qty { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 74px; }
.ing__prep, .ing__opt { color: var(--ink-faint); font-size: .88rem; }
.ing.is-have .ing__name, .ing.is-have .ing__qty { color: var(--ink-faint); text-decoration: line-through; }
.ing__meta { display: flex; gap: 5px; align-items: center; }

.tag-btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 999px; font-size: .72rem; padding: 3px 8px; cursor: pointer;
}
.tag-btn:hover { border-color: var(--green-300); color: var(--green-700); }

.fork-block { border-left: 3px solid var(--clay-600); }
.fork-block--veg { border-left-color: var(--green-600); }
.fork-block__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.fork-block__label { font-weight: 600; margin: 4px 0; }

.steps { padding-left: 1.3em; margin: 0; }
.steps li { margin-bottom: .85em; }
.steps--compact li { margin-bottom: .5em; font-size: .9rem; }

.notes { margin: 0; }
.notes dt { font-weight: 650; margin-top: 10px; font-size: .9rem; }
.notes dd { margin: 2px 0 0; color: var(--ink-soft); font-size: .9rem; }

.nutri-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
@media (min-width: 620px) { .nutri-grid { grid-template-columns: repeat(6, 1fr); } }
.nutri { text-align: center; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 4px; }
.nutri__value { display: block; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.nutri__unit { font-size: .7rem; font-weight: 500; color: var(--ink-faint); margin-left: 1px; }
.nutri__label { font-size: .7rem; color: var(--ink-faint); }
.flag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

.meters { display: grid; gap: 10px; margin: 10px 0; }
.meter__top { display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-soft); margin-bottom: 3px; }
.meter__track { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter__fill { height: 100%; background: var(--green-600); border-radius: 999px; }
.meter__fill.is-over { background: var(--clay-600); }

.explain summary { cursor: pointer; font-size: .87rem; color: var(--ink-soft); padding: 6px 0; }
.explain[open] summary { color: var(--ink); font-weight: 550; }

.recipe__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- plan ---------- */

.plan-list { display: grid; gap: 10px; }
.plan-row__head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.plan-row__controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 10px 0; }
.suggest-row { display: grid; gap: 8px; }
.suggest { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.suggest strong { cursor: pointer; }
.target-row { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }

/* ---------- pantry ---------- */

.pantry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 6px; }
.pantry-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .85rem; cursor: pointer; background: var(--surface);
}
.pantry-item input { accent-color: var(--green-700); width: 17px; height: 17px; flex: none; }
.pantry-item.is-have { background: var(--green-050); border-color: var(--green-300); }
.pantry-item__name { flex: 1; min-width: 0; }
.pantry-item__uses { font-size: .68rem; color: var(--ink-faint); background: var(--surface-2); border-radius: 999px; padding: 1px 6px; }

/* ---------- shopping list ---------- */

.export-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.aisle__hint { margin-top: -4px; }
.list-items { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item__main { display: flex; align-items: center; gap: 9px; flex: 1; cursor: pointer; min-width: 0; }
.list-item__main input { width: 21px; height: 21px; accent-color: var(--green-700); flex: none; }
.list-item__qty { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.list-item__name { text-decoration: underline dotted var(--line); text-underline-offset: 3px; }
.list-item.is-checked .list-item__name, .list-item.is-checked .list-item__qty { color: var(--ink-faint); text-decoration: line-through; }
.list-item__actions { display: flex; gap: 4px; }
.preview {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px; font-size: .78rem; max-height: 44vh; overflow: auto; white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- garden ---------- */

.now { border-color: var(--green-300); background: var(--green-050); }
.grow-list { display: grid; gap: 14px; }
.grow__name { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 2px; }
.grow p { font-size: .89rem; margin: 0 0 4px; }
.grow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.grow-cell { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.grow-cell p { margin: 3px 0 0; }
.month { border-bottom: 1px solid var(--line); padding: 6px 0; }
.month summary { cursor: pointer; }
.source { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }

/* ---------- dialogs and toast ---------- */

.sheet {
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  margin: auto auto 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}
.sheet--wide { max-width: 860px; }
.sheet::backdrop { background: rgba(8, 20, 15, .48); backdrop-filter: blur(2px); }
.sheet__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px 8px; border-bottom: 1px solid var(--line); }
.sheet__title { font-family: var(--font-display); font-size: 1.15rem; margin: 0; }
.sheet__body { padding: 14px 16px; overflow: auto; max-height: 66vh; }
.sheet__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
@media (min-width: 640px) { .sheet { border-radius: var(--radius); margin: auto; } }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  z-index: 60;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: .88rem;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  max-width: 90vw;
  text-align: center;
}
#toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--warn { background: var(--clay-600); color: #fff; }

/* ---------- accessibility and motion ---------- */

:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- print ---------- */

@media print {
  .appbar, .tabbar, .install-banner, .roller, .recipe-card__actions, .recipe__actions,
  .export-bar, .filters, .results__actions, .linkish, #toast { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .main { max-width: none; padding: 0; }
  .list-item { break-inside: avoid; }
  a[href]::after { content: ""; }
}

/* ---------- shared recipe pages (/r/<slug>/) ---------- */

.share-page .main { max-width: 760px; }
.share-page .appbar { position: static; }
.share-page .recipe { padding-bottom: 40px; }

/* The static page has no checkboxes, so the rows are plain text. */
.ing-list--static li {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.ing-list--static li:last-child { border-bottom: none; }
.ing-list--static .ing__qty { min-width: 96px; }

.share-cta { background: var(--green-050); border-color: var(--green-300); }
.share-cta .row-actions { margin-top: 12px; }

/* ---------- the why page: prose, claims, citations ---------- */

.prose-view { max-width: 700px; margin: 0 auto; }
.prose-view p { line-height: 1.65; }

.hero { padding: var(--sp-6) 0 var(--sp-4); }
.hero__eyebrow {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--green-600); font-weight: 600; margin-bottom: var(--sp-3);
}
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  line-height: 1.1; letter-spacing: -.03em; margin-bottom: var(--sp-4);
}
.hero__lede { font-size: 1.08rem; line-height: 1.62; color: var(--ink-soft); }

.topic + .topic { margin-top: var(--sp-2); }
.subtopic { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.subtopic__title { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: var(--sp-3); }

.claim-list { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: grid; gap: var(--sp-4); }
.claim {
  padding-left: var(--sp-4);
  border-left: 2px solid var(--green-300);
}
.claim__text { margin: 0 0 var(--sp-2); line-height: 1.6; }
.claim__meta { display: flex; flex-wrap: wrap; gap: 6px; }
.claim__detail {
  margin: var(--sp-2) 0 0; font-size: .87rem; line-height: 1.55; color: var(--ink-soft);
}

/* The superscript citation marker. */
.cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin: 0 1px;
  vertical-align: super;
  border: none; border-radius: 5px;
  background: var(--green-050); color: var(--green-700);
  font: inherit; font-size: .64rem; font-weight: 700; line-height: 1;
  cursor: pointer;
  transition: background .15s var(--ease), transform .12s var(--ease);
}
.cite:hover { background: var(--green-300); color: var(--green-900); }
.cite:active { transform: scale(.9); }

.evidence {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .68rem; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase;
  border: 1px solid var(--line); color: var(--ink-faint);
}
.evidence--rct { border-color: var(--green-600); color: var(--green-700); background: var(--green-050); }
.evidence--meta-analysis { border-color: var(--green-300); color: var(--green-700); }
.evidence--guideline,
.evidence--regulatory { border-color: var(--ink-faint); color: var(--ink-soft); }
.evidence--modelling,
.evidence--dataset { border-color: var(--amber-500); color: var(--amber-500); }
.evidence--editorial { border-style: dashed; }

.reference-list { padding-left: 1.4em; margin: var(--sp-3) 0 0; display: grid; gap: var(--sp-3); }
.reference { font-size: .87rem; line-height: 1.5; }
.reference__link {
  border: none; background: none; padding: 0; margin: 0;
  font: inherit; color: var(--ink-soft); text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px;
}
.reference__link:hover { color: var(--ink); text-decoration-color: var(--green-300); }

.source-detail__title { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: var(--sp-2); }
.source-detail__meta { font-size: .88rem; color: var(--ink-soft); margin-bottom: var(--sp-3); }
.source-detail__label {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-faint); margin: var(--sp-4) 0 var(--sp-2);
}
.source-detail__caveat {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4); margin-top: var(--sp-3);
}
.source-detail__caveat p { margin: 0; font-size: .9rem; }
.method { background: var(--surface-2); }

/* ---------- occasions ---------- */

.occasion-strip {
  display: flex; gap: var(--sp-2); overflow-x: auto;
  padding-bottom: var(--sp-2); margin: 0 calc(var(--sp-4) * -1); padding-inline: var(--sp-4);
  scrollbar-width: none;
}
.occasion-strip::-webkit-scrollbar { display: none; }
.occasion {
  flex: none; display: flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: .86rem; cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.occasion:hover { border-color: var(--green-300); }
.occasion.is-on { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.occasion__icon { font-size: 1rem; line-height: 1; }

.upcoming {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--green-050); border-color: var(--green-300);
}
.upcoming__icon { font-size: 26px; line-height: 1; }
.upcoming__body { flex: 1; min-width: 0; }
.upcoming__body strong { display: block; }
.upcoming__body p { margin: 2px 0 0; font-size: .85rem; color: var(--ink-soft); }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .view { animation: view-in .32s var(--ease); }
  @keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

  .sheet { animation: sheet-in .3s var(--ease); }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

  .list-item, .ing { transition: opacity .2s var(--ease); }
  .list-item.is-checked, .ing.is-have { opacity: .62; }

  .recipe-card { transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease); }
  .recipe-card:hover { box-shadow: var(--shadow-lift); }
  .recipe-card.is-locked { transform: translateY(-1px); }
}

/* ---------- the More sheet ---------- */

.tabbar__item { border: none; background: none; font: inherit; cursor: pointer; }
.more-grid { display: grid; gap: var(--sp-2); }
.more-item {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4); border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.more-item:hover { border-color: var(--green-300); background: var(--surface-2); }
.more-item__icon { font-size: 22px; line-height: 1; }
.more-item p { margin: 2px 0 0; }

/* ---------- quieter filter state ---------- */

/* Solid green is reserved for the one action on the screen. A row of five
   filled chips reads as five buttons competing for the same attention. */
.roller__row--filters .chip.is-on {
  background: var(--green-050);
  border-color: var(--green-300);
  color: var(--green-700);
  font-weight: 600;
}
.roller__row--filters .chip.is-on::before {
  content: "✓";
  margin-right: 5px;
  font-size: .82em;
  opacity: .8;
}
.roller__label { min-width: 0; }
.dice { display: inline-block; }

/* ---------- member card: legible, optional-by-default fields ---------- */

.member { padding: var(--sp-4); }
.member__row { gap: var(--sp-2); margin-bottom: var(--sp-2); }
.member .field-grid { gap: var(--sp-3) var(--sp-3); }

.field__label {
  display: flex; align-items: center; gap: 6px;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-faint);
}
.field__optional {
  text-transform: none; letter-spacing: 0; font-size: .92em;
  color: var(--ink-faint); opacity: .8; font-style: italic;
}

/* The "why are you asking?" affordance. Small, always available, never loud. */
.why-btn {
  width: 16px; height: 16px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--ink-faint);
  font: inherit; font-size: .62rem; font-weight: 700; line-height: 1;
  cursor: pointer; padding: 0;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.why-btn:hover { border-color: var(--green-300); color: var(--green-700); }

.member__est {
  margin: var(--sp-4) 0 0; padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
  font-size: .92rem; color: var(--ink);
}
.member__est .muted { display: block; margin-top: 2px; }

.member__hint {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.member__hint .fine-print { flex: 1; min-width: 200px; margin: 0; }

/* Number fields on phones: big enough to hit, no spinner clutter. */
.input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.input[type="number"]::-webkit-outer-spin-button,
.input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input { min-height: 44px; }
.height-input { display: flex; gap: 6px; }
.height-input .input { min-width: 0; }

/* A unit that stays visible after the placeholder has been typed over. */
.unit-pair { position: relative; display: block; flex: 1; min-width: 0; }
.unit-pair .input { width: 100%; padding-right: 30px; }
.unit-pair .unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  color: var(--ink-faint);
  pointer-events: none;
}

/* Unbulleted definition-ish list used inside explanation sheets. */
.plain-list { list-style: none; margin: 12px 0 0; padding: 0; }
.plain-list li { padding: 6px 0; border-top: 1px solid var(--line); font-size: .9rem; }

/* The one-line explanation under an active browse filter. */
.filters__note { margin: 4px 2px 0; }
