/* Lane Line — design system v6
   One token set, one spacing scale (4/8/12/16/20/24/32/48), one card, one control style.
   Motion animates transform and opacity only, and rests under prefers-reduced-motion. */

/* ======================================================================= tokens */
:root {
  color-scheme: light;
  --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --hover: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --grid: #eef0f3;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --accent: #1d5fb0;
  --accent-text: #1d5fb0;
  --accent-soft: #edf3fc;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-hover: 0 6px 16px -4px rgba(16, 24, 40, .12), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 48px -12px rgba(16, 24, 40, .22);

  /* categorical: strokes (fixed order, validated palette) */
  --s-free: #2a78d6; --s-back: #eb6834; --s-breast: #1baf7a; --s-fly: #eda100;
  --s-im: #e87ba4; --s-drill: #008300; --s-mixed: #6250d6;
  /* sequential: heart-rate zones, light -> dark */
  --z1: #9ec5f4; --z2: #6da7ec; --z3: #3987e5; --z4: #256abf; --z5: #104281;
  /* sleep stages */
  --st-deep: #1c5cab; --st-rem: #6250d6; --st-light: #86b6ef; --st-awake: #c9ced6;
  --hr: #e34948;
  /* status: reserved, always paired with an icon and text */
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --band: rgba(42, 120, 214, .10);

  --r-sm: 6px;
  --r-ctl: 8px;
  --r: 12px;
  --header-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0f12; --surface: #16191d; --surface-2: #1b1f24; --hover: #21252b;
    --border: #262a30; --border-strong: #353b43; --grid: #22262b;
    --text: #f2f4f7; --text-2: #c0c6cf; --text-3: #8a929e;
    --accent: #4a90e8; --accent-text: #7fb0f0; --accent-soft: #16263b; --on-accent: #0d0f12;
    --shadow: none; --shadow-hover: 0 8px 24px -6px rgba(0, 0, 0, .6); --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, .7);
    --s-free: #3987e5; --s-back: #d95926; --s-breast: #199e70; --s-fly: #c98500;
    --s-im: #d55181; --s-drill: #008300; --s-mixed: #9085e9;
    --z1: #1c5cab; --z2: #256abf; --z3: #3987e5; --z4: #6da7ec; --z5: #b7d3f6;
    --st-deep: #3987e5; --st-rem: #9085e9; --st-light: #1c5cab; --st-awake: #4a4e54;
    --hr: #e66767; --band: rgba(57, 135, 229, .16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f12; --surface: #16191d; --surface-2: #1b1f24; --hover: #21252b;
  --border: #262a30; --border-strong: #353b43; --grid: #22262b;
  --text: #f2f4f7; --text-2: #c0c6cf; --text-3: #8a929e;
  --accent: #4a90e8; --accent-text: #7fb0f0; --accent-soft: #16263b; --on-accent: #0d0f12;
  --shadow: none; --shadow-hover: 0 8px 24px -6px rgba(0, 0, 0, .6); --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, .7);
  --s-free: #3987e5; --s-back: #d95926; --s-breast: #199e70; --s-fly: #c98500;
  --s-im: #d55181; --s-drill: #008300; --s-mixed: #9085e9;
  --z1: #1c5cab; --z2: #256abf; --z3: #3987e5; --z4: #6da7ec; --z5: #b7d3f6;
  --st-deep: #3987e5; --st-rem: #9085e9; --st-light: #1c5cab; --st-awake: #4a4e54;
  --hr: #e66767; --band: rgba(57, 135, 229, .16);
}

