/* Gym Tracker v3 — drop-in replacement for static/css/style.css
   Same class names and CSS variable names as v2, plus the NEW classes listed in MIGRATION.md.
   Theme model unchanged: dark is the base :root; light applies via prefers-color-scheme
   unless [data-theme="dark"] is forced, or always with [data-theme="light"].
   Fonts: self-hosted Barlow + Barlow Condensed (SIL OFL) in /static/fonts/. */

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

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-button: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  --tap-target: 48px;
  --tap-target-lg: 56px;
  --pin-key: 76px;
  --content-max: 640px;
  --overlay-blur: blur(16px) saturate(150%);
  --font-sans: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Barlow Condensed", Barlow, system-ui, sans-serif;
}

:root {
  color-scheme: dark;
  --bg: #07090d;
  --surface: #0f141b;
  --surface-2: #161d27;
  --surface-3: #1f2834;
  --surface-translucent: rgba(15, 20, 27, 0.78);
  --surface-inverse: #f2f5f8;
  --text: #f2f5f8;
  --text-inverse: #0f141a;
  --muted: #9aa6b5;
  --border: #232c38;
  --border-strong: #3a4656;
  --accent: #22c55e;
  --accent-text: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.14);
  --on-accent: #04120a;
  --focus: #4ade80;
  --danger: #ff7b7b;
  --danger-fill: #b91c1c;
  --on-danger: #ffffff;
  --warn: #fbbf24;
  --warn-text: #fcd34d;
  --on-warn: #1f1300;
  --info: #60a5fa;
  --pr: #fcd34d;
  --pr-text: #fcd34d;
  --scrim: rgba(0, 0, 0, 0.6);
  --ring-good: #22c55e;
  --ring-warn: #f59e0b;
  --ring-critical: #ef4444;
  --stat-sets: #fb7d45;
  --stat-steps: #a39bf0;
  --stat-protein: #4ade80;
  --chart-weight-avg: #60a5fa;
  --chart-other: #6b7280;
  --muscle-chest: #3987e5;
  --muscle-shoulders: #008300;
  --muscle-triceps: #d55181;
  --muscle-back: #c98500;
  --muscle-biceps: #199e70;
  --muscle-quads: #d95926;
  --muscle-hamstrings: #9085e9;
  --elevate: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.7);
  --shadow-sheet: 0 -12px 40px rgba(0, 0, 0, 0.5);
  --glow-accent: 0 6px 20px -4px rgba(34, 197, 94, 0.45);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f1f3f6;
    --surface-3: #e7eaef;
    --surface-translucent: rgba(255, 255, 255, 0.8);
    --surface-inverse: #1a212b;
    --text: #0f141a;
    --text-inverse: #f2f5f8;
    --muted: #566170;
    --border: #e2e6eb;
    --border-strong: #b8c0cb;
    --accent: #22c55e;
    --accent-text: #107a3b;
    --accent-soft: rgba(16, 122, 59, 0.1);
    --on-accent: #04120a;
    --focus: #15803d;
    --danger: #c42525;
    --danger-fill: #c42525;
    --on-danger: #ffffff;
    --warn: #f59e0b;
    --warn-text: #8a5a08;
    --on-warn: #1f1300;
    --info: #1d6acb;
    --pr: #d4a012;
    --pr-text: #7a5600;
    --scrim: rgba(15, 20, 26, 0.4);
    --ring-good: #16a34a;
    --ring-warn: #d97706;
    --ring-critical: #dc2626;
    --stat-sets: #c2410c;
    --stat-steps: #6d5fd6;
    --stat-protein: #107a3b;
    --chart-weight-avg: #1d6acb;
    --chart-other: #9aa0aa;
    --muscle-chest: #2a78d6;
    --muscle-shoulders: #008300;
    --muscle-triceps: #e87ba4;
    --muscle-back: #eda100;
    --muscle-biceps: #1baf7a;
    --muscle-quads: #eb6834;
    --muscle-hamstrings: #4a3aa7;
    --elevate: 0 1px 2px rgba(15, 20, 26, 0.05), 0 10px 24px -14px rgba(15, 20, 26, 0.18);
    --shadow-sm: 0 2px 8px rgba(15, 20, 26, 0.08);
    --shadow: 0 16px 40px -12px rgba(15, 20, 26, 0.25);
    --shadow-sheet: 0 -12px 40px rgba(15, 20, 26, 0.15);
    --glow-accent: 0 6px 18px -6px rgba(22, 163, 74, 0.45);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e7eaef;
  --surface-translucent: rgba(255, 255, 255, 0.8);
  --surface-inverse: #1a212b;
  --text: #0f141a;
  --text-inverse: #f2f5f8;
  --muted: #566170;
  --border: #e2e6eb;
  --border-strong: #b8c0cb;
  --accent: #22c55e;
  --accent-text: #107a3b;
  --accent-soft: rgba(16, 122, 59, 0.1);
  --on-accent: #04120a;
  --focus: #15803d;
  --danger: #c42525;
  --danger-fill: #c42525;
  --on-danger: #ffffff;
  --warn: #f59e0b;
  --warn-text: #8a5a08;
  --on-warn: #1f1300;
  --info: #1d6acb;
  --pr: #d4a012;
  --pr-text: #7a5600;
  --scrim: rgba(15, 20, 26, 0.4);
  --ring-good: #16a34a;
  --ring-warn: #d97706;
  --ring-critical: #dc2626;
  --stat-sets: #c2410c;
  --stat-steps: #6d5fd6;
  --stat-protein: #107a3b;
  --chart-weight-avg: #1d6acb;
  --chart-other: #9aa0aa;
  --muscle-chest: #2a78d6;
  --muscle-shoulders: #008300;
  --muscle-triceps: #e87ba4;
  --muscle-back: #eda100;
  --muscle-biceps: #1baf7a;
  --muscle-quads: #eb6834;
  --muscle-hamstrings: #4a3aa7;
  --elevate: 0 1px 2px rgba(15, 20, 26, 0.05), 0 10px 24px -14px rgba(15, 20, 26, 0.18);
  --shadow-sm: 0 2px 8px rgba(15, 20, 26, 0.08);
  --shadow: 0 16px 40px -12px rgba(15, 20, 26, 0.25);
  --shadow-sheet: 0 -12px 40px rgba(15, 20, 26, 0.15);
  --glow-accent: 0 6px 18px -6px rgba(22, 163, 74, 0.45);
}

