/* Nutrition Tracker — single stylesheet, light + dark via prefers-color-scheme. */

:root {
  color-scheme: light dark;
  --bg: #f1f1ed;
  --surface: #ffffff;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #d55181;      /* magenta — default accent; a phase re-points it */
  --on-accent: #ffffff;   /* text on accent surfaces */
  --brand: #d55181;       /* the app's own identity — phases NEVER change it */
  --on-brand: #ffffff;
  /* each macro's own colour where one is told apart from the others —
     protein green, carbs yellow, fat orange (the owner, v0.6.84; until
     then orange / green / amber). Green and amber are ALSO meanings of
     their own (on track, a caution) and those read --green / --amber,
     so moving a macro's colour never repaints them. */
  --protein: #1baf7a;
  --carbs: #c98500;
  --fat: #d95926;
  --green: #1baf7a;
  --amber: #c98500;
  --water: #2b8fd6;    /* hydration (v0.6.124): its own blue, never the accent */
  /* sleep is the phase color too — one primary, no near-miss shades */
  --sleep: var(--accent);
  --response: var(--accent); /* meal-response curve follows the accent */
  --over: #d03b3b;
  --radius: 16px;      /* iOS-style rounding, applies to all cards */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 20px rgba(0, 0, 0, 0.07);
  /* ---- glass ----
     The two cues that actually read as "glass": a LIT top edge and a
     SHADED underside. Both are inset shadows, so they cost nothing —
     no extra compositing layer, no repaint on scroll. See the .tabbar
     rule for why we stop here and don't chase refraction. */
  --glass-lit: rgba(255, 255, 255, 0.60);
  --glass-shade: rgba(11, 11, 11, 0.09);
  --glass-tint: 58%;   /* how much surface survives; the rest is backdrop */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --surface: #1d1d1c;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #e87ba4;
    --on-accent: #22141b;
    --brand: #e87ba4;
    --on-brand: #22141b;
    --protein: #199e70;
    --carbs: #eda100;
    --fat: #eb6834;
    --green: #199e70;
    --amber: #eda100;
    --water: #5fb0ee;
    --over: #e66767;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 8px 28px rgba(0, 0, 0, 0.28);
    /* dark glass: the lit edge is a whisper, the underside does the work */
    --glass-lit: rgba(255, 255, 255, 0.16);
    --glass-shade: rgba(0, 0, 0, 0.40);
    --glass-tint: 52%;
  }
}

/* ---- phase palette ----------------------------------------------------
   Each phase owns a primary color; app.js stamps the active phase's key on
   <html data-phase-color>, which re-points --accent (and the meal-response
   curve that matches it) so the WHOLE UI wears that phase's color while its
   days are in view. Curated, not a free picker: contrast stays honest in
   both themes, and green (adherence scale) and red (warnings) are
   deliberately absent so meaning is never overloaded. Keys mirror
   tracker.PHASE_COLORS and the JS PHASE_COLORS map — change all three. */