/* ======================================================================= base */
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; scroll-margin-top: calc(var(--header-h) + 16px); }
p { text-wrap: pretty; }
h1 { font-size: 28px; font-weight: 650; letter-spacing: -.025em; line-height: 1.15; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
h3 { font-size: 14px; font-weight: 600; line-height: 1.35; }
a { color: inherit; }
button { font: inherit; color: inherit; }
a, button, summary, [data-open] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.sub { color: var(--text-3); font-size: 14px; margin-top: 4px; }
.meta { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.muted { color: var(--text-3); }
.mt { margin-top: 20px; }
.mt-lg { margin-top: 16px; }
.empty-note { color: var(--text-3); font-size: 13px; padding: 12px 0; }

.skip { position: fixed; left: 16px; top: 12px; z-index: 100; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--r-ctl); font-weight: 600; text-decoration: none; transform: translateY(-160%); }
.skip:focus-visible { transform: none; }

/* ======================================================================= header */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 32px; height: var(--header-h); display: flex; align-items: center; gap: 32px; }
/* SwimRank | Lane Line: which app. Same control as .seg, in the brand's place. */
.app-switch { display: inline-flex; flex: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.app-switch a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--text-2); text-decoration: none; white-space: nowrap; transition: transform .12s var(--ease); }
.app-switch a:hover { color: var(--text); background: var(--hover); }
.app-switch a:active { transform: scale(.96); }
.app-switch a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 0 0 1px var(--border); }
.app-switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tabs { display: flex; gap: 4px; height: 100%; flex: 1; min-width: 0; }
.tabs a { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 12px; text-decoration: none; color: var(--text-2); font-weight: 500; font-size: 14px; white-space: nowrap; border-radius: 0; }
.tabs a svg { display: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); transform: scaleX(0); transition: transform .2s var(--ease); }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); font-weight: 600; }
.tabs a.on::after { transform: scaleX(1); }
.tabs a:focus-visible { outline-offset: -4px; border-radius: var(--r-ctl); }

.actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sync { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-right: 4px; white-space: nowrap; }
.sync[data-state]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.sync[data-state="live"]::before { background: var(--good); }
.sync[data-state="loading"]::before { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.sync[data-state="error"]::before { background: var(--critical); }
.sync[data-state="demo"]::before { background: var(--warning); }

/* ======================================================================= controls */
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-ctl); cursor: pointer; color: var(--text-2); padding: 0; transition: transform .12s var(--ease); }
.icon-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { opacity: .35; cursor: default; transform: none; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin .9s linear infinite; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--text-2); transition: transform .12s var(--ease); }
.seg button:hover { color: var(--text); background: var(--hover); }
.seg button:active { transform: scale(.96); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 0 0 1px var(--border); font-weight: 600; }
:root[data-theme="dark"] .seg button.on { background: #2a2f36; box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: #2a2f36; box-shadow: none; } }
.seg-sm button { padding: 4px 10px; font-size: 12.5px; }

.link-btn { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.link-btn:hover { text-decoration-color: currentColor; }
.more-btn { margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-ctl); padding: 7px 14px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; transition: transform .12s var(--ease); }
.more-btn:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
.more-btn:active { transform: scale(.97); }

/* info "i" with a larger invisible hit area */
.info { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid var(--border-strong); background: none; color: var(--text-3); font-size: 10px; font-weight: 700; font-style: normal; line-height: 1; cursor: help; vertical-align: 1px; margin-left: 6px; }
.info::after { content: ""; position: absolute; inset: -8px; }
.info:hover, .info:focus-visible { color: var(--text); border-color: var(--text-3); }
.tip { position: fixed; z-index: 80; max-width: 300px; background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.5; padding: 8px 12px; border-radius: var(--r-ctl); box-shadow: var(--shadow-lg); pointer-events: none; }

.banner { max-width: 1280px; margin: 20px auto 0; padding: 0 32px; }
.banner > div { padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-2); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.banner b { color: var(--text); }
.banner code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); font-size: 12px; }

/* ======================================================================= layout */
main { max-width: 1280px; margin: 0 auto; padding: 32px 32px 56px; outline: none; }
.view:not([hidden]) { animation: viewIn .22s var(--ease); }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 40px 0 14px; }
.section-head:first-child { margin-top: 0; }
.section-title { font-size: 16px; font-weight: 600; margin: 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.grid-3-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }

