:root {
  --paper: #E4E8EA;
  --dot: rgba(26, 34, 48, 0.13);
  --ink: #1A2230;
  --muted: #525D6B;
  --window: #FFFFFF;
  --sunk: #F1F3F5;
  --select: #2448C8;
  --select-ink: #FFFFFF;
  --good: #2E7D3A;
  --warn: #B3261E;
  --star: #F7C948;
  --pixel: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --pxw: 700;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121A22;
    --dot: rgba(221, 227, 234, 0.08);
    --ink: #DDE3EA;
    --muted: #9AA6B3;
    --window: #1C2631;
    --sunk: #16202A;
    --select: #5B7CFF;
    --good: #6CCB7A;
    --warn: #FF8A80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121A22;
  --dot: rgba(221, 227, 234, 0.08);
  --ink: #DDE3EA;
  --muted: #9AA6B3;
  --window: #1C2631;
  --sunk: #16202A;
  --select: #5B7CFF;
  --good: #6CCB7A;
  --warn: #FF8A80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* No double-tap zoom: quick taps on the list or the stars never zoom by accident (and respond without the
   300 ms wait). Pinch zoom stays on for anyone who needs things bigger. */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; font-size: 17px; }
/* Text follows the iPhone's text size (Dynamic Type): font sizes are in rem, and on Apple devices the root is
   the system body size (17 px at the default setting). Settings, Text size overrides it on any device. */
@supports (font: -apple-system-body) { html { font: -apple-system-body; } }
html[data-text="large"] { font-size: 19px; }
html[data-text="larger"] { font-size: 21px; }
/* iOS zooms into fields with text under 16 px; never let them get that small. */
input, select, textarea { font-size: max(16px, 1rem); }
body {
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 16px 16px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
body.has-timers { padding-bottom: calc(76px + var(--safe-b)); }

a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px dotted var(--ink);
  outline-offset: 3px;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.px { font-family: var(--pixel); font-weight: var(--pxw); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Page frame ---------- */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-t)) 12px calc(28px + var(--safe-b));
}
@media (min-width: 700px) { .page { padding: calc(32px + var(--safe-t)) 24px 48px; } }

/* ---------- Retro window chrome ---------- */
.win {
  background: var(--window);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
}
.titlebar {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px;
  border-bottom: 2px solid var(--ink);
  background: var(--window);
}
.screen > .titlebar { position: sticky; top: 0; z-index: 5; }
.tb-left { justify-self: start; display: flex; }
.tb-right { justify-self: end; display: flex; gap: 6px; }
.wintitle {
  font-family: var(--pixel);
  font-weight: var(--pxw);
  font-size: 1rem;
  margin: 0;
  padding: 0 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.titlebar > .wintitle:only-child { grid-column: 1 / -1; }
.backbtn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 32px;
  padding: 0;
  border: 2px solid var(--ink);
  background: var(--window);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  position: relative;
}
.backbtn svg { width: 18px; height: auto; display: block; }
.backbtn svg.ic24 { width: 24px; height: 24px; }
#modal-close svg { width: 14px; }
.backbtn::after { content: ""; position: absolute; inset: -8px; } /* bigger tap target */

.backbtn:active { box-shadow: none; transform: translate(2px, 2px); }
.tb-btn {
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.8824rem;
  border: 2px solid var(--ink);
  background: var(--window);
  padding: 1px 8px;
  cursor: pointer;
  flex: none;
  text-decoration: none;
  color: var(--ink);
}

.wbody { padding: 18px 16px 22px; }
@media (min-width: 700px) { .wbody { padding: 24px 28px 30px; } }
.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 2px solid var(--ink);
  padding: 6px 10px;
  font-size: 0.8235rem;
  color: var(--muted);
}

/* ---------- Home ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 4px 26px; }
.hero h1 {
  font-family: var(--pixel);
  font-weight: var(--pxw);
  font-size: clamp(46px, 14vw, 80px);
  line-height: 0.95;
  margin: 0;
}
.hero h1 span { display: block; }
.hero p { font-family: var(--pixel); font-weight: var(--pxw); font-size: 1rem; margin: 12px 0 0; color: var(--muted); }
.icons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px 8px;
  padding: 26px 10px 24px;
}
@media (min-width: 560px) { .icons { grid-template-columns: repeat(4, 1fr); gap: 30px 8px; padding: 34px 16px 30px; } }
.icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.icon svg { width: 68px; height: 68px; display: block; }
@media (min-width: 560px) { .icon svg { width: 76px; height: 76px; } }
.icon .label {
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.9412rem;
  line-height: 1.3;
  text-align: center;
  padding: 1px 5px;
}
.icon .badge { font-size: 0.7647rem; color: var(--muted); margin-top: -8px; font-family: var(--body); }
.icon:focus-visible .label { background: var(--select); color: var(--select-ink); }
.icon:focus-visible svg { filter: brightness(0.85); }
.icon:active svg { transform: translate(2px, 2px); }
.today { margin-top: 22px; }
.today .wbody { padding-top: 14px; padding-bottom: 16px; }
.today h2 { font-family: var(--pixel); font-weight: var(--pxw); font-size: 1.0588rem; margin: 0 0 8px; }
.today ul { margin: 0; padding: 0; list-style: none; }
.today li { padding: 6px 0; border-bottom: 2px dotted var(--sunk); display: flex; gap: 12px; }
.today li:last-child { border-bottom: 0; }
.today .slot { font-family: var(--pixel); font-weight: var(--pxw); color: var(--muted); width: 88px; flex: none; font-size: 0.8824rem; }

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.9412rem;
  color: var(--ink);
  background: var(--window);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 14px;
  min-height: 42px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:active { box-shadow: none; transform: translate(3px, 3px); }
.btn.primary { background: var(--select); color: var(--select-ink); }

.btn.danger { color: var(--warn); }

.btn.small { font-size: 0.8235rem; min-height: 34px; padding: 4px 10px; box-shadow: 2px 2px 0 var(--ink); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btnrow { display: flex; flex-wrap: wrap; gap: 12px 12px; margin: 16px 0; }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.8824rem; margin-bottom: 4px; }
.field small { display: block; color: var(--muted); font-size: 0.8235rem; margin-top: 4px; font-family: var(--body); }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* ≥16px so iOS doesn't zoom */
  color: var(--ink);
  background: var(--window);
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 9px 10px;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
.inline { display: flex; gap: 8px; align-items: stretch; }
.inline > input { flex: 1; min-width: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.seg { display: inline-flex; border: 2px solid var(--ink); }
.seg button {
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.8824rem;
  border: 0;
  border-right: 2px solid var(--ink);
  background: var(--window);
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--window); }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 36px; }
.check input { width: 22px; height: 22px; accent-color: var(--select); flex: none; margin: 0; }

.stepper { display: inline-flex; align-items: center; border: 2px solid var(--ink); }
.stepper button { width: 38px; height: 36px; border: 0; background: var(--window); font-family: var(--pixel); font-weight: var(--pxw); font-size: 1.1765rem; cursor: pointer; }

.stepper output { min-width: 44px; text-align: center; font-family: var(--pixel); font-weight: var(--pxw); font-size: 1.0588rem; border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); line-height: 36px; padding: 0 4px; }

/* ---------- Chips / tags ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.8235rem;
  border: 2px solid var(--ink);
  background: var(--window);
  padding: 3px 9px;
  min-height: 32px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--select); color: var(--select-ink); border-color: var(--select); }
.chip .x { font-family: var(--body); font-size: 0.7647rem; opacity: 0.7; }
.tag { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.7647rem; color: var(--muted); }
.tag + .tag::before { content: "· "; }
.chipscroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.chipscroll::-webkit-scrollbar { display: none; }

/* ---------- Section headings ---------- */
h2.sect, h3.sect {
  font-family: var(--pixel);
  font-weight: var(--pxw);
  font-size: 1.1765rem;
  margin: 26px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px dotted var(--muted);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
h2.sect:first-child, h3.sect:first-child { margin-top: 0; }
.sect small { font-family: var(--body); font-size: 0.8235rem; color: var(--muted); }

/* ---------- Recipe book ---------- */
.search { position: relative; margin-bottom: 12px; }
.filters { margin-bottom: 6px; }
.more-tags { margin: 4px 0 10px; }
.more-tags summary { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.8824rem; cursor: pointer; color: var(--muted); padding: 4px 0; }
.more-tags .chips { margin-top: 8px; }
.sortrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0 4px; font-size: 0.8235rem; color: var(--muted); }
.sortrow select { width: auto; font-size: 0.9412rem; padding: 4px 30px 4px 8px; }
.cards { list-style: none; padding: 0; margin: 0; }
.card { border-bottom: 2px dotted var(--muted); }
.card:last-child { border-bottom: 0; }
.card a { display: block; padding: 14px 4px; text-decoration: none; }
.card a:focus-visible .ctitle { background: var(--select); color: var(--select-ink); }
.ctitle { font-weight: 700; font-size: 1.0588rem; line-height: 1.3; display: inline; padding: 0 2px; margin: 0 -2px; }
.cmeta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 0.8824rem; color: var(--muted); margin-top: 4px; align-items: center; }
.cmeta .mstars { color: var(--ink); letter-spacing: 1px; }
.cmeta .ccost { flex-basis: 100%; }  /* price always gets its own line, in the same spot on every card */
.ctags { margin-top: 3px; }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty .px { font-size: 1.1765rem; color: var(--ink); display: block; margin-bottom: 8px; }

