/* Farrell Fitness. Macro colors follow competition bumper plates:
   calories orange, protein red, carbs yellow, fat green. */

@font-face { font-family: 'Barlow'; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-style: normal; font-display: swap; src: url(../fonts/barlow-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/barlow-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-style: normal; font-display: swap; src: url(../fonts/barlow-condensed-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); }

:root {
  --ground: #E9EDF1; --surface: #FFFFFF; --ink: #16202B; --muted: #4E5B69;
  --line: #D3DAE2; --field: #C9D2DC; --rule: #E1E6EC;
  /* Brand: navy for actions, orange for calories and energy. */
  --primary: #00275B; --primary-hover: #001A40; --on-primary: #FFFFFF; --soft-primary: #B5C3DA; --tint-primary: #E6ECF5;
  --kcal: #E06A1F; --soft-kcal: #F6C4A2; --on-kcal: #FFFFFF; --brand-orange: #FF914D;
  --red: #C9302C; --yellow: #E2A90F; --green: #23874F; --dot: #9AA6B3;
  --deep: #00275B; --deep-2: #12396E; --on-deep: #EEF2F8; --on-deep-muted: #B8C6DC; --deep-green: #4FCB86;
  --sleep-light: #A9BCDB; --sleep-deep: #00275B; --sleep-rem: #E06A1F;
  --danger-bg: #FBE9E8; --danger-ink: #7E1B18;
  --lift: #00275B; --on-lift: #FFFFFF;
  --fiber: #8A6436; --water: #1F6FB2; --soft-water: #DCEBF7; --on-soft-water: #154E7E; --phase-reverse: #6F8FBF; --limit-fill: #9DB2CE;
  --warn-bg: #FCEBDD; --warn-ink: #8A3D0B;
  --radius-card: 18px; --radius-ctl: 12px;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabbar: 72px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0F1823; --surface: #182330; --ink: #E8EDF2; --muted: #9AA8B7;
    --line: #2A3746; --field: #2F3C4C; --rule: #253242;
    --primary: #FF914D; --primary-hover: #FFAA72; --on-primary: #0F1823; --soft-primary: #6B4329; --tint-primary: #33241C;
    --kcal: #FF914D; --soft-kcal: #6B4329; --on-kcal: #0F1823; --brand-orange: #FF914D;
    --red: #E5554F; --yellow: #F0BE2E; --green: #3DB874; --dot: #5F6E7E;
    --deep: #0A1A33; --deep-2: #1C3358; --sleep-light: #33507F; --sleep-deep: #8FAAD6; --sleep-rem: #FF914D;
    --danger-bg: #3A1A1A; --danger-ink: #F7B4B1;
    --lift: #8FAAD6; --on-lift: #0F1823;
    --fiber: #C49A63; --water: #5BA8E6; --soft-water: #1C3550; --on-soft-water: #BFE0FA; --phase-reverse: #8FAAD6; --limit-fill: #4A5F7C;
    --warn-bg: #3D2717; --warn-ink: #FFC9A3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0F1823; --surface: #182330; --ink: #E8EDF2; --muted: #9AA8B7;
  --line: #2A3746; --field: #2F3C4C; --rule: #253242;
  --primary: #FF914D; --primary-hover: #FFAA72; --on-primary: #0F1823; --soft-primary: #6B4329; --tint-primary: #33241C;
    --kcal: #FF914D; --soft-kcal: #6B4329; --on-kcal: #0F1823; --brand-orange: #FF914D;
  --red: #E5554F; --yellow: #F0BE2E; --green: #3DB874; --dot: #5F6E7E;
  --deep: #0A1A33; --deep-2: #1C3358; --sleep-light: #33507F; --sleep-deep: #8FAAD6; --sleep-rem: #FF914D;
  --danger-bg: #3A1A1A; --danger-ink: #F7B4B1;
  --lift: #8FAAD6; --on-lift: #0F1823;
  --fiber: #C49A63; --water: #5BA8E6; --soft-water: #1C3550; --on-soft-water: #BFE0FA; --phase-reverse: #8FAAD6; --limit-fill: #4A5F7C;
  --warn-bg: #3D2717; --warn-ink: #FFC9A3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.4 var(--body); -webkit-text-size-adjust: 100%; }
/* The page itself never scrolls: the content area scrolls inside a full-height shell, and the
   tab bar sits below it. On iPhone a position: fixed bar on a scrolling page drifts whenever the
   toolbar, keyboard or a sheet changes the viewport height. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- app shell ---------- */
.shell { display: flex; flex: 1; min-height: 0; }
.sidebar { display: none; }
.content { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; padding-bottom: 28px; }
.view { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.tabbar {
  position: relative; flex: none; z-index: 20;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--primary); font-weight: 600; }
.tab-add { display: flex; align-items: center; justify-content: center; }
.tab-add button {
  width: 58px; height: 58px; margin-top: -20px; border-radius: 29px; border: 4px solid var(--surface); cursor: pointer;
  background: var(--kcal); color: var(--on-kcal); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 39, 91, 0.25);
}
.tab-add button svg { width: 26px; height: 26px; }
.add-btn {
  height: 44px; margin: 0 0 14px; border-radius: 10px; border: 0; cursor: pointer; font: 600 15px var(--body);
  background: var(--kcal); color: var(--on-kcal); display: flex; align-items: center; justify-content: center; gap: 8px;
}
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 2px 10px; border: 0; border-radius: 14px; background: var(--ground); color: var(--ink); font: 600 13px var(--body); cursor: pointer; }
.quick-grid .qi { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; }
.quick-grid .qi svg { width: 22px; height: 22px; }
.tabbar svg, .sidebar svg { width: 24px; height: 24px; }

@media (min-width: 1024px) {
  .tabbar { display: none; }
  .content { padding-bottom: 40px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; width: 248px; flex: none;
    height: 100%; overflow-y: auto; padding: 28px 16px; background: var(--deep); color: var(--on-deep);
  }
  .sidebar .brand { font: 700 26px/1 var(--display); padding: 0 12px 24px; display: flex; align-items: center; gap: 10px; }
  .sidebar .brand img { width: 34px; height: 28px; flex: none; }
  .sidebar a { height: 44px; border-radius: 10px; padding: 0 12px; display: flex; align-items: center; gap: 12px; color: var(--on-deep-muted); font-weight: 500; text-decoration: none; }
  .sidebar a:hover { color: #fff; background: rgba(255,255,255,0.05); }
  .sidebar a[aria-current="page"] { background: var(--deep-2); color: #fff; font-weight: 600; }
  .sidebar svg { width: 20px; height: 20px; }
  .sidebar .spacer { flex: 1; }
  .view { padding: 0 32px; }
}

/* ---------- page header ---------- */
.page-head { padding: 28px 4px 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 14px; color: var(--muted); font-weight: 500; }
.page-head h1 { font: 700 38px/1 var(--display); letter-spacing: -0.01em; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 2px; }
@media (min-width: 1024px) { .page-head h1 { font-size: 44px; } }
/* Back arrow: every screen below the tab front pages. */
.back-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--primary); margin-left: -6px; }
@media (hover: hover) { .back-btn:hover { background: var(--surface); } }
.back-btn svg { width: 24px; height: 24px; }
.page-head.has-back { padding: 20px 0 12px; align-items: center; gap: 4px 6px; flex-wrap: nowrap; }
.page-head.has-back .titles { flex: 1; min-width: 0; }
.page-head.has-back .eyebrow { font-size: 13px; }
.page-head.has-back h1 { font-size: 34px; overflow-wrap: anywhere; }
.page-head.date-head .actions { flex-wrap: nowrap; align-items: center; }
.page-head.date-head .icon-btn.bordered { width: 44px; height: 44px; color: var(--text); }
.page-head.has-back:not(.date-head) { flex-wrap: wrap; }
.page-head.has-back:not(.date-head) .titles { flex: 1 1 150px; }
.page-head.has-back:not(.date-head) .actions { margin-left: auto; }
@media (min-width: 1024px) {
  /* The sidebar covers top-level screens on desktop. */
  .page-head.back-top .back-btn { display: none; }
  .page-head.back-top { padding: 28px 4px 12px; }
  .page-head.has-back h1 { font-size: 40px; }
}