/* Gym Tracker v3 — component styles.
   Same selectors as the live app's static/css/style.css (drop-in), plus a few
   new ones marked NEW. Every value comes from a token; no raw colors except
   inside color-mix() tints of tokens. */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
/* Atmosphere: one soft accent glow at the top of the page, so the frosted
   chrome has something to blur. Fixed, so it doesn't scroll away. */
body {
  background:
    radial-gradient(120% 55% at 50% -12%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 62%) fixed,
    var(--bg);
}

body, .card, .exercise, button, input, select, textarea, .timer, header.topbar, nav.tabbar, .muscle-tag, .set-row {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

h1, h2, h3 { letter-spacing: -0.01em; line-height: 1.2; }
a { color: var(--accent-text); text-decoration: none; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: 0; }

.app { max-width: 640px; margin: 0 auto; padding: 0 0 96px; min-height: 100vh; transition: padding-bottom .2s ease; }
.app.timer-open { padding-bottom: 232px; }
main { padding: 8px 16px 24px; }

/* ---------- top bar ---------- */
header.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  /* iOS's black-translucent status-bar style (base.html) draws the web
     content underneath the status bar/notch instead of below it — without
     this, the wordmark renders directly under the clock/battery icons
     when the app is launched from the Home Screen. */
  padding: calc(12px + env(safe-area-inset-top, 0)) 16px 12px;
  background: var(--surface-translucent);
  -webkit-backdrop-filter: var(--overlay-blur); backdrop-filter: var(--overlay-blur);
  border-bottom: 1px solid var(--border);
}
header.topbar h1 {
  margin: 0; display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 22px; font-weight: 800;
  letter-spacing: 0.02em; text-transform: uppercase;
}
header.topbar h1 .accent { color: var(--accent-text); }
header.topbar .brand-mark { width: 22px; height: 22px; color: var(--accent-text); flex-shrink: 0; }
.screen-title { font-size: 28px; font-weight: 700; margin: 12px 0 2px; letter-spacing: -0.02em; } /* NEW */
.screen-sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }                           /* NEW */

.icon-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 999px;
  min-height: 40px; min-width: 40px; padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- tab bar ---------- */
nav.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; padding: 6px 6px env(safe-area-inset-bottom, 0);
  background: var(--surface-translucent);
  -webkit-backdrop-filter: var(--overlay-blur); backdrop-filter: var(--overlay-blur);
  border-top: 1px solid var(--border);
}
nav.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 56px; padding: 4px 2px 8px; color: var(--muted);
  font-size: 12px; font-weight: 600; letter-spacing: 0; position: relative; white-space: nowrap;
}
nav.tabbar .nav-icon { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; transition: background-color .2s ease; }
nav.tabbar .nav-icon svg { width: 22px; height: 22px; }
nav.tabbar a.active { color: var(--accent-text); }
nav.tabbar a.active .nav-icon { background: var(--accent-soft); }

