/* ============ Tokens ============ */
:root {
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f6f2eb;
  --surface-3: #efe9df;
  --border: #ebe4d8;
  --border-strong: #ddd3c3;
  --text: #1c1917;
  --text-2: #57534e;
  --muted: #8a827a;

  --accent: #f08c0c;
  --accent-strong: #d9730a;
  --accent-ink: #8a4300;
  --accent-soft: #fff1dc;
  --accent-grad: linear-gradient(135deg, #fbbf24 0%, #f59e0b 45%, #ea7a0b 100%);

  --protein: #0284c7; --protein-soft: #e0f2fe;
  --fat: #d97706;     --fat-soft: #fef3c7;
  --carb: #059669;    --carb-soft: #d1fae5;
  --ok: #059669;      --ok-soft: #e7f8ef;
  --info: #0284c7;    --info-soft: #e8f5fd;
  --danger: #e11d48;  --danger-soft: #ffe9ee;

  --shadow-sm: 0 1px 2px rgba(41, 28, 10, .05);
  --shadow: 0 1px 2px rgba(41, 28, 10, .04), 0 6px 20px -6px rgba(41, 28, 10, .10);
  --shadow-lg: 0 -8px 40px -8px rgba(41, 28, 10, .25);

  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  --tap: 44px;
  --header-h: 56px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110f0d; --surface: #1b1815; --surface-2: #24201c; --surface-3: #2e2924;
    --border: #312b25; --border-strong: #433b33;
    --text: #f5f2ee; --text-2: #cbc3ba; --muted: #9a9087;
    --accent: #f5a524; --accent-strong: #fbbf24; --accent-ink: #fcd38a; --accent-soft: #3a2a12;
    --protein: #38bdf8; --protein-soft: #0c2a3a;
    --fat: #fbbf24; --fat-soft: #3a2c0c;
    --carb: #34d399; --carb-soft: #0b2e22;
    --ok: #34d399; --ok-soft: #0e2a20;
    --info: #38bdf8; --info-soft: #0c2533;
    --danger: #fb7185; --danger-soft: #3a1219;
    --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 -8px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #110f0d; --surface: #1b1815; --surface-2: #24201c; --surface-3: #2e2924;
  --border: #312b25; --border-strong: #433b33;
  --text: #f5f2ee; --text-2: #cbc3ba; --muted: #9a9087;
  --accent: #f5a524; --accent-strong: #fbbf24; --accent-ink: #fcd38a; --accent-soft: #3a2a12;
  --protein: #38bdf8; --protein-soft: #0c2a3a;
  --fat: #fbbf24; --fat-soft: #3a2c0c;
  --carb: #34d399; --carb-soft: #0b2e22;
  --ok: #34d399; --ok-soft: #0e2a20;
  --info: #38bdf8; --info-soft: #0c2533;
  --danger: #fb7185; --danger-soft: #3a1219;
  --shadow-sm: none; --shadow: 0 0 0 1px rgba(255,255,255,.02); --shadow-lg: 0 -8px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea { font-size: 16px; } /* stops iOS zoom on focus */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3, p { margin: 0; }

/* ============ Shell ============ */
.app-header {
  position: sticky; top: 0; z-index: 30;
  padding: calc(var(--safe-t) + 8px) 16px 8px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.app-header.scrolled { border-bottom-color: var(--border); }
.header-row { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 40px; }
.logo {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: var(--accent-grad); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 17px; box-shadow: 0 4px 12px -4px rgba(234, 122, 11, .55);
}
.header-title { flex: 1; min-width: 0; }
.header-title h1 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.header-title p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center; flex: none;
  color: var(--text-2); transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: var(--accent-ink); background: var(--accent-soft);
  border: 1.5px solid color-mix(in srgb, var(--accent) 40%, transparent); position: relative;
}
.sync-dot {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--bg); background: var(--ok);
}
.sync-dot[data-state="pending"] { background: var(--accent); }
.sync-dot[data-state="offline"] { background: var(--muted); }
.sync-dot[data-state="error"] { background: var(--danger); }

main {
  max-width: 760px; margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px);
}
.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stack > * + * { margin-top: 14px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(170%); -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-top: 1px solid var(--border);
}
.tabbar-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px;
  color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .01em; min-height: 52px;
  border-radius: 14px; position: relative; transition: color .15s;
}
.tab svg { width: 24px; height: 24px; transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.tab .tab-ico { padding: 3px 16px; border-radius: 999px; transition: background .2s; }
.tab.active { color: var(--accent-ink); }
.tab.active .tab-ico { background: var(--accent-soft); }
.tab.active svg { transform: scale(1.06); }
.tab .badge {
  position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff; font: 700 10.5px/18px var(--mono); text-align: center;
}

/* ============ Primitives ============ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 16px;
}
.card.warm {
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent-soft) 70%, var(--surface)) 0%, var(--surface) 70%);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}
.card.flush { padding: 0; overflow: hidden; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 2px 0; }
.section-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.section-head .aside { font-size: 13px; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); }
.sub { font-size: 13.5px; color: var(--text-2); }
.small { font-size: 12.5px; }

.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px; transition: transform .12s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(234, 122, 11, .8); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 11px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link-btn { color: var(--accent-ink); font-weight: 700; font-size: 14px; min-height: 36px; padding: 0 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--accent-soft); color: var(--accent-ink); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.mono { font-family: var(--mono); font-size: 11.5px; }

.macro-line { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.macro-line .k { color: var(--text); }
.macro-line .p { color: var(--protein); }
.macro-line .f { color: var(--fat); }
.macro-line .c { color: var(--carb); }

/* Segmented control */
.seg {
  display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; font-weight: 700; color: var(--text-2);
  white-space: nowrap; transition: background .15s, color .15s;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

/* Horizontal scroller */
.hscroll { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }

/* Day strip */
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-pill {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 700; color: var(--muted); transition: all .15s; position: relative;
}
.day-pill b { font-size: 16px; color: var(--text); font-weight: 800; }
.day-pill.today::after { content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.day-pill.on { background: var(--accent-grad); border-color: transparent; color: rgba(255,255,255,.9); box-shadow: 0 6px 16px -8px rgba(234,122,11,.8); }
.day-pill.on b { color: #fff; }
.day-pill.on.today::after { background: #fff; }

/* Lists & rows */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px;
  border-top: 1px solid var(--border); text-align: left; width: 100%;
}
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.row-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row .chev { color: var(--muted); flex: none; }
.row.tappable:active { background: var(--surface-2); }
.row.dim .row-title { color: var(--muted); text-decoration: line-through; }

/* Meal slot (planner) */
.slot {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid transparent; min-height: 58px;
  transition: border-color .15s, background .15s;
}
.slot:hover { border-color: var(--border-strong); }
.slot:active { transform: scale(.99); }
.slot-ico { width: 36px; height: 36px; border-radius: 11px; background: var(--surface); display: grid; place-items: center; font-size: 18px; flex: none; box-shadow: var(--shadow-sm); }
.slot-label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.slot-name { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.code { font-family: var(--mono); font-weight: 700; font-size: 12px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }

/* Check circle */
.check {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 2px solid var(--border-strong); background: var(--surface); transition: all .18s cubic-bezier(.34,1.56,.64,1);
}
.check svg { width: 16px; height: 16px; color: #fff; opacity: 0; transform: scale(.4); transition: all .18s cubic-bezier(.34,1.56,.64,1); }
.check.on { background: var(--ok); border-color: var(--ok); }
.check.on svg { opacity: 1; transform: none; }
.check.accent.on { background: var(--accent); border-color: var(--accent); }

/* Stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.stepper button { width: 40px; height: 40px; font-size: 20px; font-weight: 600; color: var(--text-2); }
.stepper button:active { background: var(--surface-2); }
.stepper input { width: 64px; height: 40px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font-family: var(--mono); font-weight: 700; background: transparent; }

/* Fields */
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.input, .select {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 13px; border: 1px solid var(--border-strong);
  background: var(--surface); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a827a' stroke-width='2'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.input.mono { text-align: center; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* Progress */
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; transition: width .5s cubic-bezier(.2,.8,.2,1); }

/* ============ Planner ============ */
.radar { display: flex; flex-direction: column; gap: 10px; }
.radar-card {
  width: 172px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; text-align: left;
}
.radar-card.hot { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface)); }
.radar-card.warm { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
.radar-card .name { font-weight: 700; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.radar-card .mult { font-family: var(--mono); font-weight: 800; font-size: 20px; color: var(--protein); }
.radar-card .mult small { font-size: 11px; color: var(--muted); font-weight: 600; }

.day-card { scroll-margin-top: calc(var(--header-h) + 70px); }
.day-card.today { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.day-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.day-slots { display: flex; flex-direction: column; gap: 8px; }
.day-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 13px; }
.day-foot .tip { color: var(--text-2); }
.day-foot .tip.bad { color: var(--danger); }
.day-foot .tip.warn { color: var(--accent-ink); }

/* ============ Dishes ============ */
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search .input { padding-left: 42px; border-radius: 999px; }
.recipe-grid { display: grid; gap: 12px; }
.recipe { padding: 0; overflow: hidden; }
.recipe-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px; width: 100%; text-align: left; }
.recipe-head .row-main > .row-title { font-size: 15.5px; }
.recipe-head .macro-line { margin-top: 6px; }
.fav-btn { width: var(--tap); height: var(--tap); margin: -8px -6px -8px 0; display: grid; place-items: center; font-size: 22px; color: var(--border-strong); flex: none; transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.fav-btn.on { color: var(--accent); }
.fav-btn:active { transform: scale(1.25); }
.recipe-body { border-top: 1px solid var(--border); padding: 14px 16px 16px; display: none; }
.recipe.open .recipe-body { display: block; animation: fade .2s ease; }
.recipe.open .chev { transform: rotate(180deg); }
.chev { transition: transform .2s; }
.ing-list { display: grid; grid-template-columns: 1fr; gap: 0; margin: 12px 0; border-radius: 14px; background: var(--surface-2); padding: 4px 12px; }
.ing-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--border-strong); font-size: 14px; list-style: none; }
.ing-list li:first-child { border-top: 0; }
.ing-list li b { font-family: var(--mono); color: var(--protein); white-space: nowrap; font-size: 13.5px; }
.ing-list { margin-block: 12px; padding-inline: 12px; }
.method { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.method ol { margin: 6px 0 0; padding-left: 20px; }
.method li { margin: 4px 0; }

/* ============ Tracker ============ */
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; stroke-linecap: round; }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--accent); transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1), stroke .3s; }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-center b { display: block; font: 800 28px/1 var(--mono); letter-spacing: -.03em; }
.ring-center span { font-size: 12px; color: var(--muted); font-weight: 600; }
.macros { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.macro-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.macro-head .mono { color: var(--text-2); font-size: 12.5px; }
.coach { margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; display: flex; gap: 10px; }
.coach .ico { font-size: 20px; line-height: 1.2; }
.coach b { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px; }
.coach.ok { background: var(--ok-soft); color: color-mix(in srgb, var(--ok) 70%, var(--text)); }
.coach.info { background: var(--info-soft); color: color-mix(in srgb, var(--info) 70%, var(--text)); }
.coach.bad { background: var(--danger-soft); color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid transparent; transition: transform .12s, border-color .15s; text-align: center;
}
.quick:hover { border-color: var(--border-strong); }
.quick:active { transform: scale(.95); }
.quick .e { font-size: 24px; }
.quick .l { font-weight: 700; font-size: 13.5px; }
.quick .m { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.quick.pop { animation: pop .35s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { 50% { transform: scale(1.08); border-color: var(--accent); } }
.extra-row .row-title::before { content: "⚡ "; }
.del-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); flex: none; }
.del-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* ============ Grocery ============ */
.total { font: 800 34px/1.1 var(--mono); letter-spacing: -.03em; }
.total small { font-size: 16px; color: var(--muted); font-weight: 700; margin-right: 4px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.stat b { display: block; font: 800 18px/1.2 var(--mono); }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.aisle-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; font-weight: 800; font-size: 14px; }
.aisle-head .count { font-size: 12px; color: var(--muted); font-weight: 700; }
.g-item { border-top: 1px solid var(--border); }
.g-main { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 60px; }
.g-main .row-main { cursor: pointer; }
.g-qty { font-family: var(--mono); font-weight: 700; font-size: 13.5px; text-align: right; white-space: nowrap; }
.g-qty small { display: block; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.g-item.athome .row-title { color: var(--muted); }
.g-item.bought .row-title { text-decoration: line-through; color: var(--muted); }
.g-edit { display: none; padding: 4px 14px 14px 54px; }
.g-item.open .g-edit { display: block; animation: fade .18s ease; }
.g-item.open { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.g-edit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.g-edit-row label { font-size: 12.5px; color: var(--muted); font-weight: 700; min-width: 64px; }
.price-input { width: 92px; min-height: 40px; text-align: center; font-family: var(--mono); font-weight: 700; border-radius: 12px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 6px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 2px; }

/* ============ Routine ============ */
.allow-list li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); list-style: none; font-size: 14px; }
.allow-list li:first-child { border-top: 0; }
.allow-list li span:nth-child(2) { flex: 1; }
.allow-list li b { font-family: var(--mono); font-size: 13px; }
.allow-list { margin: 8px 0 0; padding: 0; }
.note { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; line-height: 1.5; }
.timeline { position: relative; padding-left: 4px; }
.tl { display: grid; grid-template-columns: 92px 18px 1fr; gap: 8px; align-items: start; padding: 8px 0; }
.tl time { font: 700 13px/1.4 var(--mono); color: var(--accent-ink); text-align: right; padding-top: 1px; }
.tl.cool time { color: var(--protein); }
.tl.calm time { color: var(--carb); }
.tl .dot { position: relative; height: 100%; }
.tl .dot::before { content: ""; position: absolute; left: 4px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl.cool .dot::before { background: var(--protein); box-shadow: 0 0 0 4px var(--protein-soft); }
.tl.calm .dot::before { background: var(--carb); box-shadow: 0 0 0 4px var(--carb-soft); }
.tl .dot::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: -14px; width: 2px; background: var(--border); }
.tl:last-child .dot::after { display: none; }
.tl p { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.tl p b { color: var(--text); display: block; }
.tl.now time { color: var(--text); }
.tl.now p { color: var(--text); }

/* ============ Sheet, toast ============ */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(20, 14, 6, .45); opacity: 0; transition: opacity .25s; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 88vh; max-height: 88dvh;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.9,.25,1);
  max-width: 640px; margin: 0 auto;
}
.sheet.show { transform: none; }
.sheet-grab { width: 40px; height: 5px; border-radius: 99px; background: var(--border-strong); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 10px 20px; flex: none; }
.sheet-head h3 { font-size: 18px; font-weight: 800; }
.sheet-head p { font-size: 13px; color: var(--muted); }
.sheet-body { overflow-y: auto; padding: 4px 20px 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--border); display: flex; gap: 10px; flex: none; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet { bottom: 50%; transform: translateY(calc(50% + 40px)) scale(.98); opacity: 0; border-radius: 24px; transition: transform .25s, opacity .2s; max-height: 80vh; }
  .sheet.show { transform: translateY(50%); opacity: 1; }
  .sheet-grab { display: none; }
}
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 14px; text-align: left; border: 1.5px solid transparent; }
.pick:hover { background: var(--surface-2); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick .row-title { font-size: 14.5px; }
.pick-group { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 4px 6px; }

.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 70; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 16px;
  background: #1c1917; color: #f5f2ee; font-size: 14.5px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5);
  transform: translateY(20px); opacity: 0; transition: all .25s cubic-bezier(.2,.9,.25,1); max-width: 480px;
}
:root[data-theme="dark"] .toast { background: #f5f2ee; color: #1c1917; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #f5f2ee; color: #1c1917; } }
.toast.show { transform: none; opacity: 1; }
.toast button { color: var(--accent); font-weight: 800; min-height: 32px; padding: 0 4px; }

/* ============ Login ============ */
.login {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 60% at 50% 0%, var(--accent-soft) 0%, var(--bg) 60%);
}
.login-card { width: 100%; max-width: 380px; }
.login-card .logo { width: 64px; height: 64px; border-radius: 20px; font-size: 30px; margin: 0 auto 16px; }
.login-card h1 { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.login-card > p { text-align: center; color: var(--muted); margin: 4px 0 24px; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 20px; margin-top: 10px; text-align: center; }

/* ============ Settings ============ */
.set-group { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin-top: 12px; }
.set-group .row { min-height: 52px; }
.set-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 0; }

