/* Mercury-light — Nutrition viewer stylesheet.
 *
 * Ported from the approved mockups in
 * docs/superpowers/specs/mockups/2026-07-30-nutrition/ (daily-log-v2.html,
 * trends-v2.html, foods.html, week.html). This file holds the BASE
 * sections only: design tokens, the topbar/nav/content chrome, generic
 * card primitives (KPI, pill, panel), shared badges, chart primitives,
 * the week "day row" (.drow), mobile chrome (header + bottom tabs), and
 * the sign-in card. Page-specific layout (ingredient grids, foods table,
 * trends segmented control, week gap/wow-tables, …) is added by the
 * daily-log / trends / foods / week page tasks as those pages are built.
 *
 * The mockups render each page inside a `.desktop-frame` (980px) and a
 * `.phone` (390px) purely for side-by-side preview — those frame/label
 * classes are NOT ported. Real pages are unframed; the mobile layout
 * kicks in via `@media (max-width: 879px)` (topbar → mobile header +
 * bottom tabs) with a density pass at `@media (max-width: 720px)`.
 */

:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f7f7f5;
  --ink: #111114;
  --muted: #6b6b75;
  --hair: #e8e8ec;
  --hair-strong: #d8d8de;
  --gold: #9c7e3e;
  --gold-bright: #c8a86b;
  --gold-soft: #f5edd9;
  --navy: #0e1729;
  --navy-2: #1a2438;
  --green: #2f6a3a;
  --warm: #9a4f0e;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --amber: #b45309;
  --serif: ui-serif, "Charter", Georgia, serif;

  /* Categorical trio for protein / fat / carb series in charts. */
  --s-prot: #3a5cc5;
  --s-fat: #b08419;
  --s-carb: #2e7d32;

  /* Motion tokens — referenced by hover/press rules. */
  --motion-fast: 120ms;
  --motion-base: 180ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Inter", "SF Pro Text", system-ui, sans-serif;
  font-feature-settings: "tnum" 1, "ss01" 1;
  font-size: 14px;
  line-height: 1.4;
}

a { color: inherit; text-decoration: none; }

/* ---------- Topbar / nav (desktop chrome) ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--hair);
  background: var(--surface);
}
.wordmark {
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 13px;
}
.nav { display: flex; gap: 20px; margin-left: 8px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 13px; padding-bottom: 2px; }
.nav a.active { color: var(--ink); border-bottom: 2px solid var(--gold); }
.signout-form { margin-left: auto; }
.signout {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.signout:hover { color: var(--ink); }

/* ---------- Content column ---------- */

.content { max-width: 880px; margin: 0 auto; padding: 28px 28px 44px; }

/* ---------- KPI / pill cards ---------- */

