/* Emily Sanchez Nutrition — "Clinic": white, no cards, hairline rules, one quiet blue.
 * Built to Apple's HIG: the device's own type stack (San Francisco on iPhone),
 * semantic colour roles that adapt to light and dark, an 8pt grid, 44pt tap
 * targets, and spring motion that never blocks input. Chrome stays quiet so the
 * meal plan is the only thing on screen worth looking at. */

:root {
  /* content */
  --bg: #ffffff;            /* the page itself */
  --bg2: #f6f7f8;           /* the only tinted surface: inputs, quiet fills */
  --ink: #101418;           /* primary label */
  --ink2: #5c6670;          /* secondary label */
  --ink3: #8d969e;          /* tertiary label: timestamps, units */
  --line: #dfe3e6;          /* hairline */
  --fill: #eef1f3;          /* unfilled track */

  /* one accent, used sparingly */
  --acc: #15639e;
  --acc-tint: #eaf2f8;
  --onacc: #ffffff;

  /* state, never decorative */
  --late: #a8452f;  --late-tint: #fbeeea;
  --watch: #8a6a16; --watch-tint: #faf3e2;
  --good: #1f6b4a;  --good-tint: #e9f3ee;
  --water: #2d6f93;

  /* Apple's spring as a CSS curve: fast out, settles, no bounce on utility UI */
  --spring: linear(0, .0037, .0142, .031, .0534, .0804, .1108, .1438, .1784, .2135,
    .2484, .3145, .3746, .4283, .4755, .5562, .6215, .6726, .7112, .7735, .8196,
    .854, .8793, .9185, .9458, .9647, .9779, .9921, 1);
  --spring-ms: 420ms;
  --quick: 180ms;

  /* San Francisco on Apple devices, Roboto on Android. Never a downloaded font. */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;

  --gut: 20px;              /* side gutter, 8pt grid */
  color-scheme: light;
}

/* Dark is dimmed, not inverted: the base goes black, raised surfaces lighten.
 * Declared twice so "Auto" follows the phone and an explicit choice overrides it. */
/* Light is the default for everyone. Dark follows the phone only when the
 * person picks "Auto", which is why these blocks need data-theme to opt in. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #000000; --bg2: #1c1c1e; --ink: #f2f3f4; --ink2: #9ba3ab; --ink3: #72797f;
    --line: #2a2c2e; --fill: #1f2022;
    --acc: #6cb6ef; --acc-tint: #12232f; --onacc: #04131f;
    --late: #e89281; --late-tint: #2a1a16; --watch: #d9bb72; --watch-tint: #272015;
    --good: #72c79e; --good-tint: #132319; --water: #7cb3d2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg2: #1c1c1e; --ink: #f2f3f4; --ink2: #9ba3ab; --ink3: #72797f;
  --line: #2a2c2e; --fill: #1f2022;
  --acc: #6cb6ef; --acc-tint: #12232f; --onacc: #04131f;
  --late: #e89281; --late-tint: #2a1a16; --watch: #d9bb72; --watch-tint: #272015;
  --good: #72c79e; --good-tint: #132319; --water: #7cb3d2;
  color-scheme: dark;
}
:root[data-theme="dark"] .segtabs button.on { background: #38383a; box-shadow: none; }

* { box-sizing: border-box; }
/* The PAGE never scrolls: on iOS a rubber-band on the document drags everything
 * fixed with it, which is what made the tab bar slide up. The app is the scroller
 * instead, so the bar is pinned to the window and cannot move. */
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 17px; line-height: 1.4;   /* iOS body size */
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
::selection { background: var(--acc-tint); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button, a, label.btn, .tabbar a { -webkit-user-select: none; user-select: none; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
svg.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#app {
  height: 100%; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) var(--gut) calc(env(safe-area-inset-bottom, 0px) + 94px);
}
/* Every screen keeps its own element. Switching tabs reveals the one you already
 * had rather than rebuilding it, which is what makes it feel instant. */