/* ---------- Recipe view ---------- */
.rtitle { font-family: var(--pixel); font-weight: var(--pxw); font-size: clamp(28px, 7vw, 38px); line-height: 1.12; margin: 0 0 6px; }
.rsource { font-size: 0.8824rem; color: var(--muted); margin: 0 0 12px; }
.stars { display: inline-flex; gap: 2px; margin: 0 0 14px -4px; }
.stars button { border: 0; background: none; padding: 4px; cursor: pointer; line-height: 0; min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; } /* 44 pt tap targets */
.stars svg { width: 28px; height: auto; }
.stars .off svg { opacity: 0.22; filter: grayscale(1); }
.stars.show { margin: 0; }
.stars.show span { padding: 4px; line-height: 0; }
.stars.small svg { width: 20px; }
.stars.small { margin: 0; }
.ratingbox { margin: 0 0 14px; }
.ravg, .rmine { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ravg { margin-left: -4px; }
.rmine { font-size: 0.8235rem; margin-top: 2px; }
.rwho { font-size: 0.8235rem; margin: 2px 0 0; }
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px 18px;
  padding: 14px 0;
  margin: 0 0 14px;
  border-top: 2px dotted var(--muted);
  border-bottom: 2px dotted var(--muted);
}
.facts dt { color: var(--muted); font-size: 0.8235rem; }
.facts dd { margin: 2px 0 0; font-size: 1rem; }
.est { color: var(--muted); }
.ings { list-style: none; margin: 0; padding: 0; }
.ings li { border-bottom: 1px solid var(--sunk); }
.ings li:last-child { border-bottom: 0; }
.ings label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; cursor: pointer; font-size: 1.0588rem; line-height: 1.4; }
.ings input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--select); flex: none; }
.ings .amt { font-weight: 700; white-space: nowrap; }
.ings button.amt { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 4px; font-weight: 700; font-size: inherit; }
.ings li.done label { color: var(--muted); text-decoration: line-through; }
.ings li.hdr, .steps li.hdr { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.9412rem; padding: 14px 0 4px; color: var(--muted); border-bottom: 0; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li.step { counter-increment: step; display: flex; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--sunk); cursor: pointer; font-size: 1.0588rem; line-height: 1.55; }
.steps li.step::before {
  content: counter(step);
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.9412rem;
  flex: none;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.steps li.step.done { color: var(--muted); }
.steps li.step.done::before { content: "✓"; background: var(--ink); color: var(--window); }
.steps li.step.current::before { background: var(--select); color: var(--select-ink); border-color: var(--select); }
.stepbody { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.timelink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.9412rem;
  color: var(--ink);
  border: 2px solid var(--ink);
  background: var(--window);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 4px 12px 4px 9px;
  min-height: 38px;
  cursor: pointer;
  white-space: nowrap;
}
.timelink svg { width: 20px; height: auto; display: block; }

.timelink:active { box-shadow: none; transform: translate(2px, 2px); }
body.cook .timelink { font-size: 1.0588rem; min-height: 44px; }
.nutri { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; margin: 0 0 10px; }
.nutri div { border: 2px solid var(--ink); padding: 8px 10px; }
.nutri b { display: block; font-family: var(--pixel); font-weight: var(--pxw); font-size: 1.2941rem; line-height: 1.1; }
.nutri span { font-size: 0.7647rem; color: var(--muted); }
.breakdown { font-size: 0.8235rem; }
.breakdown summary { cursor: pointer; font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.8824rem; color: var(--muted); padding: 6px 0; }
.breakdown table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.breakdown td { padding: 4px 4px; border-bottom: 1px solid var(--sunk); vertical-align: top; }
.breakdown td.n { text-align: right; white-space: nowrap; }
.breakdown tr.miss td { color: var(--warn); }
.notesbox textarea { min-height: 110px; }
.saved { font-size: 0.7647rem; color: var(--muted); height: 18px; }
.cookbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: space-between; margin: 0 0 8px; }

body.cook .ings label { font-size: 1.2353rem; padding: 13px 2px; }
body.cook .steps li.step { font-size: 1.2941rem; line-height: 1.6; padding: 16px 2px; }
body.cook .hide-cook { display: none !important; }
.cook-on { display: none; }
body.cook .cook-on { display: inline-flex; }

/* ---------- Popover (unit conversions) ---------- */
.pop {
  position: absolute;
  z-index: 30;
  max-width: 260px;
  padding: 10px 12px;
  font-size: 0.9412rem;
}
.pop ul { margin: 0; padding: 0; list-style: none; }
.pop li { padding: 3px 0; border-bottom: 1px dotted var(--muted); }
.pop li:last-child { border-bottom: 0; }
.pop .px { font-size: 0.8235rem; color: var(--muted); display: block; margin-bottom: 4px; }

/* ---------- Plan ---------- */
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.weeknav .wk { font-family: var(--pixel); font-weight: var(--pxw); font-size: 1.0588rem; text-align: center; flex: 1; }
.weeknav .wk small { display: block; font-family: var(--body); font-size: 0.7647rem; color: var(--muted); }
.banner {
  border: 2px dashed var(--muted);
  padding: 10px 12px;
  font-size: 0.8824rem;
  margin: 0 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  justify-content: space-between;
}
.banner .px { font-size: 0.9412rem; }
.day { border: 2px solid var(--ink); margin: 0 0 14px; background: var(--window); }
.day.today-day { box-shadow: 4px 4px 0 var(--select); }
.dayhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 6px 10px; border-bottom: 2px solid var(--ink); background: var(--sunk); }
.dayhead .px { font-size: 1rem; }
.dayhead small { font-size: 0.7647rem; color: var(--muted); }
.slotrow { display: grid; grid-template-columns: 84px 1fr; border-bottom: 1px dotted var(--muted); min-height: 46px; }
.slotrow:last-child { border-bottom: 0; }
.slotname { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.8235rem; color: var(--muted); padding: 12px 0 0 10px; }
.slotmeals { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 8px; align-items: center; }
.mealchip {
  border: 2px solid var(--ink);
  background: var(--window);
  font-size: 0.8824rem;
  font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  max-width: 100%;
}
.mealchip.left { font-weight: 400; border-style: dashed; }
.mealchip .lo { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.7059rem; color: var(--muted); margin-left: 4px; }


.addslot { border: 2px dashed var(--muted); background: none; color: var(--muted); font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.8235rem; padding: 4px 10px; cursor: pointer; min-height: 32px; }

.preplist { list-style: none; margin: 0; padding: 0; }
.preplist li { padding: 10px 0; border-bottom: 2px dotted var(--sunk); }
.preplist li:last-child { border-bottom: 0; }
.slotpick { display: grid; grid-template-columns: 70px repeat(3, 1fr); gap: 4px 6px; align-items: center; font-size: 0.8235rem; }
.slotpick .h { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.7647rem; color: var(--muted); text-align: center; }
.slotpick .d { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.8235rem; }
.slotpick label { display: grid; place-items: center; min-height: 36px; border: 2px solid var(--sunk); cursor: pointer; }
.slotpick input { width: 20px; height: 20px; accent-color: var(--select); margin: 0; }
.slotpick label:has(input:checked) { border-color: var(--select); }
.picklist { list-style: none; margin: 8px 0 0; padding: 0; max-height: 46dvh; overflow: auto; border-top: 2px dotted var(--muted); }
.picklist button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--sunk); background: none; padding: 10px 4px; cursor: pointer; }


.picklist b { display: block; font-size: 1rem; }
.picklist .muted { font-size: 0.8235rem; }

/* ---------- Grocery ---------- */
.ask { border: 2px solid var(--ink); background: var(--sunk); padding: 12px; margin: 0 0 18px; }
.ask h3 { font-family: var(--pixel); font-weight: var(--pxw); font-size: 1rem; margin: 0 0 4px; }
.ask p { margin: 0 0 8px; font-size: 0.8235rem; color: var(--muted); }
.askrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px dotted var(--muted); }
.askrow .nm { font-weight: 700; }
.askrow small { display: block; font-weight: 400; color: var(--muted); font-size: 0.7647rem; }
.askrow .btns { display: flex; gap: 8px; flex: none; }
.aisle { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.8824rem; color: var(--muted); margin: 18px 0 2px; }
.aisle:first-child { margin-top: 0; }
.gl { list-style: none; margin: 0; padding: 0; }
.gl li { display: flex; align-items: flex-start; gap: 6px; border-bottom: 1px solid var(--sunk); }
.gl label { flex: 1; display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; cursor: pointer; min-width: 0; }
.gl input[type="checkbox"] { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--select); flex: none; }
.gl .nm { font-size: 1.0588rem; font-weight: 700; }
.gl .am { font-size: 0.9412rem; }
.gl small { display: block; color: var(--muted); font-size: 0.7647rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; }
.gl li.got .nm, .gl li.got .am { color: var(--muted); text-decoration: line-through; font-weight: 400; }
.iconbtn { border: 0; background: none; color: var(--muted); font-size: 1.0588rem; width: 40px; min-height: 44px; cursor: pointer; flex: none; }

.iconbtn.edit { width: 34px; }

.gl small.inote { color: var(--ink); font-style: italic; }
.have summary { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.9412rem; cursor: pointer; padding: 8px 0; }
.have li { align-items: center; }
.have .nm { font-weight: 400; font-size: 0.9412rem; padding: 10px 2px; flex: 1; }

