/* tokens.css */
/* Obsidian surfaces, electric actions, acid progress; small accent text uses a lighter tint. */
:root {
  --surface: #0b0d10;      /* deep charcoal */
  --surface-2: #14171c;    /* sheet and card ground, one step lighter */
  --ink: #ececec;
  --ink-2: #acacae;
  --ink-3: #77777a;
  --ink-note: #939395;
  --rule: #30353e;         /* card and control boundaries */
  --accent: #843dff;
  --accent-deep: #5f2fe0;
  --accent-text: #bb9aff;
  --accent-wash: #31274f;
  --on-accent: #ffffff;
  --accent-2: #c6ff00;
  --macro-p: var(--accent);
  --protein-overflow: var(--accent);
  --macro-c: var(--accent);
  --macro-f: var(--accent);
  --track: var(--rule);
  /* The macro colours of the serving page's donut. */
  --macro-protein: var(--accent); --macro-carbs: var(--accent-2); --macro-fat: var(--ink-2);

  --font-display: "Albert Sans", sans-serif;
  --font-body: "Albert Sans", sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --w-body: 400; --w-strong: 600; --tracking: 0em;

  --t-xs: 0.8rem;    /* 12.8 px, mono captions only */
  --t-s: 1rem;       /* 16 px body */
  --t-m: 1.25rem;    /* 20 px section heads, numbers in cards */
  --t-l: 1.5625rem;  /* 25 px screen titles */
  --t-xl: 3rem;      /* 48 px kcal left */

  --r-row: 0;        /* rows, bars, chart frames */
  --r-control: 6px;  /* buttons, chips, inputs */
  --r-sheet: 14px;   /* top corners of sheets */
  --r-tile: 10px;    /* Today dashboard chips and the Log food button */
  --r-card: 14px;    /* Today dashboard cards and the tab bar */
  --r-pill: 999px;   /* the phase pill */
  --gutter: 16px;
  /* Native controls (checkboxes, spinners, date pickers) are drawn dark to match. */
  color-scheme: dark;
  /* Checkboxes and the text-size slider take the accent. */
  accent-color: var(--accent);
}
body { background: var(--surface); color: var(--ink); font: var(--w-body) var(--t-s)/1.45 var(--font-body);
       letter-spacing: var(--tracking); }
.num { font-family: var(--font-num); font-feature-settings: "tnum" 1; }
@font-face { font-family: "Fraunces"; src: url("/static/fonts/fraunces-latin-standard-normal.woff2?v=1b37424") format("woff2");
  font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Albert Sans"; src: url("/static/fonts/albert-sans-latin-wght-normal.woff2?v=1b37424") format("woff2");
  font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2?v=1b37424") format("woff2");
  font-weight: 100 800; font-display: swap; }
h1, h2, .display { font-family: var(--font-display); font-optical-sizing: auto; font-weight: 600; }

@font-face { font-family: "Chakra Petch"; src: url("/static/fonts/chakra-petch-latin-400-normal.woff2?v=1b37424") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/static/fonts/chakra-petch-latin-500-normal.woff2?v=1b37424") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/static/fonts/chakra-petch-latin-600-normal.woff2?v=1b37424") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("/static/fonts/chakra-petch-latin-700-normal.woff2?v=1b37424") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap; }

/* app.css */
* { box-sizing: border-box; }
/* Components below set display: grid/flex, which would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
body { padding: env(safe-area-inset-top) var(--gutter) calc(72px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
h1 { font-size: var(--t-l); margin: 12px 0 8px; }
h2 { font-size: var(--t-m); margin: 20px 0 8px; }
p { max-width: 34rem; }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-xs); }
.big { font-family: var(--font-display); font-size: var(--t-xl); line-height: 1; letter-spacing: -0.01em; }
.over { color: var(--accent-text); }
/* Under the day's target with room left: the second accent. */
.left-ok { color: var(--accent-2); }
.credit { font-size: var(--t-xs); color: var(--ink-2); }
.credit p, .credit li { margin: 4px 0; }
.credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credit li > a:only-child { display: inline-block; min-height: 24px; padding-block: 3px; }   /* a link on its own line is a 24 px target */
.rule { display: block; width: 100%; height: 6px; margin: 14px 0; color: var(--rule); }
.row { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-radius: var(--r-row); }
.row + .row { border-top: 1px solid var(--rule); }
.grow { flex: 1; min-width: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
button, input, select { font: inherit; color: inherit; }
.btn { min-height: 44px; padding: 0 14px; border: 1px solid var(--ink-3); border-radius: var(--r-control);
  background: transparent; }
/* The one gradient in the app: the accent to its deeper stop, on the primary button and the + tab. */
.btn-primary, .tabbar .plus span { background: linear-gradient(180deg, var(--accent), var(--accent-deep)); }
.btn-primary { color: var(--on-accent); border-color: var(--accent); font-weight: var(--w-strong); }
.chip { min-height: 36px; padding: 0 10px; border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--surface-2); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
/* Quiet words inside a picked chip stay white on the accent. */
.chip[aria-pressed="true"] :is(.muted, .num, .small) { color: inherit; }
input[type="text"], input[type="number"], input[type="password"], input[type="time"], input[type="date"], input[type="search"] {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--ink-3); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink); font-size: max(16px, 1rem); }
/* A native select in WebKit paints a light menulist under the dark ink, so selects draw their own box. */
/* The arrow is drawn in --ink-2; a custom property cannot reach inside a data URL. */
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23acacae' stroke-width='1.5'/%3E%3C/svg%3E"); }
select { min-height: 44px; padding: 0 32px 0 12px; border: 1px solid var(--ink-3); border-radius: var(--r-control);
  background: var(--surface) var(--chevron) no-repeat right 12px center; color: var(--ink); font-size: max(16px, 1rem);
  -webkit-appearance: none; appearance: none; max-width: 100%; }
option { background: var(--surface-2); color: var(--ink); }
/* Fields take the same accent ring as every other control instead of the browser's own. */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
/* WebKit on iOS gives time and date fields a native minimum width wider than a phone column
   ("10:30 PM" plus padding), so width: 100% alone lets them run off the right edge. */
input[type="time"], input[type="date"] { display: block; max-width: 100%; min-width: 0; -webkit-appearance: none; appearance: none;
  line-height: 42px; }
input[type="time"]::-webkit-date-and-time-value, input[type="date"]::-webkit-date-and-time-value { margin: 0; text-align: left; }
label { display: block; margin: 12px 0 4px; color: var(--ink-2); }
/* US / Metric. The picked side is filled with the accent and set in the strong weight, so it reads without colour too. */
.segmented { display: inline-flex; margin: 12px 0 4px; border: 1px solid var(--ink-3); border-radius: var(--r-control); overflow: hidden; }
.segmented button { min-width: 6.5em; min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: var(--ink-2); }
.segmented button + button { border-left: 1px solid var(--ink-3); }
.segmented button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); font-weight: var(--w-strong); }
.segmented button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -4px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); box-shadow: 0 -1px 0 var(--rule); }
.tabbar button { min-width: 0; min-height: 56px; padding: 0; border: 0; background: none; color: var(--ink-2); }
/* The current tab sits on a wash of the accent, inset from the bar by a transparent border. */
.tabbar button[aria-current="page"]:not(.plus) { color: var(--accent-text); font-weight: var(--w-strong); background: var(--accent-wash);
  background-clip: padding-box; border: solid transparent; border-width: 5px 3px; border-radius: var(--r-tile); }
.tabbar .plus { color: var(--on-accent); }
.tabbar .plus span { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-control); }
/* --vvh and --kb come from ui/viewport.js: the visible height and how much of the layout viewport the
   keyboard covers. A sheet sits on top of the keyboard and is never taller than what is left. */
.sheet { width: 100%; max-width: 34rem; margin: auto 0 var(--kb, 0px); padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  max-height: calc(var(--vvh, 100dvh) - 8px); overflow-y: auto; overscroll-behavior: contain;
  border: 0; border-radius: var(--r-sheet) var(--r-sheet) 0 0; background: var(--surface-2); color: var(--ink);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .12); }
