/* CookMoveSleep — dark theme by default. Colors sampled from the reference design.
   [data-theme="light"] on <html> swaps in the light palette below (static/js/theme.js). */

/* The logo's wordmark. The file holds only its letters (c e k l m o p s v); see static/fonts/OFL.txt. */
@font-face {
  font-family: "Bricolage Grotesque"; font-weight: 750; font-display: swap;
  src: url("/fonts/bricolage-cms.woff2") format("woff2");
  unicode-range: U+63, U+65, U+6B-6D, U+6F-70, U+73, U+76;
}

:root {
  --bg-nav: #00111a;
  --bg-accent: #004466;
  --bg-panel: #22303f;
  --bg-field: #122436;
  --bg-row: #000;
  --bg-row-alt: #122436;
  --link: #4db3e6;
  --text: #e9eef2;
  --muted: #8fa3b5;
  --border: #22303f;
  --border-strong: #526375;
  --danger: #ef6a6a;
  --gold: #f4c542;
  --flag: #f0a640; /* an ingredient Pantry has no nutrition for */
  --brand-cook: #f2a33a; /* the logo's quarters and wordmark */
  --brand-move: #6fd6a8;
  --brand-sleep: #a3acff;
  --brand-rest: #3a5266;
  --energy-resting: #7f97ad; /* Move: resting energy, weigh-ins */
  --steps-under: #3f8a6b; /* Move: a day under the step goal */
  --sleep-deep: #5b63d6; /* Sleep stages; core is --brand-sleep */
  --sleep-rem: #dcdfff;
  --sleep-asleep: #8088f0; /* asleep, no stage recorded */
  --text-strong: #fff; /* hovered / active text */
  --nav-text: #dbe7f0;
  --subhead: #c9d6e0;
  --on-accent: #fff; /* text on --bg-accent */
  --on-accent-muted: #b8d6e8;
  --bar-text: #cfe6f4; /* text on the --bg-accent header bar */
  --on-link: #03202f; /* text on a --link fill */
  --link-hover: #8fd0f0;
  --hover: #1b3550;
  --hover-nav: #062535;
  --hover-side: #2a3b4d;
  --hover-faint: rgba(255,255,255,.08);
  --inset-bg: rgba(0,0,0,.2);
  --meter: #122436; /* empty part of bars and rings */
  --accent-hover: #005580;
  --selected: #0c2f45;
  --seg-selected: #1f5f88;
  --side-active-bg: #000;
  --side-active-text: #fff;
  --side-active-muted: #9fb0bf;
  --rule-dark: #000;
  --bg-rail: #2a3b4d;
  --bg-pop: #0b1824;
  --bg-tooltip: #0b1a26;
  --bg-option: #0e1c2a;
  --field-border: #0a1826;
  --placeholder: #566b80;
  --disabled-text: #4b6075;
  --icon-faint: #2d4a63;
  --thumb-icon: #3a5168;
  --scrollbar: #647a90;
  --hairline: rgba(255,255,255,.07);
  --shadow: rgba(0,0,0,.5);
  --backdrop: rgba(0,0,0,.6);
  --good: #7fdcb3;
  --mid: #c9d6e0;
  --warn: #f3c26b;
  --bad: #ff9a8a;
  --good-bg: #123a2b;
  --warn-bg: #3a2a10;
  --bad-bg: #3a1a16;
  --flag-bg: #3a2412;
  --flag-text: #f3b77a;
  --danger-text: #ffb3b3;
  --gold-text: #f6dc8a;
  --hatch: 201,214,224; /* r,g,b of the hatched "planned" fill */
  --today-bg: #0c1f14;
  --outside-bg: #05090d;
  --tray-bg: rgba(0,17,26,.9);
  --tray-border: rgba(255,255,255,.22);
  --radius: 4px;
  --topbar-h: 52px;
  --side-w: 240px;
  --section-gap: 32px; /* space after each section in the modals */
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg-nav: #ffffff;
  --bg-accent: #d9ebf7;
  --bg-panel: #f2f5f8;
  --bg-field: #ffffff;
  --bg-row: #ffffff;
  --bg-row-alt: #f4f7fa;
  --link: #0b6aa2;
  --text: #1a2632;
  --muted: #5a6c7c;
  --border: #dbe2e8;
  --border-strong: #b3c0cc;
  --danger: #c53636;
  --gold: #d99c00;
  --flag: #c76a12;
  --text-strong: #0b1620;
  --nav-text: #1f3242;
  --subhead: #34495c;
  --on-accent: #0b2f47;
  --on-accent-muted: #3f6a86;
  --bar-text: #0b3a56;
  --on-link: #fff;
  --link-hover: #064b74;
  --hover: #e5eff7;
  --hover-nav: #eef4f9;
  --hover-side: #e2e9ef;
  --hover-faint: rgba(0,0,0,.06);
  --inset-bg: rgba(0,0,0,.04);
  --meter: #dfe6ec;
  --accent-hover: #c7e1f2;
  --selected: #d7e9f6;
  --seg-selected: #0b6aa2;
  --side-active-bg: #d9ebf7;
  --side-active-text: #0b2f47;
  --side-active-muted: #4f6a80;
  --rule-dark: #d3dbe2;
  --bg-rail: #e7eef4;
  --bg-pop: #ffffff;
  --bg-tooltip: #ffffff;
  --bg-option: #ffffff;
  --field-border: #c2cdd7;
  --placeholder: #8796a4;
  --disabled-text: #a3afba;
  --icon-faint: #b9c8d5;
  --thumb-icon: #9aabba;
  --scrollbar: #a8b5c1;
  --hairline: rgba(0,0,0,.08);
  --shadow: rgba(20,40,60,.18);
  --backdrop: rgba(15,30,45,.45);
  --good: #1d8656;
  --mid: #4a5d6e;
  --warn: #a86b00;
  --bad: #c23b2a;
  --good-bg: #e0f3e9;
  --warn-bg: #fbf0d9;
  --bad-bg: #fbe3df;
  --flag-bg: #fcebd9;
  --flag-text: #9a520f;
  --danger-text: #a32424;
  --gold-text: #7a5800;
  --hatch: 80,100,120;
  --today-bg: #edf8f0;
  --outside-bg: #f5f6f8;
  --tray-bg: rgba(255,255,255,.95);
  --tray-border: #b3c0cc;
  --brand-cook: #c26800;
  --brand-move: #13865a;
  --brand-sleep: #5560d6;
  --brand-rest: #c4d0da;
  --energy-resting: #7a8fa3;
  --steps-under: #8fcfb1;
  --sleep-deep: #3540b0;
  --sleep-rem: #b4baf7;
  --sleep-asleep: #8a92e6;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; } /* the app scrolls inside its pages, never the document */
body {
  background: var(--bg-row);
  color: var(--text);
  font: 15px/1.4 "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;
}
#app { display: flex; flex-direction: column; height: 100vh; height: var(--app-h, 100dvh); } /* --app-h: main.js */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; }
.muted { color: var(--muted); }

.icon { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* --- buttons & fields ---------------------------------------------------- */
button, select, input { font: inherit; color: inherit; }
/* iOS zooms into any field with text under 16px when it's tapped; keep them at 16px on touch screens. */
@media (pointer: coarse) {
  /* :root lifts it over the page's own 15px rules; the big steppers, title inputs and the ingredient name keep their larger sizes. */
  :root :is(input, select, textarea):not(.big-input, .rv-stepper .field, .pantry-name) { font-size: max(16px, 1em); }
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius); cursor: pointer;
  background: var(--bg-field); border: 1px solid var(--border-strong); color: var(--text);
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--bg-nav); border-color: var(--link); }
.btn.primary:hover { background: var(--hover-nav); }
.btn.block { width: 100%; }
.btn:focus-visible, .side-link:focus-visible, .nav-link:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.merge-right { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.merge-left { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; margin-left: -1px; }

.link-btn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.clear-x {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer;
}
.clear-x:hover { color: var(--text); }

/* --- top bar ------------------------------------------------------------- */
/* --demo-h is set by router.js while the bar shows, so the help drawer starts below it. */
.demo-bar { flex: none; height: var(--demo-h); padding: 0 16px; background: var(--warn-bg); color: var(--warn); font-size: 13px; line-height: var(--demo-h); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: stretch; justify-content: space-between;
  background: var(--bg-nav); border-bottom: 1px solid var(--rule-dark);
}
.logo { display: flex; align-items: center; gap: 7px; padding: 0 22px 0 16px; }
.logo:hover { text-decoration: none; }
.logo-icon { display: inline-flex; width: 28px; height: 28px; flex: none; }
.logo-icon svg { width: 100%; height: 100%; }
.logo-icon .q-cook { fill: var(--brand-cook); }
.logo-icon .q-move { fill: var(--brand-move); }
.logo-icon .q-sleep { fill: var(--brand-sleep); }
.logo-icon .q-rest { fill: var(--brand-rest); }
.logo-word {
  font: 750 21px/1.3 "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif; letter-spacing: -.02em;
  white-space: nowrap;
}
.logo-word .w-cook { color: var(--brand-cook); }
.logo-word .w-move { color: var(--brand-move); }
.logo-word .w-sleep { color: var(--brand-sleep); }
.nav-main, .nav-util { display: flex; align-items: stretch; }
.nav-main { flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 8px; padding: 0 22px; font-size: 18px;
  color: var(--nav-text);
}
.nav-link:hover { background: var(--hover-nav); text-decoration: none; }
.nav-link.active { background: var(--bg-accent); }
/* The sections (Cook, Move, Sleep, Dev): the one you're in shows in its logo color, underlined. */
.sec-cook { --sec: var(--brand-cook); }
.sec-move { --sec: var(--brand-move); }
.sec-sleep { --sec: var(--brand-sleep); }
.sec-dev { --sec: var(--muted); }
.nav-link.section { font-weight: 700; }
.nav-link.section.sec-dev { font-weight: 600; color: var(--muted); }
.nav-link.section.active { background: none; color: var(--sec); box-shadow: inset 0 -3px 0 var(--sec); }
/* The bar under the top menu: the pages in the section you're in. */
.subnav {
  flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 12px; overflow-x: auto; scrollbar-width: none;
  background: var(--bg-pop); border-bottom: 1px solid var(--rule-dark);
}
.subnav-link { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 20px; color: var(--nav-text); font-size: 15.5px; white-space: nowrap; }
.subnav-link .icon { width: 17px; height: 17px; }
.subnav-link:hover { background: var(--hover-nav); text-decoration: none; }
.subnav-link.active { background: color-mix(in srgb, var(--sec) 18%, transparent); color: var(--sec); font-weight: 600; }
.subnav-link:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.nav-link.util { font-size: 16px; padding: 0 16px; }
.nav-link.icon-only { padding: 0 18px; }
.nav-link.icon-only .icon { width: 22px; height: 22px; }
.logout-form { display: flex; margin: 0; }
.logout-form[hidden] { display: none; }
.logout-form .nav-link { background: none; border: 0; cursor: pointer; font: inherit; }
.logout-form .nav-link:hover { background: var(--hover-nav); }
.theme-toggle { background: none; border: 0; cursor: pointer; font: inherit; }

.view { flex: 1; min-height: 0; overflow: hidden; }

/* --- recipe book layout --------------------------------------------------- */
.recipes-page { display: flex; height: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.side {
  width: var(--side-w); flex: none; display: flex; flex-direction: column;
  background: var(--bg-panel); border-right: 1px solid var(--border-strong);
}
.side[hidden] { display: none; }
.side-toggle { margin-right: -6px; }
.side-toggle .icon { width: 20px; height: 20px; }
.side-collections { flex: none; display: flex; flex-direction: column; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: var(--link); font-size: 16px;
}
button.side-link { width: 100%; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.side-link.sub { padding: 8px 16px 8px 46px; font-size: 15px; }
.side-link .flip { transform: rotate(180deg); }
.side-link:hover { background: var(--hover-side); text-decoration: none; }
.side-link.active { background: var(--side-active-bg); color: var(--side-active-text); }
.side-link .count { color: var(--muted); }
.side-link.active .count { color: var(--side-active-muted); }
.side-label { flex: 1; }
.side-add { background: none; border: 0; padding: 2px; color: var(--link); cursor: pointer; display: inline-flex; }
.side-add .icon { width: 20px; height: 20px; }
.side-add:hover { color: var(--text-strong); }

.side-filters {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 12px 12px; border-top: 1px solid var(--rule-dark);
  scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent;
}
.side-filters > * + *, .filter-panel > * + * { margin-top: 10px; }

.search, .filter-group { position: relative; }
.search input, .filter-group select, .ingredient-group input {
  width: 100%; height: 36px; padding: 0 12px; background: var(--bg-field);
  border: 1px solid var(--field-border); border-radius: 6px; color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.search input { padding-left: 34px; padding-right: 30px; }
.search input::placeholder, .ingredient-group input::placeholder { color: var(--placeholder); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .clear-x, .filter-group .clear-x { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); }
.search .clear-x { right: 8px; }
.search:not(.is-set) .clear-x, .filter-group:not(.is-set) .clear-x { display: none; }
/* search box with a "Filters" toggle (and clear button) on its right */
.search.has-filters-btn input { padding-right: 116px; }
.search-tools { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; }
.search .search-tools .clear-x { position: static; transform: none; }
.filters-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; white-space: nowrap; }
.filters-btn .icon { width: 16px; height: 16px; }
.filter-count { color: var(--gold); }
.filter-panel[hidden] { display: none; }
.filter-group select { appearance: none; padding-right: 30px; cursor: pointer; }
.filter-group::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg); pointer-events: none;
}
.filter-group select.is-set, .search.is-set input { border-color: var(--link); }
.filter-group select option { background: var(--bg-option); }
.filter-group select option:disabled { color: var(--disabled-text); }
.sort-group { margin-bottom: 4px; }

.ingredient-filters { padding-top: 6px; }
.ingredient-group + .ingredient-group { margin-top: 12px; }
.ingredient-group h4 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--nav-text);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 12px;
  background: var(--bg-accent); color: var(--on-accent); font-size: 13.5px;
}
.chip button { background: none; border: 0; padding: 2px; color: var(--on-accent-muted); cursor: pointer; display: inline-flex; }
.chip button:hover { color: var(--text-strong); }
.chip .icon { width: 13px; height: 13px; }

.side-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 6px; }

.side-footer {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 18px;
  background: var(--bg-accent); color: var(--bar-text); font-size: 17px;
}
.side-footer:hover { text-decoration: none; background: var(--accent-hover); }
.side-footer .push-right { margin-left: auto; width: 1em; height: 1em; }

