/* ---------- design tokens ---------- */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f1f4f6;
  --surface-3: #e6ebef;
  --text: #0f1720;
  --text-2: #475467;
  --muted: #7d8a97;
  --line: #e5eaee;

  --brand: #0f766e;
  --brand-strong: #115e59;
  --brand-ink: #ffffff;
  --brand-soft: #e3f4f1;

  --good: #15803d;
  --good-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --bad: #c0262d;

  /* One color per workout */
  --wA: #c2410c;
  --wB: #4f46e5;
  --wC: #be123c;
  --wD: #0f766e;

  --hero-grad: linear-gradient(140deg, #14857b 0%, #0f766e 45%, #134e4a 100%);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(15, 118, 110, .25);
  --radius: 20px;
  --radius-sm: 14px;
  --nav-h: 66px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e12;
    --surface: #131a20;
    --surface-2: #1a232b;
    --surface-3: #24303a;
    --text: #edf2f6;
    --text-2: #b3bfca;
    --muted: #7b8996;
    --line: #222d36;

    --brand: #2dd4bf;
    --brand-strong: #5eead4;
    --brand-ink: #042420;
    --brand-soft: #0e2d2a;

    --good: #4ade80;
    --good-soft: #10291a;
    --warn: #fbbf24;
    --warn-soft: #2d2410;
    --bad: #f87171;

    --wA: #ea580c;
    --wB: #6366f1;
    --wC: #e11d48;
    --wD: #0d9488;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
main {
  max-width: 600px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px);
  animation: fade .22s ease-out;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main { animation: none; } * { transition: none !important; } }

h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -.02em; margin: 0; font-weight: 750; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; margin: 0; font-weight: 700; }
h3 { font-size: .98rem; margin: 0; font-weight: 700; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); }

.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .85rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.two > * { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

.overline { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 4px 0 18px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--hero-grad); color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none;
  box-shadow: var(--shadow);
}

/* ---------- surfaces ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .i { color: var(--brand); }
.section-label { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 4px 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.pill .i { width: 14px; height: 14px; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.solid { background: var(--brand); color: var(--brand-ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 14px; border: none;
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-lg); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; border-radius: 12px; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: transparent; color: var(--bad); }
.iconbtn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
}
.iconbtn .i { width: 20px; height: 20px; }
.iconbtn.disabled { opacity: .35; pointer-events: none; }

/* ---------- program progress (16 segments) ---------- */
.weeks { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; margin-top: 14px; }
.seg { height: 6px; border-radius: 3px; background: var(--surface-3); }
.seg.past { background: var(--brand); opacity: .55; }
.seg.cur { background: var(--brand); }
.program .title-sm { font-weight: 700; font-size: 1.02rem; margin: 0; }

