/* Dinner Planner. Bricolage Grotesque (headings) + DM Sans (body), teal accent, light and dark. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.ada540c0e24a.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dm-sans-latin-wght-normal.7c87a648293f.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #1d2422;
  --muted: #5e6a66;
  --line: #dcd9d0;
  --accent: #0f766e;
  --accent-strong: #0b5a54;
  --on-accent: #ffffff;
  --accent-soft: #d5ede9;
  --new: #6b3fa0;
  --new-strong: #4a2680;
  --new-soft: #ece4f7;
  --mild: #8a5a00;
  --mild-bg: #fdf0d2;
  --strong: #a3261b;
  --strong-bg: #fbdcd8;
  --ok: #1f7a3d;
  --ok-bg: #d9f0df;
  --focus: #0f766e;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 2px 8px rgb(0 0 0 / .04);
  --font-head: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101514;
    --surface: #182120;
    --surface-2: #1f2a29;
    --text: #e8eeec;
    --muted: #97a6a2;
    --line: #2d3b39;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --on-accent: #06211e;
    --accent-soft: #143733;
    --new: #b693e8;
    --new-strong: #d8c2f7;
    --new-soft: #2b2140;
    --mild: #f5c96b;
    --mild-bg: #3a2f14;
    --strong: #ff9d92;
    --strong-bg: #4a1f1b;
    --ok: #7dd99a;
    --ok-bg: #163322;
    --focus: #5eead4;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;   /* a flex child (e.g. the nav) can otherwise force the page wider than the viewport */
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
a { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 1.25rem; min-width: 0;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .brand { flex: 0 0 auto; font: 700 1.25rem var(--font-head); color: var(--accent-strong); text-decoration: none; }
.topbar nav { display: flex; gap: .25rem; flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.topbar nav a { flex: 0 0 auto; white-space: nowrap; padding: .4rem .75rem; border-radius: 999px; color: var(--text); text-decoration: none; }
@media (hover: hover) { .topbar nav a:hover { background: var(--surface-2); } }
.topbar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.topbar .logout { flex: 0 0 auto; margin: 0; }

/* phone tab bar (templates/base.html): reachable without the .topbar strip, which clips below iPad
   width. Hidden by default; shown, and .topbar hidden, only at phone widths (below). */
.tabbar { display: none; }
.tab, .tab-summary { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; min-height: 44px; padding: .3rem 0; color: var(--muted); text-decoration: none; font-size: .7rem;
  font-weight: 600; }
.tab-icon { width: 22px; height: 22px; }
.tab[aria-current="page"], .tab-summary[aria-current="page"] { color: var(--accent-strong); }
.tabbar-more { flex: 1 1 0; list-style: none; }
.tab-summary { list-style: none; cursor: pointer; width: 100%; }
.tab-summary::-webkit-details-marker { display: none; }
.tabbar-sheet { position: fixed; left: .75rem; right: .75rem; bottom: calc(64px + env(safe-area-inset-bottom) + .5rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .5rem; display: flex; flex-direction: column; z-index: 30; }
.tabbar-sheet a, .tabbar-sheet button.link { display: flex; align-items: center; justify-content: flex-start;
  min-height: 44px; padding: 0 .75rem; color: var(--text); text-decoration: none; border-radius: 8px;
  font-weight: 500; text-align: left; width: 100%; background: none; border: 0; font: inherit; cursor: pointer; }
.tabbar-sheet form { display: block; width: 100%; }
.tabbar-sheet a[aria-current="page"] { color: var(--accent-strong); font-weight: 600; }
@media (hover: hover) { .tabbar-sheet a:hover, .tabbar-sheet button.link:hover { background: var(--surface-2); } }

@media (max-width: 600px) {
  .topbar { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* forms and buttons */
label { font-weight: 600; font-size: .9rem; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 44px;
}
textarea { min-height: 5rem; }
button, .btn {
  font: 600 1rem var(--font-body); min-height: 44px; padding: .5rem 1rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
button.small { min-height: 34px; padding: .25rem .6rem; font-size: .875rem; }
button.link { border: 0; background: none; min-height: 0; padding: .25rem; font-weight: 500; color: var(--muted); text-decoration: underline; }
button.link:hover { background: none; color: var(--text); }
.errorlist { list-style: none; padding: 0; margin: .25rem 0; color: var(--strong); font-size: .9rem; }
[role=alert] { color: var(--strong); font-weight: 600; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }

/* auth pages */
.auth { max-width: 380px; margin: 12vh auto 0; padding: 0 1rem; }
.auth h1 { font-size: 1.5rem; }
.auth form p { margin: 0 0 1rem; }
.auth .qr { width: 200px; height: 200px; margin: 1rem 0; background: #fff; padding: 8px; border-radius: 8px; }
.auth .qr svg { width: 100%; height: 100%; }

/* generic page */
.page { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.new-plan .fields { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.new-plan .fields p { margin: 0 0 1rem; }
.new-plan .grow { flex: 1 1 260px; }
.new-plan input[type=date] { width: auto; }
.plan-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .75rem; }
.plan-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.plan-link { display: flex; flex-direction: column; text-decoration: none; color: var(--text); flex: 1; }

/* Week Board */
.board-page { max-width: 1500px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.board-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.board-head h1 { margin: 0; }
.board-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.board-layout {
  display: grid; gap: 1rem; align-items: start;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "days checks" "days library";
}
.board-layout > #days { grid-area: days; }
.board-layout > #checks { grid-area: checks; }
.board-layout > .library-block { grid-area: library; position: sticky; top: 1rem; }
@media (max-width: 900px) {
  .board-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "days" "checks" "library"; }
  .board-layout > .library-block { position: static; }
}
.days-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.banner { background: var(--strong-bg); padding: .6rem .8rem; border-radius: 8px; margin: 0 0 .75rem; }

.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; display: flex; flex-direction: column; gap: .5rem; box-shadow: var(--shadow); }
.day.is-busy { border-color: var(--mild); }
.day.is-locked { background: var(--surface-2); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: .25rem; }
.day-head h3 { margin: 0; font-size: 1.05rem; }
.toggles { display: flex; gap: .25rem; }
.toggle[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.day.is-busy .toggle:first-child[aria-pressed=true] { background: var(--mild-bg); border-color: var(--mild); color: var(--mild); }

.slot { min-height: 64px; border: 2px dashed transparent; border-radius: 10px; }
.day.is-new { border-color: var(--new); }
.day.is-new.is-busy { border-color: var(--mild); }
.toggle.new[aria-pressed=true] { background: var(--new-soft); border-color: var(--new); color: var(--new-strong); font-weight: 700; }
.dish.is-trial { background: var(--new-soft); gap: 2px; }
.new-label { align-self: flex-start; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--new-strong); }
.slot-empty.is-new-empty { display: block; border: 1px dashed var(--new); color: var(--new-strong); line-height: 1.3; padding: .8rem .75rem; min-height: 0; }
.slot-empty { display: grid; place-items: center; min-height: 64px; border: 2px dashed var(--line); border-radius: 10px; font-size: .875rem; }
.dish { padding: .6rem .7rem; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-weight: 600; line-height: 1.25; display: flex; flex-direction: column; }
.dish small { font-weight: 400; color: var(--muted); }
.dish.draggable { cursor: grab; }
.dish.static, .dish.kind-out, .dish.kind-leftovers { background: var(--surface-2); }
.slot .status { margin: .25rem 0 0; color: var(--ok); font-weight: 600; font-size: .875rem; }
.sortable-ghost { opacity: .4; }
.slot.drop-ok { border-color: var(--accent); }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; }
.chip { min-height: 30px; padding: .1rem .55rem; font-size: .8rem; font-weight: 600; border-radius: 999px; border: 1px solid transparent; }
.chip.mild { background: var(--mild-bg); color: var(--mild); }
.chip.strong { background: var(--strong-bg); color: var(--strong); }
.chip.dismissed { background: transparent; border-color: var(--line); color: var(--muted); text-decoration: line-through; }

.controls { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge-guests { display: inline-block; font-size: .85rem; font-weight: 700; background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px; padding: .1rem .7rem; }
.stepper { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.stepper button { border: 0; background: none; min-width: 44px; min-height: 38px; font-size: 1.2rem; }
.stepper button:disabled { opacity: .35; }
.stepper output { font-variant-numeric: tabular-nums; font-size: .9rem; font-weight: 600; }
.controls select { flex: 1 1 100%; min-height: 38px; padding: .3rem .5rem; font-size: .9rem; }
.kids { font-size: .9rem; }
.kids summary { cursor: pointer; color: var(--muted); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.kids input, .kids select { min-height: 38px; margin-top: .3rem; font-size: .9rem; }
.kids textarea { min-height: 3.2rem; margin-top: .3rem; font-size: .9rem; resize: vertical; }
.kids-own { margin: .3rem 0 0; }

.side-block h2 { font-size: 1.05rem; }
.side-block h2:not(:first-child) { margin-top: 1rem; }
.hint { font-size: .85rem; margin: .5rem 0 0; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { padding: .15rem 0; }
.checks .ok .tick { color: var(--ok); }
.checks .todo .tick { color: var(--mild); }
.use-up { display: flex; gap: .4rem; }
.library { list-style: none; margin: .6rem 0 0; padding: 0; max-height: 46vh; overflow: auto; display: grid; gap: .3rem; }
.lib-item { padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: grab; display: flex; flex-direction: column; }
.lib-item .lib-name { font-weight: 600; }
.lib-item .lib-meta { font-size: .8rem; }

/* Kitchen Tonight (sized for an iPad at arm's length) */
.kitchen { max-width: 1200px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.kitchen-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); align-items: start; }
@media (max-width: 760px) { .kitchen-layout { grid-template-columns: minmax(0, 1fr); } }
.tonight { padding: 1.5rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }
.dish-name { font-size: clamp(2.2rem, 6vw, 3.5rem); margin: 0 0 .5rem; line-height: 1.05; }
.facts { font-size: 1.15rem; margin: 0 0 .75rem; }
.kids-line { font-size: 1.25rem; padding: .6rem .9rem; background: var(--accent-soft); border-radius: 10px; }
.ingredients summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.ingredients p { font-size: 1.1rem; }
button.big, .btn.big { min-height: 60px; padding: .6rem 1.4rem; font-size: 1.15rem; border-radius: 14px; }
.status-buttons { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.25rem 0 .75rem; }
.status-buttons button { flex: 1 1 160px; }
.swap summary { list-style: none; width: 100%; }
.swap summary::-webkit-details-marker { display: none; }
.swap-form { display: grid; gap: .5rem; margin-top: .75rem; }
.swap-form select, .swap-form input { min-height: 52px; font-size: 1.05rem; }
.recorded { margin-top: 1.25rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.status-line { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--ok); }
.yesterday { margin-bottom: 1rem; }
.yesterday .status-buttons { margin: .5rem 0; }
/* Quieter than tonight's buttons, so the two Cooked buttons can't be confused. */
.yesterday button.big, .yesterday .btn.big { min-height: 48px; font-size: 1rem; }
.yesterday .primary { background: var(--surface); border-color: var(--line); color: var(--text); }
.yesterday .primary:hover { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.week h2 { margin-bottom: .5rem; }
.week-list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.week-list li { border-bottom: 1px solid var(--line); }
.week-list li:last-child { border-bottom: 0; }
.week-link { display: grid; grid-template-columns: 4.2rem 1fr 1.2rem 1rem; gap: .5rem; align-items: center; min-height: 48px; padding: .4rem .5rem; font-size: 1.05rem; color: inherit; text-decoration: none; border-radius: 8px; }
.week-link:hover { background: var(--surface-2); }
.week-list .wd { color: var(--muted); font-weight: 600; }
.week-list .today { background: var(--accent-soft); border-radius: 8px; font-weight: 700; }
.week-list .today .week-link:hover { background: var(--accent-soft); }
.week-list li[aria-current="true"] { box-shadow: inset 3px 0 0 var(--accent); border-radius: 8px; }
.week-list li[aria-current="true"] .wn { font-weight: 700; }
.week-list .mark { color: var(--ok); text-align: center; }
.week-list .chev { width: 14px; height: 14px; color: var(--muted); }
.week-list .status-skipped .wn { color: var(--muted); text-decoration: line-through; }

/* meal library, tags, rules, exclusions */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.mild { background: var(--mild-bg); color: var(--mild); font-weight: 400; }
.banner.mild a { color: inherit; }
.subnav { margin: 0 0 1rem; }
.pill { font-size: .75rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: var(--mild-bg); color: var(--mild); vertical-align: middle; }
#meal-q { margin-bottom: 1rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid p { margin: 0 0 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid label:not(.check) { display: block; margin-bottom: .2rem; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem .75rem; margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.tag-group { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .9rem; margin-top: .25rem; }
.tag-group h3 { margin: 0; min-width: 6.5rem; color: var(--muted); font-size: .85rem; font-family: var(--font-body); }
label.check { display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; font-weight: 500; font-size: 1rem; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.check-row { align-self: end; }
.page .hint { display: block; font-size: .85rem; margin: .2rem 0 0; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.danger-zone { margin-top: 1.5rem; }
button.danger { color: var(--strong); border-color: var(--strong); }
.review { max-width: 1100px; }
.review-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
.review-ref { position: sticky; top: 1rem; }
.review-ref h2 { margin-bottom: .25rem; }
.review-ref h3 { margin: 1rem 0 .25rem; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pre { white-space: pre-wrap; margin: 0; }
@media (max-width: 800px) { .review-layout { grid-template-columns: minmax(0, 1fr); } .review-ref { position: static; } }
.tag-add .fields { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.tag-add .fields p { margin: 0 0 1rem; }
.tag-add .grow { flex: 1 1 220px; }
.tag-add select { width: auto; }
.tag-row { flex-wrap: wrap; }
.tag-rename { display: flex; gap: .5rem; flex: 1 1 260px; align-items: center; }
.pill.strong { background: var(--strong-bg); color: var(--strong); }
.rule-row.is-off { opacity: .6; }
.rule-row .toggle { min-width: 3.5rem; }
.add-rule { display: flex; flex-wrap: wrap; gap: .5rem; }
.page > h2 { margin-top: 1.75rem; }
.plan-list + .card { margin-top: 1rem; }
fieldset label.check { margin-right: .9rem; }
.tag-add label { display: block; margin-bottom: .2rem; }
.prep-note { font-size: .85rem; color: var(--mild); margin: .4rem 0 0; }
.banner.prep-note { background: var(--mild-bg); }
.history-log .backfill { flex: 1 1 100%; margin-top: .5rem; }
.history-log .backfill summary { cursor: pointer; }
.history-log .status-buttons, .history-log .swap-form { margin-top: .5rem; }
.history-row { flex-wrap: wrap; }
.page-head a.btn.small { flex: 0 0 auto; }
/* Shopping list: sticky header (title, progress, add), the list itself, done groups, footer. */
.shopping-page { padding-top: 0; }
.shopping-page h2 { margin: 1.1rem 0 0; }
#shop-body { display: block; padding-top: .5rem; }
.shop-header { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: .85rem 1rem .6rem;
  margin: 0 -1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; border-bottom: 1px solid var(--line); }
.shop-header h1 { margin: 0; flex: 1 1 auto; }
.shop-progress { flex: 1 1 140px; min-width: 120px; }
.shop-progress-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.shop-live { font-size: .75rem; }
.shop-live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: .3rem; vertical-align: 1px; }
.shop-live.is-stale::before { background: var(--mild); }
.shop-row.is-synced { animation: shop-synced 2.5s ease-out; }
@keyframes shop-synced { from { background: var(--accent-soft); } to { background: transparent; } }
.shop-progress-count { font-size: .8rem; font-weight: 600; color: var(--muted); }
.shop-progress-bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: .3rem; overflow: hidden; }
.shop-progress-fill { height: 100%; background: var(--accent); border-radius: inherit; }
.shop-add { flex: 0 0 auto; position: relative; }
.shop-add > summary { list-style: none; }
.shop-add > summary::-webkit-details-marker { display: none; }
.shop-add-toggle { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 1.4rem;
  line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.shop-add form { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 11; display: flex; gap: .4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .6rem; width: max(260px, 60vw); }
.shop-add input[type=text] { font-size: 1rem; }   /* ≥16px: stops iOS zooming in on focus */

.shop-toast { position: fixed; left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 40; background: var(--strong-bg); color: var(--strong); font-weight: 600; text-align: center;
  padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow); }
@media (max-width: 600px) {
  .shop-toast { bottom: calc(64px + env(safe-area-inset-bottom) + .5rem); }
  /* Room's tight at phone width: shrink the title and let progress shrink too, so the "+" stays
     on the header's one row instead of wrapping to a row of its own. */
  .shop-header h1 { font-size: 1.3rem; }
  .shop-progress { flex: 1 1 90px; min-width: 0; }
  /* The dropdown was anchored to the "+" button (fine on a wide header) but at this width that
     puts most of it past the left edge, where overflow-x:hidden clips it. Anchor it to the
     header itself instead, spanning almost its full width. */
  .shop-add { position: static; }
  .shop-add form { left: .75rem; right: .75rem; width: auto; }
}

.shop-section, .shop-extras { display: block; margin: 0; }
.shop-row, .shop-extra-row { display: flex; flex-wrap: wrap; align-items: stretch; border-bottom: 1px solid var(--line); }
.shop-row > label { flex: 1; display: flex; align-items: center; gap: .7rem; cursor: pointer; min-height: 52px; padding: .45rem .25rem; }
.shop-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.shop-row input[type=checkbox], .shop-extra-row input[type=checkbox] { flex: 0 0 auto; width: 24px; height: 24px; }
.shop-row.is-checked .shop-name, .shop-extra-row.is-checked .shop-name { text-decoration: line-through; color: var(--muted); }
.shop-row:has(input.htmx-request) { opacity: .5; }   /* visible "not confirmed yet" while a tick's save is in flight */
.shop-name { font-weight: 600; }
.shop-meals { font-size: .85rem; }
.shop-hint { margin-top: .25rem; font-size: .8rem; font-weight: 500; color: var(--mild); background: var(--mild-bg); border-radius: 6px; padding: .1rem .5rem; }
.shop-row.is-checked .shop-hint { display: none; }
.shop-finish > summary { list-style: none; cursor: pointer; min-height: 48px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent); font-weight: 700; border-radius: var(--radius); }
.shop-finish > summary::-webkit-details-marker { display: none; }
.shop-finish[open] > summary { margin-bottom: .5rem; }
.shop-finish button { width: 100%; min-height: 48px; }
.shop-toast.shop-undo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; text-align: left;
  background: var(--text); color: var(--bg); }
.shop-toast.shop-undo .link { color: var(--accent-soft); font-weight: 700; text-decoration: underline; min-height: 44px; }
.spares-note { border: 1px solid var(--mild); background: var(--mild-bg); border-radius: var(--radius); padding: .6rem .8rem; margin: .5rem 0; }
.spares-note p { margin: 0 0 .4rem; }
.spares-actions { display: flex; gap: .5rem; }
.shop-extra-row.is-new { animation: shop-new 2.5s ease-out; }
@keyframes shop-new { from { background: var(--accent); } to { background: transparent; } }
.shop-extra-remove { flex: 0 0 auto; min-height: 44px; padding: 0 .5rem; color: var(--strong); }
.shop-edit { flex: 0 0 auto; width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; align-self: center; color: var(--muted); text-decoration: none; }
.shop-edit[aria-expanded=true] { color: var(--accent-strong); background: var(--accent-soft); border-radius: 8px; }
.shop-note { font-size: .85rem; font-style: italic; }
.shop-note::before { content: "\201C"; } .shop-note::after { content: "\201D"; }
.shop-row.is-checked .shop-note { display: none; }
.shop-panel { flex: 0 0 100%; display: flex; flex-direction: column; gap: .5rem; padding: .6rem; background: var(--surface-2); border-radius: 8px; margin-bottom: .45rem; }
.shop-panel[hidden] { display: none; }
.shop-panel label { display: flex; flex-direction: column; gap: .15rem; font-size: .8rem; color: var(--muted); }
.shop-panel input[type=text] { width: 100%; min-height: 44px; }
.shop-panel-src { margin: 0; font-size: .85rem; }
.shop-panel-src a { display: block; padding: .15rem 0; }
.shop-panel-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.shop-panel-actions .grow { flex: 1; }
.shop-done summary, .pantry-check summary { cursor: pointer; margin: .75rem 0 .5rem; min-height: 44px; display: flex; align-items: center; }
.shop-footer { margin-top: 1.5rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.shop-footer form { margin-top: .75rem; }
.recipe-card { align-items: flex-start; gap: .75rem; }
.recipe-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; background: var(--surface-2); }
.recipe-info { display: flex; flex-direction: column; gap: .3rem; flex: 1 1 auto; min-width: 0; }
.recipe-actions { display: flex; gap: .5rem; margin-top: .3rem; }

/* --- sections and filter chips (recipe finder, meals, board library) --- */
.tile-group { margin-top: 1rem; }
.tile-label { font-family: var(--font-body); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 .4rem; }
.section-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .5rem; }
.section-tile { display: flex; flex-direction: column; gap: .1rem; min-height: 56px; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.section-tile.course { background: var(--surface-2); }
.section-tile b { font-family: var(--font-head); font-size: 1rem; }
.section-tile span { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.section-tile[aria-current] { border-color: var(--accent); background: var(--accent-soft); }
.recipe-search { margin-top: 1rem; }
.result-summary { margin: .75rem 0 0; }
.recipe-pills { display: flex; flex-wrap: wrap; gap: .3rem; }
.pill.section-pill { background: var(--accent-soft); color: var(--accent-strong); }
.pill.quiet { background: var(--surface-2); color: var(--muted); }
.recipe-actions { flex-wrap: wrap; align-items: center; }
.recipe-actions select { max-width: 100%; }
.load-more { justify-content: center; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0 0; }
.filter-chip { display: inline-flex; align-items: center; gap: .3rem; min-height: 36px; padding: .15rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .85rem; text-decoration: none; font-variant-numeric: tabular-nums; }
.filter-chip i { font-style: normal; color: var(--muted); font-size: .8rem; }
.filter-chip[aria-pressed="true"], .filter-chip[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.filter-chip[aria-pressed="true"] i, .filter-chip[aria-current] i { color: inherit; opacity: .85; }
.protein-mix { margin: .6rem 0 0; font-size: .9rem; font-variant-numeric: tabular-nums; }
/* Mid-tone fills read on both the light and dark surfaces; the numbers are in the legend text, not on the colour. */
.mix-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.mix-bar span { display: block; height: 100%; min-width: 4px; }
.mix-legend { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .15rem .9rem; }
.mix-legend i { display: inline-block; width: .65rem; height: .65rem; border-radius: 3px; margin-right: .35rem; }
.mix-bar span, .mix-legend i { background: #8a9a96; }
.mix-bar .mix-chicken, .mix-legend .mix-chicken { background: #d99a2b; }
.mix-bar .mix-beef, .mix-legend .mix-beef { background: #b8443a; }
.mix-bar .mix-pork, .mix-legend .mix-pork { background: #d97ea4; }
.mix-bar .mix-lamb, .mix-legend .mix-lamb { background: #8b6bbf; }
.mix-bar .mix-seafood, .mix-legend .mix-seafood { background: #2b7fd9; }
.mix-bar .mix-vegetarian, .mix-legend .mix-vegetarian { background: #2f8f57; }
.library-block .filter-chips { margin: 0 0 .5rem; }

/* --- people --- */
.people-list li { flex-wrap: wrap; }
.person-info { display: flex; flex-direction: column; min-width: 0; }
.person-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.person-actions form { margin: 0; }
.invite-link { margin-top: 1rem; }
.copy-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.copy-row input { flex: 1 1 16rem; min-width: 0; }
.invite-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.invite-form label { flex: 1 0 100%; }
.invite-form input { flex: 1 1 12rem; min-width: 0; }

/* Recipe source (plans/_recipe_source.html): a cookbook reference takes the Open recipe button's slot. */
.src-line { margin: -.25rem 0 .75rem; font-size: .95rem; }
.source-block { display: flex; align-items: center; gap: .75rem; min-height: 60px; padding: .6rem 1.1rem; margin: 0 0 .75rem; border-radius: 14px; border: 1px dashed var(--accent); background: var(--accent-soft); }
.source-block svg { flex: none; width: 28px; height: 28px; color: var(--accent-strong); }
.source-block .t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; overflow-wrap: anywhere; }
.source-block .t b { font-size: 1.15rem; }
.source-block .t span { color: var(--muted); font-size: .9rem; }
.recipe-photos { margin-top: 1rem; }
.photo-list { list-style: none; display: flex; flex-wrap: wrap; gap: .75rem; padding: 0; margin: 0 0 .75rem; }
.photo-list li { display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }
.photo-list img { display: block; width: 140px; height: 140px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.recipe-photos-page .recipe-photo { display: block; margin: 0 0 1rem; }
.recipe-photos-page .recipe-photo img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.badge-new { display: inline-block; padding: 3px 12px; border-radius: 99px; background: var(--new-soft); color: var(--new-strong); font-size: .875rem; font-weight: 700; }
.keep-prompt { border: 1px solid var(--new); background: var(--new-soft); border-radius: 14px; padding: 1.1rem; margin: 1rem 0; display: flex; flex-direction: column; gap: .6rem; }
.keep-prompt h3 { margin: 0; font-size: 1.35rem; }
.keep-prompt p { margin: 0; line-height: 1.4; }
.keep-prompt .status-buttons { margin: .25rem 0 0; }
.future-tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--mild-bg); color: var(--mild); }
.back-row { margin-top: 1.25rem; }

/* Feedback */
.fb-form { display: grid; gap: .6rem; max-width: 640px; }
.fb-form textarea { min-height: 140px; resize: vertical; }
.fb-kinds { display: flex; flex-wrap: wrap; gap: .5rem; border: 0; padding: 0; margin: 0; }
.fb-kinds label { display: inline-flex; align-items: center; min-height: 44px; padding: .3rem .9rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); cursor: pointer; }
.fb-kinds input { position: absolute; opacity: 0; }
.fb-kinds label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 700; }
.fb-kinds label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.fb-inbox { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .6rem; }
.fb-item { display: grid; gap: .35rem; }
.fb-item.done { opacity: .65; }
.fb-item .row { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.fb-item .meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .85rem; color: var(--muted); }
.fb-item p { margin: 0; overflow-wrap: anywhere; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; color: var(--text); text-decoration: none; }
.seg a[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