/* The page under an open sheet does not scroll, so a drag in a sheet never moves Today. */
html:has(dialog[open]) { overflow: hidden; }
/* Where scrollbars take space, hiding one would shift the page sideways as a sheet opens. */
html { scrollbar-gutter: stable; }
/* A sheet's primary action stays at the bottom of the visible sheet when the fields above run long. */
.sticky-foot { position: sticky; bottom: 0; z-index: 1; width: 100%; margin-top: 12px; }
/* Pressed within a frame of the touch, and no double-tap zoom delay. */
button, .btn, .chip, a.btn { touch-action: manipulation; }
.btn:active:not(:disabled), .chip:active:not(:disabled), .plate-sum:active { opacity: .6; }
.sheet[open] { animation: slide-up 200ms ease-out; }
.sheet:focus { outline: none; }
.sheet::backdrop { background: rgba(0, 0, 0, .25); }
/* Sheet header: grip to swipe down on, Close at the right. Sticky so a tall sheet keeps it in reach. */
.sheet-head { position: sticky; top: -16px; z-index: 1; display: flex; justify-content: flex-end; align-items: center;
  margin: -16px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); min-height: 44px; background: var(--surface-2);
  touch-action: none; }
.sheet-grip { position: absolute; left: 50%; top: 8px; width: 36px; height: 4px; margin-left: -18px;
  border-radius: var(--r-row); background: var(--ink-3); }
.sheet-close { min-width: 44px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink-2); }
.sheet-close:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -4px; }
@keyframes slide-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.toast { position: fixed; z-index: 10; left: var(--gutter); right: var(--gutter); bottom: calc(72px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-control);
  border: 1px solid var(--rule); background: var(--surface-2); color: var(--ink); }
