/* OutPace — design system
   Night session: dark surfaces lit from above, volt reserved for you / now / the goal,
   and the race clock (Digital-7 segments over unlit 8s) for the times that matter. */

/* Digital-7 Italic (Style-7) — race-clock readouts */
@font-face {
  font-family: "Digital-7";
  src: url("fonts/digital-7-italic.woff2") format("woff2");
  font-style: italic; font-weight: 400; font-display: block;
}

/* Figtree (variable, 400..700) and Montserrat italic 800 — self-hosted latin subsets */
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-style: normal; font-weight: 400 700; font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-wght-italic.woff2") format("woff2");
  font-style: italic; font-weight: 400 700; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-latin-800-italic.woff2") format("woff2");
  font-style: italic; font-weight: 800; font-display: swap;
}

:root {
  color-scheme: dark;
  interpolate-size: allow-keywords;

  --bg: #07080b;
  --surface: #0e1014;
  --surface-2: #14171d;
  --surface-3: #1c2028;
  --line: #1c2027;
  --line-2: #2a2f39;
  --text: #f2f4f7;
  --text-2: #a4aab6;
  --muted: #6c7380;

  --accent: #d2ff00;
  --accent-hover: #e0ff4d;
  --accent-ink: #0b0c00;
  --accent-wash: rgba(210, 255, 0, 0.09);
  --accent-line: rgba(210, 255, 0, 0.32);
  --accent-glow: 0 0 16px rgba(210, 255, 0, 0.45);

  --blue: #4d8dff;
  --gray-mark: #4e5562;
  --gray-mark-2: #2e343e;

  /* heart-rate zones, the colours Garmin uses; lime stays for today, the main action and your numbers */
  --z1: #9aa1ad; --z2: #3d9bff; --z3: #38c760; --z4: #ffa31a; --z5: #f0483e;

  /* status: always paired with an icon + label */
  --good: #22c55e;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  /* type scale: one family (plus the race clock), six sizes, four weights */
  --fs-xs: 12px; --fs-sm: 14px; --fs-base: 16px; --fs-lg: 20px; --fs-xl: 28px; --fs-2xl: 40px;
  --fs-display: clamp(28px, 4vw, 40px); --fs-hero: clamp(40px, 6vw, 64px);

  --r-lg: 22px;
  --r: 16px;
  --r-sm: 12px;
  --r-xs: 8px;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-clock: "Digital-7", var(--font);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.3, 0.5, 1);
  --topbar: 64px;
  --tabbar: 64px;
  --lift: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 24px 48px -28px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; }
/* no background on html: body's propagates to the canvas, so the track layer at z-index -1 shows above it */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 400 var(--fs-base)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  /* stadium light spilling over the top of the page */
  background:
    radial-gradient(1000px 520px at 88% -160px, rgba(210, 255, 0, 0.075), transparent 62%),
    radial-gradient(800px 420px at -10% -120px, rgba(77, 141, 255, 0.06), transparent 65%),
    var(--bg);
  background-repeat: no-repeat;
}
/* the bend of a running track, drawn faintly behind the top of every page. Lane radii and
   the centre (80px right of the viewport, 40px above it) match TRACK_LANES in app/ui.py. */
.track {
  position: absolute; z-index: -1; top: 0; right: 0; width: min(1100px, 100%); height: 620px;
  overflow: hidden; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1100 620' fill='none' stroke='%23fff'%3E%3Cg stroke-opacity='.045'%3E%3Ccircle cx='1180' cy='-40' r='420'/%3E%3Ccircle cx='1180' cy='-40' r='458'/%3E%3Ccircle cx='1180' cy='-40' r='496'/%3E%3Ccircle cx='1180' cy='-40' r='534'/%3E%3Ccircle cx='1180' cy='-40' r='572'/%3E%3Ccircle cx='1180' cy='-40' r='610'/%3E%3Ccircle cx='1180' cy='-40' r='648'/%3E%3Ccircle cx='1180' cy='-40' r='686'/%3E%3C/g%3E%3Ccircle cx='1180' cy='-40' r='420' stroke='%23d2ff00' stroke-opacity='.12'/%3E%3C/svg%3E") no-repeat top right / 1100px 620px;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.track-hub { position: absolute; top: -40px; right: -80px; width: 0; height: 0; }
/* long-exposure runners: each orbit spins a short blurred trail about the track's centre,
   anticlockwise like a race. Transform-only, so it runs on the compositor. */
.orbit {
  position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform;
  animation: lap var(--lap) linear infinite;
  animation-delay: calc(var(--clock, 0) * -1s - var(--lap) * var(--phase));
}
@keyframes lap { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
.streak { position: absolute; overflow: visible; }
.streak--white { color: #c1c1c1; opacity: 0.25; }
.streak--volt { color: var(--accent); opacity: 0.9; }
/* film grain: keeps big dark surfaces from looking flat */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--text-2); }
.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── race clock ─────────────────────────────────────────────────────────── */
.lcd {
  position: relative; isolation: isolate; display: inline-block;
  font-family: var(--font-clock); font-style: italic; font-weight: 400; line-height: 0.92;
  letter-spacing: 0.01em; color: var(--accent); white-space: nowrap;
  text-shadow: 0 0 2px rgba(210, 255, 0, 0.55), 0 0 22px rgba(210, 255, 0, 0.38);
}
.lcd-d { position: relative; display: inline-block; width: 0.473em; text-align: right; }
.lcd-d::before {
  content: "8"; position: absolute; z-index: -1; right: 0; top: 0;
  color: rgba(210, 255, 0, 0.035); text-shadow: none; pointer-events: none;
}
.lcd.is-settled { animation: lcd-flash 0.7s var(--ease); }
@keyframes lcd-flash {
  0% { text-shadow: 0 0 2px rgba(210, 255, 0, 0.8), 0 0 42px rgba(210, 255, 0, 0.8); }
  100% { text-shadow: 0 0 2px rgba(210, 255, 0, 0.55), 0 0 22px rgba(210, 255, 0, 0.38); }
}

/* ── shell ──────────────────────────────────────────────────────────────── */
.topbar {
  /* fixed, not sticky: pinned to the very top of the screen (under the Dynamic Island / status bar),
     so the page can never peek out above it. main clears it with a margin. */
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  /* status bar is translucent in the installed app: keep the bar clear of the notch */
  padding-top: env(safe-area-inset-top);
  height: calc(var(--topbar) + env(safe-area-inset-top));
  box-sizing: border-box;
  background: rgba(7, 8, 11, 0.72);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  view-transition-name: topbar;
}
/* extends the bar's fill above the screen edge, so nothing shows through behind the Dynamic Island
   or in an overscroll bounce, even if the safe-area inset comes back as 0 */
.topbar::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 240px; background: inherit; pointer-events: none; }
.topbar-inner {
  max-width: 1160px; height: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-name { font-family: "Montserrat", var(--font); font-style: italic; font-weight: 800; letter-spacing: -0.03em; font-size: 18px; }
.brand-mark { height: 22px; width: auto; display: block; filter: drop-shadow(0 0 14px rgba(190, 251, 52, 0.35)); }

.nav {
  display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.06);
}
.nav a {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: var(--fs-sm);
  transition: color 0.2s var(--ease);
}
.nav a > :not(.nav-pill) { position: relative; z-index: 1; }
.nav a svg { width: 16px; height: 16px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] svg { color: var(--accent); filter: drop-shadow(0 0 6px rgba(210, 255, 0, 0.6)); }
.nav-pill {
  position: absolute; inset: 0; border-radius: inherit; view-transition-name: nav-pill;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.4);
}
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  color: var(--text-2); background: transparent; border: 1px solid transparent; cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.06); }
.icon-btn[aria-current="page"] { color: var(--accent); background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.08); }
.icon-btn svg { width: 18px; height: 18px; transition: transform 0.5s var(--ease); }
.topbar-end .icon-btn:hover svg { transform: rotate(60deg); }

main { max-width: 1160px; margin: calc(var(--topbar) + env(safe-area-inset-top)) auto 0; padding: 40px 24px 96px; }

/* page transitions (cross-document view transitions; ignored where unsupported) */
::view-transition-group(nav-pill) { animation-duration: 0.42s; animation-timing-function: cubic-bezier(0.3, 0.9, 0.25, 1); }
::view-transition-old(root) { animation: vt-out 0.14s ease-in both; }
::view-transition-new(root) { animation: vt-in 0.32s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 760px) {
  /* a backdrop-filter or view-transition-name here would trap the fixed tab bar */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: #07080b; view-transition-name: none; }
  .topbar::before { background: #07080b; } /* solid: nothing may show through above the bar */
  .topbar-inner { padding: 0 16px; }
  .nav {
    position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    height: var(--tabbar); padding: 6px; border-radius: 24px;
    background: rgba(20, 23, 29, 0.78);
    backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 16px 40px rgba(0, 0, 0, 0.6);
    justify-content: space-around; gap: 0; view-transition-name: tabbar;
  }
  .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 3px; font-size: var(--fs-xs); padding: 6px 4px; border-radius: 18px; }
  .nav a svg { width: 21px; height: 21px; }
  .nav a[aria-current="page"] { color: var(--accent); }
  main { padding: 24px 16px calc(var(--tabbar) + 48px); }
}

/* ── page header ────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.eyebrow svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
h1 {
  font-size: var(--fs-display); line-height: 1.02; font-weight: 700;
  letter-spacing: -0.03em; margin: 0; text-wrap: balance;
}
.eyebrow + h1 { margin-top: 10px; }
h2 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.015em; margin: 0; }
h3 { font-size: var(--fs-sm); font-weight: 600; margin: 0; color: var(--text-2); }
.sub { color: var(--text-2); margin: 8px 0 0; }

/* ── layout ─────────────────────────────────────────────────────────────── */
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.today-layout {
  display: grid; gap: 16px;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas: "session goal" "week week" "insights digest";
}
.today-layout.no-digest { grid-template-areas: "session goal" "week week" "insights insights"; }
.area-session { grid-area: session; } .area-goal { grid-area: goal; } .area-week { grid-area: week; }
.area-insights { grid-area: insights; } .area-digest { grid-area: digest; }
.today-layout > * { min-width: 0; }
@media (max-width: 860px) {
  .today-layout, .today-layout.no-digest {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "session" "goal" "week" "insights" "digest";
  }
}
.week-card { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 36px; align-items: stretch; }
.week-summary { display: flex; flex-direction: column; gap: 18px; }
.week-summary .card-head { margin-bottom: 0 !important; }
.week-progress { margin-top: auto; }
.week-summary .figure { display: flex; align-items: baseline; gap: 8px; }
.week-summary .figure small { margin: 0; }
.week-summary .figure .planned { color: var(--text-2); font-weight: 600; }
html.scroll-locked, html.scroll-locked body { overflow: hidden; overscroll-behavior: none; }
@media (max-width: 860px) { .week-card { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.grid-2 > *, .grid-3 > *, .grid-4 > *, .today-grid > * { min-width: 0; }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .today-grid, .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 48px 0 16px; }
.section-title h2 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.03em; }
.section-title:first-child { margin-top: 0; }

