/* Ownplate styles. Plain CSS, no framework. Colors are tokens on :root; dark mode follows the
   system setting. Phone first: tabs along the bottom, one column. Wide screens (900px and up)
   get a left rail. Touch targets are at least 48px and body text is 17px. */

/* ---------- colour tokens ---------- */
:root {
  --bg: #fbf5ea;
  --surface: #fffaf2;
  --surface-2: #f3e8d4;
  --ink: #2b2118;
  --muted: #5f4f40;
  --line: #e0cfb4;
  --tomato: #b53a22;
  --tomato-ink: #9b2e1a;
  --on-accent: #ffffff;
  --herb: #3f6e3a;
  --on-herb: #ffffff;
  --focus: #1f5aa6;
  --danger: #a3301c;
  --gold: #f6dfae;
  --gold-ink: #4a2e00;
  --err-bg: #fbe3da;
  --err-ink: #5a1a0d;
  --shadow: 0 8px 24px rgba(60, 35, 10, 0.18);
  /* Recipe tiles: saturation and lightness pairs; the hue comes from the cuisine (--h). */
  --tile-a: 78% 88%;
  --tile-b: 66% 76%;
  --tile-ink: 52% 27%;
  --tile-glow: 100% 97%;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1814;
    --surface: #26201a;
    --surface-2: #322a21;
    --ink: #f6ecdd;
    --muted: #c9b9a2;
    --line: #4a4036;
    --tomato: #ef7458;
    --tomato-ink: #ffb09f;
    --on-accent: #1c1814;
    --herb: #9ccf8f;
    --on-herb: #1c1814;
    --focus: #8ab8ff;
    --danger: #ff8a73;
    --gold: #4d3a14;
    --gold-ink: #ffe7b0;
    --err-bg: #4a1f16;
    --err-ink: #ffd9cf;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    --tile-a: 34% 31%;
    --tile-b: 40% 21%;
    --tile-ink: 75% 82%;
    --tile-glow: 50% 42%;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1c1814;
  --surface: #26201a;
  --surface-2: #322a21;
  --ink: #f6ecdd;
  --muted: #c9b9a2;
  --line: #4a4036;
  --tomato: #ef7458;
  --tomato-ink: #ffb09f;
  --on-accent: #1c1814;
  --herb: #9ccf8f;
  --on-herb: #1c1814;
  --focus: #8ab8ff;
  --danger: #ff8a73;
  --gold: #4d3a14;
  --gold-ink: #ffe7b0;
  --err-bg: #4a1f16;
  --err-ink: #ffd9cf;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  --tile-a: 34% 31%;
  --tile-b: 40% 21%;
  --tile-ink: 75% 82%;
  --tile-glow: 50% 42%;
  color-scheme: dark;
}

/* ---------- base ---------- */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1 { font-size: 30px; line-height: 1.2; margin: 8px 0 4px; }
h2 { font-size: 21px; line-height: 1.25; margin: 0; }
h3 { font-size: 19px; margin: 0 0 6px; }
p { margin: 0; }
img { display: block; }

a { color: var(--tomato-ink); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1:focus { outline: none; }

/* Controls inside clipped containers draw their focus ring inside, so it is never cut off. */
.seg:focus-visible,
.tab:focus-visible,
.check:focus-visible,
.menu-item:focus-visible { outline-offset: -3px; }
.tabs a:focus-visible { outline-offset: -4px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--ink); color: var(--bg);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

.muted { color: var(--muted); }
.label { font-weight: 650; color: var(--ink); }
.hint { color: var(--muted); font-size: 15px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; }
.empty { color: var(--muted); }
.lede { font-size: 19px; }
.summary { color: var(--muted); font-size: 16px; }

.icon {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid var(--line);
  border-top-color: var(--tomato);
  border-radius: 50%;
  vertical-align: -4px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout: phone ---------- */
.shell { display: block; }

.page {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  min-width: 0;
}

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs a {
  flex: 1 1 0;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  border-top: 3px solid transparent;
}
.tabs a .icon { width: 26px; height: 26px; }
.tabs a[aria-current="page"] {
  color: var(--ink);
  border-top-color: var(--tomato);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 750;
  font-size: 20px;
}
.pro-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--herb);
  color: var(--on-herb);
  font-size: 14px;
  font-weight: 750;
}
.topbar .install-btn { margin-left: auto; }

