/* INTAKE — styles.css
   Light + dark (first-class, not an inversion), phone-first, iOS Safari standalone.
   Motion: transforms + opacity only (stroke-dashoffset on the ring / checkmark is the one SVG exception).
   ----------------------------------------------------------------- */

/* ================= 1. TOKENS ================= */

:root {
  color-scheme: light dark;

  /* cool steel-graphite neutrals biased toward ONE blue accent; good/warn/over are the calorie semantics */
  --bg: #F3F4F7; --surface: #FFFFFF; --surface-2: #EDEFF3; --surface-3: #E2E5EB;
  --line: #E3E6EC; --line-2: #CFD4DC; --card-line: transparent;   /* light cards rely on shadow, dark on the line */
  --text: #0F1218; --text-2: #3A4150; --muted: #66707F; --faint: #8A93A3;
  --accent: #2563EB; --accent-text: #1D4ED8; --accent-ink: #FFFFFF; --accent-soft: rgba(37, 99, 235, .12);
  --good: #15803D; --warn: #A86300; --over: #DC2626;
  --fat: #F59E0B; --carbs: #9333EA; --water: #0EA5E9; --weight: #7C3AED;
  --shimmer: rgba(15, 18, 24, .06); --scrim: rgba(15, 18, 24, .44);
  --topbar-bg: rgba(243, 244, 247, .84); --tabbar-bg: rgba(255, 255, 255, .88);
  --pill-off-bg: rgba(168, 99, 0, .12);
  --shadow-card: 0 1px 2px rgba(15, 18, 24, .06), 0 4px 12px rgba(15, 18, 24, .06);
  --shadow-sheet: 0 -12px 40px rgba(15, 18, 24, .18);
  --shadow-fab: 0 8px 24px rgba(37, 99, 235, .32), 0 2px 6px rgba(15, 18, 24, .12);
  --shadow-toast: 0 12px 32px rgba(15, 18, 24, .18);
  --shadow-primary: 0 4px 12px rgba(37, 99, 235, .25);
  --lift: none;                        /* dark uses an inset highlight on top of its shadow */
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366707F' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E");
  --chevron-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366707F' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Crect width='512' height='512' rx='112' fill='%230E1014'/%3E%3Ccircle cx='256' cy='256' r='150' fill='none' stroke='%23262B34' stroke-width='40'/%3E%3Cpath d='M331 126.1A150 150 0 1 1 181 126.1' fill='none' stroke='%234F8DFF' stroke-width='40' stroke-linecap='round'/%3E%3Crect x='230' y='190' width='52' height='132' rx='14' fill='%23F2F4F8'/%3E%3C/svg%3E");

  /* aliases app.js / inline styles rely on */
  --kcal: var(--accent); --protein: var(--good); --green: var(--good); --amber: var(--warn); --red: var(--over);
  /* apartment shelves + health tiles */
  --sec-drinks: #0EA5E9; --sec-meats: #DC2626; --sec-dairy: #F59E0B; --sec-pantry: #9333EA; --sec-fresh: #15803D; --sec-condiments: #C2410C; --sec-other: #66707F; --sec-recent: #2563EB;
  --sleep: #7C3AED; --steps: #2563EB;

  /* type */
  --font-display: "Barlow Semi Condensed", "Avenir Next Condensed", "HelveticaNeue-CondensedBold", "Arial Narrow", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-hero: 56px; --fs-num-xl: 44px; --fs-num-lg: 28px; --fs-num-md: 22px;
  --fs-title: 20px; --fs-head: 17px; --fs-input: 17px; --fs-body: 16px; --fs-row: 15px;
  --fs-sm: 14px; --fs-xs: 13px; --fs-2xs: 13px; --fs-eyebrow: 11px;

  /* radius, spacing, layout */
  --r-xs: 8px; --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  --radius: var(--r-lg); --radius-sm: var(--r-sm);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --topbar-h: 52px; --tabbar-h: 60px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --kb: 0px;   /* keyboard height, set from visualViewport in app.js; keep the name */

  /* motion */
  --dur-press: 90ms; --dur-fast: 140ms; --dur-base: 180ms; --dur-sheet: 240ms;
  --dur-bar: 420ms; --dur-ring: 640ms; --dur-count: 600ms;
  --ease-out: cubic-bezier(.22, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.32, 1.25, .5, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1014; --surface: #171A20; --surface-2: #1F232B; --surface-3: #2A2F39;
    --line: #262B34; --line-2: #343A46; --card-line: var(--line);
    --text: #F2F4F8; --text-2: #C3C9D4; --muted: #8B93A1; --faint: #6B7382;
    --accent: #4F8DFF; --accent-text: var(--accent); --accent-ink: #0B1020; --accent-soft: rgba(79, 141, 255, .16);
    --good: #3DDC84; --warn: #FFB020; --over: #FF5A5F;
    --fat: #FBBF24; --carbs: #C084FC; --water: #38BDF8; --weight: #C084FC;
    --sec-drinks: #38BDF8; --sec-meats: #FF5A5F; --sec-dairy: #FBBF24; --sec-pantry: #C084FC; --sec-fresh: #3DDC84; --sec-condiments: #FB923C; --sec-other: #8B93A1; --sec-recent: #4F8DFF;
    --sleep: #A78BFA; --steps: #4F8DFF;
    --shimmer: rgba(255, 255, 255, .06); --scrim: rgba(0, 0, 0, .62);
    --topbar-bg: rgba(14, 16, 20, .78); --tabbar-bg: rgba(23, 26, 32, .88);
    --pill-off-bg: rgba(255, 176, 32, .14);
    /* three-step surface ladder + a real drop shadow: cards lift off the page instead of being drawn on it */
    --shadow-card: 0 1px 0 rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); --lift: inset 0 1px 0 rgba(255, 255, 255, .04);
    --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, .55);
    --shadow-fab: 0 8px 24px rgba(79, 141, 255, .28), 0 2px 6px rgba(0, 0, 0, .4);
    --shadow-toast: 0 12px 32px rgba(0, 0, 0, .5);
    --shadow-primary: none;
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B93A1' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E");
    --chevron-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B93A1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  --bg: #0E1014; --surface: #171A20; --surface-2: #1F232B; --surface-3: #2A2F39;
  --line: #262B34; --line-2: #343A46; --card-line: var(--line);
  --text: #F2F4F8; --text-2: #C3C9D4; --muted: #8B93A1; --faint: #6B7382;
  --accent: #4F8DFF; --accent-text: var(--accent); --accent-ink: #0B1020; --accent-soft: rgba(79, 141, 255, .16);
  --good: #3DDC84; --warn: #FFB020; --over: #FF5A5F;
  --fat: #FBBF24; --carbs: #C084FC; --water: #38BDF8; --weight: #C084FC;
  --sec-drinks: #38BDF8; --sec-meats: #FF5A5F; --sec-dairy: #FBBF24; --sec-pantry: #C084FC; --sec-fresh: #3DDC84; --sec-condiments: #FB923C; --sec-other: #8B93A1; --sec-recent: #4F8DFF;
  --sleep: #A78BFA; --steps: #4F8DFF;
  --shimmer: rgba(255, 255, 255, .06); --scrim: rgba(0, 0, 0, .62);
  --topbar-bg: rgba(14, 16, 20, .78); --tabbar-bg: rgba(23, 26, 32, .88);
  --pill-off-bg: rgba(255, 176, 32, .14);
  /* three-step surface ladder + a real drop shadow: cards lift off the page instead of being drawn on it */
  --shadow-card: 0 1px 0 rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35); --lift: inset 0 1px 0 rgba(255, 255, 255, .04);
  --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, .55);
  --shadow-fab: 0 8px 24px rgba(79, 141, 255, .28), 0 2px 6px rgba(0, 0, 0, .4);
  --shadow-toast: 0 12px 32px rgba(0, 0, 0, .5);
  --shadow-primary: none;
  --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B93A1' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M16 16l5 5'/%3E%3C/svg%3E");
  --chevron-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B93A1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ================= 2. BASE ================= */

* { box-sizing: border-box; }

html {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Fixed body: kills the whole-page rubber band on iOS; the .screen scrolls instead. */
body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background: var(--bg);
  color: var(--text);
}

[hidden] { display: none !important; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

input, select, textarea {
  font: inherit;
  color: var(--text);
}

/* iOS zooms into any input under 16px on focus — every input is 17px. */
.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  font-size: var(--fs-input);
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--muted); }
.input.key { -webkit-text-security: disc; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input[type="time"].input, input[type="date"].input { padding-right: 8px; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select.input {
  background-image: var(--chevron-icon);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

/* ================= 3. FRAME ================= */

#app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
}

/* floating sticky header: content scrolls under it */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(var(--topbar-h) + var(--sat));
  padding: var(--sat) calc(16px + var(--sar)) 0 calc(16px + var(--sal));
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
#topbar .brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
  /* the real monogram, not a coloured dot: same SVG as the favicon / touch icon */
  padding-left: 30px;
  line-height: 22px;
  background: var(--logo) left center / 22px 22px no-repeat;
}
#topbar .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}
#topbar .pill.off { color: var(--warn); background: var(--pill-off-bg); }
#topbar .pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
#netpill:not(.off) i { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

#screens { flex: 1; position: relative; min-height: 0; }

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(var(--topbar-h) + var(--sat) + 12px) calc(16px + var(--sar)) calc(var(--tabbar-h) + var(--sab) + 32px) calc(16px + var(--sal));
  animation: screen-in var(--dur-base) var(--ease-out);
}
.screen.flush { padding: calc(var(--topbar-h) + var(--sat)) 0 calc(var(--tabbar-h) + var(--sab) + 24px) 0; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }

#progress {
  position: absolute;
  top: calc(var(--topbar-h) + var(--sat));
  left: 0; right: 0;
  height: 2px;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}
#progress::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 40%;
  height: 100%;
  background: var(--accent);
  transform: translateX(-100%);
  animation: slide 1s linear infinite;
}
@keyframes slide { to { transform: translateX(250%); } }