/* ── cards ──────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 140px), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--lift);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card--hero {
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(210, 255, 0, 0.1), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 160px),
    var(--surface);
  border-color: rgba(210, 255, 0, 0.16);
  box-shadow: inset 0 1px 0 rgba(210, 255, 0, 0.12), 0 30px 60px -30px rgba(0, 0, 0, 0.9), 0 0 80px -40px rgba(210, 255, 0, 0.25);
}
.card--flush { padding: 0; }
.card--quiet { background: transparent; border-style: dashed; border-color: var(--line-2); box-shadow: none; }
@media (max-width: 560px) { .card { padding: 18px; border-radius: 20px; } }

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  background: linear-gradient(180deg, #e3ff5a, var(--accent) 55%);
  color: var(--accent-ink); font-weight: 600; font-size: var(--fs-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 0 0 1px rgba(210, 255, 0, 0.35), 0 8px 24px -10px rgba(210, 255, 0, 0.7);
  cursor: pointer; white-space: nowrap;
  transition: box-shadow 0.25s var(--ease), transform 0.15s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(210, 255, 0, 0.55), 0 10px 32px -8px rgba(210, 255, 0, 0.85); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; transition: transform 0.25s var(--spring); }
.btn:hover svg:last-child:not(:first-child), .arrow-link:hover svg { transform: translateX(3px); }
.btn--ghost {
  background: rgba(255, 255, 255, 0.045); color: var(--text); border-color: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn--ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.btn--text { background: transparent; color: var(--text-2); padding: 0 10px; box-shadow: none; }
.btn--text:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); box-shadow: none; }
.btn--sm { height: 32px; padding: 0 13px; font-size: var(--fs-sm); }
.btn--lg { height: 50px; padding: 0 26px; font-size: var(--fs-base); }
.btn--danger { background: transparent; color: var(--serious); border-color: rgba(236, 131, 90, 0.35); box-shadow: none; }
.btn--danger:hover { background: rgba(236, 131, 90, 0.1); box-shadow: none; }
.btn[disabled], .htmx-request .btn[type="submit"] { opacity: 0.55; pointer-events: none; }
/* Sync buttons stay lit while syncing: the icon spins and the label changes (macro sync_button) */
.btn--sync .sync-busy { display: none; }
.htmx-request .btn--sync[type="submit"], .btn--sync[disabled] { opacity: 1; cursor: progress; }
.htmx-request .btn--ghost.btn--sync { border-color: var(--accent-line); color: var(--accent); }
.htmx-request .btn--sync .sync-idle { display: none; }
.htmx-request .btn--sync .sync-busy { display: inline; }
.htmx-request .btn--sync .sync-icon { animation: spin 0.8s linear infinite; }
.link { color: var(--text); border-bottom: 1px solid var(--line-2); transition: border-color 0.2s; }
.link:hover { border-color: var(--accent); }
.arrow-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; font-size: var(--fs-sm); transition: color 0.2s; }
.arrow-link:hover { color: var(--accent); }
.arrow-link svg { width: 15px; height: 15px; transition: transform 0.25s var(--spring); }

/* ── chips & status ─────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: rgba(255, 255, 255, 0.05); color: var(--text-2); border: 1px solid rgba(255, 255, 255, 0.06);
}
.chip svg { width: 13px; height: 13px; }
.chip--accent { background: var(--accent-wash); color: var(--accent); border-color: rgba(210, 255, 0, 0.18); }
.chip--outline { background: transparent; border: 1px solid var(--accent-line); color: var(--accent); }
.chip--quiet { background: transparent; border: 1px solid var(--line-2); color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.lvl-good .status-dot, .status-dot.lvl-good { background: var(--good); box-shadow: 0 0 10px rgba(34, 197, 94, 0.6); }
.lvl-warning .status-dot, .status-dot.lvl-warning { background: var(--warning); box-shadow: 0 0 10px rgba(250, 178, 25, 0.55); }
.lvl-serious .status-dot, .status-dot.lvl-serious { background: var(--serious); box-shadow: 0 0 10px rgba(236, 131, 90, 0.6); }
.lvl-info .status-dot, .status-dot.lvl-info { background: var(--blue); box-shadow: 0 0 10px rgba(77, 141, 255, 0.55); }
.status-icon { width: 20px; height: 20px; flex: none; }
.lvl-good .status-icon { color: var(--good); }
.lvl-warning .status-icon { color: var(--warning); }
.lvl-serious .status-icon { color: var(--serious); }
.lvl-info .status-icon { color: var(--blue); }

/* readiness: the verdict plus one bar per signal, worst first */
.ready {
  display: inline-flex; align-items: center; gap: 9px; height: 32px; padding: 0 12px 0 11px; border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 600; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08);
}
.ready.lvl-good { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.22); }
.ready.lvl-warning { background: rgba(250, 178, 25, 0.08); border-color: rgba(250, 178, 25, 0.22); }
.ready.lvl-serious { background: rgba(236, 131, 90, 0.09); border-color: rgba(236, 131, 90, 0.26); }
.pips { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; margin-left: 2px; }
.pips i { width: 3px; height: 13px; border-radius: 2px; background: var(--gray-mark); }
.pips i.lvl-good { background: var(--good); }
.pips i.lvl-warning { background: var(--warning); }
.pips i.lvl-serious { background: var(--serious); }
.pips i.lvl-info { background: var(--blue); }

