/* chowpip P0. Mobile first; light only.
   Tomato #D8462C for large type and decoration, #CB4129 for small text and
   buttons (4.5:1 on cream), cream ground, charcoal ink, apricot decoration only. */

:root {
  --tomato: #D8462C;
  --tomato-ink: #CB4129;
  --tomato-dark: #A9341F;
  --tomato-soft: #FBE4DA;
  --cream: #FDF6E9;
  --surface: #FFFBF4;
  --sand: #F6ECDC;
  --line: #EADFCC;
  --line-strong: #C9BFAE;
  --ink: #22231E;
  --muted: #625D53;
  --apricot: #EFB98B;
  --amber-ink: #8A4B12;
  --amber-soft: #FBE9D6;
  --ok-ink: #2E5A3C;
  --ok-soft: #E3EEDF;
  --font-head: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mark: "Fredoka", "Outfit", system-ui, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --pill: 999px;
  --tap: 44px;
  --gutter: 16px;
  --tabs-h: 64px;
  --shadow: 0 10px 30px rgba(34, 35, 30, 0.10);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-body);
  overflow-x: hidden;
}
body.has-tabs { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 600; margin-top: 1.5rem; }
h3 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
a { color: var(--tomato-ink); text-underline-offset: 2px; }
a:hover { color: var(--tomato-dark); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--cream); padding: 8px 12px; border-radius: 8px; z-index: 30; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.hide-phone { display: none; }

/* ---------------------------------------------------------------- frame */
.top { background: var(--cream); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 720px; margin: 0 auto; padding: 10px var(--gutter); display: flex; align-items: center; gap: 10px; min-height: 56px; }
.wordmark { display: inline-flex; align-items: center; min-height: var(--tap); font-family: var(--font-mark); font-weight: 600; font-size: 1.7rem; line-height: 1; color: var(--tomato); text-decoration: none; letter-spacing: -0.02em; }
.wordmark:hover { color: var(--tomato); }
.pilot-tag { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); border-radius: var(--pill); padding: 2px 8px; }
.account-link { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); min-width: var(--tap); justify-content: center; color: var(--ink); text-decoration: none; font-weight: 500; border-radius: var(--pill); padding: 0 10px; }
.account-link[aria-current] { color: var(--tomato-ink); }
.wrap { max-width: 720px; margin: 0 auto; padding: 20px var(--gutter) 32px; }
.wrap.narrow { max-width: 480px; }
.foot { max-width: 720px; margin: 0 auto; padding: 8px var(--gutter) 24px; color: var(--muted); font-size: .85rem; }
.foot a { color: var(--muted); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tabs-h); color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 500; }
.tabs a[aria-current] { color: var(--tomato-ink); font-weight: 700; }
.tabs a[aria-current] .icon { stroke-width: 2.4; }

@media (min-width: 900px) {
  body.has-tabs { padding-bottom: 0; }
  .hide-phone { display: inline; }
  .tabs { position: sticky; top: 57px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); background: var(--cream); grid-template-columns: repeat(4, 140px); justify-content: center; }
  .tabs a { flex-direction: row; gap: 8px; min-height: 48px; font-size: .95rem; }
  h1 { font-size: 2rem; }
}

/* ------------------------------------------------------------- feedback */
.flash { background: var(--ok-soft); color: var(--ok-ink); border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 500; }
.flash.error, .alert.error { background: var(--tomato-soft); color: var(--tomato-dark); }
.alert { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--sand); margin: 0 0 1rem; }
.alert.warn { background: var(--amber-soft); color: var(--amber-ink); }
.alert p:last-child { margin-bottom: 0; }
.note { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--muted); background: var(--sand); border-radius: var(--radius-sm); padding: 10px 12px; }
.note .icon { margin-top: 2px; color: var(--muted); }
.draft-note { border-left: 4px solid var(--apricot); }
.empty { text-align: center; padding: 28px 12px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-title { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; margin-bottom: .25rem; }
.stale { position: sticky; top: 64px; z-index: 5; display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--ink); color: var(--cream); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }
.stale[hidden] { display: none; }
.stale a { color: var(--cream); font-weight: 700; }