/* ================= 4. TAB BAR + FAB ================= */

#tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 8;
  display: flex;
  height: calc(var(--tabbar-h) + var(--sab));
  padding: 0 var(--sar) var(--sab) var(--sal);
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--line);
  container-type: inline-size;
  --ti: 0;
}
#tabbar:has(> button:nth-child(2).on) { --ti: 1; }
#tabbar:has(> button:nth-child(3).on) { --ti: 2; }
#tabbar:has(> button:nth-child(4).on) { --ti: 3; }
#tabbar:has(> button:nth-child(5).on) { --ti: 4; }
#tabbar::before {
  content: "";
  position: absolute;
  top: 7px;
  left: calc(10cqw - 28px);
  width: 56px; height: 30px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  transform: translateX(calc(var(--ti) * 20cqw));
  transition: transform var(--dur-sheet) var(--ease-spring);
  pointer-events: none;
}
#tabbar button {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
#tabbar button svg {
  width: 24px; height: 24px;
  stroke-width: 1.9;
  transition: transform var(--dur-sheet) var(--ease-spring), color var(--dur-fast);
}
#tabbar button.on { color: var(--accent-text); }
#tabbar button.on svg { transform: translateY(-1px); }
@supports not (selector(:has(a))) {
  #tabbar::before { display: none; }
  #tabbar button.on::before {
    content: "";
    position: absolute;
    top: 7px;
    width: 56px; height: 30px;
    border-radius: var(--r-pill);
    background: var(--accent-soft);
  }
}

/* The FAB is retired: every meal already carries its own add row, and a floating 56px disc sat over the
   kcal column of whichever row was at the bottom of the viewport. app.js only toggles `hidden` on it. */
#fab { display: none; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ================= 5. PRIMITIVES ================= */

.card {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: var(--s4);
  box-shadow: var(--shadow-card), var(--lift);
}
.card.water { margin-top: var(--s6); }
/* the one caps-label recipe: 11px / 700 / .08em / muted */
.eyebrow, .card h3, .label, .foodlist .group, .stat .l, .preview .l, .ring .cap {
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.card h3 { margin: 0 0 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-xs); }
.tiny { font-size: var(--fs-2xs); }
.bold { font-weight: 700; }
.right { text-align: right; }
.stack > * + * { margin-top: 10px; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.label { display: block; margin: 0 0 6px 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 16px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.btn .sub { display: block; font-size: 12px; font-weight: 500; opacity: .8; line-height: 1.1; }
.btn .k { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08) inset, var(--shadow-primary);
}
.btn.primary .k { color: var(--accent-ink); opacity: .7; }
.btn.primary:disabled { opacity: .5; }
.btn.danger { color: var(--over); border-color: color-mix(in srgb, var(--over) 35%, transparent); background: color-mix(in srgb, var(--over) 8%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent-text); }
.btn.block { display: flex; width: 100%; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: var(--r-sm); }
.btn.icon { width: 44px; min-height: 44px; padding: 0; border-radius: 12px; }
.btn.icon svg { width: 22px; height: 22px; }

/* press feedback, every tappable */
.btn, .chip, .seg button, #tabbar button, .food, .dayrow, .meal-add, .datestrip .arrow,
.datestrip .label, #fab, .sheet .close, .food .quick, .food .star, .switch .track, #toast button,
.scan-torch {
  transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out),
    background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
:is(.btn, .chip, .seg button, #tabbar button, .dayrow, .meal-add, .datestrip .arrow,
    .datestrip .label, .sheet .close, .food .quick, .food .star, #toast button, .scan-torch):active {
  transform: scale(.97);
  opacity: .85;
}
.food:active:not(:has(button:active)) { transform: scale(.985); opacity: .9; }
.entry .er:active { background: var(--surface-2); }   /* never transform .er: app.js drives its transform for swipe-to-delete */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: var(--fs-row);
  color: var(--text-2);
}
.chip.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.chip .k { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 4px; }

/* meal picker: sliding thumb, one column wide */
.seg {
  position: relative;
  display: flex;
  gap: 0;
  padding: 4px;
  background: var(--surface-3);
  border-radius: 12px;
  container-type: inline-size;
  --si: 0;
}
.seg:has(> button:nth-child(2).on) { --si: 1; }
.seg:has(> button:nth-child(3).on) { --si: 2; }
.seg:has(> button:nth-child(4).on) { --si: 3; }
.seg:has(> button:nth-child(5).on) { --si: 4; }
.seg::before {
  content: "";
  position: absolute;
  top: 4px; left: 4px;
  height: calc(100% - 8px);
  width: 20cqw;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14), var(--lift);
  transform: translateX(calc(var(--si) * 100%));
  transition: transform var(--dur-sheet) var(--ease-spring);
}
.seg button {
  flex: 1;
  position: relative;
  min-height: 44px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}
.seg button.on { color: var(--text); }
@supports not (selector(:has(a))) {
  .seg::before { display: none; }
  .seg button.on { background: var(--surface); border-radius: 9px; }
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  gap: 12px;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  flex: none;
  width: 50px; height: 30px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  position: relative;
  transition: background-color 200ms var(--ease-out);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform 200ms var(--ease-out);
}
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(20px); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  min-height: 60px;
  margin-bottom: 12px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ================= 6. TODAY ================= */

.datestrip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
  touch-action: pan-y;
}
.datestrip .arrow { width: 48px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.datestrip .arrow svg { width: 22px; height: 22px; stroke-width: 2.4; }
.datestrip .label {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-title);
  color: var(--text);
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
/* title + subtitle ("Today  Sat 5 Sept"), not a tracked-caps accent eyebrow */
.datestrip .label .sub { font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; text-transform: none; }

.hero { touch-action: pan-y; padding: var(--s2) 0 var(--s4); }

.ring {
  position: relative;
  width: 268px; height: 268px;
  margin: 0 auto;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 16; stroke-linecap: round; }
.ring .track { stroke: var(--surface-3); }
.ring .fill {
  stroke: var(--kcal);
  transition: stroke-dashoffset var(--dur-ring) var(--ease-out), stroke 300ms var(--ease-out), opacity 300ms;
}
.ring.near .fill { stroke: var(--warn); }
.ring.over .fill { stroke: var(--over); }
.ring.empty .fill { opacity: 0; }         /* round caps draw a dot at zero length; hide it at 0 eaten */
.ring.bump { animation: ring-bump var(--dur-bar) var(--ease-spring); }
@keyframes ring-bump { 35% { transform: scale(1.035); } }
.ring .centre {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring .big {
  font: 800 var(--fs-hero)/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -.03em;
  color: var(--text);
}
.ring.over .big { color: var(--over); }
.ring .cap { margin-top: 8px; }
/* eaten · target sits UNDER the ring now: at 232 px the third line ran into the stroke (his report 06-09) */
.hero-sub { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; font-size: var(--fs-sm); color: var(--muted); }
.hero-sub b { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text-2); }
.hero-sub i { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }

.macros { display: flex; flex-direction: column; gap: 14px; margin-top: var(--s5); }
.macro { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 12px; }
.macro .name { font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
.macro .bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.macro .bar i {
  display: block;
  height: 100%; width: 100%;
  border-radius: var(--r-pill);
  background: var(--c);
  transform: translateX(calc((var(--p, 0) - 1) * 100%));
  transition: transform var(--dur-bar) var(--ease-out), background-color 300ms;
}
.macro:nth-child(2) .bar i { transition-delay: 60ms; }
.macro:nth-child(3) .bar i { transition-delay: 120ms; }
.macro.over .bar i { background: var(--over); }
.macro.hit .bar i { background: var(--good); }
.macro .val { font-size: var(--fs-sm); color: var(--text); min-width: 88px; text-align: right; font-family: var(--font-body); letter-spacing: 0; }
.macro .val b { font-weight: 700; font-family: var(--font-display); font-size: 16px; }
.macro .val span { color: var(--muted); }
.macro.hit .val b { color: var(--good); }
.macro.over .val b { color: var(--over); }
/* the 90% warning is a tag, not a recolour — amber on the yellow fat bar was invisible */
.macro .val .tag {
  display: inline-block;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--warn);
  margin-right: 6px;
  vertical-align: 1px;
}
.macro .val .tag.over { color: var(--over); }

.water .bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin: 10px 0 12px; }
.water .bar i {
  display: block;
  height: 100%; width: 100%;
  background: var(--water);
  border-radius: var(--r-pill);
  transform: translateX(calc((var(--p, 0) - 1) * 100%));
  transition: transform var(--dur-bar) var(--ease-out);
}
.water .btn { flex: 1; padding: 0 8px; font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.water .btn.minus { flex: 0 0 48px; color: var(--muted); }
.water .amt { font-size: var(--fs-num-md); font-weight: 700; }
.water .amt b { font-weight: 700; }
.water .amt span { font-size: 14px; color: var(--muted); font-weight: 500; font-family: var(--font-body); letter-spacing: 0; }

.meal { margin-bottom: var(--s6); }
.meal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px var(--s2);
}
.meal-head h4 { margin: 0; font-family: var(--font-display); font-size: var(--fs-head); font-weight: 700; }
.meal-head .tot { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-body); letter-spacing: 0; }
.meal-head .tot b { color: var(--text-2); font-weight: 700; font-family: var(--font-display); font-size: 14px; }
.meal-body {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card), var(--lift);
}
/* an empty meal is a flat dashed slot, not a full card wrapping one add row */
.meal-body:not(:has(.entry)) { background: transparent; border: 1px dashed var(--line-2); box-shadow: none; }
.meal-body:not(:has(.entry)) .meal-add { justify-content: center; color: var(--muted); min-height: 44px; }

.entry { position: relative; overflow: hidden; }
.entry + .entry .er { border-top: 1px solid var(--line); }
.entry .under {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 22px;
  background: var(--over);
  color: #fff;
  font-weight: 800;
  letter-spacing: .04em;
}
.entry .er {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 9px 14px;
  background: var(--surface);
  transform: translateX(0);
  transition: transform .18s ease-out, background-color var(--dur-fast);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}