/* ---------- cards & layout ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > * { min-width: 0; }
.card { background: var(--surface); border-radius: var(--radius-card); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.pad-lg { padding: 20px; }
.card.dark { background: var(--deep); color: var(--on-deep); }
.card.dark .muted { color: var(--on-deep-muted); }
.card h2 { font: 600 22px/1.1 var(--display); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.grow-3 { flex: 3 1 520px; }
.grow-2 { flex: 2 1 320px; }
.half { flex: 1 1 160px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 1024px) { .row, .stack { gap: 16px; } .card { padding: 22px 24px; } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-family: var(--display); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.num .unit { font-weight: 500; color: var(--muted); font-size: 0.55em; }
.card.dark .num .unit { color: var(--on-deep-muted); }
.stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat .num { font-size: 28px; }
.stat .label { font-size: 12px; color: var(--muted); }
.card.dark .stat .label { color: var(--on-deep-muted); }
.hero-num { font: 700 76px/0.9 var(--display); color: var(--kcal); font-variant-numeric: tabular-nums; }
@media (min-width: 1024px) { .hero-num { font-size: 96px; line-height: 0.88; } }
.hero-num.over { color: var(--red); }
p { margin: 0; }
.note { font-size: 14px; line-height: 1.45; color: var(--muted); }

/* ---------- controls ---------- */
.btn {
  height: 48px; padding: 0 18px; border-radius: var(--radius-ctl); border: 1px solid var(--field); background: var(--surface);
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn.danger { color: var(--red); }
.btn.sm { height: 40px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: inherit; }
.icon-btn:hover { background: var(--ground); }
.icon-btn svg { width: 22px; height: 22px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; min-width: 0; }
.input, .field input:not([type="radio"]):not([type="checkbox"]):not([type="range"]), .field select, .field textarea, select.input {
  height: 46px; border-radius: 10px; border: 1px solid var(--field); padding: 0 12px; background: var(--surface);
  font-size: 16px; font-weight: 500; color: var(--ink); width: 100%; min-width: 0;
}
.field textarea { height: 96px; padding: 10px 12px; resize: vertical; }
.input.big { height: 52px; font: 700 26px var(--display); }
.search { height: 48px; border-radius: var(--radius-ctl); background: var(--ground); display: flex; align-items: center; gap: 10px; padding: 0 14px; flex: 1; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; font-weight: 500; min-width: 0; }
.search svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--field); background: var(--surface); font-weight: 500; font-size: 14px; cursor: pointer; }
.pill[aria-selected="true"], .pill[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--ground); border-radius: 10px; padding: 3px; gap: 3px; }
.segmented button { height: 34px; border: 0; border-radius: 8px; background: transparent; font-weight: 500; font-size: 14px; cursor: pointer; }
.segmented button[aria-selected="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* ---------- macros ---------- */
.plate-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 3px; background: var(--ground); }
.plate-bar > div { border-radius: 2px; min-width: 0; }
.plate-bar > div:first-child { border-radius: 6px 2px 2px 6px; }
.plate-bar.over { outline: 2px solid var(--red); outline-offset: 2px; }
.swatch { width: 8px; height: 14px; border-radius: 2px; display: inline-block; flex: none; }
.c-protein { background: var(--red); } .c-carbs { background: var(--yellow); } .c-fat { background: var(--green); } .c-kcal { background: var(--kcal); }
.macro { display: flex; flex-direction: column; gap: 6px; }
.macro .name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.macro .num { font-size: 24px; font-weight: 600; }
.meter { height: 6px; border-radius: 3px; background: var(--ground); overflow: hidden; }
.meter > div { height: 100%; border-radius: 3px; }
@media (min-width: 1024px) { .macro .num { font-size: 30px; } .meter { height: 8px; } .plate-bar { height: 26px; } }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); min-height: 52px; }
.list-row:first-child { border-top: 0; }
.list-row .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.list-row .title { font-weight: 600; overflow-wrap: anywhere; }
button.list-row { background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; width: 100%; color: inherit; }
button.list-row:first-child { border-top: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { font-size: 12px; color: var(--muted); font-weight: 500; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--rule); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--rule); }
.table .r { text-align: right; }
.scroll-x { overflow-x: auto; }