/* ======================================================================= card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 14px; font-weight: 600; letter-spacing: 0; }
.card.is-link { cursor: pointer; transition: transform .16s var(--ease); }
.card.is-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.card.is-link:active { transform: translateY(0); }
.chart { position: relative; width: 100%; }
.h130 { height: 130px; } .h160 { height: 160px; } .h170 { height: 170px; } .h180 { height: 180px; }
.h220 { height: 220px; } .h240 { height: 240px; } .h280 { height: 280px; }

/* status (icon + text, never colour alone) */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.status .dot { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 9px; font-weight: 800; line-height: 1; flex: none; }
.status.good .dot { background: var(--good); }
.status.warning .dot { background: var(--warning); color: #3a2a00; }
.status.serious .dot { background: var(--serious); }
.status.critical .dot { background: var(--critical); }
.status.neutral .dot { background: var(--text-3); }

.tag { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; line-height: 18px; white-space: nowrap; }
.tag.new { color: var(--accent-text); border-color: transparent; background: var(--accent-soft); margin-left: 6px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* ======================================================================= stat bar (KPIs): one container, hairline dividers */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow); }
.kpi { background: var(--surface); padding: 16px 20px; min-width: 0; }
.kpi .lbl { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.kpi .val { font-size: 26px; font-weight: 650; letter-spacing: -.025em; margin-top: 6px; line-height: 1.1; white-space: nowrap; }
.kpi .val small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.kpi .note { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.kpi .note .up, .kpi .note .down { font-weight: 600; color: var(--text-2); }
.kpi .note .up::before { content: "▲ "; font-size: 9px; }
.kpi .note .down::before { content: "▼ "; font-size: 9px; }
.kpis.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 20px 0 16px; box-shadow: none; }
.kpis.compact .kpi { padding: 12px 16px; }
.kpis.compact .kpi .val { font-size: 20px; margin-top: 4px; }
.kpis.compact .kpi .note { font-size: 11.5px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stat { font-size: 24px; font-weight: 650; letter-spacing: -.025em; margin-bottom: 8px; }
.stat small { display: block; font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: 0; margin-top: 2px; }
.grid-4 .stat { font-size: 22px; }
.grid-4 .card { padding: 18px; }

/* ======================================================================= today */
.today-top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.readiness { display: flex; flex-direction: column; gap: 20px; padding: 24px; }
.ready-main { display: flex; gap: 24px; align-items: center; }
.ring-wrap { position: relative; width: 136px; height: 136px; flex: none; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: var(--grid); }
.ring-val { stroke: var(--grid); stroke-linecap: round; transition: stroke-dashoffset .7s var(--ease); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num { font-size: 42px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.ring-lbl { font-size: 11.5px; color: var(--text-3); margin-top: 6px; font-weight: 500; }
.coach h2 { margin: 10px 0 6px; font-size: 20px; letter-spacing: -.02em; }
.coach p { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.tonight { margin-top: 12px !important; font-size: 13px !important; color: var(--text) !important; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tonight span { color: var(--text-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.factors-wrap { border-top: 1px solid var(--border); padding-top: 18px; }
.factors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; }
.factor .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 8px; }
.factor .row span:first-child { color: var(--text); font-weight: 500; }
.factor .row span:last-child { color: var(--text-3); white-space: nowrap; }
.meter { height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; }
.ready-trend { border-top: 1px solid var(--border); padding-top: 16px; margin-top: auto; }
.ready-trend .head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 10px; }
.ready-trend .head span:first-child { font-weight: 600; color: var(--text-2); }
.ready-trend .head span:last-child { color: var(--text-3); }
.mini-cols { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 44px; align-items: end; }
.mini-cols i { display: block; background: var(--s-free); border-radius: 2px 2px 1px 1px; min-height: 2px; opacity: .5; }
.mini-cols i.now { opacity: 1; }
.mini-cols i.none { background: var(--grid); opacity: 1; }

.vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile .lbl { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tile .val { font-size: 28px; font-weight: 650; letter-spacing: -.025em; line-height: 1.1; }
.tile .val small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.tile .foot { font-size: 12px; color: var(--text-3); margin-top: auto; }
.tile .desc { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.spark { height: 26px; width: 100%; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.batt { width: 30px; height: 14px; flex: none; }
.batt .shell { fill: none; stroke: var(--text-3); stroke-width: 1.2; }
.batt .cap { fill: var(--text-3); }

.range-bar { position: relative; height: 18px; margin: 2px 0; }
.range-bar .track { position: absolute; left: 0; right: 0; top: 7px; height: 4px; background: var(--grid); border-radius: 2px; }
.range-bar .band { position: absolute; top: 5px; height: 8px; background: color-mix(in srgb, var(--good) 28%, transparent); border-radius: 4px; }
.range-bar .mark { position: absolute; top: 2px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--text); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.range-bar .tick { position: absolute; top: 3px; width: 2px; height: 12px; margin-left: -1px; background: var(--text-3); border-radius: 1px; }
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack i { display: block; height: 100%; }
.stack.lg { height: 12px; border-radius: 6px; }

.big { font-size: 32px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; }
.big small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.delta { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.delta b { font-weight: 600; color: var(--text); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 104px; align-items: end; margin: 20px 0 8px; }
.days .col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; background: none; border: 0; padding: 0; border-radius: var(--r-sm); }
.days button.col { cursor: pointer; }
.days button.col:hover .bar { filter: brightness(1.12); }
.days .bar { display: block; width: 100%; max-width: 32px; background: var(--s-free); border-radius: 4px 4px 2px 2px; min-height: 2px; transform-origin: bottom; }
.days .bar.empty { background: var(--grid); }
.days .bar.future { background: transparent; border: 1px dashed var(--border-strong); min-height: 6px; animation: none; }
.days .d { font-size: 11.5px; color: var(--text-3); }
.days .d.today { color: var(--text); font-weight: 700; }
.foot-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.foot-row b { color: var(--text); font-weight: 600; }

.swim-name { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.mini-stats .k { font-size: 12px; color: var(--text-3); }
.mini-stats .v { font-size: 19px; font-weight: 600; letter-spacing: -.015em; margin-top: 2px; white-space: nowrap; }
.mini-stats .v small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 2px; }
.callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-ctl); padding: 10px 12px; font-size: 13px; color: var(--text-2); }
.callout b { color: var(--text); font-weight: 600; }
.timeline { display: flex; height: 30px; align-items: flex-end; gap: 1px; margin-bottom: 4px; }
.timeline i { display: block; min-width: 2px; border-radius: 2px; height: 100%; }
.timeline i.rest { height: 5px; background: var(--grid); min-width: 0; border-radius: 1px; }
#latest-tl .timeline { height: 22px; margin: 0 0 14px; }

/* training focus */
.focus-row { margin-bottom: 16px; }
.focus-row .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; gap: 8px; }
.focus-row .row span:first-child { font-weight: 500; }
.focus-row .row span:last-child { color: var(--text-3); white-space: nowrap; }
.focus-track { position: relative; height: 10px; background: var(--grid); border-radius: 5px; }
.focus-track .target { position: absolute; top: -3px; bottom: -3px; border: 1.5px dashed var(--text-3); border-radius: 6px; }
.focus-track .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.focus-status { font-size: 13px; color: var(--text-2); margin-top: 14px; }
.focus-status b { color: var(--text); font-weight: 600; }

/* ======================================================================= legends, bars, zones */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }
.legend i.dash { height: 0; width: 14px; border-top: 2px dashed; border-radius: 0; background: none !important; }
.legend i.band { width: 14px; height: 10px; border-radius: 2px; background: var(--grid); border: 1px solid var(--border); }
.panel-cap { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 12px 0 4px; }
.panel-cap span { font-weight: 400; color: var(--text-3); margin-left: 4px; }

.bars { display: flex; flex-direction: column; gap: 14px; }
.bars.compact { gap: 10px; }
.bar-row .row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 8px; }
.bar-row .row span:first-child { font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.bar-row .row span:last-child { color: var(--text-3); white-space: nowrap; }
.bars.compact .bar-row .row { font-size: 12.5px; margin-bottom: 4px; }
.zone-legend { display: grid; grid-template-columns: auto 1fr auto auto; gap: 7px 12px; font-size: 13px; margin-top: 14px; align-items: center; }
.zone-legend .z { font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.zone-legend .n { color: var(--text-2); }
.zone-legend .t, .zone-legend .p { color: var(--text-3); text-align: right; }

/* ======================================================================= tables */
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
.tbl th, .tbl td { padding: 12px 16px; text-align: right; }
.tbl .left { text-align: left; }
.tbl thead th { font-size: 12px; color: var(--text-3); font-weight: 500; background: var(--surface-2); border-bottom: 1px solid var(--border); padding-top: 10px; padding-bottom: 10px; }
.tbl tbody tr { border-bottom: 1px solid var(--grid); }
.tbl tbody tr:last-child { border-bottom: 0; }
.tbl .name { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tbl .sub2 { color: var(--text-3); font-size: 12px; }
.tbl td.dim { color: var(--text-3); }
.tbl .empty { text-align: center; padding: 32px; color: var(--text-3); }
.tbl tr.week td { background: var(--surface-2); font-size: 12.5px; color: var(--text-2); padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.tbl tr.week td b { color: var(--text); font-weight: 600; }
.tbl tr.set-head td { background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); padding-top: 8px; padding-bottom: 8px; }
.tbl tr.other td { color: var(--text-3); }
.tbl tr.other .name { font-weight: 500; color: var(--text-2); }

/* sortable headers are real buttons */
#sessions thead th { padding: 0; }
.sort { width: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 4px; background: none; border: 0; padding: 10px 16px; font-size: 12px; font-weight: 500; color: inherit; cursor: pointer; white-space: nowrap; border-radius: 0; }
#sessions th.left .sort { justify-content: flex-start; }
.sort:hover, #sessions th[aria-sort="ascending"] .sort, #sessions th[aria-sort="descending"] .sort { color: var(--text); }
.sort::after { content: "↓"; opacity: 0; font-size: 11px; transition: opacity .12s; }
.sort:hover::after { opacity: .4; }
#sessions th[aria-sort="descending"] .sort::after { content: "↓"; opacity: 1; }
#sessions th[aria-sort="ascending"] .sort::after { content: "↑"; opacity: 1; }
.sort:focus-visible { outline-offset: -3px; }
#sessions tbody tr[data-id] { cursor: pointer; }
#sessions tbody tr[data-id]:hover { background: var(--hover); }
.row-link { text-decoration: none; color: inherit; border-radius: var(--r-sm); }
.row-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.best td { vertical-align: top; }
.best th:first-child, .best td:first-child { text-align: left; }
.best td.cell { padding: 4px 8px; }
.cell-btn { width: 100%; display: block; text-align: right; background: none; border: 0; padding: 8px 8px; border-radius: var(--r-ctl); cursor: pointer; transition: transform .12s var(--ease); }
.cell-btn:hover { background: var(--hover); }
.cell-btn:active { transform: scale(.97); }
.best .t { display: block; font-weight: 600; font-size: 14.5px; }
.best .d { display: block; font-size: 11.5px; color: var(--text-3); }

.strokes th, .strokes td { padding: 10px 8px; }
.strokes th:first-child, .strokes td:first-child { padding-left: 0; text-align: left; width: 38%; }
.strokes th:last-child, .strokes td:last-child { padding-right: 0; }
.strokes thead th { background: none; border-bottom: 1px solid var(--border); padding-top: 0; }
.strokes .nm { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 7px; }
.strokes .v { font-weight: 600; }
.strokes .s { font-size: 11.5px; color: var(--text-3); }

/* ======================================================================= calendar */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 32px; align-items: start; }
.cal { display: grid; gap: 4px; align-items: center; }
.cal .mo { font-size: 11.5px; color: var(--text-3); height: 16px; white-space: nowrap; }
.cal .dw { font-size: 11.5px; color: var(--text-3); }
.cal .c { height: 22px; border-radius: 4px; background: var(--grid); border: 0; padding: 0; display: block; width: 100%; }
.cal button.c { cursor: pointer; transition: transform .12s var(--ease); }
.cal button.c:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text-3); }
.cal .c.l1 { background: var(--z1); } .cal .c.l2 { background: var(--z2); } .cal .c.l3 { background: var(--z3); } .cal .c.l4 { background: var(--z5); }
.cal .c.future { background: transparent; border: 1px dashed var(--border); }
.cal .c.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
.cal .c.other { background-image: radial-gradient(circle, var(--text-3) 2px, transparent 2.5px); }
.cal-legend { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); margin-top: 14px; flex-wrap: wrap; }
.cal-legend i { width: 14px; height: 12px; border-radius: 3px; display: inline-block; background: var(--grid); }
.cal-legend .sp { margin-left: 14px; display: inline-flex; align-items: center; gap: 5px; }
.cal-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.cal-stats .k { font-size: 12px; color: var(--text-3); }
.cal-stats .v { font-size: 19px; font-weight: 600; letter-spacing: -.015em; margin-top: 2px; }
.cal-stats .v small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 2px; }

/* ======================================================================= recovery: last night */
.night { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: center; }
.h-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 10px; height: 28px; }
.h-lbl { font-size: 12.5px; color: var(--text-2); }
.h-track { position: relative; height: 100%; border-bottom: 1px solid var(--grid); }
.h-row:first-child .h-track { border-top: 1px solid var(--grid); }
.h-track i { position: absolute; top: 4px; bottom: 4px; border-radius: 3px; min-width: 2px; }
.h-axis { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; margin-top: 8px; }
.h-axis div { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); }
.night-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 16px; }
.night-stats .k { font-size: 12px; color: var(--text-3); }
.night-stats .v { font-size: 19px; font-weight: 600; letter-spacing: -.015em; white-space: nowrap; margin-top: 2px; }
.night-stats .v small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 2px; }