/* ---------- Pantry ---------- */
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--sunk); }
.plist .kind { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.7059rem; color: var(--muted); margin-left: 6px; }

/* ---------- Converter ---------- */
.eqs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.eqs div { border: 2px solid var(--ink); padding: 10px; font-family: var(--pixel); font-weight: var(--pxw); font-size: 1.1765rem; text-align: center; }
.ref { width: 100%; border-collapse: collapse; font-size: 0.9412rem; }
.ref td { padding: 7px 4px; border-bottom: 1px dotted var(--muted); }
.ref td:last-child { text-align: right; font-family: var(--pixel); font-weight: var(--pxw); }

/* ---------- Settings ---------- */
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--sunk); flex-wrap: wrap; }
.setrow > span { font-weight: 700; }
.setrow small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8235rem; }
.setrow input[type="number"] { width: 110px; }
.savedtag { display: inline !important; margin-left: 8px; color: var(--good) !important; font-weight: 700 !important; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 0.7647rem; background: var(--sunk); border: 2px solid var(--ink); padding: 8px; word-break: break-all; user-select: all; -webkit-user-select: all; }
.note {
  border: 2px dashed var(--muted);
  color: var(--muted);
  font-size: 0.8824rem;
  padding: 10px 12px;
  margin: 12px 0;
}
.note b { color: var(--ink); }
.error { border-color: var(--warn); color: var(--warn); }
.error ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.7647rem; }
ol.howto { padding-left: 22px; margin: 8px 0; }
ol.howto li { margin-bottom: 6px; }

/* ---------- Dialog ---------- */
dialog.win {
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px);
  overflow: hidden;
}
dialog.win[open] { display: flex; flex-direction: column; animation: pop 0.2s steps(4, end); }
dialog .wbody { overflow: auto; }
dialog::backdrop {
  background-image: conic-gradient(rgba(10, 16, 24, 0.4) 25%, transparent 0 50%, rgba(10, 16, 24, 0.4) 0 75%, transparent 0);
  background-size: 4px 4px;
}
@keyframes pop {
  from { transform: scale(0.55); opacity: 0.3; }
  to { transform: none; opacity: 1; }
}