.banner {
  padding: 10px 16px;
  background: var(--gold);
  color: var(--gold-ink);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
}

main {
  padding: 16px;
  max-width: 880px;
  margin: 0 auto;
}
main:focus { outline: none; }
.shop-screen, .settings, .add-screen, .recipe-page, .cook, .welcome, .unlock-box { width: 100%; max-width: 760px; margin: 0 auto; }

.stack { display: grid; gap: 16px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons, inputs, notes ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--tomato); color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--danger); color: var(--on-accent); }
.btn.danger-text { color: var(--danger); }
.btn.big { min-height: 56px; padding: 12px 22px; font-size: 18px; }
.btn.small { min-height: 48px; padding: 8px 14px; font-size: 16px; }
.btn.icon-only { width: 48px; padding: 0; }
.btn.wide { width: 100%; }
.btn .icon { width: 20px; height: 20px; }

.link-btn {
  min-height: 48px;
  padding: 0 4px;
  background: none;
  border: 0;
  color: var(--tomato-ink);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.input,
.select,
textarea.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}
textarea.input { min-height: 120px; resize: vertical; }
.select { width: auto; min-width: 180px; max-width: 100%; }
.file-input { width: 100%; min-height: 52px; font: inherit; }

.stack-field { display: grid; gap: 6px; }
.stack > .stepper, .stack-field > .stepper { justify-self: start; }

.note {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  font-weight: 600;
}
.note.lock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--gold);
  color: var(--gold-ink);
  border-color: transparent;
}
.note.lock p { flex: 1 1 200px; font-weight: 600; }
.note.lock .icon { color: inherit; }

.form-errors:not(:empty) {
  padding: 10px 14px;
  border: 1px solid var(--danger);
  border-radius: 14px;
  background: var(--err-bg);
  color: var(--err-ink);
  font-weight: 600;
}
.form-errors p { margin: 4px 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 750;
}
.badge.lock { background: var(--gold); color: var(--gold-ink); }
.badge .icon { width: 16px; height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 48px;
  padding: 8px 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--herb);
  border-color: var(--herb);
  color: var(--on-herb);
}

.segmented {
  display: inline-flex;
  border: 2px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  max-width: 100%;
}
.seg {
  min-height: 48px;
  padding: 8px 16px;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.seg[aria-checked="true"] { background: var(--herb); color: var(--on-herb); }

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.step-btn {
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
}
.stepper-value {
  min-width: 40px;
  text-align: center;
  font-size: 20px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
}

.tabs-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 16px;
  background: var(--surface-2);
}
.tab {
  min-height: 48px;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--surface); box-shadow: inset 0 0 0 2px var(--tomato), 0 1px 3px rgba(0, 0, 0, 0.12); }
::placeholder { color: var(--muted); opacity: 0.8; }