/* ---------- surfaces: flat, not glass ---------- */
.card, .exercise, .glass-card, .stat-tile, .ring-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--elevate);
}
.card { padding: 16px; margin-bottom: 12px; }
.card h2, .card h3 { margin-top: 0; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; } /* NEW */
.card-title h3 { margin: 0; font-size: 17px; font-weight: 700; }
.card-title .muted { font-size: 14px; }

.day-kicker { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.muted { color: var(--muted); }

/* ---------- exercise card ---------- */
.exercise { padding: 16px; margin-bottom: 12px; }
.exercise.is-active { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--elevate), 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); } /* NEW */
.exercise.is-done { opacity: .72; }                                                                                                           /* NEW */
.ex-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }              /* NEW */
.exercise-name { font-size: 19px; font-weight: 700; line-height: 1.2; }
.ex-count { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; } /* NEW */
.ex-count b { color: var(--text); font-weight: 800; }
.exercise.is-next { padding: 14px 16px; }                                                                     /* NEW: collapsed upcoming exercise */
.exercise.is-next .target-line { margin-bottom: 0; }
.muscle-tag {
  display: inline-block; vertical-align: 2px; margin-left: 8px;
  font-size: 12px; font-weight: 600; line-height: 1; text-transform: capitalize;
  color: var(--accent-text); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: 999px; padding: 4px 8px;
}
.target-line { color: var(--accent-text); font-size: 15px; margin: 4px 0 2px; font-weight: 600; }
.last-line { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.ex-progress { display: flex; gap: 4px; margin: 12px 0 12px; }                                                 /* NEW */
.ex-progress span { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-3); }
.ex-progress span.done { background: var(--accent); }
details.cues { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
details.cues summary { cursor: pointer; color: var(--text); font-weight: 600; }

/* sets: a small table — SET · KG · REPS · RPE · action
   NOTE: v3's drop-in spec is a 4-col grid (28px 1fr 1fr 96px) with no RPE
   field. This app added per-set RPE in the audit-driven Phase A work
   (surfaces the previously-dead rpe input into progress insights), so a
   5th narrow column is inserted here rather than silently dropping that
   feature to match the drop-in literally. */
.set-head, .set-row { display: grid; grid-template-columns: 26px 1fr 1fr 52px 96px; align-items: center; gap: 6px; } /* set-head NEW */
.set-head { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 0 0 6px; }
.set-head span:nth-child(2), .set-head span:nth-child(3), .set-head span:nth-child(4) { text-align: center; }
.set-row { margin-bottom: 8px; border-radius: 14px; }
.set-row .set-num { color: var(--muted); font-family: var(--font-display); font-size: 20px; font-weight: 700; text-align: center; }
.set-row input[type=number] {
  width: 100%; text-align: center; padding: 8px 4px;
  font-family: var(--font-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums;
}
/* RPE tap-picker: replaces a typed number with a one-tap chip popover —
   typing on a tiny mobile field mid-set was the actual reason this field
   sat empty forever, not that it was hard to find. */
.rpe-cell { position: relative; }
.rpe-btn {
  width: 100%; min-height: 48px; padding: 8px 2px;
  background: transparent; border: 1px solid var(--border-strong); border-radius: 12px;
  font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--muted);
}
.rpe-btn.set { color: var(--text); border-color: var(--accent); }
.set-row.logged .rpe-btn { border-color: transparent; }
.rpe-popover {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
}
.rpe-popover button {
  min-width: 40px; min-height: 40px; padding: 0; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
}
.rpe-popover button:hover { border-color: var(--focus); }
.rpe-popover button.clear { color: var(--muted); font-family: var(--font-sans); font-size: 13px; font-weight: 600; }
.set-row input[type=number]::placeholder { font-family: var(--font-sans); font-size: 15px; font-weight: 500; color: var(--muted); opacity: .7; }
.set-row.logged { background: var(--accent-soft); }                                                              /* NEW */
.set-row.logged .set-num { color: var(--accent-text); }
.set-row.logged input[type=number] { background: transparent; border-color: transparent; color: var(--text); }
.set-done { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; color: var(--accent-text); font-weight: 700; font-size: 15px; } /* NEW */
.set-done svg { width: 20px; height: 20px; }
.set-row.is-pr .set-done { color: var(--pr-text); }                                                            /* NEW */

/* ---------- inputs ---------- */
input[type=number], input[type=text], input[type=date], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: 12px 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px;
  font: inherit; font-size: 17px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; font-weight: 600; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 6px; }                                         /* NEW */