.entry .er.drag { transition: none; }
.entry .er.pending::after {
  content: "";
  position: absolute;
  top: 10px; left: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warn);
}
.entry .time { font-size: var(--fs-2xs); color: var(--muted); min-width: 40px; }
.entry .name { font-weight: 600; font-size: var(--fs-row); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .meta { font-size: var(--fs-2xs); color: var(--muted); margin-top: 2px; }
.entry .kcal { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.entry .p { font-size: var(--fs-2xs); color: var(--protein); font-weight: 700; margin-top: 2px; }

.meal-add {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--accent-text);
  font-weight: 600;
  font-size: var(--fs-sm);
  text-align: left;
}
.meal-add svg { width: 16px; height: 16px; }
.meal-body .entry + .meal-add { border-top: 1px solid var(--line); }

.hint {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  box-shadow: var(--shadow-card), var(--lift);
}
.hint::before {
  content: "iPhone";
  display: block;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.hint b { color: var(--text); }
.hint .row { margin-top: 10px; }

/* ================= 7. FOODS ================= */

.searchbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.searchbar .input { flex: 1; }
.searchbar .btn { flex: none; }
#foodSearch, #pickSearch {
  padding-left: 40px;
  background-image: var(--search-icon);
  background-repeat: no-repeat;
  background-position: 14px center;
  background-size: 18px;
}

.foodlist {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card), var(--lift);
}
.foodlist .group {
  padding: 12px 14px 6px;
  background: var(--surface);
}
.food {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  padding: 8px 6px 8px 4px;
  border-top: 1px solid var(--line);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.food:first-child { border-top: 0; }
.food .star { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--faint); flex: none; }
.food .star.on { color: var(--fat); }
.food .star svg { width: 22px; height: 22px; }
.food .main { flex: 1; min-width: 0; }
.food .name { font-weight: 600; font-size: var(--fs-row); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.food .brand { font-size: var(--fs-2xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.food .macro100 { text-align: right; flex: none; }
.food .macro100 .k { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.food .macro100 .pp { font-size: var(--fs-2xs); color: var(--protein); font-weight: 700; }
.food .macro100 .per { font-size: 12px; color: var(--muted); }
.food .more { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.food .more svg { width: 20px; height: 20px; }
/* one-tap add: last weight / serve / 100 g, list stays open */
.food .quick {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 54px; height: 50px;
  margin-right: 4px;
  border-radius: var(--r-md);
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.food .quick svg { width: 18px; height: 18px; }
.food .quick .qg { font-size: 12px; font-weight: 700; color: var(--muted); line-height: 1.1; }
.food .quick:active { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.food.pending .name::after { content: " · syncing"; color: var(--warn); font-size: 11px; }

/* ================= 8. SCAN ================= */

#screen-scan { background: #000; }
.scanwrap { position: relative; background: #000; height: min(58vh, 460px); min-height: 260px; overflow: hidden; }
#scanVideo { width: 100%; height: 100%; display: block; object-fit: cover; background: #000; }
/* HUD: a soft sweep line over the WHOLE frame (no crop box — the decoder reads the full frame) and a
   highlight that snaps onto the code the instant it reads */
.scan-hud { position: absolute; inset: 0; pointer-events: none; }
.scan-line {
  position: absolute; left: 8%; right: 8%; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(79, 141, 255, .9), transparent);
  box-shadow: 0 0 12px rgba(79, 141, 255, .7);
  animation: scan-sweep 2.4s ease-in-out infinite;
}
@keyframes scan-sweep { 0% { top: 12%; opacity: 0; } 10% { opacity: 1; } 50% { top: 86%; } 90% { opacity: 1; } 100% { top: 12%; opacity: 0; } }
.scanwrap.found .scan-line { animation: none; opacity: 0; }
.scan-hit {
  position: absolute; border: 3px solid var(--good); border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .4), 0 0 24px rgba(61, 220, 132, .55);
  animation: hit-in 260ms var(--ease-out) both;
}
@keyframes hit-in { from { transform: scale(1.25); opacity: 0; } }
.scanwrap.found::after { content: ""; position: absolute; inset: 0; background: rgba(61, 220, 132, .12); animation: fade 200ms var(--ease-out) both; }
/* the decoded number, shown before the lookup answers */
.scan-code {
  display: flex; align-items: baseline; gap: 10px; margin: 2px 0 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--r-md);
  box-shadow: var(--shadow-card), var(--lift);
}
.scan-code .lbl { font-size: var(--fs-eyebrow); font-weight: 700; color: var(--good); text-transform: uppercase; letter-spacing: .08em; }
.scan-code b { font-family: var(--font-display); font-size: var(--fs-num-md); font-weight: 700; letter-spacing: .06em; color: var(--text); }
.scan-code .eng { margin-left: auto; font-size: var(--fs-2xs); color: var(--muted); }
.scan-code.pop b { animation: code-pop 320ms var(--ease-out) both; }
@keyframes code-pop { from { transform: translateY(6px); opacity: 0; } }
.scan-overlay {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, .55);
  color: rgba(255, 255, 255, .92);
  font-size: 13px;
  font-weight: 500;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.scan-torch {
  position: absolute;
  top: 12px; right: 12px;
  width: 44px; height: 44px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-torch.on { background: var(--fat); color: #0F1218; }
.scan-torch svg { width: 22px; height: 22px; }
.scan-panel { padding: 16px 16px 0; background: var(--bg); }
.scan-panel .big-msg { font-family: var(--font-display); font-size: var(--fs-title); font-weight: 700; margin: 6px 0 4px; }
.scan-panel .code { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: var(--fs-num-md); font-weight: 600; letter-spacing: .08em; color: var(--text-2); }
.scan-msg { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-sm); min-height: 20px; margin-bottom: 10px; }
.scan-msg.err { color: var(--warn); }
.scan-msg:not(:empty):not(.err)::before {
  content: "";
  flex: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 9. TRENDS ================= */

/* three tiles read as one segmented surface: 1px of --line between them, no per-tile border/shadow */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: var(--s4);
  background: var(--line);
  border: 1px solid var(--card-line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-card), var(--lift);
}
.stat {
  background: var(--surface);
  border: 0;
  border-radius: 0;
  padding: 12px 12px 10px;
  box-shadow: none;
}
.stat .v { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: var(--fs-num-lg); font-weight: 700; line-height: 1.1; letter-spacing: -.01em; color: var(--text); }
.stat .v.green { color: var(--good); }
.stat .v.accent { color: var(--accent); }
.stat .l { margin-top: 4px; }

.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-body); font-variant-numeric: tabular-nums; fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .target { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .bar { fill: var(--kcal); opacity: .9; }
.chart .bar.over { fill: var(--over); }
.chart .bar.none { fill: var(--surface-3); }
.chart .pline { fill: none; stroke: var(--protein); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pdot { fill: var(--protein); }
.chart .pdot.miss { fill: var(--surface); stroke: var(--protein); stroke-width: 1.5; }
.chart .wline { fill: none; stroke: var(--weight); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .wdot { fill: var(--weight); }
.chart .wlabel { fill: var(--text); font-size: 11px; font-weight: 700; }
/* bars grow from the baseline while the container is armed */
[data-anim] .chart rect.bar { transform-box: fill-box; transform-origin: 50% 100%; animation: bar-up var(--dur-bar) var(--ease-out) both; }
[data-anim] .chart rect.bar:nth-of-type(2) { animation-delay: 20ms; }
[data-anim] .chart rect.bar:nth-of-type(3) { animation-delay: 40ms; }
[data-anim] .chart rect.bar:nth-of-type(4) { animation-delay: 60ms; }
[data-anim] .chart rect.bar:nth-of-type(5) { animation-delay: 80ms; }
[data-anim] .chart rect.bar:nth-of-type(6) { animation-delay: 100ms; }
[data-anim] .chart rect.bar:nth-of-type(7) { animation-delay: 120ms; }
[data-anim] .chart rect.bar:nth-of-type(8) { animation-delay: 140ms; }
[data-anim] .chart rect.bar:nth-of-type(9) { animation-delay: 160ms; }
[data-anim] .chart rect.bar:nth-of-type(10) { animation-delay: 180ms; }
[data-anim] .chart rect.bar:nth-of-type(11) { animation-delay: 200ms; }
[data-anim] .chart rect.bar:nth-of-type(12) { animation-delay: 220ms; }
[data-anim] .chart rect.bar:nth-of-type(13) { animation-delay: 240ms; }
[data-anim] .chart rect.bar:nth-of-type(14) { animation-delay: 260ms; }
[data-anim] .chart .pline, [data-anim] .chart .pdot, [data-anim] .chart .wline, [data-anim] .chart .wdot { animation: fade 300ms var(--ease-out) 380ms both; }
@keyframes bar-up { from { transform: scaleY(0); } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-2xs); color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: var(--r-xs); margin-right: 6px; vertical-align: -1px; }

/* per-day numbers under the chart; a row opens that day on Today */
.daylist { margin-top: 12px; border-top: 1px solid var(--line); }
.dayrow {
  display: grid;
  grid-template-columns: 1fr 60px 74px 66px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.dayrow .d { text-align: left; font-weight: 600; color: var(--text); }
.dayrow.none .d { color: var(--muted); font-weight: 500; }
.dayrow .k { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--text); }
.dayrow .k.over { color: var(--over); }
.dayrow .p { color: var(--muted); }
.dayrow .p.hit { color: var(--protein); }
.dayrow .w { color: var(--muted); font-size: var(--fs-2xs); }

/* rejected ops (Settings › Data) */
.failed .frow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }

/* ================= 10. SETTINGS ================= */

.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; }
.kv .k { color: var(--muted); font-size: var(--fs-sm); }
.kv .v { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.field { position: relative; }
.field .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--fs-2xs); color: var(--muted); pointer-events: none; }
.field .unit + .input, .field .input.u { padding-right: 44px; }
/* after the generic unit rule on purpose: same specificity, and the 20px display digits need the wider inset */
.targets .field .input { text-align: right; font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; padding-right: 52px; }

/* ================= 11. SHEETS ================= */

#sheetRoot { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#sheetRoot.open { pointer-events: auto; }
#sheetGhost { position: absolute; inset: 0; z-index: 19; pointer-events: none; }
.backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  animation: fade var(--dur-base) var(--ease-out);
}
.sheet {
  position: absolute;
  left: 0; right: 0;
  /* the whole sheet lifts by the keyboard height (visualViewport → --kb); the actions row is sticky
     inside it, so Add/Save never sits below the fold on an SE / 13 mini with the keyboard up */
  bottom: var(--kb);
  max-height: calc(100% - var(--sat) - 20px - var(--kb));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--surface);
  border-top: 1px solid var(--line-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px calc(16px + var(--sar)) calc(var(--sab) + 18px) calc(16px + var(--sal));
  box-shadow: var(--shadow-sheet);
  animation: sheet-in 260ms cubic-bezier(.32, .72, 0, 1);
}
.backdrop.out { animation: fade-out 200ms var(--ease-in) forwards; }
.sheet.out { animation: sheet-out 220ms var(--ease-in) forwards; }
.sheet.out-fade, .backdrop.out-fade { animation: fade-out 160ms var(--ease-in) forwards; }
/* a sheet travels from off-screen, it does not fade up from 32px above its resting spot */
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.sheet .grip { width: 36px; height: 5px; border-radius: var(--r-pill); background: var(--line-2); margin: 0 auto 12px; }
.sheet .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet .head h2 { margin: 0; font-family: var(--font-display); font-size: var(--fs-title); font-weight: 700; line-height: 1.2; }
.sheet .head .brand { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.sheet .head .errtxt { color: var(--over); font-weight: 600; }
.note {
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: var(--fs-xs);
  color: var(--warn);
  margin-bottom: 12px;
}
/* 44px hit area, 36px visible circle: the 4px transparent border is part of the button */
.sheet .close { width: 44px; height: 44px; border: 4px solid transparent; background-clip: padding-box; border-radius: 50%; background-color: var(--surface-2); color: var(--text-2); display: flex; align-items: center; justify-content: center; flex: none; margin: -4px -4px 0 0; }
.sheet .close svg { width: 16px; height: 16px; }
.per100 {
  display: flex;
  gap: 14px;
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.per100 b { color: var(--text-2); }
.grams-wrap { position: relative; margin-bottom: 10px; }
.grams {
  width: 100%;
  min-height: 84px;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: var(--fs-num-xl);
  font-weight: 800;
  letter-spacing: -.02em;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  padding: 0 60px 0 40px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.grams:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grams-wrap .unit { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); font-size: 18px; font-weight: 700; color: var(--muted); pointer-events: none; }
.preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.preview div { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 6px; text-align: center; }
.preview .v { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; }
.preview .l { margin-top: 2px; }
.preview .kc .v { color: var(--kcal); }
.preview .pr .v { color: var(--protein); }
.preview .fa .v { color: var(--fat); }
.preview .ca .v { color: var(--carbs); }
.sheet .actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding: 10px 0 2px;
  z-index: 1;
}
.sheet .actions::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -14px;
  height: 14px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
}
.sheet .actions .btn { flex: 1; flex-direction: column; gap: 2px; line-height: 1.1; min-height: 52px; white-space: normal; }
.sheet .actions .btn.danger, .sheet .actions .btn.next { flex: 0 0 auto; }
.sheet .actions .btn.next { min-height: 48px; background: var(--surface-2); }
/* dvh: iOS vh is the LARGE viewport and never shrinks for the keyboard; size the list against what is visible */
.sheet .picklist { max-height: min(50dvh, calc(100dvh - var(--sat) - var(--kb) - 240px)); overflow-y: auto; -webkit-overflow-scrolling: touch; margin-top: 10px; }

.export pre {
  max-height: 40svh;
  overflow: auto;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 10px;
  font-size: 11px;
  color: var(--text-2);
  white-space: pre;
}

/* ================= 12. TOAST ================= */

#toast {
  position: absolute;
  left: 12px; right: 12px;
  top: calc(var(--sat) + 10px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 8px 0 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-toast), var(--lift);
  font-weight: 500;
  font-size: var(--fs-sm);
  animation: toast-in var(--dur-sheet) var(--ease-spring);
}
#toast > span { flex: 1; min-width: 0; }
#toast button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  color: var(--accent-text);
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--accent-soft);
}
#toast.out { animation: toast-out 160ms var(--ease-in) forwards; }
#toast.above { z-index: 31; }        /* app.js still toggles this; at the top it only needs to stay above sheets */
#toast .ok { width: 22px; height: 22px; flex: none; color: var(--good); animation: pop 300ms var(--ease-spring); }
#toast .ok circle { fill: none; stroke: currentColor; stroke-width: 2; opacity: .35; }
#toast .ok path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: draw 320ms var(--ease-out) 120ms forwards;
}
@keyframes toast-in { from { transform: translateY(-16px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-10px); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ================= 13. KEY SCREEN ================= */

#keyScreen {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  padding: calc(var(--sat) + 48px) 24px calc(var(--sab) + 24px);
  overflow-y: auto;
  animation: fade var(--dur-base) var(--ease-out);
}
#keyScreen .logo { width: 64px; height: 64px; border-radius: var(--r-lg); margin-bottom: 20px; }
#keyScreen h1 { font-family: var(--font-display); font-weight: 800; font-size: 30px; margin: 0 0 6px; letter-spacing: .06em; }
#keyScreen p { color: var(--muted); margin: 0 0 18px; }
#keyScreen .err { color: var(--warn); font-weight: 600; min-height: 22px; margin: 8px 0; }

/* ================= 14. ROW STAGGER ================= */

[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat) { animation: row-in var(--dur-base) var(--ease-out) both; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(2) { animation-delay: 30ms; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(3) { animation-delay: 60ms; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(4) { animation-delay: 90ms; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(5) { animation-delay: 120ms; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(6) { animation-delay: 150ms; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(7) { animation-delay: 180ms; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(8) { animation-delay: 210ms; }
[data-anim="rows"] :is(.entry, .food, .dayrow, .card, .meal, .stat):nth-child(n+9) { animation: none; }
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } }

/* ================= 15. REDUCED MOTION / WIDE ================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-delay: 0ms !important;
  }
  #tabbar::before, .seg::before { transition: none !important; }
  #toast .ok path { stroke-dashoffset: 0; }
  #progress::before { animation: none; transform: none; width: 100%; opacity: .6; }
  .skeleton::after, #netpill i, .scan-msg::before { animation: none !important; }
}

@media (min-width: 600px) {
  /* Desktop / iPad: keep the phone column so nothing stretches silly wide */
  #app { max-width: 560px; margin: 0 auto; left: 0; right: 0; }
}


/* ================= 12. APARTMENT SHELVES (06-09) ================= */
.sections { display: flex; flex-direction: column; gap: 10px; }
.sec {
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card), var(--lift);
}
.sec-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 58px; padding: 0 14px 0 16px;
  text-align: left;
  transition: background-color var(--dur-fast);
}
.sec-head:active { background: var(--surface-2); }
.sec-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); flex: none; }
.sec-head .name { flex: 1; min-width: 0; font-weight: 700; font-size: var(--fs-row); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-head .cnt { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--muted); background: var(--surface-2); border-radius: var(--r-pill); padding: 2px 9px; }
.sec-head .chev {
  width: 20px; height: 20px; flex: none;
  background: var(--chevron-icon) center / 20px no-repeat;
  transition: transform var(--dur-base) var(--ease-out);
}
.sec.open .sec-head .chev { transform: rotate(180deg); }
/* grid-rows 0fr → 1fr: the body height animates without measuring */
.sec-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur-base) var(--ease-out); }
.sec.open .sec-body { grid-template-rows: 1fr; }
.sec-inner { min-height: 0; overflow: hidden; border-top: 0 solid var(--line); }
.sec.open .sec-inner { border-top-width: 1px; }
.sec-inner .food:first-child { border-top: 0; }
.sec-inner .food { padding-left: 8px; }
@media (prefers-reduced-motion: reduce) { .sec-body, .sec-head .chev { transition: none; } }
.picklist .sections { padding-bottom: 8px; }
#foodForm select.input { min-height: 48px; }