/* ============ Desktop niceties ============ */
@media (min-width: 720px) {
  .recipe-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .quick-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 360px) {
  .ring { width: 112px; height: 112px; }
  .ring-center b { font-size: 23px; }
  .day-pill { min-height: 52px; }
  .tl { grid-template-columns: 78px 18px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ Print ============ */
#print-root { display: none; }
@media print {
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  #app, .app-header, .tabbar, .toast-wrap, .scrim, .sheet, .login { display: none !important; }
  #print-root { display: block !important; padding: 0 8mm; }
  #print-root h1 { font-size: 20pt; margin-bottom: 2mm; }
  #print-root h2 { font-size: 12pt; text-transform: uppercase; border-bottom: 1.5pt solid #000; margin: 6mm 0 2mm; padding-bottom: 1mm; }
  #print-root .p-day { border: 1px solid #bbb; border-radius: 4pt; padding: 2mm 3mm; margin-bottom: 2mm; break-inside: avoid; }
  #print-root .p-grid { columns: 2; column-gap: 8mm; }
  #print-root .p-item { display: flex; justify-content: space-between; border-bottom: 1px solid #ddd; padding: 1mm 0; break-inside: avoid; }
}

/* Spans used as blocks inside buttons */
.row-title, .row-sub, .slot-name, .slot-label { display: block; }
.slot-label { display: flex; }
.radar-card .code, .recipe .code { align-self: flex-start; }