[data-phase-color="violet"] { --accent: #7c5cd8; --on-accent: #ffffff; }
[data-phase-color="blue"]   { --accent: #2f7fd4; --on-accent: #ffffff; }
[data-phase-color="teal"]   { --accent: #0f938d; --on-accent: #ffffff; }
[data-phase-color="amber"]  { --accent: #b3760c; --on-accent: #ffffff; }
[data-phase-color="slate"]  { --accent: #5b7085; --on-accent: #ffffff; }
/* Utility chrome stays on the brand: a dialog is standard software
   furniture, not a dated feature, so only its phase chips carry phase
   colors. Dates and the day's own surfaces wear the phase. */
#export-dialog { --accent: var(--brand); --on-accent: var(--on-brand); }

@media (prefers-color-scheme: dark) {
  [data-phase-color="violet"] { --accent: #a68ef0; --on-accent: #171233; }
  [data-phase-color="blue"]   { --accent: #6fb0ee; --on-accent: #0b1c2e; }
  [data-phase-color="teal"]   { --accent: #35c2bb; --on-accent: #06201f; }
  [data-phase-color="amber"]  { --accent: #e3a316; --on-accent: #241a05; }
  [data-phase-color="slate"]  { --accent: #93a8bd; --on-accent: #121a22; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

/* no top bar — pages own their first row edge to edge; the account
   button lives in the tab bar, so nothing has to dodge it */
.container {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
}

/* floating glass bottom bar: 3 tabs + a detached round action */
.tabbar-wrap {
  /* one size axis for both halves: --tabbar-cur is what they actually
     use, and .compact swaps it. Height/width transitions animate on the
     swap, so the two circles shrink together. */
  --tabbar-h: 56px;
  --tabbar-h-sm: 46px;
  --tabbar-cur: var(--tabbar-h);
  position: fixed;
  left: 50%;
  bottom: calc(11px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  /* the two halves hold the screen's edges; 928px is the container's
     content box (960 max-width less its 16px padding), so the bar lines
     up with the cards above it rather than floating free */
  justify-content: space-between;
  width: calc(100% - 32px);
  max-width: 928px;
  gap: 8px;
  z-index: 60;
}
.tabbar-wrap.compact { --tabbar-cur: var(--tabbar-h-sm); }
/* Glass, approximated — and deliberately stopping short.
   iOS 26's material refracts what is behind it: the compositor samples
   the framebuffer under the view and warps it at the edges. The web
   cannot sample its own backdrop, so that part is simply unavailable and
   faking it costs more than it returns. What DOES carry the look is
   cheap: thinner tint (more backdrop shows through), a lit top edge, a
   shaded underside, and a tighter shadow that sits the pill close to the
   glass rather than floating it in fog.
   Blur went DOWN, not up. Radius is the expensive part of
   backdrop-filter, and the real material is less blurred than classic
   frosted glass anyway — saturation is what sells it. */
.tabbar,
.tabbar-plus {
  background: color-mix(in srgb, var(--surface) var(--glass-tint), transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.9);
  backdrop-filter: blur(14px) saturate(1.9);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--glass-lit),
    inset 0 -1px 0 var(--glass-shade),
    0 2px 8px rgba(0, 0, 0, 0.10),
    0 10px 28px rgba(0, 0, 0, 0.16);
}
.tabbar {
  display: flex;
  align-items: center;
  /* holds its natural size where there is room, but gives way rather
     than shoving the + off a narrow screen */
  flex: 0 1 auto;
  min-width: 0;
  gap: 2px;
  height: var(--tabbar-cur);
  box-sizing: border-box;
  /* equal on all four sides so the first and last lozenge sit the same
     distance from the pill's edge as the top one does — with the 1px
     border that is a constant 5px surround */
  padding: 4px;
  border-radius: 999px;
  /* the tabs squeeze to nothing on collapse — clip them rather than let
     them spill past the pill while they go */
  overflow: hidden;
  transition: height 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              width 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              padding 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  /* four tabs keep the room three had: the bar grows wider rather than
     squeezing the labels together */
  flex: 0 1 auto;
  min-width: 0;
  width: 62px;
  /* 1px less underneath: the label's line-height leaves ~1px of leading
     below the glyphs, so equal padding centres the BOXES and leaves the
     visible ink sitting a pixel high */
  padding: 6px 6px 5px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.01em;
  transition: transform 0.12s ease, background 0.16s ease,
              min-width 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              max-width 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              width 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              padding 0.32s cubic-bezier(0.32, 0.72, 0, 1),
              opacity 0.2s ease;
}
.tabbar a svg { width: 19px; height: 19px; }
.tabbar a:hover { color: var(--text); }
.tabbar a:active { transform: scale(0.94); }
/* the selected tab reads as a lozenge sitting ON the glass, not a tint
   painted into it — same lit-edge trick, one layer up */
.tabbar a.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 17%, transparent);
  box-shadow:
    inset 0 1px 0 var(--glass-lit),
    0 1px 3px rgba(0, 0, 0, 0.07);
}
.tabbar-plus {
  height: var(--tabbar-cur);
  aspect-ratio: 1 / 1;  /* circle stays 1:1 at the bar's exact height */
  width: auto;
  flex: 0 0 auto;
  box-sizing: border-box;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.12s ease,
              height 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.tabbar-plus svg {
  width: 20px;
  height: 20px;
  transition: width 0.32s ease, height 0.32s ease;
}
.compact .tabbar-plus svg { width: 18px; height: 18px; }
.tabbar-plus:active { transform: scale(0.92); }

/* ---- collapsed: four tabs squeeze into the one you are on ----
   The bar contracts to the + button's exact circle. Everything here is
   width/height/opacity on elements that already exist — no clone, no
   re-render, so the active tab genuinely morphs into the button rather
   than being swapped for one. */
.tabbar-wrap.collapsed .tabbar {
  width: var(--tabbar-cur);
  padding: 0;
  gap: 0;   /* the squeezed-out tabs must not keep their gaps either */
  cursor: pointer;
}
.tabbar-wrap.collapsed .tabbar a:not(.active) {
  min-width: 0;
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  pointer-events: none;
}
.tabbar-wrap.collapsed .tabbar a.active {
  min-width: 0;
  flex: 0 0 auto;   /* own the whole circle instead of shrinking inside it */
  /* 100%, not --tabbar-cur: the bar's 1px border makes its content box
     2px narrower than its height, and a --tabbar-cur-wide anchor would
     overflow it and carry the icon a pixel to the right */
  width: 100%;
  height: 100%;
  padding: 0;   /* the asymmetric label padding must not tilt the icon */
  gap: 0;
  justify-content: center;
  /* the glass circle IS the button now — a lozenge inside it would read
     as a ring around a ring */
  background: none;
  box-shadow: none;
}
.tabbar-wrap.collapsed .tabbar a.active svg { width: 19px; height: 19px; }
/* the label folds away vertically: the anchor is a column */
.tabbar a span {
  display: block;
  max-height: 14px;
  overflow: hidden;
  transition: max-height 0.26s ease, opacity 0.18s ease;
}
.tabbar-wrap.collapsed .tabbar a span { max-height: 0; opacity: 0; }

/* on a 320px screen the four tabs and the + cannot both keep their
   natural size — buy the room back from the margins before squeezing
   the labels, and "Analytics" still fits */
@media (max-width: 360px) {
  .tabbar-wrap { width: calc(100% - 20px); gap: 6px; }
  .tabbar a { padding: 6px 3px 5px; }
}

@media (prefers-reduced-motion: reduce) {
  .tabbar, .tabbar a, .tabbar a span, .tabbar-plus, .tabbar-plus svg {
    transition: none;
  }
}

/* ---- headers ---- */
.day-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 26px;
}
.day-header h1 { font-size: 22px; margin: 0; font-weight: 650; }
.day-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* the day title stays for screen readers and for days picked from the
   calendar that lie outside the strip */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* shown only when the viewed day is outside the strip */
.day-nav h1 {
  /* Visible only for a date the strip cannot reach (?date= outside its
     window), where it is the ONLY thing naming the day — so it keeps
     its full width and the strip yields instead. Without the explicit
     flex it lost the negotiation to the strip's enormous scroll width,
     was squeezed to a few pixels, and its nowrap text then spilled off
     the viewport and scrolled the whole page sideways. */
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  margin: 0 2px 0 0;
  color: var(--accent);
}
.date-strip {
  display: flex;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  /* No scroll-behavior here: centring the strip is positioning, not an
     animation, and a CSS-forced smooth scroll turns a plain scrollLeft
     assignment into an animation that never lands if the page is not
     compositing. Smooth is asked for explicitly, per call. */
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
  margin: -2px -2px -6px;
  scrollbar-width: none;
}
.date-strip::-webkit-scrollbar { display: none; }
.date-cell {
  flex: 0 0 auto;
  scroll-snap-align: center;
  width: 40px;
  padding: 6px 0 7px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.date-cell em {
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  opacity: 0.75;
}
.date-cell b {
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.date-cell:hover { background: var(--grid); }
/* days that have not happened yet: reachable, but visibly ahead */
.date-cell.future { opacity: 0.42; }
.date-cell.future.on { opacity: 1; }
/* today gets a mark, the viewed day gets the phase colour */
.date-cell.today b { position: relative; }
.date-cell.today b::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}
.date-cell.on {
  background: var(--accent);
  color: var(--on-accent);
}
.date-cell.on:hover { background: var(--accent); }
.date-cell.on b::after { opacity: 0.8; }
.day-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
/* the running goal phase, named at the top of the screen */
.phase-banner {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 14px;
}
.phase-banner b { font-weight: 650; letter-spacing: 0.01em; }
/* the chip is the way into the plan (v0.6.47), so it is a button — kept
   looking like the label it always was, plus a chevron that says "opens" */
button.phase-banner {
  border: none;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
button.phase-banner:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
button.phase-banner:active { transform: scale(0.97); }
button.phase-banner:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.phase-banner .pb-go { align-self: center; margin-left: -2px; font-size: 16px; line-height: 1; opacity: 0.7; }
/* no plan yet: the same chip, asking */
.phase-banner.none {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent);
}
/* header actions: soft elevated pills, icon in the phase color */
.day-actions { display: flex; gap: 8px; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px 8px 12px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.pill-btn svg { width: 17px; height: 17px; color: var(--accent); }
.pill-btn:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.pill-btn:active { transform: scale(0.96); }
@media (max-width: 420px) {
  .pill-btn { padding: 8px 12px 8px 10px; font-size: 13px; }
}
.phase-banner small {
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* history/analytics keep a simple side-by-side header */
.day-header.row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* ---- buttons & inputs ---- */
.btn {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { background: var(--grid); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 550;
}
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--grid); }
.btn.icon {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
}
.btn.small { padding: 3px 9px; font-size: 13px; border-radius: 6px; text-decoration: none; }

.live-hint {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--grid);
  border-radius: 20px;
  padding: 3px 10px;
}

.head-tools { display: flex; align-items: center; gap: 10px; }

/* day-state toggle chips, one row per group.
   The group label is what keeps fourteen chips readable — without it the
   row is a wall of words with no axis to hang them on. */
.state-chips { display: flex; flex-direction: column; gap: 7px; }
/* a grid, not a wrapping flex row: the label owns a fixed first column
   so chips that wrap stay under the chips, not under the label */
.state-group {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: start;
  gap: 6px;
}
.state-group-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.state-group-label {
  padding-top: 5px;   /* meets the first chip's text, not its top edge */
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.state-chip {
  font: inherit;
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.state-chip:hover { border-style: solid; color: var(--text); }
.state-chip:disabled { opacity: 0.5; cursor: default; }
.state-chip.on {
  border-style: solid;
  font-weight: 550;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
/* Deliberately NO colour per group. The palette above keeps one primary
   and rejects near-miss shades, and four new hues here would be exactly
   that — while saying nothing the group label does not already say.
   The label organises; the accent means "on". */

.state-badge {
  font-size: 10.5px;
  text-transform: capitalize;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
  background: var(--grid);
  color: var(--text-2);
}
.state-badge.sick { color: var(--over); }
.state-badge.refill { color: var(--amber); }
.state-badge.rest { color: var(--sleep); }

/* sleep card */
.sleep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.sleep-times { font-size: 13px; color: var(--text-2); }
.sleep-duration { font-size: 22px; font-weight: 650; margin: 2px 0; }
.sleep-duration small { font-size: 13px; color: var(--muted); font-weight: 450; }
.sleep-bar { flex: 1; max-width: 420px; }
/* the per-session breakdown, shown only when a day has more than one */
.sleep-sessions .log-kcal em {
  font-style: normal;
  font-weight: 450;
  color: var(--muted);
}
.sleep-sessions {
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.sleep-target-label { margin-top: 12px; max-width: 220px; }
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.toggle-btn {
  display: flex;
  align-items: center;
  padding: 5px 9px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
}
.toggle-btn:hover { color: var(--text); }
.toggle-btn.active { background: var(--grid); color: var(--text); }

select, input {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- macro cards ---- */
/* mobile-first top cards: accumulated headline, intake vs output, macros */
.top-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
/* Wide screens pair the cards two by two — balance beside energy, macros
   beside micros (the owner, v0.6.85). Phones keep one column: there the
   question was stack or swipe, and a swiped-to card is one most people
   never find. With no micro data the micros card is hidden and macros
   takes the whole row again. */
@media (min-width: 860px) {
  .top-cards {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "acc io" "macros micros";
  }
  .top-cards:has(#micros-card[hidden]) {
    grid-template-areas: "acc io" "macros macros";
  }
  #acc-card { grid-area: acc; }
  #io-card { grid-area: io; }
  #macros-card { grid-area: macros; }
  #micros-card { grid-area: micros; }
  /* folded, the pair stretch to one height; opened, Micros runs long and
     Macros keeps its own height rather than a tall empty card */
  .top-cards:has(#micros-card .mi-head[aria-expanded="true"]) #macros-card {
    align-self: start;
  }
}
.acc-thin { padding: 10px 16px 12px; }
.acc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.acc-io { font-size: 12.5px; color: var(--muted); }
.io-balance { font-weight: 650; font-size: 14px; }
/* on-track is a brand moment (accent), off-track a warning (red);
   green is reserved for the semantic adherence scale */
.io-balance.good { color: var(--accent); }
.io-balance.bad { color: var(--over); }
.macro-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

/* ---- Today laid out from the welcome steps' answers (v0.6.97) ----
   Only while the served layout differs from the page's own order: the
   cards become one column ordered by the server, the top cards leave
   their grid (display: contents keeps every id and listener where it
   was), and a folded card is a single row that opens it. */
.today-cards.laid-out { display: flex; flex-direction: column; }
.today-cards.laid-out > .top-cards { display: contents; }
.today-cards.laid-out .macro-card { margin-bottom: 12px; }
.today-cards.laid-out .card-folded { display: none !important; }
/* a folded card with nothing in it today has no row either */
.today-cards:has(#micros-card[hidden]) .fold-row[data-unfold="micros"],
.today-cards:has(#body-deck[hidden]) .fold-row[data-unfold="body"] { display: none; }
.fold-caption {
  margin: 8px 2px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.fold-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}
.fold-row .fold-show { color: var(--accent); font-size: 14px; font-weight: 600; }
/* "Guide me": a card's own explanation on it, until "Got it" */
.card-lead {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
}
.card-lead p { margin: 0 0 6px; }
.card-lead-actions { display: flex; gap: 14px; }
.card-lead-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.macro-card .macro-name {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
}
.macro-card .macro-value {
  font-size: 24px;
  font-weight: 650;
  margin: 4px 0 2px;
}
.macro-card .macro-value small { font-size: 14px; color: var(--muted); font-weight: 450; }
.macro-card .macro-remaining { font-size: 13px; color: var(--text-2); }
.macro-card .macro-remaining.over { color: var(--over); font-weight: 550; }
.bar {
  height: 6px;
  border-radius: 4px;
  background: var(--grid);
  margin-top: 10px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.bar > span.over { background: var(--over); }

/* ---- panels & tables ---- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panel h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
/* the plan a card follows, beside its title, in that plan's colour */
.card-plan { font-size: 14px; font-weight: 550; color: var(--accent); margin-left: 2px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.panel-head h2 { margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 200px; }
tbody tr:hover { background: color-mix(in srgb, var(--grid) 45%, transparent); }
tbody tr:last-child td { border-bottom: none; }
td .food-name { font-weight: 550; }
td .food-notes { color: var(--muted); font-size: 12.5px; }
.meal-tag {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--grid);
  color: var(--text-2);
  text-transform: capitalize;
}
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
tfoot td { font-weight: 650; border-top: 2px solid var(--grid); border-bottom: none; }

.empty { color: var(--muted); text-align: center; padding: 18px 0; margin: 0; }

/* ---- dialogs ---- */
dialog {
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 20px;
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
/* The name dialog: one field, and Delete kept away from Save by pushing
   it to the far left — the two are a rename and a destruction, and they
   should never sit shoulder to shoulder under a thumb. */
#name-dialog #name-input {
  width: 100%;
  font: inherit;
  font-size: 16px;             /* 16px: anything smaller zooms iOS on focus */
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
#name-dialog #name-input:focus {
  outline: none;
  border-color: var(--accent);
}
#name-dialog #name-delete { margin-right: auto; }
#name-dialog .dialog-note { margin: -6px 0 14px; }
dialog h3 { margin: 0 0 14px; font-size: 17px; }
.hint { color: var(--muted); font-size: 13px; margin: -8px 0 12px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  min-width: 0;
}
/* The base look lives on `select, input`, which predates any textarea in
   a dialog. Repeated here rather than widened there: the chat and profile
   textareas are deliberately styled differently and would inherit it. */
.form-grid textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  resize: vertical;
  line-height: 1.35;
}
.form-grid textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* sectioned profile/targets dialog */
.dialog-tall {
  max-height: min(85vh, 780px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* sections separate by shade, not outlines (same language as the cards) */
.dialog-block {
  background: color-mix(in srgb, var(--text) 4%, var(--surface));
  border-radius: 12px;
  padding: 14px 16px 16px;
  margin-bottom: 12px;
}
@media (prefers-color-scheme: dark) {
  .dialog-block {
    background: color-mix(in srgb, #ffffff 5%, var(--surface));
  }
}
.dialog-section {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stacked-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.dialog-block .hint { margin: 8px 0 0; }

/* BMR -> TDEE -> suggestion flow */
.calc-flow {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.calc-tile {
  flex: 1 1 90px;
  min-width: 90px;
  border-radius: 12px;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
.calc-tile.accent {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg));
}
.calc-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.calc-value { font-size: 19px; font-weight: 650; margin: 1px 0; }
.calc-tile.accent .calc-value { color: var(--accent); }
.calc-sub { font-size: 11.5px; color: var(--muted); }
.calc-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  min-width: 44px;
}
.calc-arrow span { font-size: 15px; line-height: 1; }
.calc-arrow em {
  font-style: normal;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.macro-chips {
  flex-basis: 100%;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  border: 1px solid var(--grid);
  border-radius: 999px;
  padding: 3px 11px;
  font-variant-numeric: tabular-nums;
}
.chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.tune-head { display: flex; gap: 8px; margin-top: 10px; }
#goal-tune { margin-top: 10px; }

/* accumulated / balance coloring */
.macro-value.acc-good { color: var(--accent); }
.macro-value.acc-bad { color: var(--over); }
.acc-since { font-size: 11px; text-transform: none; letter-spacing: 0; font-weight: 450; }
.acc-macros {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.acc-empty { padding: 6px 0; text-align: left; font-size: 13px; }

/* slim accumulated-balance bars with numbers inside */
.acc-bars { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.acc-bar {
  position: relative;
  height: 21px;
  background: var(--grid);
  border-radius: 11px;
  overflow: hidden;
}
/* a component of the line above it, not a peer — thinner on purpose, so
   the three macros read as the structure and this as a detail of one */
.acc-bar.sub {
  height: 15px;
  border-radius: 8px;
}
.acc-bar.sub span { font-size: 10.5px; }
.acc-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 11px;
}
.acc-bar.sub i { border-radius: 8px; }
.acc-bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* A macro row that movement has extended: the plan, a gap, then the
   earned room. Two tracks sized by flex-grow in proportion to their real
   amounts, so a 20 g earned stretch beside a 130 g plan looks like 20 g.
   The label sits ABOVE both, spanning the row, so the text reads
   continuously across the gap the way the fill does. */
.acc-bar-row {
  position: relative;
  display: flex;
  align-items: stretch;
  /* no gap: plan and earned are joined by a neck instead, and the over
     section sets its own margin */
  gap: 0;
  height: 21px;
}
/* over is not joined: it is not more room, and a neck would claim it
   was. A plain 2px step, matching the plan-earned distance exactly. */
.acc-bar-row .acc-bar.over { margin-left: 2px; }

/* The neck between plan and earned. Half the bar's height — thicker than
   a hairline, thinner than the tracks — so the pair reads as one vessel
   with a waist rather than two bars pushed together. Square-ish ends,
   because a rounded neck would read as a third pill. */
.bar-link {
  /* 6px wide against a -2px margin each side, so it CONTRIBUTES exactly
     2px of layout — the same step as plan-to-over. The neck covers the
     gap rather than widening it: it spans the 2px plus 2px into each
     neighbour, and the distance between the tracks stays 2px. */
  flex: 0 0 6px;
  align-self: center;
  /* square: any radius here reads as a third pill sitting between two
     others, which is exactly what made the first attempt look like a
     block dropped in the gap */
  border-radius: 0;
  margin: 0 -2px;
  position: relative;
  z-index: 1;   /* over BOTH tracks: the neck's job is to hide the two
                   facing outlines it crosses, which it can only do from
                   in front */
  /* Top and bottom only — those two edges continue the outline across
     the gap. No side borders: the neck opens into both tracks.
     10px tall because that is where the pills' rounded caps actually sit
     2px in from their ends (r=10.25 after the inset stroke, dx=9, so
     y=±4.9), which is what makes the strokes meet instead of stepping. */
  height: 10px;
  border-top: 1.5px solid color-mix(in srgb, var(--accent) 48%, transparent);
  border-bottom: 1.5px solid color-mix(in srgb, var(--accent) 48%, transparent);
  /* OPAQUE: layered over the card so the tint reads the same as a track
     while still hiding the outlines beneath it. A translucent neck would
     let the two facing strokes show straight through and the whole
     effect would collapse. */
  background:
    linear-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 0 100%),
    var(--surface);
  transition: background 0.35s ease;
}
/* filled only when the plan track is full: that is the moment intake
   really is running through into the earned room */
.bar-link.on { background: var(--accent); }
.acc-bar-row .acc-bar { height: 100%; }
/* ---- sectioned macro row: plan | earned | over -------------------------
   The energy card's grammar, one row at a time. OUTLINE marks the base
   you have to cover; a flat tint marks room that movement earned; amber
   -> red marks what went past both. Structure carries the colour, so
   only the third section is ever a judgement.

   Order matters here. `.acc-bar i` above sets the fill box; these rules
   set what it is PAINTED with and must come after it, and none of them
   may set a background on `.acc-bar` itself without excluding the fill —
   that source-order trap has bitten this stylesheet twice. */
.acc-bar-row .acc-bar.plan {
  /* the sentence lives in here, so it may not be squeezed below reading
     width however far past the plan the day went */
  min-width: 96px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1.5px
    color-mix(in srgb, var(--accent) 48%, transparent);
}
.acc-bar-row .acc-bar.earned {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  /* outlined like the plan track: with the neck bridging top and bottom,
     the two outlines and the neck's read as ONE continuous stroke around
     the whole vessel rather than two separate pills */
  box-shadow: inset 0 0 0 1.5px
    color-mix(in srgb, var(--accent) 48%, transparent);
  min-width: 26px;
}
.acc-bar-row .acc-bar.over {
  background: color-mix(in srgb, var(--over) 18%, transparent);
  min-width: 42px;   /* enough for "+120" */
}
/* eaten is eaten: solid, in both of the first two sections */
.acc-bar-row .acc-bar.plan i,
.acc-bar-row .acc-bar.earned i { background: var(--accent); }
/* the third one is always full — it only exists because it was passed */
.acc-bar-row .acc-bar.over i {
  background: linear-gradient(90deg,
    hsl(38 82% 52%), var(--over));
}

/* The duplicated sentence, clipped to the filled width and wearing the
   colour meant to sit on the accent. Same box, same padding, same
   layout as the original underneath it — only the colour differs, so
   the two halves line up glyph for glyph. */
.acc-bar-row .bar-on {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  font-size: 11px;
  color: var(--on-accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.acc-bar-row .bar-on b { font-weight: 650; color: var(--on-accent); }
.acc-bar-row .bar-on em {
  font-style: normal; margin-left: auto; color: var(--on-accent);
}

/* Each of the trailing sections names its own amount, so the plan
   track's sentence never has to stretch across a gap to explain them.
   Scoped to .acc-bar, NOT to .earned: the over section carries a label
   too, and while this rule was earned-only that label had no positioning
   and sat behind the absolutely-placed fill, invisible. */
.acc-bar-row .acc-bar u {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}
/* The earned amount is a footnote to the plan beside it, not a peer:
   smaller and lighter than the row's own sentence so it reads as "and a
   bit more" rather than competing for the glance. Placed AFTER the base
   rule above so these win on source order — the trap this stylesheet
   keeps setting for itself. */
.acc-bar-row .acc-bar.earned u {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}
/* centred, so past half-filled it sits on solid colour and has to flip —
   softened, because full-strength on-accent was the strongest text in
   the card and it is the least important number in the row */
.acc-bar-row .acc-bar.earned u.on {
  color: color-mix(in srgb, var(--on-accent) 72%, transparent);
}
/* the over section is always full, so its label is always on the gradient */
.acc-bar-row .acc-bar.over u { color: #fff; }
.acc-bar span b { font-weight: 650; color: var(--text); }
.acc-bar span em { font-style: normal; margin-left: auto; color: var(--text); }

.row-editable { cursor: pointer; }
.row-editable:hover .food-name { text-decoration: underline; text-underline-offset: 2px; }
.suggest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.suggest-row .dialog-section { margin-bottom: 0; }

.goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}
.goal-label { font-weight: 550; }
.seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}
.seg button {
  font: inherit;
  font-size: 13.5px;
  padding: 6px 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
/* Every language but English runs longer (languages plan, Phase 1's
   layout pass; German longest): the plan editor's three-way choices fit a
   phone only with less side padding */
html:not(:lang(en)) .seg button { padding-inline: 10px; }
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 550;
}
.dialog-actions {
  position: sticky;
  bottom: -20px;
  background: var(--surface);
  padding: 12px 0 4px;
  margin-top: 4px;
}

@media (max-width: 560px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ---- analytics ---- */
/* The averages card owns its own window control. The head puts the
   picker on the title's line so the card reads as one thing; it wraps on
   narrow screens rather than squeezing the segments. */
.avg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.avg-head h2 { margin: 0; }
.avg-range button { padding: 6px 13px; }
.avg-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.avg-custom label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.avg-custom input {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
#averages-card .hint { margin: 0 0 12px; }
/* inside the card the grid is the card's content, not a page-level block */
#averages-card .stat-grid { margin-bottom: 0; }
#averages-card .stat-tile { box-shadow: none; background: var(--bg); }
/* Macro ratio: one bar of the three shares under the tiles, each segment
   in its macro's colour, the percentages written out beneath */
#averages-card .macro-ratio { margin-top: 12px; }
.macro-ratio .ratio-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.macro-ratio .ratio-bar {
  display: flex; gap: 2px; height: 12px; margin: 10px 0 8px;
  border-radius: 6px; overflow: hidden;
}
.macro-ratio .ratio-bar span { min-width: 2px; }
.macro-ratio .ratio-run { display: flex; }   /* carbs = sugar + the rest, no gap */
.macro-ratio .protein { background: var(--protein); }
.macro-ratio .carbs { background: var(--carbs); }
.macro-ratio .fat { background: var(--fat); }
/* sugar: the carbs colour, a little lighter (the owner: "a 10% slight
   opacity change") — part of carbs, not a macro of its own */
.macro-ratio .carbs.sugar { opacity: 0.9; }
.macro-ratio .ratio-legend {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  font-size: 13.5px; color: var(--text-2);
}
.macro-ratio .ratio-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.macro-ratio .ratio-legend i { width: 9px; height: 9px; border-radius: 50%; }
.macro-ratio .ratio-legend b { color: var(--text); font-weight: 650; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-tile {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-tile .stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
/* a long compound (Dutch "Lichaamsvet") breaks at a syllable, never past the tile */
.stat-tile .stat-label { -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere; }
.stat-tile .stat-value { font-size: 22px; font-weight: 650; margin-top: 2px; }
.stat-tile .stat-sub { font-size: 12.5px; color: var(--muted); }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar-rect { cursor: pointer; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  padding: 6px 9px;
  border-radius: 7px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
  z-index: 5;
}

.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comparison .comp-col {
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border-radius: 12px;
  padding: 12px 14px;
}
.comparison .comp-col h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--text-2); }
.comparison .comp-col .big { font-size: 20px; font-weight: 650; }
.comparison .comp-col ul { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13.5px; color: var(--text-2); }
.comparison .comp-col li { display: flex; justify-content: space-between; padding: 2px 0; }

/* ---- misc ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .comparison { grid-template-columns: 1fr; }
  .day-nav h1 { min-width: 0; font-size: 18px; }
}

/* ---- assistant chat (the "+" button) ---- */
.assistant-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}
.assistant-panel {
  position: relative;   /* the camera menu anchors to it */
  width: 100%;
  max-width: 560px;
  height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.assistant-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.assistant-title { font-weight: 650; }
.assistant-daychip {
  font-size: 12.5px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 999px;
  padding: 2px 10px;
}
.assistant-head-spacer { flex: 1; }
/* Log | Advisor (v0.6.136): a small segmented control in place of the
   title; the Advisor wears a quiet tint on the header so it is never
   mistaken for the assistant that logs. */
.assistant-mode { flex-shrink: 0; }
.assistant-mode button { padding: 4px 12px; font-size: 13px; white-space: nowrap; }
/* with the toggle in the header the day chip gives way, never the toggle */
.assistant-mode:not([hidden]) ~ .assistant-daychip {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html:not(:lang(en)) .assistant-mode button { padding-inline: 9px; }
.assistant-panel.advisor .assistant-head {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.advisor-ideas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -2px 0 6px;
}
.advisor-idea {
  font: inherit;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.advisor-idea b { color: var(--accent); font-weight: 600; white-space: nowrap; }
.advisor-idea:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.assistant-iconbtn {
  background: none;
  border: none;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.assistant-iconbtn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.assistant-iconbtn svg { width: 18px; height: 18px; }
.assistant-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Saved meals panel — covers the thread rather than sharing space with
   it. Absolute inside the sheet so opening it costs no layout and the
   conversation is exactly where it was on close. */
.saved-panel {
  position: absolute;
  inset: 52px 0 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.saved-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
}
.saved-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 16px;
}
.saved-list .hint { margin: 12px 2px; line-height: 1.5; }
.saved-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}
.saved-item:last-child { border-bottom: none; }
/* The row is the primary action (use it); the pencil is the secondary
   one. Two targets, clearly separated, no long-press to discover. */
.saved-use {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 2px;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.saved-use:active { transform: scale(0.995); }
.saved-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
/* A meal saved from a photo (v0.6.73): its picture, to recognise it by. */
.saved-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--grid);
}
.saved-thumb-empty { display: block; opacity: 0.6; }
.saved-name { font-weight: 600; }
.saved-meta { font-size: 12.5px; color: var(--muted); }
.saved-sub { font-size: 11.5px; color: var(--muted); opacity: 0.8; }
.saved-manage { flex: none; }
/* A saved meal's own page (v0.6.114): opened from the row's chevron in
   place of the list — its foods, each tappable to correct, Rename, Delete
   and Log this meal. */
.saved-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 2px 0 6px -6px;
  padding: 6px 8px 6px 2px;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.saved-back svg { width: 18px; height: 18px; }
.saved-page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 12px;
  border-bottom: 1px solid var(--border);
}
.saved-page-pic {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--grid);
}
.saved-page-name { font-weight: 650; font-size: 17px; overflow-wrap: anywhere; }
.saved-food {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 2px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.saved-food:active { transform: scale(0.995); }
.saved-food-name { font-weight: 550; overflow-wrap: anywhere; }
.saved-food-go { flex: none; width: 16px; height: 16px; color: var(--muted); }
.saved-page .hint { font-size: 12.5px; }
.saved-page-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.saved-page-actions .btn.primary { flex: 1; }
/* A grouped meal's ingredients in its edit dialog (v0.6.116) — the saved
   meal page's rows, so the two read as the same gesture. */
.meal-foods { margin: 4px 0 2px; border-top: 1px solid var(--border); }
.meal-foods .saved-food:last-child { border-bottom: none; }
/* Saved | Recent | Photos (v0.6.89) — Photos hides while the photo
   library is off. */
.saved-tabs button { padding: 6px 14px; }

/* Photos (v0.6.73): a grid of every photo sent to the assistant. Square
   tiles, the day it was last sent on each, newest first. */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
  padding-top: 6px;
}
.photo-tile { position: relative; }
.photo-use {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--grid);
  cursor: pointer;
  position: relative;
}
.photo-use:active { transform: scale(0.98); }
.photo-use img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-date {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  min-width: 26px;
  padding: 0 5px;
  border: none;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.photo-del svg { width: 16px; height: 16px; }
.photo-del-word { display: none; }
/* first tap arms: the × turns into a red Delete, second tap deletes */
.photo-tile.armed .photo-del { background: var(--over); padding: 0 10px; }
.photo-tile.armed .photo-del svg { display: none; }
.photo-tile.armed .photo-del-word { display: inline; }
.photo-tile.armed .photo-use img { opacity: 0.6; }
.photo-foot { font-size: 12.5px; }
/* Save sits with Decline as a quiet third option: it is useful, but it
   is not what the user came to this card to do. */
.proposal-actions .p-save {
  margin-right: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
}

.assistant-msg {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.assistant-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--on-accent);
  border-bottom-right-radius: 6px;
}
.assistant-msg.model {
  align-self: flex-start;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border-bottom-left-radius: 6px;
}
/* The words of a message are text to select — a part of it, by holding
   it on a phone — and a copy icon sits under the bubble (v0.6.77). */
.assistant-msg.user,
.assistant-msg.model {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.assistant-msg-actions {
  display: flex;
  margin-top: -7px;
}
.assistant-msg-actions.user { align-self: flex-end; }
.assistant-msg-actions.model { align-self: flex-start; }
.msg-copy {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.msg-copy:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.msg-copy svg { width: 17px; height: 17px; }
.msg-copy .icon-check,
.msg-copy.done .icon-copy { display: none; }
.msg-copy.done .icon-check { display: block; }
.msg-copy.done { color: var(--accent); }
.assistant-msg.notice {
  align-self: center;
  max-width: 96%;
  background: none;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.assistant-msg.error {
  align-self: flex-start;
  background: color-mix(in srgb, var(--over) 12%, transparent);
  color: var(--over);
  font-size: 13.5px;
}
.assistant-typing {
  align-self: flex-start;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 13px;
}
.assistant-typing::after {
  content: "…";
  animation: assistant-dots 1.2s steps(4, end) infinite;
}
@keyframes assistant-dots {
  0% { content: ""; } 25% { content: "."; }
  50% { content: ".."; } 75% { content: "..."; }
}

/* proposal card */
.proposal {
  align-self: stretch;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  padding: 12px 14px;
  font-size: 13.5px;
}
.proposal h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.proposal-section { margin-bottom: 8px; }
.proposal-section:last-of-type { margin-bottom: 0; }
/* Three columns, three rows, everything on a fixed line.
     [x] name .................... 559 kcal
         08:00 · snack · 15 micros  P 12 · C 71 · F 26
         Assumed two medium slices of sourdough…
   The number column is a FIXED width. Sized to content it grew when the
   portion slider pushed calories past four digits, which narrowed the
   name, rewrapped it and changed the row height — the whole card danced
   on every drag. A fixed column plus one truncating line each means the
   only thing that moves while dragging is the digits. */
.proposal-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 128px;
  column-gap: 9px;
  align-items: start;
  padding: 6px 0;
}
.proposal-row input[type="checkbox"] {
  accent-color: var(--accent);
  margin-top: 3px;
  flex-shrink: 0;
}
.proposal-row > .p-name,
.proposal-row > .p-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proposal-row .p-name { grid-column: 2; grid-row: 1; font-weight: 550; }
.proposal-row .p-meta {
  grid-column: 2;
  grid-row: 2;
  color: var(--muted);
  font-size: 12.5px;
}
.proposal-row .p-assume {
  grid-column: 2 / -1;
  grid-row: 3;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin-top: 1px;
}
/* the micro count leads the footer line, upright so it reads as a fact
   rather than part of the assumption sentence */
.proposal-row .p-assume .p-micros { font-style: normal; }
.proposal-row .p-nums {
  grid-column: 3;
  grid-row: 1 / span 2;
  text-align: right;
  font-variant-numeric: tabular-nums;
  /* tabular digits keep each glyph the same width; the fixed column
     above keeps the COUNT of them from moving anything else */
  overflow: hidden;
}
.proposal-row .p-nums .p-kcal { font-weight: 600; white-space: nowrap; }
.proposal-row .p-nums .p-macros {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.proposal-row.off .p-name,
.proposal-row.off .p-meta,
.proposal-row.off .p-nums,
.proposal-row.off .p-assume { opacity: 0.4; }
.proposal-totals {
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 9px;
  color: var(--text-2);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.proposal-warn { color: var(--amber); font-size: 12.5px; margin-top: 6px; }
.proposal-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.proposal-actions button {
  flex: 1;
  border-radius: 10px;
  padding: 8px 0;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
}
.proposal-actions .p-accept {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.proposal-actions button:disabled { opacity: 0.5; cursor: default; }
.proposal.resolved .proposal-actions { display: none; }
.proposal .proposal-outcome {
  margin-top: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--green);
}
.proposal .proposal-outcome.declined { color: var(--muted); }

/* ---- The composer (v0.6.75, the owner's call — "like ChatGPT") ---------
   ONE floating field of glass: + on the left, the words, then the
   microphone and send inside it. It floats OVER the thread — absolute at
   the panel's foot — and the thread pads for its measured height
   (`--composer-h`, set from a ResizeObserver) so its last line clears it.
   The glass is the tab bar's recipe: thin tint, lit top edge, shaded
   underside, a tight shadow. The saved panel (z 2) still covers it. */
.assistant-msgs { padding-bottom: calc(var(--composer-h, 76px) + 6px); }
.composer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 0 10px calc(10px + env(safe-area-inset-bottom) / 2);
  pointer-events: none;   /* the gaps around the field stay the thread's */
}
.composer > * { pointer-events: auto; }
.composer-field,
.composer-menu {
  background: color-mix(in srgb, var(--surface) var(--glass-tint), transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.9);
  backdrop-filter: blur(14px) saturate(1.9);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--glass-lit),
    inset 0 -1px 0 var(--glass-shade),
    0 2px 8px rgba(0, 0, 0, 0.10),
    0 10px 28px rgba(0, 0, 0, 0.16);
}
.composer-field {
  border-radius: 24px;
  padding: 5px;
  transition: border-color 0.15s;
}
.composer-field:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.composer-row textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 120px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.35;
  padding: 8px 6px;
}
.composer-row textarea::placeholder {
  color: var(--muted);
  /* a hint, not text to read in full: one line, cut with an ellipsis */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.composer-plus,
.composer-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.composer-icon { color: var(--text-2); }
.composer-plus svg { width: 22px; height: 22px; }
.composer-icon svg { width: 20px; height: 20px; }
.composer-plus:hover,
.composer-icon:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.composer-plus.open { background: color-mix(in srgb, var(--text) 11%, transparent); }
.composer-plus:disabled { opacity: 0.4; cursor: default; background: none; }
.composer-icon[hidden],
.composer-plus[hidden] { display: none; }
.composer .assistant-send { width: 36px; height: 36px; flex: 0 0 36px; }
.composer .assistant-send.idle { background: var(--grid); color: var(--muted); }
.composer .assistant-voice-note {
  margin: 0 4px 6px;
  padding: 5px 10px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
/* The pending photos, at the top of the field: a row of tiles, each
   with its own ×, and one line beside them (below, once they fill it). */
.composer-field .assistant-attach {
  margin: 0 0 4px;
  padding: 6px;
  border: none;
  border-radius: 18px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

/* The + menu: glass like the field, rising from the +. Round icon wells
   and full-size labels, the way the owner's reference draws it. */
.composer-menu {
  position: absolute;
  left: 10px;
  bottom: calc(100% + 8px);
  min-width: 232px;
  padding: 8px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform-origin: bottom left;
  animation: composer-menu-in 0.16s ease-out;
}
.composer-menu[hidden] { display: none; }
.composer-menu button {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 16px 6px 6px;
  border: none;
  border-radius: 18px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}
.composer-menu button[hidden] { display: none; }
.composer-menu button:hover,
.composer-menu button:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
.composer-menu-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.composer-menu-icon svg { width: 20px; height: 20px; }
.composer-menu-sep {
  border: none;
  height: 1px;
  margin: 4px 12px;
  background: var(--border);
}
.composer-menu-sep[hidden] { display: none; }
@keyframes composer-menu-in {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .composer-menu { animation: none; }
}
.assistant-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.assistant-send:disabled { opacity: 0.45; cursor: default; }
.assistant-send svg { width: 18px; height: 18px; }
/* While a turn is in flight the button STOPS it (v0.6.74): the arrow
   becomes a square, on the same accent — one button, two jobs, never
   both at once. */
.assistant-send .icon-stop { display: none; }
.assistant-send.stop .icon-send { display: none; }
.assistant-send.stop .icon-stop { display: block; }

@media (min-width: 700px) {
  .assistant-overlay { align-items: center; }
  .assistant-panel { height: min(72vh, 680px); }
}

/* ---- row delete buttons + meal response indexes ---- */
th.del-col, td.del-col { width: 34px; text-align: center; padding-left: 2px; padding-right: 6px; }
.row-del {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.12s ease;
}
.row-del:hover { color: var(--over); border-color: var(--over); }
.row-del.armed {
  background: var(--over);
  border-color: var(--over);
  color: #fff;
  transform: scale(1.08);
}
.row-del:disabled { opacity: 0.4; cursor: default; }

.response-meals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.response-meal-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 13px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.response-meal-chip .rm-time { color: var(--muted); font-size: 12px; }
.response-meal-chip .rm-name { font-weight: 550; }
.response-meal-chip .rm-idx { font-weight: 700; font-variant-numeric: tabular-nums; }
.response-meal-chip .rm-band { color: var(--muted); font-size: 12px; }

.proposal-mri {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.proposal-mri-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-2);
}

/* ---- sleep extras (quality / wake-up feeling) ---- */
.sleep-extras { margin: 2px 0 2px 33px; }
.extra-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.extra-label {
  font-size: 11.5px;
  color: var(--muted);
  min-width: 62px;
}
.extra-chip {
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.1s ease;
}
.extra-chip:hover { border-color: var(--accent); }
.extra-chip.sel {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.extra-chip:disabled { opacity: 0.55; cursor: default; }
.extra-chip:disabled:not(.sel) { opacity: 0.3; }
.sleep-extras-line {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--sleep);
  font-weight: 550;
  text-transform: capitalize;
}

/* ---- thick single-track bars (intake-vs-output, accumulated pace) ---- */
.thick-bar {
  position: relative;
  height: 34px;
  background: var(--grid);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.thick-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  transition: width 0.35s ease;
}
.thick-bar .tb-mark {
  position: absolute;
  top: 5px;
  bottom: 5px;
  width: 3px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--text) 55%, transparent);
}
.thick-bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13.5px;
  color: var(--text);
}
.thick-bar span b { font-weight: 650; }
.thick-bar span em { font-style: normal; margin-left: auto; color: var(--text-2); }
.tb-caption {
  display: flex;
  justify-content: space-between;
  /* the two halves must never touch when they happen to fill the row —
     10px is the widest gap that still lets the block count and the goal
     window share one line on a 375px screen */
  gap: 6px 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.tb-caption > span:last-child { text-align: right; }

/* profile page */
.profile-head { text-align: center; margin: 6px 0 22px; }
.profile-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.profile-avatar svg { width: 40px; height: 40px; }
.profile-head h1 { margin: 0; font-size: 22px; }
.profile-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

.profile-card { padding: 0; overflow: hidden; margin-bottom: 12px; }
.profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  background: none;
  border: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.profile-row:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 4%, transparent); }
.profile-row:disabled { cursor: default; opacity: 0.55; }
.profile-row-icon { font-size: 20px; width: 28px; text-align: center; }
.profile-row-text { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.profile-row-text b { font-weight: 600; }
.profile-row-text small { color: var(--muted); font-size: 12.5px; }
.profile-chevron {
  color: var(--muted);
  font-size: 20px;
  transition: transform 0.15s ease;
}
.profile-card.open .profile-chevron { transform: rotate(90deg); }
/* Account's groups (v0.6.135): a heading, then ONE panel whose rows are
   divided by a hairline — the iPhone's grouped list. A row hidden by the
   script takes no divider, and a group with every row hidden goes. */
.profile-group { margin-bottom: 22px; }
.profile-group-h {
  margin: 0 4px 7px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.profile-group-cards { padding: 0; overflow: hidden; margin-bottom: 0; }
.profile-group-cards > .profile-card { margin: 0; }
.profile-group-cards > .profile-card:not([hidden]) ~ .profile-card:not([hidden]) {
  border-top: 1px solid var(--border);
}
.profile-group:not(:has(.profile-card:not([hidden]))) { display: none; }
.profile-group-foot { margin: 7px 4px 0; font-size: 12.5px; color: var(--muted); }
.profile-body { padding: 4px 18px 16px; }
.profile-body textarea {
  width: 100%;
  resize: vertical;
  min-height: 110px;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}
.profile-body-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.profile-body-actions .hint { margin: 0; }
/* Account → Password (v0.6.141) */
.password-form { display: grid; gap: 8px; }
.password-form input[type="password"] {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text);
}
.password-form input[type="password"]:focus { outline: none; border-color: var(--brand); }
.password-form .hint { margin: 0; }
.password-form .profile-body-actions .btn.danger { margin-right: 0; }
.password-form #password-hint { flex: 1; text-align: right; }
.password-form #password-hint.bad { color: var(--over); }
.password-form #password-hint.ok { color: var(--green); }
/* Delete account (v0.6.94): the one destructive row, in the colour the
   app's other destructive controls use; the dialog lists what goes. */
.profile-row-danger .profile-row-text b,
.profile-row-danger .profile-row-icon { color: var(--over); }
.delete-list {
  margin: 10px 0 4px;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.delete-export { width: 100%; margin: 14px 0 4px; }
.delete-confirm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-2);
}
.delete-confirm b { color: var(--text); font-weight: 600; word-break: break-all; }
.delete-confirm input {
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
}
#delete-dialog .btn.danger:disabled { opacity: 0.45; cursor: default; }
.export-quick { display: flex; gap: 8px; margin: 10px 0; }
.export-quick .btn { flex: 1; }
.export-range {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.export-range label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}
.export-range input[type="date"] {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

/* ---- playful fat blocks (accumulated balance) ---- */
.fat-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}
.fat-block {
  /* square: a block is one unit of mass, and reads as one whether the
     grid is a handful of 100 g chunks or a field of 10 g ones */
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--bc) 92%, #ffffff),
    var(--bc) 55%,
    color-mix(in srgb, var(--bc) 78%, #000000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),
              0 1px 2px rgba(0, 0, 0, 0.18);
  animation: fat-block-pop 0.35s ease backwards;
  animation-delay: var(--d, 0ms);
  transition: transform 0.12s ease;
}
.fat-block:hover { transform: translateY(-2px) scale(1.08); }
.fat-block.partial {
  position: relative;
  background: none;
  border: 1.5px solid color-mix(in srgb, var(--bc) 70%, transparent);
  box-shadow: none;
  overflow: hidden;
  animation: none;
}
/* The grid reads left to right, so a block fills left to right too —
   the same direction the wavefront crosses the row. Countdown and fill
   already did this through their own anchoring; this brings the plain
   leading block (banking and maintain drift) in line, so every block on
   this card moves the same way. The energy card's segments stay
   bottom-up: those are one day's food filling a vessel, not a row being
   crossed. */
.fat-block.partial::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--fill, 0%);
  background: color-mix(in srgb, var(--bc) 45%, transparent);
  border-radius: 4px 0 0 4px;
  transition: width 0.4s ease;
}
/* Countdown mode shows the WHOLE goal from day one and takes it apart:
   solid blocks are the mass still to lose, and a burned one is left as a
   faint ghost of itself. The grid literally dissolves as the cut works —
   the inverted reading the owner asked for. (Growing runs the same
   classes the other way: ghosts are what is still to gain.) */
/* Today's share of the countdown: burned by the clock and by logged
   activity, but only ASSUMED — eating gives it straight back. Drawn with
   the same solid outline as the block currently filling, so today reads
   as one continuous, still-moving stretch; settled days stay dashed. */
/* Four states, one story, reading left to right: a solid block is mass
   the day has no claim on; a half-lit one is what TODAY expects to burn
   and has not burned yet; an empty outline is what today has burned
   already — an estimate, so eating gives it straight back; and a dashed
   ghost is a day that has closed and cannot come back. */
.fat-block.estimate {
  background: color-mix(in srgb, var(--bc) 50%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--bc) 70%, transparent);
  box-shadow: none;
  animation: none;
}
.fat-block.assumed,
.fat-block.draining,
.fat-block.to-gain,
.fat-block.filling {
  background: none;
  border: 1.5px solid color-mix(in srgb, var(--bc) 70%, transparent);
  box-shadow: none;
  animation: none;
}
/* Growing runs the same band the other way. A cut states today's estimate
   at half strength and empties it to nothing; a bulk states it empty and
   fills it to half strength, because a deficit arrives on its own and a
   surplus has to be eaten. Half-lit therefore means "today's, provisional"
   in both, and solid means settled in both. */
.fat-block.assumed-fill {
  background: color-mix(in srgb, var(--bc) 50%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--bc) 70%, transparent);
  box-shadow: none;
  animation: none;
}
/* The edge. The burn crosses the grid left to right, so it crosses this
   block the same way: what is left of it holds the right-hand side and
   retreats, still wearing the state it is being taken from. */
.fat-block.draining::after {
  top: 0;
  bottom: 0;
  left: auto;
  right: 0;
  width: var(--fill, 0%);
  height: auto;
  border-radius: 0 4px 4px 0;
  transition: width 0.4s ease;
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--bc) 92%, #ffffff),
    var(--bc) 55%,
    color-mix(in srgb, var(--bc) 78%, #000000));
}
.fat-block.draining.est::after {
  background: color-mix(in srgb, var(--bc) 50%, transparent);
}
/* the block being gained right now: fills from the left, in the same
   half strength the finished ones of today wear */
.fat-block.filling::after {
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: var(--fill, 0%);
  height: auto;
  border-radius: 4px 0 0 4px;
  transition: width 0.4s ease;
  background: color-mix(in srgb, var(--bc) 50%, transparent);
}

.fat-block.cleared {
  background: none;
  border: 1.5px dashed color-mix(in srgb, var(--bc) 40%, transparent);
  box-shadow: none;
  opacity: 0.5;
  animation: none;
}

/* Counting in energy instead of body mass: many more, much smaller
   blocks, so the same balance reads as a fine-grained field rather than
   a handful of chunks. */
.fat-blocks.compact { gap: 3px; }
.fat-blocks.compact .fat-block {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.fat-blocks.compact .fat-block.partial,
.fat-blocks.compact .fat-block.cleared,
.fat-blocks.compact .fat-block.estimate,
.fat-blocks.compact .fat-block.to-gain,
.fat-blocks.compact .fat-block.assumed { border-width: 1px; }
.fat-blocks.compact .fat-block.partial::after { border-radius: 2px 0 0 2px; }
.fat-blocks.compact .fat-block.draining::after { border-radius: 0 2px 2px 0; }
.fat-blocks.compact .fat-block.filling::after { border-radius: 2px 0 0 2px; }

/* the block-unit toggle sits beside the info button, carrying both the
   mass and its energy so the equivalence is never a mystery */
.unit-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 9px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font: 650 10.5px/1.6 inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.unit-toggle em {
  font-style: normal;
  font-weight: 550;
  opacity: 0.72;
}
.unit-toggle:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
/* the info button follows the toggle, so the title keeps the left edge */
.macro-card .macro-name > span:first-child { margin-right: 0; }

@keyframes fat-block-pop {
  from { opacity: 0; transform: scale(0.4); }
  60% { transform: scale(1.12); }
  to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .fat-block { animation: none; }
}
.fat-blocks.static .fat-block { animation: none; }
.fat-blocks.static .fat-block.partial::after { transition: none; }

/* ---- login (access gate) ---- */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
}
.login-icon { border-radius: 20px; box-shadow: var(--shadow); }
.login-wrap h1 { margin: 0; font-size: 20px; }
.login-tagline {
  margin: -4px 0 4px;
  text-align: center;
  color: var(--text-2);
  font-size: 15px;
  max-width: 300px;
}
.login-form { display: flex; gap: 8px; width: min(320px, 100%); }
.login-form input {
  flex: 1;
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
.login-error { color: var(--over); font-size: 13.5px; margin: 0; }
.login-note {
  color: var(--text-2);
  font-size: 14px;
  text-align: center;
  max-width: 320px;
  margin: 0;
}
.profile-email { margin: 2px 0 0; color: var(--accent); font-size: 13.5px; }
.profile-card form { margin: 0; }

/* phase choice spotlight: the mandatory "Apply as" block pulses when the
   user tries to save without deciding */
#phase-block {
  border-radius: 12px;
  transition: outline-color 0.25s ease;
  outline: 2px solid transparent;
  outline-offset: 6px;
}
#phase-block.attention {
  outline-color: var(--accent);
  animation: phase-pulse 0.55s ease 2;
}
@keyframes phase-pulse {
  0%, 100% { transform: none; }
  35% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}

/* ---- phase color picker (targets dialog) ---- */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--pc);
  cursor: pointer;
  padding: 0;
  outline-offset: 2px;
  transition: transform 0.12s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active {
  border-color: var(--surface);
  outline: 2px solid var(--pc);
}

/* ---- phase chips (export dialog, analytics legend) ---- */
.export-phases { display: flex; flex-wrap: wrap; gap: 8px; }
.phase-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pc) 14%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
}
.phase-chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pc);
  flex: none;
}
.phase-chip small { color: var(--muted); font-weight: 400; }
.phase-chip:hover { background: color-mix(in srgb, var(--pc) 24%, transparent); }
.phase-chip.static { cursor: default; }
.phase-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -6px 0 14px;
}
.phase-legend small { color: var(--muted); font-size: 13px; }
.export-range { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.export-range label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
}
.export-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.export-range-btn { margin-top: 10px; }

/* ---- Plans page (v0.6.48 — plans only, no days): one card per plan,
   its colour down the left edge ---- */
.plan-card { padding: 0; overflow: hidden; }
.plan-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px 10px;
  border-left: 4px solid var(--pc, var(--accent));
}
.plan-card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  color: var(--pc, var(--accent));
}
.plan-card-title i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pc, var(--accent));
}
.plan-card-meta { color: var(--muted); font-size: 12.5px; }
/* Everything under the head lines up with the name, past the colour edge.
   The numbers are a small dashboard (v0.6.50): a goal chip, two tiles —
   target and result — and a progress bar for an amount-and-time goal. */
.plan-card .plan-goal,
.plan-card .plan-stats,
.plan-card .plan-progress,
.plan-card .plan-actions { margin-left: 22px; margin-right: 16px; }
.plan-card .plan-actions { margin-bottom: 14px; }
.plan-goal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 10px;
}
.plan-goal-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pc) 14%, transparent);
  color: var(--pc);
  font-size: 12.5px;
  font-weight: 650;
}
.plan-goal-chip b { font-size: 13px; line-height: 1; }
.plan-goal-how { font-size: 13px; color: var(--text-2); }
.plan-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.plan-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px 11px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 4%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  .plan-stat { background: color-mix(in srgb, #ffffff 5%, var(--surface)); }
}
.plan-stat small {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-stat b {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.plan-stat b em {
  margin-left: 3px;
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.plan-stat b.good { color: var(--pc); }
.plan-stat b.bad { color: var(--over); }
.plan-stat-sub { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.plan-stat-note { font-size: 11.5px; color: var(--muted); }
.plan-macros { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; }
.plan-macro {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
/* scoped past `.plan-stat b` (the big number), which would otherwise win */
.plan-stat .plan-macro b { font-weight: 700; font-size: 11.5px; line-height: 1.3; white-space: normal; }
.plan-progress { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.plan-progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.plan-progress-head small {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-progress-head span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.plan-progress-head span.warn { color: var(--over); }
.plan-progress-track {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pc) 16%, transparent);
  overflow: hidden;
}
.plan-progress-track i { display: block; height: 100%; border-radius: 999px; background: var(--pc); }
/* banked the wrong way: an empty bar, and the kilos say so */
.plan-progress.behind .plan-stat-sub { color: var(--over); }
.plan-card.focus { box-shadow: var(--shadow), inset 0 0 0 2px color-mix(in srgb, var(--pc) 45%, transparent); }
/* A plan's card opens its own page (v0.6.101): the head is the link, with
   a chevron at its end; anywhere else on the card but a button does too. */
.plan-card[data-plan] { cursor: pointer; }
.plan-card-open {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.plan-card-open .plan-card-head { flex: 1; min-width: 0; }
.plan-open-chev {
  padding: 0 16px 0 8px;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}
.plan-card[data-plan]:hover .plan-open-chev { color: var(--pc); transform: translateX(2px); }

/* ---- A plan's own page (v0.6.101) — its head is the Plans card's, its
   weeks a bar under it, then the Analytics cards for the week picked ---- */
.plan-back {
  display: inline-block;
  margin: 2px 0 10px;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.plan-page-head { padding-bottom: 6px; }
.plan-page-head .plan-card-head { padding-top: 16px; }
.plan-page-head .plan-card-title { font-size: 19px; }
.plan-blocks {
  position: relative;   /* the chips' offsetLeft is along the bar */
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 6px;
  margin: 2px -2px 0;
}
.plan-blocks::-webkit-scrollbar { display: none; }
.plan-block {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.plan-block:active { transform: scale(0.95); }
.plan-block b { font-weight: 650; }
.plan-block.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.plan-block.on .wk-dot { box-shadow: 0 0 0 1.5px #fff; }
.plan-block-line { margin: 2px 2px 12px; }
/* the bar picks every card's weeks here: their own tabs, the plan's name
   beside their titles and the Averages window control step aside */
body[data-page="plan"] .card-plan,
body[data-page="plan"] .src-combine,
body[data-page="plan"] .src-tabs,
body[data-page="plan"] #avg-range { display: none; }

@media (max-width: 560px) {
  .plan-card-head { padding: 13px 14px 9px; }
  .plan-card .plan-goal, .plan-card .plan-stats,
  .plan-card .plan-progress, .plan-card .plan-actions { margin-left: 18px; margin-right: 12px; }
  .plan-stat { padding: 9px 10px 10px; }
  .plan-stat b { font-size: 19px; }
}

/* analytics phase picker: chips that are the range */
.phase-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 10px;
}
.phase-select .phase-chip { opacity: 0.55; }
.phase-select .phase-chip.on {
  opacity: 1;
  background: color-mix(in srgb, var(--pc) 20%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--pc);
}
.analytics-range { margin: 0 0 16px; }

/* ---- plan editor (v0.6.47) ---- */
/* the line under a dialog title, before the first block */
.dialog-note.plan-lead { margin: -8px 0 14px; font-size: 12.5px; line-height: 1.45; }
#body-energy { margin: 0 0 4px; }
/* "Based on 171 cm · 64 kg · …" — the body a suggestion is built on,
   one tap from being corrected */
.plan-body-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 2px 0 10px;
  padding: 8px 11px;
  border: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.plan-body-row span { display: flex; flex-direction: column; min-width: 0; }
.plan-body-row small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.plan-body-row b { font-size: 13px; font-weight: 550; }
.plan-body-row em { font-style: normal; font-size: 13px; color: var(--accent); white-space: nowrap; }
.plan-body-row:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.plan-body-row.missing { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--over) 45%, transparent); }
.linkish {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
#plan-meta-name {
  width: 100%;
  font: inherit;
  font-size: 16px;             /* 16px: anything smaller zooms iOS on focus */
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
#plan-meta-name:focus { outline: none; border-color: var(--accent); }
#plan-meta-delete { margin-right: auto; }
#plan-meta-swatches { margin-bottom: 4px; }

/* ---- Plans page (v0.6.47): History's cards, now saying what each plan
   was set to and offering what can be changed ---- */
.plan-badge {
  font-style: normal;
  font-size: 11px;
  font-weight: 650;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pc, var(--accent)) 16%, transparent);
  color: var(--pc, var(--accent));
}
.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 14px 12px 18px;
}
.plan-more { min-width: 40px; font-size: 18px; line-height: 1; letter-spacing: 1px; }
.plan-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 12px;
}
.plan-empty b { font-size: 16px; }
.plan-empty p { margin: 0 0 6px; color: var(--text-2); font-size: 13.5px; }
/* the next plan, at the end of the list: the same shape as the empty
   state, quieter — a dashed edge says "not a plan yet" */
.plan-new {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
  background: transparent;
  box-shadow: none;
  border: 1.5px dashed color-mix(in srgb, var(--text) 22%, transparent);
}
.plan-new b { font-size: 15px; }
.plan-new p { margin: 0 0 6px; color: var(--text-2); font-size: 13.5px; }

/* ---- PWA install hint (browser only, floats above the tab bar) ---- */
.pwa-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 59;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(94vw, 460px);
  padding: 9px 10px 9px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  font-size: 13.5px;
}
.pwa-hint-text { color: var(--text-2); }
.pwa-hint-text b { color: var(--text); font-weight: 600; }
.pwa-share-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  color: var(--accent);
}
.pwa-hint-install { padding: 5px 12px; border-radius: 10px; font-size: 13px; }
.pwa-hint-close {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
}
.pwa-hint-close:hover { background: var(--grid); color: var(--text); }

/* ---- M7: earned windows, goal window line, live marker ---- */
.earned-tag {
  font-size: 11px;
  font-weight: 650;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 2px 7px;
  border-radius: 999px;
}
/* "live" marker on the current day's accumulated figures. Deliberately
   plain text, not a pill: the row has to stay on one line. */
.live-tag {
  font-style: normal;
  font-weight: 650;
  margin-left: 4px;
  color: var(--accent);
}
/* The goal window's own line: where the amount-and-time goal stands and
   what it now asks. Advisory only — a warning tint, never a block. */
.goal-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-2);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.goal-line b { color: var(--text); font-weight: 650; }
.goal-line.warn {
  background: color-mix(in srgb, var(--over) 10%, transparent);
  color: var(--text);
}
.goal-line.done { background: var(--grid); }

.p-earned {
  font-size: 11px;
  font-weight: 650;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 1px 6px;
  border-radius: 999px;
  margin-right: 6px;
}
.dialog-note {
  margin: 10px 0 -2px;
  font-size: 12px;
  color: var(--text-2);
}

/* Live status of an amount-and-time goal inside the targets dialog:
   the plan fields say what was asked for, this says where it stands. */
.goal-status {
  margin: 10px 0 0;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-2);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.goal-status b { color: var(--text); font-weight: 650; }
.goal-status.warn {
  background: color-mix(in srgb, var(--over) 11%, transparent);
  color: var(--text);
}

.row-earned {
  display: inline-block;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  vertical-align: 1px;
}

.goal-line.actionable { cursor: pointer; }
.goal-line.actionable:active { transform: scale(0.995); }
.goal-line.actionable::after {
  content: "›";
  margin-left: auto;
  font-size: 15px;
  opacity: 0.55;
}

/* Build marker at the foot of the profile page — deliberately quiet, but
   the fastest way to confirm which version a device is actually running. */
.app-version {
  margin: 18px 0 4px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-2);
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

/* ---- energy card: the day's allowance as segments you fill ----
   Deliberately not the accumulated card's blocks: those are a body-mass
   ledger in fixed 50 g units, these are one day's food and stretch to
   fit whatever the allowance is. Flat, thin, one row. */
.kcal-meter {
  display: flex;
  gap: 3px;
  margin-top: 12px;
  height: 26px;
}
.kcal-seg {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 4px;
  background: var(--grid);
  overflow: hidden;
  transition: background-color 0.25s ease;
}
/* Three zones read left to right, each with its own empty state, so the
   shape of the day is legible before a single calorie is logged:
     PLANNED — outlined: what the plan allows
     EARNED  — tinted: room today's movement added on top
     BURN    — bare: past the allowance, burned rather than eaten */
.kcal-seg.plan {
  background: color-mix(in srgb, var(--accent) 34%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 62%, transparent);
}
.kcal-seg.earned { background: color-mix(in srgb, var(--accent) 34%, transparent); }
.kcal-seg.burn { background: color-mix(in srgb, var(--grid) 70%, transparent); }
/* Eaten is eaten: full colour, no transparency. The translucent states
   are the ones that have not happened yet — planned and earned room —
   so "spent" and "available" never look like shades of the same thing. */
.kcal-seg.on { background: var(--sc); }
/* eaten past the plan: no transparency, so the escalation reads clearly */
/* an eaten segment is solid whichever zone it sits in */
.kcal-seg.plan.on { box-shadow: none; }
/* the segment currently being eaten into fills from the bottom */
.kcal-seg[data-part]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--p, 0%);
  background: var(--sc);
  transition: height 0.35s ease;
}
.kcal-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 9px;
  font-size: 13px;
  color: var(--text-2);
}
.kcal-line b { font-size: 17px; font-weight: 700; color: var(--text); }
.kcal-line em { font-style: normal; margin-left: auto; color: var(--text); }
.kcal-line em.over { color: var(--over); }

