/* NutriTrack — fresh, warm health look. Light + dark. */
:root {
  --bg: #f6f4ee;
  --bg-2: #efece3;
  --card: #ffffff;
  --ink: #18231d;
  --ink-2: #4a5a50;
  --ink-3: #7d8a82;
  --line: #e4e0d5;
  --primary: #17885b;
  --primary-ink: #ffffff;
  --primary-soft: #dff2e7;
  --primary-deep: #0e5e3e;
  --accent: #f08a3c;
  --accent-soft: #fde9d8;
  --danger: #d4483b;
  --danger-soft: #fbe2df;
  --info: #2f76c4;
  --info-soft: #dde9f7;
  --gold: #e3a21a;
  --shadow: 0 1px 2px rgba(24, 35, 29, .05), 0 8px 24px -12px rgba(24, 35, 29, .18);
  --shadow-lg: 0 24px 60px -20px rgba(24, 35, 29, .35);
  --r: 20px;
  --r-sm: 14px;
  --nav-h: 68px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1411;
  --bg-2: #141c18;
  --card: #18211c;
  --ink: #e9efe9;
  --ink-2: #b2c0b6;
  --ink-3: #7f8f85;
  --line: #26322b;
  --primary: #3fc58a;
  --primary-ink: #062417;
  --primary-soft: #173a2a;
  --primary-deep: #8fe5bb;
  --accent: #ffa25e;
  --accent-soft: #3a2616;
  --danger: #ff7a6b;
  --danger-soft: #3c1d1a;
  --info: #7bb2ef;
  --info-soft: #172a40;
  --gold: #f4c04e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 10px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
@media (min-width: 900px) {
  .app { max-width: 1080px; padding-left: 128px; padding-right: 32px; padding-bottom: 48px; }
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(140deg, #22a56f, #0e6a45); display: grid; place-items: center; box-shadow: 0 6px 16px -6px rgba(23, 136, 91, .6); }
.brand-mark svg { width: 20px; height: 20px; }
.brand span b { color: var(--primary); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); color: var(--ink-2); }
.icon-btn svg { width: 20px; height: 20px; }
.top-actions { display: flex; gap: 8px; }

/* ---------- Bottom nav / side rail ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); position: relative; }
.nav button svg { width: 23px; height: 23px; transition: transform .2s; }
.nav button[aria-current="page"] { color: var(--primary); }
.nav button[aria-current="page"] svg { transform: translateY(-1px) scale(1.06); }
.nav button[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary); }
@media (min-width: 900px) {
  .nav { top: 0; right: auto; width: 96px; border-top: 0; border-right: 1px solid var(--line); padding-top: 96px; }
  .nav-inner { grid-template-columns: 1fr; grid-auto-rows: 76px; height: auto; }
  .nav button[aria-current="page"]::before { top: 18px; left: 0; width: 3px; height: 40px; border-radius: 0 4px 4px 0; }
}

/* ---------- Cards & common ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 14px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.section-title h2 { font-size: 18px; }
.section-title .link { color: var(--primary); font-weight: 700; font-size: 13.5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--bg-2); color: var(--ink-2); }
.chip.green { background: var(--primary-soft); color: var(--primary-deep); }
.chip.orange { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 70%, var(--ink)); }
.chip.red { background: var(--danger-soft); color: var(--danger); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 700; background: var(--bg-2); color: var(--ink); transition: transform .12s, background .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 8px 18px -10px var(--primary); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 900px) {
  .split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
  .split > .side { position: sticky; top: 18px; }
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input { min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); outline: none; }
.input:focus { border-color: var(--primary); }

/* ---------- Hero / Today ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 26px; padding: 22px 20px;
  background: radial-gradient(120% 140% at 100% 0%, #2fb37a 0%, #17885b 45%, #0c5a3b 100%);
  color: #f4fbf7; box-shadow: 0 22px 40px -22px rgba(14, 94, 62, .7);
}
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; z-index: 1; }
.hero .date { font-size: 13px; opacity: .85; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.hero h1 { font-size: 26px; margin-top: 4px; line-height: 1.15; }
.hero .sub { opacity: .9; margin-top: 6px; font-size: 14px; }
.hero-stats { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-weight: 700; font-size: 13px; }
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: rgba(255, 255, 255, .2); }
.ring .bar { stroke: #fff; transition: stroke-dashoffset .8s cubic-bezier(.2, .8, .2, 1); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-size: 26px; display: block; line-height: 1; }
.ring .val small { font-size: 11px; opacity: .85; font-weight: 600; }

/* Trackers */
.trackers { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; margin-top: 14px; }
.trackers > * { min-width: 0; }
.slot-card, .item-main > span:last-child { min-width: 0; }
.tracker h3 { font-size: 14px; display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tracker .big { font-size: 24px; font-weight: 800; margin-top: 6px; }
.tracker .big small { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.glasses { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.glass { width: 22px; height: 28px; border-radius: 4px 4px 7px 7px; border: 2px solid color-mix(in srgb, var(--info) 45%, transparent); position: relative; overflow: hidden; padding: 0; }
.glass.full::after { content: ""; position: absolute; inset: 30% 0 0; background: var(--info); animation: fill .4s ease-out; }
@keyframes fill { from { transform: translateY(100%); } }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.stepper button { width: 38px; height: 38px; border-radius: 12px; background: var(--bg-2); font-size: 20px; font-weight: 700; }
.moods { display: flex; justify-content: space-between; margin-top: 10px; gap: 4px; }
.moods button { flex: 1; height: 44px; border-radius: 12px; font-size: 22px; background: var(--bg-2); filter: grayscale(.8); opacity: .7; transition: all .15s; }
.moods button[aria-pressed="true"] { filter: none; opacity: 1; background: var(--accent-soft); transform: scale(1.06); }

/* Timeline */
.timeline { position: relative; }
.slot { position: relative; padding-left: 58px; margin-bottom: 14px; }
.slot::before { content: ""; position: absolute; left: 23px; top: 48px; bottom: -14px; width: 2px; background: var(--line); }
.slot:last-child::before { display: none; }
.slot-dot { position: absolute; left: 0; top: 4px; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; background: var(--card); box-shadow: var(--shadow); }
.slot.done .slot-dot { background: var(--primary); }
.slot.now .slot-dot { box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.slot-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; border: 1.5px solid transparent; transition: border-color .2s; }
.slot.now .slot-card { border-color: var(--accent); }
.slot-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; gap: 8px; }
.slot-head h3 { font-size: 16px; }
.slot-head .time { font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.slot-head .badge-now { background: var(--accent); color: #fff; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; margin-left: 8px; vertical-align: 2px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--line); }
.slot-head + .item { border-top: 0; }
.item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; padding: 4px 0; }
.item-emoji { width: 40px; height: 40px; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center; font-size: 20px; flex: none; }
.item-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.item-qty { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.item.is-done .item-name, .item.is-skip .item-name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 60%, transparent); color: var(--ink-3); }
.item .swapped { color: var(--accent); font-weight: 700; }
.check { width: 46px; height: 46px; border-radius: 50%; border: 2.5px solid var(--line); display: grid; place-items: center; flex: none; transition: all .2s cubic-bezier(.3, 1.6, .5, 1); color: transparent; }
.check svg { width: 22px; height: 22px; }
.check.done { background: var(--primary); border-color: var(--primary); color: #fff; transform: scale(1.04); }
.check.skip { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }
.check.swap { background: var(--accent); border-color: var(--accent); color: #fff; }
.more { width: 36px; height: 44px; border-radius: 10px; color: var(--ink-3); display: grid; place-items: center; flex: none; }
.more svg { width: 18px; height: 18px; }
.pop { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.7); } 100% { transform: scale(1.04); } }
.slot-foot { display: flex; gap: 8px; padding: 0 16px 14px; }
.slot-foot .btn { min-height: 38px; font-size: 13px; padding: 0 12px; }

/* ---------- Menu ---------- */
.day-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab { flex: 1 0 auto; min-width: 54px; min-height: 58px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
.day-tab small { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.day-tab[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); }
.day-tab[aria-selected="true"] small { color: inherit; opacity: .85; }
.day-tab.today:not([aria-selected="true"]) { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }
.menu-slot { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.menu-slot:first-child { border-top: 0; padding-top: 2px; }
.menu-slot .when { width: 76px; flex: none; }
.menu-slot .when b { display: block; font-size: 13.5px; }
.menu-slot .when span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.menu-slot ul { list-style: none; margin: 0; padding: 0; flex: 1; }
.menu-slot li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.menu-slot li button { text-align: left; font-weight: 600; }
.menu-slot li button:hover { color: var(--primary); }
.menu-slot li span { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.segmented { display: flex; background: var(--bg-2); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; min-height: 40px; border-radius: 11px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.segmented button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.guides { counter-reset: g; list-style: none; padding: 0; margin: 0; }
.guides li { counter-increment: g; display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.guides li:first-child { border-top: 0; }
.guides li::before { content: counter(g); flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-deep); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.units { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.unit { background: var(--bg-2); border-radius: 14px; padding: 12px; text-align: center; }
.unit b { display: block; font-size: 18px; }
.unit span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.grocery { list-style: none; margin: 0; padding: 0; }
.grocery li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.grocery li:first-child { border-top: 0; }
.grocery input { width: 22px; height: 22px; accent-color: var(--primary); }
.grocery label { flex: 1; display: flex; justify-content: space-between; gap: 10px; cursor: pointer; }
.grocery input:checked + label { color: var(--ink-3); text-decoration: line-through; }
.grocery .cat { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 14px 0 4px; border: 0; }

/* ---------- Weight ---------- */
.weight-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.weight-hero .now { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.weight-hero .now small { font-size: 18px; color: var(--ink-3); font-weight: 700; }
.delta { font-weight: 800; }
.delta.down { color: var(--primary); }
.delta.up { color: var(--danger); }
.stat { background: var(--bg-2); border-radius: 14px; padding: 12px; }
.stat span { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.stat b { display: block; font-size: 18px; margin-top: 2px; }
.chart { width: 100%; height: auto; display: block; margin-top: 12px; }
.chart text { fill: var(--ink-3); font-size: 10px; font-family: var(--font); }
.progress { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #46c98f); transition: width .8s; }
.numpad-display { font-size: 52px; font-weight: 800; text-align: center; letter-spacing: -0.03em; padding: 8px 0 2px; }
.numpad-display small { font-size: 20px; color: var(--ink-3); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.numpad button { height: 58px; border-radius: 16px; background: var(--bg-2); font-size: 22px; font-weight: 700; }
.numpad button:active { background: var(--primary-soft); }
.warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-size: 13.5px; margin-top: 12px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }

/* ---------- Workout ---------- */
.wo-day { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; }
.wo-day .num { width: 48px; height: 48px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 20px; display: grid; place-items: center; flex: none; }
.wo-day .info { flex: 1; }
.wo-day .info b { display: block; }
.ex-card h3 { font-size: 16px; }
.set-row { display: grid; grid-template-columns: 34px 1fr 1fr 46px; gap: 8px; align-items: center; margin-top: 8px; }
.set-row .n { font-weight: 800; color: var(--ink-3); text-align: center; }
.set-row input { min-height: 44px; text-align: center; padding: 6px; }
.set-head { display: grid; grid-template-columns: 34px 1fr 1fr 46px; gap: 8px; font-size: 11.5px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; text-align: center; margin-top: 12px; }
.rest-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 35; background: var(--ink); color: var(--bg); border-radius: 999px; padding: 10px 10px 10px 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-lg); font-weight: 700; }
.rest-bar b { font-size: 20px; min-width: 52px; }
.rest-bar button { background: var(--primary); color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; margin-top: 14px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars i { display: block; width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: var(--primary); min-height: 3px; transition: height .6s; }
.bars i.zero { background: var(--line); }
.bars span { font-size: 11px; color: var(--ink-3); font-weight: 700; }

/* ---------- Reports ---------- */
.status { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r); }
.status.on { background: var(--primary-soft); color: var(--primary-deep); }
.status.mid { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 65%, var(--ink)); }
.status.off { background: var(--danger-soft); color: var(--danger); }
.status .ico { font-size: 30px; }
.status b { font-size: 18px; display: block; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.week-nav b { font-size: 15px; }
.heat { display: grid; grid-template-columns: 82px repeat(7, 1fr); gap: 4px; font-size: 11px; align-items: center; }
.heat .h { text-align: center; color: var(--ink-3); font-weight: 700; }
.heat .lbl { color: var(--ink-2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat .c { aspect-ratio: 1; border-radius: 6px; background: var(--bg-2); }
.heat .c.l1 { background: color-mix(in srgb, var(--primary) 30%, var(--bg-2)); }
.heat .c.l2 { background: color-mix(in srgb, var(--primary) 60%, var(--bg-2)); }
.heat .c.l3 { background: var(--primary); }
.heat .c.sk { background: var(--danger-soft); }
.actions-list { list-style: none; padding: 0; margin: 0; }
.actions-list li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.actions-list li:first-child { border-top: 0; }
.actions-list .n { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }

/* ---------- Sheets / modals / toasts ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 18, 14, .45); z-index: 50; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.scrim.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px)); max-height: 88vh; overflow-y: auto; transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); }
.sheet.open { transform: none; }
@media (min-width: 900px) {
  .sheet { bottom: auto; top: 50%; border-radius: 26px; transform: translateY(-40%) scale(.96); opacity: 0; transition: all .25s; padding-bottom: 24px; }
  .sheet.open { transform: translateY(-50%); opacity: 1; }
}
.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 21px; }
.video { position: relative; aspect-ratio: 16/9; border-radius: 18px; overflow: hidden; background: linear-gradient(135deg, #1b6b49, #0b3b28); display: grid; place-items: center; color: #fff; text-decoration: none; margin-bottom: 14px; }
.video .play { width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .95); display: grid; place-items: center; color: #d32020; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transition: transform .2s; }
.video:hover .play { transform: scale(1.08); }
.video .play svg { width: 26px; height: 26px; margin-left: 4px; }
.video .cap { position: absolute; left: 14px; bottom: 12px; font-weight: 700; font-size: 13px; opacity: .92; }
.video .big-emoji { position: absolute; right: 14px; top: 8px; font-size: 54px; opacity: .55; }
.recipe-list { padding-left: 20px; margin: 6px 0 0; }
.recipe-list li { padding: 3px 0; }
.recipe-list.steps li { padding: 6px 0; }
.swap-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 14px; text-align: left; }
.swap-opt:hover, .swap-opt:focus-visible { background: var(--bg-2); }
.swap-opt .kc { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.alarm { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 30%, #1d9b67, #0a3d29); color: #fff; text-align: center; }
.alarm .bell { font-size: 74px; animation: ring 1s ease-in-out infinite; display: inline-block; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(0); } }
.alarm h2 { font-size: 30px; margin-top: 12px; }
.alarm p { opacity: .9; margin-top: 8px; font-size: 16px; }
.alarm .acts { display: flex; flex-direction: column; gap: 12px; margin-top: 30px; width: min(320px, 80vw); margin-inline: auto; }
.alarm .btn.primary { background: #fff; color: #0e5e3e; min-height: 56px; font-size: 17px; }
.alarm .btn { background: rgba(255, 255, 255, .15); color: #fff; min-height: 52px; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 14px); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-lg); animation: tin .3s cubic-bezier(.2, .8, .2, 1); }
.toast button { margin-left: auto; color: var(--primary); font-weight: 800; background: color-mix(in srgb, var(--primary) 18%, transparent); padding: 6px 10px; border-radius: 9px; }
:root[data-theme="dark"] .toast button { color: var(--primary-ink); background: var(--primary); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--info-soft); margin-bottom: 14px; font-size: 13.5px; }
.banner b { display: block; }
.banner .btn { min-height: 38px; padding: 0 14px; margin-left: auto; flex: none; }
.offline { background: var(--accent-soft); }
.reminder-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.reminder-row:first-child { border-top: 0; }
.reminder-row .t { font-weight: 800; width: 62px; font-size: 14px; }
.reminder-row .l { flex: 1; font-weight: 600; font-size: 14px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.empty { text-align: center; padding: 28px 12px; color: var(--ink-3); }
.empty .e { font-size: 40px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }
.view { animation: vin .3s ease-out; }
@keyframes vin { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- "I ate something else" / AI food ---------- */
.check.other { background: var(--accent); border-color: var(--accent); color: #fff; }
.item.is-other .item-emoji, .item.is-extra .item-emoji { background: var(--accent-soft); }
.ai-tag { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--info-soft); color: var(--info); vertical-align: 1px; }
.extra-tag { color: var(--accent); font-weight: 800; }
.slot-foot { flex-wrap: wrap; }
.photo-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: 170px; padding: 18px;
  border-radius: 20px; border: 2px dashed color-mix(in srgb, var(--primary) 45%, var(--line)); background: color-mix(in srgb, var(--primary-soft) 40%, transparent);
  cursor: pointer; position: relative; overflow: hidden; transition: border-color .15s, background .15s; }
.photo-drop:hover { border-color: var(--primary); }
.photo-drop:focus-within { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.photo-ico { width: 58px; height: 58px; border-radius: 18px; background: var(--primary); color: #fff; display: grid; place-items: center; margin-bottom: 4px; box-shadow: 0 10px 22px -10px var(--primary); }
.photo-ico svg { width: 28px; height: 28px; }
.photo-drop.has-photo { padding: 0; border-style: solid; min-height: 0; }
.photo-drop.has-photo img { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.photo-change { position: absolute; right: 10px; bottom: 10px; display: inline-flex; gap: 6px; align-items: center; padding: 7px 12px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-weight: 700; font-size: 13px; }
.photo-change svg { width: 15px; height: 15px; }
textarea.input { resize: vertical; min-height: 64px; width: 100%; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fd-result { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 18px; background: var(--bg-2); }
.fd-thumb { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; flex: none; }
.fd-total { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fd-total b { font-size: 34px; letter-spacing: -0.03em; line-height: 1.1; }
.fd-total b small { font-size: 15px; color: var(--ink-3); }
.fd-items { list-style: none; margin: 10px 0 0; padding: 0; }
.fd-items li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.fd-items li:first-child { border-top: 0; }
.fd-items li > span:last-child { text-align: right; flex: none; }
.fd-compare { margin-top: 12px; padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 13.5px; }
.fd-compare.up { background: var(--danger-soft); color: var(--danger); }
.fd-compare.down { background: var(--primary-soft); color: var(--primary-deep); }
.btn[disabled] { opacity: .75; cursor: progress; }

/* ---------- Sign-in / onboarding ---------- */
.onboard { position: fixed; inset: 0; z-index: 85; overflow-y: auto; background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px); animation: vin .35s ease-out; }
.ob-wrap { max-width: 980px; margin: 0 auto; display: grid; gap: 16px; }
.ob-hero { position: relative; overflow: hidden; border-radius: 26px; padding: 26px 22px; color: #f4fbf7;
  background: radial-gradient(120% 140% at 100% 0%, #2fb37a 0%, #17885b 45%, #0c5a3b 100%); box-shadow: 0 22px 40px -22px rgba(14, 94, 62, .7); }
.ob-hero::after { content: ""; position: absolute; right: -70px; bottom: -90px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.ob-mark { width: 46px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, .18); box-shadow: none; }
.ob-mark svg { width: 26px; height: 26px; }
.ob-hero h1 { font-size: 30px; line-height: 1.1; margin-top: 18px; }
.ob-hero p { opacity: .9; margin-top: 10px; max-width: 34ch; }
.ob-hero ul { list-style: none; padding: 0; margin: 16px 0 0; display: none; gap: 10px; font-weight: 600; position: relative; z-index: 1; }
.ob-card { background: var(--card); border-radius: 26px; padding: 24px 20px; box-shadow: var(--shadow); }
.ob-card h2 { font-size: 23px; }
.ob-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.ob-grid > * { min-width: 0; }
.ob-full { grid-column: 1 / -1; }
.input[aria-invalid="true"] { border-color: var(--danger); }
select.input { appearance: none; 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: 34px; }
.ob-goal { border: 0; padding: 0; margin: 18px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.ob-goal legend { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.ob-goal label { flex: 1 1 90px; position: relative; }
.ob-goal input { position: absolute; opacity: 0; }
.ob-goal span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; cursor: pointer; transition: all .15s; }
.ob-goal input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }
.ob-goal input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.plan-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; border: 2px solid var(--line); cursor: pointer; position: relative; transition: border-color .15s, background .15s; }
.plan-card input { position: absolute; opacity: 0; }
.plan-card:has(input:checked), .plan-card.is-static { border-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.plan-card:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.plan-ico { width: 52px; height: 52px; flex: none; border-radius: 16px; background: var(--card); display: grid; place-items: center; font-size: 28px; box-shadow: var(--shadow); }
.plan-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan-info b { font-size: 16px; }
.plan-info small { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.plan-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.plan-tick { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: all .2s; }
.plan-tick svg { width: 16px; height: 16px; }
.plan-card:has(input:checked) .plan-tick { opacity: 1; transform: none; }
.ob-err { color: var(--danger); font-weight: 600; font-size: 13.5px; margin-top: 12px; }
.ob-err:empty { display: none; }
@media (min-width: 860px) {
  .onboard { display: grid; place-items: center; padding: 32px; }
  .ob-wrap { grid-template-columns: 1fr 1.25fr; gap: 24px; align-items: stretch; width: 100%; }
  .ob-hero { padding: 40px 34px; display: flex; flex-direction: column; justify-content: center; }
  .ob-hero h1 { font-size: 40px; }
  .ob-hero ul { display: grid; }
  .ob-card { padding: 32px; }
}

/* ---------- Print (weekly report PDF) ---------- */
@media print {
  .nav, .topbar .top-actions, .no-print, .toasts, .banner { display: none !important; }
  body { background: #fff; }
  .app { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