/* session kind chips encode intensity with a 5-step bar, not a hue per kind */
.kind { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.kind-bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.kind-bars i { width: 3px; border-radius: 1px; background: var(--gray-mark-2); }
.kind-bars i:nth-child(1) { height: 4px; } .kind-bars i:nth-child(2) { height: 6px; }
.kind-bars i:nth-child(3) { height: 8px; } .kind-bars i:nth-child(4) { height: 10px; }
.kind-bars i:nth-child(5) { height: 12px; }
.kind-bars i.on { background: var(--text-2); }
.kind--quality { color: var(--accent); }
.kind--quality .kind-bars i.on { background: var(--accent); box-shadow: 0 0 6px rgba(210, 255, 0, 0.5); }

/* ── figures ────────────────────────────────────────────────────────────── */
.hero-figure, .figure, .kpi-value { font-variant-numeric: tabular-nums; }
.hero-figure { font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.hero-figure small { font-size: var(--fs-lg); font-weight: 500; color: var(--text-2); letter-spacing: -0.01em; margin-left: 6px; }
@media (max-width: 560px) { .hero-figure { font-size: 44px; } }
.figure { font-size: var(--fs-xl); line-height: 1.05; font-weight: 700; letter-spacing: -0.025em; }
.figure small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.stat-label { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.stat-note { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpis > div { min-width: 0; }
.kpi-value { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.025em; margin-top: 3px; }
.kpi-value small { font-size: var(--fs-xs); color: var(--text-2); font-weight: 500; margin-left: 2px; }

.tile { display: grid; gap: 6px; align-content: start; }
/* full-bleed along the bottom edge, clipped to the card's corners */
.tile .spark { margin: 10px -24px -24px; width: calc(100% + 48px); clip-path: inset(-14px 0 0 0 round 0 0 21px 21px); }
@media (max-width: 560px) { .tile .spark { margin: 10px -18px -18px; width: calc(100% + 36px); clip-path: inset(-14px 0 0 0 round 0 0 19px 19px); } }
.delta { font-size: var(--fs-xs); font-weight: 600; }
.delta--good { color: #4ade80; }
.delta--bad { color: var(--serious); }
.delta--flat { color: var(--muted); }

/* meter: fill carries the state, track is a quieter step of the same hue */
.meter { position: relative; height: 8px; border-radius: 999px; background: rgba(210, 255, 0, 0.1); }
.meter > span {
  position: absolute; inset: 0 auto 0 0; border-radius: 999px;
  background: linear-gradient(90deg, rgba(210, 255, 0, 0.55), var(--accent));
  box-shadow: 0 0 14px rgba(210, 255, 0, 0.45);
  animation: meter-reveal 1.1s var(--ease) 0.15s both;
}
.meter > span::after {
  content: ""; position: absolute; right: -1px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  background: #f4ffc2; box-shadow: 0 0 0 3px rgba(210, 255, 0, 0.25), 0 0 12px rgba(210, 255, 0, 0.9);
}
.meter > span[style*="width:0"]::after, .meter > span[style*="width: 0"]::after { display: none; }
@keyframes meter-in { from { transform: scaleX(0); } }
/* a clip sweep rather than scaleX, so the glowing head never stretches */
@keyframes meter-reveal { from { clip-path: inset(-12px 100% -12px -12px); } to { clip-path: inset(-12px -12px -12px -12px); } }
.meter-scale { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); margin-top: 10px; }

/* ── today ──────────────────────────────────────────────────────────────── */
.session-hero .title {
  font-size: var(--fs-display); line-height: 1.05; font-weight: 700;
  letter-spacing: -0.03em; margin: 14px 0 4px; text-wrap: balance;
}
.session-hero .details { color: var(--text-2); margin: 12px 0 0; max-width: 60ch; }
.session-metrics { display: flex; gap: 32px; margin-top: 24px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.session-metrics .figure { font-size: var(--fs-xl); margin-top: 2px; }
@media (max-width: 560px) { .session-metrics { gap: 16px 24px; } .session-metrics .figure { font-size: var(--fs-xl); } }
.session-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; align-items: center; }
.done-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 20px; padding: 12px 14px;
  border-radius: var(--r-sm); background: var(--accent-wash); border: 1px solid rgba(210, 255, 0, 0.2);
  color: var(--accent); font-weight: 600; font-size: var(--fs-sm);
}
.done-banner svg { width: 18px; height: 18px; }
.done-badge {
  display: inline-flex; align-items: center; gap: 7px; margin-left: auto; align-self: flex-end; padding: 6px 12px;
  border-radius: 999px; background: var(--accent-wash); border: 1px solid rgba(210, 255, 0, 0.2);
  color: var(--accent); font-weight: 600; font-size: var(--fs-sm);
}
.done-badge svg { width: 15px; height: 15px; }

.readiness-title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.015em; }
.readiness-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.reason-list { display: grid; gap: 0; margin-top: 12px; }
.reason { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.reason .status-dot { width: 8px; height: 8px; transform: translateY(-1px); }
.reason-detail { grid-column: 2 / -1; font-size: var(--fs-sm); color: var(--muted); margin-top: -4px; }

/* the goal, as a race clock */
.scoreboard .lcd { font-size: clamp(58px, 4vw + 27px, 80px); margin: 4px 0 2px; }
.scoreboard { display: flex; flex-direction: column; }
.pred-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 16px; }
.pred-foot .pred-note { margin: 0 !important; padding: 0 !important; line-height: 1; white-space: nowrap; align-self: center; display: inline-flex; align-items: center; gap: 6px; }
.pred-foot .pred-note svg { width: 14px; height: 14px; flex: none; }
.pred-row { padding: 4px 0 0; }
.scoreboard .pred-row:not([hidden]) { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0; }
.scoreboard .pred-row .lcd { margin: 0; }
.pred-row .clock-row { align-items: center; justify-content: space-between; gap: 16px; flex-wrap: nowrap; }
.pred-change { font-size: var(--fs-base); font-weight: 600; text-align: right; max-width: 12ch; line-height: 1.3; font-variant-numeric: tabular-nums; color: var(--text); }
.pred-goal { margin: 8px 0 0; font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.pred-note { margin: auto 0 0; padding-top: 16px; text-align: right; font-size: var(--fs-sm); color: var(--muted); }
.clock-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.clock-side { display: grid; justify-items: end; gap: 4px; padding-bottom: 8px; font-size: var(--fs-sm); color: var(--muted); }
.clock-side b { font-size: var(--fs-lg); font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
@media (max-width: 400px) { .clock-side { justify-items: start; } }

/* this week: one column per day, planned km as the ghost, run km filled */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wday {
  display: grid; justify-items: center; align-content: start; gap: 8px; padding: 10px 0 10px; border-radius: 14px;
  font-size: var(--fs-xs); color: var(--muted); font-weight: 600; transition: background 0.2s;
}
a.wday:hover { background: rgba(255, 255, 255, 0.035); }
.wday-letter { font-size: var(--fs-xs); }
.wday.is-today .wday-letter { color: var(--accent); }
.wday-col { position: relative; width: 14px; height: 76px; border-radius: 7px; background: rgba(255, 255, 255, 0.035); }
.wday-col > span { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 7px; transform-origin: bottom; animation: col-in 0.8s var(--ease) both; }
.wday:nth-child(2) .wday-col > span { animation-delay: 40ms; } .wday:nth-child(3) .wday-col > span { animation-delay: 80ms; }
.wday:nth-child(4) .wday-col > span { animation-delay: 120ms; } .wday:nth-child(5) .wday-col > span { animation-delay: 160ms; }
.wday:nth-child(6) .wday-col > span { animation-delay: 200ms; } .wday:nth-child(7) .wday-col > span { animation-delay: 240ms; }
@keyframes col-in { from { transform: scaleY(0); } }
.wday-plan { background: rgba(255, 255, 255, 0.1); }
.wday-done { background: linear-gradient(180deg, var(--accent), rgba(210, 255, 0, 0.6)); box-shadow: 0 0 14px rgba(210, 255, 0, 0.45); }
.wday-col > .wday-gym { height: 14px; background: rgba(255, 255, 255, 0.14); border-radius: 5px; }
.wday-col > .wday-rest { height: 4px; left: 3px; right: 3px; background: rgba(255, 255, 255, 0.1); }
.wday--done .wday-gym { background: var(--accent); box-shadow: 0 0 12px rgba(210, 255, 0, 0.45); }
.wday--extra .wday-done { background: var(--text-2); box-shadow: none; }
.wday--missed .wday-plan { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(236, 131, 90, 0.7); }
.wday--missed .day-kind { color: var(--serious); }
.wday--today .wday-plan, .wday--today .wday-gym {
  background: rgba(210, 255, 0, 0.1); box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 16px rgba(210, 255, 0, 0.35);
  animation: col-in 0.8s var(--ease) both, today-pulse 2.4s ease-in-out 1s infinite;
}
@keyframes today-pulse { 50% { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 4px rgba(210, 255, 0, 0.1); } }
.day-kind { font-size: var(--fs-xs); color: var(--text-2); }
.day-km { font-size: var(--fs-xs); color: var(--muted); margin-top: -5px; font-variant-numeric: tabular-nums; }
.wday.is-today .day-kind { color: var(--text); }

.progress-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 10px; }

/* insights */
.insight { border-top: 1px solid var(--line); }
.insight:first-of-type { border-top: 0; }
.insight > summary { display: grid; grid-template-columns: 22px 1fr 18px; gap: 12px; padding: 14px 0; align-items: center; }
.insight > summary:hover .insight-title { color: var(--text); }
.insight-title { font-weight: 600; color: var(--text); }
.insight-body { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.insight-more { padding: 0 0 16px 34px; }

/* coach's note: Otto sits to the right of the note, centred on it */
.coach-head { display: flex; align-items: center; gap: 12px; }
.digest-otto { width: clamp(84px, 14vw, 133px); height: auto; aspect-ratio: 1; flex: none; margin: -10px -10px -10px -14px; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.5)); }

/* ── disclosure ─────────────────────────────────────────────────────────── */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.chev { width: 18px; height: 18px; color: var(--muted); transition: transform 0.3s var(--ease), color 0.2s; flex: none; }
details[open] > summary .chev { transform: rotate(180deg); color: var(--text-2); }
/* open and close by animating the content's height (browsers without ::details-content snap) */
:is(.disclosure, .insight, .finding, .log-item, .digest-body)::details-content {
  block-size: 0; overflow-y: clip; opacity: 0;
  transition: block-size 0.35s var(--ease), opacity 0.3s var(--ease), content-visibility 0.35s allow-discrete;
}
:is(.disclosure, .insight, .finding, .log-item, .digest-body)[open]::details-content { block-size: auto; opacity: 1; }
.disclosure { margin-top: 18px; border-top: 1px solid var(--line); }
.disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 0 2px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; transition: color 0.2s;
}
.disclosure > summary:hover { color: var(--text); }
.disclosure-body { padding: 10px 0 2px; color: var(--text-2); font-size: var(--fs-sm); }
.disclosure-body p { margin: 0 0 10px; }
.disclosure-body p:last-child { margin-bottom: 0; }
.formula {
  font-size: var(--fs-sm); color: var(--text-2); background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line);
  border-left: 2px solid var(--accent-line); border-radius: var(--r-xs); padding: 10px 12px;
}

/* ── lists & tables ─────────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 1fr auto; gap: 0; font-size: var(--fs-sm); }
.kv > div { padding: 10px 0; border-top: 1px solid var(--line); }
.kv > div:nth-child(-n + 2) { border-top: 0; }
.kv > div:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.kv > div:nth-child(odd) { color: var(--text-2); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: var(--fs-xs); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; padding-right: 0; }
.table-wrap { overflow-x: auto; }

/* ── charts ─────────────────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; border-radius: 8px; }
.chart svg { overflow: visible; display: block; }
/* a chart that takes the rest of its card: the card is a column, the chart its flexible row (contain: size
   keeps the drawing from setting its own height, so the card's height comes from its neighbour) */