/* ---------- sheet / dialog ---------- */
.scrim { position: fixed; inset: 0; background: rgba(22, 32, 43, 0.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column; overflow: hidden; padding-bottom: env(safe-area-inset-bottom);
  animation: sheet-in 0.22s ease-out;
}
.sheet.tall { height: 92vh; height: 92dvh; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--field); margin: 10px auto 2px; flex: none; }
.sheet-head { padding: 6px 12px 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex: none; }
.sheet-head h2 { font: 700 26px/1.1 var(--display); }
.sheet-body { padding: 0 16px 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 720px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 22px; max-height: 86vh; }
  .sheet.tall { height: 86vh; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 60; max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.toast.error { background: var(--red); color: #fff; }
@media (min-width: 1024px) { .toast { bottom: 32px; } }
.banner { border-radius: 12px; padding: 12px 16px; background: var(--danger-bg); color: var(--danger-ink); font-size: 14px; }
.banner.info { background: var(--tint-primary); color: var(--ink); }
.empty { padding: 24px 8px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ---------- specific pieces ---------- */
.chip-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--field); background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 5px; display: inline-block; }
.linkcard { background: var(--deep); color: #fff; border-radius: var(--radius-card); padding: 16px; display: flex; align-items: center; justify-content: space-between; text-decoration: none; gap: 12px; }
.linkcard:hover { color: #fff; }
.linkcard .muted { color: var(--on-deep-muted); }
:root[data-theme="dark"] .linkcard, :root:not([data-theme="light"]) .linkcard { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .linkcard { background: var(--deep-2); } }
:root[data-theme="dark"] .linkcard { background: var(--deep-2); }

.sleepbar { display: flex; height: 10px; gap: 2px; }
.sleepbar > div { border-radius: 3px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 12px var(--body); fill: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; }


.set-grid { display: grid; grid-template-columns: 34px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.set-grid.head { font-size: 12px; color: var(--muted); padding: 4px 0 0; }
.set-row { border-radius: 10px; padding: 4px 0; }
.set-row.done { background: var(--tint-primary); }
.set-row input { height: 40px; width: 100%; border-radius: 8px; border: 1px solid var(--field); text-align: center; font-weight: 600; font-size: 16px; background: var(--surface); color: var(--ink); padding: 0 4px; }
.set-n { font: 600 18px var(--display); text-align: center; background: none; border: 0; cursor: pointer; color: inherit; height: 40px; }
.done-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface); color: var(--dot); display: flex; align-items: center; justify-content: center; justify-self: center; cursor: pointer; }
.done-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.done-btn svg { width: 18px; height: 18px; }
.rest { position: sticky; top: 8px; z-index: 5; background: var(--deep); color: #fff; border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rest .btn { background: transparent; color: #fff; border-color: #3A4757; }
.rest .btn.light { background: #fff; color: var(--deep); border-color: #fff; }
.dashed { border-style: dashed; }

.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 400px; padding: 28px; gap: 14px; }
.login h1 { font: 700 40px/1 var(--display); text-align: center; }
.login h1 + .note { text-align: center; }
.login .logo { width: 92px; height: auto; align-self: center; margin-bottom: 4px; }

body.logged-out .tabbar, body.logged-out .sidebar { display: none !important; }
body.logged-out .content { padding-bottom: 0; }
#view:focus { outline: none; }
.diary-grid { display: grid; gap: 12px; }
@media (min-width: 1024px) { .diary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; } }
.desk-only { display: none !important; }
@media (min-width: 1024px) {
  .desk-only { display: flex !important; }
  .phone-only { display: none !important; }
  .whoop-card { background: var(--deep); color: var(--on-deep); }
  .whoop-card .muted, .whoop-card .stat .label { color: var(--on-deep-muted); }
  .whoop-card .num .unit { color: var(--on-deep-muted); }
  .whoop-card .big-recovery { display: flex !important; }
  .whoop-card .sleepbar > div:nth-child(1) { background: #4C6A9C !important; }
  .whoop-card .sleepbar > div:nth-child(2) { background: #A9BCDB !important; }
  .whoop-card .sleepbar > div:nth-child(3) { background: #FF914D !important; }
}
.scanner video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.offline-pill { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--surface); font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 16px; }

/* ---------- more ---------- */
.more-group { padding: 4px 16px; gap: 0; }
.more-row { display: flex; align-items: center; gap: 14px; min-height: 60px; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.more-row:first-child { border-top: 0; }
.more-row:hover { color: var(--ink); }
.more-row .main { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.more-row .title { font-weight: 600; }
.more-row > svg { color: var(--muted); flex: none; }
.more-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--ground); display: flex; align-items: center; justify-content: center; flex: none; }
.more-ic.dark { background: var(--primary); color: var(--on-primary); }
.more-ic svg { width: 20px; height: 20px; }
@media (min-width: 1024px) { .more-group { padding: 4px 24px; } }

/* ---------- segmented links (Diary | Plan, Strength | Cardio | Progress) ---------- */
.segmented.big { padding: 4px; gap: 4px; border-radius: 12px; background: var(--line); }
.segmented.big a, .segmented.big button { height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; }
.segmented.big a[aria-current="page"], .segmented.big button[aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
@media (min-width: 1024px) { .segmented.big { max-width: 420px; } }

/* ---------- full-screen barcode scanner ---------- */
.scanner-full { position: fixed; inset: 0; z-index: 70; background: #0B1118; color: #fff; display: flex; flex-direction: column; align-items: center; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.scan-top { width: 100%; max-width: 640px; display: flex; justify-content: space-between; align-items: center; padding: 16px; }
.scan-title { font-weight: 600; }
.scan-round { width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255,255,255,0.14); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.scan-round[hidden] { display: flex !important; visibility: hidden; }
.scan-round[aria-pressed="true"] { background: #fff; color: #0B1118; }
.scan-round svg { width: 20px; height: 20px; }
.scan-stage { position: relative; width: 100%; max-width: 640px; flex: 1; max-height: 62vh; overflow: hidden; }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.scan-stage.off video { opacity: 0.2; }
.scan-frame { position: absolute; left: 7%; right: 7%; top: 29%; bottom: 29%; pointer-events: none; }
.scan-frame i { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; }
.scan-frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.scan-frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
.scan-frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
.scan-frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
.scan-frame b { position: absolute; left: 8%; right: 8%; top: 50%; height: 3px; border-radius: 2px; background: #3DB874; animation: scanline 1.6s ease-in-out infinite alternate; }
@keyframes scanline { from { transform: translateY(-34px); } to { transform: translateY(34px); } }
.scan-status { padding: 16px 20px 8px; text-align: center; font-weight: 600; max-width: 420px; }
.scan-manual { display: flex; gap: 8px; padding: 8px 16px 20px; width: 100%; max-width: 420px; }
.scan-manual input { flex: 1; height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); color: #fff; padding: 0 12px; font-size: 16px; min-width: 0; }
.scan-manual input::placeholder { color: #B9C4D0; }
.scan-manual .btn { background: #fff; color: #0B1118; border-color: #fff; height: 44px; }

/* ---------- meal plans ---------- */
.plan-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.plan-chips::-webkit-scrollbar { display: none; }
.plan-chips .pill { display: inline-flex; align-items: center; white-space: nowrap; text-decoration: none; color: var(--ink); flex: none; }
.pill[aria-current="page"] { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
.plan-macro { display: flex; flex-direction: column; gap: 6px; }
.plan-macro-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.plan-macro .name { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.plan-macro .meter { height: 8px; }

/* ---------- cardio and progress ---------- */
.cardio-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.cardio-row:first-child { border-top: 0; }
.cardio-row:hover { color: var(--ink); }
.cardio-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cardio-row .title, .callout .title { font-weight: 600; }
.act-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--ground); display: flex; align-items: center; justify-content: center; flex: none; color: var(--ink); }
.act-ic svg { width: 22px; height: 22px; }
.act-ic.sm { width: 34px; height: 34px; border-radius: 10px; }
.act-ic.sm svg { width: 18px; height: 18px; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: var(--ground); color: var(--ink); white-space: nowrap; flex: none; }
.badge.dark { background: var(--deep); color: #fff; }
.zones { display: flex; height: 8px; gap: 2px; margin-top: 4px; max-width: 320px; }
.zones > div { border-radius: 2px; min-width: 2px; }
.callout { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--tint-primary); border: 1px solid var(--soft-kcal); color: var(--ink); text-decoration: none; }
.callout .main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.callout:hover { color: var(--ink); }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.act-grid button { height: 44px; border-radius: 12px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: 600 14px var(--body); cursor: pointer; }
.act-grid button[aria-checked="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pace-box { display: flex; justify-content: space-between; align-items: center; background: var(--ground); border-radius: 12px; padding: 10px 14px; }
.totals-grid { gap: 16px 12px; }
.card.dark .note { color: var(--on-deep-muted); }
.card.dark h2 { color: var(--on-deep); }

/* ---------- health ---------- */
.vo2-tile { display: flex; align-items: center; gap: 14px; background: var(--deep); color: var(--on-deep); border-radius: 14px; padding: 14px 16px; }
.vo2-tile .num .unit { color: var(--on-deep-muted); }
.btn.light { background: #fff; color: var(--deep); border-color: #fff; }
.btn.light:hover { color: var(--deep); background: #fff; }
.vitals-grid { gap: 16px 8px; }
.stat-btn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 0; border-top: 1px solid var(--rule); cursor: pointer; }
.check-row input { width: 24px; height: 24px; margin: 0; accent-color: var(--green); flex: none; }
.check-row .main { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.check-row .title { font-weight: 600; }
.list-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 0 4px; }
.list > .list-label:first-child { padding-top: 0; }
.list-label + .check-row { border-top: 0; }
.linkish { text-decoration: none; color: inherit; }
.linkish:hover { color: inherit; }
.linkish svg { color: var(--muted); }
.lab-row { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border: 0; border-top: 1px solid var(--rule); background: none; text-align: left; width: 100%; cursor: pointer; color: inherit; font: inherit; }
.lab-row:first-child { border-top: 0; }
.lab-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lab-head .title { font-weight: 600; }
.lab-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.range-bar { position: relative; height: 8px; border-radius: 4px; background: var(--ground); }
.range-bar .ok { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: #9ED4B3; }
.range-bar .mark { position: absolute; top: -3px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--ink); }
.range-bar .mark.out { background: var(--red); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .range-bar .ok { background: #23664A; } }
:root[data-theme="dark"] .range-bar .ok { background: #23664A; }
.lab-edit { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--ground); }
.lab-edit .field input { background: var(--surface); }

/* ---------- habits ---------- */
.heatmap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.heat { display: block; height: 22px; border-radius: 4px; background: var(--rule); }
.heat.l-1 { background: transparent; border: 1px dashed var(--rule); }
.heat.l0 { background: var(--rule); }
.heat.l1 { background: #BFE3CD; }
.heat.l2 { background: #6FC193; }
.heat.l3 { background: var(--green); }
.heat.today { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .heat.l1 { background: #1F4A35; } :root:not([data-theme="light"]) .heat.l2 { background: #2D7A52; } }
:root[data-theme="dark"] .heat.l1 { background: #1F4A35; }
:root[data-theme="dark"] .heat.l2 { background: #2D7A52; }
.legend .heat { display: inline-block; }
.habit-group { gap: 4px; }
.habit-row .main { cursor: pointer; }
.habit-row .btn.sm { min-width: 52px; height: 36px; padding: 0 10px; }
.habit-row.done .title { color: var(--muted); }
.streak { font-size: 13px; font-weight: 600; min-width: 32px; text-align: right; }
.check-row input:disabled { opacity: 1; }

/* ---------- journal ---------- */
.scale-set { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.scale-set legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.scale button { height: 44px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: 600 16px var(--body); cursor: pointer; }
.scale button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.context-box { display: flex; flex-direction: column; gap: 4px; background: var(--ground); border-radius: 12px; padding: 12px; }
.journal-row { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.journal-row:first-child { border-top: 0; }
.journal-row:hover { color: var(--ink); }
.journal-row[aria-current="true"] .title { color: var(--primary); }
.jr-head { display: flex; justify-content: space-between; gap: 8px; }
.jr-head .title { font-weight: 600; }
.jr-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.habit-segs { display: flex; gap: 3px; }
.habit-segs > div { flex: 1; height: 6px; border-radius: 3px; background: var(--rule); }
.habit-segs > div.on { background: var(--green); }
.med-pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; }
.med-pill[aria-pressed="true"] { background: #E6F3EC; color: #1B6B3F; border-color: var(--green); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .med-pill[aria-pressed="true"] { background: #173A2A; color: #9BE3B9; } }
:root[data-theme="dark"] .med-pill[aria-pressed="true"] { background: #173A2A; color: #9BE3B9; }
.med-pill svg { width: 16px; height: 16px; }
.journal-ic { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,0.12); display: flex; align-items: center; justify-content: center; flex: none; }
.journal-ic svg { width: 22px; height: 22px; }
.card h2.list-label { font: 600 12px/1.2 var(--body); letter-spacing: 0.06em; }
.list > .check-row:first-child { border-top: 0; }
.intro-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.intro-step { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.intro-tick { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--field); display: flex; align-items: center; justify-content: center; flex: none; }
.intro-step.done .intro-tick { background: var(--green); border-color: var(--green); color: #fff; }
.intro-step.done { color: var(--muted); }

/* ---------- drag to reorder ---------- */
.grip { width: 40px; height: 44px; margin-left: -8px; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; flex: none; border-radius: 10px; }
.grip svg { width: 20px; height: 20px; }
.grip:hover { color: var(--ink); background: var(--ground); }
.sort-row { justify-content: flex-start; gap: 6px; position: relative; background: var(--surface); }
.sort-row .main { flex: 1; }
.sort-row .input { height: 42px; flex: 1; }
.sortable.is-sorting { user-select: none; -webkit-user-select: none; }
.sortable.is-sorting .sort-row:not(.dragging) { transition: transform 0.12s; }
.sort-row.dragging { z-index: 5; border-radius: 14px; box-shadow: 0 12px 28px rgba(0, 39, 91, 0.22), 0 2px 6px rgba(0, 39, 91, 0.12); outline: 2px solid var(--primary); border-top-color: transparent; cursor: grabbing; }
.sort-row.dragging + .sort-row { border-top-color: transparent; }
.sort-row.dragging .grip { color: var(--primary); cursor: grabbing; }
.row-btn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meal-list { border: 1px solid var(--field); border-radius: 12px; padding: 0 10px 0 12px; }
.meal-list .list-row { padding: 6px 0; min-height: 0; }

/* ---------- shared bits ---------- */
.segmented.big.four a { font-size: 14px; }
@media (min-width: 1024px) { .segmented.big.four { max-width: 520px; } }
.icon-btn.bordered { border: 1px solid var(--field); background: var(--surface); width: 40px; height: 40px; }
.icon-btn[disabled] { opacity: 0.35; cursor: default; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kv > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.on-deep-muted { color: var(--on-deep-muted); }
.badge.ok { background: #DDF0E4; color: #1B6B3F; }
.badge.refill { background: var(--danger-bg); color: var(--danger-ink); }
.badge.freq-twice, .badge.freq-thrice { background: var(--tint-primary); color: var(--primary); }
.badge.freq-weekly, .badge.freq-interval { background: #FCEBDD; color: #8A3D0B; }
.dashed-card { background: transparent; border: 1px dashed var(--field); }
.btn.kcal { background: var(--kcal); border-color: var(--kcal); color: #fff; }
.btn.kcal:hover { color: #fff; filter: brightness(1.05); }
.btn.outline-light { background: transparent; border-color: rgba(255,255,255,0.35); color: #fff; }
.btn.outline-light:hover { color: #fff; border-color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.ok { background: #173A2A; color: #9BE3B9; } :root:not([data-theme="light"]) .badge.freq-weekly, :root:not([data-theme="light"]) .badge.freq-interval { background: #3A2617; color: #FFC79E; } }
:root[data-theme="dark"] .badge.ok { background: #173A2A; color: #9BE3B9; }
:root[data-theme="dark"] .badge.freq-weekly, :root[data-theme="dark"] .badge.freq-interval { background: #3A2617; color: #FFC79E; }

/* ---------- calendars ---------- */
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cal-head h2 { text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-day { height: 46px; border-radius: 8px; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink); background: transparent; font: inherit; cursor: pointer; }
.cal-day b { font: 600 13px var(--body); }
.cal-day small { font: 500 10px var(--body); opacity: 0.85; min-height: 12px; }
.cal-day:hover { color: var(--ink); filter: brightness(0.97); }
.cal-day.v-on { background: var(--green); color: #fff; }
.cal-day.v-over { background: #FCD9BF; }
.cal-day.v-under { background: #DCE6F5; }
.cal-day.v-none { border: 1.5px dashed var(--field); }
.cal-day.v-out { border: 1.5px dashed var(--field); color: var(--muted); }
.cal-day.v-fasted { background: var(--ground); }
.cal-day.v-future { color: var(--dot); cursor: default; }
.cal-day[aria-current="date"] { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--surface); color: var(--ink); }
.cal-key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cal-key.v-on { background: var(--green); } .cal-key.v-over { background: #FCD9BF; } .cal-key.v-under { background: #DCE6F5; } .cal-key.v-none { border: 1.5px dashed var(--field); }
.cal-day.t-lift, .cal-day.t-cardio, .cal-day.t-both { background: var(--tint-primary); }
.cal-dots { display: flex; gap: 3px; height: 6px; }
.cal-dots i, .d-lift, .d-cardio { display: inline-block; width: 6px; height: 6px; border-radius: 3px; }
.d-lift { background: var(--lift); } .d-cardio { background: var(--kcal); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cal-day.v-over, :root:not([data-theme="light"]) .cal-key.v-over { background: #5A3420; } :root:not([data-theme="light"]) .cal-day.v-under, :root:not([data-theme="light"]) .cal-key.v-under { background: #23344F; } :root:not([data-theme="light"]) .d-lift { background: #8FAAD6; } }
:root[data-theme="dark"] .cal-day.v-over, :root[data-theme="dark"] .cal-key.v-over { background: #5A3420; }
:root[data-theme="dark"] .cal-day.v-under, :root[data-theme="dark"] .cal-key.v-under { background: #23344F; }
:root[data-theme="dark"] .d-lift { background: #8FAAD6; }

/* ---------- food overview ---------- */
.today-food { gap: 10px; }
.open-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 14px; color: var(--primary); padding-bottom: 4px; }
.macro-trend { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; align-items: center; padding-top: 10px; border-top: 1px solid var(--rule); }
.mt-main { display: flex; flex-direction: column; gap: 3px; }
.mini-bars { height: 48px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; align-items: end; }
.mini-bars > div { border-radius: 3px; }
.verdict { font-weight: 600; }
.verdict.v-on { color: var(--green); } .verdict.v-over { color: var(--kcal); } .verdict.v-under { color: var(--primary); } .verdict.v-none, .verdict.v-out { color: var(--muted); }

/* ---------- train overview ---------- */
.next-up { background: var(--deep); color: var(--on-deep); }
.next-up h2 { color: var(--on-deep); }
.recovery-chip { display: flex; flex-direction: column; align-items: flex-end; text-decoration: none; color: inherit; }
.next-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.week-dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wd-dot { width: 38px; height: 38px; border-radius: 19px; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--rule); }
.wd-dot.k-lift { background: var(--lift); color: var(--on-lift); }
.wd-dot.k-cardio { background: var(--kcal); }
.wd-dot.k-both { background: linear-gradient(135deg, var(--lift) 50%, var(--kcal) 50%); color: #fff; }
.wd-dot.k-future { background: transparent; border: 1.5px solid var(--rule); }
.wd-dot.is-today.k-rest { background: transparent; border: 2px dashed var(--field); }
.act-ic.k-lift { background: var(--lift); color: var(--on-lift); }
.act-ic.k-cardio { background: var(--kcal); color: #fff; }
.list-row > .act-ic { flex: none; }

/* ---------- body ---------- */
.body-comp { background: var(--deep); color: var(--on-deep); }
.body-comp .stat .label, .body-comp .num .unit { color: var(--on-deep-muted); }
.comp-grid { border-top: 1px solid rgba(255,255,255,0.14); padding-top: 12px; }
.segmented.on-deep { background: rgba(255,255,255,0.1); }
.segmented.on-deep button { color: var(--on-deep); }
.segmented.on-deep button[aria-selected="true"] { background: var(--surface); color: var(--ink); }
.meas-row { display: grid; grid-template-columns: 1.5fr 1fr 1fr; align-items: center; gap: 8px; min-height: 46px; padding: 0 8px; margin: 0 -8px; border: 0; border-top: 1px solid var(--rule); background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 0; }
.meas-row.head { font-size: 12px; color: var(--muted); min-height: 32px; border-top: 0; cursor: default; }
.meas-row .v, .meas-row .d, .meas-row.head span:not(:first-child) { text-align: right; }
.meas-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.meas-row .d { font-size: 14px; }
.meas-row.sel { background: var(--tint-primary); border-radius: 8px; font-weight: 600; }
.meas-row.sel + .meas-row { border-top-color: transparent; }
.photo-slot { height: 132px; border-radius: 12px; border: 1.5px dashed var(--field); background: var(--ground); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ink); font: 600 14px var(--body); cursor: pointer; overflow: hidden; position: relative; padding: 0; }
.photo-slot svg { color: var(--primary); }
.photo-slot.has { border-style: solid; border-color: var(--green); }
.photo-slot.has img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot.has span { position: absolute; left: 6px; bottom: 6px; background: var(--surface); color: var(--ink); font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.photo-sets { display: grid; gap: 12px; }
@media (min-width: 1024px) { .photo-sets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
.photo-tile { position: relative; height: 150px; border-radius: 10px; overflow: hidden; background: var(--ground); border: 0; padding: 0; cursor: pointer; display: block; width: 100%; }
@media (min-width: 720px) { .photo-tile, .photo-slot { height: 220px; } }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile.empty { border: 1.5px dashed var(--field); background: transparent; cursor: default; }
.pose-tag { position: absolute; left: 6px; top: 6px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--surface); color: var(--ink); }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; }
.privacy-note svg { flex: none; margin-top: 2px; }
.photo-full { width: 100%; max-height: 64vh; object-fit: contain; border-radius: 12px; background: var(--ground); }
.file-btn { cursor: pointer; }
/* camera */
.scanner-full.camera { background: #000; }
.cam-stage { position: relative; width: 100%; max-width: 640px; flex: 1; min-height: 0; overflow: hidden; }
.cam-stage video, .cam-stage .ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-stage .ghost { opacity: 0.32; pointer-events: none; mix-blend-mode: screen; }
.cam-stage.mirror video, .cam-stage.mirror .ghost { transform: scaleX(-1); }
.cam-stage.flash::after { content: ''; position: absolute; inset: 0; background: #fff; opacity: 0.7; }
.cam-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 120px var(--display); color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.5); pointer-events: none; }
.cam-poses { display: flex; gap: 4px; background: rgba(255,255,255,0.14); border-radius: 22px; padding: 3px; }
.cam-poses button { height: 38px; padding: 0 12px; border: 0; border-radius: 19px; background: transparent; color: #fff; font: 600 14px var(--body); cursor: pointer; }
.cam-poses button[aria-selected="true"] { background: #fff; color: #0B1118; }
.cam-controls { display: flex; align-items: center; justify-content: space-around; width: 100%; max-width: 420px; padding: 8px 16px 20px; }
.cam-controls label.scan-round { cursor: pointer; }
.shutter { width: 74px; height: 74px; border-radius: 37px; border: 5px solid #fff; background: var(--kcal); cursor: pointer; box-shadow: 0 0 0 3px rgba(0,0,0,0.3); }
.shutter[disabled] { opacity: 0.5; }
/* compare */
.compare-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.compare-controls .segmented { flex: 1 1 240px; }
.compare-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.compare-split figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.compare-split img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; background: var(--ground); }
.compare-slide { position: relative; border-radius: 14px; overflow: hidden; background: var(--ground); aspect-ratio: 3 / 4; max-height: 70vh; }
.compare-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide-bar { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,0.4); pointer-events: none; }
.compare-slide .pose-tag.right { left: auto; right: 6px; }
input[type="range"] { width: 100%; accent-color: var(--kcal); height: 28px; }

/* ---------- insights ---------- */
.insight-hero { background: var(--deep); color: var(--on-deep); }
.insight-hero .chart text { fill: var(--on-deep-muted); }
.insight-hero .chart line { stroke: rgba(255,255,255,0.12); }
.eyebrow-orange { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-orange); }
.hero-sentence { font: 600 26px/1.15 var(--display); }
.insight-bars { display: flex; flex-direction: column; gap: 8px; }
.ib { display: grid; grid-template-columns: 110px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 14px; }
.ib-track { height: 14px; border-radius: 7px; background: var(--ground); overflow: hidden; }
.insight-hero .ib-track { background: rgba(255,255,255,0.12); }
.ib-fill { height: 100%; border-radius: 7px; background: var(--soft-primary); }
.ib-fill.a { background: var(--kcal); }
.ib-val { text-align: right; font-size: 18px; }
.insight-row { border-top: 1px solid var(--rule); }
.insight-row:first-child { border-top: 0; }
.insight-row summary { list-style: none; display: flex; gap: 12px; padding: 12px 0; cursor: pointer; }
.insight-row summary::-webkit-details-marker { display: none; }
.insight-row summary .main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.insight-row summary .title { font-weight: 600; line-height: 1.3; }
.insight-row .badge { align-self: flex-start; }
.insight-chart { padding: 0 0 12px; }
.badge.strength-strong { background: var(--tint-primary); color: var(--primary); }
.badge.strength-none { background: transparent; border: 1px solid var(--rule); color: var(--muted); }

/* ---------- weekly report, projection ---------- */
.week-sentence { font: 600 24px/1.15 var(--display); }
.tiles { gap: 16px 10px; }
.win-ic { width: 32px; height: 32px; border-radius: 9px; background: #FCEBDD; color: #B4500F; display: inline-flex; align-items: center; justify-content: center; flex: none; margin-right: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .win-ic { background: #3A2617; color: #FFC79E; } }
:root[data-theme="dark"] .win-ic { background: #3A2617; color: #FFC79E; }
.proj-hero { background: var(--deep); color: var(--on-deep); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.proj-table { display: flex; flex-direction: column; }
.pt-row { display: grid; grid-template-columns: 0.8fr 1.2fr 1fr 1fr; gap: 6px; align-items: center; min-height: 40px; padding: 0 8px; margin: 0 -8px; border: 0; border-radius: 8px; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.pt-row > span:not(:first-child) { text-align: right; }
.pt-row.head { font-size: 12px; color: var(--muted); cursor: default; min-height: 28px; border-bottom: 1px solid var(--rule); border-radius: 0; }
.pt-row.sel { background: #FCEBDD; font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pt-row.sel { background: #3A2617; } }
:root[data-theme="dark"] .pt-row.sel { background: #3A2617; }

/* ---------- reminders and sync ---------- */
.rem-list { display: flex; flex-direction: column; }
.rem-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.rem-row .main { flex: 1 1 180px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rem-row .title { font-weight: 600; }
.rem-ctl { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.rem-ctl .two { display: flex; gap: 6px; }
.time-in { height: 40px; width: auto; min-width: 0; font-size: 15px; padding: 0 8px; }
select.time-in { max-width: 132px; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--field); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.15s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.scale-status { display: flex; align-items: center; gap: 12px; background: var(--ground); border-radius: 12px; padding: 12px; }
.scale-status .main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.scale-status .title { font-weight: 600; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.steps.big { gap: 10px; font-size: 15px; }
.json-fields { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
code { font: 500 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--ground); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.copy-box { display: flex; flex-direction: column; gap: 6px; background: var(--ground); border-radius: 12px; padding: 12px; }
.copy-box code { background: var(--surface); padding: 8px 10px; font-size: 13px; }
.copy-box .btn { align-self: flex-start; }
.copy-box.key { border: 1px solid var(--soft-kcal); }

/* ---------- meds ---------- */
.prn-row { cursor: default; flex-wrap: wrap; }
.coming-up { padding-top: 10px; border-top: 1px solid var(--rule); }
.dose-times { display: flex; flex-direction: column; background: var(--ground); border-radius: 14px; padding: 4px 12px; }
.dose-time { display: grid; grid-template-columns: 62px minmax(0, 1fr) 116px; gap: 8px; align-items: center; min-height: 56px; border-top: 1px solid var(--rule); }
.dose-time:first-child { border-top: 0; }
.dose-time .input { height: 42px; background: var(--surface); }
.dt-label { font-weight: 600; font-size: 14px; }
.day-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-pick button { height: 44px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: 600 15px var(--body); cursor: pointer; }
.day-pick button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.linkish .act-ic svg { color: inherit; }
.time-in[type=time] { min-width: 124px; }

/* ---------- stage 2: nutrients, fill my macros, drinks, diet phases, users ---------- */
.diary-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: -4px; }
.diary-tools .btn svg { width: 16px; height: 16px; margin-right: 2px; }
.nut-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; width: 100%; }
button.nut-row { cursor: pointer; }
button.nut-row:hover .title { color: var(--primary); }
.nut-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; }
.nut-head .title { font-weight: 600; }
.nut-head b { font-weight: 600; }
.nut-over { color: var(--kcal); }
.nut-bar { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--ground); width: 100%; overflow: hidden; }
.nut-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.nut-fill.goal { background: var(--lift); }
.nut-fill.met { background: var(--green); }
.nut-fill.limit { background: var(--limit-fill); }
.nut-fill.over { background: var(--kcal); }
.fill-left { background: var(--ground); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fill-card { border: 1px solid var(--rule); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.fill-bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.drink-block { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 14px; }
.drink-block.ruled { border-top: 1px solid var(--rule); padding-top: 14px; }
.drink-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.drink-num { font-size: 30px; line-height: 1; }
.drink-num.water { color: var(--water); }
.drink-num.over { color: var(--kcal); }
.drink-of { font-family: var(--body); font-size: 15px; font-weight: 500; color: var(--muted); }
.drink-btns { display: flex; gap: 6px; }
.drink-btns .btn { height: 44px; }
.drink-btns .icon-btn.bordered { width: 44px; height: 44px; }
.btn.water-soft { background: var(--soft-water); border-color: var(--soft-water); color: var(--on-soft-water); }
.btn.water-solid { background: var(--water); border-color: var(--water); color: #fff; }
:root[data-theme="dark"] .btn.water-solid { color: #0F1823; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.water-solid { color: #0F1823; } }
.glasses { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.glasses span { height: 18px; border-radius: 4px 4px 6px 6px; background: var(--soft-water); }
.glasses span.on { background: var(--water); }
.warn-tag { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--warn-ink); }
.undo-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.undo-chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px 0 10px; border-radius: 15px; border: 1px solid var(--rule); background: var(--surface); color: var(--muted); font: 500 13px var(--body); cursor: pointer; }
.undo-chip:hover { color: var(--ink); border-color: var(--field); }
.undo-chip svg { width: 14px; height: 14px; }
.plain-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; }
.plain-fieldset legend { padding: 0; margin-bottom: 4px; }
.more-nutrients summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--primary); min-height: 32px; display: flex; align-items: center; }
.phase-now { background: var(--deep); color: var(--on-deep); }
.phase-now-title { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; }
.phase-now-left { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; color: var(--brand-orange); }
.phase-progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.16); overflow: hidden; }
.phase-progress > div { height: 100%; background: var(--brand-orange); border-radius: 4px; }
.phase-line { position: relative; height: 30px; }
.phase-segs { display: flex; height: 100%; border-radius: 8px; overflow: hidden; gap: 2px; }
.phase-segs > div { min-width: 4px; }
.phase-today { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--ink); border-radius: 2px; }
.phase-months { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.phase-row { gap: 8px; }
.phase-row.now { background: var(--tint-primary); border-radius: 12px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-top-color: transparent; }
.phase-row.now + .phase-row { border-top-color: transparent; }
.phase-swatch { width: 6px; align-self: stretch; margin: 6px 0; border-radius: 3px; flex: none; }
.badge.now-badge { background: var(--kcal); color: var(--on-kcal); }
.user-row { display: flex; align-items: center; gap: 12px; min-height: 68px; width: 100%; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 6px 0; }
.user-row .main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-row .title { font-weight: 600; }
.user-row svg { color: var(--muted); flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--warn-bg); color: var(--warn-ink); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 18px; flex: none; }
.avatar.admin { background: var(--deep); color: #fff; }
.badge.tag-admin { background: var(--tint-primary); color: var(--ink); }
.badge.tag-new { background: color-mix(in srgb, var(--green) 18%, var(--surface)); color: var(--ink); }
.badge.tag-paused { background: var(--danger-bg); color: var(--danger-ink); }
.temp-pw { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: baseline; background: var(--ground); border-radius: 12px; padding: 12px 14px; }
.mono { font: 600 16px ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.btn.danger-fill { background: var(--red); border-color: var(--red); color: #fff; }
.sub-h { margin: 6px 0 -4px; font: 600 15px var(--body); }

/* ---------- stage 4 ---------- */
/* Drinks: caffeine and alcohol fold up under water. */
.drink-fold { border-top: 1px solid var(--rule); }
.fold-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.fold-head .fold-name { font-weight: 600; width: 76px; flex: none; }
.fold-head .fold-sum { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.fold-head .fold-sum.warn { color: var(--warn-ink); font-weight: 600; }
.fold-head svg { color: var(--muted); flex: none; }
.drink-block.fold-body { padding-top: 0; }
/* Fiber: a fourth macro, in a grain brown (no bumper plate is brown, and blue is water's). */
.c-fiber { background: var(--fiber); }
.macro-cols .macro .num { font-size: 20px; }
.macro-cols .macro .unit { font-size: 13px; }
@media (min-width: 1024px) { .macro-cols .macro .num { font-size: 28px; } }
.diary-totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 12px 14px; }
.diary-totals .num { font-size: 20px; }
.diary-totals .label { font-size: 11px; line-height: 1.25; }
.diary-totals .meter { display: block; margin-top: 4px; height: 4px; }
.diary-totals .meter > span { display: block; height: 100%; border-radius: 3px; }
@media (min-width: 1024px) { .diary-totals .num { font-size: 24px; } .diary-totals .label { font-size: 13px; } }
/* Food overview: grams left for each macro, and the metric chips on the trends chart. */
.left-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.left-tile { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.left-tile .name { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.left-tile .name .swatch { width: 7px; height: 12px; }
.left-tile .num { font: 700 22px/1 var(--display); }
.left-tile .unit { font: 500 13px var(--body); color: var(--muted); }
.left-tile .meter { display: block; height: 5px; }
.left-tile .meter > span { display: block; height: 100%; border-radius: 3px; }
.metric-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.metric-chip { height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: 600 13px var(--body); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.metric-chip i { width: 8px; height: 8px; border-radius: 4px; }
.metric-chip[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.diary-totals .meter { margin: 4px 0 2px; }
.diary-totals .meter.blank { background: transparent; }
/* Cards that fold up to their heading. */
.fold-card { gap: 6px; }
.fold-card.closed { padding-top: 6px; padding-bottom: 6px; }
.fold-card-head { display: flex; align-items: center; gap: 4px; }
.fold-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.fold-toggle h2 { flex: 1; }
.fold-toggle svg { color: var(--muted); flex: none; }
/* Rest timer: orange "Rest over" bar, and the mute button on the running timer. */
.rest.over { background: #C25412; color: #fff; justify-content: flex-start; padding: 12px 12px 12px 16px; }
.rest.over > svg { flex: none; width: 26px; height: 26px; }
.rest.over .rest-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rest.over .rest-title { font: 700 26px/1 var(--display); }
.rest.over .btn.outline-light { border-color: #fff; }
.rest .rest-mute { color: #fff; width: 40px; height: 40px; border: 1px solid #3A5580; }
.rest .rest-mute[aria-pressed="false"] { color: #B8C6DC; }
@media (hover: hover) { .rest .rest-mute:hover { background: rgba(255,255,255,0.08); } }
/* Settings > Rest timer */
.set-row-line { display: flex; align-items: center; gap: 12px; min-height: 60px; border-top: 1px solid var(--rule); }
.set-row-line:first-child, [role="radiogroup"] > .set-row-line:first-child { border-top: 0; }
.set-row-line .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; cursor: pointer; }
.set-row-line .title { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .icon-btn.bordered { width: 44px; height: 44px; color: var(--ink); }
.rest-len { font: 700 24px var(--display); width: 54px; text-align: center; }
.radio { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); flex: none; }
.range { width: 100%; height: 28px; accent-color: var(--primary); }
.lock-preview { background: #0F1823; color: #fff; gap: 10px; }
.note-card { background: #E8EDF2; color: #16202B; border-radius: 16px; padding: 12px; display: flex; gap: 10px; align-items: flex-start; }
.note-card img { border-radius: 9px; flex: none; }
.note-card .main { flex: 1; display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.note-card .note-top { display: flex; justify-content: space-between; font-size: 13px; color: #4E5B69; }
.note-card .note-top b { color: #16202B; }
/* Choice chips (equipment, type, filters). */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 38px; padding: 0 13px; border-radius: 19px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: 600 13px var(--body); cursor: pointer; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--ground); color: var(--ink); }
.tag.primary { background: var(--tint-primary); color: var(--primary); }
.add-ic { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--field); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); flex: none; }
.btn.dashed { border-style: dashed; }
/* Routine editor: planned sets and warm-ups. */
.ritem { background: var(--ground); border-radius: 14px; padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.ritem-head { display: flex; align-items: center; gap: 6px; }
.ritem-toggle { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 44px; justify-content: center; padding: 0; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ritem-toggle .title { font-weight: 600; }
.plan-grid { display: grid; grid-template-columns: 36px 1fr 1fr 40px; gap: 8px; align-items: center; }
.plan-grid.head { font-size: 12px; color: var(--muted); }
.plan-grid input { height: 40px; min-width: 0; border-radius: 8px; border: 1px solid var(--field); text-align: center; font: 600 15px var(--body); color: var(--ink); background: var(--surface); }
.plan-grid .set-n { font: 600 17px var(--display); text-align: center; }
.plan-grid.warm .set-n { color: var(--warn-ink); }
.plan-grid.warm input { background: var(--warn-bg); }
.btn.soft { background: var(--tint-primary); color: var(--primary); border-color: transparent; }
/* Live logger: effort per set. */
.set-grid.fx { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 62px) minmax(0, 50px) 44px 40px; gap: 6px; }
@media (min-width: 600px) { .set-grid.fx { grid-template-columns: 34px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 52px 44px; gap: 8px; } }
.eff-btn { height: 40px; border-radius: 8px; border: 1px solid var(--field); background: var(--surface); color: var(--muted); font: 700 16px var(--display); cursor: pointer; padding: 0; }
.eff-btn.set { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.eff-btn[aria-expanded="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.eff-pick { background: var(--ground); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; margin: 2px 0 4px; }
.eff-scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.eff-scale button { height: 42px; border-radius: 8px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: 700 16px var(--display); padding: 0; cursor: pointer; }
.eff-scale button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.eff-anchors { display: flex; justify-content: space-between; }
/* Cardio form: pace and distance cells, lap times. */
.pace-box .pace-cell { display: flex; flex-direction: column; gap: 2px; }
.pace-box .pace-cell.extra { text-align: right; }
.lap-details summary { font-weight: 600; min-height: 36px; cursor: pointer; }
.lap-times { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding-top: 6px; }
.lap-time { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.lap-time input { height: 38px; min-width: 0; border-radius: 8px; border: 1px solid var(--field); text-align: center; font: 600 14px var(--body); color: var(--ink); background: var(--surface); }
.lap-time input.fastest { border-color: var(--kcal); color: var(--warn-ink); background: var(--warn-bg); }
.segmented button[aria-checked="true"], .segmented.big button[aria-checked="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
/* Train: five sections. */
.segmented.big.five a { font-size: 13px; padding: 0 2px; }
@media (min-width: 600px) { .segmented.big.five a { font-size: 14px; } }

/* Schedule rows (Schedule screen, Coming up). */
.sched-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 6px 0; border: 0; border-top: 1px solid var(--rule); background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.list > .sched-row:first-child { border-top: 0; }
.sched-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sched-row .title { font-weight: 600; }
.sched-row > svg { color: var(--muted); flex: none; }
.sched-when { width: 56px; flex: none; display: flex; flex-direction: column; align-items: center; text-align: center; }
.sched-when b { font: 700 16px/1.1 var(--display); }
.sched-bar { width: 6px; height: 36px; border-radius: 3px; flex: none; }
.day-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day-pick button { height: 44px; border-radius: 10px; border: 1px solid var(--field); background: var(--surface); color: var(--ink); font: 600 14px var(--body); cursor: pointer; padding: 0; }
.day-pick button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline input { height: 40px; }
.just-this { background: var(--ground); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.grid-delete { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.wd-dot.k-plan-strength { background: transparent; border: 2px dashed var(--lift); color: var(--lift); font: 700 13px var(--display); }
.wd-dot.k-plan-cardio { background: transparent; border: 2px dashed var(--kcal); color: var(--warn-ink); font: 700 13px var(--display); }
.wd-dot.k-plan-stretch { background: transparent; border: 2px dashed var(--green); color: var(--green); font: 700 13px var(--display); }
.wd-time { font-size: 10px; white-space: nowrap; }
.cal-dots i.p-strength, .cal-dots i.p-cardio, .cal-dots i.p-stretch, .legend i.p-strength { background: transparent; box-sizing: border-box; border: 1.5px solid var(--lift); }
.cal-dots i.p-cardio { border-color: var(--kcal); }
.cal-dots i.p-stretch { border-color: var(--green); }
.cal-day.has-plan { cursor: pointer; }
.next-actions.three { grid-template-columns: 2fr 1fr 1fr; }
.act-ic.k-stretch { background: var(--green); color: #fff; }
.done-tick { width: 36px; height: 36px; border-radius: 18px; background: var(--green); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.hold-in { width: 52px; height: 36px; border-radius: 8px; border: 1px solid var(--field); text-align: center; font: 600 14px var(--body); color: var(--ink); background: var(--surface); }

/* Guided stretch timer: full screen. */
.stretch-run { position: fixed; inset: 0; z-index: 60; background: #00275B; color: #fff; display: flex; flex-direction: column; gap: 16px;
  padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); overflow-y: auto; }
.stretch-run .btn.outline-light { border-color: #3A5580; }
.run-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.run-title { display: flex; flex-direction: column; align-items: center; text-align: center; }
.run-title .tiny { color: #B8C6DC; }
.run-mute { color: #fff; border: 1px solid #3A5580; }
.run-segs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.run-segs span { height: 5px; border-radius: 3px; background: #1E3F70; }
.run-segs span.done { background: #FF914D; } .run-segs span.now { background: #fff; }
.run-name { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-top: 6px; }
.run-name h1 { font: 700 38px/1.05 var(--display); }
.run-side { font-weight: 600; font-size: 14px; padding: 4px 12px; border-radius: 14px; background: #FF914D; color: #16202B; }
.run-ring { align-self: center; position: relative; width: min(250px, 62vw); aspect-ratio: 1; }
.run-ring svg { width: 100%; height: 100%; }
.run-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.run-num b { font: 700 68px/1 var(--display); }
.run-num span { font-size: 14px; color: #B8C6DC; }
.run-cue { text-align: center; color: #DCE4EE; margin: 0; }
.run-next { margin-top: auto; background: #0A1A33; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.run-next .tiny { color: #B8C6DC; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.run-ctl { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; }
.run-ctl .btn { height: 56px; }
.run-done { margin: auto 0; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.run-done h1 { font: 700 40px/1 var(--display); }
@media (min-width: 1024px) { .stretch-run { left: 50%; transform: translateX(-50%); width: 480px; border-radius: 0; box-shadow: 0 0 0 100vmax rgba(0, 12, 30, 0.6); } }
/* iPhone Safari gives date and time inputs a fixed native width that ignores width: 100%,
   so in two-column rows they overlap. Drop the native styling so they size like other fields. */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; box-sizing: border-box; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.grid-2 > *, .form-grid > * { min-width: 0; }

/* Timed sets: the Reps / Time switch, timed rows, and the hold timer. */
.measure-box { background: var(--ground); border-radius: 14px; padding: 14px; gap: 12px; }
.measure-box .set-row-line { min-height: 52px; border-top: 1px solid var(--rule); }
.field-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.set-grid.tx { grid-template-columns: 28px minmax(0, 1fr) minmax(0, 64px) 40px 44px 40px; gap: 6px; }
.set-grid.tx.wt { grid-template-columns: 26px minmax(0, 1fr) minmax(0, 52px) minmax(0, 58px) 36px 40px 40px; gap: 5px; }
@media (min-width: 600px) {
  .set-grid.tx { grid-template-columns: 34px minmax(0, 1.3fr) minmax(0, 1fr) 52px 48px 44px; gap: 8px; }
  .set-grid.tx.wt { grid-template-columns: 34px minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 52px 48px 44px; gap: 8px; }
}
.set-grid.tx .set-n { font-size: 16px; }
.set-row.timing { background: var(--warn-bg); }
.timer-btn { width: 100%; max-width: 44px; height: 40px; border-radius: 10px; border: 0; background: var(--tint-primary); color: var(--primary); display: flex; align-items: center; justify-content: center; justify-self: center; cursor: pointer; }
.timer-btn.on { background: #FF914D; color: #16202B; }
.set-row.done .timer-btn:not(.on) { background: transparent; color: var(--muted); border: 1px solid var(--rule); }
.wt-toggle { height: 36px; border-radius: 18px; padding: 0 12px; font-size: 13px; gap: 4px; }
.wt-toggle svg { width: 14px; height: 14px; }
.hold-box { background: var(--deep); color: #fff; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; margin: 2px 0 4px; }
.hold-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hold-title { font-size: 13px; color: #B8C6DC; font-weight: 600; }
.hold-icons { display: flex; gap: 6px; }
.hold-ic { color: #fff; width: 36px; height: 36px; border: 1px solid #3A5580; border-radius: 10px; }
.hold-read { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hold-num { font: 700 56px/1 var(--display); font-variant-numeric: tabular-nums; }
.hold-sub { font-size: 14px; color: #B8C6DC; }
.hold-box.over .hold-sub, .hold-run.over .run-num span { color: #FFD3B5; font-weight: 600; }
.hold-box.lead .hold-num { color: #B8C6DC; }
.hold-bar { height: 8px; border-radius: 4px; background: #1E3F70; overflow: hidden; }
.hold-fill { display: block; height: 100%; width: 0; background: #FF914D; border-radius: 4px; }
.hold-box.lead .hold-fill { background: #B8C6DC; }
.hold-ctl { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
.hold-ctl .btn { height: 44px; padding: 0 8px; }
.hold-box .btn.outline-light { border-color: #3A5580; }
.hold-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
.hold-stats > span { display: flex; flex-direction: column; }
.hold-stats b { font: 700 22px var(--display); }
.hold-stats > span > span { font-size: 12px; color: #B8C6DC; }
.hold-run .run-num b { font-variant-numeric: tabular-nums; }
.hold-run .run-side[hidden] { display: none; }