/* ================= 13. HEALTH TILES (06-09) ================= */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: var(--s4); }
.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--card-line);
  border-radius: var(--r-lg);
  padding: 12px 14px 12px;
  box-shadow: var(--shadow-card), var(--lift);
  min-height: 96px;
  overflow: hidden;
}
.tile.wide { grid-column: 1 / -1; }
.tile .t-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tile .t-head .src { font-size: var(--fs-2xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .big { display: flex; align-items: baseline; gap: 5px; margin-top: 6px; line-height: 1.05; flex-wrap: wrap; }
.tile .big b { font-family: var(--font-display); font-size: var(--fs-num-lg); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.tile.wide .big b { font-size: var(--fs-num-xl); }
.tile .big span { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.tile .sub { margin-top: 5px; font-size: var(--fs-2xs); color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tile .sub b { color: var(--text-2); font-weight: 700; }
.tile .big .delta { margin-left: 4px; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--muted); }
.tile .big .delta.down { color: var(--good); }
.tile .big .delta.up { color: var(--warn); }
.tile .bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.tile .bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--steps); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--dur-bar) var(--ease-out); }
.tile.steps.hit .bar i { background: var(--good); }
.tile.sleep .big b { color: var(--sleep); }
.tile.body .big b { color: var(--fat); }
.tile.weight .big b { color: var(--weight); }
.tile.recovery .big b { color: var(--c); }
/* whoop sleep stages: one strip, four segments */
.stages { display: flex; height: 8px; border-radius: var(--r-pill); overflow: hidden; margin-top: 10px; background: var(--surface-3); gap: 1px; }
.stages i { display: block; height: 100%; flex-grow: 0; flex-shrink: 0; transition: flex-basis var(--dur-bar) var(--ease-out); }
.stages .sws { background: var(--sleep); }
.stages .rem { background: color-mix(in srgb, var(--sleep) 60%, var(--surface)); }
.stages .light { background: color-mix(in srgb, var(--sleep) 30%, var(--surface)); }
.stages .awake { background: var(--surface-3); }
.tile .empty-note { margin-top: 8px; font-size: var(--fs-2xs); color: var(--faint); }
.tile .chart { margin-top: 6px; }
.chart .wavg { fill: none; stroke: var(--text-2); stroke-width: 1.6; stroke-dasharray: 5 4; stroke-linejoin: round; stroke-linecap: round; }
.chart .wpt { fill: var(--weight); stroke: var(--surface); stroke-width: 1.5; }
[data-anim="rows"] .tile { animation: row-in var(--dur-base) var(--ease-out) both; }
[data-anim="rows"] .tile:nth-child(2) { animation-delay: 40ms; }
[data-anim="rows"] .tile:nth-child(3) { animation-delay: 80ms; }
[data-anim="rows"] .tile:nth-child(4) { animation-delay: 120ms; }
[data-anim="rows"] .tile:nth-child(5) { animation-delay: 160ms; }

/* health feed freshness (06-09): steps grey out when the phone has not posted for 3 h */
.tile.stale .big b, .tile.stale .big span { color: var(--muted); }
.tile.stale .bar i { background: var(--faint); }
.sync-line { display: flex; align-items: center; gap: 7px; margin: 8px 4px 0; font-size: var(--fs-2xs); color: var(--faint); }
.sync-line b { color: var(--muted); font-weight: 600; }
.sync-line i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.sync-line i.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.sync-line.stale { color: var(--muted); }

.scan-tap {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  min-height: 52px; padding: 0 22px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  animation: fade 200ms var(--ease-out) both;
}


/* ================= 14. DESIGN PASS 06-09 — Apple-Health headers, glyphs, thumbnails, drill-downs ================= */
/* card header: coloured glyph + coloured title (Apple Health), meta right, chevron when it opens something */
.ch { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; min-height: 24px; }
.ch .ci { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--c); flex: none; }
.ch .ci svg { width: 20px; height: 20px; }
.ch .ct { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--c); letter-spacing: .01em; }
.ch .cm { margin-left: auto; font-size: var(--fs-2xs); color: var(--muted); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch .cm .amt { font-size: var(--fs-num-md); }
.ch .chev { width: 18px; height: 18px; flex: none; background: var(--chevron-icon) center / 18px no-repeat; transform: rotate(-90deg); opacity: .8; }
.ch .cm + .chev { margin-left: 2px; }
.ch:not(:has(.cm)) .chev { margin-left: auto; }
.card .ch { margin-bottom: 12px; }
.tile .ch { margin-bottom: 4px; }
.tile .ch .ct { font-size: 14px; }
.tile .ch .ci { width: 20px; height: 20px; } .tile .ch .ci svg { width: 18px; height: 18px; }
.tile[data-action] { cursor: pointer; transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out); }
.tile[data-action]:active { transform: scale(.98); opacity: .9; }
.tile .big { margin-top: 8px; }