/* ---------- Timers ---------- */
.timerdock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: var(--window);
  border-top: 2px solid var(--ink);
}
.timer { display: flex; align-items: center; gap: 8px; border: 2px solid var(--ink); padding: 4px 4px 4px 10px; flex: none; background: var(--window); }
.timer .ticon { width: 18px; height: auto; flex: none; }
.timer .tlabel { font-size: 0.7647rem; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer .tclock { font-family: var(--pixel); font-weight: var(--pxw); font-size: 1.2941rem; min-width: 62px; }
.timer.paused .tclock { opacity: 0.5; }
.timer.done { background: var(--select); color: var(--select-ink); animation: blink 1s steps(2, start) infinite; }
.timer.done .tlabel { color: inherit; }
.tbtn { width: 36px; height: 36px; border: 2px solid currentColor; background: none; cursor: pointer; font-size: 0.7647rem; }
@keyframes blink { to { background: var(--window); color: var(--ink); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 50;
  font-family: var(--pixel); font-weight: var(--pxw);
  font-size: 0.8824rem;
  padding: 8px 14px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
body.has-timers .toast { bottom: calc(92px + var(--safe-b)); }

@media (prefers-reduced-motion: reduce) {
  dialog.win[open], .timer.done { animation: none; }
  .btn:active, .icon:active svg { transform: none; }
}

@media print {
  body { background: #fff; }
  .titlebar button, .btnrow, .cookbar, .hide-print, .timerdock { display: none !important; }
  .win { box-shadow: none; }
}

/* ---------- Prices ---------- */
.pricerow { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 0; background: none; padding: 4px 0; cursor: pointer; text-align: left; font-size: 0.9412rem; }
.pricerow .pr { font-family: var(--pixel); font-weight: var(--pxw); white-space: nowrap; }
.pricerow .pr small { font-family: var(--body); color: var(--muted); font-size: 0.7647rem; }


/* ---------- Add from text / photo ---------- */
.fromtext { border: 2px solid var(--ink); padding: 10px 12px; margin: 18px 0; background: var(--sunk); }
.fromtext summary { font-family: var(--pixel); font-weight: var(--pxw); font-size: 1rem; cursor: pointer; padding: 4px 0; }
.fromtext[open] summary { margin-bottom: 6px; }
.photoprev { display: block; max-width: 100%; max-height: 70dvh; margin: 0 auto 14px; border: 2px solid var(--ink); -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* ---------- Plan: move / swap ---------- */
.dayright { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.daybtn { border: 2px solid var(--ink); background: var(--window); font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.7647rem; padding: 2px 8px; cursor: pointer; min-height: 30px; }

.movebar { position: sticky; top: 52px; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin: 0 0 14px; font-size: 0.8824rem; box-shadow: 3px 3px 0 var(--select); }
.slotrow.target { cursor: pointer; background-image: repeating-linear-gradient(135deg, transparent 0 8px, var(--sunk) 8px 16px); }
.slotrow.target:focus-visible { outline: 2px dashed var(--select); outline-offset: -3px; }
.slotrow.target .mealchip { pointer-events: none; }
.slotrow.source { background: var(--sunk); }
.slotrow.source .mealchip { background: var(--select); color: var(--select-ink); border-color: var(--select); }
.day.source { box-shadow: 4px 4px 0 var(--select); }
.droptag { font-family: var(--pixel); font-weight: var(--pxw); font-size: 0.7647rem; color: var(--select); border: 2px dashed var(--select); padding: 3px 8px; }
.actlist { display: flex; flex-direction: column; gap: 12px; }
.actlist .btn { width: 100%; }
.slotpick .taken { display: grid; place-items: center; min-height: 36px; border: 2px dashed var(--muted); background: var(--sunk); color: var(--muted); font-size: 0.6471rem; line-height: 1.15; text-align: center; padding: 2px; overflow: hidden; word-break: break-word; cursor: not-allowed; }

/* ---------- Inline ingredient editing ---------- */
.ings li.ingedit { display: flex; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 0; }
.ings li.ingedit input { flex: 1; min-width: 0; font-size: 1rem; padding: 8px 10px; }

/* ---------- Fill in ingredient info ---------- */
.fillitem { border: 2px solid var(--ink); margin: 0 0 12px; padding: 6px 10px 10px; }
.fillitem legend { font-family: var(--pixel); font-weight: var(--pxw); padding: 0 4px; }
.fillitem > small { display: block; margin-bottom: 6px; }
.fillrow { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 6px 0; }
.fillrow input { width: 64px; }
.fillrow select { width: auto; min-width: 78px; flex: none; }
.fillgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.fillgrid label { font-size: 0.8235rem; color: var(--muted); }
.fillgrid input { width: 100%; display: block; }
.fillitem input, .fillitem select { font: inherit; padding: 6px 8px; border: 2px solid var(--ink); background: var(--window); color: var(--ink); border-radius: 0; min-height: 40px; }

/* Hover effects only where there's a real mouse; on iPhone a tap leaves :hover stuck on. */
@media (hover: hover) {
  .backbtn:hover { background: var(--select); color: var(--select-ink); }
  .tb-btn:hover { background: var(--select); color: var(--select-ink); }
  .icon:hover .label { background: var(--select); color: var(--select-ink); }
  .icon:hover svg { filter: brightness(0.85); }
  .btn:hover { background: var(--select); color: var(--select-ink); }
  .btn.primary:hover { filter: brightness(1.1); }
  .btn.danger:hover { background: var(--warn); color: var(--window); }
  .stepper button:hover { background: var(--select); color: var(--select-ink); }
  .card a:hover .ctitle { background: var(--select); color: var(--select-ink); }
  .timelink:hover { background: var(--select); color: var(--select-ink); }
  .mealchip:hover { background: var(--select); color: var(--select-ink); }
  .mealchip:hover .lo { color: inherit; }
  .addslot:hover { border-color: var(--select); color: var(--select); }
  .picklist button:hover { background: var(--select); color: var(--select-ink); }
  .picklist button:hover .muted { color: inherit; }
  .iconbtn:hover { color: var(--warn); }
  .iconbtn.edit:hover { color: var(--select); }
  .pricerow:hover { color: var(--select); }
  .daybtn:hover { background: var(--select); color: var(--select-ink); }
  .slotrow.target:hover { outline: 2px dashed var(--select); outline-offset: -3px; }
}

/* =====================================================================
   Calm Pixel design system
   Retro personality as accents (pixel icons, block progress, a faint
   button shadow); calm chrome everywhere else: hairlines, whitespace,
   one type scale, 44 px+ tap targets, short purposeful motion.
   ===================================================================== */
:root {
  --c-bg: #F5F3EE; --c-card: #FFFFFF; --c-line: #E7E3DA; --c-ink: #1C222B; --c-muted: #505965; --c-faint: #5F6874;
  --c-accent: #2448CC; --c-accent-ink: #FFFFFF; --c-check: #2E8F52; --c-chip: #ECE8E0; --c-danger: #B3261E;
  --c-toast: #1C222B; --c-toast-ink: #F5F3EE; --c-shade: rgba(28, 34, 43, .38);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r: 14px; --r-sm: 10px;
  --t-title: 700 1.7647rem/1.12 var(--body); --t-head: 700 0.7647rem/1.2 var(--body); --t-row: 700 1rem/1.3 var(--body);
  --t-small: 400 0.8235rem/1.35 var(--body);
  --ease: cubic-bezier(.2, .8, .2, 1); --quick: 180ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #12161B; --c-card: #1B2128; --c-line: #2A323C; --c-ink: #E9EDF2; --c-muted: #ADB6C1; --c-faint: #8D97A3;
    --c-accent: #7C95FF; --c-accent-ink: #0B1020; --c-check: #4CC27A; --c-chip: #232A33; --c-danger: #FF8A80;
    --c-toast: #E9EDF2; --c-toast-ink: #12161B; --c-shade: rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  --c-bg: #12161B; --c-card: #1B2128; --c-line: #2A323C; --c-ink: #E9EDF2; --c-muted: #ADB6C1; --c-faint: #8D97A3;
  --c-accent: #7C95FF; --c-accent-ink: #0B1020; --c-check: #4CC27A; --c-chip: #232A33; --c-danger: #FF8A80;
  --c-toast: #E9EDF2; --c-toast-ink: #12161B; --c-shade: rgba(0, 0, 0, .55);
}
@media (prefers-reduced-motion: reduce) { :root { --quick: 1ms; } }

/* Calm page chrome (shell({ calm: true })) */
body:has(.page.calm) { background: var(--c-bg); }
.page.calm { padding-left: var(--s4); padding-right: var(--s4); }
.calm .win.screen { background: transparent; border: 0; box-shadow: none; color: var(--c-ink); }
.calm .screen > .titlebar { border: 0; background: var(--c-bg); min-height: 48px; padding: 0; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s2); }
.calm .screen > .titlebar .wintitle { opacity: 0; transition: opacity var(--quick) var(--ease); font-size: 1rem; }
.calm.scrolled .screen > .titlebar .wintitle { opacity: 1; }
.calm .backbtn { border: 0; box-shadow: none; background: transparent; width: 44px; height: 44px; border-radius: var(--r-sm); color: var(--c-ink); }
.calm .backbtn:active { transform: none; background: var(--c-chip); }
.calm .screen > .wbody { padding: 0; }
.calm h1.ctitle { font: var(--t-title); letter-spacing: -.01em; margin: 0 0 var(--s4); }
.calm h1.ctitle:has(+ .csub) { margin-bottom: var(--s1); }
.calm .csub { color: var(--c-muted); font: var(--t-small); display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
/* Title in the top bar, next to the back arrow (shell({ inlineTitle: true })). */
.calm .screen > .titlebar.inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); min-height: 64px; padding-top: var(--s2); padding-bottom: var(--s1); }
.calm .screen > .titlebar.inline .wintitle { flex: none; opacity: 1; text-align: left; font: 700 1.5294rem/1.15 var(--body); letter-spacing: -.01em; padding: 0; overflow: visible; }
.titlebar.inline .tb-right { margin-left: auto; min-width: 0; padding: 0 var(--s2); }
.gstore { min-width: 0; white-space: nowrap; }
.gstore > :not(.sname) { flex: none; }
.gstore .sname { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.calm .csub .gcount { margin-left: auto; color: var(--c-ink); font-weight: 700; white-space: nowrap; }
.calm .csub .wknav { display: inline-flex; align-items: center; gap: 2px; }
.calm .csub .wknav a { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; text-decoration: none; color: var(--c-muted); }
.calm .csub .wknav a:active { background: var(--c-chip); }
.calm .chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s3); border-radius: 999px; border: 0;
  background: var(--c-chip); color: var(--c-ink); font: var(--t-small); font-weight: 700; white-space: nowrap; cursor: pointer; text-decoration: none; }
.calm .chip.quiet { color: var(--c-muted); }
.calm .card { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; }
.calm .chead { display: flex; align-items: center; gap: var(--s2); margin: var(--s4) 0 6px; padding-left: 2px;
  font: var(--t-head); letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.calm .chead .n { margin-left: auto; letter-spacing: 0; color: var(--c-faint); font-weight: 700; }
.calm .cbtn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4);
  border-radius: var(--r-sm); border: 1px solid var(--c-line); background: var(--c-card); color: var(--c-ink); font: var(--t-small); font-weight: 700; cursor: pointer; text-decoration: none; }
.calm .cbtn.primary { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.calm .cbtn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.calm .cbtn.ghost { border-color: transparent; background: transparent; color: var(--c-muted); }
.calm .cbtn.danger { color: var(--c-danger); }
.calm .cempty { text-align: center; padding: var(--s6) var(--s4); color: var(--c-muted); }
.calm .cempty b { display: block; color: var(--c-ink); font: var(--t-row); margin: var(--s2) 0 var(--s1); }

/* Grocery list */
.gadd { display: flex; align-items: center; gap: var(--s2); height: 44px; padding: 0 6px 0 var(--s4); background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r); }
.gadd:focus-within { border-color: var(--c-accent); }
.gadd input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: 400 1rem var(--body); color: var(--c-ink); padding: 0; }
.gadd input::placeholder { color: var(--c-faint); }
.gadd .plus { width: 32px; height: 32px; flex: none; border: 0; border-radius: var(--r-sm); background: var(--c-accent); color: var(--c-accent-ink); font: 700 1.2941rem/1 var(--body); cursor: pointer; }
.gchips[hidden] { display: none; }
.gchips { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; margin: var(--s3) calc(-1 * var(--s4)) 0; padding: 0 var(--s4); }
.gchips::-webkit-scrollbar { display: none; }
.glist { list-style: none; margin: 0; padding: 0; }
.grow { position: relative; overflow: hidden; }
.grow + .grow { border-top: 1px solid var(--c-line); }
.grow-main { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 44px; padding: 6px var(--s4);
  border: 0; background: var(--c-card); color: var(--c-ink); text-align: left; cursor: pointer; font: var(--t-row);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: pan-y; transition: transform var(--quick) var(--ease), background var(--quick); }
.grow-main:active { background: var(--c-bg); }
.gbox { width: 24px; height: 24px; flex: none; border: 2px solid var(--c-faint); border-radius: 6px; display: grid; place-items: center; color: #fff;
  transition: background var(--quick) var(--ease), border-color var(--quick) var(--ease); }
.gbox .pix { width: 16px; height: 16px; }
.got .gbox { background: var(--c-check); border-color: var(--c-check); }
.gname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.gname small { display: block; font: var(--t-small); color: var(--c-faint); margin-top: 1px; }
.gamt { flex: none; max-width: 45%; text-align: right; color: var(--c-muted); font: 400 0.8824rem/1.3 var(--body); font-variant-numeric: tabular-nums; }
.got .gname { color: var(--c-faint); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.got .gamt { color: var(--c-faint); }
.gby { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 6px; border-radius: 50%; background: #E9A23B; color: #1C222B; font: 700 0.6471rem/1 var(--body); vertical-align: 2px; }
.grow-actions { position: absolute; inset: 0 0 0 auto; display: flex; }
.grow-actions button { width: 76px; border: 0; font: var(--t-small); font-weight: 700; color: #fff; cursor: pointer; }
.grow-actions .more { background: #6B7480; }
.grow-actions .rm { background: var(--c-danger); }
.ghint { text-align: center; font: var(--t-small); color: var(--c-faint); margin: var(--s4) 0 0; }
.gfoot { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; margin-top: var(--s5); }
.gask .askrow { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); min-height: 56px; }
.gask .askrow { border-top: 1px solid var(--c-line); }
.gask .askrow .nm { flex: 1; font: var(--t-row); }
.gask .askrow small { display: block; font: var(--t-small); color: var(--c-faint); }
.gask .askrow .cbtn { min-width: 56px; }
.gask p { margin: var(--s3) var(--s4) var(--s1); font: var(--t-small); color: var(--c-muted); }
.calm details.ghave summary { cursor: pointer; list-style: none; }
.calm details.ghave summary::-webkit-details-marker { display: none; }

/* ---------- Calm Pixel across the app ----------
   The older component classes, restyled with the same tokens. The pixel personality stays in the
   icons, stars, back arrow and block progress; the heavy borders and offset shadows go. */
:root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
  --paper: var(--c-bg); --window: var(--c-card); --ink: var(--c-ink); --muted: var(--c-muted);
  --sunk: var(--c-chip); --select: var(--c-accent); --select-ink: var(--c-accent-ink);
  --good: var(--c-check); --warn: var(--c-danger); --dot: transparent;
}
body { background: var(--c-bg); background-image: none; }
a { color: var(--c-ink); text-decoration-thickness: 1.5px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* Cards, banners and boxes: hairline + radius instead of thick borders and offset shadows */
.win:not(.screen) { border: 1px solid var(--c-line); box-shadow: none; border-radius: var(--r); overflow: hidden; background: var(--c-card); }
.win:not(.screen) > .titlebar { border-bottom: 1px solid var(--c-line); }
.calm .screen > .statusbar { display: flex; border: 0; background: none; color: var(--c-faint); font: var(--t-small); padding: var(--s5) 2px 0; justify-content: space-between; gap: var(--s3); }

/* Buttons */
.btn { border: 1px solid var(--c-line); box-shadow: none; border-radius: var(--r-sm); min-height: 44px; background: var(--c-card); color: var(--c-ink);
  font-family: var(--body); font-weight: 700; font-size: 0.8824rem; padding: 0 var(--s4); transition: background var(--quick), transform var(--quick); }
.btn:active { transform: scale(.98); box-shadow: none; background: var(--c-chip); }
.btn.primary { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); background: var(--c-accent); }
.btn.danger { color: var(--c-danger); }
.btn.small { min-height: 36px; font-size: 0.8235rem; padding: 0 var(--s3); box-shadow: none; border-radius: 9px; }
.btn.small.primary { box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.tb-btn { border: 0; background: var(--c-chip); border-radius: 999px; min-height: 34px; padding: 0 var(--s3); font: var(--t-small); font-weight: 700; color: var(--c-ink); box-shadow: none; }
.tb-btn:active { transform: none; background: var(--c-line); }
.tb-btn[aria-pressed="true"] { background: var(--c-accent); color: var(--c-accent-ink); }

/* Form controls */
input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-card); color: var(--c-ink); box-shadow: none; min-height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--c-accent); outline: none; }
.field > span { font-family: var(--body); font-weight: 700; font-size: 0.8235rem; color: var(--c-muted); }
.seg { border: 0; background: var(--c-chip); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { border: 0 !important; border-radius: 8px; background: transparent; font-family: var(--body); font-weight: 700; color: var(--c-muted); min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--c-card); color: var(--c-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.stepper { border: 1px solid var(--c-line); border-radius: var(--r-sm); overflow: hidden; background: var(--c-card); }
.stepper button { background: var(--c-card); font-family: var(--body); font-weight: 700; height: 40px; width: 42px; }
.stepper button:active { background: var(--c-chip); }
.stepper output { border-left: 1px solid var(--c-line); border-right: 1px solid var(--c-line); font-family: var(--body); font-weight: 700; }
.chip { border: 0; background: var(--c-chip); border-radius: 999px; min-height: 36px; font-family: var(--body); font-weight: 700; font-size: 0.8235rem; color: var(--c-ink); box-shadow: none; }
.chip[aria-pressed="true"] { background: var(--c-accent); color: var(--c-accent-ink); }
.tag { font-family: var(--body); font-weight: 700; color: var(--c-faint); }
.check input, .ings input, .slotpick input { accent-color: var(--c-check); }

/* Headings */
h2.sect, h3.sect { font-family: var(--body); font-weight: 700; font-size: 1.1765rem; border: 0; padding: 0; margin: var(--s6) 0 var(--s3); letter-spacing: -.01em; }
h2.sect small, h3.sect small { font-weight: 400; }
.wintitle { font-family: var(--body); font-weight: 700; }

/* Recipe book */
.calm .cards { background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; }
.calm .cards .card { border: 0; border-radius: 0; overflow: visible; background: none; }
.calm .cards .card + .card { border-top: 1px solid var(--c-line); }
.calm .cards .card a { padding: var(--s3) var(--s4); }
.calm .cards .card a:active { background: var(--c-bg); }
.cmeta .mstars { color: #E2A400; }
.empty { color: var(--c-muted); }
.empty .px { font-family: var(--body); font-weight: 700; color: var(--c-ink); }
.sortrow select { min-height: 36px; }

/* Recipe page */
.rtitle { font-family: var(--body); font-weight: 700; letter-spacing: -.01em; }
.nutri div { border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-card); }
.nutri b { font-family: var(--body); font-weight: 700; }
.ings li, .steps li.step { border-bottom: 1px solid var(--c-line); }
.ings li.hdr, .steps li.hdr { font-family: var(--body); font-weight: 700; font-size: 0.7647rem; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); border-bottom: 0; }
.steps li.step::before { border: 0 !important; background: var(--c-chip); color: var(--c-ink); border-radius: 8px; font-family: var(--body); font-weight: 700; }
.steps li.step.done::before { background: var(--c-check); color: #fff; }
.steps li.step.current::before { background: var(--c-accent); color: var(--c-accent-ink); }
.timelink { border: 1px solid var(--c-line); border-radius: 999px; box-shadow: none; background: var(--c-card); font-family: var(--body); font-weight: 700; }
.timelink:active { transform: none; background: var(--c-chip); }
.breakdown summary, .more-tags summary { font-family: var(--body); font-weight: 700; color: var(--c-muted); }
.breakdown td, .ref td, .plist li, .setrow, .picklist button, .preplist li, .today li, .pop li { border-bottom: 1px solid var(--c-line); border-style: none none solid; }
.facts { border: 0; }

/* Meal plan */
.weeknav .wk { font-family: var(--body); font-weight: 700; }
.weeknav .btn.small { min-width: 40px; }
.banner { border: 1px solid var(--c-line); border-radius: var(--r); background: var(--c-card); box-shadow: none; }
.banner .px { font-family: var(--body); font-weight: 700; }
.day { border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; background: var(--c-card); }
.day.today-day, .day.source { box-shadow: 0 0 0 2px var(--c-accent); border-color: transparent; }
.dayhead { border-bottom: 1px solid var(--c-line); background: none; }
.dayhead .px { font-family: var(--body); font-weight: 700; }
.slotrow { border-bottom: 1px solid var(--c-line); grid-template-columns: 6.35rem 1fr; }
.slotname { font-family: var(--body); font-weight: 700; font-size: 0.7647rem; letter-spacing: .04em; text-transform: uppercase; color: var(--c-faint); }
.mealchip { border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-chip); box-shadow: none; font-weight: 700; }
.mealchip.left { border-style: dashed; background: transparent; }
.mealchip .lo { font-family: var(--body); font-weight: 700; }
.addslot { border: 1px dashed var(--c-line); border-radius: 9px; color: var(--c-faint); font-family: var(--body); }
.daybtn { border: 0; background: var(--c-chip); border-radius: 999px; font-family: var(--body); font-weight: 700; box-shadow: none; }
.droptag { border: 1px dashed var(--c-accent); border-radius: 8px; font-family: var(--body); }
.movebar { border: 0; border-radius: var(--r); box-shadow: 0 6px 20px rgba(0, 0, 0, .14); }
.slotpick label { border: 1px solid var(--c-line); border-radius: 8px; }
.slotpick .taken { border: 1px dashed var(--c-line); border-radius: 8px; }
.slotpick .h, .slotpick .d { font-family: var(--body); font-weight: 700; }

/* Pantry, prices, settings, converter, add */
.plist .kind, .pricerow .pr, .ref td:last-child { font-family: var(--body); font-weight: 700; }
.eqs div { border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-card); font-family: var(--body); font-weight: 700; }
.note { border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-card); }
.code { border: 1px solid var(--c-line); border-radius: 8px; }
.ask, .fromtext, .fillitem { border: 1px solid var(--c-line); border-radius: var(--r); background: var(--c-card); }
.fromtext summary, .ask h3, .fillitem legend { font-family: var(--body); font-weight: 700; }
.fillitem input, .fillitem select { border: 1px solid var(--c-line); border-radius: 8px; }
.photoprev { border: 1px solid var(--c-line); border-radius: var(--r-sm); }