.pane { display: flex; flex-direction: column; gap: 13px; }
.pane:not(.on) { display: none; }
.pane.on { animation: paneIn 240ms var(--spring); will-change: transform, opacity; }
.pane.on.push { animation: pushIn 300ms var(--spring); }     /* drill-down: in from the right */
.pane.on.pop { animation: popIn 280ms var(--spring); }       /* back: in from the left */
@keyframes paneIn { from { opacity: 0; transform: translate3d(0, 8px, 0); } }
@keyframes pushIn { from { opacity: 0; transform: translate3d(26px, 0, 0); } }
@keyframes popIn { from { opacity: 0; transform: translate3d(-22px, 0, 0); } }
#app.notabs { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 36px); }
.boot { color: var(--ink3); text-align: center; margin-top: 42vh; }
.view { display: contents; }
#app.notabs .pane { gap: 18px; }

/* ---------- type ---------- */
h1.hi {                                  /* iOS large title */
  font-size: 30px; font-weight: 700; letter-spacing: -.028em; line-height: 1.08;
  margin: 0; text-wrap: balance;
}
h2.h {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .055em;
  color: var(--ink3); margin: 10px 0 -12px;
}
.sub { font-size: 15px; color: var(--ink2); margin: 4px 0 0; text-wrap: pretty; }
.lbl { font-size: 13px; font-weight: 600; color: var(--ink3); margin: 0 0 8px; }
.q { font-size: 28px; font-weight: 700; letter-spacing: -.024em; line-height: 1.14; margin: 8px 0 0; text-wrap: balance; }

/* ---------- the grouped list: no boxes, hairlines only ---------- */
.box { display: grid; }
.row {
  display: flex; gap: 14px; align-items: center; min-height: 52px; padding: 9px 0;
  border-bottom: 1px solid var(--line); position: relative;
  transition: background-color var(--quick) ease-out;
}
.box > .row:first-child { border-top: 1px solid var(--line); }
.row .w { flex: 1; min-width: 0; font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.row .w small { display: block; font-size: 14px; font-weight: 400; color: var(--ink3); margin-top: 2px; }
.row.done .w { color: var(--ink2); }
.row.late small.when { color: var(--late); }
.row .t { width: 66px; flex: none; font-size: 14px; color: var(--ink3); font-weight: 500; white-space: nowrap; }
.row .price { font-size: 16px; font-weight: 600; color: var(--ink2); flex: none; }
.row.done .price { color: var(--ink3); }
a.row { color: inherit; text-decoration: none; }
a.row::after {                           /* iOS disclosure chevron */
  content: ""; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--ink3);
  border-top: 2px solid var(--ink3); transform: rotate(45deg); opacity: .7;
}
@media (min-resolution: 2dppx) {         /* true hairlines on retina */
  .row, .box > .row:first-child, .tabbar, .math, .btn.alt, .kv, .tgt, .tgt div + div,
  .macros, .macros div + div, .used, .note, .need, .sum, .opt, .opts .opt:first-child { border-width: .5px; }
}

/* the one control that carries state: 44pt, springy, instant */
.tickbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line);
  background: transparent; display: grid; place-items: center; color: var(--line); flex: none;
  transition: transform var(--quick) var(--spring), background-color var(--spring-ms) var(--spring),
              border-color var(--spring-ms) var(--spring), color var(--spring-ms) var(--spring);
}
.tickbtn:active { transform: scale(.88); }
.tickbtn.done { background: var(--acc); border-color: var(--acc); color: var(--onacc); }
.tickbtn.late { border-color: var(--late); color: var(--late); }