.card--fill { display: flex; flex-direction: column; }
.chart--fill { flex: 1 1 0; min-height: 200px; contain: size; }
.chart text { fill: var(--muted); font-size: var(--fs-xs); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .label-strong { fill: var(--text); font-weight: 600; font-size: var(--fs-xs); }
.chart .ref-label, .chart .label-strong { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .ref-label { fill: var(--text-2); font-size: var(--fs-xs); }
.chart .ln--glow { filter: drop-shadow(0 0 6px rgba(210, 255, 0, 0.5)); }
.chart .mark-halo { opacity: 0.22; }
/* first render: lines draw in, areas and dots fade up, columns rise (charts.js adds .draw, then .in when visible) */
.chart.draw .ln { stroke-dasharray: 1; stroke-dashoffset: 1; }
.chart.draw .ar, .chart.draw .dot { opacity: 0; }
/* the projection waits for the history to finish drawing, then wipes in left to right */
.chart.draw .ln--proj { stroke-dasharray: 2 6; stroke-dashoffset: 0; clip-path: inset(0 100% 0 0); }
.chart.draw .col { transform: scaleY(0); transform-box: fill-box; transform-origin: bottom; }
.chart.draw.in .ln { animation: ln-draw 1.3s cubic-bezier(0.35, 0.6, 0.2, 1) forwards; }
.chart.draw.in .ar { animation: fade-to 0.9s 0.45s ease forwards; }
.chart.draw.in .dot { animation: fade-to 0.4s 0.9s ease forwards; }
.chart.draw.in .ln--proj { animation: proj-wipe 0.9s 1.3s linear forwards; }
.chart.draw.in .dot--late { animation-delay: 2.1s; }
@keyframes proj-wipe { to { clip-path: inset(0 0 0 0); } }
.chart.draw.in .col { animation: col-in-to 0.8s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes ln-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-to { to { opacity: 1; } }
@keyframes col-in-to { to { transform: scaleY(1); } }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 12px; font-size: var(--fs-xs); color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend i.sw { width: 10px; height: 10px; border-radius: 3px; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 128px;
  background: rgba(22, 25, 31, 0.82); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px;
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  padding: 9px 11px; font-size: var(--fs-xs); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 32px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: translateY(2px); transition: opacity 0.12s, transform 0.12s;
}
.tooltip.on { opacity: 1; transform: none; }
.tooltip .tt-head { color: var(--muted); margin-bottom: 5px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row i { width: 12px; height: 3px; border-radius: 2px; }
.tooltip .tt-row b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.tooltip .tt-row span { color: var(--text-2); }
.chart-empty {
  display: grid; place-items: center; text-align: center; gap: 6px; padding: 32px 16px;
  border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--muted); font-size: var(--fs-sm);
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, 0.012) 10px 20px);
}
.chart-empty b { color: var(--text-2); font-weight: 600; }
.spark { display: block; width: 100%; height: 44px; overflow: visible; }
.spark-area { fill: url(#g-spark); }
.spark-line { fill: none; stroke: var(--gray-mark); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark-ring { stroke: var(--surface); stroke-width: 11; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-dot { stroke: var(--accent); stroke-width: 7; stroke-linecap: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px rgba(210, 255, 0, 0.8)); }
.tile:hover .spark-line { stroke: var(--text-2); }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.07); }
.seg button { background: none; border: 0; cursor: pointer; font: inherit; }
.seg a, .seg button { padding: 6px 14px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); transition: color 0.2s, background 0.2s; }
.seg a:hover, .seg button:hover { color: var(--text); }
.seg a[aria-current="true"], .seg button[aria-pressed="true"] {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ── plan ───────────────────────────────────────────────────────────────── */
.plan-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); margin-top: 14px; }
.plan-meta span {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); font-weight: 500;
}
.plan-meta svg { width: 15px; height: 15px; color: var(--muted); }
.tl-wrap { max-width: calc(var(--n) * 52px); }
.timeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; align-items: end; height: 150px; padding-top: 18px; }
.timeline a { position: relative; display: flex; align-items: flex-end; height: 100%; border-radius: 8px; }
.timeline a { --ph: var(--gray-mark); }
.timeline a.p-base { --ph: var(--z2); } .timeline a.p-build { --ph: var(--z3); }
.timeline a.p-peak { --ph: var(--z4); } .timeline a.p-taper { --ph: var(--z1); }
.timeline a .bar {
  position: relative; width: 100%; border-radius: 7px 7px 3px 3px;
  background: var(--ph); opacity: 0.45; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform-origin: bottom; animation: col-in 0.9s var(--ease) both; transition: opacity 0.2s;
}
.timeline a.current .bar { opacity: 1; }
.timeline a.past .bar { opacity: 0.25; }
.timeline a:not(.past):hover .bar { opacity: 0.85; }
.timeline a.selected::after { content: ""; position: absolute; left: 50%; bottom: -12px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--text); box-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }
.timeline-axis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-top: 18px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.phase-row { display: flex; gap: 6px; margin-top: 12px; }
.phase-row div { padding-top: 8px; font-size: var(--fs-xs); color: var(--text-2); font-weight: 600; text-transform: capitalize; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; }
.phase-row div::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 2px; background: var(--gray-mark-2); }
.phase-row .phase--base::before { background: var(--z2); }
.phase-row .phase--build::before { background: var(--z3); }
.phase-row .phase--peak::before { background: var(--z4); }
.phase-row .phase--taper::before { background: var(--z1); }
/* the phase you're in now carries the accent, like "this week" in the bars above */

.week-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.week-head h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.025em; }
.week-nav { display: flex; gap: 6px; }
.week-nav .icon-btn { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.07); }

/* workout structure: one bar per step, wide by time, tall and coloured by zone */
.struct { display: flex; align-items: flex-end; gap: 2px; height: 56px; margin: 4px 0 12px; max-width: 460px; }
.struct i { display: block; min-width: 3px; border-radius: 3px 3px 1px 1px; background: var(--z1); transform-origin: bottom; animation: col-in 0.7s var(--ease) both; }
.struct i.z1 { background: var(--z1); height: 24%; } .struct i.z2 { background: var(--z2); height: 40%; } .struct i.z3 { background: var(--z3); height: 58%; }
.struct i.z4 { background: var(--z4); height: 80%; } .struct i.z5 { background: var(--z5); height: 100%; }

.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r);
  background: linear-gradient(90deg, rgba(210, 255, 0, 0.05), rgba(255, 255, 255, 0.02) 50%);
  border: 1px solid var(--line); color: var(--text-2); font-size: var(--fs-sm);
}
.note svg { width: 18px; height: 18px; flex: none; color: var(--accent); margin-top: 1px; }
.note b { color: var(--text); }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 210px;
  background: rgba(24, 27, 33, 0.88); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: var(--r); padding: 6px;
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 20px 50px rgba(0, 0, 0, 0.6);
  transform-origin: top right; animation: pop 0.18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }
.menu-panel a, .menu-panel button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  background: none; border: 0; text-align: left; font-size: var(--fs-sm); color: var(--text); cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: rgba(255, 255, 255, 0.07); }
.menu-panel .danger { color: var(--serious); }
.menu-panel svg { width: 16px; height: 16px; color: var(--muted); }

/* ── forms ──────────────────────────────────────────────────────────────── */
.form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label, .field .label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input, select.input, textarea.input {
  height: 46px; padding: 0 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09); color: var(--text); width: 100%; outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
textarea.input { height: auto; min-height: 92px; padding: 12px 14px; resize: vertical; }
.input:hover { border-color: rgba(255, 255, 255, 0.15); }
.input:focus { border-color: var(--accent-line); background: rgba(255, 255, 255, 0.05); box-shadow: 0 0 0 4px var(--accent-wash); }
.input::placeholder { color: var(--muted); }
.input.mono, .input.num { font-variant-numeric: tabular-nums; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.choice { display: flex; gap: 6px; flex-wrap: wrap; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  min-width: 50px; height: 42px; padding: 0 15px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.09); color: var(--text-2); font-weight: 600; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.choice label:hover { border-color: rgba(255, 255, 255, 0.16); color: var(--text); }
.choice label:active { transform: scale(0.96); }
.choice input:checked + label { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent); box-shadow: 0 0 18px -6px rgba(210, 255, 0, 0.5); }
.choice input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-status { font-size: var(--fs-sm); }
.form-status:empty { display: none; }
.form-status .ok { color: var(--accent); }
.form-status .garmin-ok, .garmin-ok { display: flex; align-items: center; line-height: 0; color: var(--text); }
.garmin-ok svg { width: 26px; height: 26px; }
.form-status .err { color: var(--serious); }

/* ── log ────────────────────────────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 24px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; font-size: var(--fs-sm); color: var(--muted); }
.log-week-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 6px 10px; font-size: var(--fs-sm); color: var(--muted); }
.log-week-head b { color: var(--text); font-weight: 600; }
.log-item { border-top: 1px solid var(--line); }
.log-item:first-child { border-top: 0; }
.log-item:first-child > .log-row { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.log-item:last-child:not([open]) > .log-row { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.log-row { display: flex; align-items: stretch; transition: background 0.2s; list-style: none; }
.log-row::-webkit-details-marker { display: none; }
.log-link { flex: 1; min-width: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 4px 12px 18px; color: inherit; }
.log-toggle { flex: none; width: 48px; display: grid; place-items: center; cursor: pointer; }
.log-row:hover { background: rgba(255, 255, 255, 0.025); }
.log-item[open] > .log-row { background: rgba(255, 255, 255, 0.03); }
.log-more { padding: 6px 18px 20px 76px; }
.log-more-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.mini-stats > div { display: grid; gap: 2px; min-width: 0; }
.mini-stats span { font-size: var(--fs-xs); color: var(--muted); }
.mini-stats b { font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-stats small { font-size: var(--fs-xs); color: var(--muted); }
.mini-stats .clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exercises td:first-child { color: var(--text); }
.log-icon {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(255, 255, 255, 0.06); color: var(--text-2);
  transition: border-color 0.2s, background 0.2s;
}
.log-icon svg { width: 18px; height: 18px; }
.log-icon .route--glyph { width: 30px; height: 30px; }
.log-row:hover .log-icon { border-color: rgba(255, 255, 255, 0.12); }
.log-row:hover .route--glyph path { stroke: var(--accent); filter: drop-shadow(0 0 3px rgba(210, 255, 0, 0.6)); }
.log-icon.race { background: var(--accent-wash); color: var(--accent); border-color: rgba(210, 255, 0, 0.22); }
.log-icon.race .route--glyph path { stroke: var(--accent); }
.log-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-meta { font-size: var(--fs-xs); color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 1px; }
.log-stats { display: flex; gap: 24px; text-align: right; font-variant-numeric: tabular-nums; }
.log-stats div { min-width: 54px; }
.log-stats b { font-weight: 700; font-size: var(--fs-base); }
.log-stats small { display: block; font-size: var(--fs-xs); color: var(--muted); }
@media (max-width: 560px) {
  .log-link { padding: 12px 2px 12px 14px; gap: 12px; grid-template-columns: 40px minmax(0, 1fr) auto; }
  .log-icon { width: 40px; height: 40px; }
  .log-more { padding: 4px 14px 16px; }
  .log-more-grid { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-stats { gap: 12px; }
  .log-stats .hide-sm { display: none; }
}

/* ── misc ───────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 60px 24px; }
.empty h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 8px; }
.empty p { color: var(--text-2); max-width: 46ch; margin: 0 auto 24px; }
.center-card { max-width: 540px; margin: 8vh auto 0; }

code { font-family: var(--font); font-weight: 500; font-size: var(--fs-xs); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.digest p { margin: 0 0 12px; color: var(--text-2); line-height: 1.65; }
.digest-body > summary { display: grid; gap: 10px; }
.digest-body .clamp { color: var(--text); font-size: var(--fs-base); line-height: 1.65; margin: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
.digest-body[open] .clamp { display: block; }
.digest-body[open] .more { display: none; }
.digest-body > p:first-of-type { margin-top: 12px; }

/* ── sliders ────────────────────────────────────────────────────────────── */
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.slider-value { font-family: var(--font-clock); font-style: italic; font-size: 30px; line-height: 1; color: var(--accent); text-shadow: 0 0 16px rgba(210, 255, 0, 0.4); min-width: 1ch; text-align: right; }
.slider { --pct: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.slider:focus { outline: none; }
.slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, rgba(210, 255, 0, 0.6), var(--accent) var(--pct), rgba(255, 255, 255, 0.08) var(--pct) 100%);
}
.slider::-moz-range-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.slider::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f7ffd0, var(--accent) 60%); box-shadow: 0 0 0 5px rgba(210, 255, 0, 0.14), 0 0 16px rgba(210, 255, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.2s, transform 0.2s var(--spring);
}
.slider::-moz-range-thumb {
  width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 5px rgba(210, 255, 0, 0.14), 0 2px 10px rgba(0, 0, 0, 0.5);
}
.slider:hover::-webkit-slider-thumb, .slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 8px rgba(210, 255, 0, 0.2), 0 0 22px rgba(210, 255, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.5); }
.slider:active::-webkit-slider-thumb { transform: scale(1.12); }
.slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 8px rgba(210, 255, 0, 0.22); }
.slider-ticks { display: flex; justify-content: space-between; padding: 0 7px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -2px; }