/* ---------- buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; min-width: 48px; padding: 12px 18px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 14px;
  font: inherit; font-size: 17px; font-weight: 600; cursor: pointer;
}
button svg { width: 20px; height: 20px; }
button:active { transform: scale(0.97); }
@media (hover: hover) {
  button:hover { border-color: var(--focus); }
  button.primary:hover { filter: brightness(1.06); }
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; box-shadow: var(--glow-accent); }
button.primary.block, button.block { width: 100%; min-height: 56px; font-size: 18px; }                          /* block NEW */
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }                       /* NEW */
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.log-set { background: transparent; border-color: var(--accent); color: var(--accent-text); font-weight: 700; padding: 8px 10px; }
button.small { min-height: 40px; padding: 8px 12px; font-size: 15px; border-radius: 12px; }
button:disabled { opacity: .45; transform: none; cursor: default; }

.row { display: flex; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 8px; }                                                      /* NEW */

/* ---------- notices ---------- */
.banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--warn); color: var(--on-warn);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
  font-weight: 600; font-size: 15px; box-shadow: var(--shadow-sm);
}
.banner svg { width: 20px; height: 20px; flex-shrink: 0; }
.offline-banner { background: var(--danger-fill); color: var(--on-danger); text-align: center; padding: 8px; font-size: 14px; font-weight: 600; display: none; }
.offline-banner.show { display: block; }

/* ---------- rest timer ---------- */
.timer {
  position: fixed; bottom: 76px; left: 12px; right: 12px; max-width: 416px; margin: 0 auto; z-index: 20;
  display: none; padding: 12px 12px 12px 18px;
  background: var(--surface-translucent);
  -webkit-backdrop-filter: var(--overlay-blur); backdrop-filter: var(--overlay-blur);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border)); border-radius: 22px;
  box-shadow: var(--shadow);
}
.timer.show { display: block; }                                                                                  /* NEW */
.timer-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }                   /* NEW */
.timer-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); } /* NEW */
.timer .timer-time {
  font-family: var(--font-display); font-size: 52px; font-weight: 800; line-height: .95;
  color: var(--accent-text); font-variant-numeric: tabular-nums; margin: 0;
}
.timer.done { border-color: var(--warn); }
.timer.done .timer-time { color: var(--warn-text); font-size: 40px; white-space: nowrap; }
.timer-bar-track { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 10px 0 0; }
.timer-bar-fill { height: 100%; width: 100%; background: var(--accent); border-radius: 999px; transition: width .25s linear, background .3s; }
.timer.done .timer-bar-fill { background: var(--warn); }
.timer-controls { display: flex; gap: 6px; }
.timer-controls button { flex: none; }