/* Home */
.calm.home .hero { margin: var(--s4) 0 var(--s5); }
.hero h1 { font-family: var(--body); font-weight: 700; letter-spacing: -.02em; }
.icon .label { font-family: var(--body); font-weight: 700; }
.icon:active svg { transform: scale(.94); }

/* Dialogs: a sheet that slides up from the bottom on phones */
dialog.win { border: 0; border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); background: var(--c-card); }
dialog.win > .titlebar { border-bottom: 1px solid var(--c-line); background: var(--c-card); min-height: 52px; }
dialog .backbtn { border: 0; box-shadow: none; background: var(--c-chip); border-radius: 999px; width: 36px; height: 36px; }
dialog::backdrop { background: var(--c-shade); background-image: none; }
@media (max-width: 600px) {
  dialog.win { width: 100vw; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 88dvh; padding-bottom: var(--safe-b); }
  dialog.win[open] { animation: sheet var(--quick) var(--ease); }
}
dialog.win[open] { animation: fadein var(--quick) var(--ease); }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

/* Toast and timers */
.toast, .toast.win { width: max-content; border: 0; border-radius: 999px; background: var(--c-toast); color: var(--c-toast-ink); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); font-family: var(--body); font-weight: 700; }
.timerdock { border-top: 1px solid var(--c-line); background: var(--c-card); }
.timer { border: 1px solid var(--c-line); border-radius: 12px; }
.timer .tclock { font-family: var(--body); font-weight: 700; font-variant-numeric: tabular-nums; }
.tbtn { border: 1px solid var(--c-line); border-radius: 999px; }
.timer.done { animation: none; }
@media (prefers-reduced-motion: no-preference) { .timer.done { animation: pulse 1.2s ease-in-out infinite; } }
@keyframes pulse { 50% { filter: brightness(1.25); } }

.toast.act { pointer-events: auto; display: flex; align-items: center; gap: var(--s3); padding: 6px 6px 6px 16px; }
.toast.act button { border: 0; border-radius: 999px; background: color-mix(in srgb, var(--c-toast-ink) 18%, transparent); color: var(--c-toast-ink);
  font: 700 0.8235rem var(--body); min-height: 36px; padding: 0 14px; cursor: pointer; }