.toast svg line { stroke: var(--accent-2); stroke-dasharray: 20; stroke-dashoffset: 20; animation: draw 250ms ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* Tally strokes (ui/tally.js): four uprights at 2.4 px and a crossing fifth at 2.5 px, round caps. */
.tally { display: block; overflow: visible; }
.tally path { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }
.tally .tally-cross { stroke-width: 2.5; }
.tally-more { fill: var(--accent-text); font: 13px var(--font-num); }
#streak-line { display: flex; align-items: center; gap: 8px; }
#streak svg { display: block; }
/* The logging streak is a run of done days: its strokes take the second accent. */
#streak .tally path { stroke: var(--accent-2); }
#streak .tally-more { fill: var(--accent-2); }
.bar rect.track { fill: var(--track); }
.bar rect.fill { fill: var(--accent); }
.bar.over rect.fill { fill: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .sheet[open], .toast svg line { animation: none; stroke-dashoffset: 0; }
}

/* Today: the ledger (ui/ledger.js). One drawing for the number, calories and macros; its geometry
   is the ink kit's, its colours are the tokens, so dark mode is the same nodes. */
#nutrition-ledger { display: block; max-width: 100%; height: auto; margin: 14px 0 2px; overflow: visible; }
#nutrition-ledger text { fill: var(--ink); font-family: var(--font-num); font-size: 12.8px; letter-spacing: 0; }
#nutrition-ledger .hero-number { font: 700 64px var(--font-display); letter-spacing: -.035em; fill: var(--accent); }
#nutrition-ledger .hero-word { font: 400 16px var(--font-body); fill: var(--ink-2); }
#nutrition-ledger[data-state="met"] .hero-word { fill: var(--accent-2); }
#nutrition-ledger[data-state="over"] .hero-word { fill: var(--accent-text); }
#nutrition-ledger .hero-eaten { font-size: 17px; }
#nutrition-ledger .hero-eaten-label { font-family: var(--font-body); fill: var(--ink-2); }
#nutrition-ledger .ledger-target-label, #nutrition-ledger .ledger-frac { fill: var(--ink-2); }
#nutrition-ledger .ledger-name { font: 600 13px var(--font-body); }
.ledger-track { fill: var(--rule); }
.ledger-fill { fill: var(--accent); transform-origin: 0 0; transition: transform 400ms cubic-bezier(.33, 1, .68, 1); }
.ledger-target { fill: none; stroke: var(--ink-2); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
#nutrition-ledger[data-state="none"] .ledger-target { display: none; }
.ledger-hatch { fill: none; stroke: var(--accent); stroke-width: 1; }
.ledger-hatch.protein { stroke: var(--protein-overflow); }
.ledger-etch, .ledger-met, .ledger-cont, .ledger-check { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
/* Met and protein reached are the second accent: the tick on the target line, the check, the word. */
.ledger-met, .ledger-check { stroke: var(--accent-2); }
#nutrition-ledger .ledger-row[data-state="met"] .ledger-left { fill: var(--accent-2); }
#nutrition-ledger .ledger-row[data-state="over"] .ledger-left { fill: var(--accent-text); }
.ledger-etch { stroke-width: 1.4; }
.ledger-met { stroke-width: 3; }
.ledger-cont { stroke-width: 1.2; }
.ledger-check { stroke-width: 1.8; }
.ledger-row:not([data-state="over"]) :is(.ledger-overflow, .ledger-etch),
.ledger-row:not([data-state="met"]) .ledger-met,
.ledger-row:not([data-continued="true"]) .ledger-cont,
.ledger-row:not([data-check="true"]) .ledger-check { display: none; }
@media (prefers-reduced-motion: reduce) { .ledger-fill { transition: none; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.link { border: 0; background: none; padding: 0; text-align: left; }
ul.plain { list-style: none; padding: 0; margin: 0; }
#caf-curve { width: 100%; height: 90px; margin-top: 8px; }
#caf-curve .area { fill: var(--accent); opacity: .2; }
#caf-curve .line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
#caf-curve .line.draw { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw-curve 600ms ease-out forwards; }
#caf-curve .thr { stroke: var(--ink-3); stroke-dasharray: 3 3; }
#caf-curve .bed { stroke: var(--ink-2); }
@keyframes draw-curve { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { #caf-curve .line.draw { animation: none; stroke-dashoffset: 0; } }

/* + sheet */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.weigh { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.weigh input { width: 6.5ch; border: 0; background: none; text-align: center; padding: 0; }
.nudges { justify-content: center; }
#again li { display: flex; align-items: center; gap: 8px; }
/* "at 14:05": the clock until changed, for one-tap logs at another time. */
.at-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.at { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.at input[type="time"] { width: 6.6em; min-height: 36px; line-height: 34px; padding: 0 8px; }
#again.wait { min-height: calc(3 * 56px + 2px); }
#again li .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sheet-tall { min-height: 80vh; }
/* Full-screen pages (ui/page.js): Add food and the serving page. Each covers the visible viewport
   (--vvt and --vvh from ui/viewport.js), so with the keyboard up the page ends where the keyboard
   starts and its bottom bar sits on top of it. A header, a body that scrolls on its own, a bar. */
.page { position: fixed; inset: var(--vvt, 0px) 0 auto 0; width: 100%; max-width: none; height: var(--vvh, 100dvh);
  max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: var(--surface); color: var(--ink); }
.page[open] { display: flex; flex-direction: column; }
.page::backdrop { background: var(--surface); }
.page:focus { outline: none; }
html:has(dialog.page[open]) .tabbar { display: none; }
.page-pad { flex: none; padding-left: var(--gutter); padding-right: var(--gutter); }
.page-head { flex: none; display: flex; align-items: center; gap: 10px; min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 6px) var(--gutter) 6px; }
.page-head h1 { margin: 0; font-size: var(--t-m); line-height: 1.25; }
.page-head > .chip { flex: none; min-height: 44px; }
.page-title { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0; border: 0; background: none;
  font: inherit; color: var(--ink); text-transform: capitalize; }
.page-title::after { content: ""; width: 7px; height: 7px; margin-top: -4px; border: solid var(--ink-2); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg); }
.page-title[aria-expanded="true"]::after { margin-top: 3px; transform: rotate(-135deg); }
#food-meal-pick { margin: 0 0 4px; }
#food-meal-pick .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.page-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--gutter) 16px; }
.page-bar { flex: none; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--surface-2); box-shadow: 0 -1px 0 var(--rule); }
/* Over the keyboard there is no home indicator to clear. */
html.kb .page-bar { padding-bottom: 10px; }
.page .toast { bottom: calc(var(--page-bar, 76px) + 8px); }
.page-food { --page-bar: 112px; }
.food-search { padding-top: 0; padding-bottom: 6px; }
/* The search field's own clear control: iOS does not reliably draw the native one, so it is built
   and the native one is hidden everywhere, leaving one control on every browser. */
.search-field { position: relative; }
.search-field input { padding-right: 44px; }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-clear { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: grid; place-items: center;
  padding: 0; border: 0; background: none; color: var(--ink-2); }
.search-clear[hidden] { display: none; }
.food-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin: 12px 0 4px; }
.food-head-row h2 { margin: 0; }
#food-results li, #food-meals li { display: flex; align-items: center; gap: 8px; min-height: 57px; }
#food-results .name, #food-meals .name { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 10px 0; }
.chip.on-plate { border-color: var(--accent); white-space: nowrap; }
.chip.on-plate svg { vertical-align: -2px; margin-right: 3px; }
.plate { padding-top: 0; }
.plate-foot { display: flex; gap: 10px; align-items: center; padding: 4px 0 10px; }
.plate-when { display: flex; gap: 10px; align-items: center; padding-top: 8px; }
.plate-when label { margin: 0; }
.plate-when input[type="time"] { width: 7.5em; }
.plate-sum { min-height: 44px; padding: 0; border: 0; background: none; text-align: left; display: flex; align-items: center; gap: 6px; }
#plate-stroke line { stroke: var(--accent-2); }
#plate-stroke.draw line { stroke-dasharray: 20; stroke-dashoffset: 20; animation: draw 250ms ease-out forwards; }
@media (prefers-reduced-motion: reduce) { #plate-stroke.draw line { animation: none; stroke-dashoffset: 0; } }
#plate-list { max-height: 40vh; overflow-y: auto; overscroll-behavior: contain; padding-top: 4px; }
#plate-list li { display: flex; align-items: center; gap: 6px; min-height: 52px; }
#plate-list .pl-name { overflow-wrap: anywhere; }
#plate-list input.pl-grams { width: 4.6em; min-height: 40px; padding: 0 8px; text-align: right; }
#plate-list .pl-kcal { min-width: 6.5ch; text-align: right; }
#plate-list li + li { border-top: 1px solid var(--rule); }
.check { color: var(--ink-note); font-size: var(--t-xs); }
/* Meal photo and Describe a meal: the wait line on Add food, then the review page. */
#describe-hint { margin: 0 0 6px; }
.food-search .chip:disabled { opacity: .45; }
.meal-wait { display: flex; align-items: center; gap: 12px; margin: 8px 0; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.meal-wait[hidden] { display: none; }
.meal-wait p { margin: 0; }
.meal-wait img, .meal-thumb { flex: none; object-fit: cover; border-radius: var(--r-control); background: var(--surface-2); }
#meal-wait-time { margin-left: 6px; color: var(--ink-3); }
.meal-thumb:not([src]), .meal-thumb[src=""] { display: none; }
.meal-caveat { margin: 4px 0 8px; padding: 8px 0 8px 12px; border-left: 3px solid var(--accent); }
.meal-item { padding: 10px 0 12px; }
.meal-item + .meal-item { border-top: 1px solid var(--rule); }
.meal-top { display: flex; align-items: center; gap: 8px; }
.meal-name { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; text-align: left;
  font: inherit; font-weight: var(--w-strong); color: var(--ink); overflow-wrap: anywhere; text-decoration: underline;
  text-decoration-color: var(--rule); text-underline-offset: 4px; }
.meal-seen { margin: 0 0 6px; }
.meal-amount { display: flex; align-items: center; gap: 6px; }
.meal-amount .sv-step { min-width: 60px; min-height: 44px; }
.meal-amount input.meal-grams { flex: none; width: 4.6em; min-height: 44px; padding: 0 8px; text-align: right; }
.meal-kcal { margin-left: auto; min-width: 7ch; text-align: right; white-space: nowrap; }
.meal-swap { margin-top: 8px; }
.meal-swap .chips { margin: 6px 0; }
.meal-swap .chip { min-height: 44px; text-align: left; }
.meal-swap .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.meal-sum { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.meal-actions { display: flex; gap: 10px; }
.meal-actions .btn { flex: 1; }
/* raw / cooked / dry, read from the USDA name: a small outlined word, so it is seen before the name is read to the end. */
.state { display: inline-block; padding: 0 5px; border: 1px solid var(--ink-3); border-radius: var(--r-control);
  color: var(--ink-2); font-family: var(--font-body); font-size: var(--t-xs); font-weight: normal;
  line-height: 1.5; vertical-align: 0.1em; }
/* The serving page, top to bottom: the name, the calorie donut and its legend, the amount, Eaten at,
   then the rest. Add to plate and Save are in the page bar. */
.sv-head h1 { font-family: var(--font-display); overflow-wrap: anywhere; }
.sv-sub { margin: 2px 0 0; }
.sv-sub:has(#sv-brand:empty):has(#sv-source:empty) { display: none; }
.source-mark { display: inline-block; padding: 0 5px; border: 1px solid var(--rule); border-radius: var(--r-control);
  color: var(--ink-2); line-height: 1.5; }
.source-mark:empty { display: none; }
.sv-chart { display: flex; flex-direction: column; align-items: center; margin: 8px 0 4px; }
.sv-ring { position: relative; width: 168px; height: 168px; }
.sv-ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.sv-ring circle { fill: none; stroke-width: 14; }
.sv-ring .sv-track { stroke: var(--rule); }
.sv-ring [data-key] { transition: stroke-dasharray 200ms ease-out, stroke-dashoffset 200ms ease-out; }
.sv-ring [data-key="protein"], .sv-legend [data-key="protein"] .sw { stroke: var(--macro-protein); background: var(--macro-protein); }
.sv-ring [data-key="carbs"], .sv-legend [data-key="carbs"] .sw { stroke: var(--macro-carbs); background: var(--macro-carbs); }
.sv-ring [data-key="fat"], .sv-legend [data-key="fat"] .sw { stroke: var(--macro-fat); background: var(--macro-fat); }
.sv-ring [data-key="alcohol"], .sv-legend [data-key="alcohol"] .sw { stroke: var(--ink-3); background: var(--ink-3); }
.sv-centre { position: absolute; inset: 0; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#sv-kcal { font-size: 2.25rem; line-height: 1; font-weight: 500; letter-spacing: -.04em; }
.sv-chart figcaption { width: 100%; }
.sv-legend { display: flex; justify-content: center; gap: 4px 18px; flex-wrap: wrap; margin: 10px 0 0; }
.sv-legend li { display: grid; grid-template-columns: 10px auto; column-gap: 6px; align-items: baseline; }
.sv-legend .sw { width: 10px; height: 10px; border-radius: var(--r-control); align-self: center; }
.sv-legend .k { color: var(--ink-2); font-size: var(--t-xs); }
.sv-legend .g { grid-column: 2; font-size: var(--t-m); line-height: 1.2; }
.sv-legend .pct { grid-column: 2; font-size: var(--t-xs); }
#sv-nomacro { text-align: center; margin: 8px 0 0; }
/* With the keyboard up the donut gives the amount its room. */
html.kb .sv-ring { width: 96px; height: 96px; }
html.kb #sv-kcal { font-size: var(--t-m); }
html.kb .sv-legend .g { font-size: var(--t-s); }
.sv-step { flex: none; min-width: 64px; min-height: 52px; padding: 0 6px; }
.sv-back + h2 { margin-top: 4px; }
.sv-star { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 44px; margin: 8px 0; }
.sv-star svg path { fill: none; }
.sv-star[aria-pressed="true"] { color: var(--accent-text); }
.sv-star[aria-pressed="true"] svg path { fill: currentColor; }
/* Favourites: one row across the top of the food sheet, scrolled sideways; a tap logs one. */
.small-head { margin: 12px 0 6px; font-size: var(--t-s); }
.fav-row { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-inline: contain; padding-bottom: 4px; }
.fav-row li { flex: none; }
.fav-row .chip { min-height: 44px; text-align: left; }
.fav-row .chip .num { color: var(--ink-2); }
.sv-amount { display: flex; gap: 6px; align-items: stretch; }
#sv-grams { flex: 1; min-width: 0; min-height: 52px; font-size: var(--t-l); text-align: center; padding: 0 6px; }
.sv-amount .segmented { margin: 0 0 0 4px; }
.sv-amount .segmented button { min-width: 2.6em; min-height: 52px; padding: 0 8px; }
#sv-total { margin: 6px 0 2px; min-height: 1.2em; }
.sv-mult-head { margin: 8px 0 0; }
#sv-total:empty { min-height: 0; margin: 0; }
#sv-units, #sv-mult, #sv-presets { margin: 6px 0; }
.sv-caf { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.sv-caf label { margin: 0; color: var(--ink); }
.sv-caf input[type="text"] { width: 5em; min-height: 36px; padding: 0 8px; }
#sv-caf-data { margin: 4px 0 8px; }
.sv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sv-actions:has(#sv-add[hidden]) { grid-template-columns: 1fr; }
.sv-when-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sv-when-row input[type="time"] { width: 7.5em; }
.sv-when-row .chips { margin: 0; }
#sv-slot .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* Log */
#log-total { margin: 0 0 4px; }
#log-total p { margin: 0; }
/* Log is a timeline: clock times in the left column, a 1 px ink-3 line beside them, each row's
   top padding (--gap) grown from the minutes since the row before, so a long gap reads as space.
   Meals are marks on the line. Only padding is used for the gap, so the line runs unbroken. */
#log-list { --time-col: 3.4rem; --axis-col: 18px; }
#log-list > li { position: relative; display: grid; grid-template-columns: var(--time-col) var(--axis-col) minmax(0, 1fr);
  align-items: center; padding-top: var(--gap, 0); }
#log-list .axis { grid-column: 2; align-self: stretch; position: relative; margin-top: calc(-1 * var(--gap, 0)); }
#log-list .axis::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: var(--ink-3); }
/* The axis box runs from the top of the gap to the bottom of the row: a row's middle is half the gap below its own middle. */
#log-list > li:first-child .axis::before { top: calc(var(--gap, 0) + 26px); }
#log-list > li:last-child .axis::before { bottom: calc(50% - var(--gap, 0) / 2); }
#log-list > li.slot:last-child .axis::before { bottom: auto; height: calc(var(--gap, 0) + 26px); }
#log-list .entry .axis::after, #log-list .dose .axis::after { content: ""; position: absolute; left: 5px; top: calc(50% + var(--gap, 0) / 2 - 3.5px);
  width: 7px; height: 7px; border-radius: var(--r-pill); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent); }
#log-list .slot .axis::after { content: ""; position: absolute; left: 2px; top: calc(var(--gap, 0) + 26px); width: 13px; height: 1.5px; background: var(--accent); }
#log-list .gap { position: absolute; left: 0; top: calc(var(--gap, 0) / 2 - 1.1em); width: var(--time-col);
  font-size: var(--t-xs); line-height: 1.1; color: var(--ink-2); white-space: pre-line; }
#log-list .t { grid-column: 1; font-size: var(--t-xs); }
#log-list .slot-body { grid-column: 3; padding: 12px 0 6px; }
#log-list .slot-row { display: flex; align-items: center; gap: 10px; }
#log-list .slot h2 { margin: 0; color: var(--ink-2); font-family: var(--font-display); font-size: var(--t-m); font-weight: normal; }
#log-list .slot-total { margin: 2px 0 0; font-size: var(--t-xs); }
#log-list .slot-copy { margin-top: 6px; max-width: 100%; text-align: left; }
/* A food row slides over its Delete button. Only the transform moves, 200 ms, and not at all under reduced motion. */
#log-list .slide { grid-column: 3; position: relative; overflow: hidden; }
#log-list .entry-row { grid-column: 3; position: relative; z-index: 1; display: flex; gap: 10px; align-items: center; padding: 6px 0;
  background: var(--surface); touch-action: pan-y; transition: transform 200ms ease-out; }
#log-list .entry.sliding .entry-row { transition: none; }
#log-list .swipe-del { position: absolute; top: 0; right: 0; bottom: 0; width: 88px; border: 0; border-radius: 0;
  background: var(--accent); color: var(--on-accent); font-weight: var(--w-strong); visibility: hidden; }
#log-list .entry:is(.sliding, .open, .gone) .swipe-del { visibility: visible; }
@media (prefers-reduced-motion: reduce) { #log-list .entry-row { transition: none; } }
#log-list .tile { flex: none; display: grid; place-items: center; width: 44px; height: 44px; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--r-tile); background: var(--surface-2); color: var(--ink); }
#log-list .tile img { width: 100%; height: 100%; object-fit: cover; }
.picto { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#log-list .what { display: flex; flex-direction: column; min-width: 0; }
#log-list .what .l { overflow-wrap: anywhere; }
#log-list .what .sub { line-height: 1.3; }
#log-list .k, #log-intake .k { min-width: 3.5ch; text-align: right; }
/* A long press must not open the phone's text callout or select the label. */
#log-list .entry-row { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* Select mode: a box before each food row's tile, accent-filled with a check when picked; "···" and the
   swipe step aside. The bar sits where the toast does, above the tab bar. */
#log-list .pick { display: none; flex: none; width: 22px; height: 22px; border: 1.5px solid var(--ink-3);
  border-radius: var(--r-control); padding: 0; background: transparent; color: var(--on-accent); }
#log-list.selecting .entry .pick { display: grid; place-items: center; }
#log-list.selecting .entry .more { visibility: hidden; }
#log-list.selecting .slot-body { cursor: pointer; }
#log-list .entry[data-picked] .pick { background: var(--accent); border-color: var(--accent); }
#log-list .entry:not([data-picked]) .pick svg { visibility: hidden; }
.select-bar { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 2;
  padding: 8px 10px 10px; border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--surface-2); }
.sel-top { display: flex; align-items: center; justify-content: space-between; }
.select-bar .chips { margin-top: 4px; }
#screen-log:has(#select-bar:not([hidden])) { padding-bottom: 150px; }
#food-slot { margin: 4px 0 0; }
#log-intake:not(:empty) { margin-top: 8px; }
#log-projection { margin: 12px 0 4px; }
#log-intake .entry { display: flex; gap: 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--rule); }
.entry-actions { display: grid; gap: 8px; }
#recent li { display: flex; align-items: center; gap: 10px; }

/* Barcode scanner */
.viewfinder { position: relative; overflow: hidden; border-radius: var(--r-control); background: #000; }
.viewfinder video { display: block; width: 100%; max-height: 40vh; object-fit: cover; }
.viewfinder .box { position: absolute; left: 15%; right: 15%; top: 35%; bottom: 35%; border: 2px solid var(--surface); border-radius: var(--r-control); }
#scan-result { margin: 12px 0; }

/* Trends */
#trend-chart { margin: 8px 0 12px; }
/* The unit over the y axis, as in the ink kit: 9 px mono ink-2, from the plot's left edge (Y_AXIS in
   charts/common.js). */
#trend-unit { margin: 8px 0 2px; padding-left: 44px; font-size: 9px; line-height: 12px; color: var(--ink-2); }
#trend-unit:not([hidden]) + #trend-chart { margin-top: 0; }
#trend-chart .u-legend { display: none; }

/* Week */
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin: 4px 0 10px; }
/* The week's balance: one quiet line under Today's ledger and under Week's day marks. */
.week-balance { margin: 8px 0 0; }
#week-balance { margin: 0 0 10px; color: var(--ink-2); }
/* Calories banked over the week read in the second accent; owed stays grey. */
.week-balance[data-state="banked"], #week-balance[data-state="banked"] { color: var(--accent-2); }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 4px 0;
  border: 1px solid transparent; border-radius: var(--r-control); background: none; color: var(--ink-2); }
.week-day:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }
/* One stroke a day (ui/tally.js weekdayMarkSvg): solid when logged, the lower half inked on a pale
   stroke when partly logged, two cross-strokes when marked incomplete, broken with one fine cross
   when too little was logged to count, a thin line when nothing was. The key under the marks uses
   the same drawing. */
.wd-mark { display: block; }
.wd-mark path { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
/* A fully logged day is done: its stroke takes the second accent. A part-logged day's inked half is the accent. */
[data-state="full"] .wd-stroke { stroke: var(--accent-2); }
.wd-stroke { stroke-width: 3; }
.wd-low, .wd-broken, .wd-cross, .wd-cut { display: none; }
[data-state="partial"] .wd-stroke { stroke: var(--rule); stroke-width: 4; }
[data-state="partial"] .wd-low { display: inline; stroke: var(--accent); stroke-width: 3; }
[data-state="incomplete"] .wd-stroke { stroke-width: 1.4; }
[data-state="incomplete"] .wd-cross { display: inline; }
.wd-cross path { stroke-width: 1.5; }
[data-state="skipped"] .wd-stroke { display: none; }
[data-state="skipped"] .wd-broken { display: inline; stroke-width: 1.8; }
[data-state="skipped"] .wd-cut { display: inline; stroke: var(--ink-2); stroke-width: 1; }
[data-state="empty"] .wd-stroke { stroke: var(--ink-3); stroke-width: 1; }
.wd-key { margin: 0 0 10px; }
.wd-key > summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); font-size: var(--t-xs); cursor: pointer; }
.wd-key ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 6px 12px; margin: 2px 0 6px; }
.wd-key li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: var(--t-xs); }
#rv-stats { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
#rv-stats dt { color: var(--ink-2); }
#rv-stats dd { margin: 0; }
/* A stalled cut: two choices stacked, each button with its one sentence under it. */
.checkin-choices { display: grid; gap: 12px; margin: 12px 0; }
.checkin-choices .btn { width: 100%; }
.checkin-choices p { margin: 4px 0 0; }
#week-break { margin: 0 0 10px; }
#micros .micro, #micros-all .micro { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; width: 100%; min-height: 44px;
  padding: 6px 0; border: 0; background: none; text-align: left; align-items: baseline; }