/* ---------- progress: rings ---------- */
.hero-rings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.ring-card { position: relative; padding: 18px 12px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; overflow: hidden; }
.ring-card svg { display: block; position: relative; z-index: 1; }
.ring-glow {
  position: absolute; top: -30px; left: 50%; width: 170px; height: 170px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(circle, var(--ring-glow, transparent) 0%, transparent 68%);
  opacity: .28; filter: blur(8px); pointer-events: none;
}
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 10; }
.ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .8s cubic-bezier(.16,1,.3,1); }
.ring-fill.good { stroke: var(--ring-good); }
.ring-fill.warn { stroke: var(--ring-warn); }
.ring-fill.critical { stroke: var(--ring-critical); }
.ring-fill.info { stroke: var(--info); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; } /* NEW */
.ring-number { font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-top: 2px; }
.ring-label { margin-top: 12px; font-weight: 700; font-size: 16px; }
.ring-detail { color: var(--muted); font-size: 13px; margin-top: 2px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ring-status { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: 4px 10px; } /* NEW */
.ring-status.good { color: var(--accent-text); background: var(--accent-soft); }
.ring-status.warn { color: var(--warn-text); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.ring-status.critical { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ---------- progress: stat tiles ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 12px; }
.stat-tile { position: relative; padding: 16px; overflow: hidden; }
.stat-tile-icon {
  width: 36px; height: 36px; margin-bottom: 12px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--stat-accent, var(--accent-text));
  background: color-mix(in srgb, var(--stat-accent, var(--accent)) 16%, transparent);
}
.stat-tile-icon svg { width: 20px; height: 20px; }
.stat-tile-label { color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.stat-tile-value { font-family: var(--font-display); font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-tile-value small { font-family: var(--font-sans); font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat-tile-delta { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; margin-top: 8px; font-weight: 700; }
.stat-tile-delta.up { color: var(--accent-text); }
.stat-tile-delta.down { color: var(--danger); }
.stat-tile-delta.flat { color: var(--muted); }

/* ---------- progress: week strip ---------- */
.day-strip { display: flex; align-items: flex-end; gap: 8px; height: 96px; padding-top: 4px; }
.day-strip .day-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.day-strip .day-bar { width: 100%; max-width: 28px; border-radius: 8px; background: var(--surface-3); min-height: 6px; transition: height .4s ease; }
.day-strip .day-col.trained .day-bar { background: color-mix(in srgb, var(--accent) 45%, var(--surface-3)); } /* NEW */
.day-strip .day-col.is-today .day-bar { background: var(--accent); box-shadow: var(--glow-accent); }
.day-strip .day-label { font-size: 12px; color: var(--muted); font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 999px; }
.day-strip .day-col.is-today .day-label { color: var(--on-accent); background: var(--accent); }

/* ---------- PR badge (NEW) ---------- */
.pr-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--pr-text); background: color-mix(in srgb, var(--pr) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--pr) 45%, transparent);
  border-radius: 999px; padding: 4px 10px 4px 8px;
}
.pr-badge svg { width: 14px; height: 14px; }

/* ---------- session complete (NEW) ---------- */
.session-done { text-align: center; padding: 28px 20px 20px; }
.session-done .done-mark {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 999px;
  display: grid; place-items: center; color: var(--on-accent); background: var(--accent); box-shadow: var(--glow-accent);
}
.session-done .done-mark svg { width: 36px; height: 36px; }
.session-done h2 { font-size: 26px; margin: 0 0 4px; }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; }
.done-stats div { background: var(--surface-2); border-radius: 14px; padding: 12px 6px; }
.done-stats b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.done-stats span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- PIN screen (NEW) ---------- */
.pin-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; gap: 28px; }
.pin-brand { font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; line-height: 1; }
.pin-brand .accent { color: var(--accent-text); }
.pin-title { margin: 0; font-size: 17px; font-weight: 600; color: var(--muted); }
.pin-dots { display: flex; gap: 16px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 999px; border: 2px solid var(--border-strong); }
.pin-dots span.on { background: var(--accent); border-color: var(--accent); }
.pin-dots.error span { border-color: var(--danger); animation: pin-shake .35s ease; }
@keyframes pin-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; }
.pin-pad button { width: 76px; height: 76px; border-radius: 999px; padding: 0; font-family: var(--font-display); font-size: 32px; font-weight: 700; background: var(--surface-2); border-color: var(--border); }
.pin-pad button.ghost { background: transparent; border-color: transparent; font-family: var(--font-sans); font-size: 15px; }

/* ---------- toast ---------- */
.toast-host {
  position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom, 0));
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; padding: 0 16px;
}
.toast {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-inverse); color: var(--text-inverse);
  padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(10px) scale(.96);
  transition: opacity .25s ease, transform .25s cubic-bezier(.16,1,.3,1);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: none; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex-shrink: 0; }
.toast-error::before { background: var(--danger-fill); }

/* ---------- bottom sheet ---------- */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-end; z-index: 200; opacity: 0; transition: opacity .25s ease; }
.modal-overlay.show { opacity: 1; }
.modal-sheet {
  width: 100%; max-height: 84vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-bottom: none;
  border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0));
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%); transition: transform .3s cubic-bezier(.16,1,.3,1);
}
.modal-sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 999px; background: var(--border-strong); margin: 0 auto 12px; } /* grabber NEW */
.modal-overlay.show .modal-sheet { transform: none; }
.modal-close svg { width: 16px; height: 16px; }
.modal-set-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 16px; }
.modal-set-row b { font-family: var(--font-display); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.modal-set-row:last-child { border-bottom: none; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(10px); animation: reveal-in .5s cubic-bezier(.16,1,.3,1) forwards; }
@keyframes reveal-in { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

canvas { max-width: 100%; }

/* ---------- lift picker (chips above the strength chart) ---------- */
/* Matches gym-charts.css's own .chart-range pattern (scrollable instead of
   segmented, since there can be more than three lifts). */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 14px; margin: 4px 0 -4px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 36px; padding: 6px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip.active { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