/* ---- skeletons ----
   Shape while waiting, not a spinner. Purely decorative: no layout
   thrash, no JS, and the first real render replaces them wholesale.
   A sweep runs only while something is genuinely pending — waiting is
   the one moment an animation earns its keep. */
.skel {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(100deg,
    var(--grid) 30%,
    color-mix(in srgb, var(--text-2) 12%, var(--grid)) 48%,
    var(--grid) 66%);
  background-size: 260% 100%;
  animation: skel-sweep 1.5s ease-in-out infinite;
}
.skel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.skel-head .skel { height: 11px; }
.skel-lg { height: 26px; border-radius: 8px; }
.skel-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 16px;
}
.skel-blk { width: 24px; height: 24px; border-radius: 6px; }
.skel-meter { height: 26px; border-radius: 4px; margin-top: 12px; }
.skel-bar { height: 18px; border-radius: 9px; margin-top: 5px; }
@keyframes skel-sweep {
  from { background-position: 140% 0; }
  to   { background-position: -40% 0; }
}
/* A day that takes a moment to arrive gets the same sweep back, rather
   than the previous day's numbers sitting there looking current. */
#top-cards.loading { opacity: 0.55; transition: opacity 0.18s ease; }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
}

/* ---- card info button + shared explainer dialog ---- */
.card-info {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-2) 18%, transparent);
  color: var(--text-2);
  font: 650 11px/1 ui-serif, Georgia, serif;
  font-style: italic;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.card-info:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}