/* ======================================================================= session drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, .44); animation: fade .2s ease; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(820px, 100%); background: var(--bg); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain; padding: 0 28px 40px; animation: slide .24s var(--ease); outline: none; }
.drawer-panel .card { margin-bottom: 16px; }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 0 -28px; padding: 22px 28px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.drawer-panel.scrolled .drawer-head { border-bottom-color: var(--border); }
.drawer-head h2 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.drawer-nav { display: flex; gap: 6px; flex: none; }
.grid-2.tight { gap: 16px; }
.te-row { margin-bottom: 16px; }
.te-row:last-child { margin-bottom: 0; }
.te-row .row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.te-row .row b { font-size: 19px; font-weight: 650; }
.te-row .row span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.te-row .msg { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.sets { display: flex; flex-direction: column; }
.set { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--grid); align-items: center; }
.set:last-child { border-bottom: 0; }
.set .no { font-size: 12px; color: var(--text-3); font-weight: 600; }
.set .what { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set .how { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.set .pace { text-align: right; font-weight: 600; font-size: 14.5px; }
.set .pace small { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.set.main .what::after { content: "Main set"; font-size: 11px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; letter-spacing: .02em; }
.details summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; border-radius: var(--r-ctl); }
.details summary::-webkit-details-marker { display: none; }
.details summary h3::before { content: "▸"; display: inline-block; width: 16px; color: var(--text-3); transition: transform .15s var(--ease); }
.details[open] summary h3::before { transform: rotate(90deg); }
.details[open] summary { margin-bottom: 14px; }
.details .table-scroll { margin: 0 -20px -20px; border-top: 1px solid var(--border); }
#d-laps td.splits { text-align: left; color: var(--text-3); font-size: 12px; }

/* ======================================================================= loading */
.loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--bg); z-index: 40; color: var(--text-2); font-size: 13px; transition: opacity .25s; }
.loading.hide { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s, visibility 0s .25s; }
.lane-loader { position: relative; width: 132px; height: 14px; }
.lane-loader::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 16px); opacity: .45; border-radius: 1px; }
.lane-loader i { position: absolute; top: 2px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: lap 1.5s cubic-bezier(.45, 0, .55, 1) infinite alternate; }
.foot { margin-top: 48px; text-align: center; font-size: 12.5px; color: var(--text-3); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(36px); opacity: 0; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes lap { to { transform: translateX(122px); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes grow { from { transform: scaleY(0); } }

/* ======================================================================= responsive */
@media (max-width: 1100px) {
  .today-top { grid-template-columns: 1fr; }
  .vitals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis:not(.compact) > .kpi:last-child:nth-child(3n + 2) { grid-column: span 2; }
  .kpis:not(.compact) > .kpi:last-child:nth-child(3n + 1) { grid-column: span 3; }
  .grid-3-2 { grid-template-columns: 1fr; }
  .cal-wrap { grid-template-columns: 1fr; gap: 20px; }
  .cal-stats { grid-template-columns: repeat(4, 1fr); }
  .night { grid-template-columns: 1fr; gap: 20px; }
  .night-stats { grid-template-columns: repeat(6, 1fr); }
}

/* narrow windows and phones: compact header, tab bar along the bottom */
@media (max-width: 820px) {
  :root { --header-h: 56px; }
  /* no blur here: backdrop-filter would make the header the containing block of the fixed tab bar */
  .topbar { backdrop-filter: none; background: var(--surface); }
  .topbar-inner { padding: 0 16px; gap: 12px; justify-content: space-between; }
  .tabs { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-top: 1px solid var(--border); }
  .tabs a { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 0; min-height: 50px; font-size: 11.5px; border-radius: var(--r-ctl); }
  .tabs a svg { display: block; }
  .tabs a::after { display: none; }
  .tabs a.on { color: var(--accent-text); background: var(--accent-soft); }
  .sync { display: none; }
  .banner { padding: 0 16px; margin-top: 16px; }
  main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .view-head { margin-bottom: 18px; }
  .section-head { margin-top: 32px; }
  .grid-2, .grid-2-1, .grid-3, .grid-3-2, .grid-4 { grid-template-columns: 1fr; }
  .vitals { grid-template-columns: 1fr 1fr; }
  .kpis, .kpis.compact { grid-template-columns: 1fr 1fr; }
  .kpis:not(.compact) > .kpi:last-child:nth-child(3n + 2), .kpis:not(.compact) > .kpi:last-child:nth-child(3n + 1) { grid-column: auto; }
  .kpis:not(.compact) > .kpi:last-child:nth-child(odd) { grid-column: span 2; }
  .kpis.compact .kpi .note { white-space: normal; }
  .factors { grid-template-columns: 1fr; }
  .ready-main { flex-direction: column; align-items: flex-start; gap: 16px; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .cal-stats { grid-template-columns: 1fr 1fr; }
  .cal .c { height: 16px; }
  .night-stats { grid-template-columns: repeat(3, 1fr); }
  .drawer-panel { padding: 0 16px 32px; }
  .drawer-head { margin: 0 -16px; padding: 16px 16px 12px; flex-wrap: wrap-reverse; }
  .drawer-nav { margin-left: auto; }
}
@media (max-width: 420px) {
  .vitals, .kpis { grid-template-columns: 1fr; }
  .kpis:not(.compact) > .kpi:last-child:nth-child(odd) { grid-column: auto; }
}

/* touch: 44px targets */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .seg button { min-height: 40px; padding-left: 14px; padding-right: 14px; }
  .info { width: 22px; height: 22px; font-size: 11px; }
  .sort { min-height: 44px; }
  .cell-btn { min-height: 44px; }
}

/* ======================================================================= v7: interaction + polish */
[hidden] { display: none !important; }
body { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--bg)) 0, var(--bg) 420px) no-repeat, var(--bg); }