/* macro rows: small glyph before the label */
.macro .name { display: flex; align-items: center; gap: 6px; }
.macro .name .mi { width: 16px; height: 16px; color: var(--c); display: inline-flex; }
.macro .name .mi svg { width: 16px; height: 16px; }

/* meal headers: glyph + name + the meal's start time */
.meal-head { align-items: center; gap: 8px; }
.meal-head .mg { width: 22px; height: 22px; color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.meal-head .mg svg { width: 20px; height: 20px; }
.meal-head .from { font-size: var(--fs-2xs); color: var(--faint); margin-right: auto; }
.meal-head .tot { margin-left: auto; }

/* thumbnails: product photo when Open Food Facts has one, else the shelf glyph on a tinted tile */
.thumb {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c) 16%, var(--surface-2)); color: var(--c);
  overflow: hidden; position: relative;
}
.thumb svg { width: 22px; height: 22px; }
.thumb.img { background: #fff; }
.thumb.img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb.img svg { opacity: 0; }
.entry .er .thumb { width: 40px; height: 40px; border-radius: 11px; }
.entry .er .time { min-width: 0; }
.food .thumb { margin-left: 8px; }
.food .star { width: 36px; }
.sec-inner .food { padding-left: 4px; }

/* shelf headers: the dot becomes a glyph */
.sec-head .dot { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 16%, var(--surface-2)); color: var(--c); }
.sec-head .dot svg { width: 18px; height: 18px; }

/* seven little bars (steps) + recovery dots */
.minibars { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 44px; margin-top: 8px; padding-bottom: 12px; }
.minibars .mb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.minibars .mb i { display: block; width: 100%; max-width: 22px; height: var(--h); border-radius: 4px 4px 2px 2px; background: color-mix(in srgb, var(--c) 45%, var(--surface-3)); transform-origin: bottom; }
.minibars .mb.last i { background: var(--c); }
.minibars .mb.none i { background: var(--surface-3); height: 4px; }
.minibars .mb em { position: absolute; bottom: -12px; font-style: normal; font-size: 9px; color: var(--faint); font-weight: 600; }
.minibars .mb.last em { color: var(--muted); }
.minibars .tgt { position: absolute; left: 0; right: 0; bottom: calc(12px + var(--p)); border-top: 1px dashed var(--line-2); pointer-events: none; }
[data-anim] .minibars .mb i { animation: bar-up var(--dur-bar) var(--ease-out) both; }
.sheet-chart .minibars { height: 120px; gap: 6px; }
.sheet-chart .minibars .mb em { font-size: 10px; }
.dots { display: flex; align-items: flex-end; gap: 5px; height: 26px; margin-top: 8px; }
.dots i { flex: 1; max-width: 26px; height: var(--h); min-height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--c) 55%, var(--surface-3)); }
.dots i.last { background: var(--c); }
.sheet-chart .dots { height: 90px; }

/* drill-down sheets */
.sheet.tall { max-height: calc(100dvh - 40px); }
.sheet-chart { margin: 4px 0 8px; }
.sheet .list { border-top: 1px solid var(--line); margin-top: 6px; max-height: 40vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet .li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "d v" "s a"; align-items: baseline; column-gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.sheet .li .d { grid-area: d; font-weight: 600; font-size: var(--fs-row); }
.sheet .li .s { grid-area: s; font-size: var(--fs-2xs); color: var(--faint); }
.sheet .li .v { grid-area: v; text-align: right; font-size: var(--fs-sm); color: var(--muted); }
.sheet .li .v b { font-family: var(--font-display); font-size: 17px; color: var(--text); }
.sheet .li .a { grid-area: a; text-align: right; font-size: var(--fs-2xs); color: var(--muted); }
[data-anim="rows"] .sheet .li { animation: row-in var(--dur-base) var(--ease-out) both; }
.stagegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 10px; }
.stagegrid .sg { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-md); }
.stagegrid .sg i { width: 18px; height: 5px; border-radius: 3px; }
.stagegrid .sg span { font-size: var(--fs-2xs); color: var(--muted); }
.stagegrid .sg b { font-family: var(--font-display); font-size: 15px; }
.stagegrid .sg .sws { background: var(--sleep); } .stagegrid .sg .rem { background: color-mix(in srgb, var(--sleep) 60%, var(--surface)); }
.stagegrid .sg .light { background: color-mix(in srgb, var(--sleep) 30%, var(--surface)); } .stagegrid .sg .awake { background: var(--surface-3); }
/* the night strip: asleep bands over the hours in bed */
.timeline { margin: 6px 0 10px; }
.tl-head { display: flex; justify-content: space-between; font-size: var(--fs-2xs); color: var(--muted); margin-bottom: 6px; }
.tl { position: relative; height: 34px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.tl i { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--sleep) 55%, var(--surface)); }
.tl i.asleep, .tl i.rem { background: color-mix(in srgb, var(--sleep) 60%, var(--surface)); }
.tl i.sws { background: var(--sleep); }
.tl i.awake { background: var(--warn); opacity: .85; }
.tl i.inbed { background: transparent; }
.tl-axis { position: relative; height: 14px; margin-top: 4px; }
.tl-axis span { position: absolute; transform: translateX(-50%); font-size: 9px; color: var(--faint); font-weight: 600; }

/* favourite = a small star badge on the thumbnail (the star button was eating the name) */
.food.fav .thumb::after { content: ""; position: absolute; right: -3px; top: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--fat); box-shadow: 0 0 0 2px var(--surface); }
.food .thumb { margin-left: 10px; }
.food .main { padding-left: 2px; }
.food .quick { margin-right: 6px; }


/* ================= 15. 06-09 late — day view, minerals, notes ================= */
.dayview-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 12px; padding: 0 12px 0 10px;
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; font-size: 14px;
}
.dayview-btn svg { width: 18px; height: 18px; color: var(--accent); }
.dayview-btn .chev { margin-left: auto; width: 18px; height: 18px; background: var(--chevron-icon) center / 18px no-repeat; transform: rotate(-90deg); opacity: .7; }
.dayview-btn:active { transform: scale(.985); opacity: .9; }
.macros[data-action] { cursor: pointer; }