/* ---------- hero ---------- */
.hero {
  --wc: var(--brand);
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 20px;
  margin-bottom: 14px;
  color: #fff;
  background: var(--wc);
  background: linear-gradient(140deg, color-mix(in srgb, var(--wc) 88%, #fff) 0%, var(--wc) 45%, color-mix(in srgb, var(--wc) 65%, #000) 100%);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--wc) 35%, transparent);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.hero.wA { --wc: var(--wA); }
.hero.wB { --wc: var(--wB); }
.hero.wC { --wc: var(--wC); }
.hero.wD { --wc: var(--wD); }
.hero h2 { font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; margin: 10px 0 6px; }
.hero h1 { color: #fff; margin: 8px 0 4px; }
.hero p { color: rgba(255, 255, 255, .88); }
.hero-top { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); color: #fff;
  font-size: .78rem; font-weight: 700; backdrop-filter: blur(4px);
}
.hero-chip .i { width: 14px; height: 14px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 18px; font-size: .88rem; font-weight: 600; color: rgba(255, 255, 255, .92); }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .i { width: 16px; height: 16px; opacity: .85; }
.hero-foot { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.hero-btn { flex: 1; background: #fff; color: var(--wc); box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.hero-btn.soft { background: rgba(255, 255, 255, .2); color: #fff; box-shadow: none; }
.hero .ring-track { stroke: rgba(255, 255, 255, .25); }
.hero .ring-fill { stroke: #fff; }
.hero .ring-label { color: #fff; }
.hero.compact { padding: 18px 20px; }
.hero.compact .hero-meta { margin-bottom: 0; }

.rest-hero { background: var(--surface); box-shadow: var(--shadow); border-radius: 24px; padding: 20px; margin-bottom: 14px; }
.rest-hero .icon-badge { background: var(--brand-soft); color: var(--brand); }
.icon-badge { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.icon-badge .i { width: 22px; height: 22px; }
.ideas { list-style: none; padding: 0; margin: 14px 0 0; }
.ideas li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; color: var(--text-2); }
.ideas li .i { color: var(--brand); margin-top: 2px; }

/* ---------- progress ring ---------- */
.ring { position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-track { fill: none; stroke: var(--surface-3); }
.ring-fill { fill: none; stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring-label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 750; font-size: .85rem; line-height: 1.1; text-align: center;
}
.ring-label small { font-size: .7rem; font-weight: 600; color: var(--muted); margin-top: 2px; }
.ring.big .ring-label { font-size: 1.5rem; letter-spacing: -.02em; }
.ring.big .ring-label small { font-size: .78rem; }

/* ---------- stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.stat .i { color: var(--brand); width: 18px; height: 18px; }
.stat .v { font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; margin-top: 8px; white-space: nowrap; }
.stat .v small { font-size: .78rem; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.stat .l { color: var(--muted); font-size: .78rem; font-weight: 600; }

/* ---------- banner link ---------- */
.banner {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
  border: 1.5px solid color-mix(in srgb, var(--brand) 35%, transparent);
}
.banner .icon-badge { background: var(--brand-soft); color: var(--brand); }
.banner .grow { flex: 1; min-width: 0; }
.banner .chev { color: var(--muted); }

/* ---------- week strip ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0 8px; border-radius: 14px;
  color: var(--muted); font-size: .72rem; font-weight: 600; text-decoration: none;
}
.day b { font-size: 1rem; color: var(--text); font-weight: 700; }
.day .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .68rem; font-weight: 800; color: #fff; }
.day .dot.rest { background: transparent; color: var(--muted); }
.day .dot .i { width: 13px; height: 13px; stroke-width: 3; }
.day.today { background: var(--brand-soft); }
.day.today b { color: var(--brand); }

.wbadge {
  --wc: var(--brand);
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: color-mix(in srgb, var(--wc) 14%, transparent); color: var(--wc);
  font-weight: 800; font-size: .95rem;
}
.wbadge.solid, .dot.wA, .dot.wB, .dot.wC, .dot.wD { background: var(--wc); color: #fff; }
.wA { --wc: var(--wA); }
.wB { --wc: var(--wB); }
.wC { --wc: var(--wC); }
.wD { --wc: var(--wD); }
.dot.done { background: var(--good); }

/* ---------- inputs ---------- */
input[type="number"], input[type="date"], input[type="text"], input[type="email"], input[type="password"], select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: 12px;
  padding: 11px 14px; min-height: 48px; width: 100%;
  transition: border-color .15s, background .15s;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.field { display: block; margin: 0 0 14px; font-weight: 650; font-size: .86rem; color: var(--text-2); }
.field input, .field select { margin-top: 6px; font-weight: 500; }
.field .hint { font-weight: 500; color: var(--muted); }
fieldset.field { border: none; padding: 0; margin: 0 0 16px; }
fieldset.field legend { padding: 0; margin-bottom: 8px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 44px; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; font-size: .9rem; pointer-events: none; }
.big-input { text-align: center; }
.big-input input { font-size: 2.6rem; font-weight: 750; letter-spacing: -.02em; text-align: center; min-height: 84px; padding-right: 14px; }
.big-input span { position: static; transform: none; display: block; margin-top: 6px; }

.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s ease; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-grid; place-items: center; min-width: 50px; height: 42px; padding: 0 12px;
  border-radius: 12px; background: var(--surface-2); font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: background .15s, color .15s;
}
.chip input:checked + span { background: var(--brand); color: var(--brand-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- workout screen ---------- */
.appbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  margin: calc(-1 * (env(safe-area-inset-top) + 18px)) -16px 14px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.appbar-title { flex: 1; font-weight: 700; text-align: center; }
.appbar-count { min-width: 40px; text-align: right; font-weight: 700; color: var(--brand); font-size: .9rem; }
.appbar-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--surface-3); }
.appbar-progress i { display: block; height: 100%; background: var(--brand); transition: width .3s ease; }

.note-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--text); margin-bottom: 14px; font-size: .92rem; }
.note-card .i { color: var(--brand); margin-top: 2px; }
.note-card.warn { background: var(--warn-soft); }
.note-card.warn .i { color: var(--warn); }

.block-title { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.block-title .icon-badge { width: 34px; height: 34px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
.block-title .icon-badge .i { width: 18px; height: 18px; }
.block-title .grow { flex: 1; }
.block-text { color: var(--text-2); font-size: .95rem; }

.group { margin-top: 6px; }
.group + .group { margin-top: 16px; }
.group-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin: 0 2px 8px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.group-head span:last-child { text-transform: none; letter-spacing: 0; font-weight: 600; }
.group-body { border-radius: 16px; background: var(--surface-2); padding: 4px; }
.group-body .ex + .ex { margin-top: 4px; }

.ex { background: var(--surface); border-radius: 13px; padding: 14px; transition: opacity .2s; }
.ex-main { display: flex; gap: 12px; align-items: flex-start; }
.ex-label { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: .78rem; font-weight: 800; }
.ex-body { flex: 1; min-width: 0; }
.ex-name { font-weight: 700; margin: 3px 0 6px; line-height: 1.25; }
.ex.done .ex-name { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.rx { display: flex; flex-wrap: wrap; gap: 6px; }
.rx span { padding: 3px 9px; border-radius: 8px; background: var(--surface-2); font-size: .8rem; font-weight: 650; color: var(--text-2); }
.rx span.strong { background: var(--brand-soft); color: var(--brand); }
.rx-text { color: var(--text-2); font-size: .92rem; }

.check { flex: none; cursor: pointer; position: relative; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check > span:first-of-type {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--surface-3); color: transparent;
  transition: background .15s, border-color .15s, transform .15s;
}
.check > span .i { width: 18px; height: 18px; stroke-width: 3; }
.check input:checked + span { background: var(--good); border-color: var(--good); color: #fff; transform: scale(1.05); }
.check input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.ex-weight { display: flex; align-items: center; gap: 10px; margin: 12px 0 0 42px; }
.ex-weight .input-suffix { width: 120px; }
.ex-weight input { min-height: 42px; padding: 8px 40px 8px 12px; font-weight: 700; }
.ex-weight .last { font-size: .8rem; color: var(--muted); font-weight: 600; }
.ex details { margin: 10px 0 0 42px; font-size: .9rem; }
.ex details p { margin: 8px 0 0; color: var(--text-2); }
summary { color: var(--brand); cursor: pointer; font-weight: 650; font-size: .86rem; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
summary::-webkit-details-marker { display: none; }
summary .i { width: 15px; height: 15px; transition: transform .2s; }
details[open] summary .i { transform: rotate(90deg); }

.done-banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--good-soft); color: var(--good); font-weight: 700; margin-bottom: 12px; }

/* ---------- plan ---------- */
.phase-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.phase-col p { font-size: .72rem; font-weight: 700; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase-col.current p { color: var(--brand); }
.phase-weeks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.wk {
  display: grid; place-items: center; height: 30px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-2);
  font-size: .74rem; font-weight: 700; text-decoration: none;
}
.wk.past { background: var(--brand-soft); color: var(--brand); }
.wk.deload { box-shadow: inset 0 0 0 1.5px var(--warn); }
.wk.sel { background: var(--brand); color: var(--brand-ink); }
.wk.now { position: relative; }
.wk.now::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.pager .mid { text-align: center; }
.pager .mid b { display: block; font-size: 1.1rem; }

.plan-day { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: inherit; text-decoration: none; }
.plan-day + .plan-day { border-top: 1px solid var(--line); }
.date-box { width: 44px; flex: none; text-align: center; }
.date-box span { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.date-box b { font-size: 1.2rem; }
.plan-day.is-today .date-box b { color: var(--brand); }
.plan-day .grow { flex: 1; min-width: 0; }
.plan-day .t { font-weight: 650; }
.plan-day .s { font-size: .82rem; color: var(--muted); }
.plan-day.rest .t { color: var(--muted); font-weight: 600; }

.wlist { list-style: none; margin: 0; padding: 0; }
.wlist li { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.wlist li + li { border-top: 1px solid var(--line); }

/* ---------- progress ---------- */
.goal-card { display: flex; align-items: center; gap: 18px; }
.goal-side { flex: 1; min-width: 0; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: .92rem; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv span { color: var(--muted); font-weight: 600; }
.kv b { font-weight: 750; }

.chart { width: 100%; height: auto; display: block; margin: 4px 0 8px; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; font-weight: 600; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .target { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; }
.chart .goal-line { stroke: var(--good); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .goal-text { fill: var(--good); }
.chart .actual { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.chart .dot.last { fill: var(--brand); }
.legend { display: flex; align-items: center; gap: 16px; font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 16px; border-top: 2.5px solid var(--brand); }
.key.target { border-top: 1.5px dashed var(--muted); }

.insight { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 14px; font-size: .92rem; color: var(--text-2); }
.insight .i { color: var(--brand); margin-top: 2px; }
.insight.good { background: var(--good-soft); }
.insight.good .i { color: var(--good); }
.insight.warn { background: var(--warn-soft); }
.insight.warn .i { color: var(--warn); }
.insight b { color: var(--text); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; align-items: center; padding: 10px 0; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 38px; bottom: -10px; width: 2px; background: var(--surface-3); }
.timeline .node { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 800; position: relative; z-index: 1; }
.timeline .node .i { width: 15px; height: 15px; stroke-width: 3; }
.timeline li.reached .node { background: var(--good); color: #fff; }
.timeline li.reached:not(:last-child)::before { background: var(--good); }
.timeline .grow { flex: 1; }
.timeline .t { font-weight: 700; }
.timeline .s { font-size: .82rem; color: var(--muted); }
.timeline .w { font-weight: 750; }

.nutri { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.nutri div { background: var(--surface-2); border-radius: 14px; padding: 14px; }
.nutri b { display: block; font-size: 1.35rem; letter-spacing: -.02em; }
.nutri span { font-size: .78rem; color: var(--muted); font-weight: 600; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.history li + li { border-top: 1px solid var(--line); }
.history .grow { flex: 1; min-width: 0; }
.history .t { font-weight: 650; }
.history .s { font-size: .8rem; color: var(--muted); }
.history .w { font-weight: 750; }
.delta { font-size: .78rem; font-weight: 700; }
.delta.down { color: var(--good); }
.delta.up { color: var(--warn); }

.empty { text-align: center; padding: 18px 8px; color: var(--muted); }
.empty .i { width: 32px; height: 32px; color: var(--surface-3); margin-bottom: 8px; }

/* ---------- settings ---------- */
.settings-list { list-style: none; margin: 0; padding: 0; }
.settings-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.settings-list li + li { border-top: 1px solid var(--line); }
.settings-list .grow { flex: 1; min-width: 0; }
.settings-list .t { font-weight: 650; }
.settings-list .s { font-size: .82rem; color: var(--muted); }
.step-list { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); font-size: .92rem; }
.step-list li { margin-bottom: 4px; }
.disclaimer { font-size: .78rem; color: var(--muted); text-align: center; margin: 20px 12px 0; }

/* ---------- bottom nav ---------- */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
}
nav.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: calc(var(--nav-h) - 12px);
  color: var(--muted); text-decoration: none;
  font-size: .7rem; font-weight: 650;
}
nav.tabs a span.ic { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background .2s; }
nav.tabs svg { width: 22px; height: 22px; }
nav.tabs a.active { color: var(--brand); }
nav.tabs a.active span.ic { background: var(--brand-soft); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; z-index: 20;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  transform: translate(-50%, 10px);
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-weight: 650; font-size: .92rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .i { width: 18px; height: 18px; color: var(--brand); }

/* ---------- sign in ---------- */
body.signed-out nav.tabs { display: none; }
body.signed-out main { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }
.auth { max-width: 420px; margin: 0 auto; padding-top: 6vh; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand img { border-radius: 20px; box-shadow: var(--shadow-lg); margin-bottom: 14px; }
.auth-brand h1 { margin-bottom: 6px; }
.auth-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 14px; background: var(--surface-3); }
.auth-tabs button {
  flex: 1; height: 40px; padding: 0 8px; border: none; border-radius: 11px;
  background: transparent; color: var(--text-2);
  font: inherit; font-weight: 650; font-size: .92rem; cursor: pointer;
}
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.form-error { color: var(--bad); font-size: .88rem; font-weight: 600; margin: -4px 0 12px; min-height: 1em; }
.form-error:empty { display: none; }
.btn:disabled { opacity: .6; pointer-events: none; }
.pw-details { margin-top: 6px; }
.pw-form { margin-top: 14px; }