/* --- header bar ----------------------------------------------------------- */
.bar {
  flex: none; display: flex; align-items: center; gap: 14px; padding: 8px 16px;
  background: var(--bg-accent); min-height: 50px;
}
.spacer { flex: 1; }
.split { display: inline-flex; position: relative; }
.menu-host .menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 220px;
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 8px 24px var(--shadow); padding: 4px 0;
}
.menu button {
  display: block; width: 100%; text-align: left; padding: 9px 14px; background: none; border: 0; cursor: pointer;
}
.menu button:hover { background: var(--hover-side); }
.pills { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 20px;
  background: transparent; color: var(--bar-text); border: 1px solid transparent; font-size: 16px;
}
.pill:hover { text-decoration: none; background: var(--hover-faint); }
.pill.selected { background: var(--bg-nav); color: var(--text-strong); }
.pill em { font-style: normal; font-weight: 600; }
.pill-x { display: inline-flex; background: none; border: 0; padding: 0 0 0 2px; color: var(--on-accent-muted); cursor: pointer; }
.pill-x:hover { color: var(--text-strong); }
.seg { display: inline-flex; }
.seg button {
  padding: 6px 14px; background: var(--bg-field); border: 1px solid var(--border-strong); cursor: pointer; color: var(--text);
}
.seg button.merge-left { border-left-width: 0; margin-left: 0; }
.seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.seg button.selected { background: var(--seg-selected); border-color: var(--link); color: #fff; }

/* --- results area --------------------------------------------------------- */
.results { flex: 1; min-height: 0; overflow: auto; background: var(--bg-row); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.empty { max-width: 460px; margin: 12vh auto 0; padding: 0 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { width: 56px; height: 56px; color: var(--icon-faint); }
.empty h2 { font-size: 24px; font-weight: 600; }
.empty p { margin: 0 0 8px; }

.stub { max-width: 460px; margin: 14vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stub-icon { width: 56px; height: 56px; color: var(--icon-faint); }

/* --- dev planning backlog ------------------------------------------------- */
.bl-page { height: 100%; overflow: auto; }
.bl-inner { max-width: 760px; margin: 0 auto; padding: 28px 16px 60px; display: flex; flex-direction: column; gap: 12px; }
.bl-inner h1 { font-size: 26px; font-weight: 700; }
.bl-inner > p { margin: -6px 0 4px; }
.bl-add { display: flex; gap: 8px; }
.bl-add .field { flex: 1; min-width: 0; }
.bl-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel); }
.bl-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); }
.bl-row:first-child { border-top: 0; }
.bl-row > input[type="checkbox"] { margin-top: 3px; flex: none; }
.bl-rank { flex: none; min-width: 22px; color: var(--muted); font-weight: 700; text-align: right; }
.bl-text { flex: 1; min-width: 0; }
.bl-title { overflow-wrap: anywhere; }
.bl-notes { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.bl-row.done .bl-title { text-decoration: line-through; color: var(--muted); }
.bl-actions { display: flex; flex: none; margin: -4px -4px -4px 0; }
.bl-row.editing { display: block; }
.bl-row[draggable] { cursor: grab; }
.bl-row.dragging { opacity: .4; }
.bl-row.drop-before { box-shadow: inset 0 2px 0 var(--link); }
.bl-row.drop-after { box-shadow: inset 0 -2px 0 var(--link); }
.bl-grip { display: inline-flex; flex: none; margin: 2px -4px 0 -4px; color: var(--muted); opacity: .45; }
.bl-grip .icon { width: 14px; height: 14px; transform: rotate(90deg); }
.bl-row:hover .bl-grip { opacity: 1; }
.bl-edit { display: flex; flex-direction: column; gap: 8px; }
.bl-edit-foot { display: flex; justify-content: flex-end; gap: 8px; }
.bl-empty { padding: 18px 12px; text-align: center; }
.bl-done { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.bl-head { font-size: 17px; font-weight: 600; margin-top: 6px; }
.bl-talk { position: relative; }
.bl-count { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--bg-accent); color: var(--on-accent); font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
.bl-thread { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding-left: 10px; border-left: 2px solid var(--border); }
.bl-comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bl-comment-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.bl-comment-body { font-size: 14px; overflow-wrap: anywhere; }
.bl-comment.editing, .bl-compose { display: flex; flex-direction: column; gap: 8px; }

/* --- shared row controls --------------------------------------------------- */
input[type="checkbox"] { accent-color: var(--link); width: 16px; height: 16px; cursor: pointer; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  background: none; border: 0; border-radius: var(--radius); color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--hover-faint); color: var(--text); }
.icon-btn.active { color: var(--link); }
.queue-btn.active svg { fill: currentColor; }
.icon-btn.danger:hover { background: rgba(239,106,106,.15); color: var(--danger); }
.row-actions { display: flex; align-items: center; gap: 2px; }
.row-actions .icon-btn { color: var(--link); }
.row-actions .icon-btn:not(.danger):hover { color: var(--link-hover); }
.row-actions .icon { width: 1.3em; height: 1.3em; }

.stars { display: inline-flex; gap: 2px; }
.star { background: none; border: 0; padding: 1px; cursor: pointer; display: inline-flex; color: var(--muted); }
.star .icon svg { width: 15px; height: 15px; fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.star.filled .icon svg { fill: var(--gold); stroke: var(--gold); }
.star:hover .icon svg { stroke: var(--gold); }

.thumb {
  width: 44px; height: 44px; border-radius: var(--radius); object-fit: cover; flex: none;
  background: var(--bg-row-alt);
}
.thumb.placeholder { display: flex; align-items: center; justify-content: center; color: var(--thumb-icon); }
.thumb.placeholder .icon { width: 20px; height: 20px; }

.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(239,106,106,.12); }
.btn[disabled] { opacity: .4; cursor: default; }
.btn[disabled]:hover { background: var(--bg-field); }

/* --- bulk selection bar ----------------------------------------------------- */
.bulk-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--bg-panel); border-bottom: 1px solid var(--border-strong);
}
.bulk-bar .link-btn { white-space: nowrap; }

/* --- recipe table ------------------------------------------------------- */
.table-scroll { overflow-x: auto; }
.recipe-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.recipe-table th, .recipe-table td { padding: 8px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.recipe-table thead th { position: sticky; top: 0; background: var(--bg-panel); color: var(--muted); font-weight: 600; z-index: 2; }
.recipe-table tbody tr { cursor: pointer; }
.recipe-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.recipe-table tbody tr:hover { background: var(--hover); }
.recipe-table tbody tr.is-selected { background: var(--selected); }
.recipe-table td.col-title { white-space: normal; max-width: 320px; }
.recipe-table .recipe-link { color: var(--text); font-weight: 600; }
.recipe-table .recipe-link:hover { color: var(--link); }
.col-check, .col-photo, .col-actions { width: 1%; }
.check-cell { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.row-num { min-width: 2ch; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.col-rating { width: 1%; }

.sort-btn {
  display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0;
  color: inherit; font: inherit; font-weight: 600; cursor: pointer;
}
.sort-btn:hover { color: var(--text); }
.sort-arrow { width: 11px; height: 11px; transition: transform .15s; }
.sort-arrow.up { transform: rotate(180deg); }

/* --- recipe grid --------------------------------------------------------- */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; padding: 16px; }
.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; overflow: hidden; }
.card:hover { border-color: var(--border-strong); }
.card.is-selected { outline: 2px solid var(--link); outline-offset: -1px; }
.card-photo { position: relative; aspect-ratio: 4 / 3; }
.card-photo .thumb { width: 100%; height: 100%; border-radius: 0; }
.card-photo input[type="checkbox"] { position: absolute; top: 8px; left: 8px; }
.card-queue.card-queue { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.45); color: #fff; }
.card-queue.card-queue:hover { background: rgba(0,0,0,.65); }
.card-queue.card-queue.active { color: var(--link); }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.card-title {
  font-size: 15px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12.5px; margin: 0; }

/* --- pagination ------------------------------------------------------------ */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; }

/* --- modals (recipe view / form) ------------------------------------------- */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: var(--backdrop);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 640px; background: var(--bg-panel); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 20px 60px var(--shadow); display: flex; flex-direction: column; max-height: 90vh;
  overflow: hidden;
}
.modal.wide { max-width: 920px; }
.modal-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg-nav); border-radius: 8px 8px 0 0;
}
/* Modal type, one style per role ("Ruled sections"): title 20/700, section 15/700 on a full-width
   rule, sub-header 14/600, label 12.5/600 muted, body 15/1.45, meta 12.5 muted. All sentence case. */
.modal { line-height: 1.45; }
.modal-head h2 { font-size: 20px; font-weight: 700; line-height: 1.2; }
.modal-close { width: 32px; height: 32px; font-size: 20px; line-height: 1; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  flex: none; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px;
  border-top: 1px solid var(--border); background: var(--bg-panel); border-radius: 0 0 8px 8px;
}
/* Confirm dialog (modals/confirm.js): small, centered higher, the destructive button filled red. */
.modal.modal-confirm { max-width: 440px; margin-top: 12vh; }
.confirm-dialog { display: flex; flex-direction: column; min-height: 0; }
.confirm-dialog .modal-body p { margin: 0; overflow-wrap: anywhere; }
.btn.danger-solid { background: #b93b3b; border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #cf4a4a; }

.field {
  width: 100%; padding: 8px 10px; background: var(--bg-field); border: 1px solid var(--field-border);
  border-radius: 6px; color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
textarea.field { resize: vertical; font: inherit; }
.form-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-field.inline { flex-direction: row; align-items: center; gap: 8px; }
.form-label { font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.3; }

.ingredient-rows { display: flex; flex-direction: column; margin-bottom: 10px; }
.row-btns { display: flex; gap: 2px; }
.ingredient-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.paste-ingredients { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.paste-screen { gap: 14px; }
.form-links { display: inline-flex; flex-wrap: wrap; gap: 18px; }
.import-error { margin: 0; color: var(--danger); }
.import-notice { padding: 8px 12px; background: rgba(77,179,230,.12); border: 1px solid var(--link); border-radius: var(--radius); }
.import-photo { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.clipper { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--border-strong); }
.clipper h4 { font-size: 14px; font-weight: 600; color: var(--subhead); margin-bottom: 4px; }
.clipper p { margin: 0 0 10px; }
.clipper-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.clipper-btn { cursor: grab; }
.import-photo img { width: 220px; max-width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; background: var(--bg-field); }

/* Section headers sit on a rule: on the h3 itself, or on its .section-head row when it has controls beside it. */
.section-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-strong);
}
.section-head h3 { margin-bottom: 0; }
.view-section > h3, .rv-macro-section > h3 { padding-bottom: 6px; border-bottom: 1px solid var(--border-strong); margin-bottom: 10px; }
/* .modal-body already puts 16px between rows; sections get the rest of --section-gap on top. */
.modal-body > .view-section { margin-top: calc(var(--section-gap) - 16px); }
.view-section h3, .section-head h3, .rv-macro-section > h3 { font-size: 15px; font-weight: 700; line-height: 1.3; letter-spacing: .02em; color: var(--text); }

.tag-toggle-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-toggle {
  padding: 4px 12px; border-radius: 14px; background: var(--bg-field); border: 1px solid var(--border-strong);
  color: var(--text); cursor: pointer; font-size: 13.5px;
}
.tag-toggle.active { background: var(--bg-accent); border-color: var(--link); color: var(--on-accent); }

/* --- recipe view ------------------------------------------------------- */
.recipe-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.deleted-banner { padding: 8px 12px; background: rgba(239,106,106,.15); border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger-text); }
/* Read-only values sit where the Edit form's inputs do, same height, no box. */
.view-value { min-height: 36px; padding: 8px 0; overflow-wrap: anywhere; }
.nutrition-row .view-value { min-height: 0; padding: 0; text-align: right; }
.tag-toggle.static { cursor: default; }
.ingredient-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ingredient-list .heading { font-size: 14px; font-weight: 600; margin-top: 10px; color: var(--subhead); }
.ingredient-list .heading:first-child { margin-top: 0; }
.ing-tab i { font-style: normal; font-weight: 400; color: var(--muted); }
/* Nutrition per serving as a slim data sheet (the Compact data sheet mockup). */
.nf-sheet-title.nf-sheet-title { font-size: 14px; font-weight: 600; color: var(--subhead); margin-bottom: 4px; }
/* Rows spaced like the ingredient rail's: 6px above and below, a faint divider, body-size text. */
.nf-sheet { width: 100%; max-width: 420px; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.nf-sheet td { padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.nf-sheet tr:last-child td { border-bottom: 0; }
.nf-sheet td:last-child { text-align: right; color: var(--muted); padding-left: 12px; white-space: nowrap; }
.nf-sheet tr.cal td:first-child { font-weight: 700; }
.nf-sheet tr.sub td:first-child { padding-left: 14px; color: var(--muted); }
/* Watching: sodium, sugars and fiber per serving vs. daily value. Sodium and sugars are limits
   (high = red); fiber is a target (high = green, low = amber). */
.rv-watch-rows { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.rv-watch-row { --c: var(--text); display: grid; grid-template-columns: 64px minmax(0, 1fr) 120px; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; }
.rv-watch-row.is-good { --c: var(--good); }
.rv-watch-row.is-mid { --c: var(--mid); }
.rv-watch-row.is-warn { --c: var(--warn); }
.rv-watch-row.is-bad { --c: var(--bad); }
.rv-watch-row.is-none { --c: var(--muted); }
.rv-watch-row .n { font-weight: 600; }
.rv-watch-row .r { text-align: right; font-size: 14px; color: var(--c); white-space: nowrap; }
.rv-watch-row .missing { color: var(--muted); font-style: italic; }
.rv-watch-row .link-btn { justify-self: end; }
.rv-watch-bar { position: relative; height: 10px; border-radius: 10px; background: var(--meter); }
.rv-watch-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 10px; background: var(--c); }
.rv-watch-bar .tick { position: absolute; left: 20%; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; }
.rv-watch-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
@media (max-width: 520px) { .rv-watch-row { grid-template-columns: 60px minmax(0, 1fr); } .rv-watch-row .r, .rv-watch-row .link-btn { grid-column: 1 / -1; text-align: left; justify-self: start; } }

/* Macro ring, %DV bars and flags under the sheet (the Nutrition first mockup). */
.rv-macro-section { margin-top: 0; } /* a section of its own in .rv-meta, which spaces it */
/* (i) tooltip beside a section header; opens on hover or focus, so a tap works on phones. */
.info-tip { position: relative; display: inline-flex; vertical-align: middle; }
.info-tip-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: help;
}
.info-tip-btn:hover, .info-tip-btn:focus-visible { color: var(--link); }
.info-tip-text {
  display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 4; width: 320px; max-width: calc(100vw - 64px);
  flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg-nav); box-shadow: 0 8px 24px var(--shadow);
  font-size: 13px; font-weight: 400; letter-spacing: 0; line-height: 1.45; color: var(--text); text-transform: none;
}
.info-tip:hover .info-tip-text, .info-tip:focus-within .info-tip-text { display: flex; }
.rv-macros { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: center; max-width: 600px; }
.rv-ring { width: 180px; height: 180px; border-radius: 50%; display: grid; place-items: center; }
.rv-ring > div {
  width: 124px; height: 124px; border-radius: 50%; background: var(--bg-panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.1;
}
.rv-ring b { font-size: 30px; font-variant-numeric: tabular-nums; }
.rv-ring span { font-size: 12.5px; color: var(--muted); }
.rv-mac { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rv-mrow { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.rv-mrow span:last-child { color: var(--muted); text-align: right; white-space: nowrap; }
.rv-mrow.sub span:first-child { padding-left: 12px; color: var(--muted); }
.rv-mbar { height: 8px; border-radius: 8px; background: var(--meter); overflow: hidden; }
.rv-mbar i { display: block; height: 100%; }
.rv-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.rv-flag { font-size: 11.5px; border-radius: 4px; padding: 2px 8px; background: var(--flag-bg); color: var(--flag-text); }
.rv-flag.ok { background: var(--good-bg); color: var(--good); }
@media (max-width: 520px) { .rv-macros { grid-template-columns: 1fr; justify-items: center; } .rv-mac { width: 100%; } }
.orig-qty { color: var(--muted); font-size: 12.5px; font-style: italic; }
/* The line-item editor needs the full modal width. */
.directions { line-height: 1.6; }

/* Formatted Description / Directions (static/js/rich-text.js) */
.rich p { margin: 0 0 .6em; }
.rich ul, .rich ol { margin: 0 0 .6em; padding-left: 1.5em; }
.rich li { margin: .2em 0; }
.rich > :last-child { margin-bottom: 0; }
.rich-editor { display: flex; flex-direction: column; }
.rich-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--bg-nav);
  border: 1px solid var(--field-border); border-bottom: 0; border-radius: 6px 6px 0 0;
}
.rich-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px;
  background: none; border: 0; border-radius: var(--radius); color: var(--muted); cursor: pointer;
}
.rich-btn:hover { background: var(--hover-faint); color: var(--text); }
.rich-btn.active { background: var(--bg-accent); color: var(--on-accent); }
.rich-area { border-radius: 0 0 6px 6px; line-height: 1.5; cursor: text; overflow-wrap: anywhere; }
.rich-area:focus { outline: 1px solid var(--link); outline-offset: -1px; }
.edit-header-actions .btn.selected { background: var(--bg-accent); border-color: var(--link); color: var(--on-accent); }

.stars.lg .star .icon svg { width: 22px; height: 22px; }