.minerals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: var(--s4); }
.mineral { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--r-md); padding: 10px 12px 10px; box-shadow: var(--shadow-card), var(--lift); }
.mineral .mn { font-size: var(--fs-eyebrow); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.mineral .mv { margin-top: 4px; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.mineral .mv b { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.mineral .mv span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.mineral .bar { height: 5px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.mineral .bar i { display: block; height: 100%; width: 100%; background: var(--sec-fresh); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--dur-bar) var(--ease-out); }
.mineral:first-child .bar i { background: var(--water); }
.mineral.warn .bar i { background: var(--warn); } .mineral.over .bar i { background: var(--over); }
.mineral.over .mv b { color: var(--over); } .mineral.hit .mv b { color: var(--good); }

.card.notes .label { margin-top: 2px; }
.chips.small { gap: 6px; }
.chips.small .chip { min-height: 36px; padding: 0 12px; font-size: 13px; }
.card.notes textarea.notes { margin-top: 12px; min-height: 64px; padding: 10px 14px; line-height: 1.35; resize: none; font-size: var(--fs-input); }

.daytot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 10px; }
.daytot .c { background: var(--surface-2); border-radius: var(--r-md); padding: 8px 6px; text-align: center; }
.daytot .c b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.daytot .c span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.daytot .c em { display: block; font-style: normal; font-size: 11px; color: var(--faint); }
.daytot .c.p b { color: var(--protein); } .daytot .c.f b { color: var(--fat); } .daytot .c.cb b { color: var(--carbs); }
.daymin { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-2xs); color: var(--muted); margin-bottom: 8px; }
.daymin i { font-style: normal; margin-right: 4px; }
.daymin b { color: var(--text-2); }
.dayrows { border-top: 1px solid var(--line); max-height: 52vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dr { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.dr .thumb { width: 38px; height: 38px; border-radius: 10px; }
.dr .m { flex: 1; min-width: 0; }
.dr .n { font-weight: 600; font-size: var(--fs-row); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr .s { font-size: var(--fs-2xs); color: var(--muted); }
.dr .k { text-align: right; flex: none; }
.dr .k b { display: block; font-family: var(--font-display); font-size: 16px; }
.dr .k span { font-size: 10px; color: var(--muted); }
[data-anim="rows"] .dr { animation: row-in var(--dur-base) var(--ease-out) both; }


/* ================= 16. 06-09 late — next meal, tick list, sync dots, minerals sheet ================= */
.card.nextmeal { position: relative; overflow: hidden; }
.card.nextmeal::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--protein)); opacity: .9; }
.card.nextmeal.done::before { background: var(--good); }
.nm-name { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; }
.nm-line { font-size: var(--fs-sm); color: var(--text-2); margin-top: 3px; }
.nm-macros { display: flex; gap: 14px; margin-top: 10px; font-size: var(--fs-2xs); color: var(--muted); }
.nm-macros b { font-family: var(--font-display); font-size: 17px; color: var(--text); }
.nm-macros .p b { color: var(--protein); } .nm-macros .f b { color: var(--fat); } .nm-macros .c b { color: var(--carbs); }
.nm-why { margin-top: 8px; font-size: var(--fs-2xs); color: var(--muted); }
.ch .due { font-weight: 700; color: var(--muted); }
.ch .due.now { color: var(--good); }
.ch .due.now::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
[data-anim="rows"] .card.nextmeal { animation: row-in var(--dur-base) var(--ease-out) both; }

/* supplements: a tick list, not chips */
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 4px; text-align: left; font-weight: 600; font-size: 14px; color: var(--text-2); border-radius: var(--r-sm); }
.check i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; position: relative; transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-press) var(--ease-spring); }
.check i::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform 180ms var(--ease-spring); }
.check.on i { background: var(--good); border-color: var(--good); }
.check.on i::after { transform: rotate(45deg) scale(1); }
.check.on span { color: var(--text); }
.check:active i { transform: scale(.9); }
.check.on:active i { transform: scale(1.08); }

/* sync dot in a tile header: green = fresh, amber = stale */
.ch .sd { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-right: 5px; vertical-align: 1px; }
.ch .sd.stale { background: var(--warn); }
.notice { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 10px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text-2); font-size: var(--fs-2xs); text-align: left; }
.notice svg { width: 18px; height: 18px; color: var(--warn); flex: none; }
.notice b { color: var(--text); }

/* minerals: the strip states and the explainer sheet */
.mineral.near .bar i { background: var(--warn); }
.mineral.hit .bar i { background: var(--good); }
.mineral.over .bar i { background: var(--over); }
.mineral .mv span { font-size: 10.5px; }
.msec { padding: 12px 0 6px; border-top: 1px solid var(--line); }
.msec:first-of-type { border-top: 0; }
.msec .bar { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; margin: 2px 0 8px; }
.msec .bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--dur-bar) var(--ease-out); }
.msec.hit .bar i { background: var(--good); } .msec.over .bar i { background: var(--over); } .msec.near .bar i { background: var(--warn); }
.msec p { margin: 0 0 8px; color: var(--text-2); line-height: 1.4; }
.mini-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-list span { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill); background: var(--surface-2); font-size: var(--fs-2xs); color: var(--muted); max-width: 100%; }
.mini-list em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.mini-list b { color: var(--text); }


/* ================= 17. 06-09 8:20pm — coach, add-on, link-it ================= */
.card.coach .tips { display: flex; flex-direction: column; gap: 4px; margin: 0 -6px; }
.tip { display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px; border-radius: var(--r-md); text-align: left; transition: background-color var(--dur-fast), transform var(--dur-press) var(--ease-out); }
.tip:active { background: var(--surface-2); transform: scale(.985); }
.tip .ti { width: 30px; height: 30px; border-radius: 9px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 16%, var(--surface-2)); color: var(--c); }
.tip .ti svg { width: 17px; height: 17px; }
.tip .tt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tip .tt b { font-size: 14px; color: var(--text); }
.tip .tt span { font-size: var(--fs-2xs); color: var(--muted); line-height: 1.35; }
[data-anim="rows"] .tip { animation: row-in var(--dur-base) var(--ease-out) both; }
[data-anim="rows"] .tip:nth-child(2) { animation-delay: 40ms; } [data-anim="rows"] .tip:nth-child(3) { animation-delay: 80ms; } [data-anim="rows"] .tip:nth-child(4) { animation-delay: 120ms; }

.nm-off { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-md); background: color-mix(in srgb, var(--warn) 10%, var(--surface-2)); font-size: var(--fs-2xs); color: var(--text-2); }
.nm-off svg { width: 16px; height: 16px; color: var(--warn); flex: none; }
.nm-addon { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-md); background: color-mix(in srgb, var(--sec-fresh) 10%, var(--surface-2)); border: 1px dashed color-mix(in srgb, var(--sec-fresh) 45%, transparent); text-align: left; font-size: var(--fs-2xs); color: var(--text-2); }
.nm-addon i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--sec-fresh); flex: none; position: relative; }
.nm-addon i::after { content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 8px; border: solid var(--sec-fresh); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.nm-addon b { color: var(--text); }
.nm-addon:active { transform: scale(.985); }

.twin { display: flex; align-items: center; gap: 10px; width: 100%; margin: 6px 0 4px; padding: 8px 10px; border-radius: var(--r-md); background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); text-align: left; font-size: var(--fs-2xs); color: var(--text-2); }
.twin .thumb { width: 36px; height: 36px; border-radius: 10px; }
.twin b { color: var(--text); }
.twin em { font-style: normal; font-weight: 700; color: var(--accent-text); }
.faint { color: var(--faint); }