/* Checking off: the row fills, then folds away into In cart */
.grow { transition: max-height var(--quick) var(--ease), opacity var(--quick) var(--ease); max-height: 200px; }
.grow.leaving { max-height: 0; opacity: 0; }
.grow.leaving + .grow { border-top-color: transparent; }
.gcart summary { list-style: none; cursor: pointer; }
.gcart summary::-webkit-details-marker { display: none; }
.gcart summary .chead { margin-bottom: var(--s2); }
.gcart .tw { transition: transform var(--quick) var(--ease); display: inline-block; }
.gcart[open] .tw { transform: rotate(180deg); }
.gdone { text-align: center; padding: var(--s5) var(--s4) var(--s2); color: var(--c-muted); font: var(--t-small); }
.gdone b { display: block; color: var(--c-ink); font: var(--t-row); margin-top: var(--s2); }
.gsug { list-style: none; margin: var(--s2) 0 0; padding: 0; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; }
.gsug button { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); width: 100%; min-height: 48px; padding: 0 var(--s4);
  border: 0; background: none; color: var(--c-ink); font: var(--t-row); text-align: left; cursor: pointer; }
.gsug li + li button { border-top: 1px solid var(--c-line); }
.gsug button:active { background: var(--c-bg); }
.gsug small { font: var(--t-small); color: var(--c-faint); }
.spick .srow, .spick label.srow { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: 0 var(--s4); }
.spick .srow label { flex: 1; display: flex; align-items: center; gap: var(--s3); min-height: 52px; cursor: pointer; }
.spick .srow + .srow { border-top: 1px solid var(--c-line); }
.spick input[type="radio"] { width: 20px; height: 20px; accent-color: var(--c-accent); margin: 0; }
.spick span { font: var(--t-row); }
.spick small { display: block; font: var(--t-small); color: var(--c-faint); }
.olist { list-style: none; margin: 0; padding: 0; background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; }
.orow { display: flex; align-items: center; gap: var(--s2); min-height: 52px; padding: 0 var(--s2) 0 0; background: var(--c-card); position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.orow + .orow { border-top: 1px solid var(--c-line); }
.orow.dragging { z-index: 2; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); border-radius: var(--r-sm); }
.ohandle { width: 44px; text-align: center; color: var(--c-faint); font-size: 1.1765rem; cursor: grab; }
.oname { flex: 1; display: flex; align-items: center; gap: var(--s2); font: var(--t-row); cursor: grab; }
.obtn { width: 36px; height: 36px; border: 0; border-radius: 9px; background: var(--c-chip); color: var(--c-muted); font: 700 0.9412rem var(--body); cursor: pointer; }

/* Shopping mode: a bar at the bottom, then bigger rows with only what's left, by aisle */
.page.calm.hasbar .screen > .wbody { padding-bottom: calc(88px + var(--safe-b)); }
.gshopbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; gap: var(--s2);
  padding: var(--s5) max(var(--s4), env(safe-area-inset-right)) calc(var(--s3) + var(--safe-b)) max(var(--s4), env(safe-area-inset-left));
  background: linear-gradient(to top, var(--c-bg) 62%, color-mix(in srgb, var(--c-bg) 0%, transparent)); pointer-events: none; }
.gshopbar .cbtn { pointer-events: auto; min-height: 52px; font: 700 1rem var(--body); border-radius: var(--r); }
.gshopbar .cbtn.primary { flex: 1; }
.gshopbar .cbtn:not(.primary) { background: var(--c-card); border: 1px solid var(--c-line); color: var(--c-ink); padding: 0 var(--s5); }
.gshopbar .pix { width: 18px; height: 18px; }
body.has-timers .gshopbar { bottom: calc(68px + var(--safe-b)); padding-bottom: var(--s3); }
body:has(.gshopbar) .toast { bottom: calc(92px + var(--safe-b)); }
body.has-timers:has(.gshopbar) .toast { bottom: calc(160px + var(--safe-b)); }
.gwake { display: flex; align-items: center; gap: var(--s2); margin: calc(var(--s2) * -1) 0 var(--s3); color: var(--c-check); font: 700 0.8235rem var(--body); }
.gwake[hidden] { display: none; }
.shopping .gwake { margin: 0 0 var(--s2); }
.shopping #addForm, .shopping .gsug, .shopping .gchips, .shopping .gaskwrap, .shopping .ghave,
.shopping .ghint, .shopping .gfoot, .shopping .cempty { display: none; }
/* Shopping mode: the title, store and week stay where they are and scroll away (so the first items start
   within thumb reach); progress and "X of Y" pin to the top once they reach it. */
.calm.shopping .screen > .titlebar.inline { position: static; }
.shopping .csub .gcount { display: none; }
.calm.shopping .csub { margin-bottom: 0; }
.gshoptop { display: none; }
.shopping .gshoptop { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--s3);
  margin: 0 calc(-1 * var(--s4)); padding: var(--s3) var(--s4); background: var(--c-bg); font: var(--t-small); }
.gshoptop b { color: var(--c-ink); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gbar { flex: 1; display: flex; gap: 2px; min-width: 60px; }
.gbar i { flex: 1; height: 8px; border-radius: 1px; background: var(--c-line); transition: background var(--quick) var(--ease); }
.gbar i.on { background: var(--c-check); }
.gbar.solid { height: 8px; border-radius: 2px; background: var(--c-line); overflow: hidden; display: block; }
.gbar.solid i { display: block; height: 100%; background: var(--c-check); border-radius: 0; transition: width var(--quick) var(--ease); }
.gopt { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); margin: 0 0 var(--s3); border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-bg); cursor: pointer; }
.gopt input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--c-check); flex: none; }
.gopt span { font: var(--t-row); }
.gopt small { display: block; font: var(--t-small); color: var(--c-muted); margin-top: 2px; }
.gcarry .gopt { margin: 0; align-items: center; padding: 10px var(--s4); border: 0; border-top: 1px solid var(--c-line); border-radius: 0; background: none; }
.gcarry .gopt small { display: inline; margin: 0 0 0 var(--s2); }
.gcarry .btnrow { display: flex; gap: var(--s2); margin: 0; padding: var(--s3) var(--s4); border-top: 1px solid var(--c-line); }
.gcarry .btnrow .primary { flex: 1; }

/* A partner's change note: their initial, then what they did */
.toast.who { display: flex; align-items: center; gap: var(--s2); padding-left: 8px; }
.toast .gby { margin: 0; flex: none; }
.gname .gby { margin-left: 8px; vertical-align: 1px; }
.got .gname .gby { opacity: .8; }

/* The add box is one field: the input inside draws no border, fill or focus ring of its own (the box shows focus) */
.gadd input[type="text"], .gadd input[type="text"]:focus { flex: 1; min-width: 0; height: auto; min-height: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  -webkit-appearance: none; appearance: none; font: 400 1rem var(--body); color: var(--c-ink); padding: 0; height: 100%; }
.gadd input[type="text"]:focus-visible { outline: none; }
.gadd:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 18%, transparent); }

