/* chow — app styles. Every value comes from tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
html {
  font: -apple-system-body;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
}
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100dvh; overscroll-behavior-y: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { max-width: var(--max-w); margin: 0 auto; min-height: 100dvh; position: relative; }
.view { padding-top: var(--safe-top); padding-bottom: calc(var(--tabbar-h) + 24px); outline: none; }
.view.has-dock { padding-bottom: calc(var(--tabbar-h) + var(--dock-h) + 24px); }

/* type */
.t1 { font: var(--type-title); letter-spacing: -.01em; }
.t2 { font: var(--type-title-2); }
.h { font: var(--type-headline); }
.callout { font: var(--type-callout); }
.foot { font: var(--type-footnote); color: var(--ink-2); }
.foot b, .foot strong { color: var(--ink); font-weight: 650; }
.cap { font: var(--type-caption); color: var(--ink-3); }
.flabel { font: 500 .76rem/1.38 var(--font); color: var(--ink-2); }
.muted { color: var(--ink-2); }

/* icons */
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ico.s { width: 20px; height: 20px; }
.ico.fill { fill: currentColor; }

/* buttons */
.btn { appearance: none; border: 0; min-height: var(--tap); border-radius: 999px; font: 650 1rem/1.29 var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; white-space: nowrap; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: var(--surface-2); color: var(--ink); }
.btn-plain { background: none; color: var(--accent); padding: 0 8px; }
.btn:disabled { background: var(--surface-2); color: var(--ink-3); }
.btn.lg { min-height: var(--tap-lg); }
.btn.wide { width: 100%; }
.btn:active { filter: brightness(.92); }
.icon-btn { appearance: none; border: 0; background: none; color: var(--ink); width: var(--tap); height: var(--tap); border-radius: var(--r-ctl); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.icon-btn.filled { background: var(--surface-2); }
.chip { appearance: none; border: 0; min-height: var(--tap); padding: 0 14px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font: 600 .88rem/1.33 var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.chip.sel { background: var(--ink); color: var(--bg); }
.chip.water { background: var(--water-tint); }
.linkbtn { appearance: none; border: 0; background: none; color: var(--accent); font: 600 .88rem/1.33 var(--font); min-height: var(--tap); padding: 0 8px; }

/* layout bits */
.pad { padding-left: var(--gutter); padding-right: var(--gutter); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.grow { flex: 1; min-width: 0; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px var(--gutter) 12px; }

/* tab bar: a floating frosted pill (Today · Pantry · Grocery · Plan) and a round accent + button with its menu */
.tabbar { position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, var(--max-w)); height: var(--tabbar-h); padding: 10px 16px calc(10px + var(--safe-bottom)); display: flex; align-items: center; gap: 12px; pointer-events: none; }
.tabbar > * { pointer-events: auto; }
.glass { background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); border: 1px solid var(--glass-line); box-shadow: var(--e-glass); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--surface-2); } }
.tabpill { flex: 1; min-width: 0; height: 72px; border-radius: 999px; padding: 6px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.tab { appearance: none; border: 0; background: none; height: 60px; border-radius: 999px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-2); font: 600 .72rem/1.2 var(--font); padding: 0; text-decoration: none; min-width: 0; transition: background var(--dur) var(--ease); }
.tab .ico { width: 26px; height: 26px; }
.tab.on { background: var(--glass-on); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10); }
.tab.on .ico { color: var(--accent); }
.fab { appearance: none; border: 0; width: 66px; height: 66px; border-radius: 50%; flex-shrink: 0; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: var(--e-fab); }
.fab .ico { width: 30px; height: 30px; stroke-width: 2.4; transition: transform var(--dur) var(--ease); }
.fab[aria-expanded="true"] .ico { transform: rotate(45deg); }
.fab:active { filter: brightness(.92); }
.fabmenu { position: fixed; z-index: 21; right: max(16px, calc((100% - var(--max-w)) / 2 + 16px)); bottom: calc(var(--tabbar-h) - 2px); min-width: 232px; max-width: min(360px, calc(100vw - 32px)); border-radius: 22px; padding: 6px; display: flex; flex-direction: column; gap: 2px; animation: pop var(--dur) var(--ease); transform-origin: bottom right; }
.fabmenu[hidden] { display: none; }
.fabmenu button { appearance: none; border: 0; background: none; color: var(--ink); min-height: 52px; padding: 0 18px 0 14px; border-radius: 16px; display: flex; align-items: center; gap: 12px; font: 600 1rem/1.29 var(--font); text-align: left; white-space: nowrap; }
.fabmenu button:active { background: var(--glass-on); }
.fabmenu button .ico { color: var(--accent); }
.fabmenu button .txt { white-space: nowrap; }
.fabmenu button .foot { margin-left: auto; padding-left: 12px; white-space: normal; text-align: right; }   /* wraps: a long sub (a date range) must not push the menu past 328 px */
.fabmenu button:disabled { color: var(--ink-3); }
@keyframes pop { from { transform: translateY(8px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.app.no-tabs .tabbar { display: none; }
/* docks float above the pill: no bar, the secondary buttons go frosted */
.dock { position: fixed; z-index: 19; left: 50%; transform: translateX(-50%); width: min(100%, var(--max-w)); bottom: calc(var(--tabbar-h) - 6px); padding: 8px 16px; display: flex; gap: 10px; pointer-events: none; }
.dock .btn { min-height: var(--tap-lg); pointer-events: auto; border-radius: 999px; box-shadow: var(--e-glass); }
.dock .btn-secondary { background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); border: 1px solid var(--glass-line); }
.dock .btn-primary { box-shadow: var(--e-fab); }

/* bars */
.bar { height: 8px; background: var(--surface-3); display: flex; overflow: hidden; border-radius: 999px; }
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width var(--dur) var(--ease); }
.barwrap { display: flex; align-items: center; gap: 4px; }
.barwrap .bar { flex: 1; }
.tick { display: inline-block; width: 4px; height: 14px; background: var(--over); flex-shrink: 0; }

/* segmented */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface-2); border-radius: 999px; padding: 2px; gap: 3px; }
.seg button, .seg a { display: flex; align-items: center; justify-content: center; text-decoration: none; appearance: none; border: 0; background: none; min-height: var(--tap); border-radius: 999px; font: 600 .82rem/1.2 var(--font); color: var(--ink-2); padding: 0 4px; white-space: nowrap; }
.seg [aria-selected="true"], .seg [aria-checked="true"] { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .flabel { font: 500 .76rem/1.38 var(--font); color: var(--ink-2); }
.input, .select { height: 48px; border-radius: var(--r-ctl); background: var(--surface-2); border: 2px solid transparent; color: var(--ink); font: var(--type-body); padding: 0 13px; width: 100%; outline: none; appearance: none; -webkit-appearance: none; }
.input:focus, .select:focus { border-color: var(--accent); background: var(--surface); }
.input.err { border-color: var(--ink); }
.input.num { text-align: right; }
.select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.errmsg { display: flex; gap: 6px; align-items: center; font: 500 .76rem/1.38 var(--font); color: var(--ink); }
.search { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 12px; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--ink-3); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); font: var(--type-body); padding: 0; height: 100%; }
.search input::placeholder, .input::placeholder { color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.switch { appearance: none; width: 52px; height: 32px; border-radius: var(--r-ctl); background: var(--surface-3); position: relative; border: 0; padding: 0; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: var(--r-ctl); background: #FFFFFF; transition: left var(--dur) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 23px; }

/* Today */
.macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.macro { display: flex; flex-direction: column; gap: 6px; appearance: none; border: 0; background: none; padding: 0; text-align: left; color: inherit; }
.frow { appearance: none; border: 0; border-top: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto 52px; align-items: center; column-gap: 12px; min-height: 52px; padding: 0 var(--gutter); text-align: left; font: var(--type-body); position: relative; z-index: 1; touch-action: pan-y; }
.frow .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .q { font: var(--type-callout); color: var(--ink-2); }
.frow .k { text-align: right; font-weight: 600; }
.swipe { position: relative; overflow: hidden; }
.swipe .under { position: absolute; top: 1px; right: 0; bottom: 0; width: 96px; display: flex; background: var(--surface-3); }
.swipe .under button { appearance: none; border: 0; background: none; color: var(--ink); width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 .76rem/1.2 var(--font); }
.swipe .frow { transition: transform var(--dur) var(--ease); }
.swipe.dragging .frow { transition: none; }
.addrow { appearance: none; border: 0; border-top: 1px solid var(--line); background: none; width: 100%; min-height: 48px; padding: 0 var(--gutter); display: flex; align-items: center; gap: 10px; color: var(--accent); font: 600 .88rem/1.33 var(--font); text-align: left; }
.expander { appearance: none; border: 0; background: none; color: var(--ink); width: 100%; min-height: var(--tap); padding: 0 4px; display: flex; align-items: center; justify-content: space-between; text-align: left; }
.went { appearance: none; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); width: 100%; min-height: var(--tap); padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; align-items: center; gap: 8px; text-align: left; font: var(--type-callout); }
.went.confirm { color: var(--accent); font-weight: 650; }

/* Nutrition label */
.lbl { border: 2px solid var(--rule); padding: 6px 10px 10px; background: var(--bg); }
.lbl-t { font: var(--type-label-title); font-stretch: 72%; letter-spacing: -.01em; }
.r-thick { height: var(--rule-section); background: var(--rule); }
.r-mid { height: var(--rule-group); background: var(--rule); }
.lgrp { font: 800 .76rem/1.38 var(--font); padding: 6px 0 2px; }
.lcal { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 6px 0 4px; }
.lcal .w { font: 900 1.75rem/1 var(--font); font-stretch: 80%; }
.lcal .v { font: 900 2.35rem/1 var(--font); }
.lr { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; border-top: 1px solid var(--hair); font: var(--type-label-row); }
.lr b { font-weight: 800; }
.lr.first { border-top: 0; }
.lr.ind { padding-left: 16px; }
.lr.ind2 { padding-left: 32px; }
.lr .dv { font-weight: 800; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lr.hd { justify-content: flex-end; font-size: .76rem; font-weight: 800; border-top: 0; }

/* label-shaped form */
.nr { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; border-top: 1px solid var(--hair); font: var(--type-label-row); }
.nr.first { border-top: 0; }
.nr.ind { padding-left: 16px; } .nr.ind2 { padding-left: 32px; }
.nr b { font-weight: 800; }
.nin { display: flex; align-items: center; gap: 6px; }
.nin input { width: 84px; height: 36px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 1rem/1 var(--font); text-align: right; padding: 0 10px; outline: none; font-variant-numeric: tabular-nums; }
.nin input:focus { border-color: var(--accent); }
.nin input.err { border: 2px solid var(--ink); }
.nin span { width: 52px; font: var(--type-footnote); color: var(--ink-2); }

/* lists */
.lrow { appearance: none; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); width: 100%; min-height: 60px; padding: 8px var(--gutter); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; text-align: left; font: var(--type-body); }
.lrow .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lrow .main > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .k { font-weight: 600; }
.rrow { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; align-items: center; column-gap: 10px; min-height: 60px; padding: 0 10px 0 var(--gutter); border-top: 1px solid var(--line); }
.rrow .main { appearance: none; border: 0; background: none; color: var(--ink); text-align: left; padding: 8px 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; font: var(--type-body); }
.rrow .main > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow .k { font-weight: 600; text-align: right; }
.qadd { appearance: none; border: 0; width: 44px; height: 44px; border-radius: var(--r-ctl); background: var(--accent-tint); color: var(--accent); display: flex; align-items: center; justify-content: center; padding: 0; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; padding: 16px var(--gutter) 6px; font: 700 .76rem/1.38 var(--font); color: var(--ink-2); }
.empty { padding: 32px var(--gutter); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* stepper */
.stepper { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; background: var(--surface-2); border-radius: var(--r-ctl); height: 64px; }
.stepper button { appearance: none; height: 64px; border: 0; background: none; color: var(--ink); display: flex; align-items: center; justify-content: center; }
.stepper input { text-align: center; font: 700 2rem/1 var(--font); background: none; border: 0; color: var(--ink); width: 100%; outline: none; font-variant-numeric: tabular-nums; }
.chips { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }

/* overlay: sheets, toasts, fullscreen */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); animation: fade var(--dur) var(--ease); }
.sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, var(--max-w)); max-height: calc(100dvh - var(--safe-top) - 12px); background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--e-sheet); display: flex; flex-direction: column; animation: up var(--dur) var(--ease); }
.sheet-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sheet.tall { height: calc(100dvh - var(--safe-top) - 12px); }
.sheet-grab { flex-shrink: 0; padding: 8px 0 6px; display: flex; justify-content: center; touch-action: none; }
.sheet-grab i { width: 36px; height: 5px; background: var(--surface-3); border-radius: var(--r-ctl); display: block; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--gutter) 16px; display: flex; flex-direction: column; gap: 16px; }
.sheet-body.flush { padding-left: 0; padding-right: 0; }
.sheet-foot { flex-shrink: 0; padding: 12px 16px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--surface); }
.sheet-foot .btn { min-height: var(--tap-lg); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet .lbl { background: var(--surface); }
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); width: min(calc(100% - 32px), calc(var(--max-w) - 32px)); bottom: calc(var(--tabbar-h) + var(--dock-h) + 12px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 6px 0 16px; border-radius: var(--r-ctl); background: var(--ink); color: var(--bg); font: 600 .88rem/1.33 var(--font); box-shadow: var(--e-toast); animation: up var(--dur) var(--ease); }
.toast.plain { padding-right: 16px; }
.toast button { appearance: none; border: 0; background: none; color: var(--bg); font: 750 .88rem/1.33 var(--font); min-height: 44px; padding: 0 10px; text-decoration: underline; text-underline-offset: 3px; }
@keyframes up { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.toast { animation-name: fade; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sheet, .toast, .scrim { animation: fade 120ms linear; }
  .bar > i, .switch::after, .swipe .frow { transition: none; }
}

/* camera */
.cam { position: fixed; inset: 0; z-index: 50; background: #0E0F0F; color: #F3F4F1; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .shade { position: absolute; inset: 0; background: rgba(0,0,0,.25); pointer-events: none; }
.cam .top { position: absolute; top: calc(var(--safe-top) + 12px); left: 20px; right: 20px; font: 600 .88rem/1.33 var(--font); }
.cam .mid { position: absolute; left: 0; right: 0; top: 24%; display: flex; flex-direction: column; align-items: center; gap: 20px; pointer-events: none; }
.reticle { position: relative; width: min(78vw, 320px); aspect-ratio: 300 / 170; }
.reticle i { position: absolute; width: 30px; height: 30px; border: 0 solid #F3F4F1; }
.reticle i:nth-child(1) { left: 0; top: 0; border-top-width: 4px; border-left-width: 4px; }
.reticle i:nth-child(2) { right: 0; top: 0; border-top-width: 4px; border-right-width: 4px; }
.reticle i:nth-child(3) { left: 0; bottom: 0; border-bottom-width: 4px; border-left-width: 4px; }
.reticle i:nth-child(4) { right: 0; bottom: 0; border-bottom-width: 4px; border-right-width: 4px; }
.reticle b { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: rgba(243,244,241,.55); }
.cam .bottom { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 12px); padding: 0 20px 12px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.cam .bottom .row { width: 100%; justify-content: space-between; }
.cam-btn { appearance: none; border: 0; width: 64px; height: 64px; border-radius: var(--r-ctl); background: rgba(243,244,241,.14); color: #F3F4F1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 .65rem/1.2 var(--font); }
.cam-btn[aria-pressed="true"] { background: #F3F4F1; color: #0E0F0F; }
.cam .typelink { appearance: none; border: 0; background: none; min-height: 44px; padding: 0 12px; color: #F3F4F1; font: 600 1rem/1.29 var(--font); text-decoration: underline; text-underline-offset: 4px; }
.cam .msg { position: absolute; left: 20px; right: 20px; top: 45%; text-align: center; font: var(--type-body); }

/* Grocery */
.ckrow { display: flex; align-items: center; border-top: 1px solid var(--line); padding-right: 12px; }
.ck { appearance: none; border: 0; background: none; color: var(--ink); flex: 1; min-width: 0; min-height: 60px; padding: 8px 8px 8px var(--gutter); display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; text-align: left; }
.box { width: 28px; height: 28px; border: 2px solid var(--ink-3); border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--bg); }
.ck[aria-checked="true"] .box { background: var(--ink); border-color: var(--ink); }
.ck .nm { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; font: 500 1rem/1.29 var(--font); }
.ck .nm > span:first-child { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck .q { font: 600 1rem/1.29 var(--font); white-space: nowrap; }
.ck[aria-checked="true"] .nm > span:first-child, .ck[aria-checked="true"] .q { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.src { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--ink-2); font: 600 .7rem/1.33 var(--font); }
.addp { appearance: none; border: 0; height: 44px; padding: 0 12px; border-radius: var(--r-ctl); background: var(--accent-tint); color: var(--accent); font: 650 .88rem/1.33 var(--font); white-space: nowrap; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; align-items: center; column-gap: 8px; min-height: 68px; padding: 8px 12px 8px var(--gutter); border-top: 1px solid var(--line); }
.prow .main { appearance: none; border: 0; background: none; color: var(--ink); padding: 0; text-align: left; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.prow .bar > i { background: var(--ink); }
.stepbtn { appearance: none; border: 0; width: 44px; height: 44px; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; }

/* Plan — month calendar (Outlook-style): weekday header, 7-column grid, today in a filled circle, a chip per planned slot */
.cal-nav { display: flex; align-items: center; gap: 4px; padding: 0 8px 2px; }
.cal-nav h2 { flex: 1; text-align: center; }
.cal-wd { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 2px 8px 0; }
.cal-wd span { text-align: center; font: var(--type-caption); color: var(--ink-3); padding: 4px 0 6px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; margin: 0 8px; background: var(--line); border: 1px solid var(--line); touch-action: pan-y; }
.cal-cell { appearance: none; border: 0; background: var(--bg); color: var(--ink); min-height: 88px; min-width: 0; padding: 4px 2px 5px; display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left; }
.cal-cell .n { align-self: center; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font: 600 .82rem/1 var(--font); margin-bottom: 2px; }
.cal-cell.today .n { background: var(--accent); color: var(--on-accent); font-weight: 750; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .n, .cal-cell.past:not(.today) .n { color: var(--ink-3); }
.cal-cell.past .pc, .cal-cell.out .pc { opacity: .55; }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell:active { background: var(--surface-2); }
.pc { display: block; font: 600 .62rem/1.25 var(--font); font-style: normal; padding: 2px 3px 2px 4px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface-2); color: var(--ink); border-left: 2px solid var(--ink-3); }
.pc.breakfast { background: var(--accent-tint); border-color: var(--accent); }
.pc.lunch { background: var(--water-tint); border-color: var(--water); }
.pc.dinner { background: var(--surface-3); border-color: var(--ink); }
.pc.snacks { background: var(--over-tint); border-color: var(--over); }
.pc.dot { width: 10px; height: 10px; padding: 0; border-radius: 2px; border-left-width: 3px; flex-shrink: 0; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px var(--gutter) 0; font: var(--type-caption); color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .pc { width: 10px; height: 10px; padding: 0; border-radius: 2px; border-left-width: 3px; }
@media (min-width: 480px) { .cal-cell { min-height: 96px; } .pc { font-size: .7rem; } }
/* day sheet rows */
.slot { appearance: none; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); width: 100%; min-height: 54px; padding: 0 var(--gutter); display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; column-gap: 12px; text-align: left; font: var(--type-body); }
.slot .ml { font: 500 .76rem/1.38 var(--font); color: var(--ink-2); }
.slot .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .v.add { color: var(--accent); font-weight: 600; font-size: .88rem; }
.slot .k { font: 600 .88rem/1.33 var(--font); color: var(--ink-2); }
.sheet .slot { background: var(--surface); }
.sheet .slot:last-child { border-bottom: 1px solid var(--line); }
/* Plan: view switcher dropdown (top right) and the Week / Day cards */
.dd { position: relative; }
.dd .chip { min-height: var(--tap); padding: 0 8px 0 12px; gap: 2px; }
.ddmenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 150px; border-radius: 16px; padding: 6px; display: flex; flex-direction: column; animation: pop var(--dur) var(--ease); transform-origin: top right; }
.ddmenu button { appearance: none; border: 0; background: none; color: var(--ink); min-height: 44px; padding: 0 12px 0 14px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 600 .95rem/1.29 var(--font); text-align: left; white-space: nowrap; }
.ddmenu button[aria-checked="true"] { color: var(--accent); }
.ddmenu button:active { background: var(--glass-on); }
.dcards { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; touch-action: pan-y; }
.dcard { margin: 0 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); overflow: hidden; }
.dcard-h { appearance: none; border: 0; background: none; color: var(--ink); width: 100%; min-height: 52px; padding: 0 12px 0 var(--gutter); display: flex; align-items: center; gap: 10px; text-align: left; }
.dcard-h .foot { margin-left: auto; white-space: nowrap; }
.dcard-h .ico { color: var(--ink-3); }
.dcard.today .dcard-h .h { color: var(--accent); }
.dcard.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.dcard .slot { background: var(--surface); }
.plan-day .dcard .slot { min-height: 64px; }
.plan-day .dcard .slot .v { white-space: normal; }
/* day sheet: a header per meal, one row per planned item, an add row */
.pm-h { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px var(--gutter) 2px; }
.pm-h h3 { font: var(--type-headline); }
.pm-h .foot { margin-left: auto; }
.pitem { appearance: none; border: 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; min-height: 48px; padding: 0 var(--gutter) 0 calc(var(--gutter) + 20px); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; text-align: left; font: var(--type-body); }
.pitem .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem .k { font: 600 .88rem/1.33 var(--font); color: var(--ink-2); }
.pitem.add { display: flex; gap: 8px; color: var(--accent); font: 600 .88rem/1.33 var(--font); min-height: 44px; }
section:last-of-type > .pitem:last-child { border-bottom: 1px solid var(--line); }
.pc.more { background: none; border-left-color: transparent; color: var(--ink-2); font-weight: 500; }

/* Settings */
.gh { font: 700 .76rem/1.38 var(--font); color: var(--ink-2); padding: 20px var(--gutter) 8px; }
.group { margin: 0 16px; background: var(--surface); border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--line); }
.setrow { appearance: none; border: 0; background: none; color: var(--ink); width: 100%; min-height: 50px; padding: 0 12px 0 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; align-items: center; column-gap: 10px; text-align: left; font: var(--type-body); text-decoration: none; }
.setrow + .setrow, .group > * + * { border-top: 1px solid var(--line); }
.setrow .v { color: var(--ink-2); }
.setrow .seg { width: 132px; }
.setnote { padding: 8px var(--gutter) 0; }

/* auth */
.mark { font: 900 4rem/1 var(--font); font-stretch: 70%; letter-spacing: -.02em; }
.auth { padding: calc(var(--safe-top) + 48px) 24px calc(var(--safe-bottom) + 120px); display: flex; flex-direction: column; gap: 18px; }
.auth-foot { position: fixed; left: 50%; transform: translateX(-50%); width: min(100%, var(--max-w)); bottom: 0; padding: 12px 20px calc(12px + var(--safe-bottom)); background: var(--bg); }

/* desktop: same column, a little air */
@media (min-width: 640px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* while a sheet or the camera is up, toasts move to the top so they never cover its controls */
body:has(.sheet) .toasts, body:has(.cam) .toasts { bottom: auto; top: calc(var(--safe-top) + 12px); }

/* ---- added in phase 0 for the server build: sync bar, ghost rows, completed day, charts, A2HS card, codes, lockout ---- */
.syncbar { position: fixed; z-index: 30; top: 0; left: 50%; transform: translateX(-50%); width: min(100%, var(--max-w)); display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 32px; padding: calc(var(--safe-top) + 4px) 16px 4px; background: var(--surface-2); color: var(--ink-2); font: 600 .76rem/1.38 var(--font); border-bottom: 1px solid var(--line); }
.syncbar[hidden] { display: none; }
.syncbar i { display: inline-block; width: 4px; height: 12px; background: var(--over); flex-shrink: 0; }
body:has(.syncbar:not([hidden])) .view { padding-top: calc(var(--safe-top) + 32px); }
.queued .k::after, .ck.queued .q::after, .went.queued span:nth-child(2)::after { content: ""; display: inline-block; width: 4px; height: 12px; background: var(--over); margin-left: 6px; vertical-align: -1px; }

.frow.ghost { color: var(--ink-3); border-top-style: dashed; grid-template-columns: minmax(0, 1fr) auto auto; }
.frow.ghost .n::before { content: "Planned · "; font: var(--type-callout); }
.frow.ghost .k { font-weight: 500; }
.ghost-log { appearance: none; border: 0; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-ctl); background: var(--accent-tint); color: var(--accent); font: 650 .82rem/1 var(--font); white-space: nowrap; }

.daydone { margin: 8px var(--gutter) 0; border: 2px solid var(--rule); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.daydone .dd-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.daydone .dd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; border-top: var(--rule-group) solid var(--rule); padding-top: 8px; }
.daydone .stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.daydone .stat b { font: 700 1.25rem/1.2 var(--font); white-space: nowrap; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--ink); }
.chart .bar.protein { fill: var(--accent); }
.chart .bar.carbs { fill: var(--accent-2); }
.chart .bar.fat { fill: var(--accent-3); }
.chart .bar.over { fill: var(--over); }
.chart .bar.water { fill: var(--water); }
.chart .bar.dim { fill: var(--surface-3); }
.chart .line { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linejoin: round; }
.chart .avg { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart .goal { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .pt { fill: var(--ink); }
.chart text { font: 500 10px var(--font); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 22px var(--gutter) 6px; }
.chart-wrap { padding: 0 var(--gutter); }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; padding: 6px var(--gutter) 0; }

.a2hs { margin: 12px 16px 0; padding: 14px 16px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.a2hs ol { margin: 0; padding-left: 20px; font: var(--type-callout); color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }

.code-input { font: 700 1.6rem/1 var(--font) !important; letter-spacing: .3em; text-align: center; height: 56px !important; font-variant-numeric: tabular-nums; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font: 600 1rem/1.5 var(--font); font-variant-numeric: tabular-nums; padding: 8px 0; }
.qr { width: 180px; height: 180px; background: #fff; border-radius: var(--r-ctl); padding: 8px; align-self: center; }

.lock { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-card); background: var(--surface-2); color: var(--ink); }
.lock svg { color: var(--over); }

.rrow.online { grid-template-columns: minmax(0, 1fr) auto; }
.src.online { background: var(--accent-tint); color: var(--accent); }

/* include toggles in sheets reuse .ck but are not purchases: no strikethrough when checked */
.sheet .ck[aria-checked="true"] .nm > span:first-child, .sheet .ck[aria-checked="true"] .q { color: var(--ink); text-decoration: none; }

/* ---- modern pass (2026-10-14 evening): cards, section heads, week strip, meal cards; colors unchanged ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--gutter) 4px; }
.icon-btn.round { border-radius: 50%; }
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 6px 8px 14px; touch-action: pan-y; }
.wk-d { appearance: none; border: 0; background: none; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 4px 0; font: 600 .76rem/1 var(--font); }
.wk-d .c { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--surface-3); display: flex; align-items: center; justify-content: center; font: 600 .88rem/1 var(--font); color: var(--ink); transition: border-color var(--dur) var(--ease); }
.wk-d.done .c { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.wk-d.sel .c { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.wk-d.sel .wd, .wk-d.today .wd { color: var(--accent); }
.sect-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 26px var(--gutter) 10px; }
.sect-h h2 { font: 700 1.3rem/1.2 var(--font); letter-spacing: -.01em; }
.cards { display: flex; flex-direction: column; gap: 12px; }
.card { margin: 0 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush > .lrow:first-child, .card.flush > .prow:first-child, .card.flush > .ckrow:first-child, .card.flush > .frow:first-child, .card.flush > .swipe:first-child .frow { border-top: 0; }
.card .lrow, .card .prow, .card .ckrow, .card .frow, .card .frow.ghost, .card .went, .card .section-h { background: var(--surface); }
.card .swipe .under { background: var(--surface-3); }
.card .section-h { padding-top: 14px; }
.card .lbl { background: var(--surface); }
.kpi { font: 800 2.1rem/1 var(--font); letter-spacing: -.02em; }
.mealcard-h { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.mealcard-h h2 { font: 700 1.1rem/1.2 var(--font); }
.mi { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mi.done { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); }
.logpill { appearance: none; border: 0; min-height: var(--tap); padding: 0 18px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font: 700 .95rem/1 var(--font); flex-shrink: 0; }
.logpill:active { filter: brightness(1.1); }
.mealcard .frow { border-top: 1px solid var(--line); }
.crow { appearance: none; border: 0; background: none; color: var(--ink); width: 100%; min-height: 64px; padding: 12px 14px 12px 16px; display: flex; align-items: center; gap: 12px; text-align: left; text-decoration: none; }
.card.daydone { border-color: var(--line); padding: 16px; }
.daydone .dd-stats { border-top: 1px solid var(--line); }
.macros { gap: 12px; }
.macro { gap: 8px; }
.title-row { padding-top: 14px; }

/* pantry low pill, recipe editor rows */
.src.low { background: var(--accent-tint); color: var(--accent); margin-left: 6px; vertical-align: 2px; }
.chip.sel .ico { color: var(--bg); }
.recipelist .lrow .k { white-space: nowrap; }