/* ---------- the day's numbers: plain figures and a rule, no tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; }
.tile {
  background: none; border: 0; padding: 2px 0 11px; text-align: left; color: inherit;
  border-bottom: 1px solid var(--line);
}
.tile + .tile { padding-left: 20px; border-left: 1px solid var(--line); }
.tile .k { font-size: 13px; font-weight: 600; color: var(--ink3); letter-spacing: .02em; }
.tile .v { font-size: 31px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; margin: 1px 0 9px; }
.tile .v span { font-size: 17px; color: var(--ink3); font-weight: 500; letter-spacing: -.01em; }
.seg { display: flex; gap: 3px; padding-right: 20px; }
.tile + .tile .seg { padding-right: 0; }
.seg i { flex: 1; height: 4px; border-radius: 2px; background: var(--fill); transition: background-color var(--spring-ms) var(--spring); }
.seg.m i.f { background: var(--acc); }
.seg.h i.f { background: var(--water); }
.macline { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink3); margin-top: -8px; }
.macline b { color: var(--ink); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  background: var(--acc); color: var(--onacc); border: 0; border-radius: 12px;
  min-height: 50px; padding: 13px 18px; font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  text-decoration: none; transition: transform var(--quick) var(--spring), opacity var(--quick) ease-out;
}
.btn:active { transform: scale(.975); }
.btn { transition: transform var(--quick) var(--spring), background-color 140ms ease-out, border-color 140ms ease-out, color 140ms ease-out; }
.btn:disabled { opacity: .45; }
.btn.alt { background: transparent; color: var(--acc); border: 1px solid var(--line); }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.small { min-height: 36px; padding: 8px 15px; font-size: 15px; width: auto; border-radius: 9px; white-space: nowrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link {
  background: none; border: 0; color: var(--acc); font-size: 17px; font-weight: 500;
  padding: 12px 0; text-align: left; min-height: 44px;
}
.back {
  display: inline-flex; align-items: center; gap: 4px; color: var(--acc); font-size: 17px;
  background: none; border: 0; padding: 6px 0; align-self: flex-start; margin-bottom: -10px; min-height: 44px;
}
.back svg.ic { width: 17px; height: 17px; stroke-width: 2.4; }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink3); }
input, select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid transparent; border-radius: 11px;
  padding: 13px 14px; font-size: 17px; min-height: 50px;
  transition: border-color var(--quick) ease-out, background-color var(--quick) ease-out;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: none; background: var(--bg); border-color: var(--acc); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.err { color: var(--late); font-size: 15px; margin: 0; }

/* ---------- choices (onboarding) ---------- */
.prog { height: 3px; background: var(--fill); border-radius: 2px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--acc); transition: width var(--spring-ms) var(--spring); }
.opts { display: grid; }
.opt {
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 15px 2px;
  text-align: left; font-size: 17px; font-weight: 500; min-height: 56px; width: 100%;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; color: inherit;
  transition: transform var(--quick) var(--spring), color var(--quick) ease-out;
}
.opts .opt:first-child { border-top: 1px solid var(--line); }
.opt:active { transform: scale(.99); }
.opt small { display: block; font-size: 14px; font-weight: 400; color: var(--ink3); margin-top: 2px; }
.opt .ck {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); flex: none;
  display: grid; place-items: center; color: var(--onacc);
  transition: background-color var(--spring-ms) var(--spring), border-color var(--spring-ms) var(--spring);
}
.opt.on { color: var(--acc); }
.opt.on .ck { background: var(--acc); border-color: var(--acc); }
.opt .ck svg { opacity: 0; width: 13px; height: 13px; stroke-width: 3; transition: opacity var(--quick) ease-out; }
.opt.on .ck svg { opacity: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 9px 15px;
  font-size: 15px; font-weight: 500; min-height: 40px; color: inherit;
  transition: transform var(--quick) var(--spring), background-color var(--quick) ease-out;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--acc); border-color: var(--acc); color: var(--onacc); }