/* Amounts: "1 pint" with the package size as a small second line; the name gets priority for width */
.gamt { max-width: 40%; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.gamt .gq { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; line-height: 1.15; }
.gamt .gq small { font: 400 0.7059rem/1.2 var(--body); color: var(--c-faint); }
.gamt .gplus { font-size: 0.7059rem; line-height: 1; color: var(--c-faint); }
.got .gamt .gq small { color: inherit; }
.gname { hyphens: none; overflow-wrap: break-word; }
@media (max-width: 360px) { .shopping .grow-main { font-size: 1.0588rem; gap: var(--s3); } .shopping .gamt .gq { font-size: 0.9412rem; } }
.gshopbar .cbtn { white-space: nowrap; }
@media (max-width: 360px) { .gshopbar .cbtn:not(.primary) { padding: 0 var(--s4); } .gshopbar .cbtn { font-size: 0.9412rem; } }

/* Aisle editor: only the handle drags; the rest of the row scrolls the sheet */
.orow { touch-action: pan-y; user-select: auto; -webkit-user-select: auto; }
.ohandle { touch-action: none; align-self: stretch; display: grid; place-items: center; width: 48px; flex: none; font-size: 1.2941rem; user-select: none; -webkit-user-select: none; cursor: grab; }
.orow.dragging { transition: none; background: var(--c-card); }
.orow.dragging .ohandle { cursor: grabbing; color: var(--c-accent); }
.toast.act button { white-space: nowrap; flex: none; }

/* Recipe rating: your stars are the big row you tap; the household average is a small line under it */
.ratingbox { margin: 0 0 var(--s4); }
.ratingbox .rmine { display: flex; align-items: center; flex-wrap: wrap; gap: 2px var(--s2); }
.ratingbox .rlabel { flex-basis: 100%; font: var(--t-head); letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.ratingbox .stars { margin: 0 0 0 -6px; }
.ratingbox .stars button { padding: 6px; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.ratingbox .stars svg { width: 30px; }
.ratingbox .rhint { font: 400 0.8235rem var(--body); color: var(--c-faint); }
.ratingbox .ravg { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font: 400 0.8235rem var(--body); color: var(--c-muted); }
.ratingbox .ravg svg { width: 14px; height: auto; }
.ratingbox .ravg b { color: var(--c-ink); }

/* Nutrition by ingredient: tap one to see where its numbers come from and add its label */
.nubd summary .nuhint { font-weight: 400; color: var(--c-faint); }
.nurows { list-style: none; margin: 6px 0 0; padding: 0; }
.nurow { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 48px; padding: var(--s2) 0; border: 0; border-bottom: 1px solid var(--c-line);
  background: none; color: var(--c-ink); text-align: left; font: 400 0.8235rem/1.35 var(--body); cursor: pointer; }
.nurow:active { background: var(--c-bg); }
.nurow .nuname { flex: 1; min-width: 0; }
.nurow .nuval { text-align: right; white-space: nowrap; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.nurow .nugo { color: var(--c-faint); font-size: 1.0588rem; }
.nurow.miss .nuname { color: var(--c-muted); }
.nutag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--c-chip); color: var(--c-muted); font: 700 0.6471rem/1.5 var(--body); vertical-align: 1px; }
.nutag.label, .nutag.yours { background: color-mix(in srgb, var(--c-check) 18%, transparent); color: var(--c-check); }
.nutag.standin, .nutag.none { background: color-mix(in srgb, #E9A23B 20%, transparent); color: #A86A12; }
:root[data-theme="dark"] .nutag.standin, :root[data-theme="dark"] .nutag.none { color: #F2C14E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nutag.standin, :root:not([data-theme="light"]) .nutag.none { color: #F2C14E; } }
/* Label sheet */
.fsrc { margin: 0 0 10px; font: 700 0.8824rem/1.4 var(--body); }
.fsact { display: flex; flex-wrap: wrap; gap: var(--s2); }
.fsfile { cursor: pointer; }
.lcform { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.lcform label { display: flex; flex-direction: column; gap: 4px; font: 700 0.7647rem var(--body); color: var(--c-muted); }
.lcform label.wide, .lcform .btnrow, .lcform .lcwarn { grid-column: 1 / -1; }
.lcform .lin { display: flex; align-items: center; gap: 6px; }
.lcform .lin input { flex: 1; min-width: 0; }
.lcform .lin small { color: var(--c-faint); font-weight: 400; }
.lcwarn { margin: 0; padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: color-mix(in srgb, #E9A23B 18%, transparent); color: var(--c-ink); font: 400 0.8235rem/1.4 var(--body); }
.lcwarn[hidden] { display: none; }
.fillscan { margin: 6px 0 2px; }

/* A quiet note under a recipe's Nutrition: stand-in values or ingredients not counted. */
.nunote { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--c-chip); color: var(--c-muted); font: var(--t-small); }
.nunote > span { flex: 1; }
.nunote .linkbtn { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--c-accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.nunote .nux { flex: none; width: 44px; height: 44px; margin: -12px -8px -12px 0; border: 0; background: none; color: var(--c-muted); font-size: 1.1765rem; cursor: pointer; }
/* Pinch zoom over the grocery list too (its rows keep vertical scrolling and their own swipe). */

/* Pages laid out like the grocery list */
.titlebar.inline .tb-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; }
.calm .csub .wkjump { margin-left: auto; font-weight: 700; color: var(--c-accent); text-decoration: none; white-space: nowrap; }
.prows .prow { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; padding: 4px 6px 4px var(--s4); }
.prows .prow + .prow { border-top: 1px solid var(--c-line); }
.prows .prow > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.prows .btn.small { min-height: 36px; }

/* Tab bar: Recipes · Plan · List · More, on the main screens */
:root { --tabh: calc(58px + var(--safe-b)); }
.tabbar { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 4px max(4px, env(safe-area-inset-right)) var(--safe-b) max(4px, env(safe-area-inset-left)); background: var(--c-card); border-top: 1px solid var(--c-line); }
.tabbar[hidden], body.shopping-mode .tabbar { display: none; }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; text-decoration: none; color: var(--c-muted); font: 600 0.7059rem var(--body); }
.tabbar a[aria-current="page"] { color: var(--c-accent); font-weight: 700; }
.tabbar svg { width: 24px; height: 24px; flex: none; }
body.has-tabs:not(.shopping-mode) .page { padding-bottom: calc(var(--tabh) + 24px); }
body.has-tabs:not(.shopping-mode) .gshopbar { bottom: var(--tabh); padding-bottom: var(--s3); }
body.has-tabs:not(.shopping-mode) .page.calm.hasbar .screen > .wbody { padding-bottom: calc(88px + var(--tabh)); }
body.has-tabs:not(.shopping-mode) .toast { bottom: calc(var(--tabh) + 16px); }
body.has-tabs:not(.shopping-mode) .timerdock { bottom: var(--tabh); padding-bottom: 8px; }

/* Today | Week */
.seg.planseg { display: inline-flex; }
.seg.planseg a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s3); border-radius: 8px; text-decoration: none; font: 700 0.8824rem var(--body); color: var(--c-muted); }
.seg.planseg a[aria-current="page"] { background: var(--c-card); color: var(--c-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }

/* Today */
.tdhero { margin-bottom: var(--s3); }
.tdphoto { display: block; width: 100%; height: 170px; object-fit: cover; background: var(--c-chip); }
.tdbody { padding: var(--s3) var(--s4) var(--s4); display: flex; flex-direction: column; gap: 6px; }
.tdkind { font: var(--t-head); letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }
.tdtitle { font: 700 1.2353rem/1.25 var(--body); color: var(--c-ink); text-decoration: none; }
.tdmeta { font: var(--t-small); color: var(--c-muted); }
.tdbtns { display: flex; gap: var(--s2); margin-top: var(--s2); }
.tdbtns .cbtn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; padding: 0 var(--s4); }
.tdbtns .cbtn.primary { flex: 1; }
.tdempty { padding: var(--s4); margin-bottom: var(--s3); }
.tdempty b { display: block; font: var(--t-row); }
.tdempty p { margin: 4px 0 0; color: var(--c-muted); font: var(--t-small); }
.tdrow a { display: flex; align-items: center; gap: var(--s3); min-height: 50px; padding: 4px var(--s4); text-decoration: none; color: var(--c-ink); }
.tdrow + .tdrow { border-top: 1px solid var(--c-line); }
.tdslot { width: 6.2rem; flex: none; font: var(--t-head); letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.tdname { flex: 1; min-width: 0; font: var(--t-row); }
.tdtag { font: var(--t-small); color: var(--c-muted); background: var(--c-chip); border-radius: 999px; padding: 2px 10px; }
.tdlist { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); padding: var(--s3) var(--s4); text-decoration: none; color: var(--c-ink); }
.tdlisttext { flex: 1; display: flex; flex-direction: column; }
.tdlisttext b { font: var(--t-row); }
.tdlisttext small { font: var(--t-small); color: var(--c-muted); }
.tdgo { color: var(--c-muted); font-size: 1.2941rem; }
.tdnext { margin: var(--s3) 4px 0; color: var(--c-muted); font: var(--t-small); }

/* More */
.calm .card + .card { margin-top: var(--s3); }
.card a.morerow, .morerow { display: flex; align-items: center; gap: var(--s3); min-height: 50px; padding: 0 var(--s4); text-decoration: none; color: var(--c-ink); }
.morerow > span:first-child { flex: 1; min-width: 0; font: var(--t-row); }
.morerow small { margin-left: auto; text-align: right; }
.morerow .tdgo { flex: none; width: 12px; text-align: right; }
.morerow small { font: var(--t-small); color: var(--c-muted); }
li + li > .morerow { border-top: 1px solid var(--c-line); }

/* Recipe photos (on this phone) */
.rphoto { display: block; width: 100%; height: 220px; object-fit: cover; border-radius: var(--r); background: var(--c-chip); margin: 0 0 var(--s3); }
.calm .card a.hasphoto { display: flex; align-items: center; gap: var(--s3); }
.cthumb { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: var(--r-sm); background: var(--c-chip); }
.cbody { flex: 1; min-width: 0; display: block; }
.tb-btn.tb-more { min-width: 44px; min-height: 36px; font-size: 1.1765rem; line-height: 1; padding: 0 var(--s2); }
.rbtns .btn { flex: 1; }
/* The recipe's ⋯ menu */
.rmenu { display: flex; flex-direction: column; border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; background: var(--c-card); }
.rmitem { display: flex; align-items: center; min-height: 52px; padding: 0 var(--s4); border: 0; background: none; text-align: left; text-decoration: none; color: var(--c-ink); font: 600 1rem var(--body); cursor: pointer; }
.rmitem + .rmitem { border-top: 1px solid var(--c-line); }
.rmitem.danger { color: var(--c-danger); border-top: 8px solid var(--c-bg); }

/* Recipe book: Filters button and sheet */
.searchrow { display: flex; gap: var(--s2, 8px); align-items: stretch; margin-bottom: 12px; }
.searchrow .search { flex: 1; min-width: 0; margin-bottom: 0; }
.fbtn { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-card); color: var(--c-ink); font: 600 0.8824rem var(--body); }
.fbtn svg { width: 14px; height: 14px; }
.fbtn.on { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-ink); }
.fsheet h3 { margin: var(--s4) 0 var(--s2, 8px); font: var(--t-head); letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.fsheet h3:first-child { margin-top: 0; }
.flims { display: flex; flex-direction: column; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-card); }
.flim { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 52px; padding: 0 var(--s3) 0 var(--s4); }
.flim + .flim { border-top: 1px solid var(--c-line); }
.flim > span:first-child { display: flex; flex-direction: column; font: var(--t-row); }
.flim small { font: var(--t-small); color: var(--c-muted); }
.flimin { display: inline-flex; align-items: center; gap: 6px; color: var(--c-muted); }
.flimin i { font-style: normal; font: var(--t-small); }
.flimin input { width: 84px; min-height: 40px; text-align: right; }
.frate { display: flex; }
.frate button { flex: 1; }
.fbtns { position: sticky; bottom: 0; display: flex; gap: var(--s2, 8px); margin-top: var(--s4); padding: var(--s3) 0 2px; background: var(--c-card); }
.fbtns .btn { flex: 1; min-height: 48px; }
.fbtns .btn:first-child { flex: 0 0 auto; }
.filllabel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 6px 0 4px; }
.fillmsg { flex-basis: 100%; margin: 0; font-size: 0.8235rem; min-height: 0; }
.fillmsg:empty { display: none; }
.filllabel .btn { width: auto; margin: 0; }
/* A sheet scrolls by itself; it never scrolls the page behind it. */
html.modal-open { overflow: hidden; }
dialog .wbody { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* Typing: the keyboard covers the bottom of the screen, so the tab bar and the shopping bar step aside. */
body.kb-open .tabbar, body.kb-open .gshopbar { display: none; }
body.kb-open.has-tabs:not(.shopping-mode) .page { padding-bottom: 24px; }

/* Store-bought meals */
.rdtag { display: inline-block; font: 600 0.7059rem var(--body); letter-spacing: .02em; color: var(--c-ink); background: var(--c-chip); border-radius: 999px; padding: 1px 8px; margin-right: 6px; vertical-align: 1px; }
.rdform { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.rdform .rdwide { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.rdform label.rdwide input { margin-top: 2px; }
.rdlabel { font: var(--t-head); letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.rdlabel small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.rdfield { display: flex; flex-direction: column; gap: 4px; font-size: 0.8824rem; }
.rdfield .lin { display: flex; align-items: center; gap: 6px; }
.rdfield .lin input { flex: 1; min-width: 0; }
.rdfield .lin small { color: var(--c-muted); }
.rdgrid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.rdnums { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: var(--s3); margin: 0; padding: var(--s3) var(--s4); }
.rdnums dt { font: var(--t-small); color: var(--c-muted); }
.rdnums dd { margin: 2px 0 0; font: var(--t-row); }
.pickready { width: 100%; margin-top: var(--s3); }
.rdadd { width: 100%; margin-bottom: var(--s3); }

/* ---------- Icon set ---------- */
.ic { width: 1em; height: 1em; display: inline-block; flex: none; vertical-align: -0.14em; }
.ic16 { width: 16px; height: 16px; }
.ic20 { width: 20px; height: 20px; }
.ic24 { width: 24px; height: 24px; }
.btn .ic, .linkbtn .ic, .chip .ic { margin-right: 4px; }
.tb-btn.tb-more { display: inline-grid; place-items: center; }
.stars .off svg { opacity: 1; filter: none; color: var(--c-faint); }
.stars svg.ic { width: 28px; height: 28px; }
.stars.small svg.ic, .stars.show svg.ic { width: 18px; height: 18px; }
.tbtn { display: inline-grid; place-items: center; }

/* One-time tips and the estimates note */
.tip { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 var(--s3); padding: 8px 12px; border-radius: var(--r-sm); background: var(--c-chip); color: var(--c-ink); font: var(--t-small); }
.tip .ic { margin-top: 2px; color: var(--c-muted); }
.estnote { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 var(--s3); padding: 12px; border-radius: var(--r); background: var(--c-card); border: 1px solid var(--c-line); }
.estnote p { margin: 0; flex: 1; font: var(--t-small); color: var(--c-ink); }
.estnote .ic20 { color: var(--c-accent); margin-top: 1px; }
.estnote .iconbtn { margin: -8px -8px 0 0; }
.estbtn { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; margin-left: 6px; padding: 0 8px; border: 0; border-radius: 999px; background: var(--c-chip); color: var(--c-muted); font: 600 0.7647rem var(--body); vertical-align: middle; }
.nusrc { font: var(--t-small); margin: 0 0 6px; }
.nunote > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }

/* Recipe source */
.rsource { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.rsource .rsite { font-weight: 600; color: var(--c-ink); }
.rview { display: inline-flex; align-items: center; gap: 4px; }
.rorigin { flex-basis: 100%; font: var(--t-small); color: var(--c-muted); }
.ravg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ravgwho { flex-basis: 100%; color: var(--c-muted); }
.ic14 { width: 14px; height: 14px; }
.cmeta .mstars { display: inline-flex; gap: 1px; align-items: center; color: var(--c-faint); letter-spacing: 0; }
.stepper button, .obtn { display: inline-grid; place-items: center; }
.tdgo, .nugo { display: inline-grid; place-items: center; }
.morerow .tdgo { width: 16px; }
.ghave .tw { display: inline-block; transition: transform var(--quick) var(--ease); }
.ghave[open] .tw { transform: rotate(180deg); }
.chkline { display: flex; align-items: center; gap: 6px; }
.frate button { display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.chip { display: inline-flex; align-items: center; gap: 2px; }
.vertap { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: default; -webkit-user-select: none; user-select: none; }

/* Tap targets: every small control gets an invisible hit area of at least 44 × 44 px around it, so it
   looks the same but is easy to hit. */
.btn.small, .chip, .tb-btn, .seg button, .seg a, .estbtn, .daybtn, .addslot, .mealchip, .timelink, .gadd .plus,
.wknav a, .linkbtn, .rview, .amt, .stepper button, .vertap, .obtn, .nux, .iconbtn, .gcart summary, .ghave summary .n { position: relative; }
.btn.small::after, .chip::after, .tb-btn::after, .seg button::after, .seg a::after, .estbtn::after, .daybtn::after,
.addslot::after, .mealchip::after, .timelink::after, .gadd .plus::after, .wknav a::after, .linkbtn::after, .rview::after,
.amt::after, .stepper button::after, .vertap::after, .obtn::after, .nux::after, .iconbtn::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
}
details > summary { min-height: 44px; display: flex; align-items: center; }
.ghave > summary.chead, .gcart > summary { min-height: 44px; }
.sortrow select, .setsel { min-height: 44px; }
.preplist a { display: inline-block; padding: 12px 0; margin: -12px 0; }

/* Favorites: the heart beside your stars, and a small one before a favorite's title in the book */
.ratingbox .favbtn { margin-left: auto; min-width: 44px; min-height: 44px; display: grid; place-items: center; padding: 6px; border: 0; background: none; color: var(--c-muted); cursor: pointer; }
.ratingbox .favbtn svg { width: 26px; height: 26px; }
.ctitle .cfav { vertical-align: -1px; margin-right: 5px; }

/* Import from Paprika */
.implink { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s4) 0; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r); background: var(--c-card); color: var(--c-ink); text-decoration: none; min-height: 44px; }
.implink small { display: block; color: var(--c-muted); font-size: 0.8235rem; margin-top: 2px; }
.implink svg { color: var(--c-muted); flex: none; }
.impcard .howto { margin: 0 0 var(--s3); }
.impbar { display: block; height: 8px; border-radius: 2px; background: var(--c-line); overflow: hidden; }
.impbar i { display: block; height: 100%; background: var(--c-check); transition: width var(--quick) var(--ease); }
.impcounts { list-style: none; margin: 0 0 var(--s3); padding: 0; }
.impcounts li { padding: 8px 0; border-top: 1px solid var(--c-line); }
.impcounts li:first-child { border-top: 0; }
.impcounts b { font-variant-numeric: tabular-nums; margin-right: 4px; }
.impcounts small { display: block; color: var(--c-muted); font-size: 0.8235rem; margin-top: 2px; }
.implist { margin: 6px 0 0; padding-left: 18px; font-size: 0.8824rem; }
.implist li { margin: 4px 0; }
.impsum .check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.impbox { padding: 14px 16px; margin: 0 0 var(--s3); }

/* Breakdowns that open (Nutrition by ingredient, Cost breakdown, …): a chevron says so, and turns when open */
details.breakdown > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 44px; }
details.breakdown > summary::-webkit-details-marker { display: none; }
details.breakdown > summary::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 6px 4px 0; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--quick) var(--ease); }
details.breakdown[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
@media (prefers-reduced-motion: reduce) { details.breakdown > summary::after { transition: none; } }

/* Cooked: a small check on the cooked meal (Today, and its chip in the week) */
.cooked { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--c-check) 14%, transparent); color: var(--c-check); font: 700 0.7647rem var(--body); vertical-align: 1px; white-space: nowrap; }
.cooked svg { color: var(--c-check); }
.tdrow .cooked { margin-left: auto; }
.mealchip.made { opacity: .8; }
.mealchip.made svg { color: var(--c-check); vertical-align: -1px; margin-right: 4px; }

/* Today and Week: arriving by a swipe slides in from that side */
.page.slide-from-right { animation: slide-in-r .22s var(--ease) both; }
.page.slide-from-left { animation: slide-in-l .22s var(--ease) both; }
@keyframes slide-in-r { from { transform: translateX(28px); opacity: .4; } }
@keyframes slide-in-l { from { transform: translateX(-28px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .page.slide-from-right, .page.slide-from-left { animation: none; } }

/* "Moving from the old address? Paste move link" on an empty Today */
.tdmove { margin: var(--s3) 0 0; font-size: 0.8824rem; color: var(--c-muted); }
.tdmove .linkbtn { border: 0; background: none; padding: 0; min-height: 44px; font: inherit; font-weight: 700; color: var(--c-accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