/* ---------- the droplet-side brain (coach/coach.py) + the Hevy lifts card, 06-09 ---------- */
.card.coach .brain { margin: 2px 0 8px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 9%, var(--card, transparent)); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.card.coach .brain.pushed { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.card.coach .brain .bh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card.coach .brain .bh b { font-size: 14px; }
.card.coach .brain .bh span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.card.coach .brain p { margin: 4px 0 0; font-size: 13px; line-height: 1.35; }
.card.coach .brain ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.card.coach .brain li { font-size: 12px; line-height: 1.35; color: var(--muted); }
.card.coach .brain li b { color: inherit; color: var(--text, inherit); font-weight: 600; }
.card.hevy .lifts { margin: 6px 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.card.hevy .lifts li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; line-height: 1.4; }
.card.hevy .lifts li span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.hevy .lifts li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.card.hevy .pb { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 6px; background: var(--accent); color: #fff; margin-left: 4px; vertical-align: 1px; }

/* reheat sheet — collapsed by default, one row per food */
.card.reheat details > summary { list-style: none; cursor: pointer; }
.card.reheat details > summary::-webkit-details-marker { display: none; }
.card.reheat details > summary .ch { margin-bottom: 0; }
.card.reheat details[open] > summary .ch { margin-bottom: 12px; }
.card.reheat .rh-rule { margin: 0 0 10px; font-size: var(--fs-small, 13px); opacity: .75; line-height: 1.35; }
.card.reheat .rh-list { display: flex; flex-direction: column; gap: 8px; }
.card.reheat .rh { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-top: 1px solid rgba(128,128,128,.18); font-size: var(--fs-small, 13px); line-height: 1.3; }
.card.reheat .rh b { font-weight: 600; }
.card.reheat .rh span { display: flex; gap: 8px; opacity: .85; }
.card.reheat .rh em { font-style: normal; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; opacity: .6; min-width: 48px; }

/* ---------- PROGRESS: the program card + adherence rings (06-09 11:30pm) ---------- */
.card.program .phases { display: flex; gap: 8px; margin: 4px 0 10px; }
.card.program .ph { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--card-2, rgba(255,255,255,.04)); border: 1px solid transparent; }
.card.program .ph.on { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.card.program .ph b { font-size: 11px; color: var(--muted); }
.card.program .ph span { font-size: 13px; font-weight: 700; }
.card.program .ph i { font-style: normal; font-size: 11px; color: var(--muted); }
.card.program .pbar { height: 8px; border-radius: 6px; background: var(--card-2, rgba(255,255,255,.06)); overflow: hidden; margin: 4px 0 8px; }
.card.program .pbar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.card.program .prow { display: flex; justify-content: space-between; font-size: 15px; font-weight: 700; }
.card.program .prow span { display: flex; flex-direction: column; align-items: center; }
.card.program .prow span:first-child { align-items: flex-start; } .card.program .prow span:last-child { align-items: flex-end; }
.card.program .prow .now { color: var(--accent-text); font-size: 18px; }
.card.program .prow i { font-style: normal; font-size: 11px; font-weight: 500; color: var(--muted); }
.card.program .pfacts { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.card.program .pfacts b { color: var(--text, inherit); }
.card.adherence .adgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 6px; margin: 6px 0 4px; }
.card.adherence .ad { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.card.adherence .ad svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.card.adherence .ad .t { fill: none; stroke: var(--card-2, rgba(255,255,255,.08)); stroke-width: 5; }
.card.adherence .ad .f { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1); }
.card.adherence .ad b { font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.card.adherence .ad span { font-size: 10.5px; color: var(--muted); text-align: center; }

.card.program .physique { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.card.program .ph-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.card.program .ph-h span { font-size: 11px; color: var(--muted); }
.card.program .ladder { position: relative; height: 10px; margin: 10px 4px 6px; border-radius: 6px; background: var(--card-2, rgba(255,255,255,.06)); }
.card.program .ladder b { position: absolute; left: 0; top: 0; height: 100%; border-radius: 6px; background: var(--protein); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.card.program .ladder i { position: absolute; top: -3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--card, #111); border: 2px solid var(--muted); z-index: 1; }
.card.program .ladder i.hit { border-color: var(--protein); background: var(--protein); }
.card.program .ladder i.next { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }

/* =========================================================================================
   REDESIGN 07-09 — sections, full-screen pages, compact strips
   ========================================================================================= */
#gearBtn { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
#gearBtn svg { width: 20px; height: 20px; }
#gearBtn:active { background: var(--surface-2); }
.scanbtn { flex: 0 0 44px; height: 44px; border: 0; border-radius: var(--r-md, 12px); background: var(--surface); color: var(--accent-text); display: grid; place-items: center; box-shadow: var(--shadow-card); }
.scanbtn svg { width: 22px; height: 22px; }

/* strips: one-line launchers on Today */
.strip { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: var(--s4); border: 1px solid var(--card-line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-card), var(--lift); color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; }
.strip:active { transform: scale(.985); }
.strip .si { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); flex: 0 0 30px; }
.strip .si svg { width: 17px; height: 17px; }
.strip .st { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.strip .st b { font-size: 14px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .st span { font-size: 12px; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.strip .sm { font-size: 11px; color: var(--muted); white-space: nowrap; }
.strip .chev { width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); flex: 0 0 8px; }

/* full-screen page layer */
#pageRoot { position: absolute; inset: 0; z-index: 18; pointer-events: none; }
#pageRoot.open { pointer-events: auto; }
#pageRoot .page { position: absolute; inset: 0; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--topbar-h) + var(--sat)) 16px calc(var(--tabbar-h) + var(--sab) + 24px); transform: translateX(100%); opacity: 0; }
#pageRoot.open .page { animation: page-in 260ms cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes page-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.page-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; margin: -6px -16px 8px; padding: 6px 12px 8px; background: var(--topbar-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.page-head .back { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface); color: var(--text); display: grid; place-items: center; box-shadow: var(--shadow-card); flex: 0 0 36px; }
.page-head .back svg { width: 20px; height: 20px; }
.page-head .pt { min-width: 0; display: flex; flex-direction: column; }
.page-head h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; line-height: 1.15; color: var(--c); }
.page-head .pt span { font-size: 11.5px; color: var(--muted); }
.phero { padding: 10px 2px 14px; }
.phero .big { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-display); }
.phero .big b { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -.5px; color: var(--c); }
.phero .big span { font-size: 15px; color: var(--muted); }
.phero .sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
.phero .sub b { color: var(--text); }
.phero .sub b.down { color: var(--good); } .phero .sub b.up { color: var(--over); }
.range { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); margin: 2px 0 8px; }
.range button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: var(--r-pill); }
.range button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.pchart { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--r-lg); padding: 10px 8px 6px; box-shadow: var(--shadow-card), var(--lift); margin-bottom: 10px; }
.pchart .chart { width: 100%; height: auto; display: block; }
.chart .wavg { fill: none; stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .7; }
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 10px; }
.statrow .st { background: var(--surface); border-radius: var(--r-md, 12px); padding: 9px 6px; text-align: center; box-shadow: var(--shadow-card); }
.statrow .st b { display: block; font-family: var(--font-display); font-size: 17px; font-weight: 700; line-height: 1.1; }
.statrow .st span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.explain { font-size: 12.5px; line-height: 1.45; color: var(--muted); padding: 10px 12px; border-radius: var(--r-md, 12px); background: var(--surface-2); margin: 0 0 12px; }
.explain b { color: var(--text); }
.ph3 { margin: 14px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.page .list .li { cursor: pointer; }
.page .list .li .s { color: var(--muted); font-size: 11.5px; }
.card.tap { cursor: pointer; }

/* workouts */
.phero.wk .big span { font-size: 16px; }
.weekdots { display: flex; gap: 8px; margin-top: 12px; }
.weekdots i { flex: 1; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-style: normal; font-size: 11px; color: var(--muted); border: 1.5px solid transparent; }
.weekdots i.on { background: color-mix(in srgb, var(--protein) 22%, transparent); color: var(--protein); font-weight: 700; }
.weekdots i.today { border-color: var(--accent); }
.note-card .sub { font-size: 12.5px; line-height: 1.45; color: var(--muted); margin-top: 4px; }
.card.exsess .sets { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 2px; }
.setrow { display: grid; grid-template-columns: 52px 1fr 60px 64px; align-items: center; font-size: 13px; padding: 5px 8px; border-radius: 8px; background: var(--surface-2); }
.setrow.top { background: color-mix(in srgb, var(--protein) 14%, transparent); }
.setrow > span:first-child { color: var(--muted); font-size: 11.5px; }
.setrow .muted { color: var(--muted); font-size: 11.5px; text-align: right; }

/* coach */
.card.brainc .bt { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.15; margin: 4px 0 6px; }
.card.brainc .bb { margin: 0; font-size: 14px; line-height: 1.45; }
.card.brainc .why { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.4; }
.tip.static { cursor: default; }
.tip.static .tt { padding-left: 0; }

/* list rows on pages + inside cards (ported from the sheet rules, 07-09) */
.page .list, .card .list { border-top: 1px solid var(--line); margin-top: 6px; max-height: 40vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page .li, .card .li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "d v" "s a"; align-items: baseline; column-gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.page .li, .card .li .d { grid-area: d; font-weight: 600; font-size: var(--fs-row); }
.page .li, .card .li .s { grid-area: s; font-size: var(--fs-2xs); color: var(--faint); }
.page .li, .card .li .v { grid-area: v; text-align: right; font-size: var(--fs-sm); color: var(--muted); }
.page .li, .card .li .v b { font-family: var(--font-display); font-size: 17px; color: var(--text); }
.page .li, .card .li .a { grid-area: a; text-align: right; font-size: var(--fs-2xs); color: var(--muted); }
.page .list, .card .list { max-height: none; border-top: 0; }
.page .li, .card .li { padding: 9px 2px; border-bottom: 1px solid var(--line); }
.page .li:last-child, .card .li:last-child { border-bottom: 0; }
.tile.heart .big span { font-size: 11px; color: var(--muted); margin-left: 4px; }
.explain.warn { background: color-mix(in srgb, var(--over) 12%, transparent); color: var(--text); }

/* =========================================================================================
   VANTAGE DESIGN SYSTEM — 07-09 00:20. The pass that gets the app out of the "artifact" look.
   Dark-first, ONE brand blue on a deep navy ground with real depth, glass surfaces, editorial
   numbers, a floating dock, motion on entry. Overrides the graphite tokens above.
   ========================================================================================= */
:root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #070B17; --surface: rgba(20, 28, 52, .62); --surface-2: rgba(36, 48, 84, .55); --surface-3: rgba(60, 78, 128, .5);
  --line: rgba(140, 170, 255, .10); --line-2: rgba(140, 170, 255, .18); --card-line: rgba(140, 170, 255, .12);
  --text: #F1F4FF; --text-2: #C7D0EA; --muted: #8B97BC; --faint: #5E6A8C;
  --accent: #4F8DFF; --accent-2: #8AB8FF; --accent-text: #8AB8FF; --accent-ink: #061024; --accent-soft: rgba(79, 141, 255, .18);
  --good: #3EE39A; --warn: #FFB547; --over: #FF5D6C;
  --fat: #FFC44D; --carbs: #C99BFF; --water: #46C6FF; --weight: #C99BFF; --sleep: #B49BFF; --steps: #4F8DFF;
  --topbar-bg: rgba(7, 11, 23, .72); --tabbar-bg: rgba(14, 20, 40, .72);
  --shadow-card: 0 1px 0 rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
  --lift: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow-fab: 0 10px 30px rgba(79, 141, 255, .38), 0 2px 6px rgba(0, 0, 0, .5);
  --shimmer: rgba(255, 255, 255, .05); --scrim: rgba(3, 6, 14, .7);
  --r-lg: 22px; --r-md: 16px;
}
body {
  background: radial-gradient(120% 60% at 50% -10%, rgba(79, 141, 255, .28), transparent 60%),
              radial-gradient(80% 40% at 100% 100%, rgba(79, 141, 255, .08), transparent 60%),
              linear-gradient(180deg, #0B1226 0%, #070B17 45%, #04060F 100%);
}
#app { background: transparent; }
.screen { background: transparent; }

/* wordmark */
#topbar .brand { font-family: var(--font-display); font-weight: 800; letter-spacing: .22em; font-size: 15px; color: var(--text); background: none; padding-left: 0; }
#topbar .brand::before { content: ""; display: inline-block; width: 18px; height: 18px; margin-right: 10px; vertical-align: -3px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234F8DFF' stroke-width='4.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 6l7 12 7-12'/%3E%3C/svg%3E") center / contain no-repeat; }
#topbar { border-bottom: 0; }

/* glass surfaces instead of grey boxes */
.card, .tile, .strip, .pchart, .statrow .st, .meal-body, .scanbtn { background: var(--surface); border: 1px solid var(--card-line); box-shadow: var(--shadow-card), var(--lift); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.card { padding: 18px 18px 16px; margin-bottom: 14px; }
.tile { padding: 14px 16px; min-height: 104px; }
.tiles { gap: 12px; }
.ch .ct { color: var(--text); font-size: 15px; letter-spacing: .02em; }
.ch .ci { width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--c) 16%, transparent); }
.ch .ci svg { width: 15px; height: 15px; }
.tile .ch .ci { width: 22px; height: 22px; } .tile .ch .ci svg { width: 13px; height: 13px; }
.tile .big b, .stat .v, .water .amt, .macro .val b { font-family: var(--font-display); letter-spacing: -.02em; }
.tile .big b { font-size: 30px; }
.tile .sub { color: var(--muted); }

/* editorial numbers */
.ring .big { font-size: 64px; letter-spacing: -.03em; }
.phero .big b { font-size: 60px; letter-spacing: -.03em; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 100%, #fff 35%) 0%, var(--c) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.phero { padding: 14px 2px 18px; }
.ph3, .statrow .st span, .tile .ch .ct, .strip .sm { text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.tile .ch .ct { color: var(--text-2); font-size: 11.5px; }
.explain { background: rgba(140, 170, 255, .06); border: 1px solid var(--line); }
.range { background: rgba(140, 170, 255, .08); }
.range button.on { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(79, 141, 255, .35); }

/* the ring glows */
.ring .fill { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 55%, transparent)); }
.ring .track { stroke: rgba(140, 170, 255, .12); }
.macro .bar, .water .bar, .card.program .pbar, .card.program .ladder { background: rgba(140, 170, 255, .10); }

/* floating dock */
#tabbar { left: 12px; right: 12px; bottom: calc(var(--sab) + 10px); height: 64px; padding: 6px; border: 1px solid var(--line-2); border-radius: 24px; background: var(--tabbar-bg); box-shadow: 0 18px 50px rgba(0, 0, 0, .55), var(--lift); }
#tabbar::before { top: 6px; height: 52px; width: 20cqw; left: 0; border-radius: 18px; background: var(--accent-soft); transform: translateX(calc(var(--ti) * 20cqw)); }
@supports not (selector(:has(a))) { #tabbar button.on::before { top: 0; height: 52px; width: 100%; border-radius: 18px; } }
#tabbar button { gap: 3px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
#tabbar button svg { width: 22px; height: 22px; }
#tabbar button.on { color: var(--accent-2); }
.screen { padding-bottom: calc(var(--tabbar-h) + var(--sab) + 40px); }
#pageRoot .page { padding-bottom: calc(var(--tabbar-h) + var(--sab) + 40px); }
#fab { bottom: calc(var(--tabbar-h) + var(--sab) + 26px); }

/* strips */
.strip { padding: 13px 16px; }
.strip .si { border-radius: 10px; }

/* entry motion: cards rise in with a stagger */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#todayRest > *, #workoutsBody > *, #coachBody > *, #trendsBody > *, .page-body > * { animation: rise 420ms var(--ease-out) both; }
#todayRest > *:nth-child(2), .page-body > *:nth-child(2) { animation-delay: 40ms; }
#todayRest > *:nth-child(3), .page-body > *:nth-child(3) { animation-delay: 80ms; }
#todayRest > *:nth-child(4), .page-body > *:nth-child(4) { animation-delay: 120ms; }
#todayRest > *:nth-child(5), .page-body > *:nth-child(5) { animation-delay: 160ms; }
#todayRest > *:nth-child(n+6), .page-body > *:nth-child(n+6) { animation-delay: 200ms; }
@media (prefers-reduced-motion: reduce) { #todayRest > *, #workoutsBody > *, #coachBody > *, #trendsBody > *, .page-body > * { animation: none; } }

/* adherence rings + workouts week dots get the glass too */
.card.adherence .ad .t { stroke: rgba(140, 170, 255, .12); }
.weekdots i { background: rgba(140, 170, 255, .08); }
.setrow { background: rgba(140, 170, 255, .07); }
/* nits from the first look at the design pass (07-09 00:25) */
.lifts { margin: 6px 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.lifts li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; line-height: 1.4; }
.lifts li span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lifts li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pb { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); margin-left: 4px; vertical-align: 1px; }
.wk-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin: -4px 0 4px; }
.ch .ct { white-space: nowrap; }
.ch .cm { max-width: 55%; }
#pageRoot .page { padding-top: calc(var(--sat) + 6px); z-index: 19; }
.page-head { margin-top: 0; padding-top: 8px; }
.statrow .st span { font-size: 9.5px; letter-spacing: .06em; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.statrow .st { padding: 10px 4px; }
.card.brainc .bt { font-size: 24px; }
/* page/card list rows: force the grid so the date sits left and the number right (07-09 00:30) */
.page .list, .card .list { display: block; }
.page .li, .card .li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "d v" "s a"; align-items: baseline; column-gap: 12px; text-align: left; }
.page .li .d, .card .li .d { grid-area: d; justify-self: start; text-align: left; }
.page .li .s, .card .li .s { grid-area: s; justify-self: start; text-align: left; }
.page .li .v, .card .li .v { grid-area: v; justify-self: end; }
.page .li .a, .card .li .a { grid-area: a; justify-self: end; }

/* =========================================================================================
   07-09 01:50 — HIS VERDICT FIXES (surgical, on top of the 00:25 layer). Red meals · spacing · rise replay · ring.
   ========================================================================================= */
/* 1. the swipe-to-delete underlay bled through the translucent row: opaque row, underlay only while dragging */
.entry .er { background: #121A33; }
.entry .under { opacity: 0; visibility: hidden; transition: opacity 120ms; }
.entry:has(.er.drag) .under { opacity: 1; visibility: visible; }
.meal-body { background: #101830; }
/* 2. one rhythm in the Today stream: 12px between every block, nothing carries its own top margin */
#todayRest > * { margin-top: 0 !important; margin-bottom: 12px !important; }
#todayRest > *:last-child { margin-bottom: 0 !important; }
.minerals, .tiles, .card.water { margin-top: 0 !important; }
.meal { margin-bottom: 12px !important; }
.screen { padding-bottom: calc(64px + 10px + var(--sab) + 24px) !important; }
#pageRoot .page { padding-bottom: calc(64px + 10px + var(--sab) + 24px) !important; }
.screen { padding-top: 8px; }
/* 3. the entrance animation replayed on every rebuild (each water tap): only pages and tabs animate, not the Today stream */
#todayRest > * { animation: none !important; }
/* 4. the ring: over the number is amber, never a full red ring; the glow follows the stroke */
.ring.over .fill { stroke: var(--warn); }
.ring.over .big { color: var(--warn); }
.ring .fill { filter: drop-shadow(0 0 10px currentColor); }
.ring.over .fill { color: var(--warn); }
/* 5. the three planned gym days read as a plan, not a shortfall */
.weekdots i.plan { border-color: var(--accent); color: var(--accent-2); }
/* native folds for Best lifts / Sessions (07-09) */
details.fold-d { margin-top: 6px; }
details.fold-d > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 0 4px; font-size: 13px; font-weight: 700; color: var(--accent-2); -webkit-tap-highlight-color: transparent; }
details.fold-d > summary::-webkit-details-marker { display: none; }
details.fold-d > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); margin-left: auto; transition: transform 160ms; }
details.fold-d[open] > summary::after { transform: rotate(-135deg); }
details.fold-d.top > summary { padding: 0; }
details.fold-d.top > summary .ch { margin: 0; flex: 1; }
/* the Dexys logger on the supplements card (07-09) */
.dexrow { margin: 12px 0 10px; padding: 12px 14px; border-radius: 14px; background: rgba(140, 170, 255, .07); border: 1px solid var(--line); }
.dexrow .dexhead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.dexrow .dexhead b { font-size: 15px; }
.dexrow .dexhead span { font-size: 12px; color: var(--muted); }
.dexrow .row { gap: 8px; }
.dexrow .row .btn { flex: 1; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 10px; border-radius: 999px; background: rgba(79, 141, 255, .16); color: var(--accent-2); font-size: 12px; font-weight: 700; }
.dchip button { border: 0; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }

/* ---------- the daily photo diary (0.7, 07-09) ---------------------------------------------------- */
/* His chain: wake -> scale -> three photos. The card sits directly under the health tiles for that reason. */
.card.photos .photo-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-slot {
  position: relative; display: flex; flex-direction: column; gap: 6px; align-items: center;
  padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.photo-slot .pimg {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-2, rgba(255, 255, 255, .05));
  border: 1px dashed rgba(255, 255, 255, .18);
  transition: transform .16s ease, border-color .16s ease;
}
.photo-slot.has .pimg { border-style: solid; border-color: rgba(255, 255, 255, .1); }
.photo-slot .pimg svg { width: 26px; height: 26px; opacity: .5; }
.photo-slot .pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot .plab { font-size: 12px; opacity: .72; letter-spacing: .01em; }
.photo-slot:active .pimg { transform: scale(.965); }
.card.photos .photo-note { margin-top: 10px; font-size: 12px; opacity: .55; }

/* the capture sheet: live preview with YESTERDAY'S frame ghosted over it. The ghost is the feature —
   without it the framing drifts day to day and the week comparison stops meaning anything. */
.shoot {
  position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden;
  background: #000; margin-top: 4px;
}
.shoot video { width: 100%; height: 100%; object-fit: cover; display: block; }
.shoot video.mirror { transform: scaleX(-1); }   /* preview mirrored like a mirror; the SAVE un-mirrors it */
.shoot #shootGhost {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; pointer-events: none; transition: opacity .2s ease; mix-blend-mode: screen;
}
.shoot #shootGhost.on { opacity: .32; }
.shoot-msg {
  position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 8px 10px; border-radius: 10px;
  background: rgba(0, 0, 0, .62); font-size: 12.5px; line-height: 1.35; text-align: center;
}
.shoot-msg.bad { background: rgba(190, 45, 45, .8); }
.btn.danger { color: #ff8a8a; }