/* the header is a flex row; keep the title left and the rest right */
.macro-card .macro-name { align-items: center; }
.macro-card .macro-name > span:first-child { margin-right: auto; }

.info-dialog { position: relative; padding-top: 22px; }
.info-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--grid);
  color: var(--text-2);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.info-close:hover { color: var(--text); }
.info-dialog h3 { padding-right: 34px; }
.info-body { font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.info-body p { margin: 12px 0 0; }
.info-body b { color: var(--text); font-weight: 650; }

/* Macro rows open their breakdown (v0.6.46). The affordance is quiet on
   purpose — a pointer and a slight lift — because the bars are read far
   more often than they are tapped. */
.macro-tap { cursor: pointer; border-radius: 11px; outline-offset: 2px; }
.macro-tap:hover { filter: brightness(1.04); }
.macro-tap:focus-visible { outline: 2px solid var(--accent); }

/* The breakdown: one row per entry — name and where it was eaten, grams,
   share of the day — with a share track underneath, so the ranking reads
   at a glance and the numbers are there when wanted. */
.macro-dialog {
  max-height: min(85vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.macro-dialog h3 { margin-bottom: 4px; }
.mb-head { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.mb-head b { color: var(--text); font-size: 15px; font-weight: 650; }
.mb-list { display: flex; flex-direction: column; }
.mb-row {
  display: grid;
  grid-template-columns: 1fr auto 38px;
  align-items: center;
  gap: 4px 10px;
  padding: 9px 0;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mb-row:first-child { border-top: none; padding-top: 2px; }
.mb-row:hover .mb-name b { color: var(--accent); }
.mb-name { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mb-name b {
  font-size: 13.5px; font-weight: 550; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mb-name small { display: block; font-size: 11.5px; color: var(--muted); }
.mb-name small::first-letter { text-transform: uppercase; }
.mb-val {
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mb-val em { font-style: normal; font-weight: 450; color: var(--muted); margin-left: 1px; }
.mb-pct {
  font-size: 12px; color: var(--muted); text-align: right;
  font-variant-numeric: tabular-nums;
}
.mb-track {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
  background: var(--grid);
  overflow: hidden;
}
.mb-track i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.mb-empty { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.mb-foot {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.mb-list + .mb-foot {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.info-rows { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.info-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}
.info-rows dt { margin: 0; }
.info-rows dd { margin: 0; color: var(--text); font-weight: 600; }
.info-rows .info-sum {
  margin-top: 3px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
}
.info-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
/* DIRECT children only: a nested <span> wrapping the description text
   would otherwise become a flex container itself and split its own words
   into columns */
.info-legend > span { display: flex; align-items: flex-start; gap: 9px; }
.info-legend i {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border-radius: 4px;
}
.info-legend .lg-plan { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.info-legend .lg-eaten { background: var(--accent); }
.info-legend .lg-over { background: hsl(38 82% 52%); }
.info-legend .lg-warn { background: hsl(28 80% 52%); }
/* the micros card's over state is the real over colour, not the macro
   card's amber staging — the swatch has to match what it describes */
.info-legend .lg-limit { background: var(--over); }
/* the macro row's three sections, drawn as they actually appear */
.info-legend .lg-plan-out {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1.5px
    color-mix(in srgb, var(--accent) 48%, transparent);
}
.info-legend .lg-over {
  background: linear-gradient(90deg, hsl(38 82% 52%), var(--over));
}
.info-legend .lg-band {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-left: 1px dashed color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: 0 4px 4px 0;
}

/* block-state swatches for the accumulated card's explainer */
.info-legend .lg-block-full {
  border-radius: 4px;
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--accent) 92%, #ffffff),
    var(--accent) 55%,
    color-mix(in srgb, var(--accent) 78%, #000000));
}
.info-legend .lg-block-estimate {
  background: color-mix(in srgb, var(--accent) 50%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 70%, transparent);
}
.info-legend .lg-block-assumed {
  background: none;
  border: 1.5px solid color-mix(in srgb, var(--accent) 70%, transparent);
}
.info-legend .lg-block-cleared {
  background: none;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  opacity: 0.6;
}
/* the value row: number left, live marker right */
.acc-row { align-items: baseline; }

/* The goal window's line moved into the footer row, opposite the block
   count: same information, one row instead of a band across the card.
   Down here it is text, not a filled bar — a warning still reads as one
   through colour, without spending a full-width block on it. */
.tb-caption .goal-line {
  margin-top: 0;
  padding: 0;
  gap: 4px;
  background: none;
  font-size: inherit;
  justify-content: flex-end;
  text-align: right;
}
.tb-caption .goal-line.warn,
.tb-caption .goal-line.warn b { color: var(--over); }
.tb-caption .goal-line.done { background: none; }
.tb-caption .goal-line.actionable::after { margin-left: 2px; font-size: 14px; }

/* zone swatches for the energy explainer */
.info-legend .lg-zone-plan {
  background: color-mix(in srgb, var(--accent) 34%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 62%, transparent);
}
.info-legend .lg-zone-earned { background: color-mix(in srgb, var(--accent) 34%, transparent); }
/* the burn swatch is "bare track" — outlined so it reads the same on the
   dialog's lighter surface as it does on the card */
.info-legend .lg-zone-burn {
  background: none;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text-2) 34%, transparent);
}

/* ---- zone rail ----
   A dimension bracket hung under the meter — the drawing convention for
   "this span is that thing", which beats a row of labels nobody reads.
   Each bracket is placed with the meter's own geometry, so it measures
   exactly the segments it sits under. */
.zone-rail {
  position: relative;
  height: 25px;
  margin-top: 5px;
}
.zone {
  position: absolute;
  top: 0;
  height: 6px;
  border: 1.5px solid;
  border-top: none;
  border-radius: 0 0 4px 4px;
}
.zone.z-plan { border-color: color-mix(in srgb, var(--accent) 62%, transparent); }
.zone.z-earned { border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.zone.z-burn { border-color: color-mix(in srgb, var(--text-2) 30%, transparent); }
/* the name hangs from the middle of its span and ignores the span width */
.zone b {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-2);
}
.zone b em {
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.zone.z-plan b em { color: var(--accent); }

/* the "over" zone: eaten past everything you burned today */
/* :not(.on) matters — this rule sits after `.kcal-seg.on` and would
   otherwise win on source order, leaving an EATEN over-segment wearing
   the faint "not yet" tint instead of solid red. */
.kcal-seg.over:not(.on) { background: color-mix(in srgb, var(--over) 18%, transparent); }
/* Growing, the card keeps the cut's grammar with the roles swapped: the
   OUTLINE marks the base you have to cover, the flat tint marks what is
   added on top. Cutting that is planned (outlined) then earned (flat);
   growing it is tdee (outlined) then the surplus (flat). Both are food
   you plan to eat, both fill to solid once eaten.
   :not(.on) for the same reason as the over rule above — these sit after
   `.kcal-seg.on` at equal specificity, and without the guard source
   order wins and an EATEN segment draws as unspent. */
.kcal-seg.tdee:not(.on) {
  background: color-mix(in srgb, var(--sc) 34%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sc) 62%, transparent);
}
.kcal-seg.surplus:not(.on) {
  background: color-mix(in srgb, var(--sc) 34%, transparent);
}
.zone.z-tdee { border-color: color-mix(in srgb, var(--text-2) 45%, transparent); }
.zone.z-tdee b { color: var(--text-2); }
.zone.z-tdee b em { color: var(--text-2); }
.info-legend .lg-zone-tdee {
  background: color-mix(in srgb, var(--text-2) 55%, transparent);
  border-radius: 3px;
}
.zone.z-over { border-color: color-mix(in srgb, var(--over) 60%, transparent); }
.zone.z-over b em { color: var(--over); }

/* ---- the info dialog's sums ----
   Two relationships instead of eight loose figures: the numbers explain
   each other, which a list of rows never does. */
.eq {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--grid);
}
.eq-t {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.eq-t b {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.eq-t em {
  font-style: normal;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}
.eq-sum b { color: var(--accent); }
.eq-op {
  padding-bottom: 12px;
  font-size: 13px;
  color: var(--text-2);
}

/* the live/full-day switch is a control, so it looks like one */
/* The balance and the mode it is being read in are one statement, so
   they are one control: the number, and a slow pulse saying it is still
   moving. Two people asked in a row why this figure differed from the
   day card's — it was never the arithmetic, it was that "live" looked
   like a label instead of a switch. */
.acc-live {
  /* hugs its own statement instead of stretching the card: the figure,
     what it is in, and whether it is still moving are one phrase, and a
     full-width panel made the "live" end read as a separate widget */
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  width: auto;
  max-width: 100%;
  margin: 2px 0 0;
  padding: 6px 12px;
  border: none;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}
.acc-live:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.acc-live.off { background: color-mix(in srgb, var(--text-2) 8%, transparent); }
.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.acc-live.off .live-tag { color: var(--text-2); }
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: live-pulse 2.4s ease-in-out infinite;
}
.acc-live.off .live-dot { animation: none; opacity: 0.5; }
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.25; transform: scale(0.8); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}


/* ---- iOS: stop the focus zoom at its cause ----
   Safari zooms the page whenever a field with a computed font-size under
   16px takes focus, and does NOT zoom back out when it blurs — which is
   why opening the "+" chat on an iPhone left the whole layout enlarged
   and had to be pinched back by hand. Every field in the app was under
   16px (the chat textarea at 14, dialog inputs and selects at 13), so
   every one of them triggered it.

   Fixed at the cause rather than with `user-scalable=no`: that would
   also stop the zoom, and would also stop the user pinching to read
   anything, which is a worse trade. Scoped to touch pointers, so desktop
   keeps its denser forms and phones get larger tap targets they wanted
   anyway. The explicit selectors are repeated because they set their own
   size and would otherwise win on specificity. */
@media (hover: none) and (pointer: coarse) {
  input,
  select,
  textarea,
  .composer-row textarea,
  .profile-body textarea,
  .password-form input[type="password"],
  .export-range input[type="date"] { font-size: 16px; }
}

/* ---- Body response ----------------------------------------------------
   A DECK, not a card. Each signal is a whole panel — own title, own
   status, own info button — and the deck slides sideways. They answer
   different questions, and a shared frame kept forcing them to share a
   header that could only describe one of them at a time.

   All cards wear the phase primary: one is on screen at a time and its
   title names it, so colour has no work left to do, and the stylesheet
   keeps one primary with no near-miss shades. */
.body-deck { margin-bottom: 20px; }
/* The track breaks OUT to the screen edges (negative margin) and pulls
   its content back in with equal padding. Two things fall out of that:
   the cards still line up with every other panel on the page, and a
   swipe shows the page background in the gutter instead of two rounded
   corners butting together — which is what made the deck feel glued.
   The 16px must match the page's own side padding; if that ever changes,
   this changes with it. */
.body-track {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-inline: -16px;
  padding-inline: 16px;
  scroll-padding-inline: 16px;
  overflow-x: auto;
  /* every card is padded to the tallest in JS, so the track is one
     stable height and swiping never makes the page jump */
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.body-track::-webkit-scrollbar { display: none; }
.body-slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
/* the panel's own bottom margin would break the snap rhythm — the deck
   owns the spacing below the whole stack instead */
.body-card { margin-bottom: 0; }

.body-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* the family name, so a card that says "Fuel" still says what it is part of */
.body-kicker {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.body-card h2 { margin: 0; }
.body-note {
  margin: 0 0 10px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}
.body-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
/* Small on purpose. At 11.5px in a pill with 10px of padding, three of
   these filled the card and read as buttons — they are STATUS, not
   controls, and nothing here is tappable. */
.body-chip {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--grid);
  color: var(--text-2);
  white-space: nowrap;
}
/* the one chip that is a call to action, so the one that is filled */
.body-chip.open {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.body-svg { display: block; width: 100%; height: auto; }

.body-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
}
.body-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--grid);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.body-dot.on { background: var(--accent); transform: scale(1.25); }

/* readiness card — the one with no curve */
.rd-score {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 2px 0 14px;
}
.rd-score.low { color: var(--over); }
.rd-score small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: capitalize;
}
.rd-parts { display: flex; flex-direction: column; }
.rd-part {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.rd-part:last-child { border-bottom: 0; }
.rd-part-label { color: var(--text); font-weight: 550; }
.rd-part-note {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.rd-part-delta {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--text-2);
  flex: 0 0 auto;
}

/* Absent cards are NAMED and the gaps listed on Readiness: a card
   missing because nothing was logged must never be mistaken for a flat
   one — the same rule the micros card follows. */
.body-missing, .body-gap {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.body-gap { color: var(--over); opacity: 0.85; }
.body-foot {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

/* The "wrong day open" notice. Deliberately NOT a proposal: there is
   nothing to accept, and it has to be obvious at a glance that no
   estimate is on offer — the whole reason it exists is that a reply
   asking someone to swipe elsewhere gets ignored while the numbers
   underneath it get accepted. */
.otherday {
  border: 1px solid color-mix(in srgb, var(--over) 40%, transparent);
  background: color-mix(in srgb, var(--over) 9%, transparent);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 4px 0 2px;
}
.otherday-head {
  font-size: 12px;
  font-weight: 650;
  color: var(--over);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.otherday p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}

/* ---- Analytics: by week ------------------------------------------------
   The phase's own 7-day blocks. Tabs select; one panel below reports.
   The headline is the week's ENERGY BALANCE — intake against everything
   burned — because adherence to an aggressive plan says nothing about
   whether the week went well. The hero bar IS that balance: the track is
   output, the fill is intake, so short of the end reads as a deficit and
   past it spills into the over colour. Below it the week is a table, not
   a stack of cards: seven days, then the averages. */
.weeks-panel h2 { margin-bottom: 12px; }
/* The tabs WRAP onto more rows (v0.6.62): a scrolling row ran off the
   card once a plan had five or six weeks. Each tab keeps its own size. */
.week-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
  margin-bottom: 14px;
}
.week-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 62px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: none;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease,
              transform 0.12s ease;
}
.week-tab:active { transform: scale(0.95); }
.week-tab b { font-size: 13px; font-weight: 650; }
.week-tab small { font-size: 11px; color: var(--muted); }
/* A selected tab carries a SOLID outline in the plan's colour (v0.6.56):
   a tint alone was hard to tell apart on neutral plan colours (slate),
   and since Food sources' tabs combine, several can be lit at once. */
.week-tab.on {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
}
.week-tab.on small { color: var(--accent); }
/* Food & Activity sources (v0.6.62): compact one-line chips in a grid that
   WRAPS — dot, week, count. A single scrolling row of tall tabs ran off
   the card at five or six weeks. Equal widths, so a second row lines up
   under the first. ("By week" keeps its own tabs.) */
.week-tabs.src-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  overflow: visible;
  padding-bottom: 0;
}
.src-tabs .week-tab {
  flex-direction: row;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 6px;
  border-radius: 10px;
}
.src-tabs .week-tab b { font-size: 12.5px; }
.src-tabs .week-tab small { font-size: 11px; font-variant-numeric: tabular-nums; }
.src-tabs .wk-dot { flex: none; }
.wk-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--grid);
}
/* the dot answers "did this week go the way the phase wants" — the same
   good/bad the Today card's balance uses, not an adherence scale */
.wk-dot.good { background: var(--accent); }
.wk-dot.bad  { background: var(--over); }

/* the panel fades and lifts a little on every switch, so changing tabs
   reads as the same card turning over rather than a silent re-render */
.week-detail.swap { animation: wk-swap 0.28s ease both; }
@keyframes wk-swap {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.wk-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.wk-range { font-size: 14px; font-weight: 600; color: var(--text); }
.wk-days { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
/* the count IS the warning when days are missing — a second "N days not
   logged" beside it said the same thing twice and wrapped the line */
.wk-days.gap { color: var(--over); }
.wk-hero { margin-bottom: 4px; }
.wk-hero-num {
  font-size: 30px; font-weight: 700; line-height: 1.05;
  color: var(--text-2);
}
.wk-hero-num.good { color: var(--accent); }
.wk-hero-num.bad { color: var(--over); }
.wk-hero-num small {
  font-size: 14px; font-weight: 450; color: var(--muted);
}
.wk-hero-word {
  font-size: 12.5px; color: var(--muted); margin: 3px 0 10px;
}
.wk-hero-sub {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--muted); margin-top: 6px;
}
.wk-hero-sub b { color: var(--text-2); font-weight: 650; }

.wk-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--grid);
  overflow: hidden;
}
.wk-bar-lg { height: 14px; }
.wk-bar i { position: absolute; top: 0; bottom: 0; display: block; }
.wk-plan   { left: 0; background: color-mix(in srgb, var(--accent) 22%, transparent); }
/* every bar wears the phase primary, macros included: the row is already
   labelled, so a per-macro tint adds a second colour language for no
   information — and the stylesheet's standing rule is one primary, no
   near-miss shades */
.wk-fill   { left: 0; background: var(--accent); border-radius: 999px; }
.wk-over   { background: var(--over); }

/* ---- Food sources (v0.6.51) ------------------------------------------
   Four rows, one per macro: the total, a bar split into its five biggest
   sources, and the top three named. Tap a row for the full ranking. The
   bar is the plan's colour like every bar on this page; the sources are
   told apart by fading, not by hue. */
.src-lead { margin: -4px 0 12px; }
.src-empty p { margin: 0 0 12px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.src-empty .btn { display: inline-flex; align-items: center; gap: 8px; }
.src-rows { display: flex; flex-direction: column; }
.src-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 6px 10px;
  padding: 12px 0;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.src-row:first-child { border-top: none; padding-top: 2px; }
.src-row:hover .src-label { color: var(--accent); }
.src-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.src-label { font-size: 14px; font-weight: 600; color: var(--text); }
.src-total {
  font-size: 15px; font-weight: 650; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.src-total em { font-style: normal; font-weight: 450; color: var(--muted); margin-left: 1px; }
.src-bar {
  grid-column: 1 / -1;
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 999px;
  background: var(--grid);
  overflow: hidden;
}
.src-bar i { display: block; height: 100%; background: var(--accent); min-width: 2px; }
.src-bar i.src-rest { opacity: 0.16; }
.src-top {
  grid-column: 1 / -1;
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.src-top b { font-weight: 600; color: var(--text-2); }
.src-stale { margin: 10px 0 0; font-size: 12px; color: var(--over); }
.src-error { margin: 10px 0 0; font-size: 12.5px; color: var(--over); }
.src-still { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.src-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.src-foot .linkish { font-size: 12.5px; }
.src-foot .linkish:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.src-foot .linkish:disabled .src-spin { margin-right: 4px; }
.wk-dot.src-stale-dot { background: var(--over); }

.src-spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: src-spin 0.8s linear infinite;
}
@keyframes src-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .src-spin { animation-duration: 2.4s; } }

/* The panel reuses the breakdown's rows; a source opens onto its foods.
   Each row sits inside its own group, so the breakdown's first-child and
   stretch rules no longer reach it — width and separators are restated. */
.src-group + .src-group { border-top: 1px solid var(--border); }
.src-group .src-group-row { width: 100%; border-top: none; padding: 9px 0; }
.src-group:first-child .src-group-row { padding-top: 2px; }
.src-group-row .mb-name small { text-transform: none; }
.src-group.open .src-group-row .mb-name b { color: var(--accent); }
.src-foods {
  list-style: none;
  margin: 0 0 8px;
  padding: 2px 0 4px 12px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  display: flex; flex-direction: column; gap: 6px;
}
.src-foods li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.src-food { min-width: 0; display: flex; flex-direction: column; }
.src-food b {
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.src-food small { font-size: 11px; color: var(--muted); }
.src-food-g {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.src-food-g em { font-style: normal; font-weight: 450; color: var(--muted); margin-left: 1px; }

/* Activity sources (v0.6.61): the summary row is the food card's macro row,
   but nothing opens from it — the kinds below open in place instead. */
.src-row.act-sum { cursor: default; padding-bottom: 14px; }
.src-row.act-sum:hover .src-label { color: var(--text); }
.act-list { border-top: 1px solid var(--border); padding-top: 8px; }
.act-list .mb-val { min-width: 84px; text-align: right; }
/* "5,080 kcal", not "5,080kcal": a three-letter unit needs the gap a "g"
   does not */
#activities .src-total em, #activities .mb-val em,
#activities .src-food-g em { margin-left: 3px; }

/* Two plain tables, not cards of bars. The week's job is to be READ —
   seven days down a column, then the averages — and a stack of decorated
   panels made that harder, not easier. */
.wk-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  font-size: 12.5px;
}
.wk-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 0 6px;
  border-bottom: 1px solid var(--border);
}
.wk-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.wk-table td.num, .wk-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.wk-table tbody tr:last-child td { border-bottom: 0; }
.wk-table tfoot td {
  border-top: 1.5px solid var(--border);
  border-bottom: 0;
  padding-top: 9px;
  font-weight: 650;
  color: var(--text);
}
/* an unlogged day still burned its baseline, so it keeps its row and its
   negative — dimmed, because the missing intake is the story */
.wk-unlogged td { opacity: 0.5; }
.wk-table .good { color: var(--accent); }
.wk-table .bad { color: var(--over); }
/* the plan comparison, demoted to a third column: still the answer to
   "did I hit my protein", no longer the headline it was never right for */
.wk-week-total { color: var(--muted); font-size: 11.5px; }
.wk-avg td:first-child { color: var(--text-2); }
.wk-avg b { color: var(--text); font-weight: 650; font-size: 13px; }
/* Micros on a week. A nutrient with no estimate is ABSENT from this
   table, never a zero row — the same rule the day card follows, and it
   matters more here: micros began at v0.6.2, so an earlier week has food
   and no estimates, and twenty-four zeroes would report a catastrophic
   week that never happened. Such a week renders no micro table at all. */
.wk-micros { margin-top: 20px; }
.wk-micros thead th:last-child {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.wk-group td {
  padding-top: 12px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 0;
}
.wk-limit {
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 5px;
  margin-left: 4px;
}
.wk-micro-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.wk-more {
  font: inherit;
  font-size: 12px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
}
.wk-more:hover { text-decoration: underline; }
/* coverage is never hidden behind the expand: without it a low row and a
   never-asked row look identical, and they are opposite conclusions */
.wk-micro-gap { font-size: 11px; color: var(--muted); }

@media (max-width: 360px) {
  .wk-table { font-size: 12px; }
  .wk-week-total { font-size: 11px; }
}

/* ---- Micros card ------------------------------------------------------
   Under Macros, short by default. Thin bars because the expanded list is
   24 rows — anything thicker turns the page into a scroll. Coverage sits
   in the header, never hidden behind the expand, because a missing
   estimate and a genuine shortfall look identical without it. */
/* deliberately shorter than Macros when collapsed: it is a glance, not a
   panel. The chevron carries "there is more", so no footer line is spent
   saying it. */
.micros-card { padding-bottom: 14px; }

/* Body metrics (v0.6.86): three tiles side by side even on a phone — the
   values are short, and a quiet card should not grow to a column */
.bm-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 0; }
.bm-tiles .stat-tile { box-shadow: none; background: var(--bg); padding: 10px 12px; }
.bm-tiles .stat-value { font-size: 19px; }
.bm-tiles .stat-value.muted { color: var(--muted); }
.bm-entries { margin-top: 10px; }
/* the three tiles are always one height, whatever each one holds (the
   owner, v0.6.87) — a grid row stretches its items; said here so no later
   rule quietly turns it off */
.bm-tiles { align-items: stretch; }

/* Analytics → Body metrics (v0.6.87): the tiles are buttons that open a
   value's readings underneath */
.bh-tile { font: inherit; color: inherit; text-align: left; border: 0;
  cursor: pointer; display: block; width: 100%; }
.bh-tile:disabled, div.bh-tile { cursor: default; }
.bh-tile.on { box-shadow: inset 0 0 0 2px var(--accent); }
#bh-list:not(:empty) { margin-top: 12px; }
.bh-head { font-size: 12.5px; color: var(--text-2); font-weight: 550; margin-bottom: 4px; }
.bh-row { display: grid; grid-template-columns: 1fr auto 56px; gap: 10px;
  align-items: baseline; padding: 7px 0; border-top: 1px solid var(--border); }
.bh-date { color: var(--text-2); font-size: 14px; }
.bh-date small { color: var(--muted); margin-left: 4px; }
.bh-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.bh-chg { text-align: right; color: var(--muted); font-size: 13px;
  font-variant-numeric: tabular-nums; }
.bh-more { margin-top: 8px; }
/* the info button is a SIBLING of the expand button, never inside it —
   nested buttons are invalid, and tapping "i" must not also toggle */
.mi-topline { display: flex; align-items: center; gap: 8px; }
.mi-topline .card-info { flex: 0 0 auto; margin-bottom: 10px; }
.mi-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 0 10px;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.mi-coverage {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}
.mi-chev {
  width: 16px; height: 16px;
  color: var(--muted);
  flex: 0 0 auto;
  transition: transform 0.24s ease;
}
.mi-head[aria-expanded="true"] .mi-chev { transform: rotate(180deg); }

.mi-body { display: flex; flex-direction: column; gap: 7px; }
.mi-group {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}
.mi-group:first-child { margin-top: 0; }

.mi-row {
  display: grid;
  grid-template-columns: 82px 1fr auto 34px;
  align-items: center;
  gap: 8px;
}
.mi-name {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mi-track {
  height: 4px;                 /* thin, as asked — 24 of these must fit */
  border-radius: 999px;
  background: var(--grid);
  overflow: hidden;
}
.mi-fill {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.mi-fill.over { background: var(--over); }
.mi-val { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.mi-val em { font-style: normal; font-weight: 450; color: var(--muted); }
.mi-pct {
  font-size: 11px; color: var(--muted); text-align: right;
}
/* not estimated is its own state, visibly different from "you ate none" */
.mi-row.none .mi-name, .mi-row.none .mi-val { color: var(--muted); }
.mi-row.none .mi-track { opacity: 0.45; }

/* worked example inside the info dialog: the same row the card draws,
   shown once with its arithmetic spelled out underneath */
.mi-eg {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.mi-eg-row {
  display: grid;
  grid-template-columns: 82px 1fr auto 34px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.mi-eg-track {
  height: 4px; border-radius: 999px;
  background: var(--grid); overflow: hidden;
}
.mi-eg-track i {
  display: block; height: 100%;
  background: var(--accent); border-radius: 999px;
}
.mi-eg-num { font-size: 11.5px; font-weight: 600; color: var(--text); }
.mi-eg-num em { font-style: normal; font-weight: 450; color: var(--muted); }
.mi-eg-pct { font-size: 11px; color: var(--muted); text-align: right; }
.mi-eg p { margin: 10px 0 0; font-size: 12.5px; }

/* the un-estimated nutrients, named but not drawn — see renderMicrosCard */
.mi-missing {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.mi-missing b {
  display: block;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.mi-gap {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}
@media (max-width: 360px) {
  .mi-row { grid-template-columns: 70px 1fr auto 30px; gap: 6px; }
  .mi-name { font-size: 11.5px; }
}
.p-micros { color: var(--accent); font-weight: 550; }

/* ---- Food log as a list ------------------------------------------------
   Replaces a ten-column table that could not fit a phone. Two lines per
   entry: name and calories on the first, meal/quantity and macros on the
   second, with the time in a fixed narrow column so every row shares a
   left edge to scan down. Nothing scrolls sideways. */
.log-list { display: flex; flex-direction: column; }
.log-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: start;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.log-row:last-child { border-bottom: 0; }
/* A meal group carries a bookmark as a third column. The row's own tap
   is destructive (delete), so the two targets must be visibly separate —
   the icon is quiet until touched, then takes the accent. */
.log-row.has-bookmark { grid-template-columns: 42px 1fr auto; }
.log-bookmark {
  align-self: center;
  display: flex;
  /* 11px around a 17px icon gives a 39px target inside a 57px row — the
     icon stays small and quiet while the thing you actually hit does
     not, which matters most on the phone where this lives. */
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.55;
}
.log-bookmark svg { width: 17px; height: 17px; }
.log-bookmark:hover { opacity: 1; color: var(--accent); }
.log-bookmark:active { transform: scale(0.9); }
.log-time {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.log-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.log-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.log-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  /* ellipsis rather than wrapping: a long food name must not turn one
     entry into three lines and push the rest of the day off screen */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.log-kcal {
  margin-left: auto;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.log-sub { font-size: 11.5px; color: var(--muted); }
.log-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.log-macros {
  margin-left: auto;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
/* the unit letters are the quiet half — the number is what is read */
.log-macros em { font-style: normal; color: var(--muted); }
.log-macros i { font-style: normal; color: var(--border); margin: 0 3px; }
.log-note {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 1px;
}
.log-resp {
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  padding-right: 8px;
}
.log-resp + .log-macros { margin-left: 0; }
/* a destructive control in the dialog, where the decision is already
   being made — the row keeps its width for the numbers instead */
.btn.danger {
  background: color-mix(in srgb, var(--over) 14%, transparent);
  color: var(--over);
  border: 1px solid color-mix(in srgb, var(--over) 32%, transparent);
  margin-right: auto;
}
.btn.danger.armed { background: var(--over); color: #fff; border-color: var(--over); }
.rm-tap { cursor: pointer; }
.log-total {
  border-top: 1.5px solid var(--border);
  border-bottom: 0;
  margin-top: 2px;
}
.log-total .log-title { font-weight: 700; }
.row-editable.log-row:hover .log-title {
  text-decoration: underline;
  text-underline-offset: 2px;
}
@media (max-width: 360px) {
  .log-row { grid-template-columns: 38px 1fr; gap: 6px; }
  .log-macros, .log-sub { font-size: 11px; }
}

/* An activity's earned macros sit where a food's eaten macros do, and
   must not be mistaken for them: the "+" and the accent say this WIDENS
   the day rather than spending it. */
.log-earned { color: var(--accent); }
.log-earned em { color: color-mix(in srgb, var(--accent) 62%, transparent); }
.log-earned i { color: color-mix(in srgb, var(--accent) 34%, transparent); }

/* ---- assistant photos (v0.6.17) ---------------------------------------
   A photo is an INPUT to an estimate: the pending image sits at the top
   of the composer's field so it is obvious the next send carries it, and
   the transcript keeps only a small thumbnail. (Since v0.6.73 the server
   also keeps each photo sent in the account's Saved photos.) */

/* Voice input (v0.6.43). Listening is the accent circle with a stop
   square, plus one ring that breathes outward — transform and opacity
   only, so it composites without repainting the panel, and it stops for
   anyone who asked for less motion. */
.assistant-mic { position: relative; }
.assistant-mic .mic-stop { display: none; width: 12px; height: 12px; }
.assistant-mic.listening {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.assistant-mic.listening .mic-glyph { display: none; }
.assistant-mic.listening .mic-stop { display: block; }
.assistant-mic.listening::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  pointer-events: none;
  animation: mic-breathe 1.6s ease-out infinite;
}
.assistant-mic.starting { opacity: 0.55; cursor: progress; }
@keyframes mic-breathe {
  from { transform: scale(0.92); opacity: 0.55; }
  to { transform: scale(1.32); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .assistant-mic.listening::after { animation: none; opacity: 0.35; }
}
.assistant-voice-note {
  margin: 0;
  padding: 6px 14px 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--over);
}
.assistant-voice-note.muted { color: var(--muted); }
.assistant-voice-note[hidden] { display: none; }
.assistant-attach {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.assistant-attach[hidden] { display: none; }
.attach-strip {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.attach-strip::-webkit-scrollbar { display: none; }
.attach-tile {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
}
.attach-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
/* The × sits on the tile's corner, a dark disc as on the reference. */
.attach-x {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.62);
  color: #fff;
  cursor: pointer;
}
.attach-x svg { width: 11px; height: 11px; }
/* a bigger target than it looks, for a thumb */
.attach-x::after { content: ""; position: absolute; inset: -6px; }
.attach-note {
  flex: 1 1 140px;
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
}

.assistant-msg-photo {
  display: block;
  width: 100%;
  max-width: 190px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.assistant-msg.user:has(.assistant-msg-photo) { padding: 6px 6px 8px; }
/* several photos in one message: a small grid, three across at most */
.assistant-msg-photos {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 4px;
  margin-bottom: 6px;
}
/* two, and four, sit two across */
.assistant-msg-photos:has(> :nth-child(2):last-child),
.assistant-msg-photos:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, 92px); }
.assistant-msg-photos .assistant-msg-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin: 0;
  border-radius: 8px;
}

/* The model's own follow-up questions: ONE horizontal row that scrolls,
   never a stack. Stacked, two long questions became a wall of text that
   read as a form to complete; in a row they read as options. */
.assistant-clarify {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 2px 0 6px;
  padding-bottom: 2px;
}
.assistant-clarify::-webkit-scrollbar { display: none; }
.clarify-chip {
  font: inherit;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  flex: 0 0 auto;
}
.clarify-chip:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }

/* A HELD proposal: the model's questions stand alone, the numbers wait.
   Showing an estimate next to a question means the question loses. */
/* Held: two routes of equal weight. The first version leaned on the
   questions — accent chips, a "One thing first" heading — and read as
   90% pressure to add context. Now the copy states the trade and both
   choices are one tap at the same size. */
.proposal.held { border-style: dashed; }
.proposal.held .held-lead {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--text-2);
}
.held-actions { display: flex; margin-top: 4px; }
.p-skip {
  font: inherit;
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
  cursor: pointer;
}
.p-skip:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }

/* One-tap recovery on a failed send. Retyping is annoying; re-taking a
   photo of a plate you have started eating may be impossible. */
.retry-btn {
  display: block;
  margin-top: 8px;
  font: inherit;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid currentColor;
  background: none;
  color: inherit;
  cursor: pointer;
}
.retry-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }

/* Portion scale. One handle for the whole meal, because a photo gets the
   food right and the amount roughly — and the honest fix for that is a
   control, not a paragraph. Exponential midpoint: "as estimated" is dead
   centre, so nudging is symmetric rather than biased upward. */
.p-scale { margin: 12px 0 2px; }
.p-scale-range {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  height: 22px;
}
.p-scale-legend {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--muted);
  margin-top: -2px;
}
.p-scale-val { font-size: 12px; color: var(--text-2); font-weight: 500; }
.p-scale-val.on { color: var(--accent); }
.proposal.resolved .p-scale { opacity: 0.5; }
/* A single food's portion (v0.6.115): the same slider, under Calories in
   the food editors, spanning the grid; its legend is a button that puts
   the numbers back as they opened. */
.form-grid .food-scale { grid-column: 1 / -1; margin: -2px 0 4px; }
.food-scale .p-scale-val {
  font: inherit; font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-2); background: none; border: 0; padding: 0 6px;
}
.food-scale .p-scale-val.on { color: var(--accent); cursor: pointer; }

/* Meal time. Same shape as the portion scale on purpose — they are the
   two corrections a proposal accepts, and they should read as one pair
   rather than two inventions. Offered only when the proposal holds a
   single meal; with two, a single handle could only flatten them. */
.p-time { margin: 14px 0 2px; }
.p-time-range {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  height: 22px;
}
.p-time-legend {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--muted);
  margin-top: -2px;
}
.p-time-val {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: none;
  border: 0;
  padding: 0 6px;
  cursor: default;
}
.p-time-val.on { color: var(--accent); cursor: pointer; }
.p-time-val.on:hover { text-decoration: underline; }
.p-time-note {
  margin: 10px 0 2px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}
.proposal.resolved .p-time { opacity: 0.5; }

/* Workout intensity (v0.6.137) — the third handle, under the gym
   session it belongs to, indented to the row's text like the sleep
   chips. The time slider's shape, so the three read as one family. */
.p-intensity { margin: 0 0 8px 33px; }
.p-int-range {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  height: 22px;
}
.p-int-legend {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--muted);
  margin-top: -2px;
}
.p-int-val {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: none;
  border: 0;
  padding: 0 6px;
  cursor: default;
}
.p-int-val.on { color: var(--accent); cursor: pointer; }
.p-int-val.on:hover { text-decoration: underline; }
.p-intensity.off, .proposal.resolved .p-intensity { opacity: 0.5; }

/* The grouped meal dialog reuses .p-scale / .p-time verbatim — the same
   correction, offered later, should look like the same correction. Only
   the spacing and the preview line are its own. */
#meal-dialog .dialog-note { margin: -6px 0 16px; }
#meal-dialog .p-scale { margin: 4px 0 2px; }
.meal-preview {
  margin: 18px 0 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.mp-kcal { display: block; font-size: 15px; }
.mp-kcal b { color: var(--text); font-weight: 650; }
.mp-macros { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }

/* ---- Coaching (knowledge/coaching-plan.md) --------------------------------
   The VIEW BAR says whose account this is while a coach views a client. It
   is sticky, glass like the tab bar, and wears the CLIENT's plan colour —
   the whole page does — so it can never be mistaken for one's own. */
.view-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: color-mix(in srgb, var(--surface) var(--glass-tint), transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: inset 0 -1px 0 var(--glass-shade);
}
.view-bar-in {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.view-who {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  font: inherit;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  text-align: left;
}
.view-who small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: none;
}
.view-who b {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.view-who svg { width: 15px; height: 15px; flex: none; align-self: center; color: var(--accent); }
.view-back {
  flex: none;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  color: var(--accent);
  background: none;
  border: none;
  padding: 6px 2px;
  cursor: pointer;
  white-space: nowrap;
}
.view-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  max-width: 420px;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
@media (min-width: 984px) { .view-menu { left: calc(50% - 468px); } }
.view-menu-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
}
.view-menu-item:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.view-menu-item b { font-weight: 600; font-size: 14px; }
.view-menu-item small { color: var(--muted); font-size: 12px; }
.view-menu-item.on b::after { content: " ✓"; color: var(--accent); }
.view-menu-foot { border-bottom: none; color: var(--accent); font-size: 13.5px; font-weight: 550; }
.view-menu-note { margin: 0; padding: 12px 14px; color: var(--muted); font-size: 13px; }

/* Read-only while viewing: the edit doors are closed (the server refuses
   them regardless). Rows and chips still READ — they just do not act. */
body.viewing .row-editable { cursor: default; }
body.viewing .state-chip:disabled { opacity: 1; cursor: default; }
body.viewing .state-chip:not(.on):hover { border-style: dashed; color: var(--muted); }
body.viewing #export-open,
body.viewing .plan-actions,
body.viewing .plan-new,
body.viewing .plan-empty .btn,
body.viewing .goal-line.actionable::after { display: none; }
body.viewing .goal-line.actionable { cursor: default; }
body.viewing .goal-line.actionable:active { transform: none; }

/* Account → Coaching */
.coach-share { margin: 2px 0 6px; }
.coach-lead { margin: 0 0 12px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.coach-hint { margin: 8px 0 10px; }
.coach-code {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}
/* A QR needs a light ground to scan — white in dark mode too. */
.coach-qr {
  flex: none;
  width: 112px;
  height: 112px;
  padding: 4px;
  border-radius: 10px;
  background: #fff;
}
.coach-qr svg { display: block; width: 100%; height: 100%; }
.coach-code-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.coach-code-text > small { color: var(--muted); font-size: 12px; }
.coach-code-val {
  font: 650 21px/1.15 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--text);
}
.coach-code-actions { display: flex; gap: 6px; margin-top: 6px; }
.coach-h {
  margin: 16px 0 4px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.coach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.coach-row:last-of-type { border-bottom: none; }
.coach-row > span:first-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.coach-row b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-row small { color: var(--muted); font-size: 12.5px; }
.coach-row-actions { display: flex; gap: 6px; flex: none; }
.coach-row { flex-wrap: wrap; }
/* sharing progress photos with one coach (v0.6.106) — a switch under the row */
.coach-photos, .health-app {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.coach-photos > span, .health-app > span { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; font-weight: 550; }
.coach-photos small, .health-app small { color: var(--muted); font-size: 12px; font-weight: 400; }
.coach-photos i, .health-app i {
  flex: none;
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  transition: background 0.2s ease;
}
.coach-photos i::after, .health-app i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.coach-photos[aria-checked="true"] i, .health-app[aria-checked="true"] i { background: var(--accent); }
.coach-photos[aria-checked="true"] i::after, .health-app[aria-checked="true"] i::after { transform: translateX(16px); }
.coach-photos:disabled, .health-app:disabled { opacity: 0.6; cursor: default; }
.coach-history { margin-top: 12px; font-size: 13px; }
.coach-history summary { cursor: pointer; color: var(--muted); font-weight: 550; }
.coach-history ul { list-style: none; margin: 8px 0 0; padding: 0; }
.coach-history li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.coach-history li:last-child { border-bottom: none; }
.coach-history li small { color: var(--muted); white-space: nowrap; }

/* the coach dashboard */
.coach-head { margin: 4px 0 18px; }
.coach-head h1 { margin: 6px 0 0; font-size: 24px; }
.coach-back { color: var(--accent); text-decoration: none; font-size: 14px; }
.coach-panel { padding: 16px 18px; margin-bottom: 12px; }
.coach-panel > b { display: block; font-size: 15px; margin-bottom: 8px; }
.coach-panel > p { margin: 0 0 10px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.coach-add { display: flex; gap: 8px; }
.coach-add input {
  flex: 1;
  min-width: 0;
  font: 600 17px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.coach-add input::placeholder { color: var(--muted); opacity: 0.6; }
.coach-error { margin: 8px 0 0; color: var(--over); font-size: 13.5px; }
.coach-suspended { border: 1px solid color-mix(in srgb, var(--over) 45%, var(--border)); }
.coach-reason {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
}
.coach-reason span {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.coach-reason p { margin: 4px 0 0; white-space: pre-wrap; }
/* a plan opened from the plan chip scrolls to its card — clear of the bar */
body.viewing [data-plan] { scroll-margin-top: calc(64px + env(safe-area-inset-top)); }
.coach-panel a.btn { display: inline-block; text-decoration: none; }

/* Account → Coaching → Become a coach (coach applications) */
.coach-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand); margin-right: 6px; vertical-align: 1px;
}
.apply { margin-top: 6px; }
.apply textarea {
  width: 100%; box-sizing: border-box;
  font-family: inherit; font-size: 15px; line-height: 1.4;
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  resize: vertical;
}
.apply textarea::placeholder { color: var(--muted); }
.apply-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.apply-row small { flex: 1; color: var(--muted); font-size: 12.5px; }
.apply-status {
  margin: 6px 0 2px; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.apply-status.apply-turn b,
.apply-status.apply-approved b { color: var(--brand); }
.apply-status.apply-declined b { color: var(--text-2); }
.apply-reason {
  margin: 6px 0 8px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 14px; line-height: 1.45; white-space: pre-wrap;
}
.apply-thread {
  display: flex; flex-direction: column; gap: 8px; margin: 10px 0;
  /* a chat: its own scroll, opening on the newest message */
  max-height: 340px; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--border);
}
.apply-thread .apply-msg { background: var(--surface); }
.apply-thread .apply-msg.you {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}
.apply-msg {
  max-width: 86%; padding: 8px 12px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--border);
}
.apply-msg.you {
  align-self: flex-end;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.apply-msg small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.apply-msg p { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
/* a chat field: one rounded box, the send button inside it */
.apply-reply {
  display: flex; gap: 6px; align-items: flex-end; margin-top: 8px;
  padding: 4px 4px 4px 14px; border-radius: 22px;
  background: var(--bg); border: 1px solid var(--border);
}
.apply-reply:focus-within { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); }
.apply .apply-reply textarea {
  flex: 1; min-width: 0; min-height: 0; height: 36px; max-height: 80px;
  padding: 7px 0; border: 0; border-radius: 0; background: transparent;
  resize: none; outline: none; overflow-y: hidden; line-height: 22px;
}
.apply-send {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  border: 0; background: var(--brand); color: var(--on-brand);
}
.apply-send:disabled { opacity: 0.45; cursor: default; }
#apply-letter { min-height: 170px; }
.apply-withdraw { flex: none; }
.apply .btn:disabled { opacity: 0.45; cursor: default; }

/* ---- the privacy policy (/privacy): a readable document -------------- */
.login-privacy { margin: 18px 0 0; font-size: 13px; }
.login-privacy a { color: var(--muted); }
.doc {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(48px + env(safe-area-inset-bottom));
  line-height: 1.6;
  font-size: 15.5px;
}
.doc h1 { font-size: 28px; margin: 8px 0 4px; }
.doc h2 { font-size: 19px; margin: 34px 0 8px; }
.doc h3 { font-size: 15.5px; margin: 20px 0 4px; }
.doc p, .doc li { color: var(--text-2); }
.doc b { color: var(--text); font-weight: 600; }
.doc ul { padding-left: 20px; margin: 8px 0; }
.doc li { margin: 6px 0; }
.doc a { color: var(--accent); }
.doc-back { margin: 0; font-size: 14px; }
.doc-back a { text-decoration: none; }
.doc-meta { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.doc-short {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 20px 10px;
  margin: 18px 0 8px;
}
.doc-short h2 { margin-top: 16px; }

/* ---- the welcome steps (v0.6.97; designed first screen v0.6.99) -------
   One step at a time, no tab bar; the answers are big tappable choices,
   the same ones Account → My setup shows. The first screen wears the
   BRAND, never a plan's accent — a new person has no plan yet, and the
   welcome is the app introducing itself. */
.welcome { max-width: 560px; margin: 0 auto; padding-top: 8px; }
.welcome h1 { font-size: 26px; margin: 18px 0 14px; letter-spacing: -0.01em; }
.welcome p { color: var(--text-2); line-height: 1.5; }
.welcome.is-intro .welcome-dots { visibility: hidden; }
.welcome-dots {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.welcome-dots li {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--grid);
  transition: background 0.25s ease;
}
.welcome-dots li.done, .welcome-dots li.on { background: var(--accent); }
.welcome-dots li.on { opacity: 0.55; }

.welcome-hero {
  margin: -8px -16px 0;
  padding: 34px 16px 22px;
  text-align: center;
  background: radial-gradient(closest-side at 50% 30%,
    color-mix(in srgb, var(--brand) 22%, transparent), transparent);
}
.welcome-logo {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 22px;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 40%, transparent),
    0 2px 6px rgba(0, 0, 0, 0.12);
}
.welcome-hero h1 { font-size: 32px; margin: 20px 0 8px; letter-spacing: -0.02em; }
.welcome .welcome-lead {
  max-width: 400px;
  margin: 0 auto;
  font-size: 17px;
  color: var(--text-2);
}
.welcome-features {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}
.welcome-features li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.welcome-features li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.welcome-features b { font-size: 15.5px; font-weight: 650; color: var(--text); }
.welcome-features li > span:last-child > span {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}
.welcome-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 13%, transparent);
}
.welcome-ic svg { width: 22px; height: 22px; }
.welcome-go { margin-top: 22px; }
.welcome-go .btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 650;
  border-radius: 14px;
}

.welcome-choices { display: grid; gap: 10px; margin: 6px 0 12px; }
.welcome-choices.compact { grid-template-columns: 1fr 1fr; gap: 8px; }
.welcome-choice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.welcome-choice b { font-size: 16px; font-weight: 650; }
.welcome-choice span { font-size: 14px; color: var(--text-2); line-height: 1.4; }
.welcome-choices.compact .welcome-choice { padding: 10px 12px; }
.welcome-choices.compact .welcome-choice b { font-size: 15px; }
.welcome-choices.compact .welcome-choice span { font-size: 13px; }
.welcome-choice.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.welcome-card {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  line-height: 1.45;
}
.welcome-body .goal-row { margin-top: 10px; padding-bottom: 0; }
.welcome-sub { font-size: 15px; margin: 20px 0 8px; }
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
.welcome-actions-end { display: flex; gap: 8px; margin-left: auto; }
.welcome-extra { margin-top: 18px; }
.welcome-extra h2 { font-size: 16px; margin: 0 0 4px; }
.welcome-extra p { margin: 0 0 8px; font-size: 14.5px; }
.welcome-extra textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  resize: vertical;
}
.welcome-extra textarea::placeholder { color: var(--muted); }
.welcome-extra textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.welcome-extra .linkish { margin-top: 6px; font-size: 14px; }

/* ---- every step wears the first screen's glow (v0.6.100, the owner:
   "more gradient around the next slides"). The brand runs to a violet
   blend (--welcome-to) on the page, the badges, the chosen answer and the
   buttons — scoped to /welcome, so My setup keeps the plan's accent. */
:root { --welcome-to: #a957ad; }
@media (prefers-color-scheme: dark) { :root { --welcome-to: #c785ca; } }
body[data-page="welcome"] {
  min-height: 100vh;
  background:
    radial-gradient(90% 50% at 50% 0%,
      color-mix(in srgb, var(--brand) 24%, transparent), transparent 75%),
    radial-gradient(70% 45% at 100% 100%,
      color-mix(in srgb, var(--welcome-to) 22%, transparent), transparent 75%),
    radial-gradient(55% 40% at 0% 60%,
      color-mix(in srgb, var(--brand) 12%, transparent), transparent 75%),
    var(--bg);
  background-attachment: fixed;
}
.welcome-head { margin: 22px 0 18px; text-align: center; }
.welcome-badge {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--welcome-to));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 35%, transparent);
}
.welcome-badge svg { width: 28px; height: 28px; }
.welcome .welcome-step-no {
  margin: 14px 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
}
.welcome-head h1 { margin: 2px 0 6px; font-size: 27px; }
.welcome .welcome-head .welcome-lead { max-width: 440px; font-size: 15.5px; }
.welcome .welcome-choice {
  position: relative;
  padding-right: 46px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.welcome .welcome-choice:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
}
.welcome .welcome-choice.on {
  border-color: transparent;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)),
      var(--surface)) padding-box,
    linear-gradient(135deg, var(--brand), var(--welcome-to)) border-box;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 20%, transparent);
}
.welcome .welcome-choice.on::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--welcome-to));
}
.welcome .welcome-choices.compact .welcome-choice { padding-right: 36px; }
.welcome .welcome-choices.compact .welcome-choice.on::after {
  top: 9px; right: 9px; width: 19px; height: 19px; font-size: 11px;
}
.welcome .welcome-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.welcome .welcome-card.welcome-extra { margin-top: 14px; }
.welcome .welcome-card.welcome-extra .hint { margin: 0; }
.welcome .btn.primary {
  border: 0;
  color: var(--on-brand);
  background: linear-gradient(135deg, var(--brand), var(--welcome-to));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 30%, transparent);
}
.welcome .btn.primary:disabled { opacity: 0.45; box-shadow: none; filter: saturate(0.5); }
.welcome-dots li.done, .welcome-dots li.on {
  background: linear-gradient(90deg, var(--brand), var(--welcome-to));
}

/* each step arrives with a short rise; the intro's cards one after another */
.welcome-step.enter > * { animation: welcome-in 0.32s ease both; }
.welcome-step.enter .welcome-features li { animation: welcome-in 0.4s ease both; }
.welcome-step.enter .welcome-features li:nth-child(2) { animation-delay: 0.06s; }
.welcome-step.enter .welcome-features li:nth-child(3) { animation-delay: 0.12s; }
.welcome-step.enter .welcome-features li:nth-child(4) { animation-delay: 0.18s; }
@keyframes welcome-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-step.enter > *, .welcome-step.enter .welcome-features li { animation: none; }
}
#setup-content .welcome-choice { padding: 11px 14px; }
#setup-content .welcome-choice b { font-size: 15px; }