/* card headings carry a small tinted icon in the metric's own colour */
.card-head { align-items: center; }
.card-head h2, .card-head h3 { display: flex; align-items: center; min-width: 0; }
.ico { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; margin-right: 10px; border-radius: 7px; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
.ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card:has(canvas):hover { border-color: var(--border-strong); }

/* status reads as a tinted chip */
.status { padding: 2px 10px 2px 3px; border-radius: 999px; color: var(--text); background: color-mix(in srgb, var(--st, var(--text-3)) 14%, transparent); }
.status.good { --st: var(--good); }
.status.warning { --st: var(--warning); }
.status.serious { --st: var(--serious); }
.status.critical { --st: var(--critical); }

/* a faint tint behind headline numbers */
.tile { --tone: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 6%, var(--surface)) 0, var(--surface) 64px); }
.kpi { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 3.5%, var(--surface)) 0, var(--surface) 60px); }

/* Today: vitals expand into a 30-day chart */
.tile.is-exp { cursor: pointer; transition: transform .16s var(--ease); }
.tile.is-exp:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.tile.is-exp:active { transform: translateY(0); }
.tile.open { grid-column: 1 / -1; cursor: default; }
.vitals { grid-auto-flow: dense; }
.tile .status { align-self: flex-start; }
.tile.open:hover { transform: none; }
.lbl-t { display: inline-flex; align-items: center; min-width: 0; }
.tile .ico { width: 24px; height: 24px; margin-right: 8px; }
.tile .ico svg { width: 14px; height: 14px; }
.lbl-r { display: inline-flex; align-items: center; gap: 8px; }
.exp-btn { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--surface); color: var(--text-3); cursor: pointer; }
.exp-btn:hover { color: var(--text); border-color: var(--border-strong); }
.exp-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.tile.open .exp-btn svg { transform: rotate(180deg); }
.tile-chart { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); animation: reveal .3s var(--ease); }