#nt-foods .share { min-width: 4ch; text-align: right; }
#micros .cov, #micros-all .cov { grid-column: 2; color: var(--ink-3); font-size: var(--t-xs); }
details summary { min-height: 44px; display: flex; align-items: center; }

/* Label photo */
#labelcam .viewfinder video { max-height: 50vh; }
#label-status { margin: 12px 0; }
#label-form input.unsure { border-color: var(--accent); }
#lf-raw { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }

/* Settings > Data: shortcut install and run links styled as buttons */
.sc-links { display: flex; flex-wrap: wrap; gap: 8px; }
/* A link that does a button's job (Connect, Install, Export) looks like one. */
a.btn { display: inline-flex; align-items: center; color: inherit; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Weekly calorie schedule: one row a day, the shift between - and + chips, the day's kcal at the right. */
#cs-days li { display: grid; grid-template-columns: 3em 44px 5ch 44px 1fr; align-items: center; gap: 6px; min-height: 48px; }
#cs-days .shift { text-align: right; }
#cs-days .day-kcal { text-align: right; color: var(--ink-2); }
#cs-days .chip { min-width: 44px; }
/* Text size: the slider runs the column's width. Inputs keep 16 px at the least (iOS zooms below). */
input[type="range"] { width: 100%; min-height: 44px; }
/* Log and Week: room between the timeline, the water rows and the day's own controls. */
#log-intake:not(:empty) { margin-top: 18px; border-top: 1px solid var(--rule); }
#log-projection { margin: 18px 0 0; }
.log-foot { margin-top: 22px; }
.log-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.log-foot .fold { margin-top: 18px; }
.log-foot .more-block { margin-top: 0; }
#week-nutrients { margin-top: 32px; }
#week-nutrients > summary span:first-child { font-family: var(--font-display); font-size: var(--t-m); }
#week-nutrients .all-nutrients { margin: 6px 0 12px; }
#screen-settings > h2 { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--rule); }
#settings-advanced { margin-top: 34px; }
#settings-advanced .more-block h2 { margin-bottom: 8px; }
/* Trends: the five kinds on one row; at large text sizes the row scrolls inside itself. */
#trend-kinds { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
#trend-kinds .chip { flex: 1 0 auto; padding-left: 4px; padding-right: 4px; font-size: 0.9375rem; }
#trend-head { margin-top: 18px; }

/* Settings > Diet. The seven coming days are a strip of small cells like Week's marks: the weekday
   over the day type's short name. Editor fields reuse the plain form controls. */
.diet-days { padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin: 6px 0 10px; }
.diet-days li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.diet-days .num { font-size: var(--t-xs); }
.diet-rows li { padding: 4px 0; align-items: center; }
.diet-rows select { max-width: 60%; }
.diet-warn { color: var(--accent-text); }
.diet-warn:empty { display: none; }
.diet-editor { border-top: 1px solid var(--accent); margin-top: 8px; padding-top: 4px; }
.diet-type { border: 0; border-top: 1px solid var(--rule); margin: 10px 0; padding: 8px 0 0; min-width: 0; }
.diet-type legend { padding: 0; }
.diet-pair { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: end; }
.diet-pair label { grid-column: 1 / -1; }
.diet-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.diet-rule input[type="text"] { width: 7em; }
#de-start { margin: 10px 0; }
.wd-type { font-size: var(--t-xs); color: var(--ink-2); min-height: 1.2em; }
/* A target typed in by hand: calories, then the three macros side by side, the line saying what the
   grams add up to, and the fill chips. Today's quiet line says where the day's target came from. */
.split-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 6px; margin: 8px 0 2px; }
.split-chip { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  min-height: 48px; padding: 4px 10px; text-align: left; }
.split-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.split-chip:disabled { opacity: 0.55; }
.target-macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.target-macros input { width: 100%; }
.target-src { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 0; }
.target-src span:empty { display: none; }
.target-src button { margin-left: auto; }