/* --------------------------------------------------------------- blocks */
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.card.hero { padding: 20px; box-shadow: var(--shadow); border: 0; }
.card.soft { background: var(--sand); border-color: transparent; }
.card.accent { background: var(--tomato-soft); border-color: transparent; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--tomato-ink); margin-bottom: .35rem; }
.lede { font-size: 1.05rem; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); font-weight: 600; text-decoration: none; margin: -8px 0 4px -6px; padding-right: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 6px 0 12px; }
.chips li { background: var(--sand); border-radius: var(--pill); padding: 3px 10px; font-size: .88rem; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: var(--pill); padding: 2px 9px; white-space: nowrap; }
.badge.proposed { color: var(--amber-ink); background: var(--amber-soft); }
.badge.confirmed { color: var(--cream); background: var(--ink); }
.badge.ready { color: var(--ok-ink); background: var(--ok-soft); }
.badge.draft { color: var(--amber-ink); background: var(--amber-soft); }
.badge.muted { color: var(--muted); background: var(--sand); }
.badge.tomato { color: var(--cream); background: var(--tomato-ink); }
.progress { display: block; width: 100%; height: 10px; border-radius: 5px; overflow: hidden; appearance: none; -webkit-appearance: none; border: 0; background: var(--line); }
.progress::-webkit-progress-bar { background: var(--line); border-radius: 5px; }
.progress::-webkit-progress-value { background: var(--tomato-ink); border-radius: 5px; }
.progress::-moz-progress-bar { background: var(--tomato-ink); border-radius: 5px; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.kv.wide { grid-template-columns: minmax(0, 1fr); gap: 0; }
.kv.wide dd { text-align: left; margin-bottom: 10px; }
details.more > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 600; color: var(--tomato-ink); }

/* -------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px; border-radius: var(--pill);
  background: var(--tomato-ink); color: var(--cream); border: 2px solid var(--tomato-ink);
  font: 700 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--tomato-dark); border-color: var(--tomato-dark); color: var(--cream); }
.btn.secondary { background: transparent; color: var(--tomato-ink); }
.btn.secondary:hover { background: var(--tomato-soft); color: var(--tomato-dark); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); font-weight: 600; }
.btn.quiet:hover { background: var(--sand); color: var(--ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0 4px; min-height: var(--tap); color: var(--tomato-ink); font: 600 1rem var(--font-body); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
form.inline { display: inline; }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 16px; }
.field > label, .field > .label, legend { display: block; font-weight: 700; margin-bottom: 6px; }
.hint { display: block; color: var(--muted); font-size: .88rem; font-weight: 400; margin-top: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 2px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: 400 1rem var(--font-body);
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
textarea { min-height: 120px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: var(--tap); padding: 8px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--tomato-ink); flex: none; }
.pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pick { position: relative; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 12px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 500; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick:has(input:checked) { border-color: var(--tomato-ink); background: var(--tomato-soft); }
.pick:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.pick .tick { display: none; color: var(--tomato-ink); }
.pick:has(input:checked) .tick { display: inline; }
.inline-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.qty-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 2px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg label { display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 6px 4px; text-align: center; font-size: .9rem; font-weight: 600; cursor: pointer; background: var(--surface); }
.seg label + label { border-left: 2px solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: var(--ink); color: var(--cream); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--tomato-ink); outline-offset: -3px; }
.day-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: 0; }
.day-row .day-name { font-weight: 700; margin-bottom: 6px; }
.busy-pick { margin-top: 8px; }

/* -------------------------------------------------------- lists of rows */
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.rows > li { padding: 12px 14px; border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.rows a.row-link { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-height: var(--tap); }
.rows a.row-link:hover .row-title { text-decoration: underline; }
.row-main { flex: 1; min-width: 0; }
.row-main > .row-title, .row-main > .row-sub { display: block; }
.row-title { font-weight: 700; }
.row-sub { color: var(--muted); font-size: .9rem; }
.row-side { flex: none; }

/* ----------------------------------------------------------------- week */
.night, .rows a.row-link.night { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.night .dow { font-weight: 700; line-height: 1.1; }
.night .dow small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.night .what > span { display: block; }
.night .what { min-width: 0; }
.night .meal { font-weight: 600; }
.night .reason { color: var(--tomato-ink); font-size: .9rem; }
.night .problem { color: var(--amber-ink); font-size: .9rem; }
.night .off { font-style: italic; color: var(--muted); }
.night .side { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .85rem; }
.night.today { background: var(--tomato-soft); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--muted); }
.tag .icon { width: 1rem; height: 1rem; }
.status-line { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }

/* ----------------------------------------------------------------- shop */
.cat-head { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 6px; }
.item { display: grid; grid-template-columns: var(--tap) minmax(0, 1fr); gap: 10px; align-items: start; }
.tick-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: transparent; padding: 0; }
.tick-btn:hover { border-color: var(--tomato-ink); }
.tick-btn.on { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.item.done .item-name { text-decoration: line-through; color: var(--muted); }
.item-name { font-weight: 700; }
.item-figs { color: var(--muted); font-size: .9rem; }
.item-figs strong { color: var(--ink); }
.item-tools { margin-top: 6px; }
.item-tools summary { display: inline-flex; align-items: center; min-height: 36px; color: var(--tomato-ink); font-weight: 600; font-size: .9rem; cursor: pointer; }
.have-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 6px; }
.left-hint { color: var(--ok-ink); font-size: .9rem; }