/* ---------- status ---------- */
.pill { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 7px; white-space: nowrap; letter-spacing: 0; }
.p-behind { background: var(--late-tint); color: var(--late); }
.p-watch { background: var(--watch-tint); color: var(--watch); }
.p-ok { background: var(--good-tint); color: var(--good); }
.p-none { background: var(--fill); color: var(--ink3); }
.av {
  width: 38px; height: 38px; border-radius: 50%; background: var(--acc-tint); color: var(--acc);
  display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; letter-spacing: 0;
}
.ktiles { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.ktiles .tile { border-bottom: 0; padding-bottom: 12px; }
.ktiles .tile + .tile { padding-left: 16px; }
.ktiles .tile .v { font-size: 34px; margin-bottom: 0; }
.ktiles .b .v { color: var(--late); } .ktiles .wa .v { color: var(--watch); } .ktiles .o .v { color: var(--good); }

/* ---------- coach: plan editor ---------- */
.tgt { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tgt div { padding: 12px 4px; font-size: 12px; color: var(--ink3); font-weight: 500; }
.tgt div + div { border-left: 1px solid var(--line); padding-left: 10px; }
.tgt strong { display: block; font-size: 22px; color: var(--ink); font-weight: 700; letter-spacing: -.025em; }
.tgt em { display: block; font-style: normal; font-size: 12px; margin-top: 3px; }
.tgt em.ok { color: var(--good); } .tgt em.off { color: var(--late); }
.ai {
  background: var(--ink); color: var(--bg); border: 0; border-radius: 14px; padding: 16px;
  display: flex; gap: 13px; align-items: center; text-align: left; font-size: 17px; font-weight: 600; width: 100%;
  transition: transform var(--quick) var(--spring);
}
.ai:active { transform: scale(.985); }
.ai small { display: block; font-weight: 400; opacity: .7; font-size: 14px; margin-top: 2px; letter-spacing: 0; }
.ai .spark { width: 22px; height: 22px; flex: none; }
.ai.busy .spark { animation: spin 1.3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* A meal reads as a plate, not a sentence: the dish, then what is on it. */
.row.top { align-items: flex-start; }
.row.top .t { padding-top: 1px; }
.bul { list-style: none; margin: 5px 0 0; padding: 0; display: grid; gap: 2px; }
.bul li { position: relative; padding-left: 15px; font-size: 14.5px; font-weight: 400; color: var(--ink2); line-height: 1.25; }
.bul li::before { content: ""; position: absolute; left: 3px; top: .58em; width: 4px; height: 4px; border-radius: 50%; background: var(--ink3); }
.row.done .bul li { color: var(--ink3); }

/* Removing a line collapses it where it stands instead of repainting the screen. */
.row.gone { max-height: 160px; overflow: hidden; animation: collapse 180ms ease-in forwards; pointer-events: none; }
@keyframes collapse { to { opacity: 0; transform: translateX(-14px); max-height: 0; padding-top: 0; padding-bottom: 0; border-bottom-color: transparent; } }

/* Adding a glass of water has to be unmistakable: the button says what it did. */
.btn.hit { background: var(--good); border-color: var(--good); color: #fff; }
.tile .v.pop { animation: pop 340ms var(--spring); transform-origin: left center; }
@keyframes pop { 35% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .row.gone { animation: none; opacity: 0; max-height: 0; }
  .tile .v.pop { animation: none; }
}

/* An AI call runs 10-30 seconds. The bar keeps moving, the stage says what is
 * happening and the seconds are real, so the wait never reads as a dead button. */
.working { display: grid; gap: 9px; padding: 5px 0 3px; }
.wline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; color: var(--ink2); }
.wline .wsec { color: var(--ink3); font-size: 14px; flex: none; }
.working .bar { height: 3px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.working .bar i { display: block; height: 100%; width: 38%; border-radius: 2px; background: var(--acc); animation: sweep 1.4s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-105%); } to { transform: translateX(270%); } }
@media (prefers-reduced-motion: reduce) { .working .bar i { animation: none; width: 100%; opacity: .3; } }
.used { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 13px 0; display: grid; gap: 9px; }
.used b { font-size: 13px; font-weight: 600; color: var(--ink3); letter-spacing: .02em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { background: var(--bg2); border-radius: 7px; padding: 5px 10px; font-size: 14px; font-weight: 500; }
.editbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--ink3); flex: none;
  transition: transform var(--quick) var(--spring), background-color var(--quick) ease-out;
}
.editbtn:active { transform: scale(.88); background: var(--bg2); }
.editform { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.empty {
  border: 1px dashed var(--line); border-radius: 14px; padding: 26px 18px; text-align: center;
  color: var(--ink2); font-size: 15px; line-height: 1.5;
}
.sum {
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 2px;
  display: grid; gap: 4px; text-align: left; width: 100%; color: inherit;
  transition: transform var(--quick) var(--spring);
}
.sum:active { transform: scale(.99); }
.sum .h2 {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; color: var(--ink3); letter-spacing: .02em;
}
.sum p { margin: 0; font-size: 17px; font-weight: 500; }
.sum p.m { color: var(--ink3); font-weight: 400; font-size: 15px; }
.allergy { display: flex; flex-wrap: wrap; gap: 7px; }
.allergy span { border-radius: 7px; padding: 4px 10px; font-size: 14px; font-weight: 600; background: var(--late-tint); color: var(--late); }
.math { display: grid; gap: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 13px 0; font-size: 15px; }
.math div { display: flex; justify-content: space-between; gap: 12px; }
.math span { color: var(--ink3); }
.math .tot { border-top: 1px solid var(--line); padding-top: 9px; font-weight: 600; }
.math .tot span { color: var(--ink); }
.segtabs { display: flex; background: var(--bg2); border-radius: 10px; padding: 2px; gap: 2px; }   /* iOS segmented control */
.segtabs button {
  flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 8px; min-height: 36px;
  font-size: 15px; font-weight: 500; color: var(--ink2);
  transition: background-color var(--quick) ease-out, color var(--quick) ease-out, transform var(--quick) var(--spring);
}
.segtabs button:active { transform: scale(.97); }
.segtabs button.on { background: var(--bg); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .09); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .segtabs button.on { background: #38383a; box-shadow: none; } }

/* ---------- scanner ---------- */
.cam { position: relative; background: #0b0c0d; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3.2; display: grid; place-items: center; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .frame { position: relative; width: 72%; height: 36%; z-index: 1; }
.cam .frame i { position: absolute; width: 24px; height: 24px; border: 0 solid #fff; }
.cam .frame i:nth-child(1) { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 10px; }
.cam .frame i:nth-child(2) { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 10px; }
.cam .frame i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 10px; }
.cam .frame i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 10px; }
.cam .hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 15px; z-index: 1; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.cam .msg { color: #fff; z-index: 1; text-align: center; padding: 24px; font-size: 16px; line-height: 1.45; }
.prod { display: flex; gap: 14px; align-items: center; }
.thumb { width: 48px; height: 48px; border-radius: 11px; background: var(--acc-tint); display: grid; place-items: center; color: var(--acc); flex: none; }
.prod h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; text-wrap: balance; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:first-of-type { border-top: 1px solid var(--line); }
.kv > span, .kv > label { color: var(--ink2); flex: none; font-size: 17px; }
.kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv select, .kv input { width: auto; min-width: 0; flex: 1; max-width: 62%; text-align: right; padding: 9px 12px; min-height: 40px; }
.macros { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.macros div { padding: 12px 2px; font-size: 12px; color: var(--ink3); font-weight: 500; text-align: center; }
.macros div + div { border-left: 1px solid var(--line); }
.macros strong { display: block; font-size: 22px; color: var(--ink); font-weight: 700; letter-spacing: -.025em; }
.stepper { display: flex; align-items: center; gap: 14px; font-weight: 600; }
.round {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent;
  display: grid; place-items: center; font-size: 20px; font-weight: 400; flex: none; color: var(--acc);
  transition: transform var(--quick) var(--spring), background-color var(--quick) ease-out;
}
.round:active { transform: scale(.9); background: var(--bg2); }
.water { display: flex; align-items: center; gap: 12px; }

/* The day you are looking at, with a step either side of it. */
.dayhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.daynav { display: flex; gap: 8px; flex: none; }
.daynav .round { width: 40px; height: 40px; }
.daynav .round svg.ic { width: 19px; height: 19px; stroke-width: 2.3; }
.daynav .round:disabled { opacity: .3; }
.daynav .round:disabled:active { transform: none; background: transparent; }

/* ---------- notices ---------- */
.note { border-top: 1px solid var(--line); padding: 14px 0; font-size: 16px; line-height: 1.45; }
.note b { display: block; font-size: 13px; color: var(--ink3); font-weight: 500; margin-bottom: 3px; }
.note strong { font-weight: 600; }
.banner { background: var(--acc-tint); border-radius: 14px; padding: 15px; font-size: 15px; display: grid; gap: 11px; line-height: 1.45; }
.banner b { font-weight: 600; }
.fine { display: flex; align-items: center; gap: 9px; font-size: 15px; color: var(--ink2); padding: 6px 0; }
.need { border-bottom: 1px solid var(--line); padding: 15px 0; display: grid; gap: 11px; }
.need .h { display: flex; align-items: center; gap: 13px; }
.need .h .w { flex: 1; min-width: 0; font-weight: 600; }
.need .h small { display: block; color: var(--ink3); font-size: 14px; font-weight: 400; margin-top: 2px; }
.sug { background: var(--bg2); border-radius: 11px; padding: 12px 13px; font-size: 15px; line-height: 1.45; }
.sug b { display: block; font-size: 13px; color: var(--ink3); font-weight: 500; margin-bottom: 3px; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line); padding: 7px 0 calc(env(safe-area-inset-bottom, 0px) + 7px);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .tabbar { background: var(--bg); } }
.tabbar .inner { display: flex; width: 100%; max-width: 560px; justify-content: space-around; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 68px; min-height: 48px;
  padding: 4px 12px; font-size: 10.5px; font-weight: 500; letter-spacing: 0; color: var(--ink3); text-decoration: none;
  transition: color var(--quick) ease-out, opacity var(--quick) ease-out;
}
.tabbar a.on { color: var(--acc); }
.tabbar a:active { opacity: .5; }
.tabbar svg.ic { width: 25px; height: 25px; stroke-width: 1.7; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); transform: translateX(-50%);
  background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--bg);
  padding: 12px 20px; border-radius: 999px; font-size: 15px; font-weight: 500; z-index: 20;
  max-width: calc(100vw - 36px); text-align: center;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: rise var(--spring-ms) var(--spring);
}
/* With an Undo the toast is a control, not a message: it sits as a row and the
 * action is the only thing that looks tappable. */
#toast.withundo { display: flex; align-items: center; gap: 16px; padding: 10px 12px 10px 20px; text-align: left; }
.tundo {
  background: none; border: 0; font: inherit; font-weight: 700; color: var(--bg);
  text-decoration: underline; text-underline-offset: 3px; padding: 6px 8px; min-height: 32px; flex: none;
}
.tundo:active { opacity: .6; }
.link.danger { color: var(--late); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px) scale(.96); } }