.toasts {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 60;
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: rise 0.2s ease-out;
}
.toast.error { background: var(--danger); color: var(--on-accent); }
.toast-wrap { pointer-events: auto; }
.toast.action {
  width: 100%;
  min-height: 52px;
  border: 0;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- sheets (native dialog) ---------- */
dialog.sheet {
  width: min(560px, calc(100vw - 24px));
  max-height: 88vh;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(20, 12, 6, 0.5); }
.sheet-inner {
  display: grid;
  gap: 14px;
  max-height: 88vh;
  overflow: auto;
  padding: 20px;
}
.sheet-title { font-size: 22px; }
.sheet-body { display: grid; gap: 10px; }
.sheet-actions {
  position: sticky;
  bottom: -20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 -20px -20px;
  padding: 12px 20px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.filters-dialog .sheet-actions .btn,
.plan-dialog .sheet-actions .btn.big { flex: 1 1 120px; }
.plan-dialog .sheet-actions .btn.big { padding: 12px 14px; white-space: nowrap; }
.plan-dialog .sheet-actions .btn.primary { flex-grow: 1.5; }
.menu-sheet .sheet-title { font-size: 20px; }

/* ---------- cards and lists ---------- */
.card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.recipe-card { display: grid; gap: 4px; }
.recipe-title { font-size: 19px; font-weight: 700; }
.fav-mark { display: inline-flex; align-items: center; color: var(--tomato); margin-left: 6px; }
.fav-mark .icon { width: 18px; height: 18px; fill: currentColor; }

.panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.setting-row > .label { flex: 0 1 auto; }

/* ---------- recipe tiles (no photos: cuisine color + drawn protein) ---------- */
.tile {
  --h: 30;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 18%, hsl(var(--h) var(--tile-glow) / 0.55), transparent 55%),
    linear-gradient(135deg, hsl(var(--h) var(--tile-a)), hsl(calc(var(--h) + 16) var(--tile-b)));
  color: hsl(var(--h) var(--tile-ink));
}
.glyph {
  width: 56px; height: 56px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile-card { height: 96px; border-radius: 17px 17px 0 0; }
.tile-card .glyph { width: 64px; height: 64px; }
.tile-row { width: 56px; height: 56px; flex: none; border-radius: 14px; }
.tile-row .glyph { width: 36px; height: 36px; stroke-width: 2.8; }
.tile-hero { height: 124px; border-radius: 22px; }
.tile-hero .glyph { width: 88px; height: 88px; stroke-width: 2; }
@media (min-width: 900px) {
  .tile-hero { height: 168px; }
  .tile-hero .glyph { width: 112px; height: 112px; }
}
.tile-missing { background: var(--surface-2); }
.tile-lock {
  position: absolute;
  top: 8px; right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--gold-ink);
  font-size: 14px;
  font-weight: 750;
}
.tile-lock .icon { width: 15px; height: 15px; }
.tile-row .tile-lock { top: auto; right: 2px; bottom: 2px; padding: 3px; }
.tile-row .tile-lock .icon { width: 13px; height: 13px; }

/* ---------- plan ---------- */
.plan-screen { max-width: 760px; width: 100%; margin: 0 auto; }
.week-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.week-title { text-align: center; }
.week-dates { margin: 0; font-size: 20px; font-weight: 750; }

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.strip-day {
  min-height: 60px;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  min-width: 0;
}
.strip-day.today { border-color: var(--tomato); }
.strip-name { font-size: 13px; font-weight: 750; text-transform: uppercase; }
.strip-num { font-size: 18px; font-weight: 750; line-height: 1.2; }
.strip-dot { width: 7px; height: 7px; margin-top: 2px; border-radius: 50%; }
.strip-day.has .strip-dot { background: var(--herb); }

.empty-hero {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
.empty-hero h2 { font-size: 22px; }

.list-cta { justify-content: flex-start; gap: 8px; }
.list-cta span { white-space: nowrap; }
.list-cta .cta-text { font-weight: 750; }
.list-cta .cta-count { font-weight: 600; opacity: 0.92; }
.list-cta .icon-arrowRight { margin-left: auto; }

/* One card holding seven slim rows: day label on the left, dinners or "Add dinner" on the right. */
.week-days {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}
.day {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.day:first-child { border-top: 0; }
.day.today { box-shadow: inset 4px 0 0 var(--tomato); }
.day-label { display: grid; font-size: 16px; line-height: 1.2; margin: 0; }
.day-name { font-weight: 750; text-transform: uppercase; letter-spacing: 0.04em; font-size: 14px; }
.day-date { color: var(--muted); font-weight: 500; font-size: 14px; }
.day.today .day-name { color: var(--tomato-ink); }
.day-body { display: grid; gap: 6px; min-width: 0; }
.day-none { padding: 12px 0; }

.add-dinner {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 6px 14px 6px 10px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.add-dinner:hover { color: var(--ink); border-color: var(--muted); }
.add-dinner .icon { width: 20px; height: 20px; }

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
}
.entry-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  min-width: 0;
  padding: 2px;
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
}
.entry-text { display: grid; min-width: 0; }
.entry-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.entry-meta { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry.missing .entry-title { color: var(--muted); }
.btn.ghost.more-btn { flex: none; border-color: transparent; color: var(--muted); }
.btn.ghost.more-btn:hover { border-color: var(--line); color: var(--ink); }
.icon-more { stroke-width: 3.4; }

.uses-up {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 16px;
}

.plan-result { display: grid; gap: 10px; }
.plan-preview { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-size: 18px; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.pick {
  width: 100%;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pick-title { font-weight: 700; }
.pick.is-locked { opacity: 0.8; }
.day-pick { display: grid; gap: 8px; }
.day-pick .btn { justify-content: flex-start; }

/* ---------- menus ("⋯" sheets) ---------- */
.menu { display: grid; gap: 14px; }
.menu-controls { display: grid; gap: 10px; padding-bottom: 4px; }
.menu-controls .select { min-width: 0; flex: 1 1 180px; }
.menu-items { display: grid; border-top: 1px solid var(--line); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger-text { color: var(--danger); }

/* ---------- recipes ---------- */
.chip-scroll {
  display: flex;
  gap: 8px;
  margin: -4px -16px;
  padding: 4px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll .chip { flex: none; white-space: nowrap; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.filter-btn { flex: none; }
.filter-badge {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--herb);
  color: var(--on-herb);
  font-size: 14px;
  font-weight: 800;
}
.wide-select { width: 100%; }
.filter-sheet { gap: 18px; }
.filter-sheet .segmented { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; }
.filter-sheet .seg { padding: 8px 4px; }
.count { margin: 0; }
.recipe-grid { grid-template-columns: minmax(0, 1fr); }
.recipe-card { display: flex; flex-direction: column; height: 100%; padding: 0; overflow: hidden; }
.recipe-card-body { display: grid; gap: 4px; padding: 12px 16px 16px; }
.card-facts { font-size: 15px; }
.recipe-card .summary {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  color: var(--tomato-ink);
  font-weight: 650;
  text-decoration: none;
  justify-self: start;
}
.recipe-page { gap: 14px; }
.recipe-head { display: grid; gap: 6px; }
.recipe-head h1 { margin: 0; }
.facts-line { font-size: 17px; font-weight: 650; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.recipe-actions { gap: 10px; }
.fav-btn.on { color: var(--tomato-ink); border-color: var(--tomato); }
.fav-btn.on .icon { fill: currentColor; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.servings-label { margin-top: -6px; }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}
.ingredients li:last-child { border-bottom: 0; }
.amount { font-weight: 750; font-variant-numeric: tabular-nums; }

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding-left: 48px;
  font-size: 18px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--herb);
  color: var(--on-herb);
  font-weight: 750;
}

/* ---------- cook mode ---------- */
.cook { min-height: calc(100vh - 150px); gap: 12px; }
.cook-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cook-recipe { font-weight: 650; }
.step-text {
  margin: 4px 0;
  font-size: clamp(26px, 6.5vw, 36px);
  line-height: 1.32;
  font-weight: 600;
}
.progress { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--herb); transition: width 0.25s ease; }
.step-times { display: grid; gap: 8px; }
.time-btn { justify-content: flex-start; }
.timers { display: grid; gap: 8px; }
.timer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid var(--herb);
  border-radius: 14px;
  background: var(--surface);
}
.timer.done { border-color: var(--tomato); }
.timer-label { flex: 1 1 140px; font-weight: 650; }
.timer-time { min-width: 80px; font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; }
.drawer { padding: 6px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.drawer[hidden] { display: none; }
.cook-nav-row {
  position: sticky;
  bottom: calc(72px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: auto;
  padding: 10px 0 4px;
  background: var(--bg);
}
.cook-nav { width: 100%; }
.celebrate {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.celebrate .icon { width: 56px; height: 56px; color: var(--herb); stroke-width: 2.4; }

/* ---------- grocery list ---------- */
.add-extra { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.units-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.aisle h2 { margin: 8px 0 0; font-size: 17px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tomato-ink); }
.shop-list { list-style: none; margin: 0; padding: 0; }
.shop-line {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.check {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
}
.box {
  flex: none;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--muted);
  border-radius: 9px;
  background: var(--surface);
}
.box .icon { width: 22px; height: 22px; stroke-width: 3; color: var(--on-herb); }
.shop-body { display: grid; min-width: 0; }
.shop-text { overflow-wrap: anywhere; line-height: 1.3; }
.shop-text .amount { font-weight: 750; }
.shop-for {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shop-line.done .box { background: var(--herb); border-color: var(--herb); }
.shop-line.done .shop-text { text-decoration: line-through; color: var(--muted); }
.pantry-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  background: var(--surface);
}
.pantry-group summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
}
.pantry-group .shop-line:last-child { border-bottom: 0; }
.pantry-note { font-size: 15px; }
.list-tools { display: grid; gap: 12px; justify-items: start; padding-top: 4px; }
.restore-row { color: var(--muted); }

/* ---------- settings, add, welcome, unlock ---------- */
.radio { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: 17px; }
.radio input { width: 24px; height: 24px; accent-color: var(--herb); }
.modes { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.more summary { min-height: 48px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.more > div { display: grid; gap: 10px; padding-bottom: 6px; }
.recipe-form { gap: 16px; }
.welcome { gap: 18px; padding-top: 12px; }
.unlock-box { gap: 16px; }
.empty-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.install-hint { margin: 0; }

/* ---------- wide screens: a left rail instead of the bottom bar ---------- */
@media (min-width: 900px) {
  .shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
  }
  .tabs {
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    padding: 20px 12px;
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .tabs a {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    min-height: 52px;
    padding: 0 14px;
    border-top: 0;
    border-left: 4px solid transparent;
    border-radius: 14px;
    font-size: 17px;
  }
  .tabs a[aria-current="page"] {
    background: var(--surface-2);
    border-left-color: var(--tomato);
  }
  .page { padding-bottom: 0; }
  .topbar { padding: 16px 32px; }
  main { padding: 24px 32px 56px; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  main { max-width: 1040px; }
  .chip-scroll { margin: -4px 0; padding: 4px 0; flex-wrap: wrap; overflow: visible; }
  .toasts {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: min(380px, calc(100vw - 48px));
  }
  .cook-nav-row { bottom: 0; }
}

/* Recipe grid: two columns on tablets, three on wide screens. */
@media (min-width: 640px) {
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1180px) {
  .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Small phones (320px): tighter gutters so nothing overflows. */
@media (max-width: 360px) {
  main { padding: 12px; }
  .topbar { padding: 10px 12px; }
  h1 { font-size: 26px; }
  .btn.big { padding: 12px 16px; font-size: 17px; }
  .day-strip { gap: 3px; }
  .strip-name { font-size: 11px; }
  .chip-scroll { margin: -4px -12px; padding: 4px 12px; }
  .tabs a { font-size: 13px; }
  .list-cta { padding: 12px 14px; }
  .topbar .install-btn { padding: 8px 10px; }
  .topbar .install-btn .icon { display: none; }
  .brand { font-size: 18px; gap: 8px; }
  .list-cta .icon-list { display: none; }
  .day { grid-template-columns: 46px minmax(0, 1fr); gap: 6px; padding: 6px 4px 6px 10px; }
  .entry-main { gap: 10px; }
  .tile-row { width: 44px; height: 44px; border-radius: 12px; }
  .tile-row .glyph { width: 30px; height: 30px; }
  .entry-title { font-size: 16px; }
  .entry-meta { font-size: 14px; }
}

/* ---------- motion: respect the user's setting ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .spinner { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }
}