/* Empty states: an ink drawing (256 x 192 PNG, light ink for the dark ground) at 128 x 96, left
   aligned above or beside the line that says what is missing. */
.empty-art { display: block; width: 128px; height: 96px; margin: 8px 0 4px; }
.empty-art img { display: block; width: 128px; height: 96px; }
.empty-state { margin: 4px 0 8px; }
.empty-state > p { margin-top: 0; }
#trend-empty { margin: 16px 0 12px; }
/* Settings: "Saved" at the end of a field's label after the change is stored, fading out. */
.saved-note { color: var(--accent-2); opacity: 0; transition: opacity 600ms ease-out; }
.saved-note.on { opacity: 1; transition: none; }
@media (prefers-reduced-motion: reduce) { .saved-note { transition: none; } }
/* Add food rows: the amount + logs beside its kcal, kept on one line. */
#food-results .kcal, #food-meals .kcal { flex: none; white-space: nowrap; }

/* Room held for blocks that arrive with a screen's data, so what sits under them does not jump when
   the answer lands (layout shift). Each holds only while its block is still empty; the sizes are
   the blocks' usual heights on a phone. */
.week-days:empty { min-height: 77px; }
#week-balance:empty { min-height: 2.9em; }
#rv-span:empty { min-height: 1.45em; }                             /* "Mon 19 Oct - Sun 25 Oct · Cut wk 9" */
#review:has(> #rv-stats:empty) { min-height: 472px; }
#review:has(> #rv-stats:empty) > * { visibility: hidden; }          /* its buttons wait for the numbers above them */
#log-total:has(#log-total-head:empty) { min-height: 74px; }
#log-list:empty { min-height: 23.5rem; }                           /* the four meal heads every day has */
#log-list:empty ~ * { visibility: hidden; }                        /* the foot waits for the rows */
#t-balance:empty { min-height: 1.45em; }
#recent:empty:has(+ #recent-empty[hidden]) { min-height: 159px; }  /* three rows */
#trend-chart:empty { min-height: 273px; }                          /* the head, the unit line and the 220 px chart */

/* trends-daily.css */
.trend-daily { margin: 12px 0 20px; }
.trend-daily-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.trend-daily-title h2 { margin: 4px 0 8px; }
.trend-daily-title span { color: var(--ink-2); font-size: var(--t-xs); text-align: right; }
.trend-daily-strip { display: flex; gap: 2px; overflow-x: auto; overscroll-behavior-inline: contain;
  padding: 3px 0 8px; scrollbar-color: var(--ink-3) transparent; }
.trend-day { flex: 0 0 44px; min-width: 44px; min-height: 60px; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: 3px; padding: 3px 2px;
  border: 1px solid transparent; border-radius: var(--r-control); background: transparent; color: var(--ink-2); }