/* ---- Progress photos on a plan's page (v0.6.103) — the week's cover of
   slashes (one per filled slot, front first, each showing the middle of
   its photo), the four slots under it, and on All every week's cover.
   The plan's accent with the brand's violet blend, as the welcome. ---- */
.pp-card { padding-bottom: 14px; }
.pp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.pp-head h2 { margin-bottom: 10px; }
.pp-count { color: var(--muted); font-size: 13px; }
.pp-cover {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(240px, 72vw, 400px);
  border-radius: 18px;
  overflow: hidden;
  background: var(--grid);
  margin-bottom: 12px;
}
.pp-slice {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  animation: pp-in 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 80ms);
}
.pp-slice img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}
.pp-slice:hover img { transform: scale(1.04); }
@keyframes pp-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
}
.pp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  font: inherit;
  color: #fff;
  cursor: pointer;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, #fff 22%, transparent), transparent 55%),
    linear-gradient(135deg, var(--accent), var(--welcome-to, #a957ad));
}
.pp-empty b { font-size: 17px; }
.pp-empty small { opacity: 0.85; font-size: 13px; }
.pp-empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.2);
  margin-bottom: 4px;
}
.pp-empty-icon svg { width: 30px; height: 30px; }
.pp-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.pp-slot {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--grid);
  cursor: pointer;
  font: inherit;
}
.pp-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-slot span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 7px 5px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.pp-slot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--accent);
}
.pp-slot-empty i { font-style: normal; font-size: 24px; line-height: 1; }
/* A photo waiting to upload (v0.6.107, the outbox): its preview, a little
   dimmed, with a badge saying so — red once the server refused it. */