.kpis { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 26px; }
.kpi { background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px; }
.kpi .label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; color: var(--muted); }
.kpi .value { font-family: var(--serif); font-size: 26px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi .value .unit { font-size: 14px; color: var(--muted); }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { background: linear-gradient(135deg, var(--navy), var(--navy-2)); border: none; color: #fff; }
.kpi.accent .label { color: var(--gold-bright); }
.kpi.accent .sub { color: #aab2c5; }

.band { position: relative; height: 6px; border-radius: 3px; background: #243050; margin-top: 10px; }
.band .target { position: absolute; left: 38%; width: 42%; top: 0; bottom: 0; background: rgba(200, 168, 107, .35); border-radius: 3px; }
.band .fill { position: absolute; left: 0; width: 58%; top: 0; bottom: 0; background: var(--gold-bright); border-radius: 3px; }

.ok { color: var(--green); font-weight: 600; }
.good { color: var(--green); }
.warn { color: var(--amber); }
.miss { color: var(--red); }
.delta-up { color: var(--amber); font-weight: 600; }
.delta-down { color: var(--green); font-weight: 600; }

.pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.pill { background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; padding: 12px 14px; }
.pill .label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; color: var(--muted); }
.pill .value { font-family: var(--serif); font-size: 22px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.pill .value .pct { font-size: 14px; color: var(--muted); }
.pill .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------- Panels ---------- */

.panel { background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; }
.panel-head .count { font-size: 12px; color: var(--muted); }
.panel h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; margin: 0; padding: 14px 16px 0; color: var(--ink); }
.panel .note { font-size: 12px; color: var(--muted); padding: 0 16px; margin: 2px 0 8px; }

/* ---------- Badges ---------- */

.src { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; border-radius: 9px; padding: 2px 8px; }
.src.usda { background: #e9f2ea; color: var(--green); }
.src.mixed { background: var(--gold-soft); color: var(--gold); }
.src.estimate { background: var(--red-soft); color: var(--red); }

.q { display: inline-block; font-size: 10px; border-radius: 8px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; font-weight: 700; letter-spacing: .4px; }
.q.exact { background: #e9f2ea; color: var(--green); }
.q.substitute { background: var(--gold-soft); color: var(--gold); }
.q.estimated { background: var(--red-soft); color: var(--red); }

.origin { display: inline-block; font-size: 10px; border-radius: 8px; padding: 1px 7px; margin-left: 8px; vertical-align: 1px; font-weight: 700; letter-spacing: .4px; }
.origin.roman { background: var(--gold-soft); color: var(--gold); }
.origin.web { background: #e8edf7; color: #3a5cc5; }

.gap-flag { display: inline-block; font-size: 10px; border-radius: 8px; padding: 1px 7px; margin-left: 8px; font-weight: 700; background: var(--red-soft); color: var(--red); }

/* ---------- Daily log page ---------- */

.day-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.day-head h1 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0; }
.day-sub { font-size: 12px; color: var(--muted); }
.day-nav { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.day-nav a { display: block; }
.day-nav button {
  border: 1px solid var(--hair-strong);
  background: var(--surface);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.day-nav button:disabled { color: var(--hair-strong); cursor: default; }
.day-nav input {
  border: 1px solid var(--hair-strong);
  background: var(--surface);
  border-radius: 8px;
  height: 32px;
  padding: 0 8px;
  color: var(--muted);
  font: inherit;
  width: 130px;
}

.panel-head .slot { font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.panel-head .time { font-size: 12px; color: var(--muted); }
.panel-head .meal-kcal { margin-left: auto; font-family: var(--serif); font-size: 16px; font-variant-numeric: tabular-nums; }
.panel-head .meal-kcal span { font-size: 11.5px; color: var(--muted); }
.panel[hx-get] .panel-head, .panel-head[hx-get] { cursor: pointer; }

.desc { padding: 0 16px 12px; color: var(--ink); font-size: 13.5px; }
.meta { padding: 0 16px 13px; color: var(--muted); font-size: 12px; }

.ing, .colhead, .totals { grid-template-columns: minmax(0, 1.4fr) 76px 90px 64px; gap: 0 12px; }
.ing { display: grid; padding: 8px 16px; border-bottom: 1px solid var(--hair); align-items: baseline; }
.ing:last-child { border-bottom: none; }
.ing .name { font-size: 13.5px; }
.ing .cite { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.ing .grams { text-align: right; font-variant-numeric: tabular-nums; }
.ing .grams .gsrc { display: block; font-size: 10.5px; color: var(--muted); }
.ing .grams.assumed { color: var(--warm); }
.ing .macros { text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ing .kcal { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.colhead {
  display: grid;
  padding: 7px 16px;
  border-bottom: 1px solid var(--hair);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
}
.colhead div:not(:first-child) { text-align: right; }
.totals {
  display: grid;
  padding: 10px 16px;
  border-top: 1px solid var(--hair-strong);
  font-weight: 600;
  background: var(--surface-2);
}
.totals div:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.assume-note { padding: 9px 16px; background: var(--gold-soft); color: var(--gold); font-size: 12.5px; border-top: 1px solid var(--hair); }

.mobile-ing { display: none; }

.m-ing { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 10px 14px; border-bottom: 1px solid var(--hair); }
.m-ing:last-child { border-bottom: none; }
.m-ing .name { font-size: 13.5px; }
.m-ing .cite { font-size: 11px; color: var(--muted); margin-top: 2px; }
.m-ing .nums { text-align: right; font-variant-numeric: tabular-nums; }
.m-ing .nums .kcal { font-weight: 600; }
.m-ing .nums .g { display: block; font-size: 11.5px; color: var(--muted); }
.m-ing .nums .g.assumed { color: var(--warm); }
.m-totals { display: flex; justify-content: space-between; padding: 10px 14px; font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--hair-strong); }
.m-totals .pfc { color: var(--muted); font-weight: 500; font-size: 12.5px; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .desktop-ing { display: none; }
  .mobile-ing { display: block; }
}

/* ---------- Chart primitives (SVG) ---------- */

svg { display: block; width: 100%; height: auto; }
.bar-kcal { fill: var(--gold-bright); }
.bar-kcal.hover { fill: var(--gold); }
.bar-prot { fill: var(--s-prot); }
.seg-p { fill: var(--s-prot); }
.seg-f { fill: var(--s-fat); }
.seg-c { fill: var(--s-carb); }
.grid { stroke: var(--hair); stroke-width: 1; }
.refband { fill: var(--gold-soft); opacity: .75; }
.refline { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; opacity: .55; }
.axis { font: 10.5px -apple-system, system-ui, sans-serif; fill: var(--muted); }
.tip-box { fill: #fff; stroke: var(--hair-strong); rx: 6; }
.tip-text { font: 11px -apple-system, system-ui, sans-serif; fill: var(--ink); }
.tip-sub { font: 10.5px -apple-system, system-ui, sans-serif; fill: var(--muted); }
.legend { display: flex; gap: 16px; align-items: center; padding: 6px 2px 4px; font-size: 12px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Weight line chart ---------- */
.line-raw { fill: none; stroke: var(--hair-strong); stroke-width: 1.5; }
.line-trend { fill: none; stroke: var(--navy); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.dot-raw { fill: var(--hair-strong); }
.dot-latest { fill: var(--navy); }
.rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rates .pill .value.dim { color: var(--muted); }
.rates .pill .value.good { color: var(--green); }
.rates .pill .value.warn { color: var(--red); }
.milestone-bar { height: 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--hair); overflow: hidden; margin: 10px 0 6px; }
.milestone-bar .fill { height: 100%; background: var(--gold-bright); border-radius: 6px; }
.milestone-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ---------- Week day row (.drow) ---------- */

.drow {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 90px 80px 90px 80px;
  gap: 0 12px;
  padding: 9px 16px 9px 12px;
  border-bottom: 1px solid var(--hair);
  align-items: center;
  border-left: 4px solid transparent;
}
.drow:last-child { border-bottom: none; }
.drow.best { border-left-color: var(--green); }
.drow.worst { border-left-color: var(--red); }
.drow .day { font-weight: 600; font-size: 13px; }
.drow .day .tag { display: inline-block; font-size: 9.5px; border-radius: 7px; padding: 1px 6px; margin-left: 6px; font-weight: 700; letter-spacing: .4px; vertical-align: 1px; }
.drow.best .tag { background: #e9f2ea; color: var(--green); }
.drow.worst .tag { background: var(--red-soft); color: var(--red); }
.drow .num { text-align: right; font-variant-numeric: tabular-nums; }
.drow .num.dim { color: var(--muted); font-size: 12.5px; }

.kbar { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); }
.kbar .band { position: absolute; left: 69%; width: 15.3%; top: 0; bottom: 0; background: var(--gold-soft); border-radius: 5px; }
.kbar .fill { position: absolute; left: 0; top: 2px; bottom: 2px; background: var(--gold-bright); border-radius: 3px; }

/* ---------- Page head / segmented control / search (trends, foods, week) ---------- */

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0; }
.page-sub { font-size: 12px; color: var(--muted); }

.seg { display: flex; margin-left: auto; border: 1px solid var(--hair-strong); border-radius: 9px; overflow: hidden; }
.seg a { padding: 6px 14px; font-size: 12.5px; color: var(--muted); text-decoration: none; border-right: 1px solid var(--hair); }
.seg a:last-child { border-right: none; }
.seg a.active { background: var(--navy); color: #fff; font-weight: 600; }

.search { margin-left: auto; display: flex; align-items: center; gap: 8px; border: 1px solid var(--hair-strong); background: var(--surface); border-radius: 9px; padding: 7px 12px; width: 280px; }
.search .glyph { opacity: .6; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; }
.search input::placeholder { color: var(--muted); }

/* ---------- Generic panel row (foods page) ---------- */

.row { display: grid; padding: 10px 16px; border-bottom: 1px solid var(--hair); align-items: baseline; }
.row:last-child { border-bottom: none; }
.row .name { font-size: 13.5px; }
.row .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.row .num { text-align: right; font-variant-numeric: tabular-nums; }
.row .macros { text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .qcell { text-align: right; }

.colhead.foods-cols, .row.foods-cols { grid-template-columns: minmax(0, 1.6fr) 110px 150px 70px; gap: 0 12px; }
.colhead.ing-cols, .row.ing-cols { grid-template-columns: minmax(0, 1.6fr) 70px 110px 130px; gap: 0 12px; }

.qbar { display: inline-flex; height: 8px; border-radius: 4px; overflow: hidden; width: 110px; vertical-align: middle; }
.qbar .qe { background: #2f6a3a; }
.qbar .qs { background: #c8a86b; }
.qbar .qx { background: #d9776f; }
.qlegend { display: flex; gap: 14px; padding: 9px 16px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--hair); background: var(--surface-2); }
.qchip { display: inline-flex; align-items: center; gap: 5px; }
.qswatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------- Week page: colhead grid, split (gaps + WoW) ---------- */

.colhead.week-cols { grid-template-columns: 110px minmax(0, 1fr) 90px 80px 90px 80px; }
.colhead .bar-col { text-align: left; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gap-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 0 12px; padding: 9px 16px; border-bottom: 1px solid var(--hair); align-items: baseline; }
.gap-row:last-child { border-bottom: none; }
.gap-row .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.gap-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.wow-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px; gap: 0 12px; padding: 9px 16px; border-bottom: 1px solid var(--hair); align-items: baseline; }
.wow-row:last-child { border-bottom: none; }
.wow-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.wow-row .num.dim { color: var(--muted); }
.wow-head { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px; gap: 0 12px; padding: 7px 16px; border-bottom: 1px solid var(--hair); font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; background: var(--surface-2); }
.wow-head div:not(:first-child) { text-align: right; }

/* ---------- Sign-in card ---------- */

.signin {
  max-width: 380px;
  margin: 12vh auto;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 12px;
  text-align: center;
}
.signin .brand {
  font-weight: 700;
  letter-spacing: 1.4px;
  font-size: 12px;
  color: var(--gold);
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}
.signin h1 {
  font-family: var(--serif);
  font-weight: 600;
  margin: 4px 0 4px;
  font-size: 28px;
  letter-spacing: -0.5px;
}
.signin p { color: var(--muted); margin: 0 0 20px; }
.signin form { display: grid; gap: 12px; }
.signin input[type="text"],
.signin input[type="password"] {
  border: 1px solid var(--hair-strong);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  outline: 2px solid transparent;
  outline-offset: 0;
  transition:
    border-color var(--motion-fast) ease,
    outline-color var(--motion-fast) ease;
}
.signin input[type="text"]:focus,
.signin input[type="password"]:focus {
  outline-color: var(--gold-bright);
  border-color: var(--gold-bright);
}
.signin button {
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 0 rgba(17, 17, 20, 0);
  transition:
    background var(--motion-fast) ease,
    transform var(--motion-base) var(--ease-out),
    box-shadow var(--motion-base) var(--ease-out);
}
.signin button:hover {
  background: var(--navy-2);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(17, 17, 20, 0.18);
}
.signin button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(17, 17, 20, 0.12);
}
.signin .error {
  background: var(--red-soft);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}

/* ---------- Mobile chrome ---------- */

.mobile-header,
.tabs { display: none; }

@media (max-width: 879px) {
  .topbar { display: none; }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--hair);
    position: sticky;
    top: 0;
    z-index: 2;
  }
  .mobile-header .wordmark { font-size: 12px; }
  .m-daynav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .m-daynav button {
    border: 1px solid var(--hair-strong);
    background: var(--surface);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
  .m-daynav .m-date { font-family: var(--serif); font-size: 15px; font-weight: 600; }

  .content { padding: 14px 12px calc(74px + env(safe-area-inset-bottom)); }

  .split { grid-template-columns: 1fr; }
  .search { width: auto; flex: 1; }

  .m-kpis, .m-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .m-kpis .kpi.accent, .m-pills .pill.accent { grid-column: 1 / -1; }
  .m-kpis .kpi, .m-pills .pill { padding: 12px 14px; }
  .m-kpis .value, .m-pills .value { font-size: 22px; }
  .m-kpis .row3 { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  .m-kpis .row3 .kpi .value { font-size: 19px; }

  .m-drow {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 0 10px;
    padding: 9px 14px 9px 10px;
    border-bottom: 1px solid var(--hair);
    align-items: center;
    border-left: 4px solid transparent;
  }
  .m-drow:last-child { border-bottom: none; }
  .m-drow.best { border-left-color: var(--green); }
  .m-drow.worst { border-left-color: var(--red); }
  .m-drow .day { font-weight: 600; font-size: 12.5px; }
  .m-drow .nums { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }
  .m-drow .nums .p { display: block; font-size: 11px; color: var(--muted); }

  .tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--hair);
    padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
    z-index: 50;
  }
  .tabs a {
    text-align: center;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 6px 4px;
    transition: color var(--motion-fast) ease;
  }
  .tabs a.active {
    color: var(--ink);
    font-weight: 700;
  }
  .tabs a.active::after {
    content: "";
    display: block;
    width: 22px;
    height: 2px;
    background: var(--gold);
    margin: 5px auto 0;
    border-radius: 1px;
  }
}

@media (max-width: 720px) {
  .content { padding: 12px 10px calc(74px + env(safe-area-inset-bottom)); }
  .kpis, .pills { grid-template-columns: 1fr 1fr; }
  .kpi, .pill { padding: 11px 12px; }
  .kpi .value { font-size: 21px; }
  .pill .value { font-size: 18px; }

  /* The foods page's two tables (.foods-cols, .ing-cols) use fixed pixel
     column widths sized for desktop. Below 720px there isn't room for
     them plus a usable name column, so the name track collapses toward
     0 and the trailing columns overflow past the row/viewport edge.
     Narrow the fixed columns and drop the row/panel side padding so the
     name column keeps a legible minimum width. */
  .row { padding: 10px 10px; }
  .colhead.foods-cols, .row.foods-cols { grid-template-columns: minmax(96px, 1fr) 40px 92px 28px; gap: 0 8px; }
  .colhead.ing-cols, .row.ing-cols { grid-template-columns: minmax(96px, 1fr) 30px 54px 92px; gap: 0 8px; }
  .row .macros { font-size: 11px; }
  .qbar { width: 84px; }
}

@media print {
  .topbar, .mobile-header, .tabs { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .signin button,
  .signin input[type="text"],
  .signin input[type="password"],
  .tabs a {
    transition: none;
  }
}