/* ---------- never let a row push the page sideways ---------- */
body { height: 100%; overflow: hidden; overscroll-behavior: none; }
#app > .view > *, #panel > * { min-width: 0; }

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

/* ---------- My Macros: the macro counter ---------- */
.kcal { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.kcal .k { font-size: 13px; font-weight: 600; color: var(--ink3); letter-spacing: .02em; }
.kcal .v { font-size: 31px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; margin-top: 1px; }
.kcal .v span + span { font-size: 17px; color: var(--ink3); font-weight: 500; letter-spacing: -.01em; }
.kcal .left { text-align: right; font-size: 13px; color: var(--ink3); font-weight: 500; }
.kcal .left b { display: block; font-size: 20px; color: var(--acc); font-weight: 700; letter-spacing: -.02em; }
.kcal .left.over b { color: var(--late); }
.mbar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.mbar.big { height: 8px; border-radius: 4px; margin-top: -4px; }
.mbar i { display: block; height: 100%; border-radius: inherit; background: var(--acc); transition: width var(--spring-ms) var(--spring); }
.macs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding-bottom: 4px; }
.mac .mtop { display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: var(--ink3); font-weight: 600; margin-bottom: 6px; }
.mac .mtop .num { font-weight: 500; font-size: 14px; }
.mac .mtop b { color: var(--ink); font-weight: 700; font-size: 16px; }
.mac.p .mbar i { background: var(--acc); }
.mac.c .mbar i { background: var(--water); }
.mac.f .mbar i { background: var(--watch); }
.mac.over .mbar i { background: var(--late); }
.mac.over .mtop b { color: var(--late); }
#macros { display: grid; gap: 13px; }
/* calories row is the button that opens protein / carbs / fat */
button.kcal { width: 100%; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.kcal:active { transform: scale(.99); }
.kcal .k { display: inline-flex; align-items: center; gap: 4px; }
.kcal .k svg.ic { width: 14px; height: 14px; stroke-width: 2.4; transition: transform var(--spring-ms) var(--spring); }
.kcal[aria-expanded="true"] .k svg.ic { transform: rotate(180deg); }
.macs[hidden] { display: none; }
.macs:not([hidden]) { animation: paneIn 240ms var(--spring); }
.row .w small.swap { color: var(--acc); font-weight: 500; }

/* Meals: generator, grocery stores */
.genbox { display: grid; gap: 14px; }
.genbox .lbl { margin: 0; }
.stores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.store { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 15px; font-weight: 500; text-align: left; transition: transform var(--quick) var(--spring), border-color 140ms ease-out, background-color 140ms ease-out; }
.store:active { transform: scale(.97); }
.store.on { border-color: var(--acc); background: var(--acc-tint); box-shadow: inset 0 0 0 1px var(--acc); }
.store.all { grid-column: 1 / -1; }
.logo { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: -.02em; }
.storerow { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; color: inherit; text-align: left; gap: 12px; }
.storerow.on .w { color: var(--acc); font-weight: 600; }
.storerow .price { color: var(--ink); }
.storerow.on .price { color: var(--acc); }
small.cheap { color: var(--good) !important; font-weight: 600 !important; }

/* Me: grouped sections */
.group { display: grid; gap: 10px; }
.group .h { margin: 6px 0 0; }
.group .box .kv:first-child { border-top: 1px solid var(--line); }
.kv .unit { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }
.kv .unit input { max-width: 110px; }
.kv .unit i { font-style: normal; color: var(--ink3); font-size: 15px; width: 56px; }
img.logo { object-fit: cover; background: #fff; box-shadow: 0 0 0 .5px var(--line); }
.logo.alltile { background: var(--ink); color: var(--bg); font-size: 12px; }
.store .logo, .storerow .logo { width: 36px; height: 36px; border-radius: 9px; }
.pickhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link.small { font-size: 15px; padding: 6px 0; min-height: 0; }
.row .price small.est { display: block; font-size: 11px; font-weight: 500; color: var(--ink3); text-align: right; }
.storerow small .cheap { color: var(--good); font-weight: 600; }
.srcs { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.srcs summary { color: var(--acc); font-weight: 500; cursor: pointer; }
.srcs ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.srcs a { color: var(--ink); font-size: 15px; overflow-wrap: anywhere; }
.srcs small { display: block; color: var(--ink3); font-size: 13px; }

/* pricing progress */
.prog2 { display: grid; gap: 10px; }
.prog2 .phead { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; }
.prog2 .phead span { color: var(--ink3); font-size: 15px; }
.pbar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; position: relative; }
.pbar i { display: block; height: 100%; width: 4%; border-radius: inherit; background: var(--acc); transition: width 900ms var(--spring); position: relative; overflow: hidden; }
.pbar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: translateX(-100%); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.step { gap: 12px; color: var(--ink3); transition: color 200ms ease-out; }
.step .w { color: inherit; }
.step.active, .step.ok { color: var(--ink); }
.step .logo { width: 30px; height: 30px; border-radius: 8px; }
.sicon { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; position: relative; transition: background-color 200ms ease-out, border-color 200ms ease-out; }
.sicon svg.ic { width: 14px; height: 14px; stroke-width: 3; opacity: 0; transform: scale(.4); transition: opacity 200ms ease-out, transform 320ms var(--spring); color: var(--onacc); }
.sicon .spin { position: absolute; inset: -2px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--acc); opacity: 0; }
.step.active .sicon .spin { opacity: 1; animation: spin .8s linear infinite; }
.step.ok .sicon { background: var(--acc); border-color: var(--acc); }
.step.ok .sicon svg.ic { opacity: 1; transform: scale(1); }
.mini { display: block; height: 3px; border-radius: 2px; background: var(--fill); margin-top: 7px; overflow: hidden; }
.mini i { display: block; height: 100%; width: 0; background: var(--acc); border-radius: inherit; transition: width 700ms var(--spring); }
.step.ok .mini { display: none; }
@media (prefers-reduced-motion: reduce) { .pbar i::after, .step.active .sicon .spin { animation: none; } }

/* live narration */
.pnow { margin: 0; font-size: 15px; color: var(--acc); min-height: 1.35em; overflow-wrap: anywhere; }
.pnow.in { animation: nowIn 260ms var(--spring); }
@keyframes nowIn { from { opacity: 0; transform: translateY(4px); } }
.livelog { display: grid; gap: 10px; padding: 4px 0; }
.livelog .phead { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; }
.livelog .phead span { color: var(--ink3); font-size: 15px; }
.livelog .pbar i { width: 100%; background: var(--acc-tint); }
.livelog .pbar i::after { background: linear-gradient(90deg, transparent, var(--acc), transparent); }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.feed li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink2); animation: nowIn 260ms var(--spring); }
.feed li.now { color: var(--ink); font-weight: 500; }
.feed li .sicon { width: 20px; height: 20px; }
.feed li .sicon svg.ic { width: 11px; height: 11px; }
.feed li.now .sicon .spin { opacity: 1; animation: spin .8s linear infinite; }
.feed li.ok .sicon { background: var(--acc); border-color: var(--acc); }
.feed li.ok .sicon svg.ic { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .pnow.in, .feed li { animation: none; } }