/* filter chips */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -8px 0 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 600; cursor: pointer; animation: chipIn .2s var(--ease); transition: transform .12s var(--ease); }
.chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; opacity: .7; }
.chip:hover svg { opacity: 1; }
.chip:active { transform: scale(.96); }
.chip-clear { background: none; border: 0; padding: 5px 6px; font-size: 12.5px; font-weight: 500; color: var(--text-3); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: transparent; border-radius: var(--r-sm); }
.chip-clear:hover { color: var(--text); text-decoration-color: currentColor; }

/* things you can click to filter */
.dim { opacity: .38; }
.lg-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 3px 8px; margin: -3px -2px; border-radius: 999px; font-size: 12.5px; color: var(--text-2); cursor: pointer; transition: opacity .2s; }
.lg-btn:hover { background: var(--hover); color: var(--text); }
.lg-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.lg-btn i { width: 10px; height: 10px; border-radius: 3px; }
.row-btn, .bar-btn, .zone-row { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; border-radius: var(--r-ctl); transition: opacity .2s; }
.bar-btn { padding: 5px 6px; margin: -5px -6px; width: calc(100% + 12px); }
.bar-btn:hover, .zone-row:hover { background: var(--hover); }
.bar-btn[aria-pressed="true"], .zone-row[aria-pressed="true"] { background: var(--accent-soft); }
.bar-row { display: block; }
.meter { display: block; }
.row-btn .nm { margin-bottom: 7px; }
.row-btn:hover .nm { text-decoration: underline; text-underline-offset: 3px; }
.strokes tr, .best tr { transition: opacity .2s; }
.strokes tr.on .nm { font-weight: 650; }
.zone-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.zone-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 44px; gap: 10px; align-items: center; padding: 5px 6px; margin: 0 -6px; width: calc(100% + 12px); font-size: 13px; }
.zone-row .z { font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.zone-row .n { color: var(--text-2); }
.zone-row .t, .zone-row .p { color: var(--text-3); text-align: right; }
.tag-btn { cursor: pointer; font-family: inherit; }
.tag-btn:hover { border-color: var(--border-strong); color: var(--text); }
.tag-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.cal .c.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* workout view: sets are buttons; a selected set dims the rest */
.set { width: calc(100% + 16px); margin: 0 -8px; padding: 11px 8px; background: none; border: 0; border-bottom: 1px solid var(--grid); border-radius: var(--r-ctl); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: opacity .2s; }
.set:hover { background: var(--hover); }
.set.on { background: var(--accent-soft); }
.sets.has-sel .set:not(.on) { opacity: .5; }
.set .set-body { min-width: 0; }
.set .how { display: block; }
#d-laps tr.dim td { opacity: .4; }
#d-graph-card canvas { cursor: crosshair; }

/* motion: entrances replay when a tab opens; "now" markers breathe */
.now-dot { position: absolute; left: 0; top: 0; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; z-index: 1; }
.now-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--c); animation: ripple 2.6s ease-out infinite; }
.mini-cols i { transform-origin: bottom; }
.mini-cols.fresh i, .days.fresh .bar { animation: grow .55s var(--ease) backwards; }
.mini-cols i.now, .days .bar.is-today { animation: breathe 2.8s ease-in-out infinite; }
.mini-cols.fresh i.now, .days.fresh .bar.is-today { animation: grow .55s var(--ease) backwards, breathe 2.8s ease-in-out .8s infinite; }
.fresh .spark path { stroke-dasharray: 1; animation: drawLine 1s var(--ease) backwards; }
.hypno.fresh .h-track i { transform-origin: left; animation: growX .5s var(--ease) backwards; }
.sync[data-state="live"]::before { animation: breathe 3.2s ease-in-out infinite; }