.pp-slot-queued img { opacity: 0.78; }
.pp-slot-queued em {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  padding: 3px 5px;
  border-radius: 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pp-slot-queued.pp-trouble em { background: color-mix(in srgb, var(--over) 85%, #000); }
.pp-slot-empty span {
  position: static;
  padding: 0 4px;
  background: none;
  color: var(--text-2);
  text-align: center;
  font-weight: 500;
}
.pp-extra { margin: 10px 2px 0; }
/* a coach's read-only view (v0.6.106): placeholders that do nothing */
.pp-still { cursor: default; }
.pp-cover.pp-still { opacity: 0.75; }
.pp-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.pp-week {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.pp-week-cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--grid);
}
.pp-week-cover .pp-slice { cursor: pointer; }
.pp-week-empty {
  border: 1.5px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.pp-week-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6px;
  padding: 0 2px;
}
.pp-week-line small { color: var(--muted); font-size: 12px; }

/* adding one: what was picked, its day, Save */
.pp-add img {
  display: block;
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  border-radius: 12px;
  background: var(--grid);
  margin-bottom: 12px;
}
.pp-outbox-day { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.pp-add-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
  margin-bottom: 8px;
}
.pp-add-date input, .pp-view-bar input {
  font: inherit;
  font-size: 16px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}

/* the viewer: the photo full screen, on black */
dialog.pp-view {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 0 calc(env(safe-area-inset-bottom) + 10px);
  border-radius: 0;
  background: #000;
  color: #fff;
}
dialog.pp-view[open] { display: flex; flex-direction: column; }
dialog.pp-view::backdrop { background: #000; }
.pp-view-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
}
.pp-view-title span { color: rgba(255, 255, 255, 0.65); margin-left: 6px; }
.pp-view-close {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.pp-view-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pp-view-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pp-view-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}
#pp-view-prev { left: 10px; }
#pp-view-next { right: 10px; }
.pp-view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 0;
}
.pp-view-bar label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pp-view-bar input { background: #1a1a1a; color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.pp-view-actions { display: flex; gap: 8px; }
.pp-view-day { font-size: 14px; color: rgba(255, 255, 255, 0.8); }
.pp-view .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* Compare (v0.6.104): two weeks side by side, one slot at a time, on the
   viewer's black */
.pp-head-end { display: flex; align-items: baseline; gap: 10px; }
.pp-compare-open {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.pp-cmp-slots {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 16px 12px;
  scrollbar-width: none;
}
.pp-cmp-slots::-webkit-scrollbar { display: none; }
.pp-cmp-slot {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.pp-cmp-slot.on { background: #fff; color: #000; font-weight: 600; }
.pp-cmp-slot:disabled { opacity: 0.35; cursor: default; }
.pp-cmp-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  padding: 0 6px;
}
.pp-cmp-side {
  margin: 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pp-cmp-week {
  align-self: center;
  max-width: 100%;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 30px 6px 14px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.12)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 12px center / 11px 8px;
  cursor: pointer;
}
.pp-cmp-week option { color: #000; }
.pp-cmp-pic {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  background: #121212;
}
.pp-cmp-pic img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: pp-fade 0.3s ease;
}
@keyframes pp-fade { from { opacity: 0; } }
.pp-cmp-none {
  padding: 12px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  text-align: center;
}
.pp-cmp-side figcaption {
  min-height: 1.3em;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .pp-slice, .pp-cmp-pic img { animation: none; }
}

/* Account → Language (v0.6.108): a select that sits where the chevron does */
.profile-row-pick { cursor: pointer; }
.profile-pick {
  font: inherit; color: var(--text); background: transparent;
  border: 1px solid var(--line, rgba(127, 127, 127, 0.35)); border-radius: 10px;
  padding: 6px 10px; max-width: 46%;
}

/* Log sleep (v0.6.118): the meal time's slider, twice, each with its
   time typed in its own head — a nap or a 05:00 night is typed, the
   sliders cover the nights people have. The total sits on top as the
   one figure the two handles decide. */
#sleep-add { white-space: nowrap; }
.sleep-log-total {
  margin: -4px 0 12px;
  font-size: 22px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sleep-log-total small { font-size: 13px; font-weight: 500; color: var(--muted); }
.sleep-slide { margin: 0 0 14px; }
.sleep-slide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.sleep-slide-head input[type="time"] {
  width: auto;
  padding: 3px 6px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#sleep-log-dialog .form-grid { margin-top: 4px; }
#sleep-log-dialog .dialog-note.warn { color: var(--amber); }

/* Food from Apple Health (v0.6.120) — the group's mark, Today's "count
   this app?" line, the read-only sheets and Account's app switches */
.log-health { color: #ff2d55; font-size: 12px; margin-left: 4px; }
.health-ask {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 13.5px;
}
.health-ask > span { flex: 1 1 200px; }
.health-ask .btn { flex: none; }
#meal-form.mirrored .p-scale, #meal-form.mirrored .p-time,
#meal-form.mirrored #meal-preview, #meal-form.mirrored #meal-del,
#meal-form.mirrored #meal-save { display: none; }
.health-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px; margin: 10px 0; }
.health-nums div { display: flex; flex-direction: column; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; }
.health-nums b { font-size: 16px; }
.health-nums small { color: var(--muted); font-size: 12px; }
.health-app { flex-basis: auto; width: 100%; margin-top: 8px; }
#meal-hide { display: none; }
#meal-form.mirrored #meal-hide { display: inline-flex; }
/* other apps' data the person hid (v0.6.125): one quiet line, a list
   with Restore — shaded, never outlined */
.health-hidden { margin: 8px 0 0; font-size: 12.5px; color: var(--muted);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent); cursor: pointer; font-weight: 550; }
.health-hidden-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.health-hidden-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 12px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.health-hidden-row > span { flex: 1; display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.health-hidden-row small { color: var(--muted); font-size: 12px; }
/* Account → Apple Health (v0.6.125): a kind per block — counted from, its
   apps, each with Remove */
.health-kind { margin-top: 14px; }
.health-kind h4 { margin: 0 0 4px; font-size: 13px; font-weight: 650; }
.health-since { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); }
.health-app-row { display: flex; align-items: center; gap: 8px; }
.health-app-row .health-app { flex: 1; }
.health-app-row .btn { flex: none; margin-top: 8px; }
.health-since-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.health-since-preview { font-size: 13px; min-height: 2.6em; }

/* Supplements (v0.6.121) — a card of their own: ONE row that scrolls
   sideways, a block per supplement. A block is two targets kept apart: the
   body opens its sheet, the + logs a dose. Compact inner tiles with NO
   outline (v0.6.123, the borderless rule): not taken is the house's flat
   tile shade; taken is the accent tint, lifted by a soft accent shadow and
   counting ("2× today"); one logged just for this day (not on the list)
   carries a small calendar mark — it was a dashed edge. */
.supp-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* the row bleeds to the card's edges so a half-seen block says "scroll";
     the vertical room keeps a taken block's shadow inside the clip */
  margin: -4px -16px -2px;
  padding: 6px 16px 8px;
}
.supp-row::-webkit-scrollbar { display: none; }
.supp-block {
  position: relative;
  flex: 0 0 auto;
  width: 132px;
  min-height: 92px;
  display: flex;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  scroll-snap-align: start;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.supp-block.taken {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 22%, transparent);
}
.supp-once {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 11px;
  height: 11px;
  color: var(--muted);
  pointer-events: none;
}
.supp-block.once .supp-name { padding-right: 12px; }
.supp-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 10px;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 12px;
}
.supp-name {
  /* two lines, then an ellipsis: "Magnesium glycinate" fits, a paragraph
     does not push the row taller */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 650;
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
/* the maker, when one was named: one small quiet line under the name */
.supp-brand {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--muted);
}
.supp-dose { font-size: 11.5px; color: var(--text-2); }
.supp-state {
  margin-top: auto;
  padding-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.supp-block.taken .supp-state { color: var(--accent); font-weight: 600; }
.supp-state b { font-size: 13px; }
/* bottom-right, beside the count: the name keeps the block's whole width */
.supp-plus {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
}
/* a 44 px target around the 26 px disc */
.supp-plus::before { content: ""; position: absolute; inset: -9px; }
.supp-plus:active { transform: scale(0.92); }
.supp-plus:disabled { opacity: 0.5; }
.supp-panel .empty { margin: 0; }
/* the food log's one line for the day's doses, above the total */
.log-supps .log-title { color: var(--text-2); font-weight: 600; }
/* the block's sheet */
#supp-dialog .dialog-note { margin: -6px 0 6px; }
.supp-doses-head { margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
#supp-dialog .saved-food:disabled { cursor: default; opacity: 1; }
.supp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.supp-actions .btn { flex: 1 1 auto; }
.supp-actions .btn.primary { flex-basis: 100%; }
.supp-actions .btn.danger { color: var(--over); border-color: var(--over); }
#supp-edit-dialog input:disabled, #supp-edit-dialog select:disabled { opacity: 0.6; }
#supp-edit-dialog .hint { margin: 10px 0 0; }
/* a proposal's supplement rows */
.p-section-title {
  margin: 6px 6px 2px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.p-supp-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 2px 0 8px 33px;
}
.p-supp-match {
  flex-basis: 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.p-supp-match.new { color: var(--muted); }
/* a supplement's name and its dose may take two lines: the name is how
   the person recognises it, the dose is what the row will log */
.proposal-row[data-kind="supplement"] > .p-name,
.proposal-row[data-kind="supplement"] > .p-meta {
  white-space: normal;
  overflow-wrap: anywhere;
}
#supp-dialog .health-nums { grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); }
#supp-dialog .hint { margin: 0 0 4px; }


/* Water (v0.6.124) — a quiet card: the day's total against the served
   target on one bar, the quick taps, and the drinks in a row that scrolls
   sideways like the supplement blocks. Borderless (shade, never an
   outline); its own blue, so it never reads as the plan's accent. */
.water-panel .panel-head { align-items: baseline; }
.water-total {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.water-total b { color: var(--text); font-size: 15px; }
.water-bar {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--water) 14%, transparent);
  overflow: hidden;
}
.water-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--water);
  transition: width 0.35s ease;
}
.water-bar.met .water-fill { background: color-mix(in srgb, var(--water) 80%, var(--green)); }
.water-target {
  margin: 6px 0 10px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.water-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.water-quick {
  background: color-mix(in srgb, var(--water) 14%, var(--surface));
  color: var(--text);
  border: none;
  font-weight: 600;
}
.water-quick:hover { background: color-mix(in srgb, var(--water) 22%, var(--surface)); }
.water-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 2px 16px 4px;
}
.water-row::-webkit-scrollbar { display: none; }
.water-drink {
  flex: 0 0 auto;
  min-width: 84px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 10px;
  border: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.water-drink:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.water-ml { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.water-ml small { font-size: 11px; font-weight: 600; color: var(--text-2); }
.water-name { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.water-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.water-panel .empty { margin: 0; }
.water-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 2px;
}
.water-sizes .chip {
  border: none;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
}
.water-sizes .chip:hover { background: color-mix(in srgb, var(--water) 18%, transparent); }

/* Account → Preferences (v0.6.124): the switches reuse the Apple Health
   card's switch rows; the water target sits under its switch. */
.prefs-water { margin-top: 14px; }
.prefs-target {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.prefs-target span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.prefs-target small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.prefs-target input {
  width: 96px;
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.prefs-target-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* Analytics → Water (v0.6.124): when in the day the water came, one bar in
   three shades of the water blue, and each day's bar against its target. */
.wh-tiles { margin-top: 10px; }
.wh-tiles .stat-value em { font-style: normal; font-size: 0.6em; color: var(--muted); }
.wh-parts { margin: 12px 0 4px; }
.wh-parts-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--water) 12%, transparent);
}
.wh-parts-bar i { display: block; height: 100%; }
.wh-part-0 { background: color-mix(in srgb, var(--water) 55%, var(--surface)); }
.wh-part-1 { background: var(--water); }
.wh-part-2 { background: color-mix(in srgb, var(--water) 70%, var(--text)); }
.wh-parts-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.wh-parts-legend span { display: inline-flex; align-items: center; gap: 5px; }
.wh-parts-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
#water-history-card .mb-track i { background: var(--water); }
#water-history-card .mb-track.met i { background: color-mix(in srgb, var(--water) 80%, var(--green)); }
.wh-more { margin-top: 8px; }

/* Apple Health beside the logged burn and nights (v0.6.126): quiet lines —
   active energy is shown, never counted; a typed night shows Health's */
.health-energy, .sleep-health-line { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---- Workouts & recovery (v0.6.128; Home + sheet v0.6.132) ---------- */
.workouts-panel .panel-head { align-items: center; }
/* Home: one list by muscle — name, a slim bar (full = ready), %, when */
.rc-list { display: flex; flex-direction: column; }
.rc-row {
  display: grid; grid-template-columns: minmax(84px, 30%) 1fr auto; align-items: center; gap: 10px;
  width: 100%; padding: 7px 0; border: 0; border-top: 1px solid var(--border);
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.rc-row:first-child { border-top: 0; padding-top: 2px; }
.rc-row:hover .rc-row-name { color: var(--accent); }
.rc-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.rc-row-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; min-width: 0;
  display: flex; flex-direction: column; overflow: hidden; }
.rc-row-name small { font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.rc-bar { display: block; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.rc-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.3s ease; }
.rc-row-end { display: flex; flex-direction: column; align-items: flex-end; min-width: 64px;
  font-variant-numeric: tabular-nums; }
.rc-row-end b { font-size: 13px; font-weight: 600; }
.rc-row-end small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.rc-row.ready .rc-row-end small { color: var(--green); }
.rc-fresh { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }
.rc-sleep { margin: 6px 0 0; font-size: 11.5px; color: var(--text-2); }

/* the sheet: a row opened */
.rc-dialog { width: min(560px, calc(100vw - 32px)); }
.rc-d-head { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2); margin: 2px 0 12px; }
.rc-d-head b { font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.rc-d-head .rc-bar { height: 8px; border-radius: 4px; }
.rc-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.rc-tile { background: var(--bg); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.rc-tile small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.25; }
.rc-tile b { display: block; font-size: 14px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.rc-seg.k-anabolic, .rc-key.k-anabolic { background: var(--accent); }
.rc-seg.k-sleep, .rc-key.k-sleep { background: color-mix(in srgb, var(--accent) 50%, #fff); }
.rc-seg.k-awake, .rc-key.k-awake { background: var(--grid); }
.rc-seg.ahead { opacity: 0.45; }
.rc-key.k-ahead { background: repeating-linear-gradient(90deg, var(--accent) 0 3px, transparent 3px 5px); opacity: 0.6; }
.rc-key.k-mark { width: 0; height: 0; border-radius: 0; border-left: 5px solid transparent;
  border-right: 5px solid transparent; border-bottom: 8px solid var(--text); }
.rc-tl { margin: 0 0 6px; }
.rc-tl-ticks { position: relative; height: 15px; }
.rc-tl-ticks em { position: absolute; top: 0; font-style: normal; font-size: 10.5px; color: var(--muted);
  padding-left: 3px; border-left: 1px solid var(--grid); height: 15px; white-space: nowrap; }
.rc-tl-line { position: relative; height: 22px; border-radius: 5px; background: var(--bg); margin-bottom: 9px; }
.rc-tl-line i { position: absolute; top: 0; bottom: 0; display: block; }
.rc-done { width: 2px; background: var(--accent); }
.rc-done::after { content: "✓"; position: absolute; left: 4px; top: 3px; font-size: 12px;
  font-style: normal; color: var(--accent); }
.rc-now { width: 1.5px; top: -3px !important; bottom: -3px !important; background: var(--over); }
.rc-mark { position: absolute; bottom: -9px; margin-left: -5px; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--text); }
.rc-legend { margin: 6px 0 0; font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.rc-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 4px; }
.rc-note { margin: 10px 0 0; font-size: 12px; color: var(--text-2); line-height: 1.45; }
.rc-h { margin: 16px 0 6px; font-size: 13px; }
.rc-days { display: flex; flex-direction: column; gap: 2px; }
.rc-day { display: grid; grid-template-columns: 40px 1fr 46px; align-items: center; gap: 4px 8px;
  padding: 5px 0; border-top: 1px solid var(--border); }
.rc-day:first-child { border-top: 0; }
.rc-day-name { font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; line-height: 1.15; }
.rc-day-name small { font-size: 10.5px; font-weight: 400; color: var(--muted); }
.rc-day.ahead .rc-day-name { color: var(--muted); }
.rc-day-bar { display: flex; height: 10px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.rc-day-bar i { display: block; height: 100%; }
.rc-day-pct { font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.rc-day-hours, .rc-day-sleep { grid-column: 2 / 4; font-size: 11px; color: var(--muted); }
.rc-day-sleep { color: var(--text-2); font-weight: 600; }
.rc-day-sleep small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.rc-sess { border-top: 1px solid var(--border); padding: 8px 0 4px; }
.rc-sess:first-of-type { border-top: 0; }
.rc-sess p { margin: 0 0 4px; display: flex; flex-direction: column; }
.rc-sess p b { font-size: 13.5px; }
.rc-sess p small, .rc-sess li small { font-size: 11px; color: var(--muted); }
.rc-sess ul { list-style: none; margin: 0; padding: 0 0 0 10px; border-left: 2px solid var(--grid); }
.rc-sess li { display: flex; flex-direction: column; padding: 3px 0; }
.rc-sess li b { font-size: 12.5px; font-weight: 600; }
/* Analytics → Training (v0.6.133) */
.tr-line { margin: -6px 0 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.tr-line:empty { display: none; }
.tr-h { margin: 14px 0 6px; font-size: 13px; }
.tr-muscle { cursor: default; grid-template-columns: 1fr auto; }
.tr-muscle .mb-val { font-variant-numeric: tabular-nums; }
.tr-track { position: relative; overflow: hidden; height: 8px; }
.tr-track .tr-band { position: absolute; top: 0; bottom: 0; display: block;
  background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tr-track i { position: relative; }
.tr-note { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.tr-list { display: flex; flex-direction: column; }
.tr-sess { border-top: 1px solid var(--border); }
.tr-sess:first-child { border-top: 0; }
.tr-sess-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 0; border: 0; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer; }
.tr-sess-row:hover .mb-name b { color: var(--accent); }
.tr-earlies { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; flex: none; max-width: 45%; }
.tr-early { font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--text-2); white-space: nowrap; }
.tr-more { padding: 0 0 10px 10px; border-left: 2px solid var(--grid); margin-bottom: 8px; }
.tr-more p { margin: 0 0 4px; font-size: 12px; color: var(--text-2); }
.tr-more ul { list-style: none; margin: 0; padding: 0; }
.tr-more li { display: flex; flex-direction: column; padding: 2px 0; }
.tr-more li b { font-size: 12.5px; font-weight: 600; }
.tr-more li small { font-size: 11px; color: var(--muted); }
.rc-all { font-size: 12.5px; white-space: nowrap; }

.rc-edit { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px 12px; margin: 10px 0; }
.rc-edit legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
.rc-muscle-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-exercises { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.rc-ex { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; border-radius: 10px; background: var(--bg); }
.rc-ex-name { min-width: 0; font-size: 13.5px; font-weight: 600; display: flex; flex-direction: column; }
.rc-ex-name small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.rc-ex-sets { display: flex; align-items: center; gap: 4px; flex: none; font-size: 13px; }
.rc-ex-sets b { min-width: 1.4em; text-align: center; }
.rc-ex-sets small { color: var(--muted); }
.rc-chip small { margin-left: 2px; opacity: 0.8; }



/* Workouts & recovery levels (v0.6.134, recovery_levels.py) — Basic's
   pills and session rows, the rings of the three things that move
   recovery (Medium and Expert), the tip, Medium's sheet story */
.rc-ready { margin: 0 0 8px; font-size: 13px; line-height: 1.4; color: var(--text-2); }
.rc-ready b { color: var(--green); margin-right: 4px; }
.rc-sub { margin: 10px 0 2px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; }
.rc-row.basic, .rc-srow { grid-template-columns: 1fr auto; }
.rc-srow { display: grid; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--grid); }
.rc-srow:first-child { border-top: 0; }
.rc-srow .rc-row-name small { white-space: normal; }
.rc-pill { justify-self: end; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  white-space: nowrap; background: var(--bg); color: var(--text-2); }
.rc-pill.s-ready { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.rc-pill.s-soon { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.rc-words { font-size: 12px !important; font-weight: 600; color: var(--text-2) !important; }
.rc-row.ready .rc-words { color: var(--green) !important; }
.rc-row.plain .rc-row-end { min-width: 92px; }
.rc-helpers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
.rc-help { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  background: var(--bg); border-radius: 12px; padding: 10px 6px; min-width: 0; --st: var(--muted); }
.rc-help.st-good { --st: var(--green); }
.rc-help.st-ok { --st: var(--amber); }
.rc-help.st-low { --st: var(--over); }
.rc-ring { position: relative; width: 40px; height: 40px; border-radius: 50%;
  background: conic-gradient(var(--st) calc(var(--fill) * 1%), var(--grid) 0); }
.rc-ring i { position: absolute; inset: 5px; border-radius: 50%; background: var(--bg); }
.rc-help-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rc-help-text small { font-size: 10.5px; color: var(--muted); }
.rc-help-text b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rc-help-text em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--st); }
.rc-tip { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.4;
  color: var(--text); background: color-mix(in srgb, var(--accent) 9%, transparent); }
/* Today's short card (v0.6.139): one button — ready to train, a line per
   ready time (a pill and its muscles), the tip; the detail is #rc-over */
.rc-sum { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 0; margin: 0;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.rc-sum-ready { font-size: 13.5px; line-height: 1.4; color: var(--text); }
.rc-sum-ready b { color: var(--green); margin-right: 4px; }
.rc-sum-wait { display: grid; grid-template-columns: max-content 1fr; align-items: center; gap: 8px 10px; }
.rc-sum-wait .rc-pill { justify-self: start; }
.rc-sum-who { font-size: 13.5px; line-height: 1.35; color: var(--text); min-width: 0; }
.rc-sum .rc-tip { display: block; margin: 2px 0 0; }
button.rc-all { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; cursor: pointer; }
.rc-over-foot { margin: 14px 0 0; }
.rc-b-head { display: flex; margin: 2px 0 6px; }
.rc-b-head .rc-pill { font-size: 15px; padding: 6px 14px; }
.rc-when { margin: -6px 0 4px; font-size: 12px; color: var(--muted); }
.rc-story { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rc-story li { position: relative; padding-left: 20px; font-size: 12.5px; line-height: 1.4; color: var(--text); }
.rc-story li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.rc-story li.tone-good::before { content: "↑"; color: var(--green); }
.rc-story li.tone-slow::before { content: "↓"; color: var(--amber); }
.rc-story li.tone-info::before { content: "•"; color: var(--muted); }
.prefs-detail { display: flex; flex-direction: column; gap: 8px; padding: 10px 0 4px; border-top: 1px solid var(--border); }
.prefs-detail-text { display: flex; flex-direction: column; gap: 2px; }
.prefs-detail-text b { font-size: 14px; }
.prefs-detail-text small, .prefs-detail-note { font-size: 12px; color: var(--muted); line-height: 1.4; }
.prefs-detail .seg { align-self: flex-start; }