/* calorie ring */
button.ringcard { display: grid; grid-template-columns: 132px 1fr; align-items: center; gap: 20px; position: relative; }
.ring { width: 132px; height: 132px; display: block; }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: var(--fill); }
.ring .fill { stroke: var(--acc); stroke-linecap: round; transition: stroke-dashoffset 900ms cubic-bezier(.23, 1, .32, 1), stroke 200ms ease-out; }
.ringcard.over .ring .fill { stroke: var(--late); }
.ringmid { position: absolute; left: 0; top: 0; width: 132px; height: 132px; display: grid; place-content: center; text-align: center; }
.ringmid b { font-size: 28px; font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.ringmid small { font-size: 13px; color: var(--ink3); margin-top: 3px; }
.ringcard .side { display: grid; gap: 2px; }
.ringcard .side .k { font-size: 13px; font-weight: 600; color: var(--ink3); letter-spacing: .02em; }
.ringcard .side b { font-size: 34px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; color: var(--acc); }
.ringcard.over .side b { color: var(--late); }
.ringcard .side small { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--ink2); margin-top: 6px; }
.ringcard .side small svg.ic { width: 14px; height: 14px; stroke-width: 2.4; transition: transform var(--spring-ms) var(--spring); }
.ringcard[aria-expanded="true"] .side small svg.ic { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .ring .fill { transition: none; } }