/* Recipe view: photo hero, stat strip, then ingredients beside directions. */
.rv-scroll { flex: 1; min-height: 0; overflow-y: auto; }
/* Zero height, so the pinned actions overlay the hero instead of taking a row. */
.rv-tools { position: sticky; top: 0; z-index: 3; height: 0; }
.rv-tools-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px; }
.rv-glass.rv-glass { background: rgba(0,17,26,.62); border-color: rgba(255,255,255,.22); color: #fff; backdrop-filter: blur(6px); }
.rv-glass.rv-glass:hover { background: rgba(0,17,26,.85); }
.rv-glass.rv-glass.danger { color: #ffb3b3; }
.rv-hero {
  position: relative; min-height: 320px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  padding: 72px 24px 22px; background: var(--bg-field); overflow: hidden;
  color: #e9eef2; /* always dark: a photo under a dark overlay, or the fixed gradient */
}
.rv-hero.no-photo { min-height: 0; background: linear-gradient(160deg, #004466, #00111a); }
.rv-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rv-hero:not(.no-photo)::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,17,26,.96) 12%, rgba(0,17,26,.3) 60%, rgba(0,17,26,.55));
}
.rv-hero > :not(.rv-hero-img) { position: relative; z-index: 1; }
.rv-hero h1 { font-size: 20px; font-weight: 700; line-height: 1.2; color: #fff; text-wrap: balance; }
.rv-hero-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rv-chip { padding: 2px 10px; border-radius: 999px; background: rgba(0,17,26,.55); border: 1px solid rgba(255,255,255,.18); font-size: 12.5px; }
.rv-photo-actions { display: flex; gap: 6px; margin-left: auto; }
.rv-photo-actions .btn { padding: 4px 10px; font-size: 12.5px; }
.rv-source { color: rgba(233,238,242,.75); font-size: 13.5px; overflow-wrap: anywhere; }
.rv-desc { max-width: 68ch; color: #c9d6e0; }
/* Stat strip in the Big numbers style: large figures between rules, cells split by thin lines. */
.rv-strip {
  display: flex; flex-wrap: wrap; align-items: stretch;
  padding: 0 24px; border-block: 1px solid var(--border-strong);
}
/* --border matches the modal background, so the dividers use --border-strong to show. */
.rv-stat { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 12px 22px; border-left: 1px solid var(--border-strong); }
.rv-stat:first-child { padding-left: 0; border-left: 0; }
.rv-big { display: flex; align-items: baseline; gap: 8px; min-height: 36px; font-size: 32px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rv-big .n small { font-size: 13px; font-weight: 600; color: var(--muted); }
.rv-big .n.word { font-size: 18px; font-weight: 700; }
.rv-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Serves: the Nutrition first mockup's boxed stepper (one outline, filled − / + ends), kept at the
   strip's big-figure size. The number can still be typed in. */
.rv-stepper {
  display: inline-flex; align-items: stretch; height: 40px;
  border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden;
}
.rv-stat .rv-stepper { align-self: flex-start; }
.rv-stepper button {
  width: 34px; border: 0; border-radius: 0; background: var(--bg-field);
  color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; padding: 0;
}
.rv-stepper button:hover { background: var(--bg-accent); }
.rv-stepper .field {
  width: 2.2em; height: auto; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent;
  text-align: center; font-size: 32px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.rv-stepper .field:focus { outline: 0; background: rgba(77,179,230,.1); }
.rv-stepper .field::-webkit-inner-spin-button, .rv-stepper .field::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.rv-queue { margin-left: auto; align-self: center; width: 36px; height: 36px; }
.rv-queue .icon { width: 22px; height: 22px; }
/* Ingredients in a tinted rail that stays in view; directions get the rest of the width. */
.rv-cook { display: grid; grid-template-columns: minmax(0, 290px) minmax(0, 1fr); border-bottom: 1px solid var(--border); }
.rv-cook .section-head { min-height: 32px; }
.rv-rail { background: var(--bg-rail); border-right: 1px solid var(--border-strong); }
.rv-rail-inner { position: sticky; top: 0; max-height: 90vh; overflow-y: auto; padding: 18px 18px 22px; }
.rv-rail .ingredient-list { gap: 0; }
.rv-rail .ingredient-list li { padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.rv-rail .ingredient-list li:last-child { border-bottom: 0; }
.rv-rail .ingredient-list .heading {
  border-bottom: 0; padding: 14px 0 2px; margin: 0;
}
.rv-rail .ingredient-list .heading:first-child { padding-top: 0; }
.rv-rail .ing-amt { color: var(--link); font-weight: 600; font-variant-numeric: tabular-nums; }
.rv-steps-col { padding: 18px 24px 24px; }
/* Directions down a timeline, as in the Step timeline mockup: node, time and label, text, ingredient chips. */
.rv-steps { counter-reset: step; position: relative; display: flex; flex-direction: column; gap: 18px; font-size: 15px; line-height: 1.5; }
/* The timeline's spine, running behind the step nodes. */
.rv-steps::before {
  content: ""; position: absolute; left: 11px; top: 12px; bottom: 12px; width: 2px;
  background: linear-gradient(var(--link), var(--bg-accent));
}
.rv-step { counter-increment: step; position: relative; padding-left: 40px; min-height: 24px; display: flex; flex-direction: column; gap: 4px; }
.rv-step::before {
  content: counter(step); position: absolute; left: 0; top: -1px; width: 24px; height: 24px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--bg-panel); border: 2px solid var(--link); color: var(--text); font-size: 12px; font-weight: 700; line-height: 1;
}
.rv-step-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; line-height: 1.2; }
.rv-step-time { display: inline-flex; align-items: center; gap: 4px; color: var(--link); font-size: 13px; font-weight: 700; }
.rv-step-title { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.rv-step-body.rich p { margin: 0 0 .4em; }
.rv-step-body.rich > :last-child { margin-bottom: 0; }
.rv-step-uses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.rv-ing-chip { padding: 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 13px; line-height: 1.5; }
.rv-step-heading {
  position: relative; padding-left: 40px; font-size: 14px; font-weight: 600; color: var(--subhead);
}
/* Categories, Tags and Nutrition, under the directions in the same column. */
.rv-meta { display: flex; flex-direction: column; gap: var(--section-gap); margin-top: var(--section-gap); }
.rv-meta .view-section + .view-section { margin-top: 0; }
.rv-deleted { margin: 16px 24px 0; }

@media (max-width: 760px) {
  .rv-cook { grid-template-columns: 1fr; }
  .rv-rail { border-right: 0; border-bottom: 1px solid var(--border-strong); }
  .rv-rail-inner { position: static; max-height: none; padding: 16px; }
  .rv-steps-col { padding: 16px; }
  .rv-hero { min-height: 260px; padding: 96px 16px 18px; }
  .rv-strip { padding-left: 16px; padding-right: 16px; }
  /* Two figures per row on phones, split by rules instead of side lines. */
  .rv-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-stat, .rv-stat:first-child { padding: 10px 0; border-left: 0; border-top: 1px solid var(--border-strong); }
  .rv-stat:nth-child(-n + 2) { border-top: 0; }
  .rv-big, .rv-stepper .field { font-size: 26px; }
  .rv-queue { grid-column: 1 / -1; justify-self: end; }
}

/* --- recipe edit form: the recipe view's layout with the inputs in place (recipe-form.js) --- */
.recipe-edit-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.edit-header {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg-nav); border-radius: 8px 8px 0 0;
}
.edit-header h1 { font-size: 20px; font-weight: 700; line-height: 1.2; }
.edit-header-actions { display: flex; gap: 10px; }
.rv-glass.rv-glass.primary { border-color: var(--link); }
.unsaved-chip { align-self: center; color: var(--warn); border-color: rgba(243,194,107,.55); }
.form-scroll .import-notice { margin: 16px 24px 0; }

/* Photo header: title, source and description typed on the photo; a dashed underline marks them editable. */
.form-hero .hero-input {
  width: calc(100% + 10px); max-width: 68ch; margin-left: -5px; padding: 2px 4px; font: inherit; color: #fff;
  background: transparent; border: 1px dashed transparent; border-bottom-color: rgba(255,255,255,.35); border-radius: 4px;
}
.form-hero .hero-input:hover { border-color: rgba(255,255,255,.35); }
.form-hero .hero-input:focus { outline: 0; border-style: solid; border-color: var(--link); background: rgba(0,17,26,.6); }
.form-hero .hero-input::placeholder { color: rgba(233,238,242,.5); }
.form-hero .hero-title { font-size: 20px; font-weight: 700; line-height: 1.2; }
.form-hero .hero-source { font-size: 13.5px; color: rgba(233,238,242,.85); }
.hero-desc { max-width: 68ch; margin-top: 4px; }
.hero-desc .rich-toolbar { background: rgba(0,17,26,.62); border-color: rgba(255,255,255,.18); }
.hero-desc .rich-btn { color: rgba(233,238,242,.75); }
.hero-desc .rich-area { background: rgba(0,17,26,.5); border-color: rgba(255,255,255,.18); box-shadow: none; color: #c9d6e0; }
/* Course, Cuisine and Main ingredient as the header's chips; dashed "+ Course" when empty. */
.rv-chip.chip-select {
  appearance: none; -webkit-appearance: none; cursor: pointer; color: #fff; font: inherit; font-size: 12.5px; line-height: 1.5;
  padding: 2px 24px 2px 10px;
  background: rgba(0,17,26,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e9eef2' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 10px;
}
.rv-chip.chip-select.is-empty { border-style: dashed; color: rgba(233,238,242,.7); }
.rv-chip.chip-select:hover { border-color: rgba(255,255,255,.45); }
.rv-chip.chip-select:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.chip-select option { background: var(--bg-nav); color: var(--text); }

/* Stat strip: the view's big figures as borderless number boxes. */
.form-strip .rv-big .n { display: inline-flex; align-items: baseline; cursor: text; }
.form-strip .cook-total .n { cursor: default; }
.form-strip .cook-total .none { color: var(--border-strong); }
.big-input {
  font: inherit; color: inherit; background: transparent; border: 0; border-bottom: 1px dashed var(--border-strong); border-radius: 0;
  padding: 0; field-sizing: content; min-width: 1.2ch; max-width: 4ch; text-align: center;
  appearance: textfield; -moz-appearance: textfield;
}
@supports not (field-sizing: content) { .big-input { width: 2.4ch; } .big-input.big-text { width: 10ch; } }
.big-input::-webkit-inner-spin-button, .big-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.big-input::placeholder, .rv-stepper .field::placeholder { color: var(--border-strong); }
.big-input:hover { border-bottom-color: var(--muted); }
.big-input:focus { outline: 0; border-bottom: 2px solid var(--link); background: rgba(77,179,230,.1); }
.big-input.big-text { min-width: 7ch; max-width: 16ch; font-size: 18px; font-weight: 700; text-align: left; }

/* Ingredient rows read like the view's list; a click opens a row's inputs. */
.ing-line {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 6px; align-items: center;
  padding: 2px 0; border-bottom: 1px solid var(--hairline);
}
.ing-line:last-child { border-bottom: 0; }
.ing-line.heading { border-bottom: 0; padding-top: 10px; }
.ing-line.heading .ing-text { font-weight: 600; color: var(--subhead); }
.ing-grip { display: inline-flex; color: var(--muted); cursor: grab; opacity: .45; }
.ing-grip .icon { width: 14px; height: 14px; transform: rotate(90deg); }
.ing-line:hover .ing-grip { opacity: 1; }
.ing-text {
  min-width: 0; margin-left: -4px; padding: 4px; text-align: left; font: inherit; line-height: 1.4; color: var(--text);
  background: none; border: 0; border-radius: 4px; cursor: text; overflow-wrap: anywhere;
}
.ing-text:hover { background: var(--hover-faint); }
.ing-line .icon-btn { color: var(--muted); }
.ing-line.dragging { opacity: .4; }
.ing-line.drop-before { box-shadow: inset 0 2px 0 var(--link); }
.ing-line.drop-after { box-shadow: inset 0 -2px 0 var(--link); }
.ing-edit {
  display: grid; grid-template-columns: 56px 64px minmax(0, 1fr) auto;
  grid-template-areas: "qty unit name name" "suggest suggest suggest suggest" "note note note note" "pantry pantry pantry btns";
  gap: 4px; margin: 2px -8px; padding: 6px 8px; background: var(--inset-bg); border-radius: 6px;
}
.ing-edit.heading-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name btns"; }
.ing-edit .field { padding: 6px 8px; }
.ing-edit .qty { grid-area: qty; color: var(--link); font-weight: 600; }
.ing-edit .unit { grid-area: unit; }
.ing-edit .name { grid-area: name; font-weight: 600; }
.ing-edit .note { grid-area: note; }
.ing-edit .row-btns { grid-area: btns; }
.ing-edit .pantry { grid-area: pantry; min-width: 0; }
/* Ingredients matching the name box, listed in the row (a pop-up would be clipped by the rail's scroll). */
.ing-suggest {
  grid-area: suggest; display: flex; flex-direction: column; gap: 1px; padding: 4px;
  background: var(--bg-pop); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: 0 6px 16px var(--shadow);
}
.ing-suggest-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border: 0; border-radius: 4px;
  background: none; font: inherit; font-size: 13.5px; color: var(--text); text-align: left; cursor: pointer;
}
.ing-suggest-row:hover, .ing-suggest-row.on { background: var(--hover); }
.ing-suggest-row .muted { font-size: 12px; }
.ing-suggest-name { font-weight: 600; overflow-wrap: anywhere; }
/* The dot after an ingredient Pantry has no nutrition for; its title says why. */
.nutri-flag {
  display: inline-block; width: 7px; height: 7px; margin: 0 2px 1px 6px; border-radius: 50%;
  background: var(--flag); vertical-align: middle; cursor: help;
}
.nutri-flag:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.nf-source { font-size: 13px; margin: 0 0 8px; }
.nf-source .nutri-flag { margin-left: 2px; cursor: default; }

/* Directions on the view's step timeline: minutes and label above the text, chips below. */
.step-rows.rv-steps { margin-bottom: 12px; }
.step-rows.is-empty::before { display: none; }
.step-time input, .step-title-input, .step-heading-input {
  font: inherit; color: inherit; background: transparent; border: 0; border-bottom: 1px dashed var(--border-strong); border-radius: 0; padding: 1px 0;
}
.step-time input:focus, .step-title-input:focus, .step-heading-input:focus { outline: 0; border-bottom: 2px solid var(--link); color: var(--text); }
.step-min-input { field-sizing: content; min-width: 1.5ch; max-width: 5ch; text-align: center; appearance: textfield; -moz-appearance: textfield; }
@supports not (field-sizing: content) { .step-min-input { width: 3.5ch; } }
.step-min-input::-webkit-inner-spin-button, .step-min-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.step-time input::placeholder { color: rgba(77,179,230,.45); }
.step-title-input { flex: 1; min-width: 120px; }
.step-edit-meta .row-btns, .step-edit-heading .row-btns { margin-left: auto; }
.step-edit-heading { display: flex; align-items: center; gap: 8px; }
.step-heading-input { flex: 1; min-width: 0; font-weight: 600; }
.step-chip { font: inherit; font-size: 13px; line-height: 1.5; color: var(--text); background: none; cursor: pointer; }
.step-chip.on { background: var(--bg-accent); border-color: var(--link); color: var(--on-accent); }
.step-chip.off { border-style: dashed; color: var(--muted); }
.step-chip:hover { border-color: var(--link); }
.step-uses { align-items: center; }
.step-link { font-size: 13px; }

/* Nutritional Facts typed into the view's data sheet; Watching and the Macro Ring follow it. */
.form-nutrition-preview { display: flex; flex-direction: column; gap: var(--section-gap); }
.nf-edit { display: flex; flex-direction: column; max-width: 420px; font-size: 15px; font-variant-numeric: tabular-nums; }
.nf-erow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 48px; gap: 12px; align-items: center;
  padding: 4px 0; border-bottom: 1px solid var(--hairline); cursor: text;
}
.nf-erow.cal .nf-name { font-weight: 700; }
.nf-erow.sub .nf-name { padding-left: 14px; color: var(--muted); }
.nf-amt { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 4px; }
.nf-input {
  width: 7ch; padding: 2px; font: inherit; color: var(--text); text-align: right;
  background: transparent; border: 0; border-bottom: 1px dashed var(--border-strong); border-radius: 0;
  appearance: textfield; -moz-appearance: textfield;
}
.nf-input::-webkit-inner-spin-button, .nf-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.nf-input:focus { outline: 0; border-bottom: 2px solid var(--link); background: rgba(77,179,230,.08); }
.nf-unit { width: 2.5ch; font-size: 13px; color: var(--muted); }
.nf-dv { text-align: right; color: var(--muted); white-space: nowrap; }
.nf-more { align-self: flex-start; margin-top: 8px; }

.ing-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }

.ing-tab {
  background: none; border: 0; padding: 8px 4px; margin-right: 18px; cursor: pointer;
  color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent;
}
.ing-tab.active { color: var(--text); border-bottom-color: var(--link); }
.ing-panel.hidden, .ing-panel[hidden] { display: none; }
.btn.outline { background: none; }
.ing-panel .muted.small { font-size: 12.5px; display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.ing-panel .muted.small code { background: var(--bg-field); padding: 1px 6px; border-radius: 4px; }

.category-row { display: flex; gap: 14px; flex-wrap: wrap; }
.category-row .form-field { flex: 1; min-width: 140px; }
/* Course / Cuisine / Main Ingredient are sub-headers, like Per serving and ingredient groups. */
.category-row .form-label { font-size: 14px; font-weight: 600; color: var(--subhead); }

/* --- category / tag editor ------------------------------------------------- */
/* Nutrition Facts template editor */
.nt-list { display: flex; flex-direction: column; }
.nt-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 70px 100px 170px 44px 96px; gap: 8px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.nt-head { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.nt-row.is-hidden > .field { opacity: .5; }
.nt-check { display: flex; justify-content: center; }
.nt-builtin { font-size: 12.5px; text-align: center; }
.nt-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nt-sub .nt-name { padding-left: 18px; }
.nt-branch { color: var(--muted); }
.nt-row.nt-top { border-top: 1px solid var(--border-strong); }
.nt-top .nt-name .field { font-weight: 700; }
.nt-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.lookup-add .field.nt-under { flex: 0 0 170px; }

.lookup-add .field.nt-unit { flex: 0 0 90px; }
.lookup-add .field.nt-dv { flex: 0 0 120px; }
.nt-row .field:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 760px) {
  .nt-row { grid-template-columns: auto minmax(0, 1fr) 56px 70px 90px 32px 64px; gap: 4px; }
  .nt-builtin { font-size: 0; }
  .lookup-add { flex-wrap: wrap; }
}
.lookup-add { display: flex; gap: 10px; }
.lookup-add .field { flex: 1; }
.lookup-list { display: flex; flex-direction: column; }
.lookup-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.lookup-row .field { flex: 1; }
.lookup-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- meal planner ----------------------------------------------------------- */
.plan-page { display: flex; height: 100%; }
.plan-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* recipe sidebar: drag recipes from here onto meal slots */
.plan-side {
  width: var(--side-w); flex: none; display: flex; flex-direction: column;
  background: var(--bg-panel); border-right: 1px solid var(--border-strong);
}
.plan-side[hidden] { display: none; }
.plan-side-head { display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.plan-side-tabs { flex: 1; display: flex; }
.plan-side-tab {
  flex: 1; background: none; border: 0; padding: 12px 6px; color: var(--link); font: inherit; font-size: 15px; cursor: pointer;
}
.plan-side-tab:hover { background: var(--hover-side); }
.plan-side-tab.active { background: var(--side-active-bg); color: var(--side-active-text); }
.plan-side-search { margin: 10px 8px; }
.plan-side-list {
  flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--rule-dark);
  scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent;
}
.plan-side-filters { padding: 12px 8px; border-bottom: 1px solid var(--border-strong); }
.plan-side-filters[hidden] { display: none; }
.plan-side-filters .side-actions { padding-top: 10px; }
.plan-group { padding: 8px; text-align: center; font-size: 14px; background: var(--bg-panel); }
.plan-side-row {
  display: flex; align-items: stretch; gap: 10px; margin: 0 0 4px; background: var(--bg-row);
  border-radius: 0 6px 6px 0; cursor: grab; user-select: none; min-height: 56px;
}
.plan-side-row:hover { background: var(--hover); }
.plan-side-row .thumb { width: 56px; height: auto; min-height: 56px; flex: none; border-radius: 0; object-fit: cover; }
.plan-side-title {
  flex: 1; min-width: 0; align-self: center; font-size: 14px; line-height: 1.3; padding: 6px 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.plan-side-tools { flex: none; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 2px 4px; }
.plan-grip { color: var(--muted); display: inline-flex; }
.plan-grip .icon { width: 16px; height: 16px; }
.plan-side-tools .queue-btn { padding: 2px; }
.plan-side-empty { padding: 12px; }
.plan-slot.is-drop { background: var(--selected); outline: 1px dashed var(--link); outline-offset: -2px; }
.plan-card[draggable] { cursor: grab; }
.plan-bar { justify-content: flex-start; gap: 12px; }
.plan-side-tools .plan-btn { padding: 2px; color: var(--link); }
/* Pick a day and meal (add from the list, or move a planned recipe) */
.plan-when-recipe { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.plan-when-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
/* Phones: days stacked down the page, each with its meals */
.plan-days { display: flex; flex-direction: column; }
.plan-day { border-bottom: 2px solid var(--border-strong); }
.plan-day.is-today { background: var(--today-bg); }
.plan-day-title { position: sticky; top: 0; z-index: 2; display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; font-size: 16px; font-weight: 700; background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.plan-day.is-today .plan-day-title { color: var(--link); }
.plan-day-date { font-weight: 400; color: var(--muted); font-size: 14px; }
.plan-today-tag { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--link); border: 1px solid currentColor; border-radius: 10px; padding: 0 8px; }
.plan-days .plan-slot { border-right: 0; padding: 6px 12px 8px; }
.plan-days .plan-slot:last-child { border-bottom: 0; }
.plan-days .plan-slot-head { font-size: 13px; }
.plan-days .plan-add { opacity: 1; padding: 4px; }
.plan-days .plan-add svg { width: 20px; height: 20px; }
.plan-days .plan-card { padding-block: 8px; }
.plan-days .plan-card-title { font-size: 15px; }
@media (max-width: 760px) {
  .plan-page { position: relative; }
  /* The recipe list covers the calendar while it's open. */
  .plan-side { position: absolute; inset: 0; z-index: 20; width: auto; border-right: 0; }
  .plan-bar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .plan-range { order: 5; flex: 1 0 100%; font-size: 16px; }
  .plan-grid .plan-month { min-width: 600px; }
  .plan-side-tools .icon-btn { padding: 6px; }
}
.plan-nav { display: flex; align-items: center; gap: 4px; }
.plan-range { font-size: 17px; font-weight: 600; color: var(--link); }

.plan-grid { flex: 1; min-height: 0; overflow: auto; background: var(--bg-row); }
.plan-week, .plan-month { min-width: 840px; }
.plan-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.plan-head { position: sticky; top: 0; z-index: 2; background: var(--bg-panel); border-bottom: 1px solid var(--border); }

/* week view: "Sun 1" headers over tall slots */
.plan-day-head { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; padding: 8px 12px; font-size: 18px; }
.plan-day-head.is-today { color: var(--link); }
.plan-week .plan-slot { min-height: 92px; }

/* month view: weekday names, then a date band + compact slots per week */
.plan-weekday { text-align: center; padding: 8px; font-size: 14px; }
.plan-month-week { border-bottom: 2px solid var(--border-strong); }
.plan-date-row { background: var(--bg-panel); }
.plan-date { position: relative; display: flex; justify-content: flex-end; padding: 4px 8px; min-height: 44px; }
.plan-date.is-outside .plan-date-label { opacity: .45; }
.plan-date.is-today { color: var(--link); }
.plan-date-label { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.plan-date-mon { font-size: 11px; }
.plan-day-num { font-size: 20px; }
.plan-hide { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; }
.plan-hide svg { width: 14px; height: 14px; }
.plan-month .plan-slot { min-height: 42px; }

.plan-slot { border-right: 1px solid var(--border); border-bottom: 1px dashed var(--border); padding: 2px 4px 4px; min-width: 0; }
.plan-slot:last-child { border-right: 0; }
.plan-slot.is-today { background: var(--today-bg); }
.plan-slot.is-outside { background: var(--outside-bg); }
.plan-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 12px; color: var(--muted); }
.plan-add { padding: 0; opacity: 0; }
.plan-add svg { width: 15px; height: 15px; }
.plan-slot:hover .plan-add, .plan-add:focus-visible { opacity: 1; }
@media (hover: none) { .plan-add { opacity: 1; } }
.plan-card {
  display: flex; align-items: center; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--bg-field); border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 4px 8px; margin-top: 4px; cursor: pointer;
}
.plan-card:hover { border-color: var(--link); }
.plan-card-title { font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-card:hover .plan-card-title { color: var(--link); }

/* popover for a planned recipe: photo + actions */
.plan-pop {
  position: fixed; z-index: 50; width: min(380px, calc(100vw - 16px));
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 6px;
  box-shadow: 0 10px 30px var(--shadow); overflow: hidden;
}
.plan-pop-title { padding: 8px 12px; background: #b9c4cf; color: #0b1a26; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-pop-body { display: flex; }
.plan-pop-photo { width: 55%; aspect-ratio: 1; object-fit: cover; flex: none; border-radius: 0; }
.plan-pop-photo.placeholder { height: auto; }
.plan-pop-photo.placeholder .icon { width: 40px; height: 40px; }
.plan-pop-actions { flex: 1; display: flex; flex-direction: column; }
.plan-pop-action {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: none; border: 0;
  border-bottom: 1px solid var(--border); color: var(--link); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer;
}
.plan-pop-action:hover, .plan-pop-action:focus-visible { background: var(--hover-side); outline: none; }
.plan-pop-action .icon { width: 18px; height: 18px; flex: none; }
.plan-pop-action.danger { color: var(--danger); }

/* --- recipe picker (planner "Add" button) ----------------------------------- */
.picker-results { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.picker-row {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px;
  background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.picker-row:hover { background: var(--bg-field); }
.picker-row .thumb { width: 36px; height: 36px; }


/* --- tooltips (static/js/tooltip.js): one bubble for every title / icon-only label --- */
.tooltip {
  position: fixed; z-index: 200; max-width: 260px; padding: 5px 9px; pointer-events: none;
  background: var(--bg-tooltip); border: 1px solid var(--border-strong); border-radius: 5px; box-shadow: 0 6px 18px var(--shadow);
  color: var(--text); font-size: 12.5px; font-weight: 400; line-height: 1.35; text-align: left; white-space: normal; overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: no-preference) {
  .tooltip:not([hidden]) { animation: tooltip-in .12s ease-out; }
  @keyframes tooltip-in { from { opacity: 0; transform: translateY(3px); } }
}

/* --- toasts --------------------------------------------------------------- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 16px; border-radius: var(--radius); background: var(--bg-panel); border: 1px solid var(--border-strong);
  box-shadow: 0 6px 20px var(--shadow); transition: opacity .25s, transform .25s;
}
.toast-error { border-color: var(--danger); }
.toast-act { margin-left: 14px; font: inherit; font-weight: 600; }
.toast.out { opacity: 0; transform: translateY(6px); }

@media (max-width: 760px) {
  :root { --side-w: 200px; --topbar-h: 100px; }
  .hide-mobile { display: none; }
  .nav-link span:not(.icon) { display: none; }
  .nav-link { padding: 0 14px; }
  /* Two rows on phones: logo and account icons, then the sections spread across the width. */
  .topbar { flex-wrap: wrap; }
  .logo { height: 52px; flex: 1 1 auto; min-width: 0; padding: 0 8px 0 12px; }
  .logo-word { font-size: clamp(14px, 4.3vw, 19px); overflow: hidden; text-overflow: ellipsis; }
  .nav-util { height: 52px; flex: none; }
  .nav-link.util, .nav-link.icon-only { padding: 0 10px; }
  .nav-main { order: 3; flex: 1 0 100%; height: 48px; border-top: 1px solid var(--rule-dark); }
  .nav-main .nav-link { flex: 1; justify-content: center; padding: 0; gap: 6px; }
  .nav-main .nav-link.section span:not(.icon) { display: inline; }
  .nav-main .nav-link.sec-dev { flex: 0 0 auto; padding: 0 14px; }
  .subnav { padding: 4px 8px; gap: 2px; }
  .subnav-link { padding: 6px 11px; font-size: 15px; }
  .subnav-link .icon { display: none; }
}
@media (max-width: 374px) { .logo-word { display: none; } }

/* --- cooking view (static/js/modals/cooking-view.js) ------------------------------ */
/* The recipe view's look: a short photo header with see-through buttons, the steps timeline and
   the shaded ingredients panel; plus step timers, a timer tray, checked-off steps and time left. */
.cook-view {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  background: var(--bg-row); color: var(--text);
}
.rv-hero.cook-hero { flex: none; min-height: 170px; padding: 60px 24px 16px; transition: min-height .2s, padding .2s; }
.cook-view.compact .rv-hero.cook-hero { min-height: 0; padding: 12px 24px; }
.cook-view.compact .cook-hero .rv-hero-meta { display: none; }
.cook-view.compact .cook-hero h1 { padding-right: 300px; }
.cook-hero h1 { font-size: 22px; }
.cook-tools { position: absolute; top: 12px; right: 16px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cook-tools .btn.primary { border-color: var(--link); background: rgba(0,68,102,.85); }
.cook-close { width: 36px; padding: 0; justify-content: center; }
.cook-close .icon { width: 1.2em; height: 1.2em; }

/* Step numbers and the time-left line, on navy under the photo. */
.cook-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 10px 24px; background: var(--bg-nav); border-bottom: 1px solid var(--border-strong); }
.cook-numbers { display: flex; flex-wrap: wrap; gap: 6px; }
/* Serves in the bar: the recipe view's stepper, sized to the bar. */
.cook-serves { display: flex; align-items: center; gap: 10px; }
.cook-serves .rv-stepper { height: 34px; }
.cook-serves .rv-stepper button { width: 32px; }
.cook-serves .rv-stepper .field { width: 2.4em; font-size: 20px; }
.cook-ing-tools { display: inline-flex; align-items: center; gap: 12px; }
.cook-reset { font-size: 13px; }
.cook-ingredients .orig-qty { margin-left: 4px; }
.cook-scale-note {
  margin: 4px 0 0; padding: 8px 10px; border-radius: 6px; font-size: 13.5px;
  background: rgba(244,197,66,.12); border: 1px solid rgba(244,197,66,.5); color: var(--gold-text);
}
.cook-num {
  min-width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--border-strong);
  background: var(--bg-field); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.cook-num.done { background: rgba(92,200,160,.2); border-color: #5cc8a0; color: var(--good); }
.cook-num.selected { background: var(--bg-accent); border-color: var(--link); color: var(--on-accent); }
.cook-progress { flex: 1 1 260px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cook-progress-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cook-progress-row b { color: var(--text); font-weight: 700; }
.cook-progress-bar { height: 6px; border-radius: 3px; background: var(--hover-faint); overflow: hidden; }
.cook-progress-bar i { display: block; height: 100%; background: #5cc8a0; border-radius: 3px; transition: width .3s; }

.cook-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
.cook-left { min-height: 0; overflow-y: auto; padding: 24px 24px 96px; display: flex; flex-direction: column; gap: 20px; }
.cook-ingredients.rv-rail { min-height: 0; overflow-y: auto; padding: 18px 18px 96px; border-right: 0; border-left: 1px solid var(--border-strong); }

.cook-resume {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 18px;
  padding: 10px 14px; border-radius: 8px; background: rgba(77,179,230,.12); border: 1px solid var(--link); font-size: 15px;
}
.cook-resume-actions { display: flex; gap: 8px; }

/* Steps down the timeline: a node per step (tap to check off), time and label, text, ingredient chips. */
.cook-steps { list-style: none; margin: 0; padding: 0; position: relative; display: flex; flex-direction: column; gap: 10px; }
.cook-steps::before {
  content: ""; position: absolute; left: 15px; top: 18px; bottom: 18px; width: 2px;
  background: linear-gradient(var(--link), var(--bg-accent));
}
.cook-step {
  position: relative; padding: 10px 12px 10px 52px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; font-size: 19px; line-height: 1.55;
}
.cook-step.current { border-color: var(--link); background: rgba(77,179,230,.10); }
.cook-node {
  position: absolute; left: 2px; top: 10px; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--bg-row); border: 2px solid var(--link);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer;
}
.cook-node:hover { background: var(--bg-accent); }
.cook-node .icon { width: 15px; height: 15px; }
.cook-step.done .cook-node { background: #5cc8a0; border-color: #5cc8a0; color: #062a1d; }
.cook-step.done .cook-step-body { color: var(--muted); }
.cook-step.done .cook-step-body .found { color: inherit; border-bottom-color: transparent; }
.cook-step-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; line-height: 1.2; font-size: 14px; }
.cook-step-meta b { font-weight: 600; color: var(--muted); }
.cook-step-body.rich p { margin: 0 0 .4em; }
.cook-step-body.rich > :last-child { margin-bottom: 0; }
.cook-step-heading { position: relative; padding-left: 52px; font-weight: 700; font-size: 16px; color: var(--subhead); margin-top: 8px; }
.cook-step-heading:first-child { margin-top: 0; }
.found { color: var(--gold); font-weight: 600; border-bottom: 1px dotted var(--gold); cursor: help; }

/* Tap a step's time to run a timer. */
.cook-timer {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px;
  border: 1px solid var(--link); background: none; color: var(--link); font: inherit; font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.cook-timer:hover { background: rgba(77,179,230,.12); }
.cook-timer.is-running { background: var(--link); color: var(--on-link); }
.cook-timer.is-ringing { background: #f0a64a; border-color: #f0a64a; color: #2a1600; }
.cook-timer .icon { width: 15px; height: 15px; }

/* The ingredients a step uses, as the recipe view's chips; tap to check off. */
.cook-step-uses { display: flex; flex-wrap: wrap; gap: 6px; }
.cook-chip {
  padding: 2px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: none;
  color: var(--text); font: inherit; font-size: 14px; line-height: 1.6; cursor: pointer;
}
.cook-chip b { color: var(--link); font-weight: 600; }
.cook-chip.done { opacity: .45; text-decoration: line-through; }

/* Ingredients: the shaded panel, with a box to tick each line. */
.cook-ingredients .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cook-ready { font-size: 13px; font-weight: 600; color: var(--muted); }
.cook-ingredients .ingredient-list { font-size: 17px; }
.cook-ingredients .ingredient-list .heading { font-size: 15px; }
.cook-ing { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; line-height: 1.4; border-radius: 4px; }
.cook-ing:hover { background: var(--hover-faint); }
.cook-box {
  flex: none; width: 18px; height: 18px; margin-top: 3px; border: 2px solid var(--border-strong); border-radius: 4px;
  display: flex; align-items: center; justify-content: center; color: transparent;
}
.cook-box .icon { width: 13px; height: 13px; }
.cook-ing.done { opacity: .5; }
.cook-ing.done > span:last-child { text-decoration: line-through; }
.cook-ing.done .cook-box { background: #5cc8a0; border-color: #5cc8a0; color: #062a1d; }
.cook-ing.lit { background: rgba(244,197,66,.15); outline: 1px solid var(--gold); }

/* Step by Step: one big step at a time. */
.cook-view.step-mode .cook-step:not(.current),
.cook-view.step-mode .cook-step-heading,
.cook-view.step-mode .cook-steps::before { display: none; }
.cook-view.step-mode .cook-step.current { font-size: 28px; line-height: 1.5; padding: 20px 8px 20px 64px; border-color: transparent; background: none; gap: 12px; }
.cook-view.step-mode .cook-step.current .cook-node { width: 44px; height: 44px; top: 20px; font-size: 20px; }
.cook-view.step-mode .cook-step.current .cook-node .icon { width: 22px; height: 22px; }
.cook-view.step-mode .cook-timer { font-size: 17px; padding: 5px 16px; }
.cook-view.step-mode .cook-chip { font-size: 17px; padding: 4px 14px; }
.cook-step-nav { display: flex; justify-content: space-between; gap: 12px; }
.cook-step-nav .btn { padding: 10px 18px; font-size: 16px; }

/* Running timers, stacked in the corner so another step can be followed meanwhile. */
.cook-tray {
  position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
  right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.cook-tray-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-radius: 8px;
  background: var(--tray-bg); border: 1px solid var(--tray-border); backdrop-filter: blur(6px);
  box-shadow: 0 6px 20px var(--shadow); font-size: 14px;
}
.cook-tray-item b { font-size: 18px; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.cook-tray-item.is-running b { color: var(--link); }
.cook-tray-item.is-ringing { border-color: #f0a64a; }
.cook-tray-item.is-ringing b { color: #f0a64a; }
.cook-tray-name { background: none; border: 0; padding: 0; color: var(--text); font: inherit; cursor: pointer; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook-tray-name:hover { color: var(--link); }
.cook-tray-item .icon-btn { width: 30px; height: 30px; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .rv-hero.cook-hero, .cook-progress-bar i { transition: none; } }

@media (max-width: 760px) {
  .rv-hero.cook-hero { min-height: 140px; padding: 56px 14px 12px; }
  .cook-view.compact .rv-hero.cook-hero { padding: 10px 14px; }
  .cook-view.compact .cook-hero h1 { padding-right: 0; display: none; }
  .cook-hero h1 { font-size: 19px; }
  .cook-tools { top: 8px; right: 8px; }
  .cook-view.compact .cook-tools { position: static; }
  .cook-bar { padding: 8px 14px; }
  .cook-body { display: block; overflow-y: auto; }
  .cook-left { overflow: visible; padding: 16px; }
  .cook-ingredients.rv-rail { overflow: visible; padding: 16px 16px 96px; border-left: 0; border-top: 1px solid var(--border-strong); }
  .cook-step { font-size: 17px; }
  .cook-view.step-mode .cook-step.current { font-size: 22px; padding: 12px 0 12px 56px; }
  .cook-view.step-mode .cook-step.current .cook-node { top: 12px; }
}

/* --- nutrition tracker (static/js/pages/track.js, goals.js, progress.js) ------------ */
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-foot .push-left { margin-right: auto; }

.track-page { height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.track-bar { flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.track-bar .pill .icon { width: 16px; height: 16px; }
.track-date { font-size: 18px; font-weight: 600; }
.track-date small { margin-left: 8px; font-size: 14px; font-weight: 400; color: var(--bar-text); opacity: .8; }
.track-date-input { width: auto; }
.track-body { padding: 16px; }
.track-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; max-width: 1200px; margin: 0 auto; align-items: start; }
.track-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.track-panel { background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.track-panel p { margin: 0; }
.track-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.track-panel-head h3 { font-size: 18px; }
.track-full { grid-column: 1 / -1; }

/* Week strip: the last seven days, a calorie ring and watch dots each; the day shown is filled. */
.track-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 8px; }
.tw-day {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 2px; border-radius: 6px;
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; --ring-bg: var(--bg-panel);
}
.tw-day:hover { background: var(--bg-field); --ring-bg: var(--bg-field); }
.tw-day.selected { background: var(--bg-accent); color: var(--text); font-weight: 600; --ring-bg: var(--bg-accent); }
.tw-ring {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) 0 var(--p), var(--meter) var(--p) 100%);
}
.tw-ring::after { content: ""; width: 22px; height: 22px; border-radius: 50%; background: var(--ring-bg); }
.tw-dots { display: flex; gap: 3px; min-height: 5px; }
.tw-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--mid); }
.tw-dots i.is-good { background: var(--good); }
.tw-dots i.is-warn { background: var(--warn); }
.tw-dots i.is-bad { background: var(--bad); }

/* Big-number strip: the recipe view's stat strip, without its rules (the panel frames it). */
.track-strip { padding: 0; border-block: 0; }
.track-strip .rv-stat { flex: 1 1 0; min-width: 0; padding-block: 2px; }

/* Warnings above the Watching bars when a limit is close or passed. */
.track-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.track-alert.is-bad { background: var(--bad-bg); color: var(--bad); }
.track-alert .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.track-alert b { color: var(--text); }

/* Macros & Watching: the recipe view's ring and bars, where fiber, sugar and sodium are the
   Watching rows (bar split by meal, planned meals hatched, what's left after them). */
.track-macros .rv-macros { max-width: none; }
.track-macros .rv-mrow { grid-template-columns: 124px minmax(0, 1fr) 200px; }
/* Protein, carbs and fat stand out from the bars under them */
.track-macros .rv-mrow.macro { font-size: 16px; font-weight: 700; }
.track-macros .rv-mrow.macro span:last-child { font-size: 15px; font-weight: 600; color: var(--text); }
/* The amounts under them read the same; fiber and sugar keep their Watching colour */
.track-macros .rv-mrow.sub:not(.track-watch-row) span:last-child { font-size: 15px; font-weight: 600; color: var(--text); }
.track-macros .rv-mrow.sub .track-watch-value b { font-size: 15px; }
/* Every bar in the panel is the same height, the Watching ones too */
.track-macros .rv-mbar, .track-macros .watch-bar { height: 18px; border-radius: 9px; }
.track-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.track-watch-row { --c: var(--text); }
.track-watch-row.is-good { --c: var(--good); }
.track-watch-row.is-mid { --c: var(--mid); }
.track-watch-row.is-warn { --c: var(--warn); }
.track-watch-row.is-bad { --c: var(--bad); }
/* (the .rv-mrow span:last-child rule would grey these out, hence the selectors) */
.track-watch-name { white-space: nowrap; }
.rv-mrow.track-watch-row span.track-watch-kind { margin-left: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--c); text-align: left; }
.rv-mrow span.track-watch-value { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; color: var(--c); }
.track-watch-value b { font-weight: 600; }
.watch-bar { position: relative; display: flex; height: 12px; border-radius: 12px; background: var(--meter); overflow: hidden; }
.watch-bar i { display: block; height: 100%; }
.watch-bar i.watch-plan, .watch-plan-key { background: repeating-linear-gradient(135deg, rgba(var(--hatch),.55) 0 4px, rgba(var(--hatch),.15) 4px 8px); }
.watch-bar i.watch-plan.is-over { background: repeating-linear-gradient(135deg, rgba(255,154,138,.7) 0 4px, rgba(255,154,138,.2) 4px 8px); }
.watch-goal { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: .75; }
.watch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
.watch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.watch-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
@media (max-width: 640px) {
  .track-macros .rv-mrow { grid-template-columns: 92px minmax(0, 1fr) auto; }
  .track-macros .rv-mrow.track-watch-row { grid-template-columns: 1fr; gap: 4px; }
  .rv-mrow span.track-watch-value { align-items: flex-start; }
}
.track-source { font-size: 13px; }

.nutri-row { display: flex; flex-direction: column; gap: 4px; --status: var(--link); }
.nutri-row.is-met { --status: #4fc28a; }
.nutri-row.is-over { --status: var(--danger); }
.nutri-head { display: flex; justify-content: space-between; gap: 10px; }
.nutri-name { font-weight: 600; }
.nutri-bar { display: flex; height: 10px; border-radius: 5px; background: var(--meter); overflow: hidden; }
.nutri-fill { display: block; height: 100%; background: var(--status); border-radius: 5px; transition: width .3s; }
.nutri-plan { display: block; height: 100%; background: repeating-linear-gradient(135deg, rgba(var(--hatch),.5) 0 4px, rgba(var(--hatch),.12) 4px 8px); }
.nutri-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.nutri-foot span:last-child { color: var(--status); }
.nutri-row.untracked .nutri-name { font-weight: 400; color: var(--muted); }
.nutri-row.sub { padding-left: 18px; }
.nutri-row.sub .nutri-name { font-weight: 400; }

.track-meal { display: flex; flex-direction: column; gap: 6px; }
.track-meal h4 { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.track-meal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.track-meal-head .link-btn { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 13px; font-weight: 600; }
.track-meal-head .link-btn .icon { width: 14px; height: 14px; }
.track-meal-head .muted { font-size: 13px; }
/* On an earlier day: put a log on today too (see .track-meal-head for a whole course) */
.track-today { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 13px; font-weight: 600; }
.track-today .icon { width: 14px; height: 14px; }
.track-today.is-there { color: var(--muted); }
/* Meal cards: the recipe's photo, the portion eaten (changed in place), and the recipe view's 5/20 flags. */
.track-card {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px; border-radius: 6px; background: var(--bg-field); border-left: 3px solid var(--mc, var(--border-strong));
}
.track-card.is-food { padding-top: 6px; padding-bottom: 6px; }
.track-food-icon { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; justify-self: center; background: var(--hover-faint); color: var(--mc, var(--muted)); }
.track-food-icon .icon { width: 18px; height: 18px; }
.track-amount { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.track-amount input { width: 80px; }
.track-add { display: flex; flex-wrap: wrap; gap: 8px; }
.track-card.is-planned { background: none; border: 1px dashed var(--border-strong); border-left: 3px dashed var(--mc, var(--border-strong)); }
.track-card .thumb { width: 56px; height: 56px; }
.track-card-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.track-card-title { font: inherit; font-weight: 600; text-align: left; color: var(--text); overflow-wrap: anywhere; }
.track-card-title.link-btn:hover { color: var(--link); }
.track-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--muted); }
.track-card-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.track-portion { display: flex; align-items: center; gap: 4px; }
.track-portion .cook-num { min-width: 34px; height: 30px; border-radius: 15px; font-size: 13.5px; }
.track-portion-input { width: 64px; height: 30px; padding: 2px 6px; }
.track-course { width: auto; max-width: 140px; height: 30px; padding: 2px 6px; font-size: 13px; }
.track-skipped { display: flex; gap: 10px; align-items: baseline; font-size: 13px; padding-left: 4px; }
.meal-pick { padding: 0 14px; }
.track-card .btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.track-card .btn.ghost:hover { color: var(--text); border-color: var(--border-strong); }

/* Copy from another day (static/js/modals/copy-from.js) */
.copy-from { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.copy-from .field { width: auto; }
.copy-when { margin: 0 0 0 6px; }
.copy-list { display: flex; flex-direction: column; gap: 14px; }
.copy-list p { margin: 0; }
.copy-course { display: flex; flex-direction: column; gap: 2px; }
.copy-course-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 4px; }
.copy-course-head h4 { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.copy-course-head .link-btn { font: inherit; font-size: 13px; font-weight: 600; }
.copy-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 7px 8px; border-radius: 6px; background: var(--bg-field); border-left: 3px solid var(--mc, var(--border-strong)); cursor: pointer;
}
.copy-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--link); }
.copy-name { font-weight: 600; overflow-wrap: anywhere; }
.copy-have { margin-left: 8px; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); white-space: nowrap; }
.copy-k { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.copy-sum { margin-right: auto; align-self: center; font-size: 13.5px; }
.copy-sum ~ .btn { white-space: nowrap; }
@media (max-width: 520px) {
  .copy-row { grid-template-columns: auto minmax(0, 1fr); }
  .copy-k { grid-column: 2; white-space: normal; }
}

/* planner cards for meals the signed-in person logged */
.plan-card.is-eaten { border-color: #2f7d58; }
.plan-card-eaten { width: 14px; height: 14px; margin-left: auto; padding-left: 4px; color: #4fc28a; box-sizing: content-box; }

/* log-a-portion dialog */
.portion-when { margin: 0; }
.portion-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.portion-pick .cook-num { min-width: 44px; }
.portion-input { width: 100px; }
.portion-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; }
.portion-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--border); }

@media (max-width: 760px) {
  .track-grid { grid-template-columns: 1fr; }
  .track-body { padding: 12px; }
  .track-strip .rv-stat { flex-basis: 40%; }
  .track-card { grid-template-columns: 48px minmax(0, 1fr); }
  .track-card .thumb { width: 48px; height: 48px; }
  .track-card-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .track-date { font-size: 15px; }
}

/* --- Move & Sleep (static/js/pages/move.js, sleep.js; charts in static/js/health.js) ----- */
.hp-grid { display: flex; flex-direction: column; gap: 16px; max-width: 1200px; margin: 0 auto; }
.hp-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.hp-title { display: flex; align-items: center; gap: 8px; }
.hp-title .icon { width: 20px; height: 20px; }
.hp-energy .hp-title .icon { color: var(--brand-cook); }
.hp-steps .hp-title .icon, .hp-chart .hp-title .icon { color: var(--brand-move); }
.hp-night .hp-title .icon, .hp-stages .hp-title .icon { color: var(--brand-sleep); }
.hp-aside { font-size: 14px; }
.hp-sync { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--bar-text); }
.hp-sync .icon { width: 15px; height: 15px; }
.hp-sync .link-btn { color: inherit; text-decoration: underline; font-size: 14px; }
.hp-headline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.hp-big { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hp-big small { font-size: 15px; font-weight: 400; color: var(--muted); }
.hp-huge { font-size: 44px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; margin-top: 6px; }
.hp-down, .hp-up { font-weight: 600; }
.hp-meter { height: 10px; border-radius: 5px; background: var(--meter); overflow: hidden; }
.hp-meter span { display: block; height: 100%; }
.hp-meter span:not([class*="hs-"]) { background: var(--brand-move); }
.hp-empty { align-items: center; text-align: center; padding: 40px 20px; }
.hp-empty p { max-width: 440px; }

/* Energy balance: eaten against burned on one scale; what's still to come is hatched. */
.hp-ebars { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; }
.hp-elabel { color: var(--subhead); }
.hp-etrack { height: 22px; border-radius: 4px; background: var(--meter); display: flex; overflow: hidden; }
.hp-etrack i { height: 100%; flex: none; }
.hp-evalue { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hc-eaten { --c: var(--brand-cook); background: var(--c); }
.hc-resting { --c: var(--energy-resting); background: var(--c); }
.hc-active { background: var(--brand-move); }
.hp-etrack i.is-planned, .hc-legend i.is-planned { background: repeating-linear-gradient(45deg, var(--c) 0 3px, transparent 3px 7px); }

/* Week strips: Move's step rings, Sleep's bars of hours asleep. */
.tw-note { font-size: 12px; font-variant-numeric: tabular-nums; }
.tw-sleep { width: 16px; height: 40px; display: flex; align-items: flex-end; }
.tw-sleep i { width: 100%; border-radius: 3px 3px 0 0; background: var(--sleep-deep); }
.tw-sleep i.is-met { background: var(--brand-sleep); }

/* Charts */
.hc-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--subhead); }
.hc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hc-legend i { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.hc-legend i.is-dot { width: 8px; height: 8px; border-radius: 50%; }
.hc-legend i.is-line { width: 16px; height: 3px; border-radius: 0; }
.hc-legend i.is-dash { width: 16px; height: 0; border-radius: 0; background: none; border-top: 2px dashed var(--brand-cook); }
.hc-legend .hc-raw { background: var(--energy-resting); }
.hc-legend .hc-avg { background: var(--text); }
.hc-steps.is-met { background: var(--brand-move); }
.hc-steps.is-under { background: var(--steps-under); }
.hc-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.hc-bars { position: relative; display: flex; align-items: flex-end; gap: 3px; }
.is-dense .hc-bars, .is-dense .hc-diverging, .hp-sched-plot.is-dense { gap: 1px; }
.hc-bar { flex: 1; min-width: 0; border-radius: 2px 2px 0 0; background: var(--brand-move); }
.hc-bar.is-under { background: var(--steps-under); }
.hc-stack { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column-reverse; border-radius: 2px 2px 0 0; overflow: hidden; }
.hc-stack i { display: block; flex: none; }
.hc-goal { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--text); pointer-events: none; }
.hc-goal b { position: absolute; right: 0; bottom: 2px; padding: 0 4px; font-size: 12px; font-weight: 600; background: var(--bg-panel); }
.hc-diverging { display: flex; gap: 3px; }
.hc-dcol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hc-up, .hc-down { flex: 1; display: flex; }
.hc-up { align-items: flex-end; border-bottom: 1px solid var(--border-strong); }
.hc-down { align-items: flex-start; }
.hc-div { width: 100%; }
.hc-div.is-over, .hc-div-over { background: var(--brand-cook); }
.hc-div.is-under, .hc-div-under { background: var(--link); }
.hc-line-wrap { padding-right: 34px; }
.hc-plot { position: relative; }
.hc-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hc-rule { position: absolute; left: 0; right: 0; border-top: 1px solid var(--hairline); }
.hc-rule b { position: absolute; right: -34px; transform: translateY(-50%); font-size: 12px; font-weight: 400; color: var(--muted); }
.hc-line { fill: none; stroke-width: 2.5; }
.hc-line.hc-avg { stroke: var(--text); }
.hc-line.hc-pred { stroke: var(--brand-cook); stroke-width: 2; }
.hc-line.is-dashed { stroke-dasharray: 5 4; }
.hc-dot { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--energy-resting); }

/* Calories vs. the scale */
.hp-verdict { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 40px; }
.hp-verdict > div:first-child { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; }
.hp-figures { display: flex; gap: 32px; }
.hp-figures div { display: flex; flex-direction: column; }
.hp-figures b { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hp-figures .muted { font-size: 13px; }

/* Sleep: one night */
.hs-deep { background: var(--sleep-deep); }
.hs-core { background: var(--brand-sleep); }
.hs-rem { background: var(--sleep-rem); }
.hs-asleep { background: var(--sleep-asleep); }
.hs-awake { background: var(--warn); }
.hs-inbed { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--warn) 55%, transparent) 0 3px, transparent 3px 7px); }
.hp-night-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 32px; }
.hp-stats { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.hp-stat { display: flex; flex-direction: column; gap: 2px; }
.hp-stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.hp-stat .muted { font-size: 13px; }
.hp-hypno { display: flex; flex-direction: column; margin-top: 6px; }
.hp-lane { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; }
.hp-lane-name { font-size: 13px; color: var(--muted); }
.hp-lane-track { position: relative; height: 30px; background: var(--meter); }
.hp-lane:first-child .hp-lane-track { border-radius: 4px 4px 0 0; }
.hp-lane:nth-last-child(2) .hp-lane-track { border-radius: 0 0 4px 4px; }
.hp-lane-track i { position: absolute; top: 3px; bottom: 3px; border-radius: 2px; }
.hp-hypno-axis { position: relative; height: 18px; margin: 4px 0 0 56px; font-size: 12px; color: var(--muted); }
.hp-hypno-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.hp-hypno-axis .is-start { left: 0; transform: none; }
.hp-hypno-axis .is-end { right: 0; transform: none; }
.hp-stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 32px; }
.hp-stage { display: flex; flex-direction: column; gap: 6px; }
.hp-stage-head { display: flex; justify-content: space-between; gap: 8px; }
.hp-stage-head i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; }
.hp-stage > .muted { font-size: 13px; }

/* Sleep: bedtime to wake, night by night */
.hp-schedule { display: flex; gap: 8px; height: 220px; }
.hp-schedule + .hc-axis { padding-left: 70px; }
.hp-sched-hours { position: relative; width: 62px; flex: none; font-size: 12px; color: var(--muted); }
.hp-sched-hours span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.hp-sched-plot { position: relative; flex: 1; min-width: 0; display: flex; gap: 3px; }
.hp-sched-col { position: relative; flex: 1; min-width: 0; }
.hp-sched-col i { position: absolute; left: 0; right: 0; border-radius: 3px; background: var(--brand-sleep); }

/* Set up Apple Health (static/js/modals/health-connect.js) */
.hk-body p { margin: 0; }
.hk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hk-status { display: flex; flex-direction: column; gap: 10px; }
.hk-fresh { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--link); border-radius: 8px; background: var(--inset-bg); }
.hk-row { display: flex; flex-direction: column; gap: 4px; }
.hk-copy { display: flex; gap: 8px; }
.hk-copy .field { flex: 1; min-width: 0; font: 13.5px ui-monospace, Consolas, monospace; }
.hk-note { display: flex; gap: 8px; align-items: flex-start; color: var(--warn); font-size: 14px; }
.hk-note .icon { margin-top: 2px; }
.hk-get { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.hk-get .hk-steps { margin-top: 6px; }
.hk-how summary { cursor: pointer; font-weight: 600; color: var(--link); }
.hk-steps { margin: 10px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 760px) {
  .hp-pair { grid-template-columns: 1fr; }
  .hp-sync { flex-basis: 100%; }
  .hp-huge { font-size: 36px; }
  .hp-figures { gap: 20px; }
  .hp-figures b { font-size: 22px; }
}

/* --- pantry ------------------------------------------------------------------ */
.pantry-page { height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.pantry-bar { flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.bar-title { font-size: 20px; font-weight: 700; margin: 0; }
.pantry-search { flex: 1 1 280px; min-width: 0; } /* search runs across the bar, with how many it shows */
.pantry-search input { padding-right: 80px; }
.pantry-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.pantry-more { width: 36px; height: 36px; }
.pantry-bar .btn .icon { width: 16px; height: 16px; }
/* Two columns: the list, and the editor with everything else */
.pantry-body {
  flex: 1; display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); align-items: start;
  width: 100%; max-width: 1500px; margin: 0 auto;
}
.pantry-list { padding: 14px; display: flex; flex-direction: column; gap: 12px; border-right: 1px solid var(--border); min-height: 100%; }
.pantry-rows { display: flex; flex-direction: column; }
.pantry-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.pantry-pager .btn { padding: 5px 10px; }
.pantry-pager .btn:disabled { opacity: .45; cursor: default; }
.pantry-pager-info { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; }
.pantry-pager-info label { display: inline-flex; align-items: center; gap: 6px; }
.pantry-pager .pantry-size { width: auto; padding: 3px 6px; font-size: 13px; }
.pantry-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 10px; width: 100%;
  font: inherit; color: var(--text); text-align: left; background: none; border: 0; border-radius: var(--radius); cursor: pointer;
}
.pantry-line { display: flex; align-items: stretch; border-radius: var(--radius); }
.pantry-line:nth-of-type(even) { background: var(--bg-row-alt); } /* of-type: letter headings don't count */
/* Long A-Z lists: letter headings, and a rail of letters beside the list to jump with */
.pantry-lettered { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; align-items: start; }
.pantry-letter { position: sticky; top: 56px; z-index: 2; margin: 0; padding: 6px 10px 3px; font-size: 13px; font-weight: 800; letter-spacing: .06em; color: var(--link); background: var(--bg-row); border-bottom: 1px solid var(--border-strong); scroll-margin-top: 56px; }
.pantry-rail { position: sticky; top: 64px; display: flex; flex-direction: column; padding: 2px 0; }
.pantry-rail button { width: 22px; padding: 1px 0; border: 0; border-radius: 4px; background: none; font: inherit; font-size: 11px; font-weight: 700; line-height: 1.25; color: var(--link); cursor: pointer; touch-action: none; }
.pantry-rail button:hover, .pantry-rail button:focus-visible { background: var(--hover); outline: 0; }
.pantry-rail button.none { color: var(--muted); opacity: .4; cursor: default; }
.pantry-line.picked { background: rgba(239,106,106,.1); }
.pantry-line .pantry-row { flex: 1; min-width: 0; }
.pr-tick { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 10px; cursor: pointer; }
.pr-tick input { width: 18px; height: 18px; accent-color: var(--link); cursor: pointer; }
.pantry-selbar { display: flex; align-items: center; gap: 12px; min-height: 32px; font-size: 14px; color: var(--muted); }
.pantry-selbar.active { color: var(--text); }
.pantry-selbar .btn { margin-left: auto; padding: 5px 12px; }
.pantry-row:hover { background: var(--hover); }
.pantry-row.selected { background: var(--bg-accent); box-shadow: inset 0 0 0 1px var(--link); }
.pantry-row:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.pr-name { font-weight: 600; overflow-wrap: anywhere; }
.pr-label { width: 18px; height: 24px; object-fit: cover; object-position: top; border-radius: 2px; margin-right: 7px; vertical-align: -6px; background: #fff; border: 1px solid var(--border-strong); }
/* The label photo kept with an ingredient */
.label-photo-row { display: flex; gap: 14px; align-items: flex-start; }
.label-photo-row > a { flex: none; }
.label-photo-thumb { display: block; width: 84px; height: 112px; object-fit: cover; object-position: top; border-radius: 4px; background: #fff; border: 1px solid var(--border-strong); }
.label-photo-info { display: flex; flex-direction: column; gap: 8px; font-size: 14px; min-width: 0; }
.label-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.label-photo-actions .btn { padding: 5px 10px; }
.pr-kcal { text-align: right; font-variant-numeric: tabular-nums; }
.pr-serving, .pr-used { font-size: 13px; color: var(--muted); }
.pr-used { text-align: right; }
.pr-pill { font-size: 12px; color: var(--flag); border: 1px solid currentColor; border-radius: 10px; padding: 0 7px; }
.pantry-empty { padding: 8px 0; }
.pantry-editor { padding: 0 24px 32px; min-width: 0; }
/* What your recipes need that isn't here: at the top of the list */
.pantry-needed { border: 1px solid var(--flag); background: var(--flag-bg); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.pn-head { display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--flag-text); cursor: pointer; text-align: left; }
.pn-head .icon { width: 16px; height: 16px; }
.pn-why { margin: 0 0 2px; font-size: 12.5px; color: var(--flag-text); opacity: .85; }
.pn-row { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 30px; }
.pn-name { overflow-wrap: anywhere; }
.pn-who { flex: 1; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pn-row .btn { padding: 3px 9px; font-size: 13px; }
.pn-row .btn .icon { width: 14px; height: 14px; }
.pn-all { align-self: flex-start; font-size: 13px; }
.pn-row + .pn-why, .pn-all + .pn-why { margin-top: 6px; }
.pn-detail { display: block; font-size: 12px; color: var(--muted); }

/* Other measures: "1 · tbsp · weighs 15 g" rows under the serving */
.pantry-measures { display: flex; flex-direction: column; gap: 6px; }
.pantry-measures:empty { display: none; }
.pantry-measure { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto 72px auto auto; align-items: center; gap: 6px; }
.pantry-measure .field { min-width: 0; }
.pantry-measure .icon-btn .icon { width: 16px; height: 16px; }
.pantry-addmeasure { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; }
.pantry-addmeasure .icon { width: 14px; height: 14px; }
.pantry-measures-field { display: flex; flex-direction: column; gap: 6px; }
.pantry-fixnote { display: flex; gap: 6px; align-items: flex-start; margin: 0; padding: 6px 8px; border-radius: var(--radius); background: var(--flag-bg); color: var(--flag-text); font-size: 13px; }
.pantry-fixnote .icon { flex: none; width: 15px; height: 15px; margin-top: 1px; }
/* Filter chips and the sort */
.pantry-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip { border: 1px solid var(--border-strong); background: none; border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.pchip b { margin-left: 4px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pchip:hover { border-color: var(--link); }
.pchip.on { border-color: var(--link); color: var(--link); background: color-mix(in srgb, var(--link) 12%, transparent); }
.pchip.warn b { color: var(--flag); }
.pchip:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.pantry-sortrow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.pantry-sort { width: auto; height: 30px; padding: 0 8px; font-size: 13px; }
/* Small drop-down menus: Facts from, the three dots */
.pmenu-host { position: relative; display: inline-flex; }
.pmenu { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; min-width: 240px; padding: 5px; display: flex; flex-direction: column; gap: 2px; background: var(--bg-pop); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 12px 30px var(--shadow); }
.pmenu.left { left: 0; right: auto; }
.pmenu button { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 0; border-radius: 5px; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.pmenu button:hover, .pmenu button:focus-visible { background: var(--hover); outline: 0; }
.pmenu button .icon { width: 17px; height: 17px; margin-top: 2px; color: var(--link); flex: none; }
.pmenu small { display: block; font-size: 12.5px; color: var(--muted); }
.pmenu .danger, .pmenu .danger .icon { color: var(--danger); }
/* With nothing picked: what needs doing */
.pantry-overview { max-width: 640px; margin: 40px auto 0; display: flex; flex-direction: column; gap: 14px; }
.pantry-overview h2 { font-size: 22px; font-weight: 700; }
.pantry-overview p { margin: 0; }
.pantry-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pantry-stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-panel); font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.pantry-stat:hover { border-color: var(--link); }
.pantry-stat b { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pantry-stat span { font-size: 13.5px; color: var(--muted); }
.pantry-stat.warn { border-color: var(--flag); }
.pantry-stat.warn b { color: var(--flag); }
.pantry-form { display: flex; flex-direction: column; gap: 14px; max-width: 1100px; }
.pantry-form .hint { font-size: 12.5px; color: var(--muted); }
.pantry-serving { display: grid; grid-template-columns: 90px 110px minmax(0, 1fr); gap: 8px; align-items: center; }
.pantry-serving input { width: 100%; }
.pantry-grams { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.pantry-grams input { max-width: 90px; }
/* One action bar: the three dots, Cancel and Save on the right. Stays in view under the bar. */
.pantry-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  position: sticky; top: 56px; z-index: 6; padding: 12px 0 10px;
  background: var(--bg-row); border-bottom: 1px solid var(--border);
}
.pantry-actions .icon-btn { width: 36px; height: 36px; }
.pantry-back { display: none; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.pantry-save:disabled, .pantry-dock-save:disabled { opacity: .55; cursor: default; }
.pantry-dock { display: none; }
/* The name and details on the left; on the right, how the facts are filled over the Nutrition
   Facts label, in view while you type */
.pantry-cols {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 14px 28px; align-items: start;
  grid-template-areas: "name side" "details side"; grid-template-rows: auto 1fr;
}
.pantry-namebox { grid-area: name; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pantry-details { grid-area: details; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pantry-label-box { display: flex; flex-direction: column; gap: 10px; }
/* No facts yet: a tile per way to fill them. Then one chip saying where they came from. */
.pantry-facts-head { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pantry-facts-head .link-btn { align-self: flex-start; }
.facts-tile { display: flex; align-items: center; gap: 12px; padding: 10px 12px; font: inherit; color: var(--text); text-align: left; background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 6px; cursor: pointer; }
.facts-tile:hover, .facts-tile:focus-visible { border-color: var(--link); background: var(--hover); outline: 0; }
.facts-tile .icon { width: 22px; height: 22px; color: var(--link); flex: none; }
.facts-tile b { display: block; font-weight: 600; }
.facts-tile small { display: block; font-size: 12.5px; color: var(--muted); }
.pantry-facts-head .pmenu-host { max-width: 100%; }
.facts-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px; font: inherit; font-size: 14px; color: var(--text); background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; }
.facts-chip:hover, .facts-chip:focus-visible, .facts-chip[aria-expanded="true"] { border-color: var(--link); outline: 0; }
.facts-chip .icon { width: 16px; height: 16px; color: var(--link); flex: none; }
.facts-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pantry-name { width: 100%; font: inherit; font-size: 24px; font-weight: 700; color: var(--text); background: none; border: 1px dashed transparent; border-radius: 6px; padding: 2px 6px; margin-left: -7px; }
.pantry-name:hover { border-color: var(--border-strong); }
.pantry-name:focus { border-color: var(--link); outline: 0; background: var(--bg-field); }
.pantry-status { margin: -10px 0 0; font-size: 13.5px; color: var(--muted); }
.label-photo-none { margin: 0; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 6px; font-size: 13.5px; color: var(--muted); }
.pantry-label-col { grid-area: side; position: sticky; top: 124px; display: flex; flex-direction: column; gap: 14px; }
/* Drawn like the package label; the paper is white in both themes */
.pantry-label, .nf-label { background: #fff; color: #000; border: 2px solid #000; padding: 6px 8px 8px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.pl-title { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: -.02em; padding-bottom: 3px; border-bottom: 1px solid #000; }
.pl-serving { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-weight: 800; font-size: 14px; border-bottom: 8px solid #000; }
.pl-dvhead { text-align: right; font-size: 11.5px; font-weight: 800; padding: 2px 0; border-bottom: 1px solid #000; }
.pantry-label .nf-edit { max-width: none; font-size: 14px; }
/* A recipe's Nutrition Facts, read-only, in the same package-label look (nutritionLabel) */
.nf-label { max-width: 380px; font-size: 14px; }
.nfl-servings { padding-top: 3px; font-size: 14px; }
.nfl-cal { display: flex; justify-content: space-between; align-items: flex-end; padding: 2px 0; border-bottom: 5px solid #000; font-weight: 900; }
.nfl-cal-head { display: flex; flex-direction: column; font-size: 22px; line-height: 1; }
.nfl-cal-head small { font-size: 12px; font-weight: 800; margin-bottom: 2px; }
.nfl-cal-n { font-size: 30px; line-height: 1; }
.nfl-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid #000; }
.nfl-row.sub .nfl-name { padding-left: 16px; }
.nfl-row.thick { border-bottom-width: 8px; }
.nfl-dv { white-space: nowrap; }
.nfl-foot { margin: 6px 0 0; font-size: 11px; line-height: 1.3; }
.pantry-label .nf-erow { border-bottom: 1px solid #000; padding: 3px 0; color: #000; }
.pantry-label .nf-erow .nf-name { font-weight: 700; }
.pantry-label .nf-erow.sub .nf-name { padding-left: 16px; font-weight: 400; color: #000; }
.pantry-label .nf-erow.cal { border-bottom-width: 5px; font-size: 18px; }
.pantry-label .nf-erow.cal .nf-name { font-weight: 900; }
.pantry-label .nf-input { color: #000; background: #f4f5f6; border-bottom: 1px dashed #888; border-radius: 2px; font-weight: 600; }
.pantry-label .nf-erow.cal .nf-input { font-size: 18px; font-weight: 900; }
.pantry-label .nf-input:focus { background: #fff; border-bottom: 2px solid #0b6aa2; }
.pantry-label .nf-unit { color: #333; }
.pantry-label .nf-dv { color: #000; font-weight: 800; }
.pantry-label .nf-more { color: #0b6aa2; }
.pantry-form .pantry-label .nf-input.fs-filled { background: #d6ebf8; }
/* FatSecret results or the label being read, opened from the tiles or Facts from */
.pantry-fill { min-width: 0; }
.scan-body { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 14px; align-items: start; }
.scan-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pantry-source { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 10px 12px; font-size: 14px; background: rgba(77,179,230,.08); border: 1px solid #1e5a7a; border-radius: var(--radius); }
.pantry-source .icon { color: var(--link); }
.pantry-source-text { flex: 1 1 240px; }
.pantry-form .fs-filled, .pantry-form .nf-input.fs-filled { background: rgba(77,179,230,.16); }
/* Label scan: values Claude couldn't read for sure, the drop target, and the photo beside the form. */
.pantry-form .check-flag, .pantry-form .nf-input.check-flag,
.pantry-form .scan-unsure, .pantry-form .nf-input.scan-unsure,
.modal-label-scan .check-flag, .modal-label-scan .scan-unsure { border-color: var(--flag); box-shadow: 0 0 0 2px color-mix(in srgb, var(--flag) 35%, transparent); }
/* Scan > Nutrition label on Track and Compare (static/js/modals/label-scan.js) */
.ls-reading { display: grid; grid-template-columns: minmax(0, 160px) minmax(0, 1fr); gap: 14px; align-items: center; }
.ls-review { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ls-review .ls-photo { position: sticky; top: 0; }
.ls-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ls-main .scan-details p { margin: 0; font-size: 14px; }
.ls-main .scan-details .icon { vertical-align: -2px; }
@media (max-width: 640px) {
  .ls-review { grid-template-columns: minmax(0, 1fr); }
  .ls-review .ls-photo { position: static; }
  .ls-review .ls-photo img { max-height: 200px; }
}
.pantry-form.scan-drop { outline: 2px dashed var(--link); outline-offset: 6px; border-radius: 6px; background: color-mix(in srgb, var(--link) 6%, transparent); }
.scan-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--bg-pop); border: 1px solid var(--link); border-radius: 6px; box-shadow: 0 8px 24px var(--shadow); }
.scan-head { display: flex; align-items: center; justify-content: space-between; }
.scan-head h3 { font-size: 16px; font-weight: 700; }
.scan-photo { display: block; border-radius: 4px; overflow: hidden; background: #fff; }
.scan-photo img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.scan-status { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.scan-status p { margin: 0; }
.scan-status .icon { vertical-align: -2px; }
.scan-status:has(.spinner) { flex-direction: row; align-items: center; gap: 8px; }
.scan-status.is-error { flex-direction: row; gap: 8px; color: var(--danger); }
.scan-warn { color: var(--flag); }
/* Two-column labels: which column fills the form */
.scan-columns { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.scan-columns-label { font-size: 13.5px; color: var(--muted); }
.seg-row { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-row .btn[aria-pressed="true"] { border-color: var(--link); background: var(--bg-accent); color: var(--on-accent); }
.scan-details { display: flex; flex-direction: column; gap: 6px; }
/* Numbers that don't add up (static/js/nutrition-checks.js) */
.nf-checks { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; padding: 10px 12px; font-size: 14px; color: var(--flag-text); background: var(--flag-bg); border: 1px solid var(--flag); border-radius: var(--radius); }
.nf-checks p { margin: 0; display: flex; gap: 8px; align-items: flex-start; }
.nf-checks .icon { flex: none; margin-top: 2px; color: var(--flag); }
/* Live viewfinder for a label (static/js/modals/label-camera.js); always dark, like a camera app */
.cam { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; overflow: hidden; touch-action: none; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Label-shaped frame; everything around it is dimmed. Its colour says how close the shot is. */
.cam-guide {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: min(80vw, calc(58vh * 0.66)); aspect-ratio: 0.66; border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); border: 2px solid rgba(255, 255, 255, .55);
  transition: border-color .15s;
}
.cam[data-state="near"] .cam-guide { border-color: #f4c542; }
.cam[data-state="good"] .cam-guide { border-color: #4fc28a; }
.cam-guide i { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.cam-guide .c1 { top: -4px; left: -4px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.cam-guide .c2 { top: -4px; right: -4px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.cam-guide .c3 { bottom: -4px; right: -4px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.cam-guide .c4 { bottom: -4px; left: -4px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.cam[data-state="good"] .cam-guide i { border-color: #4fc28a; }
/* fills while the shot holds, then the picture is taken */
.cam-ring { position: absolute; left: 10%; right: 10%; top: -18px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
.cam-ring::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--hold, 0)); background: #4fc28a; transition: transform .15s linear; }
.cam-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(rgba(0,0,0,.6), transparent);
}
.cam-title { font-size: 17px; font-weight: 600; }
.cam-torch { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cam-torch[aria-pressed="true"] { background: #f4c542; color: #000; }
.cam-torch .icon { width: 22px; height: 22px; }
.cam-hint {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 122px); transform: translateX(-50%);
  margin: 0; max-width: calc(100% - 32px); padding: 8px 16px; border-radius: 20px; background: rgba(0,0,0,.72);
  font-size: 16px; text-align: center;
}
.cam[data-state="error"] .cam-hint { background: rgba(160, 40, 40, .9); }
.cam-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 18px) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(transparent, rgba(0,0,0,.75) 35%);
}
.cam-text-btn { background: none; border: 0; color: #fff; font: inherit; font-size: 17px; padding: 12px 4px; cursor: pointer; justify-self: start; }
.cam-bar .cam-text-btn:last-child { justify-self: end; }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; background: none; padding: 5px; cursor: pointer; }
.cam-shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
.cam-shutter:active span { transform: scale(.92); }
.cam-shutter:disabled { opacity: .4; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.on { animation: cam-flash .25s ease-out; }
@keyframes cam-flash { from { opacity: .8; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cam-flash.on { animation: none; } .cam-ring::after { transition: none; } }

/* Barcode viewfinder (static/js/modals/barcode-scanner.js): a wide, short frame with a scan line */
.cam-guide.bc-guide { width: min(86vw, 520px); aspect-ratio: 2.2; top: 44%; }
.bc-laser { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; border-radius: 1px; background: #ef6a6a; box-shadow: 0 0 10px #ef6a6a; }
.bc-cam[data-state="good"] .bc-laser { background: #4fc28a; box-shadow: 0 0 10px #4fc28a; }
@media (prefers-reduced-motion: no-preference) { .bc-laser { animation: bc-sweep 1.4s ease-in-out infinite alternate; } }
@keyframes bc-sweep { from { top: 22%; } to { top: 78%; } }
/* ...and typing the numbers, on a computer */
.bc-row { display: flex; gap: 8px; }
.bc-digits { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 18px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.bc-check { margin: 0; min-height: 18px; font-size: 13px; color: var(--muted); }
.bc-check.ok { color: var(--good); }
.bc-other { display: flex; flex-direction: column; gap: 6px; }
.bc-other-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.bc-status { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.bc-status:empty { display: none; }
.bc-status.bad { color: var(--danger); }
/* An ingredient's barcodes, and what a scan found, in its editor */
.bc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bc-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border: 1px solid var(--border-strong); border-radius: 14px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-variant-numeric: tabular-nums; }
.bc-chip .icon-btn { width: 26px; height: 26px; padding: 4px; }
.pantry-barcodes .pantry-addmeasure { align-self: flex-start; }
.bc-panel p { margin: 0; }
.bc-panel .scan-actions { flex-wrap: wrap; }

/* Use my phone (static/js/modals/phone-handoff.js): the QR code and the wait */
.handoff-body { align-items: center; text-align: center; }
.handoff-lead { margin: 0; }
.handoff-qr { width: 220px; height: 220px; padding: 0; border-radius: 6px; background: #fff; display: grid; place-items: center; }
.handoff-qr svg { width: 100%; height: 100%; display: block; }
.handoff-qr.is-stale { opacity: .25; }
.handoff-or { margin: 0; font-size: 14px; }
.handoff-url { font-family: ui-monospace, Consolas, monospace; color: var(--text); user-select: all; overflow-wrap: anywhere; }
.handoff-status { margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 24px; }

/* Crop the label (static/js/modals/label-crop.js) */
.modal.modal-crop { max-width: 760px; }
.crop-body { align-items: center; gap: 10px; }
.crop-hint { margin: 0; align-self: stretch; font-size: 14px; }
/* As wide as fits, but no taller than --crop-h; --ratio (width / height) comes from the photo. */
.crop-stage { --crop-h: min(62vh, 640px); position: relative; width: min(100%, calc(var(--crop-h) * var(--ratio, 0.75))); aspect-ratio: var(--ratio, 0.75); touch-action: none; user-select: none; -webkit-user-select: none; }
.crop-photo { display: block; width: 100%; height: 100%; border-radius: 4px; }
.crop-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.crop-shade { fill: rgba(0, 0, 0, .55); }
.crop-outline { fill: none; stroke: var(--gold); stroke-width: 3; vector-effect: non-scaling-stroke; }
/* 44px touch target around a 20px dot */
.crop-handle {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; background: none;
  cursor: grab; touch-action: none; display: grid; place-items: center;
}
.crop-handle::after { content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.6); }
.crop-handle.is-dragging { cursor: grabbing; }
.crop-handle.is-dragging::after { transform: scale(1.25); }
.crop-handle:focus-visible { outline: 2px solid var(--link); outline-offset: -6px; border-radius: 50%; }
.modal-crop .modal-foot { flex-wrap: wrap; }
@media (max-width: 760px) {
  .crop-stage { --crop-h: min(52vh, 520px); }
  .modal-crop .modal-body { padding: 12px; }
}
.scan-actions { display: flex; gap: 8px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--link); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* FatSecret lookup panel beside the Pantry form */
.fs-panel { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--bg-pop); border: 1px solid var(--link); border-radius: 6px; box-shadow: 0 8px 24px var(--shadow); }
.fs-head { display: flex; align-items: center; justify-content: space-between; }
.fs-head h3 { font-size: 16px; font-weight: 700; }
.fs-chips { display: flex; gap: 6px; }
.fs-chip { padding: 3px 10px; border-radius: 12px; font-size: 13px; background: none; border: 1px solid var(--border-strong); color: var(--muted); cursor: pointer; }
.fs-chip.on { background: var(--bg-accent); border-color: var(--link); color: var(--text); }
.fs-status { margin: 0; font-size: 13px; }
.fs-status:empty { display: none; }
.fs-results { display: flex; flex-direction: column; border-top: 1px solid var(--border); max-height: 50vh; overflow-y: auto; }
.fs-food { border-bottom: 1px solid var(--border); }
.fs-food.open { background: var(--bg-field); }
.fs-food-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; width: 100%; padding: 9px 8px; text-align: left; background: none; border: 0; cursor: pointer; }
.fs-food-head:hover { background: var(--hover); }
.fs-food-head:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.fs-name { font-weight: 600; overflow-wrap: anywhere; }
.fs-brand { font-size: 12px; color: var(--muted); }
.fs-desc { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.fs-servings { display: flex; flex-direction: column; gap: 8px; padding: 2px 8px 10px; }
.fs-label { font-size: 13px; font-weight: 600; color: var(--subhead); }
.fs-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-pill { padding: 5px 10px; font-size: 13px; border-radius: var(--radius); background: none; border: 1px solid var(--border-strong); cursor: pointer; }
.fs-pill.on { background: var(--bg-accent); border-color: var(--link); }
.fs-use { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.fs-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 1100px) {
  /* Not enough room beside the label: it goes under the details, and the tiles or the Facts
     from chip under the name. */
  .pantry-cols { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "head" "details" "label"; grid-template-rows: none; }
  .pantry-label-col { display: contents; }
  .pantry-facts-head { grid-area: head; max-width: 420px; }
  .pantry-label-box { grid-area: label; max-width: 420px; }
}
@media (max-width: 760px) {
  /* Phones: the list and the editor are separate screens; Back returns to the list. */
  .pantry-body { grid-template-columns: minmax(0, 1fr); }
  .pantry-body.editing .pantry-list { display: none; }
  .pantry-body:not(.editing) .pantry-editor { display: none; }
  .pantry-list { border-right: 0; min-height: 0; padding: 12px; }
  .pantry-letter { top: 0; scroll-margin-top: 0; }
  .pantry-rail { top: 8px; }
  .pantry-rail button { width: 30px; font-size: 11px; line-height: 1.1; padding: 1px 0; } /* compact enough to sit beside a short page; wide to tap */
  .pantry-editor { padding: 0 14px 16px; }
  .pantry-actions { top: 0; }
  .pantry-back { display: inline-flex; padding-left: 4px; }
  .pantry-cancel, .pantry-save { display: none; }
  .pantry-search { flex-basis: 100%; order: 5; }
  .pantry-bar { position: static; } /* scrolls away, leaving the form the room above the keyboard */
  .pantry-serving { grid-template-columns: 80px minmax(0, 1fr); }
  .pantry-grams { grid-column: 1 / -1; }
  .pantry-stats { grid-template-columns: minmax(0, 1fr); }
  .pantry-overview { margin-top: 20px; }
  .scan-body { grid-template-columns: minmax(0, 1fr); }
  /* Save stays under the thumb */
  .pantry-dock { display: flex; gap: 8px; position: sticky; bottom: 0; z-index: 6; margin: 0 -14px -16px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--bg-nav); border-top: 1px solid var(--border-strong); }
  .pantry-dock .btn { flex: 1; padding: 11px; font-size: 16px; }
  .facts-tile { padding: 12px 14px; font-size: 16px; }
  .facts-chip { padding: 9px 14px; font-size: 15px; }
  /* The lookup's one way forward: a full-width button that can't be missed */
  .fs-use .btn.primary { flex: 1 1 100%; padding: 12px; font-size: 16px; font-weight: 700; background: var(--bg-accent); border: 2px solid var(--link); color: var(--on-accent); }
}

/* --- Add food (Track) --------------------------------------------------------- */
.add-food .af-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.af-tab-btn { padding: 8px 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.af-tab-btn.on { color: var(--text); border-bottom-color: var(--link); }
.af-tab { display: flex; flex-direction: column; gap: 12px; }
.af-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.af-split { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.af-split .muted { font-weight: 400; }
.af-recents { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.af-recents:empty { display: none; }
.af-chip { padding: 4px 10px; border-radius: 14px; background: none; border: 1px solid var(--border-strong); font-size: 13px; cursor: pointer; }
.af-chip:hover { background: var(--hover); }
.af-results { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow-y: auto; }
.af-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; width: 100%; padding: 8px 10px; text-align: left; background: none; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; }
.af-row:hover:not(:disabled) { background: var(--hover); }
.af-row.on { background: var(--bg-accent); border-color: var(--link); }
.af-row:disabled { cursor: default; opacity: .6; }
.af-name { font-weight: 600; overflow-wrap: anywhere; }
.af-sub { font-size: 13px; color: var(--muted); }
.af-wide { grid-column: 1 / -1; }
.af-none { margin: 0; padding: 4px 10px; font-size: 13px; }
.af-search-row { display: flex; gap: 8px; align-items: center; }
.af-search-row .search { flex: 1; min-width: 0; }
.af-scanned { display: flex; flex-direction: column; gap: 6px; }
.af-scanned:empty { display: none; }
.af-scanned .af-none .icon { vertical-align: -2px; color: var(--good); }
.af-scan-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 10px; }
.af-row.af-static { cursor: default; }
.af-row.af-static:hover { background: none; }
.af-fs { border-top: 1px solid var(--border); }
.af-fs.open { background: var(--bg-field); border-radius: var(--radius); }
.af-servings { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 10px; }
.af-attrib { font-size: 12px; text-align: right; padding-top: 4px; }
.af-pick { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; background: var(--bg-field); border-radius: 6px; }
.af-amount { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.af-amount input { width: 90px; }
.af-amount select { width: auto; min-width: 120px; }
.af-preview { margin: 0; font-size: 14px; color: var(--subhead); }
.af-preview.bad { color: var(--flag); }
.af-note { margin: 0; font-size: 14px; }
.af-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.af-num { display: flex; flex-direction: column; gap: 4px; }
.af-num-box { display: flex; align-items: center; gap: 6px; }
.af-num-box input { width: 100%; min-width: 0; }
.af-more { align-self: flex-start; }
.af-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.af-check input { width: 18px; height: 18px; accent-color: var(--link); }
@media (max-width: 760px) {
  .af-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Help center (/help) -------------------------------------------------------- */
.help-page { height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.help-bar { position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.help-search { width: min(360px, 100%); }
/* Three panes: sections | that section's articles | the open article, each scrolling on its own. */
.help-page { overflow: hidden; }
.help-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(240px, 320px) minmax(0, 1fr); width: 100%; }
.help-lists { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--bg-nav); border-right: 1px solid var(--border); overflow-y: auto; }
.help-list { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); color: var(--subhead); font-weight: 600; }
.help-list:hover { background: var(--hover); text-decoration: none; }
.help-list.active { background: var(--bg-accent); color: var(--text); }
.help-list .icon { width: 15px; height: 15px; color: var(--link); }
.help-count { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--muted); }
.help-index { border-right: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; }
.help-index-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 12px 14px; font-size: 13px; color: var(--muted); background: var(--bg-row); border-bottom: 1px solid var(--border); }
.help-row { display: flex; flex-direction: column; gap: 3px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.help-row:hover { background: var(--hover); text-decoration: none; }
.help-row.active { background: var(--bg-field); box-shadow: inset 3px 0 0 var(--link); }
.help-row-sub { font-size: 13px; color: var(--muted); }
.help-row-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--link); }
.help-row-meta:empty { display: none; }
.help-row-video { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.help-row-video .icon { width: 11px; height: 11px; }
.help-none { padding: 14px; margin: 0; }
.help-main { padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 14px; min-width: 0; overflow-y: auto; }
.help-main > * { max-width: 820px; }
.help-main h2 { font-size: 26px; }
.help-h3 { font-size: 17px; margin-top: 10px; }
.help-crumb { font-size: 13px; }
.help-summary { margin: 0; font-size: 16px; color: var(--subhead); }
.help-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.help-tips { padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-field); font-size: 14px; }
.help-tips ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.help-next { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.help-video { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.help-video video { width: 100%; aspect-ratio: 16 / 10; border-radius: 8px; background: #000; border: 1px solid var(--border); }
.help-video figcaption { font-size: 13px; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.help-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); font-size: 14px; }
.help-card:hover { border-color: var(--link); text-decoration: none; background: var(--hover); }
.help-card strong { font-size: 15px; }
.help-card-area { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--link); }
.help-card-area .icon { width: 12px; height: 12px; }
.help-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.help-thumb { position: relative; display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: 14px; }
.help-thumb:hover { text-decoration: none; }
.help-thumb img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.help-thumb:hover img { border-color: var(--link); }
.help-thumb-img { position: relative; display: block; }
.help-thumb-play { position: absolute; left: 10px; bottom: 12px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,17,26,.85); border: 2px solid var(--link); }
.help-thumb-play .icon { width: 18px; height: 18px; margin-left: 3px; }
@media (max-width: 760px) {
  /* One column: sections as a scrolling row of chips, then the list, then the article. */
  .help-page { overflow-y: auto; }
  .help-body { display: flex; flex-direction: column; min-height: auto; }
  .help-lists { flex-direction: row; overflow-x: auto; overflow-y: visible; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .help-list { flex: none; padding: 6px 10px; }
  .help-index { border-right: 0; overflow: visible; max-height: none; }
  .help-main { padding: 18px 16px 40px; overflow: visible; }
  .help-search { width: 100%; }
}

/* --- Help drawer (the ? in the top bar) ------------------------------------------- */
.help-drawer {
  position: fixed; top: calc(var(--topbar-h) + var(--demo-h, 0px)); right: 0; bottom: 0; z-index: 60; width: min(400px, 100vw);
  display: flex; flex-direction: column; background: var(--bg-pop); border-left: 1px solid var(--link); box-shadow: -12px 0 32px var(--shadow);
}
.help-drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.help-drawer-head h2 { font-size: 18px; }
.help-drawer-area { flex: 1; min-width: 0; height: 34px; padding: 0 10px; background: var(--bg-field); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.help-drawer-body { flex: 1; overflow-y: auto; padding: 8px 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.help-drawer-item { border-bottom: 1px solid var(--border); padding: 8px 0; font-size: 14px; }
.help-drawer-item summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; padding: 4px 0; font-size: 15px; }
.help-drawer-item[open] summary { margin-bottom: 6px; }
.help-drawer-item p { margin: 0 0 8px; }
.help-drawer-item .help-video { margin-bottom: 10px; }
.help-drawer-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--link); font-weight: 400; }
.help-drawer-badge .icon { width: 11px; height: 11px; }
.help-drawer-tips { margin: 8px 0 0; padding-left: 18px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.help-drawer-foot { padding: 12px 14px; border-top: 1px solid var(--border); }
.help-drawer-foot .btn { width: 100%; }

/* --- What's new (release notes, in the help center and the ? panel) ---------------- */
.release { display: flex; flex-direction: column; gap: 8px; }
.help-drawer-body .release { padding: 10px 0 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.release-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
h3.release-title { font-size: 15px; }
.release-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--flag-bg); color: var(--flag-text); font-size: 12px; font-weight: 600; }
.release-badge .icon, .help-row-meta .icon { width: 12px; height: 12px; }
.release-notes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.release-help { margin: 0; font-size: 13.5px; color: var(--muted); }
.help-latest strong a { font-weight: 700; }
/* The dot on the ? while a notable release is unread (static/js/releases.js). */
.nav-link[data-help-toggle] { position: relative; }
.nav-link.has-news::after {
  content: ""; position: absolute; top: calc(50% - 15px); left: calc(50% + 5px); width: 10px; height: 10px;
  border-radius: 50%; background: var(--brand-cook); box-shadow: 0 0 0 2px var(--bg-nav);
}

/* --- Compare (Track) ---------------------------------------------------------- */
/* A store-style compare sheet: item cards across the top, then a striped table with the row names
   pinned on the left. Narrow screens scroll the sheet sideways. */
.pill .cmp-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--link); color: var(--on-link); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.pill .cmp-count[hidden] { display: none; }
.cmp-body { --cmp-label: minmax(120px, 170px); --cmp-col: 190px; --cmp-sheet: var(--bg-row); --cmp-stripe: var(--bg-row-alt);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 1400px; width: 100%; min-width: 0; margin: 0 auto; }
.cmp-body > * { min-width: 0; max-width: 100%; }
.cmp-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.cmp-top h1 { font-size: 24px; margin: 0; }
.cmp-top-gap { flex: 1; }
.cmp-scroll { overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--cmp-sheet); }
.cmp-sheet { display: grid; }
.cmp-sheet > * { min-width: 0; }
.cmp-corner { position: sticky; left: 0; z-index: 2; background: var(--cmp-sheet); padding: 16px 12px; }
.cmp-corner p { font-size: 13px; max-width: 160px; }
/* cards */
.cmp-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 18px; min-width: 0; }
.cmp-remove { align-self: center; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 2px 6px; color: var(--danger); font-size: 12.5px; font-weight: 700; cursor: pointer; border-radius: var(--radius); }
.cmp-remove .icon { width: 14px; height: 14px; padding: 2px; border-radius: 50%; background: var(--danger); color: var(--cmp-sheet); }
.cmp-remove:hover { background: var(--hover-faint); }
.cmp-photo { position: relative; aspect-ratio: 1 / 0.9; border-radius: 4px; background: var(--bg-field); display: grid; place-items: center; overflow: hidden; }
.cmp-photo .rv-ring { width: min(168px, 84%); height: auto; aspect-ratio: 1; }
.cmp-photo .rv-ring > div { width: 69%; height: 69%; background: var(--bg-field); }
.cmp-photo .rv-ring b { font-size: 28px; }
.cmp-photo-thumb { position: absolute; top: 8px; left: 8px; width: 46px; height: 46px; border-radius: 4px; object-fit: cover; box-shadow: 0 2px 8px var(--shadow); }
.cmp-error { color: var(--danger-text); padding: 12px; text-align: center; font-size: 13px; }
.cmp-name { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.cmp-name b { font-weight: 700; }
.cmp-title { font: inherit; text-align: left; color: inherit; }
.cmp-name .link-btn.cmp-title:hover { color: var(--link); }
.cmp-desc { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.cmp-price { font-size: 30px; font-weight: 700; line-height: 1; color: var(--danger); font-variant-numeric: tabular-nums; margin-top: 4px; }
.cmp-price small { font-size: 14px; font-weight: 600; margin-left: 4px; }
.cmp-fin { font-size: 12.5px; color: var(--muted); }
.cmp-cta { margin-top: auto; }
.cmp-slot-btn:focus-visible, .cmp-remove:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.cmp-slot { justify-content: center; }
.cmp-slot-btn { flex: 1; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; margin-top: 26px;
  border: 2px dashed var(--border-strong); border-radius: 6px; background: none; color: var(--link); cursor: pointer; text-align: center; }
.cmp-slot-btn .icon { width: 28px; height: 28px; }
.cmp-slot-btn span { font-size: 12.5px; color: var(--muted); }
.cmp-slot-btn:hover { background: var(--hover-faint); border-color: var(--link); }
/* the table */
.cmp-group { padding: 16px 12px 6px; border-top: 1px solid var(--border-strong); }
.cmp-group span { position: sticky; left: 12px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--link); }
.cmp-label, .cmp-cell { padding: 8px 12px; font-size: 14px; border-top: 1px solid var(--hairline); background: var(--cmp-sheet); }
.cmp-label { position: sticky; left: 0; z-index: 1; font-weight: 700; }
.cmp-label.sub { padding-left: 26px; font-weight: 400; color: var(--subhead); }
.cmp-label.is-stripe, .cmp-cell.is-stripe { background: var(--cmp-stripe); }
.cmp-cell { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-variant-numeric: tabular-nums; }
.cmp-dv { font-size: 12px; color: var(--muted); }
.cmp-cell.is-best .cmp-v { color: var(--good); font-weight: 700; }
.cmp-cell.is-high .cmp-v, .cmp-cell.is-high .cmp-dv { color: var(--bad); font-weight: 700; }
.cmp-tag { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 3px; background: var(--good-bg); color: var(--good); font-size: 11px; font-weight: 700; }
.cmp-tag .icon { width: 11px; height: 11px; }
/* mini cards pinned under the Track tabs once the cards scroll away */
.cmp-mini { position: sticky; z-index: 4; height: 0; }
.cmp-mini-clip { overflow: hidden; visibility: hidden; opacity: 0; border: 1px solid var(--border-strong); border-top: 0; border-radius: 0 0 6px 6px; box-shadow: 0 6px 16px var(--shadow); background: var(--bg-panel); }
.cmp-mini.is-on .cmp-mini-clip { visibility: visible; opacity: 1; }
.cmp-mini-row { display: grid; }
@media (prefers-reduced-motion: no-preference) { .cmp-mini-clip { transition: opacity .15s, visibility .15s; } }
.cmp-mini-label { padding: 8px 12px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); align-self: center; }
.cmp-mini-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 6px; padding: 6px 12px; min-width: 0; border-left: 1px solid var(--border); }
.cmp-mini-name { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-mini-kcal { grid-row: 2; font-size: 12.5px; font-weight: 700; color: var(--danger); }
.cmp-mini-card .pill-x { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--muted); }
/* the search under the empty card */
.cmp-pop { position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 10px; padding: 14px; max-height: min(70vh, 560px);
  background: var(--bg-panel); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: 0 12px 32px var(--shadow); }
.cmp-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cmp-pop .search { position: relative; }
.cmp-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-filters .af-chip.on { background: var(--bg-accent); border-color: var(--link); color: var(--on-accent); }
.cmp-results { max-height: none; min-height: 0; flex: 1; }
.cmp-badge { display: inline-block; margin-right: 8px; padding: 1px 6px; border-radius: 3px; background: var(--bg-accent); color: var(--on-accent); font-size: 11px; font-weight: 700; letter-spacing: .03em; vertical-align: 1px; }
.cmp-badge.fs { background: var(--good-bg); color: var(--good); }
.cmp-hit:disabled .af-sub:first-of-type { color: var(--link); }

/* The food search bar (static/js/food-search.js): the field and Scan, source chips, then results. */
.fsearch { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fsearch-bar { display: flex; gap: 8px; align-items: center; }
.fsearch-bar .search { flex: 1; min-width: 0; }
.fsearch-scan { flex: none; }
.fsearch-results { background: var(--bg-pop); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px; box-shadow: 0 8px 22px var(--shadow); max-height: min(50vh, 440px); }
.fsearch-results.bare { background: none; border: 0; box-shadow: none; padding: 0; }
.fsearch-quick { border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 var(--radius) var(--radius); }
.fsearch-quick .af-name { color: var(--link); }
.fsearch-quick .af-name .icon { margin-right: 6px; vertical-align: -2px; }
.fsearch .cmp-filters .af-chip.on { background: var(--bg-accent); border-color: var(--link); color: var(--on-accent); }
.cmp-pop .fsearch { flex: 1; min-height: 0; }
.cmp-pop .fsearch-results { max-height: none; min-height: 0; flex: 1; }
.cmp-scanned { flex: none; max-height: 45%; overflow-y: auto; }

/* Scan: barcode or label (static/js/modals/scan-choice.js) */
.scan-q { margin: 0; font-weight: 700; }
.scan-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scan-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 14px 8px; border-radius: 10px; background: var(--bg-field); border: 1px solid var(--border-strong); color: var(--text); cursor: pointer; font: inherit; }
.scan-tile:hover { border-color: var(--link); }
.scan-tile .muted { font-size: 12.5px; }
.scan-pic { height: 78px; display: grid; place-items: center; }
/* printed things keep their paper white and ink black in both themes */
.sc-barcode { background: #fff; padding: 7px 9px 4px; border-radius: 3px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sc-bars { width: 96px; height: 38px; background: repeating-linear-gradient(90deg, #000 0 2px, transparent 2px 3px, #000 3px 4px, transparent 4px 6px, #000 6px 8px, transparent 8px 9px, #000 9px 10px, transparent 10px 12px); }
.sc-digits { font: 600 8px/1 ui-monospace, Consolas, monospace; color: #000; letter-spacing: 1px; }
.sc-label { background: #fff; color: #000; border: 1.5px solid #000; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; width: 96px; padding: 3px 4px 4px; font-size: 7px; line-height: 1.25; display: flex; flex-direction: column; text-align: left; }
.sc-h { font-size: 11px; font-weight: 900; line-height: 1; border-bottom: 1px solid #000; padding-bottom: 2px; }
.sc-r { display: flex; justify-content: space-between; border-bottom: 1px solid #000; padding: 1px 0; }
.sc-sv { font-weight: 800; border-bottom: 3px solid #000; }
.sc-cal { font-weight: 900; border-bottom: 2px solid #000; align-items: baseline; }
.sc-cal b { font-size: 11px; }
/* Compare boxes elsewhere, and the bar that offers "Compare now" */
.icon-btn.cmp-toggle[aria-pressed="true"] { color: var(--on-accent); background: var(--bg-accent); }
.btn.cmp-toggle[aria-pressed="true"] { border-color: var(--link); color: var(--link); }
.cmp-float { position: fixed; z-index: 90; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 28px;
  background: var(--bg-panel); border: 1px solid var(--link); box-shadow: 0 8px 24px var(--shadow); }
.cmp-float[hidden] { display: none; }
.cmp-float > .icon { color: var(--link); }
.cmp-float-n { font-weight: 700; white-space: nowrap; }
.cmp-float .btn { border-radius: 20px; }
@media (max-width: 520px) {
  .cmp-body { padding: 12px; --cmp-label: 108px; --cmp-col: 168px; }
  .cmp-price { font-size: 26px; }
  .cmp-float { left: calc(12px + env(safe-area-inset-left, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); justify-content: space-between; }
}