.trend-day[aria-pressed="true"] { border-color: var(--accent); background: var(--surface-2); color: var(--ink); }
.trend-day:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.trend-day-number { font-size: var(--t-xs); line-height: 16px; }
.trend-ledger-small { display: block; width: 24px; height: 40px; }
.trend-ledger-large { display: block; width: min(240px, calc(100% - 42px)); height: 78px; }
.tl-track { fill: var(--rule); }
.tl-fill { fill: var(--accent); }
.tl-protein { fill: var(--macro-p); }
.tl-carbs { fill: var(--macro-c); }
.tl-fat { fill: var(--macro-f); }
.tl-over { fill: var(--accent); }
.tl-over-protein { fill: var(--protein-overflow); }
.tl-hatch { fill: none; stroke: var(--surface); stroke-width: .75; }
.tl-partial-line { fill: none; stroke: var(--ink); stroke-width: .8; }
.tl-target { fill: none; stroke: var(--ink); stroke-width: .9; }
.trend-ledger-small .tl-target { stroke-width: .55; }
.tl-on, .tl-check { fill: none; stroke: var(--accent-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.trend-ledger-small .tl-on, .trend-ledger-small .tl-check { stroke-width: .8; }
.trend-day-detail { margin-top: 6px; padding: 12px 0 2px; border-top: 1px solid var(--rule); }
.trend-detail-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.trend-detail-date { font-family: var(--font-display); font-size: var(--t-m); font-weight: 500; }
.trend-detail-state { color: var(--ink-2); font-size: var(--t-xs); text-align: right; }
.trend-detail-state[data-state="over"] { color: var(--accent-text); font-weight: var(--w-strong); }
.trend-detail-kcal { margin: 6px 0 2px; font-size: var(--t-s); }
.trend-detail-graphic { display: flex; gap: 8px; align-items: start; max-width: 100%; }
.trend-detail-rowlabels { display: grid; grid-template-rows: 25px repeat(3, 16px); width: 34px;
  color: var(--ink-2); font-size: var(--t-xs); text-align: right; }
.trend-detail-rowlabels span { align-self: center; }
.trend-detail-macros { display: flex; justify-content: space-between; gap: 8px; max-width: 240px; font-size: var(--t-xs); }
.trend-detail-macros b { font-weight: 400; }
.trend-detail-note { margin: 6px 0 0; color: var(--ink-2); font-size: var(--t-xs); }

/* dashboard.css */
/* Today dashboard: compact on a phone, two balanced columns on wider screens. */
:root {
  --dashboard-card: #15191f;   /* a step above the sheet */
  --dashboard-tint: #20252e;   /* chips on the card */
}
#app { max-width: 1080px; margin: 0 auto; }
.screen:not(#screen-today) { max-width: 720px; margin: 0 auto; }
#screen-today { padding-bottom: 14px; }
.today-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px 0 14px; }
.today-header h1 { flex: 1; font-size: 30px; line-height: 1.2; margin: 0; letter-spacing: -.025em; font-weight: 700; }
.today-header .phase { white-space: nowrap; font-size: 0.8125rem; }
#today-offline { margin: -6px 0 12px; }
.today-grid { display: grid; gap: 18px; }
/* Natural card heights keep quick logging within reach on a phone. */
.today-first { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.dashboard-card { min-width: 0; padding: 18px; border: 1px solid var(--rule); border-radius: var(--r-card); background: var(--dashboard-card); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-heading h2 { font-size: 1.25rem; line-height: 1.25; margin: 0; letter-spacing: -.025em; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.nutrition-card { border-top: 3px solid var(--accent); padding-top: 15px; }
#today-log-food { min-height: 44px; padding: 0 12px; border-radius: var(--r-tile); font-size: 0.8125rem; white-space: nowrap; }
#today-log-food span { margin-right: 5px; font-size: 1.125rem; font-weight: 400; }
.target-guide-content { font-size: 0.8125rem; color: var(--ink-2); }
.target-guide-content p { margin: 8px 0; max-width: none; }
/* Everything checked once a day or less: one disclosure under the cards, ruled like a ledger page. */
.fold { margin-top: 26px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px;
  font-size: 0.9375rem; color: var(--ink); cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary span:last-child { font-size: 1.375rem; line-height: 1; color: var(--ink-2); transition: transform 150ms; }
.fold[open] > summary span:last-child { transform: rotate(45deg); }
.more-block { padding: 18px 0 20px; border-top: 1px solid var(--rule); }
.more-block h2 { font-size: 1.0625rem; line-height: 1.25; margin: 0; letter-spacing: -.02em; }
#target-guide h2 { margin-bottom: 4px; color: var(--ink); }
.card-link { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 6px; padding: 0; border: 0; background: none; color: var(--ink-2); font-size: 0.8125rem; line-height: 24px; text-align: left; }
button.card-link { min-height: 44px; margin-top: -4px; }
.card-link > span:last-child { color: var(--accent-text); font-size: 1.125rem; }
#caf-toggle { display: block; width: 100%; }
#caf-toggle .card-link { min-height: 44px; margin-top: -4px; }
#caf-toggle[aria-expanded="true"] .curve-toggle { transform: rotate(180deg); }
.signal-value { display: block; margin: 6px 0 5px; font-size: 1.4375rem; line-height: 1.2; font-weight: 550; letter-spacing: -.065em; }
#rate-line { font-family: var(--font-body); font-size: 0.75rem; line-height: 1.6; letter-spacing: 0; }
#caf-cut { font-size: 0.75rem; line-height: 1.6; }
.caffeine-actions { border-top: 1px solid var(--rule); margin-top: 14px; padding-top: 12px; }
.water-row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 16px; border-top: 1px solid var(--rule); margin-top: 16px; padding-top: 14px; }
.water-row .signal-value { margin: 4px 0 0; white-space: nowrap; }
#water-presets { flex: 1 1 11rem; max-width: 15rem; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.micro-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: 0.75rem; }
#caf-today { font-size: 0.75rem; }
#caf-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
#screen-today .chip { min-height: 44px; border-color: var(--rule); border-radius: var(--r-tile); background: var(--dashboard-tint); font-size: 0.75rem; letter-spacing: -.03em; }
#caf-presets .chip { padding: 4px 6px; }
#caf-curve { height: 105px; }
#caf-curve .area { fill: var(--accent); opacity: .12; }
#caf-curve .line { stroke: var(--accent); }
.card-caption { display: block; margin: 0; font-size: 0.75rem; }
.movement-metrics { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin: 19px 0 14px; }
.movement-metrics .num { margin-top: 5px; font-size: 0.9375rem; letter-spacing: -.05em; }
#health-line { border-top: 1px solid var(--rule); padding-top: 11px; font-size: 0.75rem; }
.movement-card .card-heading { flex-wrap: wrap; }
#streak { display: flex; justify-content: end; max-width: 100%; }
#streak svg { max-width: 100%; height: 23px; }
.lift-card .signal-value { margin: 12px 0; font-size: 1.25rem; }
.training-window { display: grid; grid-template-columns: 47px 1fr; gap: 8px; margin: 9px 0; font-size: 0.75rem; }
.training-window .num { letter-spacing: -.05em; }
#lift-copy { max-width: none; margin-bottom: 0; font-size: 0.75rem; }
.text-action { border: 0; min-height: 44px; background: none; padding: 0 2px; font-size: 0.75rem; color: var(--accent-text); }
.text-action span { margin-left: 4px; }
#recent { margin-top: 6px; }
#recent li { font-size: 0.8125rem; padding: 13px 0; }
.day-footer { display: flex; flex-direction: column; gap: 8px; align-items: start; }
.day-footer .small { font-size: 0.75rem; }
#incomplete { min-height: 44px; padding-left: 0; border-color: transparent; font-size: 0.8125rem; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.tabbar { z-index: 5; border-radius: var(--r-card) var(--r-card) 0 0; border: 1px solid var(--rule); box-shadow: 0 -5px 20px #00000006; background: var(--dashboard-card); }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 0.75rem; min-height: 64px; }
.tabbar button > svg { width: 19px; height: 19px; flex: none; }
.tabbar button:not(.plus) > span { max-width: 100%; overflow: hidden; text-overflow: clip; white-space: nowrap; }
.tabbar button[aria-current="page"] { color: var(--accent-text); }
.tabbar .plus span { width: 44px; height: 44px; border-radius: var(--r-sheet); }
#screen-today button, .tabbar button { cursor: pointer; }
#screen-today button:focus-visible, .fold > summary:focus-visible, .tabbar button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; }
@media (hover: hover) {
  #screen-today .chip:hover { border-color: var(--ink-2); background: var(--surface-2); }
  #screen-today .btn-primary:hover { filter: brightness(.92); }
  .card-link:hover, .text-action:hover, .fold > summary:hover { color: var(--accent-text); }
}
@media (min-width: 760px) {
  body { padding-left: 36px; padding-right: 36px; padding-bottom: 112px; }
  .today-header { padding: 35px 0 26px; }
  .today-header h1 { font-size: 42px; }
  .today-header .phase { font-size: 0.9375rem; }
  .today-grid { grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: stretch; }
  .today-first { display: contents; }
  .dashboard-card { padding: 24px; border-radius: var(--r-card); }
  .nutrition-card { grid-column: 1; grid-row: 1 / span 2; padding-top: 21px; }
  .recent-card { grid-column: 2; grid-row: 1; }
  .daily-signals { grid-column: 2; grid-row: 2; }
  .fold { margin-top: 28px; }
  .signal-value { font-size: 1.625rem; }
  #rate-line, #caf-cut { font-size: 0.75rem; }
  #screen-today .chip { font-size: 0.75rem; }
  .day-footer { flex-direction: row; justify-content: space-between; align-items: center; }
  .tabbar { left: 50%; right: auto; bottom: 18px; transform: translateX(-50%); width: min(540px, calc(100% - 48px)); border-radius: var(--r-card); padding: 5px 12px; box-shadow: 0 7px 30px #00000012; }
  .sheet { margin-left: auto; margin-right: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .fold > summary span:last-child { transition: none; }
}

/* One-time "Put Tally on your home screen" card, and the same steps under the join form. */
.home-card { margin-bottom: 14px; }
.home-steps ol { margin: 12px 0 0; padding-left: 1.3em; }
.home-steps li + li { margin-top: 6px; }
.home-steps p { margin: 10px 0 0; }
.share-glyph { vertical-align: -3px; color: var(--accent-text); }
.join-preview { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule); }
.join-preview h2 { margin-top: 0; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Settings sits at the right end of every tab's header: a drawn gear over its name. */
.settings-link { flex: none; align-self: center; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 44px; min-height: 44px; margin-left: 4px; padding: 0 2px; border: 0; background: none; color: var(--ink-2); font-size: 0.6875rem; cursor: pointer; }
.settings-link > svg { width: 20px; height: 20px; }
.settings-link:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
@media (hover: hover) { .settings-link:hover { color: var(--accent-text); } }

/* The phase line carries the diet's day type too ("Cut · wk 6 · High carb"), so it may wrap to a
   second line at the right rather than push the date. */
.today-header .phase { white-space: normal; text-align: right; max-width: 48%; }
.diet-note { margin: -6px 0 12px; color: var(--ink-2); }
/* Alcohol, under the ledger only on days with some: the ledger's label-left, number-right row. */
.alcohol-line { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 0; padding-top: 9px; border-top: 1px solid var(--rule); font-size: 0.875rem; }
.alcohol-line .num { letter-spacing: -.04em; }
#t-alcohol-note { margin: 4px 0 0; }
/* Fiber, sodium and sugars: three plain rows inside the disclosure. */
.nutrient-rows { margin: 12px 0 0; }
.nutrient-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.nutrient-rows > div + div { border-top: 1px solid var(--rule); }
.nutrient-rows dt { color: var(--ink-2); }
.nutrient-rows dd { margin: 0; font-size: 0.9375rem; letter-spacing: -.04em; }
.sleep-line { margin: 0 0 12px; font-size: 0.9375rem; letter-spacing: -.04em; }
/* Last logged: time, name, amount, kcal, as Log lays out a row. */
#recent .t { flex: none; width: 5ch; font-size: var(--t-xs); }
#recent .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; contain: inline-size; }  /* a long name never widens the card */
#recent .a, #recent .k { flex: none; text-align: right; white-space: nowrap; }
#recent .k { min-width: 7.5ch; }

/* Obsidian dashboard: compact controls and clear, independent information tiles. */
.today-header { border-bottom: 1px solid var(--rule); margin-bottom: 20px; }
.today-header h1 { font-size: clamp(26px, 4vw, 36px); letter-spacing: -.035em; }
.today-header .phase { border: 1px solid var(--rule); border-radius: var(--r-pill); padding: 6px 10px; font-size: .8125rem; }
.today-grid, .today-first { gap: 14px; }
.dashboard-card { border-radius: var(--r-card); }
.nutrition-card { border-top: 1px solid var(--rule); box-shadow: inset 0 3px var(--accent); }
.card-heading h2 { font-size: 1.125rem; letter-spacing: -.015em; }
#nutrition-ledger { width: 100%; max-width: 420px; margin: 24px auto 16px; }
#nutrition-ledger .hero-number { fill: var(--accent-2); }
#nutrition-ledger[data-state="over"] .hero-number { fill: var(--accent-text); }
#nutrition-ledger[data-state="none"] .hero-number { fill: var(--ink-2); }
#screen-today .text-action, #screen-today .card-link, #screen-today .chip,
#screen-today .micro-heading, #caf-cut, #caf-today, #rate-line, .card-caption { font-size: .875rem; letter-spacing: 0; }
#screen-today .signal-value { font-family: var(--font-body); font-weight: 600; letter-spacing: -.025em; }
#water { color: var(--accent-2); }
#recent li { font-size: .9375rem; padding: 14px 0; }
#recent-empty { min-height: 0; margin: 12px 0 0; }
#recent-empty .empty-art { display: none; }
.daily-signals .card-link { color: var(--ink); font-weight: 600; }
.settings-link { font-size: .75rem; }
.fold { border: 1px solid var(--rule); border-radius: var(--r-card); background: var(--dashboard-card); padding: 0 18px; margin-top: 16px; }
.fold > summary { min-height: 56px; font-weight: 600; }
.tabbar { background: var(--surface-2); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
@media (min-width: 760px) {
 .today-grid { grid-template-columns: 1.15fr 1fr; gap: 16px; }
 .nutrition-card { grid-row: 1 / span 2; }
 .daily-signals { grid-row: 1; }
 .recent-card { grid-row: 2; }
 .dashboard-card { padding: 22px; }
 .fold[open] { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
 .fold > summary, .fold .day-footer { grid-column: 1 / -1; }
}
@media (max-width: 380px) {
 .dashboard-card { padding: 14px; }
 .nutrition-card .card-heading { flex-wrap: wrap; gap: 4px; }
 .nutrition-card .heading-actions { width: 100%; justify-content: space-between; }
 .today-header { gap: 8px; }
}

/* training.css */
/* Training shares the nutrition dashboard's squared typography and quiet paper surfaces. */
#sheet-training { max-height: min(94dvh, calc(var(--vvh, 100dvh) - 8px)); overflow-y: auto; }
.training-heading h2 { font-family: var(--font-display); font-size: 1.8rem; margin: 5px 0; line-height: 1.1; }
.training-heading p { margin: 8px 0 18px; font-size: .9rem; }
.training-eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .07em; color: var(--ink-2); }
.training-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.training-tabs button[aria-pressed=true] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
#training-status { font-size: .88rem; margin: 12px 0; }
#training-status:empty { display: none; }
.training-error { color: var(--accent-text); font-weight: 600; }
.training-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 12px; }
#training-content label { font-size: .82rem; min-width: 0; }
#training-content label input, #training-content label select { margin-top: 5px; }
#training-content select, #training-content textarea { width: 100%; min-width: 0; min-height: 44px; padding: 10px; border: 1px solid var(--ink-3); border-radius: var(--r-control); background-color: var(--surface); color: var(--ink); font: inherit; font-size: max(16px, 1rem); }
#training-content textarea { resize: vertical; margin-top: 5px; }
.training-unit-row { display: grid; grid-template-columns: 95px 1fr; align-items: center; gap: 16px; margin-bottom: 14px; }
.training-unit-row p { margin: 20px 0 0; }
.training-exercise { padding: 14px; margin: 14px 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-control); }
.training-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 30px; }
.training-remove { min-height: 44px; min-width: 44px; border: 0; padding: 0 6px; color: var(--ink-2); background: transparent; font-size: .85rem; }
.training-remove:disabled { opacity: .35; }
.training-set, .training-set-head { display: grid; grid-template-columns: 28px minmax(0,1fr) minmax(0,.8fr) 36px; gap: 8px; align-items: center; }
.training-set-head { margin: 20px 0 5px; font-size: .66rem; color: var(--ink-2); font-weight: 700; letter-spacing: .03em; }
.training-set label { margin: 0; }
.training-set .training-remove { min-width: 36px; font-size: 1.4rem; }
.training-set-number { font-family: var(--font-display); font-weight: 700; color: var(--ink-2); }
.training-set-effort { margin: 5px 0 12px 36px; }
.training-set-effort summary { min-height: 32px; padding-top: 6px; cursor: pointer; color: var(--ink-2); font-size: .76rem; }
.training-add { width: 100%; margin-top: 8px; text-align: left; }
.training-save { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px;
  position: sticky; bottom: 0; z-index: 1; padding: 8px 0; background: var(--surface-2); box-shadow: 0 -1px 0 var(--rule); }
.training-save .btn { flex-shrink: 0; }
.training-history-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.training-history-detail { font-size: .88rem; line-height: 1.6; overflow-wrap: anywhere; }
.training-exercise h3 { margin: 8px 0; overflow-wrap: anywhere; }
#training-content button:focus-visible, #training-content summary:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
#training-content .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media(min-width:700px) { #sheet-training { max-width: 42rem; } }
@media(max-width:360px) { .training-exercise { padding: 10px; } .training-fields { gap: 0 8px; } .training-set, .training-set-head { gap: 5px; grid-template-columns: 22px minmax(0,1fr) minmax(0,.8fr) 30px; } .training-set .training-remove { min-width: 30px; } }

.training-launch { display: flex; gap: 10px; margin: 16px 0; }
.training-launch .btn { flex: 1; }
#today-training-summary { font-size: 0.8125rem; color: var(--ink-2); overflow-wrap: anywhere; }
.training-set, .training-set-head { grid-template-columns: 24px minmax(0,1fr) minmax(0,.8fr) 44px; }
.training-set .training-remove { min-width: 44px; }
.training-set-effort summary { min-height: 44px; }
.training-set-head { font-size: 0.6875rem; }
.training-error { color: var(--ink); border-left: 3px solid var(--accent); padding-left: 10px; }
#training-content select { padding-right: 32px; }

/* Lift log: quiet estimates beside the sets, last time, movements and the movement page. */
.training-set, .training-set-head { grid-template-columns: 24px minmax(0,1fr) minmax(0,.8fr) 52px 44px; }
.training-e1rm { font-size: var(--t-xs); color: var(--ink-3); line-height: 1.2; overflow-wrap: anywhere; }
.training-best { margin: 4px 0 0; font-size: var(--t-xs); color: var(--ink-2); }
.training-best:empty { display: none; }
.training-last { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.training-last[hidden] { display: none; }
.training-last p { margin: 0; overflow-wrap: anywhere; }
.training-last .text-action { flex: none; }
.training-movements { margin: 4px 0 14px; }
.training-movements summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.training-movement-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 44px;
  padding: 10px 0; border: 0; border-bottom: 1px solid var(--rule); background: none; color: var(--ink); text-align: left; font: inherit; }
.training-movement-name { font-weight: 600; overflow-wrap: anywhere; }
.training-movement-link { border: 0; padding: 0; min-height: 0; background: none; color: inherit; font: inherit; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.training-highlight { display: block; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink);
  font: inherit; font-size: 0.8125rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.movement-body > #movement-head { margin: 4px 0 12px; }
.movement-chart { margin: 0 0 12px; }
.movement-records .row { gap: 10px; }
.movement-session h3 { margin: 18px 0 4px; font-size: var(--t-s); }
.movement-set { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,.9fr) minmax(0,1.2fr); gap: 8px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--rule); }
.movement-pr { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.pr { font-size: var(--t-xs); font-weight: 600; padding: 0 4px; border: 1px solid var(--accent-2); color: var(--accent-2); border-radius: var(--r-control); }
#trend-movements { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 0 8px; }
#trend-movements[hidden] { display: none; }
#trend-movements .chip { flex: none; }
#trend-movements .chip:disabled { opacity: .45; }
/* Seven kinds since Sleep: a little less room around each so the row still fits a 375 px phone. */
#trend-kinds { gap: 2px; }
#trend-kinds .chip { padding-left: 1px; padding-right: 1px; font-size: 0.8125rem; }

/* friends.css */
/* Friends tab, the Today inbox and the board. Cards reuse the Today card; the small ledgers are
   Trends' own (trends-daily.css). */
#screen-friends header { padding: 14px 0 6px; }
#screen-friends h1 { margin: 0; }
.board-card { margin-bottom: 14px; border-top: 3px solid var(--accent); padding-top: 15px; }
.board, .fc-days { list-style: none; padding: 0; }
.board { margin: 10px 0 6px; }
.board li { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 4px 8px; align-items: baseline; padding: 12px 0 10px; }
.board li + li { border-top: 1px solid var(--rule); }
.board li.me .br-name { font-weight: var(--w-strong); }
.br-rank { color: var(--ink-2); }
.br-who { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; min-width: 0; }
.br-name { font-size: 1.0625rem; }
/* The points as tally strokes, the split at the right; on a narrow card the split drops under them. */
.br-line { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 4px 12px; }
.br-marks { min-height: 20px; }
.br-detail { margin-left: auto; color: var(--ink-2); font-size: 0.6875rem; letter-spacing: -.02em; }
.br-top { padding: 0 6px; border: 1px solid var(--accent-2); border-radius: var(--r-control); color: var(--accent-2); }
.br-pts { font-size: var(--t-m); }
.board-card > p { margin: 4px 0 0; }

.friends-list { display: grid; gap: 14px; }
.friend-card .fc-state { margin: 4px 0 0; }
.friend-card .fc-kcal { margin: 12px 0 2px; font-size: var(--t-m); }
.friend-card .fc-macros { margin: 0 0 10px; color: var(--ink-2); }
.fc-today { display: flex; gap: 8px; align-items: start; }
.friend-card .fc-open { margin-top: 12px; }
.fc-week { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.fc-days { display: flex; justify-content: space-between; gap: 2px; margin: 0 0 6px; }
.fc-day { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; min-width: 0; }
.fc-day-kcal { font-size: 0.6875rem; letter-spacing: -.06em; }
.fc-day-name { color: var(--ink-2); }
.fc-note label { margin-top: 14px; }
.fc-note textarea { display: block; width: 100%; min-height: 64px; padding: 10px 12px; border: 1px solid var(--ink-3);
  border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; font-size: max(16px, 1rem);
  resize: vertical; }
.fc-note-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.fc-reactions { margin-top: 10px; }
.fc-history-head { margin: 16px 0 2px; font-size: var(--t-s); }
.fc-history li { padding: 8px 0; }
.fc-history li + li { border-top: 1px solid var(--rule); }
.fc-history li > span { display: block; }

.friend-inbox { margin-bottom: 14px; padding-top: 8px; padding-bottom: 8px; }
.friend-inbox ul:empty { display: none; }
.friend-inbox .row { align-items: center; flex-wrap: wrap; font-size: 0.875rem; }
.friend-inbox .row + .row, .friend-inbox ul + ul .row:first-child { border-top: 1px solid var(--rule); }
.friend-inbox b { font-weight: var(--w-strong); }

/* body.css */
/* The Body page, the Measure sheet and the Add photo sheet (screens/body.js). */
.body-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }

.body-block { padding: 14px 0 18px; border-top: 1px solid var(--rule); }
.body-block:first-child { border-top: 0; padding-top: 4px; }
.body-block h2 { font-size: var(--t-m); line-height: 1.25; margin: 0; }
.body-block > p { margin: 8px 0 0; }
#body-weight { margin-top: 6px; }

.body-sites { margin-top: 6px; }
.body-site { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.body-site:last-child { border-bottom: 0; }
.body-site .row { padding: 0; border: 0; }
.body-site-change { margin-top: 2px; }
.body-spark { height: 56px; margin-top: 6px; }

.measure-sites { margin-top: 4px; }
.measure-row { display: grid; grid-template-columns: 1fr 6.5rem 1.6rem; align-items: center; gap: 8px; margin: 0;
  padding: 4px 0; border-bottom: 1px solid var(--rule); color: var(--ink); }
.measure-row:last-child { border-bottom: 0; }
.measure-row .small { display: block; }
.measure-row input { text-align: right; }

.compare-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.compare-pick label { margin: 0; }
.compare-pick select { width: 100%; }
.compare-view { display: flex; gap: 8px; margin-top: 10px; touch-action: pan-y; }
.compare-view figure { flex: 1 1 0; min-width: 0; margin: 0; }
/* Both frames are 3:4 and the photos sit inside them whole, so the pair is always the same height. */
.compare-view img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--surface-2); }
.compare-view figcaption { margin-top: 4px; }
.compare-view figcaption:empty { display: none; }
.compare-view.single figure { flex: 0 1 60%; }

#body-photo-list { margin-top: 16px; }
#body-photos .row { align-items: center; }
.body-private { margin-top: 14px; }

#photo-file { display: block; width: 100%; min-height: 44px; padding: 10px 0; }

/* nutrients.css */
/* All nutrients for one day (screens/nutrients.js), and its links on Today and Log. */
/* The link sits beside the totals when they fit on one line, under them at the right when not. */
#log-total { display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 12px; }
#log-total > div { flex: 1 1 auto; }
#log-nutrients { flex: none; margin-left: auto; min-height: 28px; font-family: var(--font-body); white-space: nowrap; }

#nutrients-cover { margin: 4px 0 0; }
#nutrients-sofar { margin: 4px 0 0; }
.nutrient-group { padding: 14px 0 6px; }
.nutrient-group + .nutrient-group { border-top: 1px solid var(--rule); }
.nutrient-group h2 { font-size: var(--t-m); line-height: 1.25; margin: 0 0 4px; }
.nutrient-group .group-note { margin: 0 0 4px; }
.nutrient-line { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 8px 0; }
.nutrient-line + .nutrient-line { border-top: 1px solid var(--rule); }
.nutrient-line .n { color: var(--ink-2); }
.nutrient-line .v { text-align: right; }
.nutrient-line .bar { grid-column: 1 / -1; display: block; width: 100%; height: 3px; margin-top: 6px; color: var(--ink-2); }
.nutrient-line .cov { grid-column: 1 / -1; color: var(--ink-3); font-size: var(--t-xs); margin-top: 2px; }
.nutrient-line .cov:empty { display: none; }
#nutrients-week { margin-top: 8px; }