@keyframes breathe { 50% { opacity: .5; } }
@keyframes ripple { from { transform: scale(1); opacity: .45; } to { transform: scale(2.8); opacity: 0; } }
@keyframes drawLine { from { stroke-dashoffset: 1; } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes chipIn { from { opacity: 0; transform: scale(.94); } }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }

@media (pointer: coarse) {
  .exp-btn { width: 40px; height: 40px; }
  .chip, .chip-clear { min-height: 40px; }
  .lg-btn { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .card.is-link:hover { transform: none; }
}

/* ======================================================================= sign-in */
/* Signed out there's nothing for the tabs, units or sync to act on. */
.signed-out .tabs, .signed-out #unit-seg, .signed-out #refresh, .signed-out .sync { display: none !important; }
.signin { max-width: 440px; margin: 48px auto; padding: 0 16px; }
.signin-card { display: flex; flex-direction: column; gap: 8px; padding: 28px; }
.signin-card h1 { font-size: 22px; margin: 0; text-wrap: balance; }
.signin-card .sub { margin: 0 0 12px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.signin-card label { font-size: 13px; font-weight: 500; color: var(--text-2); margin-top: 4px; }
.signin-card input { font: inherit; font-size: 16px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--text); }
.signin-card input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.signin-error { margin: 4px 0 0; color: var(--critical); font-size: 13.5px; }
.signin-btn { margin-top: 12px; min-height: 44px; border: 0; border-radius: var(--r-ctl); background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; transition: transform .12s var(--ease), filter .12s var(--ease); }
.signin-btn:hover { filter: brightness(1.06); }
.signin-btn:active { transform: scale(.98); }
.signin-btn:disabled { opacity: .6; cursor: progress; }
.signin-foot { margin: 12px 0 0 !important; font-size: 13px !important; }
@media (max-width: 420px) {
  .app-switch a { padding: 0 9px; font-size: 13px; }
  .signin { margin-top: 24px; }
  .signin-card { padding: 20px; }
}