/* --------------------------------------------------------------- tonight */
.tonight-meal { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; line-height: 1.1; margin: 4px 0 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.meta li { display: inline-flex; align-items: center; gap: 6px; background: var(--sand); border-radius: var(--pill); padding: 4px 12px; font-size: .92rem; }
.meta .icon { width: 1rem; height: 1rem; }

/* --------------------------------------------------------------- meals */
.ing { display: grid; gap: 6px; }
.ing-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ing-name { font-weight: 700; }
.ing-form { display: grid; grid-template-columns: minmax(0, 1fr) 6.4rem auto; gap: 8px; align-items: center; }
.ing-form .btn.small { min-height: var(--tap); }
.ing-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 14px; align-items: center; margin-top: -4px; }
.starter-list { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.starter { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 8px 8px 14px; }
.starter .row-sub { font-size: .85rem; display: block; }
.starter .row-title { display: flex; align-items: center; min-height: 32px; }
.starter a.row-title { min-height: var(--tap); }
@media (min-width: 560px) { .starter-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* -------------------------------------------------------------- staff */
.staff-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-weight: 600; font-size: .92rem; }
.staff-nav a { color: var(--ink); text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; }
.staff-nav .link-btn { font-size: .92rem; }
.staff .top-inner { flex-wrap: wrap; }
.staff .wrap { max-width: 1100px; }
.staff .top-inner { max-width: 1100px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.tile-value { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; }
.tile-label { color: var(--muted); font-size: .85rem; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table.data { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.secret-link { word-break: break-all; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9rem; background: var(--sand); padding: 10px; border-radius: 8px; }
.qr svg { display: block; width: min(260px, 100%); height: auto; aspect-ratio: 1 / 1; margin: 0 auto; background: #fff; border-radius: 8px; }
.secret-key { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1rem; letter-spacing: .04em; background: var(--sand); padding: 10px; border-radius: 8px; }
.secret-key span { display: inline-block; white-space: nowrap; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.steps li { display: flex; gap: 8px; align-items: center; }
.steps li.done { color: var(--ok-ink); }
.steps li.todo { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .btn, .tick-btn, .pick { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}
@media print {
  .tabs, .top, .foot, .item-tools, .tick-btn, .btn { display: none !important; }
  body { background: #fff; }
}