/* progress */
.wtop { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; }
.wtop .bigv { font-size: 34px; font-weight: 700; letter-spacing: -.035em; }
.wtop .unitv { font-size: 17px; color: var(--ink3); }
.wtop small { display: block; font-size: 14px; color: var(--ink2); margin-top: 2px; }
.wform { display: flex; gap: 8px; align-items: center; flex: none; }
.wform input { width: 92px; text-align: right; }
.chartwrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis.now { fill: var(--ink); font-weight: 600; }
.chart .wline { fill: none; stroke: var(--acc); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .wdot { fill: var(--acc); stroke: var(--bg); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .bar { fill: var(--acc); }
.chart .bar.off { fill: var(--late); }
.chart .bar.none { fill: var(--fill); }
.chart .target { stroke: var(--ink2); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .tlabel { fill: var(--ink2); font-weight: 500; }
.tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 500; padding: 5px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats div { padding: 12px 8px 12px 0; }
.stats div + div { border-left: 1px solid var(--line); padding-left: 12px; }
.stats b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.stats b span { font-size: 15px; color: var(--ink3); font-weight: 500; }
.stats small { display: block; font-size: 12px; color: var(--ink3); margin-top: 2px; line-height: 1.3; }
.legend { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--ink2); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -8px; }
.legend .sw.on { background: var(--acc); } .legend .sw.off { background: var(--late); }
.legend .sw.tl { height: 0; border-top: 2px dashed var(--ink2); border-radius: 0; width: 14px; }
.chart .bar.today { fill: var(--acc); fill-opacity: .4; }
.legend .sw.td { background: var(--acc); opacity: .4; }