/* ── busy overlay: blurred glass + stopwatch while Claude works ─────────── */
.builder-card { position: relative; }
.busy {
  position: absolute; inset: 0; z-index: 10; border-radius: inherit;
  display: grid; place-items: center;
  background: rgba(7, 8, 11, 0.6);
  backdrop-filter: blur(12px) saturate(120%); -webkit-backdrop-filter: blur(12px) saturate(120%);
  opacity: 0; visibility: hidden; transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}
.busy.htmx-request { opacity: 1; visibility: visible; transition: opacity 0.3s var(--ease); }
.busy--page { position: fixed; border-radius: 0; z-index: 60; }
.busy-inner { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 24px; }
.stopwatch { position: relative; width: 136px; height: 136px; margin-bottom: 8px; }
.stopwatch svg { width: 100%; height: 100%; transform: rotate(-90deg); animation: sw-spin 1.6s linear infinite; }
.sw-track { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 5; }
.sw-arc {
  fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 72 255;
  filter: drop-shadow(0 0 6px rgba(210, 255, 0, 0.65));
}
.sw-time {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-clock); font-style: italic; font-size: 40px; color: var(--accent);
  text-shadow: 0 0 18px rgba(210, 255, 0, 0.45); font-variant-numeric: tabular-nums;
}
.busy-title { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.02em; }
.busy-sub { color: var(--text-2); font-size: var(--fs-sm); min-height: 1.5em; animation: fade-in 0.4s var(--ease); }
@keyframes sw-spin { to { transform: rotate(270deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ── explanatory tooltips (Trends tiles) ────────────────────────────────── */
.has-tip { position: relative; }
.tip-icon { display: inline-flex; color: var(--muted); vertical-align: -2px; margin-left: 5px; }
.tip-icon svg { width: 14px; height: 14px; }
.tip {
  position: absolute; z-index: 20; left: 12px; right: 12px; top: calc(100% - 6px);
  padding: 12px 14px; border-radius: 12px; background: rgba(24, 27, 33, 0.9); border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); font-size: var(--fs-sm); line-height: 1.5; color: var(--text-2);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0s linear 0.18s;
  pointer-events: none;
}
.tip b { color: var(--text); font-weight: 600; }
.has-tip:hover .tip, .has-tip:focus-visible .tip, .has-tip:focus-within .tip {
  opacity: 1; visibility: visible; transform: none; transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}


/* ── activity page ──────────────────────────────────────────────────────── */
.back-link { margin-bottom: 16px; }
.back-link:hover svg { transform: translateX(-3px) !important; }
.act-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
.act-kpis > div { min-width: 0; }
.act-kpis > div + div { border-left: 1px solid rgba(255, 255, 255, 0.06); padding-left: 18px; }
.act-kpis .figure { font-size: var(--fs-xl); margin-top: 4px; }
@media (max-width: 980px) {
  .act-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .act-kpis > div:nth-child(3n + 1) { border-left: 0; padding-left: 0; }
}
@media (max-width: 560px) {
  .act-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .act-kpis > div:nth-child(n) { border-left: 0; padding-left: 0; }
}

.route { display: block; }
.route path { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(210, 255, 0, 0.4)); }
.route--lg { width: 100%; height: auto; }
.route--lg path { stroke-dasharray: 1; animation: route-draw 2.2s cubic-bezier(0.45, 0.1, 0.2, 1) 0.2s both; }
@keyframes route-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.route--lg .route-start, .route--lg .route-end { animation: fade-in 0.4s 2.2s both; }
.route-map {
  border-radius: var(--r); padding: 6px;
  background:
    radial-gradient(70% 70% at 50% 50%, rgba(210, 255, 0, 0.05), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 28px 28px;
}
.route--sm { width: 176px; height: 116px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.route--sm path { stroke-width: 2; filter: none; }
.route--glyph path { stroke: var(--text-2); stroke-width: 1.6; filter: none; vector-effect: non-scaling-stroke; transition: stroke 0.2s; }
.route .route-start { fill: var(--surface); stroke: var(--text); stroke-width: 2; }
.route .route-end { fill: var(--text); stroke: var(--surface); stroke-width: 2; }
.route-legend { display: flex; gap: 16px; margin-top: 12px; font-size: var(--fs-xs); color: var(--text-2); }
.route-legend span { display: inline-flex; align-items: center; gap: 6px; }
.route-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.route-legend i.route-start { border: 2px solid var(--text); }
.route-legend i.route-end { background: var(--text); }
@media (max-width: 560px) { .route--sm { width: 100%; height: 150px; } }

.te-row { margin-bottom: 16px; }
.te-head { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 8px; }
.te-head b { color: var(--text); font-weight: 700; }
.planned-vs + .planned-vs { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }

.zones { display: grid; gap: 11px; }
.zone-row { display: grid; grid-template-columns: 124px minmax(0, 1fr) 96px; gap: 12px; align-items: center; font-size: var(--fs-sm); }
.zone-name { color: var(--text); font-weight: 600; white-space: nowrap; }
.zone-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.zone-bar i { display: block; height: 100%; border-radius: 999px; background: var(--gray-mark); transform-origin: left; animation: meter-in 0.9s var(--ease) both; }
.zone-row .zone-bar i { background: var(--zc, var(--gray-mark)); }
.zone-row.z1 { --zc: var(--z1); } .zone-row.z2 { --zc: var(--z2); } .zone-row.z3 { --zc: var(--z3); }
.zone-row.z4 { --zc: var(--z4); } .zone-row.z5 { --zc: var(--z5); }
.zone-row.main .zone-name { color: var(--zc); }
.zone-val { text-align: right; color: var(--text); }
.zones--mini { width: 220px; gap: 6px; }
.zones--mini .zone-row { grid-template-columns: 26px minmax(0, 1fr) 38px; gap: 8px; font-size: var(--fs-xs); }
.zones--mini .zone-bar { height: 6px; }
@media (max-width: 560px) { .zones--mini { width: 100%; } .zone-row { grid-template-columns: 96px minmax(0, 1fr) 84px; } }

.dyn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.dyn-grid > div { min-width: 0; outline-offset: 4px; }
@media (max-width: 560px) { .dyn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stream { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.stream--first { padding-top: 0; margin-top: 0; border-top: 0; }
.stream h3 { margin-bottom: 10px; }

.splits td { padding-top: 7px; padding-bottom: 7px; }
.split-bar-col { width: 42%; }
.split-bar { display: block; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.split-bar i { display: block; height: 100%; border-radius: 999px; background: var(--gray-mark); transform-origin: left; animation: meter-in 0.9s var(--ease) both; }
.splits tr.fastest .split-bar i { background: linear-gradient(90deg, rgba(210, 255, 0, 0.6), var(--accent)); box-shadow: 0 0 10px rgba(210, 255, 0, 0.5); }
.splits tr.fastest td:first-child, .splits tr.fastest td:nth-child(2) { color: var(--accent); font-weight: 600; }

.detail-loading { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: var(--fs-sm); }
.spinner-sm { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Today: background Strava check, first import ───────────────────────── */
.page-head-chips { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sync-check { gap: 8px; }
.sync-check:not(.htmx-request) { display: none; }
.sync-check .spinner-sm { width: 12px; height: 12px; border-width: 1.5px; }
.import-card .import-progress { display: inline-flex; align-items: center; gap: 12px; color: var(--text-2); font-size: var(--fs-sm); }
.import-card .import-progress b { color: var(--text); }

/* ── skip / move / swap on a planned session ────────────────────────────── */
.sess-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.sess-move { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sess-move label { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.sess-more { display: flex; gap: 4px; }
.sess-actions .form-status { flex-basis: 100%; }
.input--sm, select.input--sm { height: 32px; padding: 0 10px; font-size: var(--fs-sm); border-radius: 10px; width: auto; }
.session-menu > summary.btn { list-style: none; }
.session-menu > summary::-webkit-details-marker { display: none; }
/* anchored to the card (the menu itself is static), so it never runs off a phone screen */
.session-menu { position: static; }
.menu-panel--wide { left: 16px; right: 16px; top: auto; margin-top: 8px; min-width: 0; transform-origin: top left; padding: 12px 14px; }
.menu-panel--wide .sess-actions { margin-top: 0; padding-top: 0; border-top: 0; }
.menu-panel--wide .btn { display: inline-flex; width: auto; }
.session-hero .title.is-skipped, .drow.is-skipped .tt { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.25); }
.skipped-banner { margin-top: 18px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px dashed var(--line-2); color: var(--text-2); font-size: var(--fs-sm); }
.skipped-banner b { color: var(--text); }
.moved-note { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.wday--skipped .wday-plan { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.18); }
.wday--skipped .day-kind { text-decoration: line-through; }
.felt { color: var(--text-2); }

/* ── readiness: a Garmin signal that isn't in yet ───────────────────────── */
.lvl-missing .status-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.stale { color: var(--warning); }

/* ── weekly note: lead with next week's focus ───────────────────────────── */
.digest-next { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--accent-wash); border: 1px solid rgba(210, 255, 0, 0.16); }
.digest-next-text { min-width: 0; flex: 1; }
.digest-next .stat-label { color: var(--accent); }
.digest-next p { margin: 6px 0 0; color: var(--text); font-size: var(--fs-base); line-height: 1.6; }
.digest-body > summary { margin-top: 14px; }
.digest-section { margin-top: 16px; }
.digest-section p { margin: 6px 0 0; }
.digest-asof { margin: 16px 0 0 !important; font-size: var(--fs-xs); color: var(--muted) !important; }

/* ── settings: data sources ─────────────────────────────────────────────── */
.source + .source { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.source-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.source-head b { color: var(--text); margin-right: 8px; }
.source-head .muted { font-size: var(--fs-sm); }
.source-when { font-size: var(--fs-sm); color: var(--text); font-variant-numeric: tabular-nums; }
.source-note { margin: 8px 0 0; font-size: var(--fs-sm); color: var(--muted); line-height: 1.55; }
.source-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.band-inputs { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── not found ──────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .orbit { display: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .chart.draw .ln { stroke-dashoffset: 0; }
  .chart.draw .ln--proj { clip-path: none; }
  .chart.draw .ar, .chart.draw .dot { opacity: 1; }
  .chart.draw .col { transform: none; }
}

/* insights: ranked findings, each with what it means, its evidence, a chart and (sometimes) a plan change */
.findings { display: grid; gap: 12px; }
.finding { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--lift); --lc: var(--blue); }
.finding.lvl-serious { --lc: var(--critical); } .finding.lvl-warning { --lc: var(--warning); } .finding.lvl-good { --lc: var(--good); }
.finding > summary { display: grid; grid-template-columns: 44px 72px minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; padding: 20px 22px; cursor: pointer; }
.finding .rank { font-size: var(--fs-2xl); font-weight: 700; line-height: 1; color: var(--lc); }
.finding-otto { width: 72px; height: 72px; margin: -12px -6px -12px; align-self: center; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.5)); }
.finding-title { font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.finding-body { margin: 5px 0 0; color: var(--text-2); font-size: var(--fs-sm); max-width: 64ch; }
.finding-side { display: flex; align-items: center; gap: 12px; }
.finding-metric { font-size: var(--fs-base); font-weight: 700; white-space: nowrap; }
.finding[open] .chev { transform: rotate(180deg); }
.finding-more { padding: 0 22px 22px 82px; }
.finding-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
.finding-cols--one { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
.finding-why { margin: 0 0 14px; color: var(--text-2); font-size: var(--fs-sm); }
.finding-chart { min-width: 0; }
.fix { margin-top: 16px; }
.fix-head { margin: 0 0 8px; font-size: var(--fs-sm); display: flex; gap: 6px; align-items: center; }
.fix-done { color: var(--good); } .fix-done svg { width: 16px; height: 16px; }
.fix-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; font-size: var(--fs-sm); }
.fix-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
.fix-list small { display: block; color: var(--text-2); font-size: var(--fs-xs); }
.fix-actions { display: flex; gap: 8px; }
@media (max-width: 720px) {
  .finding > summary { grid-template-columns: 30px 52px minmax(0, 1fr) auto; padding: 16px; }
  .finding-otto { width: 52px; height: 52px; margin: -8px -4px; }
  .finding .rank { font-size: var(--fs-xl); }
  .finding-more { padding: 0 16px 18px; }
  .finding-cols { grid-template-columns: minmax(0, 1fr); gap: 18px; }
}
.session-kind { margin-top: 8px; }
.session-hero .hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero-top .session-kind { margin-top: 8px; }
button.ready { cursor: pointer; font: inherit; color: inherit; }
button.ready:hover { filter: brightness(1.2); }
.ready-dialog { border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface-2); color: var(--text-2); padding: 20px 24px 24px; width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.ready-dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.ready-dialog-head { display: flex; justify-content: flex-end; align-items: center; margin-bottom: 14px; }
.ready-dialog p { margin: 0 0 10px; }

.plan-head { flex: 1 1 100%; }
.plan-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.plan-meta-row .plan-meta { margin-top: 0; }
.plan-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.note { position: relative; align-items: flex-start; }
.note > div { flex: 1; min-width: 0; }
.note-close { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin: -2px -4px 0 0; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.note-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.note-close svg { width: 15px; height: 15px; color: inherit; margin: 0; }
.hero-top { align-items: flex-start; }
.session-hero .hero-top .title { margin-top: 0; }
.session-hero { display: flex; flex-direction: column; }
.session-hero .session-actions { margin-top: auto; padding-top: 24px; }

html { scroll-padding-top: 104px; }
.wk-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wk-dates { margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); }
.phase-chip { --ph: var(--gray-mark); display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; color: var(--ph); background: color-mix(in srgb, var(--ph) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ph) 32%, transparent); }
.phase-chip.p-base { --ph: var(--z2); } .phase-chip.p-build { --ph: var(--z3); }
.phase-chip.p-peak { --ph: var(--z4); } .phase-chip.p-taper { --ph: var(--z1); }

.field-row--goal { grid-template-columns: auto 1fr 1fr; align-items: end; }
@media (max-width: 560px) { .field-row--goal { grid-template-columns: 1fr; } }
.pace-input { width: 84px; text-align: center; }

select.input {
  appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa1ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.chart .ref-label--color { font-weight: 600; font-size: var(--fs-xs); }

/* ── step list: rows coloured by zone, repeats boxed ─────────────────────── */
.step-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); }
.step { display: flex; align-items: center; gap: 12px; }
.step i { flex: none; width: 4px; height: 18px; border-radius: 2px; background: var(--z2); }
.step i.z1 { background: var(--z1); } .step i.z2 { background: var(--z2); } .step i.z3 { background: var(--z3); }
.step i.z4 { background: var(--z4); } .step i.z5 { background: var(--z5); }
.step-rep { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-2); }
.rep-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.rep-badge { padding: 2px 9px; border-radius: 999px; background: var(--accent-wash); border: 1px solid var(--accent-line); color: var(--accent); font-size: var(--fs-sm); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.step-rep ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }

/* ── plan card: chart, week header, days ─────────────────────────────────── */
.tl-wrap { margin: 0 auto; max-width: calc(var(--n) * 62px); }
.timeline { height: 112px; padding-top: 6px; }
.timeline a.selected::after { left: 0; right: 0; bottom: -10px; width: auto; height: 3px; margin: 0; border-radius: 2px; background: var(--text); box-shadow: none; }
.plan-card .week-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.plan-card .week-nav { gap: 6px; }
.week-id { min-width: 0; flex: 1; }
.week-stats { text-align: right; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.week-stats b { color: var(--text); }
.plan-card .meter { margin: 14px 0 16px; }
.days { display: grid; gap: 6px; }
.dgroup {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 20px; align-items: center; padding: 6px 16px;
  border-radius: 16px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); transition: border-color 0.2s, opacity 0.2s;
}
.dgroup:hover { border-color: var(--line-2); }
.dgroup.is-today { border-color: rgba(210, 255, 0, 0.55); background: linear-gradient(var(--accent-wash), var(--accent-wash)), rgba(255, 255, 255, 0.02); }
.dgroup:has(.drow.is-open) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px -6px rgba(210, 255, 0, 0.45); }
.dgroup.is-past { opacity: 0.55; } .dgroup.is-past:hover { opacity: 0.85; }
.dgroup.is-past .dd b { color: var(--text-2); }
.dgroup.rest { background: transparent; border-style: dashed; opacity: 0.6; }
.dgroup.is-today .dd { color: var(--accent); }
.dsess { display: grid; min-width: 0; }
.drow {
  display: grid; grid-template-columns: 18px 4px minmax(0, 1fr) auto 18px; align-items: center; gap: 20px; width: 100%;
  margin: 0 -8px; padding: 11px 8px; border-radius: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: none; border: 0; transition: background 0.2s;
}
.drow + .drow { position: relative; }
.drow + .drow::before { content: ""; position: absolute; top: 0; left: 8px; right: 8px; height: 1px; background: var(--line); }
.drow:hover { background: rgba(255, 255, 255, 0.06); }
.drow.is-open { background: var(--accent-wash); }
.drow.rest { cursor: default; } .drow.rest:hover { background: none; }
.dgroup .dd { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1.4; min-height: 1px; }
.dgroup .dd b { display: block; font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1.05; font-variant-numeric: tabular-nums; }
.drow .strip { align-self: stretch; border-radius: 2px; background: var(--kc, var(--gray-mark-2)); }
.drow .tt { font-weight: 600; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow .tg { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.drow .tg .pace { color: var(--text-2); font-variant-numeric: tabular-nums; }
.drow .rt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--fs-base); }
.drow .rt small { display: flex; gap: 5px; align-items: center; justify-content: flex-end; font-weight: 500; font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.drow .rt small svg { width: 13px; height: 13px; }
.drow .rt small.is-done { color: var(--accent); }
.drow .rt small.is-missed { color: var(--serious); }
.drow .chev { width: 16px; height: 16px; color: var(--muted); transform: rotate(-90deg); }
@media (max-width: 560px) { .dgroup { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 4px 12px; } .drow { grid-template-columns: 16px 3px minmax(0, 1fr) auto; gap: 12px; } .drow .chev { display: none; } }

/* ── side sheet ──────────────────────────────────────────────────────────── */
.layer[hidden] { display: none; }
.layer .scrim { position: fixed; inset: 0; z-index: 50; background: rgba(3, 4, 6, 0.62); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.35s; }
.layer .sheet {
  position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(540px, 100%); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-2); border-left: 1px solid var(--line-2); padding: 22px 26px 40px;
  transform: translateX(104%); transition: transform 0.5s var(--ease); box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
}
.layer.open .scrim { opacity: 1; }
.layer.open .sheet { transform: none; }
.sheet .x { position: sticky; top: 0; z-index: 2; display: grid; place-items: center; width: 34px; height: 34px; margin-left: auto; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-3); color: var(--text); cursor: pointer; }
.sheet .x svg { width: 16px; height: 16px; }
.sheet-title { margin: 6px 0 12px; font-size: var(--fs-display); line-height: 1; font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sheet-top > div { min-width: 0; }
.sheet-top .btn { flex: none; }
.sheet-top .btn svg { width: 17px; height: 17px; }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sheet-sec { padding: 18px 0 4px; border-top: 1px solid var(--line); margin-top: 18px; }
.sheet-sec h4 { margin: 0 0 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.sheet-sec p { margin: 0 0 8px; color: var(--text-2); font-size: var(--fs-sm); }
.sheet .sess-actions { margin-top: 0; padding-top: 0; border-top: 0; }
.sheet-done { padding: 14px 16px; border-radius: var(--r); background: var(--accent-wash); border: 1px solid rgba(210, 255, 0, 0.2); color: var(--accent); font-weight: 600; display: flex; gap: 10px; align-items: center; }
.sheet-done svg { width: 18px; height: 18px; }
.sheet .struct { max-width: none; height: 48px; margin: 0 0 14px; }
.sheet .step-list { margin-top: 0; }
#sheet-body > * { animation: sheet-in 0.5s var(--ease) both; }
#sheet-body > :nth-child(2) { animation-delay: 0.05s; } #sheet-body > :nth-child(3) { animation-delay: 0.1s; }
#sheet-body > :nth-child(4) { animation-delay: 0.15s; } #sheet-body > :nth-child(5) { animation-delay: 0.2s; } #sheet-body > :nth-child(6) { animation-delay: 0.25s; }
@keyframes sheet-in { from { opacity: 0; transform: translateX(18px); } }
@media (prefers-reduced-motion: reduce) { .layer .sheet, .layer .scrim { transition: none; } #sheet-body > * { animation: none; } }
.hero-top--next { margin-bottom: 4px; }
.icon-btn.is-disabled { opacity: 0.3; pointer-events: none; }

.sess-send { display: flex; align-items: center; gap: 12px; flex-basis: 100%; margin-bottom: 4px; }
.sess-send .btn svg { width: 17px; height: 17px; }
.sess-send .form-status { margin: 0; }
.sheet { padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.sheet .x { margin-bottom: -26px; }
/* installed app (viewport-fit=cover): keep the pinned close button below the status bar / Dynamic Island */
.sheet .x { top: env(safe-area-inset-top); }
.drow .ico { display: grid; place-items: center; color: #fff; }
.drow .ico svg { width: 16px; height: 16px; }
.btn--danger { background: rgba(236, 90, 90, 0.08); color: #f08a8a; border: 1px solid rgba(236, 90, 90, 0.22); box-shadow: none; }
.btn--danger:hover { background: rgba(236, 90, 90, 0.16); border-color: rgba(236, 90, 90, 0.4); color: #ff9c9c; }
.sess-send { flex-wrap: wrap; }
.sess-send { justify-content: space-between; }
.sess-send .form-status { flex-basis: 100%; }
.sess-send .form-status:empty { display: none; }
/* the "on Garmin" watch is part of the button row: it sits before Delete instead of wrapping under it */
.sess-send .form-status:has(.garmin-ok) { flex-basis: auto; order: 1; }
.sess-send .btn--danger { order: 2; }
/* a day with one workout highlights (and opens) as a whole card */
.dgroup:has(.drow:only-child:not(.rest)) { cursor: pointer; }
.dgroup:has(.drow:only-child:not(.rest)):hover { background: rgba(255, 255, 255, 0.06); }
.dgroup.is-today:has(.drow:only-child:not(.rest)):hover { background: linear-gradient(var(--accent-wash), var(--accent-wash)), rgba(255, 255, 255, 0.06); }
.dgroup:has(.drow:only-child.is-open) { background: var(--accent-wash); }
.dsess > .drow:only-child { margin: 0; padding-left: 0; padding-right: 0; }
.dsess > .drow:only-child:hover, .dsess > .drow:only-child.is-open { background: none; }
.sort-by { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sort-by label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.sort-by select.input { height: 36px; min-width: 130px; }
.sort-dir { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.sort-dir svg { width: 16px; height: 16px; }

/* ── drag and drop between days ──────────────────────────────────────────── */
.drow[data-drag] { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.drow.is-lifted { opacity: 0.28; background: rgba(255, 255, 255, 0.04); outline: 1px dashed var(--line-2); outline-offset: -1px; }
.drow.is-landed { animation: landed 0.9s var(--ease); }
@keyframes landed { 0% { background: var(--accent-wash); box-shadow: 0 0 0 1px var(--accent-line); } 100% { background: none; box-shadow: 0 0 0 1px transparent; } }
.drow.is-new { animation: rest-in 0.35s var(--ease) both; }
@keyframes rest-in { from { opacity: 0; } }
.drag-ghost {
  position: fixed; z-index: 70; margin: 0; pointer-events: none; will-change: transform;
  display: grid; grid-template-columns: 18px 4px minmax(0, 1fr) auto 18px; align-items: center; gap: 20px; padding: 11px 8px;
  border-radius: 12px; background: var(--surface-3); border: 1px solid var(--accent-line);
  box-shadow: 0 18px 44px -10px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(210, 255, 0, 0.18), 0 0 28px -8px rgba(210, 255, 0, 0.45);
  transition: scale 0.2s var(--spring);
}
.drag-ghost.is-up { scale: 1.025; }
@media (max-width: 560px) { .drag-ghost { grid-template-columns: 16px 3px minmax(0, 1fr) auto; gap: 12px; } .drag-ghost .chev { display: none; } }
html.is-dragging, html.is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
html.is-dragging .dgroup { transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, opacity 0.2s; }
html.is-dragging .dgroup.is-past { opacity: 0.28; }
html.is-dragging .dgroup.rest { opacity: 0.85; }
.dgroup.is-drop, html.is-dragging .dgroup.is-drop.rest {
  border-color: var(--accent); border-style: solid; opacity: 1;
  background: linear-gradient(var(--accent-wash), var(--accent-wash)), rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 0 1px var(--accent), 0 0 26px -8px rgba(210, 255, 0, 0.5);
}
@media (prefers-reduced-motion: reduce) { .drow.is-landed, .drow.is-new { animation: none; } .drag-ghost { transition: none; } }

/* ── add / edit forms in the sheet ───────────────────────────────────────── */
.sheet .form { margin-top: 18px; }
.sheet .field-row .field { min-width: 0; }
.wf-actions { justify-content: flex-start; margin-top: 4px; }
.wf-est { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 1em; }
.wf-est:empty { display: none; }
.wf-mode { justify-self: start; margin-top: 14px; border-color: var(--accent-line); color: var(--accent); }
.wf-mode:hover { background: var(--accent-wash); border-color: var(--accent); }
.struct--edit { max-width: none; height: 44px; margin: 4px 0 12px; }
.steps-edit { display: grid; gap: 10px; position: relative; }
.grip { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 28px; color: var(--muted); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.grip:hover { color: var(--text); }
.grip svg { width: 10px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.srow.is-lifted, .blk.is-lifted { opacity: 0.28; outline: 1px dashed var(--line-2); outline-offset: 2px; border-radius: 8px; }
.srow.is-landed, .blk.is-landed { animation: landed 0.9s var(--ease); border-radius: 8px; }
.sort-ghost { position: fixed; z-index: 80; margin: 0; pointer-events: none; will-change: transform; transition: scale 0.2s var(--spring); }
.sort-ghost::before {
  content: ""; position: absolute; inset: -8px; z-index: -1; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--accent-line);
  box-shadow: 0 18px 44px -10px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(210, 255, 0, 0.18), 0 0 28px -8px rgba(210, 255, 0, 0.45);
}
.sort-ghost.is-up { scale: 1.025; }
.sort-slot {
  position: absolute; z-index: 0; border-radius: 10px; border: 1px dashed var(--accent-line); background: var(--accent-wash); pointer-events: none;
  opacity: 0; scale: 0.97; transition: top 0.2s var(--ease), left 0.2s var(--ease), width 0.2s var(--ease), height 0.2s var(--ease), opacity 0.2s, scale 0.25s var(--spring);
}
.sort-slot.on { opacity: 1; scale: 1; }
.steps-edit.is-sorting .srow, .steps-edit.is-sorting .blk { transition: margin 0.22s var(--ease); }
@media (prefers-reduced-motion: reduce) { .sort-ghost, .sort-slot, .steps-edit.is-sorting .srow, .steps-edit.is-sorting .blk { transition: none; } .srow.is-landed, .blk.is-landed { animation: none; } }
.steps-add { display: flex; gap: 8px; margin-top: 10px; }
.blk { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px; background: rgba(255, 255, 255, 0.02); display: grid; gap: 8px; }
.sort-ghost.blk { border: 0; background: none; }
.blk--plain { border: 0; padding: 0; background: none; }
.blk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.blk-head label { margin-right: auto; display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.blk-head .input { width: 64px; }
.blk-rows { display: grid; gap: 8px; }
.blk > .btn { justify-self: start; }
.srow { display: grid; grid-template-columns: 16px minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 0.7fr) minmax(0, 1.3fr) minmax(0, 1fr) 28px; gap: 6px; align-items: center; }
.srow .input { width: 100%; padding: 0 8px; }
.srow .icon-btn, .blk-head .icon-btn { width: 28px; height: 28px; font-size: var(--fs-lg); line-height: 1; color: var(--muted); }
@media (max-width: 560px) { .srow { grid-template-columns: 16px 1fr 1fr 1fr 28px; } .srow [data-f=pace] { grid-column: 2 / 4; } .srow [data-f=zone] { grid-column: 4 / 5; } }
.races-beyond { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.races-beyond h4 { margin: 0 0 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.races-beyond .drow { margin: 0; padding-left: 0; padding-right: 0; }
.races-beyond p { margin: 8px 0 0; font-size: var(--fs-sm); }
.field[hidden] { display: none; }

/* ── race day ───────────────────────────────────────────────────────────── */
.card--race {
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(210, 255, 0, 0.2), transparent 60%),
    radial-gradient(70% 90% at 0% 100%, rgba(255, 163, 26, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 160px),
    var(--surface);
  border-color: rgba(210, 255, 0, 0.4);
  box-shadow: inset 0 1px 0 rgba(210, 255, 0, 0.25), 0 30px 60px -30px rgba(0, 0, 0, 0.9), 0 0 100px -30px rgba(210, 255, 0, 0.4);
}
.race-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; color: var(--accent);
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
}
.race-eyebrow svg { width: 16px; height: 16px; }
.card--race .title { font-size: clamp(34px, 5vw, 52px); margin-top: 10px; }
.race-metrics { align-items: flex-end; }
.race-lcd { font-size: 56px; color: var(--accent); text-shadow: 0 0 24px rgba(210, 255, 0, 0.35); margin-top: 4px; }

/* Review changes sheet */
.adapt-reasons { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); }
.adapt-reasons li { padding-left: 14px; position: relative; }
.adapt-reasons li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.adapt-summary { margin: 0 0 12px; font-size: var(--fs-sm); }
.adapt-summary:empty { display: none; }
.adapt-opts { display: grid; gap: 8px; margin: 14px 0 6px; font-size: var(--fs-sm); color: var(--text-2); }
.adapt-opts label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.adapt-opts input[type=checkbox], .adapt-week > input { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.adapt-pace { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.adapt-pace span { display: inline-block; min-width: 84px; color: var(--text-2); }
.adapt-weeks { display: grid; gap: 8px; }
.adapt-week { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); }
.adapt-week > input { margin-top: 3px; }
.adapt-week summary { list-style: none; display: flex; justify-content: space-between; gap: 12px; cursor: pointer; font-size: var(--fs-sm); }
.adapt-week summary::-webkit-details-marker { display: none; }
.aw-title { font-weight: 600; }
.aw-km { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.adapt-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.adapt-cols h5 { margin: 0 0 6px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.adapt-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: var(--fs-xs); color: var(--text-2); }
.adapt-cols .d { display: inline-block; width: 34px; color: var(--muted); }
.adapt-cols p { margin: 0; font-size: var(--fs-xs); }
.adapt-warn { display: flex; gap: 8px; align-items: center; margin: 16px 0 12px; font-size: var(--fs-sm); color: var(--text-2); }
.adapt-warn svg { width: 15px; height: 15px; flex: none; color: var(--serious); }
.note-actions { margin-top: 10px; }

/* ── connect page: a drifting dot-matrix shader (connect-bg.js) and one button styled like the nav ── */
body.connect-page .track { display: none; }
body.connect-page main { max-width: none; padding: 0; margin-top: 0; }
.connect { position: fixed; inset: 0; z-index: 1; overflow: hidden; background: #010201; }
.connect-dots { position: absolute; inset: 0; background-image: radial-gradient(rgba(190, 251, 52, 0.55) 1.2px, transparent 1.6px); background-size: 12px 12px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 55%, transparent 8%, #000 75%); mask-image: radial-gradient(ellipse at 50% 55%, transparent 8%, #000 75%); }
.connect canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.connect-shade { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 46% 34% at 50% 50%, rgba(1, 2, 1, 0.88), transparent 100%), linear-gradient(#010201, transparent 18%, transparent 80%, #010201); }
.connect-center { position: absolute; inset: 0; display: grid; place-items: center; padding-top: var(--topbar); }
/* the navbar's track and its active pill, scaled up into a button */
.connect-stack { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 24px; }
.nf-code { font-size: clamp(110px, 22vw, 230px); font-weight: 800; line-height: 0.85; letter-spacing: -0.06em; color: var(--text); }
.nf-otto { display: block; width: clamp(150px, 22vw, 230px); height: auto; aspect-ratio: 1; margin: 10px auto -18px; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.55)); }
.nf-title { margin: 22px 0 0; font-size: clamp(18px, 2.4vw, 24px); line-height: 1.3; font-weight: 600; letter-spacing: -0.02em; max-width: 26ch; text-wrap: balance; }
.nf-body { margin: 10px 0 0; color: var(--text-2); max-width: 44ch; }
.nf-title + .connect-btn, .nf-body + .connect-btn { margin-top: 32px; }
.connect-btn { display: block; padding: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.025); border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.9); }
.connect-btn > span { position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 28px; border-radius: 999px;
  font-weight: 500; font-size: var(--fs-base); color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.connect-btn svg { height: 18px; width: auto; color: #fff; }
.connect-btn svg:not([viewBox="0 0 142 199"]) { width: 18px; color: var(--accent); filter: drop-shadow(0 0 6px rgba(210, 255, 0, 0.6)); }
.connect-btn:hover > span { background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 2px 14px rgba(210, 255, 0, 0.12); }
.connect-btn:active > span { transform: scale(0.98); }

/* Gym sessions: exercises with sets × reps and the weight to lift */
.lifts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.lift { display: grid; grid-template-columns: minmax(0, 1fr) auto 112px; align-items: center; gap: 10px; padding: 7px 0; }
.lift-name { min-width: 0; }
.lift-sets { color: var(--text-2); font-variant-numeric: tabular-nums; }
.lift-w { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: var(--fs-sm); }
.lift-w .input { width: 82px; text-align: right; }

/* Muscle map: front and back figures, muscles shaded by how hard the session works them */
.muscles { margin: 14px 0 0; }
.muscles-title { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 8px; }
.muscles-figs { display: flex; gap: 10px; justify-content: center; }
.muscles-figs svg { width: 124px; height: auto; flex: none; overflow: visible; }
.muscles polygon { stroke: var(--surface); stroke-width: 0.5; stroke-linejoin: round; transition: fill 0.2s; }
.muscles .mb { fill: var(--surface-3); }
.muscles .mm { fill: #232831; }
.muscles .mm.m1 { fill: rgba(210, 255, 0, 0.38); }
.muscles .mm.m2 { fill: rgba(210, 255, 0, 0.68); }
.muscles .mm.m3 { fill: var(--accent); filter: drop-shadow(0 0 1.5px rgba(210, 255, 0, 0.4)); }

/* ── PWA install prompt (pwa.js) ─────────────────────────────────────────── */
.pwa-install {
  position: fixed; z-index: 60; left: 16px; right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 460px; margin: 0 auto; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); font-size: 14px; color: var(--text);
}
.pwa-install[hidden], [data-pwa-install][hidden] { display: none; }
.pwa-install p { margin: 0; flex: 1; color: var(--text-2); line-height: 1.4; }
.pwa-install p b { color: var(--text); font-weight: 600; }
.pwa-install-btn {
  border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink);
}
.pwa-install-btn:hover { background: var(--accent-hover); }
.pwa-install-close {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 20px; line-height: 1; padding: 4px 6px;
}
.pwa-install-close:hover { color: var(--text); }

/* ── Toasts (navigation-and-failure block; app.js toast()) ───────────────────────────────────── */
.toasts {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
@media (max-width: 760px) { .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); } } /* clear the tab bar */
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 8px 11px 14px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); font-size: var(--fs-sm); line-height: 1.4;
  animation: toast-in 0.28s var(--ease) both;
}
.toast--error { border-color: color-mix(in srgb, var(--serious) 55%, var(--line-2)); }
.toast--ok { border-color: color-mix(in srgb, var(--good) 55%, var(--line-2)); }
.toast-text { flex: 1; min-width: 0; }
.toast-btn, .toast-x {
  flex: none; font: inherit; cursor: pointer; border: 0; border-radius: 8px; background: transparent; color: var(--text);
}
.toast-btn { padding: 6px 10px; font-weight: 700; background: rgba(255, 255, 255, 0.1); }
.toast-btn:hover { background: rgba(255, 255, 255, 0.18); }
.toast-x { width: 28px; height: 28px; font-size: 18px; line-height: 1; color: var(--text-2); }
.toast-x:hover { color: var(--text); }
.toast-btn:focus-visible, .toast-x:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.toast.is-leaving { animation: toast-out 0.2s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.is-leaving { animation: none; } }
/* ── end toasts ──────────────────────────────────────────────────────────────────────────────── */

/* ═══ UX polish / native feel (owner: ux-polish; keep this block self-contained) ═══════════════ */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior-y: contain; }
/* no 300 ms tap delay / double-tap zoom on anything tappable */
a, button, summary, label, select, [role="button"], [data-open], [data-drag], .btn, .icon-btn, .seg a {
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
/* chrome is not text content: no accidental selection / callout on long-press */
.topbar, .nav, .btn, .icon-btn, .seg, .chip, .weekstrip, .log-row, .drow, .log-toggle, summary {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* pressed states */
.btn, .icon-btn, .nav a, .seg a, .drow, .wday, .log-link, .arrow-link, a.card, a.tile {
  transition-property: transform, opacity, background-color, color, border-color, box-shadow;
}
.icon-btn:active, .nav a:active, .seg a:active, .wday:active, .arrow-link:active { transform: scale(0.94); opacity: 0.8; }
.nav a:active svg { transform: scale(0.9); }
.drow:active, a.card:active, a.tile:active { transform: scale(0.985); opacity: 0.9; }
.log-link:active, .log-toggle:active { background: rgba(255, 255, 255, 0.05); }
/* 44px touch targets */
.icon-btn { width: 44px; height: 44px; }
.btn--sm { min-height: 36px; }
.log-toggle { min-width: 44px; }
.seg a { min-height: 40px; display: inline-flex; align-items: center; }
@media (max-width: 760px) {
  .nav a { min-height: 48px; min-width: 44px; }
  .nav a:not([aria-current="page"]) { color: #b4bac5; } /* inactive tabs: >= 7:1 on the bar */
  .btn--sm { min-height: 40px; }
}

/* skeleton loaders: shimmer placeholders for fragments htmx fetches on load */
.skel { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: skel-shimmer 1.4s linear infinite; }
.skel-line { height: 12px; margin: 10px 0; width: 100%; }
.skel-block { height: 140px; border-radius: 14px; margin: 14px 0; }
.skel-card { display: block; }
.adapt-summary .skel-line { margin: 6px 0; }
.adapt-summary:not(.htmx-request) .skel-line { display: none; }  /* request failed or done: don't leave grey bars behind */
@keyframes skel-shimmer { to { background-position: -200% 0; } }
.sheet-done .arrow-link { margin-left: auto; color: var(--accent); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; background: var(--surface-2); }
  .btn:active, .icon-btn:active, .nav a:active, .seg a:active, .wday:active, .arrow-link:active,
  .drow:active, a.card:active, a.tile:active { transform: none; }
  .nav a:active svg { transform: none; }
}
/* ═══ end UX polish ═══════════════════════════════════════════════════════════════════════════ */

/* ── pull to refresh (pwa.js; installed app only) ─────────────────────────────────────────────── */
.ptr {
  position: fixed; z-index: 20; left: 50%; top: calc(var(--topbar) + env(safe-area-inset-top) + 10px);
  width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; opacity: 0; pointer-events: none;
  display: grid; place-items: center; color: var(--text-2);
  background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.ptr svg { width: 18px; height: 18px; transform: rotate(calc(var(--ptr-k, 0) * 270deg)); }
.ptr.is-ready { color: var(--accent); }
.ptr.is-loading { opacity: 1 !important; color: var(--accent); }
.ptr.is-loading svg { animation: ptr-spin 0.8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ptr.is-loading svg { animation-duration: 1.6s; } }

/* Phone browser tab: the page itself never scrolls, <main> does. Otherwise Safari lets the document
   scroll visibly under its own top bar, above our fixed header. The installed app is unaffected. */
@media (max-width: 760px) {
  html.tab-shell, html.tab-shell body { height: 100%; overflow: hidden; }
  html.tab-shell main {
    position: fixed; top: var(--topbar); left: 0; right: 0; bottom: 0; margin: 0; max-width: none;
    overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  }
}
