/*
 * Ink tokens: the only place a colour, face, size or radius is written as a literal. Every
 * other stylesheet uses these custom properties. A colour that differs by theme is one
 * `light-dark()`, so a palette swap touches this file alone. The theme follows the system
 * until the app bar's toggle sets `data-theme` on the root (static/theme.js, ADR-0028).
 * See docs/design/DESIGN_SYSTEM.md §1–§2.
 */
:root {
  color-scheme: light dark;

  /* Ground and surfaces */
  --bg: light-dark(#ffffff, #141416); /* screen ground */
  --elevated: light-dark(#ffffff, #1d1d20); /* the app bar, sticky bars, dialogs */
  --scrim: light-dark(rgba(24, 24, 27, 0.35), rgba(0, 0, 0, 0.55)); /* behind an open drawer */
  --fill: light-dark(#ffffff, #1d1d20); /* cards and tiles */
  --fill-2: light-dark(#f4f4f5, #27272b); /* fields, badges, workout text */
  --fill-hover: light-dark(#ececee, #303035);
  --shimmer: light-dark(
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 0.1)
  ); /* a skeleton's sheen */
  --line: light-dark(#e4e4e7, #2e2e33); /* row hairlines, the day grid's rules */
  --line-2: light-dark(#c9c9cf, #45454c); /* tile and field borders */
  --card-edge: light-dark(#bcbcc2, #4b4b52); /* a workout card's thin edge */
  --track: light-dark(#c9c9cf, #45454c); /* meter track */

  /* Ink */
  --txt: light-dark(#141417, #f5f5f6); /* primary text */
  --dim: light-dark(#505058, #c3c3ca); /* sub-lines, section captions */
  --faint: light-dark(#5c5c64, #acacb4); /* units, captions, hints */
  --chevron: light-dark(#a1a1aa, #71717a);
  --ring: light-dark(#a1a1aa, #71717a); /* unchecked control outline, a hovered edge */
  --edge-on: light-dark(#a1a1aa, #5c5c64); /* a selected thing's edge: one step past a tile's */
  --seg-on: light-dark(#ffffff, #3f3f46); /* the chosen segment's fill, in a .seg's track */
  --seg-on-edge: light-dark(#d4d4d8, #3f3f46); /* its edge: white on a pale track needs one */

  /* Primary: near-black in light, near-white in dark */
  --accent: light-dark(#141417, #f5f5f6); /* primary action, selection, focus, key sessions */
  --accent-dim: light-dark(rgba(20, 20, 23, 0.07), rgba(245, 245, 246, 0.12));
  --ink-accent: light-dark(#ffffff, #141416); /* text on an accent fill */

  /* Signal: real status only, never decoration */
  --green: light-dark(#166534, #4ade80); /* done, on track, ok */
  --green-dim: light-dark(rgba(22, 101, 52, 0.1), rgba(74, 222, 128, 0.13));
  --gold: light-dark(#92400e, #fbbf24); /* needs a look: warnings, pending, partial */
  --gold-dim: light-dark(rgba(180, 83, 9, 0.11), rgba(251, 191, 36, 0.13));
  --warn: light-dark(#b91c1c, #f87171); /* errors, missed */
  --warn-dim: light-dark(rgba(185, 28, 28, 0.08), rgba(248, 113, 113, 0.13));
  --warn-line: light-dark(rgba(185, 28, 28, 0.4), rgba(248, 113, 113, 0.4)); /* Delete's border */
  --decide-wash: light-dark(#fbeec8, #3a2f12); /* a Calendar day waiting on a decision */
  --decide-ink: light-dark(#7a4a00, #fbbf24); /* its warning mark */

  /*
   * Block identity: wherever a block or goal is named, never a state (§1). One shade for both
   * themes, all at one lightness (OKLCH L 0.65), at least 3:1 on white and on the dark ground.
   * Hues clear of the signals: no amber, green or red. Time off's kinds share one grey.
   */
  --block-build: #977ae0;
  --block-maintain: #4c93dc;
  --block-base: #02a49e;
  --block-unstructured: #8590a2;
  --block-travel: #8590a2;
  --block-re-entry: #8590a2;

  /* Day type: a week card's glyph, never a state (ADR-0049) */
  --day-hard: var(--on-chart);
  --day-endurance: rgba(255, 255, 255, 0.55); /* between the white and the unlit bar */
  --day-easy: var(--on-chart-dim);

  /* The chart panel: black in either theme, so zones and rides always read the same */
  --chart-bg: #111113;
  --on-chart: #ffffff; /* the type word, the FTP line, a plan outlined over a ride */
  --on-chart-dim: rgba(255, 255, 255, 0.28); /* an unlit version bar */
  --on-chart-mute: #c3c3ca; /* axis ticks */
  --on-chart-flag: #fbbf24; /* off the plan's version, a short rep */

  /*
   * Power zones Z1–Z7, intervals' zone palette — the workout charts only (§1, ADR-0024):
   * charts/charts.css is the one sheet that uses them.
   */
  --z1: #009e80;
  --z2: #009e00;
  --z3: #ffcb0e;
  --z4: #ff7f0e;
  --z5: #dd0447;
  --z6: #6633cc;
  --z7: #504861;

  /* One face */
  --font-ui: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Type scale (§2): one row per role */
  --fs-screen-title: 1.5rem; /* 24 */
  --fs-brand: 1.125rem; /* 18, the app bar wordmark */
  --fs-section-title: 1.125rem; /* 18 */
  --fs-row-title: 1rem; /* 16 */
  --fs-body: 0.9375rem; /* 15 */
  --fs-value: 1.25rem; /* 20, stat tiles */
  --fs-row-value: 0.9375rem; /* 15 */
  --fs-sub: 0.8125rem; /* 13, sub-lines */
  --fs-caption: 0.8125rem; /* 13, section captions, field labels */
  --fs-micro: 0.75rem; /* 12, badges, stat labels */
  --fs-card-label: 0.625rem; /* 10, a workout card's TIME, TSS and IF */
  /* Tracking for the capitals base.css draws (ADR-0028): the wordmark, a pane row's label. */
  --tracking-wordmark: 0.3em;
  --tracking-label: 0.06em;

  /* Space: a 4px grid */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Shape */
  --radius-s: 4px; /* badges' corners, workout cards */
  --radius: 6px; /* buttons at either size, fields, the current tab */
  --radius-l: 8px; /* tiles, cards */
  --gutter: var(--s-5); /* the screen's side padding; --s-4 at phone width (base.css) */
  --appbar-height: 57px; /* the sticky app bar, its hairline included; two rows on a phone (base.css) */
  --content-width: 72rem;
  --add-panel-width: 19rem; /* Add a block's side pane of inputs (ADR-0049) */
  /* Where Add a block's pane and strip stick: the page's gap left under the app bar. */
  --add-stuck-gap: var(--s-4);
  --add-stuck-top: calc(var(--appbar-height) + var(--add-stuck-gap));
  /*
   * Add a block's sticky strip, which a linked week row clears. An estimate, not a measure: no
   * CSS reads an element's height into a length, and measuring it would take script. A strip
   * that wraps taller (a long name, a plan-back's notes in its head) leaves the top of a
   * linked row under it by the difference.
   */
  --add-strip-height: 9.5rem;
  --add-bars-height: 3.75rem; /* the strip's planned TSS bars */
  --add-bar-gap: 2px; /* between two of the strip's bars */
  /* The session drawer's time in zone: its bar, a legend swatch, a legend entry's least width. */
  --zone-bar-height: 10px;
  --zone-swatch: 8px;
  --zone-legend-min: 8rem;
  --workout-line-label: 7rem; /* the session drawer's Workout: a section name's column */
  /* an eighth of the strip: eight weeks or more fill it (its 100% is the bars' row, where used) */
  --add-bar-max: calc((100% - 7 * var(--add-bar-gap)) / 8);
  /* Add a block's week cards: a card's band, the strip its type word and ↺ sit in, then its glyph */
  --week-card-strip: var(--s-6);
  --week-card-chart: 36px;
  --form-width: 34rem;
  /* A side pane of inputs (pane.tsx, Add a block): one row height and one label column. */
  --pane-row-height: 48px;
  --pane-label-width: 7.25rem;
  --target: 36px; /* minimum control height on a desktop panel */
  --target-s: 32px; /* a small control's: rows, segments, icons, toolbars */
  --mark: 14px; /* a value's marks in a pane row: ‹ ›, − +, ⌄ */
  /* How far a mark's glyph sits in from its target's edge: a pane row's value column reaches
     this far past the row's content, so the marks end where a switch ends. */
  --mark-inset: calc((var(--target-s) - var(--mark)) / 2);
  --select-arrow-half: 5px; /* one half of a select's drawn arrow */

  /* Motion: 150–200ms ease, never a spring */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t-fast: 120ms;
  --t: 180ms;
}
/* The toggle's choice, over the system's. */
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

/*
 * Elements and shared components. Screens compose these; a screen's own stylesheet
 * (screens/*.css) holds only what one screen draws that no other does.
 * Every value comes from tokens.css. See docs/design/DESIGN_SYSTEM.md §3.
 */

/* ── Reset and elements ─────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  /* An in-page link (#new-block, #block-3) lands below the sticky app bar, not under it. */
  scroll-padding-top: calc(var(--appbar-height) + var(--s-3));
  /*
   * Keep the scrollbar's room on every page, so a page that scrolls (Add a block) and one
   * that fits (Athletes) centre the shell on the same line instead of 7.5 px apart.
   */
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  font: 400 var(--fs-body) / 1.55 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection {
  background: var(--accent-dim);
  color: var(--txt);
}

h1,
h2,
h3,
h4 {
  color: var(--txt);
  margin: 0;
  font-weight: 600;
}
h1 {
  font-size: var(--fs-screen-title);
  font-weight: 700;
  line-height: 1.15;
}
h2 {
  font-size: var(--fs-section-title);
  line-height: 1.3;
  margin: var(--s-6) 0 var(--s-3);
}
h3 {
  font-size: var(--fs-row-title);
  font-weight: 600;
  margin: 0 0 var(--s-1);
}
h4 {
  font-size: var(--fs-body);
  font-weight: 600;
}
p {
  margin: var(--s-2) 0;
}
small {
  font-size: var(--fs-sub);
}
strong,
b {
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease);
}
a:hover {
  text-decoration: underline;
}
/* The primary is ink, so a link among words is told by its underline. */
:is(p, dd, .notice, .hint, .row-sub, .doc-body li) a:not([class]) {
  text-decoration: underline;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* A link among words rounds its ring; a button or field keeps its own corners. */
a:not([class]):focus-visible {
  border-radius: var(--radius-s);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--s-6) 0;
}

ul,
ol {
  margin: var(--s-2) 0;
  padding-left: var(--s-5);
}
li + li {
  margin-top: var(--s-1);
}
li::marker {
  color: var(--faint);
}

code,
kbd,
samp {
  font-family: var(--font-ui);
}
pre {
  font-family: var(--font-ui);
  font-size: var(--fs-sub);
  line-height: 1.6;
  color: var(--txt);
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-4);
  margin: var(--s-2) 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── Utilities ──────────────────────────────────────────────────────── */
.muted {
  color: var(--dim);
}
.faint {
  color: var(--faint);
}
.caption {
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--dim);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.scroll {
  overflow-x: auto;
}
.stack {
  display: grid;
  gap: var(--s-3);
}
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.spread {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
}
ul.plain,
ol.plain {
  list-style: none;
  padding: 0;
  margin: var(--s-1) 0;
}

.overline {
  font-size: var(--fs-micro);
  font-weight: 500;
  color: var(--faint);
}
.overline a {
  color: var(--dim);
}
.overline a:hover {
  color: var(--txt);
}

/* ── App shell ──────────────────────────────────────────────────────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--elevated);
  border-bottom: 1px solid var(--line);
}
.appbar-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s-5);
  min-height: calc(var(--appbar-height) - 1px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  font-size: var(--fs-brand);
  --caps-tracking: var(--tracking-wordmark);
  margin-right: calc(-1 * var(--tracking-wordmark)); /* the tracking trails the last letter */
  color: var(--txt);
  text-decoration: none;
  flex: none;
}
/*
 * The one rule in this sheet that writes capitals (ADR-0028): the wordmark's, and a side pane
 * row's label (pane.tsx), each with its own tracking.
 */
.brand,
.pane-label {
  letter-spacing: var(--caps-tracking);
  text-transform: uppercase;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 1.2em;
  height: 1.25em;
  flex: none;
  fill: currentColor;
  /* Centre on the capitals, not the line box: caps sit above it by the descender room. */
  translate: 0 -0.08em;
}
.appbar-context {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.appbar-athlete {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding-left: var(--s-4);
  border-left: 1px solid var(--line-2);
  color: var(--txt);
  font-weight: 600;
  white-space: nowrap;
}
.appbar-athlete:hover {
  color: var(--dim);
  text-decoration: none;
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink-accent);
  font-size: var(--fs-micro);
  font-weight: 700;
}
.avatar::before {
  content: attr(data-initials);
}
/* Beside a row's name: Athletes and the picker. */
.avatar.large {
  width: 32px;
  height: 32px;
  flex: none;
}

/* Tabs: the app bar's athlete sections, and any in-page section switch. */
nav.tabs {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
nav.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 var(--s-3);
  border-radius: var(--radius);
  color: var(--dim);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
nav.tabs a:hover {
  color: var(--txt);
  text-decoration: none;
}
/* The current tab: the chosen segment's raised fill, edged where it sits on white. */
nav.tabs a[aria-current] {
  background: var(--seg-on);
  box-shadow: inset 0 0 0 1px var(--seg-on-edge);
  color: var(--txt);
  font-weight: 700;
}

/* The bell's count, on its corner: what waits on a decision, in red while sync is wrong. */
.follow-up-count {
  position: absolute;
  top: -2px;
  right: -5px;
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  outline: 2px solid var(--elevated);
  background: var(--accent);
  color: var(--ink-accent);
  font-size: var(--fs-micro);
  font-weight: 700;
  line-height: 1;
}
.follow-up-count[data-tone="bad"] {
  background: var(--warn);
}
/* With nothing to count, a dot while sync needs a look; nothing while it doesn't. */
.follow-up-count:empty {
  top: 4px;
  right: 5px;
  min-width: 0;
  width: 8px;
  height: 8px;
  padding: 0;
  background: var(--gold);
}
.follow-up-count:empty[data-tone="bad"] {
  background: var(--warn);
}
.follow-up-count:empty[data-tone="neutral"] {
  display: none;
}
/* The bar's end: the bell, then the operator menu; the menu alone on a page of no athlete. */
.appbar-end {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}

/* A control that is one drawn icon: the app bar's bell and operator menu, the Calendar's
   month steps. */
.icon-btn,
.appbar-bell,
.appbar-operator {
  flex: none;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--target-s);
  height: var(--target-s);
  border-radius: var(--radius);
  color: var(--dim);
  text-decoration: none;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
a.icon-btn:hover,
.appbar-bell:hover,
.appbar-operator:hover {
  background: var(--fill-hover);
  color: var(--txt);
  text-decoration: none;
}
.icon-btn[aria-disabled] {
  color: var(--line-2);
}
/*
 * The operator menu (page.tsx): its trigger, a gear, a button with none of a button's
 * frame; a dot on its corner while intervals needs a look, none while it reads.
 */
.appbar-operator {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
}
.appbar-operator:hover {
  border: 0;
}
.operator-dot {
  display: none;
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  outline: 2px solid var(--elevated);
}
.appbar-operator[data-tone="caution"] .operator-dot {
  display: block;
  background: var(--gold);
}
.appbar-operator[data-tone="bad"] .operator-dot {
  display: block;
  background: var(--warn);
}
/* Its popover, under the trigger's right edge; centred where anchoring isn't supported. */
.operator-menu {
  width: 16rem;
  padding: var(--s-2);
  color: var(--txt);
  background: var(--elevated);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
@supports (position-area: bottom) {
  .operator-menu {
    inset: auto;
    margin: var(--s-1) 0 0;
    position-area: bottom span-left;
  }
}
.operator-head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  margin: 0 0 var(--s-2);
  padding: var(--s-1) var(--s-2) var(--s-2);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sub);
}
.operator-head .num {
  color: var(--faint);
}
/* A row: an icon, its words, and intervals' status dot at the end. */
.operator-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-3);
  width: 100%;
  min-height: var(--target-s);
  padding: var(--s-2);
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--txt);
  font: 500 var(--fs-body) / 1.3 var(--font-ui);
  text-align: left;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease);
}
.operator-row:hover {
  border: 0;
  background: var(--fill-hover);
  text-decoration: none;
}
/* The screen open now: the chosen segment's raised fill, edged on the menu's white. */
.operator-row[aria-current] {
  border: 0;
  background: var(--seg-on);
  box-shadow: inset 0 0 0 1px var(--seg-on-edge);
  text-decoration: none;
}
.operator-row > svg {
  flex: none;
  color: var(--dim);
}
.operator-row-main {
  display: flex;
  flex: 1;
  min-width: 0;
}
/* Sign out posts: its form holds the row and adds nothing to the menu's layout. */
.operator-form {
  display: contents;
}
/* Light or dark: the script shows it, since without the script it can do nothing. */
.operator-row[data-theme-toggle] {
  display: none;
}
:root[data-theme-toggles] .operator-row[data-theme-toggle] {
  display: flex;
}

/* ── Drawer: a panel over the current screen (Follow-ups) ────────────── */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--scrim);
  cursor: pointer;
  view-transition-name: drawer-scrim;
}
dialog.drawer {
  /* The sticky head's height: an anchor in the drawer scrolls clear of it. */
  --drawer-head-height: var(--appbar-height);
  /* Its width, which its action bar (`.drawer-actions`) takes too. */
  --drawer-width: min(30rem, 100%);
  /* What the drawer keeps clear at its end for the action bar. */
  --drawer-bar-reserve: 96px;
  view-transition-name: drawer;
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 21;
  width: var(--drawer-width);
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0 var(--s-5) var(--s-8);
  overflow-y: auto;
  overscroll-behavior: contain;
  color: var(--txt);
  background: var(--elevated);
  border: 0;
  border-left: 1px solid var(--line-2);
}
.drawer-head {
  position: sticky;
  top: 0;
  /* Over a pressed segment (`.seg`, z-index 1) and what a drawer pins under it. */
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--drawer-head-height);
  margin: 0 calc(-1 * var(--s-5));
  padding: 0 var(--s-5);
  background: var(--elevated);
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  margin: 0;
  font-size: var(--fs-section-title);
  outline: none;
}
.drawer-head .trailing {
  color: var(--dim);
  font-size: var(--fs-sub);
}
.drawer-head [data-drawer-close] {
  margin-left: auto;
}
/* Follow-ups opens over a screen's drawer: a name is one element's. */
#follow-up-drawer .drawer-scrim {
  view-transition-name: follow-up-scrim;
  background: none;
}
/* Follow-ups is a small panel under the bell, as tall as what it says, not a side drawer. */
#follow-up-drawer dialog.drawer {
  --drawer-head-height: 48px;
  view-transition-name: follow-ups;
  inset: calc(var(--appbar-height) + var(--s-1))
    max(var(--gutter), calc((100% - var(--content-width)) / 2 + var(--gutter))) auto auto;
  width: min(26rem, calc(100% - 2 * var(--gutter)));
  height: auto;
  max-height: calc(100% - var(--appbar-height) - var(--s-6));
  padding-bottom: var(--s-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
/* Where intervals stands, first in the panel, in one line: its state, Retry, the sync log. */
.follow-up-sync {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  padding: var(--s-3) 0;
  font-size: var(--fs-sub);
}
.follow-up-sync [data-sync-link] {
  margin-left: auto;
}
.follow-up-sync-retry form {
  margin: 0;
}
.follow-ups-none {
  margin: 0;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
}
/* A sentence several items share, said once above them. */
.follow-ups-shared {
  margin: 0;
  padding: var(--s-2) 0;
  border-top: 1px solid var(--line);
}

/*
 * A drawer's motion, on the swaps that ask for it (`DRAWER_SWAP`). The page itself swaps at
 * once. A drawer on one side of the swap slides in or out and its scrim fades; one on
 * both sides stays put and its content crossfades. Without view transitions, an instant swap.
 */
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: var(--t);
  animation-timing-function: var(--ease);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-new(drawer):only-child {
  animation-name: drawer-in;
}
::view-transition-old(drawer):only-child {
  animation-name: drawer-out;
}
::view-transition-new(follow-ups):only-child {
  animation-name: panel-in;
}
::view-transition-old(follow-ups):only-child {
  animation-name: panel-out;
}
@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}
@keyframes drawer-out {
  to {
    transform: translateX(100%);
  }
}
/*
 * A drawer's action bar (`DrawerActions`): fixed along the drawer's foot whatever scrolls
 * behind it, as wide as the drawer, which scrolls its last lines clear of it. A hint, or an
 * armed `ConfirmButton`'s note, on the left; the buttons on the right, Cancel before the
 * commit. With no room beside the hint, the buttons take the next line, still on the right.
 */
dialog.drawer:has(.drawer-actions) {
  padding-bottom: var(--drawer-bar-reserve);
}
.drawer-actions {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  width: var(--drawer-width);
  padding: var(--s-3) var(--s-5);
  background: var(--elevated);
  border-top: 1px solid var(--line);
}
.drawer-actions > .hint {
  flex: 1 1 16rem;
  margin: 0;
}
.drawer-actions > .hint:empty {
  display: none;
}
.drawer-actions-buttons {
  /* After the hint and the armed note, which the bar's scope draws last. */
  order: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}
.drawer-actions form {
  margin: 0;
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(calc(-1 * var(--s-2)));
  }
}
@keyframes panel-out {
  to {
    opacity: 0;
    transform: translateY(calc(-1 * var(--s-2)));
  }
}

/*
 * Follow-ups's items (decided in the panel, #520) and a day's proposals (decided there): a
 * flat row list, each row's two lines, then its answers and its day's link under them.
 */
ul.follow-ups-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.follow-up {
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.follow-up-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.follow-up .row-title {
  display: block;
  margin-top: var(--s-1);
}
.follow-up .row-sub {
  margin: var(--s-1) 0 0;
}
/* Why an answer was refused, or why it can't be given, under the item's two lines. */
.follow-up > [role="alert"],
.follow-up > .hint {
  margin: var(--s-2) 0 0;
}
.follow-up-actions,
.follow-up-actions .decide {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.follow-up-actions .decide {
  margin-top: 0;
}
.follow-up-actions form,
.follow-up-actions form.log {
  margin: 0;
}
/* The decisions are button.small; an Easier-or-Z2 option names its workout, so it
   wraps rather than overflow a phone. */
.follow-up-actions button.small {
  padding-block: var(--s-1);
  white-space: normal;
  text-align: left;
  line-height: 1.3;
}
.follow-up ul[data-replan] {
  margin: var(--s-2) 0 0;
  padding-left: var(--s-5);
  color: var(--dim);
  font-size: var(--fs-sub);
}
/* A follow-up's day, to look at before answering. */
.follow-up-link {
  margin: var(--s-2) 0 0;
  font-size: var(--fs-sub);
}

main.shell {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--s-5) var(--gutter) var(--s-10);
}

/* Page head: overline, title, sub-line, actions on the right. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3) var(--s-6);
  margin-bottom: var(--s-6);
}
.page-head .overline {
  display: block;
  margin-bottom: var(--s-2);
}
.page-head .sub {
  margin: var(--s-2) 0 0;
  color: var(--dim);
}
.page-head .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* ── Sections ───────────────────────────────────────────────────────── */
section.section {
  margin: var(--s-8) 0 0;
}
section.section:first-child {
  margin-top: 0;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  margin: 0;
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--dim);
}
/* A section's one sentence of purpose, under its caption (Section `lead`). */
.section-lead {
  margin: 0 0 var(--s-3);
  max-width: 44rem;
  color: var(--dim);
}
.section-head .trailing {
  font-size: var(--fs-sub);
  color: var(--faint);
}

/* ── Rows: the core idiom (flat, hairline above, no fill) ───────────── */
.rows {
  list-style: none;
  padding: 0;
  margin: 0;
}
.rows > li,
.row {
  display: flex;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.rows > li:first-child {
  border-top: 0;
}
.row-main {
  min-width: 0;
  flex: 1;
}
/* biome-ignore lint/style/noDescendingSpecificity: a follow-up's title above wins on purpose */
.row-title {
  font-size: var(--fs-row-title);
  font-weight: 500;
  color: var(--txt);
}
a.row-title {
  color: var(--txt);
}
/* A name is the row's target: no underline on hover. */
a.row-title:hover {
  text-decoration: none;
}
/* biome-ignore lint/style/noDescendingSpecificity: a follow-up's sub line above wins on purpose */
.row-sub {
  font-size: var(--fs-sub);
  color: var(--dim);
}
.row-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: none;
}
a.row {
  color: inherit;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease);
}
a.row:hover {
  background: var(--fill-hover);
}
.rows > li:has(> a.row) {
  display: block;
  padding: 0;
}
.rows > li > a.row {
  border-top: 0;
}
a.row::after {
  content: "›";
  margin-left: auto;
  color: var(--chevron);
  font-size: 1.4em;
  line-height: 1;
}

/* A menu row (`MenuRow`): a door whose icon on the right stands in for the chevron. */
a.row.menu-row {
  padding-inline: var(--s-2);
}
a.row.menu-row::after {
  content: none;
}
a.row.menu-row .row-main {
  display: flex;
  flex-direction: column;
}
a.row.menu-row .row-end {
  color: var(--dim);
}
a.row.menu-row:hover .row-end {
  color: var(--txt);
}

/* ── Cards: only for bounded tiles ──────────────────────────────────── */
.card,
article.card {
  background: var(--fill);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  padding: var(--s-4);
  min-width: 0;
}
.card[aria-current],
.card.highlighted {
  border-color: var(--edge-on);
}
/* Needs a look: a gold leading rule inside the border. */
.card.caution {
  box-shadow: inset 2px 0 0 var(--gold);
}
/* CardHead: an overline over the title, badges on the right. */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  margin-bottom: var(--s-3);
}
.card-heading {
  min-width: 0;
}
.card-head .overline {
  display: block;
  margin-bottom: var(--s-1);
}
.card-title {
  margin: 0;
  font-size: var(--fs-section-title);
  overflow-wrap: anywhere;
}
.card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-1);
  flex: none;
}
.card-badges .badge {
  margin-left: 0;
}
.cards {
  display: grid;
  gap: var(--s-3);
}
.grid {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}

/* ── Stats: a label over a value ────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--s-3);
  margin: var(--s-3) 0;
}
ul.stats {
  list-style: none;
  padding: 0;
}
ul.stats > li {
  margin: 0;
}
.stat {
  background: var(--fill);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  padding: var(--s-3) var(--s-4);
  display: grid;
  gap: var(--s-1);
  min-width: 0;
}
.stat-label,
dl.facts dt {
  font-size: var(--fs-micro);
  font-weight: 500;
  color: var(--faint);
}
.stat-value {
  font-size: var(--fs-value);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--txt);
  line-height: 1.2;
}
.unit,
.stat-value .unit {
  font-size: var(--fs-micro);
  font-weight: 400;
  color: var(--faint);
  margin-left: 2px;
}
.stat-sub {
  font-size: var(--fs-sub);
  color: var(--dim);
}
dl.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: var(--s-2) var(--s-4);
  margin: var(--s-3) 0;
}
dl.facts dd {
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-row-value);
}

/* ── Badges: small flat tags ────────────────────────────────────────── */
/* biome-ignore lint/style/noDescendingSpecificity: a card's badges above win on purpose */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: 0.1em;
  font-size: var(--fs-micro);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  padding: 3px 7px;
  margin-left: var(--s-1);
  border-radius: var(--radius-s);
  color: var(--dim);
  background: var(--fill-2);
}
.badge.key,
.badge.accent {
  color: var(--accent);
  background: var(--accent-dim);
}
.badge.ok {
  color: var(--green);
  background: var(--green-dim);
}
.badge.caution {
  color: var(--gold);
  background: var(--gold-dim);
}
.badge.bad {
  color: var(--warn);
  background: var(--warn-dim);
}

/* A session as badges (SessionBadges): the key mark, then type and attribute badges. */
.session-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1);
  vertical-align: 0.1em;
}
.session-badges .badge {
  margin-left: 0;
}
.key-mark {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* Status dot before a word: done / pending / missed. */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ring);
  flex: none;
}
.dot.accent {
  background: var(--accent);
}
.dot.ok {
  background: var(--green);
}
.dot.caution {
  background: var(--gold);
}
.dot.bad {
  background: var(--warn);
}
/* A drawn tick: done. Two borders of a turned box, in the text's colour or green. */
.tick {
  display: inline-block;
  width: 4px;
  height: 8px;
  margin: 0 2px 2px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  flex: none;
}
.tick.ok {
  color: var(--green);
}

/* ── Notices: a margin note with a 2px leading rule, never a box ────── */
/* An info note keeps the plain --dim rule: an accent stripe would only decorate. */
.notice,
/* biome-ignore lint/style/noDescendingSpecificity: a follow-up's refusal above wins on purpose */
[role="alert"],
.warning,
.flag {
  border-left: 2px solid var(--dim);
  padding: var(--s-1) 0 var(--s-1) var(--s-3);
  margin: var(--s-4) 0;
  color: var(--txt);
}
.notice > :first-child,
[role="alert"] > :first-child,
.warning > :first-child {
  margin-top: 0;
}
.notice > :last-child,
[role="alert"] > :last-child,
.warning > :last-child {
  margin-bottom: 0;
}
.notice.ok {
  border-left-color: var(--green);
}
.warning,
.flag,
.notice.caution {
  border-left-color: var(--gold);
}
/* biome-ignore lint/style/noDescendingSpecificity: a follow-up's refusal above wins on purpose */
[role="alert"],
.notice.bad {
  border-left-color: var(--warn);
}
[role="alert"] ul,
.warning ul {
  margin: var(--s-1) 0 0;
}
.notice > strong:first-child,
.warning > strong:first-child,
[role="alert"] > strong:first-child {
  display: block;
  font-size: var(--fs-caption);
}
.warning > strong:first-child {
  color: var(--gold);
}
[role="alert"] > strong:first-child {
  color: var(--warn);
}

/* ── Empty state ────────────────────────────────────────────────────── */
.empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-l);
  padding: var(--s-6);
  text-align: center;
  color: var(--dim);
}
.empty > :first-child {
  margin-top: 0;
}
.empty > :last-child {
  margin-bottom: 0;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
button,
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--target);
  padding: 0 var(--s-4);
  font: 500 var(--fs-body) / 1 var(--font-ui);
  color: var(--txt);
  background: var(--fill-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    opacity var(--t-fast) var(--ease);
}
button:hover,
.btn:hover {
  background: var(--fill-hover);
  border-color: var(--ring);
  text-decoration: none;
}
button:disabled,
button[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}
button.primary,
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink-accent);
  font-weight: 700;
}
button.primary:hover,
.btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  opacity: 0.88;
}
button.text,
.btn.text {
  background: none;
  border-color: transparent;
  color: var(--accent);
  padding: 0 var(--s-2);
}
button.text:hover {
  background: var(--fill-hover);
}
button.danger,
.btn.danger {
  --confirm-tone: var(--warn);
  background: none;
  border-color: var(--warn-line);
  color: var(--warn);
}
/* What takes the operator's choice back (a pick's Clear): a plain button until it arms. */
button.undo {
  --confirm-tone: var(--txt);
}
button.danger:hover {
  background: var(--warn-dim);
  border-color: var(--warn);
}
/*
 * A destructive button that asks in place (`ConfirmButton`, ADR-0050): the first click arms
 * it with its armed word, its scope's `ConfirmNote` says what it does, and it fills from the
 * left like a progress bar over `--confirm-fill` (set by the script). Clicks while it fills
 * are ignored; once full (`data-ready`) it stays solid and the second click posts.
 */
/* The text size: a word in a row, no outline until it arms. */
button.danger.text {
  border-color: transparent;
}
.confirm-armed,
button[data-armed] .confirm-idle {
  display: none;
}
button[data-armed] .confirm-armed {
  display: inline;
}
button:is(.danger, .undo)[data-armed] {
  position: relative;
  overflow: hidden;
  border-color: var(--confirm-tone);
  cursor: progress;
}
/* The fill: the armed word inverted on its tone, uncovered left to right over the outline's. */
button:is(.danger, .undo)[data-armed]::before {
  content: attr(data-confirm-armed);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--confirm-tone);
  color: var(--bg);
  animation: confirm-fill var(--confirm-fill, 800ms) linear both;
}
button:is(.danger, .undo)[data-ready] {
  background: var(--confirm-tone);
  color: var(--bg);
  cursor: pointer;
}
button:is(.danger, .undo)[data-ready]::before,
.htmx-request button:is(.danger, .undo)[data-armed]::before {
  display: none;
}
@keyframes confirm-fill {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  button:is(.danger, .undo)[data-armed]::before {
    animation: none;
    clip-path: inset(0 100% 0 0);
  }
}
.confirm-note {
  margin: 0;
}
.form-actions > .confirm-note {
  flex-basis: 100%;
}
.form-actions > .confirm-note:empty {
  display: none;
}

/* biome-ignore lint/style/noDescendingSpecificity: a follow-up's answers above win on purpose */
button.small,
.btn.small {
  min-height: var(--target-s);
  padding: 0 var(--s-3);
  font-size: var(--fs-sub);
}

/* A choice among a few: buttons with aria-pressed, in a row. */
.segmented,
/* biome-ignore lint/style/noDescendingSpecificity: a follow-up's log form above wins on purpose */
form.log {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1);
  margin: var(--s-2) 0 0;
}
button[aria-pressed="true"] {
  background: var(--accent-dim);
  border-color: var(--edge-on);
  color: var(--txt);
}
button[data-suggested] {
  border-color: var(--edge-on);
  border-style: dashed;
}
/*
 * .seg: the choices in one track, the chosen one a raised fill in it. No segment has an
 * edge of its own, so a hover only lifts the words and tints, and nothing stacks.
 */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.seg > button,
.seg > .btn {
  min-height: calc(var(--target-s) - 6px);
  padding: 0 var(--s-3);
  font-size: var(--fs-sub);
  color: var(--dim);
  background: transparent;
  border-color: transparent;
  border-radius: var(--radius-s);
}
.seg > button:hover,
.seg > .btn:hover {
  color: var(--txt);
  background: var(--fill-hover);
  border-color: transparent;
}
.seg > button[data-suggested] {
  border-color: var(--ring);
}
/*
 * The one in force; a segment that links reads the same with no link. Its edge is an inset
 * ring.
 */
.seg > button[aria-pressed="true"],
.seg > .btn[aria-current="true"] {
  color: var(--txt);
  background: var(--seg-on);
  border-color: transparent;
  box-shadow: inset 0 0 0 1px var(--seg-on-edge);
}

/*
 * Stepper (`Stepper`): one value from an ordered list, its readout between a step down and a
 * step up in one .seg track, and a frameless ↺ after it while the value is off its default (in a
 * pane row, inside the track beside the readout).
 */
.stepper-field {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
}
.seg.stepper {
  flex-wrap: nowrap;
  align-items: center;
}
.seg.stepper > button {
  width: var(--target-s);
  padding: 0;
  font-size: var(--fs-body);
  color: var(--txt);
}
.seg.stepper > output {
  min-width: 5.5em;
  padding: 0 var(--s-2);
  text-align: center;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--txt);
}
/* Back to the default: drawn only once the value is off it, an icon with no frame. */
.stepper-reset {
  width: var(--target-s);
  min-height: var(--target-s);
  padding: 0;
  color: var(--dim);
  background: transparent;
  border-color: transparent;
}
.stepper-reset:hover {
  color: var(--txt);
  background: var(--fill-hover);
  border-color: transparent;
}

/* ── Forms ──────────────────────────────────────────────────────────── */
input,
select,
textarea {
  font: 400 var(--fs-body) / 1.4 var(--font-ui);
  color: var(--txt);
  background: var(--fill-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  min-height: var(--target);
  padding: var(--s-2) var(--s-3);
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}
input[type="number"],
input[type="date"],
input[inputmode="numeric"],
input[inputmode="decimal"] {
  font-variant-numeric: tabular-nums;
}
input::placeholder,
textarea::placeholder {
  color: var(--faint);
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--ring);
}
/* A field being typed in: its edge a step up and a soft halo, never a white edge. */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--warn);
}
select {
  appearance: none;
  padding-right: var(--s-8);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input[type="checkbox"],
input[type="radio"] {
  min-height: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  vertical-align: -3px;
}
label {
  color: var(--txt);
}

/* A stacked form: one field per row, label caption above the control. */
form.stack {
  display: grid;
  gap: var(--s-4);
  max-width: var(--form-width);
  margin: var(--s-4) 0;
}
form.stack > label,
.field {
  display: grid;
  gap: 6px;
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--dim);
}
.field > input,
.field > select,
.field > textarea,
form.stack > label > input,
form.stack > label > select {
  font-weight: 400;
}
/* A checkbox or radio label stays a sentence. */
form.stack > label:not(.switch):has(> input[type="checkbox"]),
form.stack > label:has(> input[type="radio"]),
label.check {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font: 400 var(--fs-body) / 1.4 var(--font-ui);
  color: var(--txt);
}
/*
 * A switch (`Switch`): its words, then a 30 by 18 pill at the end with a 12 px knob, off on
 * the field fill, on in the accent. The global reduced-motion rule stops the knob's slide.
 */
label.switch,
form.stack > label.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  font: 400 var(--fs-body) / 1.4 var(--font-ui);
  color: var(--dim);
  cursor: pointer;
}
label.switch:has(> input:checked) {
  color: var(--txt);
}
label.switch:has(> input:disabled) {
  opacity: 0.4;
  cursor: not-allowed;
}
label.switch > input[role="switch"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 30px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--fill-2);
  cursor: inherit;
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}
label.switch > input[role="switch"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--faint);
  transition:
    transform var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}
/* A field's focus ring is its border and glow: a switch shows focus as a ring outside it. */
label.switch > input[role="switch"]:focus {
  border-color: var(--line-2);
  box-shadow: none;
}
label.switch > input[role="switch"]:hover:not(:disabled) {
  border-color: var(--ring);
}
label.switch > input[role="switch"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
label.switch > input[role="switch"]:checked::before {
  transform: translateX(12px);
  background: var(--ink-accent);
}
label.switch > input[role="switch"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* biome-ignore lint/style/noDescendingSpecificity: a stepper is never a form.stack */
form.stack > button,
.form-actions {
  justify-self: start;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
/* biome-ignore lint/style/noDescendingSpecificity: the drawer bar's hint above wins on purpose */
.hint,
.prefill {
  font-size: var(--fs-sub);
  font-weight: 400;
  color: var(--faint);
  margin: 0;
}

.value-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 2px var(--s-3);
  min-width: 0;
  margin-left: auto;
  font-size: var(--fs-sub);
  font-weight: 400;
  color: var(--faint);
}
.value-sources:empty {
  display: none;
}
form.log > .value-sources {
  flex-basis: 100%;
  justify-content: flex-start;
  margin-left: 0;
}
button.value-source {
  display: inline;
  min-height: 0;
  padding: 0;
  font-size: var(--fs-sub);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* The reset needs value-source.js: without it the field is typed by hand. */
html:not(.value-source-live) button.value-source {
  display: none;
}

fieldset {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  padding: var(--s-4);
  margin: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--s-3);
}
legend {
  padding: 0 var(--s-2);
  margin-left: calc(-1 * var(--s-2));
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--dim);
}
/* biome-ignore lint/style/noDescendingSpecificity: a label's parent is a fieldset or a form, not both */
fieldset > label {
  display: grid;
  gap: 6px;
  font-size: var(--fs-sub);
  color: var(--dim);
}
/* Controls line up when one label wraps; a captioned Field keeps its caption on top. */
/* biome-ignore lint/style/noDescendingSpecificity: a label's parent is a fieldset or a form, not both */
fieldset > label {
  align-content: end;
}
fieldset > .field {
  align-content: start;
}
fieldset > label > :is(input, select),
.field > :is(input, select) {
  width: 100%;
  min-width: 0;
}
fieldset > :is(.hint, .prefill) {
  grid-column: 1 / -1;
}

/*
 * Setting rows (`SettingRow`, Settings): the name over its sub-line, the control at the
 * row's end, one width for text and one for numbers so the controls line up. A narrow row
 * puts its end under the name rather than squeeze it.
 */
.setting-rows > li.setting-row {
  flex-wrap: wrap;
}
/* biome-ignore lint/style/noDescendingSpecificity: a menu row is never a setting row */
.setting-row .row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 12rem;
}
.setting-row .row-end input {
  width: 16rem;
}
.setting-row .row-end input[type="number"] {
  width: 8rem;
}
@media (max-width: 640px) {
  .setting-row .row-main {
    flex-basis: 8rem;
  }
  .setting-row .row-end input:not([type="number"]) {
    width: 12rem;
  }
}
.setting-rows > li.setting-note {
  display: block;
  border-top: 0;
  padding-top: 0;
}

/* ── Disclosure ─────────────────────────────────────────────────────── */
details {
  border-top: 1px solid var(--line);
  padding: var(--s-2) 0;
}
summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--dim);
  font-weight: 500;
  min-height: 28px;
}
summary::-webkit-details-marker {
  display: none;
}
summary::before {
  content: "›";
  display: inline-block;
  width: 1ch;
  color: var(--faint);
  font-size: 1.2em;
  transition: transform var(--t) var(--ease);
}
details[open] > summary::before {
  transform: rotate(90deg);
}
summary:hover {
  color: var(--txt);
}

/* ── Tables: hairline rows, a quiet header ───────────────────────────── */
table {
  border-collapse: collapse;
  width: 100%;
}
th {
  font-size: var(--fs-micro);
  font-weight: 500;
  color: var(--faint);
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
td {
  padding: var(--s-3);
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}
tbody th {
  font: 500 var(--fs-body) / 1.5 var(--font-ui);
  color: var(--txt);
  padding: var(--s-3);
  border-bottom: 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
th:first-child,
td:first-child {
  padding-left: 0;
}
th:last-child,
td:last-child {
  padding-right: 0;
}
tbody tr {
  transition: background var(--t-fast) var(--ease);
}
tbody tr:hover {
  background: var(--fill-hover);
}
td.num,
th.num {
  text-align: right;
}
table.plain {
  width: auto;
}
table.plain td,
table.plain th {
  padding: var(--s-2) var(--s-5) var(--s-2) 0;
}
/* No rule above the first row: after table.plain th, which it out-ranks. */
tbody tr:first-child > th,
tr:first-child > td {
  border-top: 0;
}

/* ── Meter: a progress bar ──────────────────────────────────────────── */
.meter {
  height: 6px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
}
.meter > span {
  display: block;
  width: var(--meter, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--t) var(--ease);
}

/* ── Next step: one sentence and the one action, at a screen's foot ── */
.next-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  margin: var(--s-8) 0 0;
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  background: var(--fill-2);
}
.next-step-text {
  min-width: 0;
  flex: 1 1 18rem;
}
.next-step-text .overline {
  color: var(--accent);
}
.next-step-text p {
  margin: var(--s-1) 0 0;
}

/* ── Term: a word to hover, its note in the glyph tooltip (ADR-0022) ── */
button.term {
  /* The words around it decide its face, case and tracking: in a pane label, its capitals. */
  all: unset;
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
  cursor: help;
}
button.term:hover {
  color: var(--txt);
}
button.term:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}

/* ── Status line: a Dot, then the sentence ──────────────────────────── */
.status {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}
.status > .dot {
  transform: translateY(-1px);
}

/* A list of checks or notes, each a Dot then the sentence (Season, a race's replan). */
ul.checks {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.checks > li {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: 0;
  padding: var(--s-1) 0;
}
ul.checks .dot {
  transform: translateY(-1px);
}

/* ── A change: <del>before</del> <ins>after</ins> ───────────────────── */
del {
  color: var(--faint);
  text-decoration-color: var(--faint);
}
ins {
  text-decoration: none;
  color: var(--gold);
}
ins::before {
  content: "→ ";
  color: var(--faint);
}

/* ── Lede: a screen's intro paragraph ───────────────────────────────── */
.lede {
  max-width: 48rem;
  margin: 0 0 var(--s-8);
  color: var(--dim);
}

/* ── Poll line (polling.tsx): the last intervals read and Refresh ───── */
.poll-line {
  margin: calc(-1 * var(--s-2)) 0 var(--s-6);
}
.poll-line > [role="alert"] {
  margin: 0 0 var(--s-3);
}
.poll-line > form.poll {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  margin: 0;
}
.poll-line [data-poll-status] {
  font-size: var(--fs-sub);
  color: var(--dim);
  min-width: 0;
}

/* ── htmx ───────────────────────────────────────────────────────────── */
.htmx-request button[type="submit"],
button.htmx-request {
  opacity: 0.6;
  pointer-events: none;
}
/* A post that waits on intervals: its button is the progress (`PendingLabel`). */
.pending-label {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.htmx-request button:has(.pending-label) {
  opacity: 1;
}
.htmx-request .pending-word {
  display: none;
}
.htmx-request .pending-label::before {
  content: "";
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: pending-spin 0.7s linear infinite;
}
.htmx-request .pending-label::after {
  content: attr(data-pending);
}
@keyframes pending-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: var(--s-4);
    --appbar-height: 90px;
  }
  /* No athlete, no tabs row: the bar is the brand row alone. */
  :root:not(:has(.appbar nav.tabs)) {
    --appbar-height: 49px;
  }
  /*
   * Two rows on a phone: the brand, athlete, bell and operator menu; then the tabs full
   * width. Sticky bars under the app bar (the Calendar's toolbar) and in-page links read
   * the height.
   */
  .appbar-inner {
    flex-wrap: wrap;
    gap: 0 var(--s-3);
  }
  .brand {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
  }
  .appbar-context {
    display: contents;
  }
  .appbar-athlete {
    min-height: 48px;
    min-width: 0;
    padding-left: var(--s-3);
  }
  .appbar-end {
    gap: 0;
  }
  dialog.drawer {
    --drawer-head-height: 56px;
    padding: 0 var(--gutter) var(--s-8);
    border-left: 0;
  }
  .drawer-actions {
    padding: var(--s-3) var(--gutter);
  }
  .drawer-head {
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter);
  }
  .appbar-context nav.tabs {
    order: 3;
    flex: 1 0 100%;
    height: 41px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 calc(var(--gutter) - var(--s-3));
    border-top: 1px solid var(--line);
  }
  main.shell {
    padding-top: var(--s-5);
    padding-bottom: var(--s-8);
  }
  /* Thumb-sized on a phone: dense controls grow, together. */
  :root {
    --target-s: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    /* biome-ignore lint/complexity/noImportantStyles: reduced motion must beat every rule's motion */
    transition: none !important;
  }
  /* The button's word still says it is writing. */
  .htmx-request .pending-label::before {
    animation: none;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    /* biome-ignore lint/complexity/noImportantStyles: reduced motion must beat every rule's motion */
    animation: none !important;
  }
}

/*
 * A document of Docs (docs.tsx): the switch and `DocContents` beside its sections on a
 * wide screen, above them on a phone. `DocTable`s stack into labelled rows at phone width.
 */

.doc {
  display: grid;
  grid-template-columns: 14.5rem minmax(0, 1fr);
  gap: var(--s-10);
  align-items: start;
}

/* The switch and the contents: sticky under the app bar while the topics scroll. */
.doc-side {
  position: sticky;
  top: calc(var(--appbar-height) + var(--s-6));
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  max-height: calc(100vh - var(--appbar-height) - var(--s-6) * 2);
}
.doc-toc {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.doc-toc ol {
  list-style: none;
  padding: 0;
  margin: var(--s-1) 0 0;
  border-left: 1px solid var(--line-2);
}
.doc-toc ol + .caption {
  display: block;
  margin-top: var(--s-3);
}
/* biome-ignore lint/style/noDescendingSpecificity: the Docs contents are never ul.stats */
.doc-toc li {
  margin: 0;
}
/* biome-ignore lint/style/noDescendingSpecificity: the Docs contents are never in nav.tabs */
.doc-toc a {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  color: var(--dim);
  text-decoration: none;
}
/* biome-ignore lint/style/noDescendingSpecificity: the Docs contents are never in nav.tabs */
.doc-toc a:hover {
  color: var(--txt);
}
.doc-toc-aside {
  flex: none;
  font-size: var(--fs-sub);
  color: var(--faint);
}
/* A section's parts: a row each under it, indented, on the same rule. */
.doc-toc ol ol {
  margin: 0;
  border-left: 0;
}
.doc-toc ol ol a {
  padding: 2px var(--s-3) 2px var(--s-6);
  font-size: var(--fs-sub);
  color: var(--faint);
}
.doc-toc ol ol a:hover {
  color: var(--txt);
}
/* The place being read (doc-contents.js), its mark on the contents' rule. */
/* biome-ignore lint/style/noDescendingSpecificity: the Docs contents are never in nav.tabs */
.doc-toc a[aria-current] {
  color: var(--txt);
  box-shadow: -1px 0 0 var(--edge-on);
}
.doc-toc li:has(> ol a[aria-current]) > a {
  color: var(--txt);
}

/* A topic: its prose at a reading width. */
.doc-sections > section.section:first-child {
  margin-top: 0;
}
.doc-body {
  max-width: 46rem;
  line-height: 1.6;
}
.doc-body h3 {
  margin-top: var(--s-6);
}
.doc-body ul,
/* biome-ignore lint/style/noDescendingSpecificity: the Docs body is never inside its contents */
.doc-body ol {
  padding-left: var(--s-5);
}
.doc-body .notice {
  margin-top: var(--s-5);
}
.doc-body .notice p {
  margin: var(--s-1) 0 0;
}

.doc-table {
  margin: var(--s-4) 0;
}
.doc-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}
.doc-table tbody tr:hover {
  background: none;
}
/* A version's workout under its reps. */
.doc-table .workout-shape {
  height: 2.5rem;
  margin-top: var(--s-1);
}

@media (max-width: 640px) {
  .doc {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-6);
  }
  .doc-side {
    position: static;
    max-height: none;
  }
  .doc-toc {
    overflow: visible;
  }
  .doc-toc ol {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    border-left: 0;
  }
  .doc-toc li + li {
    margin-top: 0;
  }
  .doc-toc a {
    padding: var(--s-1) var(--s-3);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-s);
    font-size: var(--fs-sub);
  }
  /* A section's parts wrap in the same row of links as the sections. */
  .doc-toc li:has(> ol),
  .doc-toc ol ol {
    display: contents;
  }
  .doc-toc ol ol a {
    padding: var(--s-1) var(--s-3);
  }
  .doc-toc a[aria-current] {
    box-shadow: none;
  }

  /* Each row becomes a small block: the first cell as its title, the rest labelled. */
  .doc-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .doc-table tr {
    display: block;
    padding: var(--s-3) 0;
    border-top: 1px solid var(--line);
  }
  .doc-table td {
    display: block;
    padding: var(--s-1) 0;
    border: 0;
  }
  .doc-table td:first-child {
    white-space: normal;
  }
  .doc-table td + td::before {
    content: attr(data-label) " · ";
    font-size: var(--fs-micro);
    color: var(--faint);
  }
}

/* ── Side pane and strip (pane.tsx `SidePane`, ui.tsx `FactGroup`) ─────────── */
/*
 * Add a block's frame (ADR-0049), which the block page (ADR-0058) and the session drawer
 * (#648) draw too: the side pane of inputs, and the strip over the main area. A screen
 * lays them out (its grid, where they stick, its narrow width) in its own sheet.
 */
/*
 * The side pane: its header, then its inputs (a screen that sticks the pane and caps its
 * height scrolls them on their own), then its foot (Add, Cancel), always in reach at its bottom.
 */
.add-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  background: var(--bg);
}
.add-pane-head {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}
.add-pane-head .page-head {
  flex-wrap: nowrap;
  align-items: baseline;
  margin: 0;
}
.add-pane-head :is(h1, h2) {
  margin: 0;
  font-size: var(--fs-row-title);
}
.add-pane-head button.text {
  min-height: 0;
  padding: 0;
  font-size: var(--fs-micro);
}
.add-pane-head [data-step-help] {
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.add-pane-body {
  flex: 1 1 auto;
  min-height: 0;
}
.add-pane-foot {
  border-radius: 0 0 var(--radius-l) var(--radius-l);
  background: var(--bg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
}
/* The head is the block's axis bar: its rule over a title and a line. */
.add-plan-head {
  display: grid;
  gap: 2px;
  padding-top: var(--s-2);
  border-top: 3px solid var(--block, var(--line-2));
}
/*
 * The strip: one summary under a rule in the block's colour (`--block`), which runs its full
 * width: the head, the figures on one row, then what the screen draws under them.
 */
.add-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
  padding: var(--s-2) 0;
  border-top: 3px solid var(--block, var(--line-2));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
/*
 * In the strip the rule is the strip's: the name, larger than the rest, and its dates on one
 * line, then any line the length leaves out under them.
 */
.add-strip .add-plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--s-3);
  padding-top: 0;
  border-top: 0;
}
.add-strip .add-plan-head p.hint {
  flex-basis: 100%;
  font-size: var(--fs-micro);
}
.add-plan-head h2 {
  margin: 0;
  font-size: var(--fs-row-title);
}
.add-strip .add-plan-head h2 {
  font-size: var(--fs-screen-title);
  line-height: 1.2;
}
/* biome-ignore lint/style/noDescendingSpecificity: a strip's head is never a Docs page's notice (.doc-body .notice) */
.add-plan-head p {
  font-size: var(--fs-caption);
}
.add-plan-head p:not(.hint) {
  color: var(--dim);
}
/*
 * The strip's first line: the head, and at its end the block's planned TSS, so the line says
 * what the block is, when, and how much load it plans.
 */
.add-strip-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-1) var(--s-4);
}
.add-strip-top > .add-plan-head {
  flex: 1 1 auto;
  min-width: 0;
}
/* The strip's figures: a small caption, then each figure, its value then its name. */
.add-fact-group {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}
.add-fact-group dl {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin: 0;
}
.add-fact-group dl > div {
  display: flex;
  flex-direction: row-reverse;
  align-items: baseline;
  gap: var(--s-1);
}
/* biome-ignore lint/style/noDescendingSpecificity: a strip's figures are never a dl.facts */
.add-fact-group dt {
  font-size: var(--fs-micro);
  color: var(--faint);
  white-space: nowrap;
}
/* biome-ignore lint/style/noDescendingSpecificity: a strip's figures are never a dl.facts */
.add-fact-group dd {
  margin: 0;
  font-size: var(--fs-row-value);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--txt);
}

/* ── Side pane rows (pane.tsx): a label column, then the value or control ─ */
/*
 * Rows sit in `.pane-rows`, a hairline between each. `.pane-row-note` is a line under a row
 * (a warning, a row's sub-choices): it joins the row above with no hairline of its own.
 */
.pane-row {
  display: grid;
  grid-template-columns: var(--pane-label-width) minmax(0, 1fr);
  align-items: center;
  gap: var(--s-2);
  min-height: var(--pane-row-height);
  padding: var(--s-1) var(--s-4);
}
.pane-label {
  --caps-tracking: var(--tracking-label);
  font-size: var(--fs-micro);
  font-weight: 600;
  color: var(--faint);
  white-space: nowrap;
}
.pane-row-content {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  min-width: 0;
}
.pane-row[data-pane-row="control"] > .pane-row-content {
  justify-content: center;
}
.pane-row-note {
  padding: 0 var(--s-4) var(--s-3);
  font-size: var(--fs-micro);
}
.pane-row-note:empty {
  display: none;
}
.pane-rows > * + *:not(:empty) {
  border-top: 1px solid var(--line);
}
.pane-rows > .pane-row-note {
  border-top: 0;
}
/* An answer as a switch: its sentence muted, on or off. */
label.switch.pane-switch,
label.switch.pane-switch:has(> input:checked) {
  font-size: var(--fs-micro);
  color: var(--faint);
}

/*
 * The swiper (`Swiper`, `SelectSwiper`): one option at a time in a track one option wide that
 * snaps per option, ‹ › either side and a tick per option under it. The island
 * (static/season.js) steps it and sets the real field; without script it is the radios as a
 * row, or the select, and the arrows and ticks go.
 */
.swiper {
  display: grid;
  grid-template-columns: var(--target-s) minmax(0, 1fr) var(--target-s);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: var(--s-1);
  row-gap: 2px;
  width: 100%;
  /* A wide row (a pane at full width) keeps ‹ and › near the value they step. */
  max-width: 18rem;
  min-width: 0;
}
.swiper-step {
  grid-row: 1;
  min-height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
}
.swiper-step:hover:not(:disabled) {
  border-color: transparent;
  background: var(--fill-hover);
  color: var(--txt);
}
.swiper-step:disabled {
  opacity: 1;
  color: var(--chevron);
  cursor: default;
}
/* The drawn chevron points down: turned, it is ‹ and ›. */
.swiper-step[data-swiper-step="-1"] > svg {
  rotate: 90deg;
}
.swiper-step[data-swiper-step="1"] > svg {
  rotate: -90deg;
}
.swiper-track {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  cursor: grab;
  user-select: none;
  touch-action: pan-x;
}
.swiper-track::-webkit-scrollbar {
  display: none;
}
.swiper[data-dragging] .swiper-track {
  scroll-snap-type: none;
  cursor: grabbing;
}
.swiper-option {
  position: relative;
  flex: 0 0 100%;
  display: grid;
  place-items: center;
  min-width: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  cursor: inherit;
}
/* The picked option shows from the first paint, before the island has run. */
.swiper-option:has(> input:checked),
.swiper-option[data-at] {
  /* biome-ignore lint/correctness/noUnknownProperty: CSS Scroll Snap 2's scroll-initial-target (Chrome 133+), newer than Biome's property list */
  scroll-initial-target: nearest;
}
.swiper .swiper-option > input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.swiper-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-sub);
  font-weight: 600;
  line-height: 1.5;
  color: var(--txt);
}
/* A locked swiper holds its one value (ADR-0049 decision 1): dim, with no marks. */
.swiper[data-locked] .swiper-text {
  color: var(--dim);
}
.swiper[data-locked] :is(.swiper-step, .swiper-ticks) {
  visibility: hidden;
}
.swiper-option:has(> input:focus-visible) > .swiper-text,
.swiper:has(.swiper-select select:focus-visible) .swiper-option[data-at] > .swiper-text {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}
.swiper-ticks {
  grid-row: 2;
  grid-column: 2;
  display: flex;
  justify-content: center;
  gap: var(--s-1);
}
.swiper-ticks > i {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-2);
  transition:
    width var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}
/* The active tick: the shown option's accent (a goal's block colour), else the ink. */
.swiper-ticks > i[data-on] {
  width: 16px;
  background: var(--swiper-accent, var(--txt));
}
/*
 * A link swiper (`LinkSwiper`): its steps are links to the options either side, so its track
 * holds the one option shown and neither scrolls nor drags.
 */
.swiper.link-swiper > .swiper-track {
  overflow: visible;
  scroll-snap-type: none;
  cursor: auto;
  user-select: auto;
  touch-action: auto;
}
/* A select swiper's select: in the form, out of sight, still the field the form sends. */
.swiper-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/*
 * Without the island (no script, or a script that didn't run): a swiper over a field
 * (`[data-swiper]`) is the real field. A link swiper has no field and keeps its look. `:where`
 * keeps each rule as specific as the look it undoes.
 */
:root:not(.pane-live) [data-swiper] {
  display: flex;
  justify-content: center;
}
:root:not(.pane-live) :where([data-swiper]) > .swiper-step,
:root:not(.pane-live) :where([data-swiper]) > .swiper-ticks {
  display: none;
}
:root:not(.pane-live) :where([data-swiper]) > .swiper-track {
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-1) var(--s-3);
  overflow: visible;
  scroll-snap-type: none;
  cursor: auto;
}
:root:not(.pane-live) :where([data-swiper]) .swiper-option {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
:root:not(.pane-live) [data-swiper] .swiper-option > input {
  position: static;
  opacity: 1;
  pointer-events: auto;
}
:root:not(.pane-live) .swiper[data-swiper="select"] > .swiper-track {
  display: none;
}
:root:not(.pane-live) .swiper-select {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
}

/*
 * A day as a chip (`DateChip`): a button, "Mon 1 Feb" and a caret, the real date input lying
 * under it unseen; a press on the button opens the input's picker (the island). Locked: dashed,
 * no caret. A blank that means a day shows that day, drawn as any picked day: its hidden note
 * says it is a default. Without script the button goes and the input shows instead.
 */
.date-chip {
  position: relative;
  display: inline-flex;
}
.date-chip-face {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  min-height: var(--target-s);
  padding: 0 var(--s-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--fill-2);
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--txt);
  white-space: nowrap;
  cursor: pointer;
}
.date-chip-caret {
  display: inline-grid;
  color: var(--dim);
}
/* Under the face, where the browser's picker anchors; the face takes the pointer. */
.date-chip input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.date-chip-face:disabled {
  border-style: dashed;
  background: none;
  color: var(--dim);
  cursor: default;
  opacity: 1;
}
.date-chip-face:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.date-chip-face:hover:not(:disabled) {
  border-color: var(--ring);
  background: var(--fill-hover);
}
/* Without the island (no script, or a script that didn't run): the real field. */
:root:not(.pane-live) .date-chip-face {
  display: none;
}
:root:not(.pane-live) .date-chip input[type="date"] {
  position: static;
  width: auto;
  height: auto;
  min-height: var(--target-s);
  padding: 0 var(--s-2);
  border: 1px solid var(--line-2);
  opacity: 1;
  pointer-events: auto;
}
/* The input's focus, when a browser can't open the picker and the input takes typing instead. */
.date-chip:has(input:focus) .date-chip-face {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/*
 * A pane row's value (ADR-0049 as amended 2026-11-10, week cards): no box. A swiper, a stepper
 * and a date chip fill one value column, the row's content and one mark's inset (`--mark-inset`)
 * past it either side, their value centred and their marks (‹ ›, − +, ⌄) at the column's edges,
 * so the glyphs end where a switch and the Settings link end. Every mark is `--mark` in `--dim`
 * on a `--target-s` target, a `--fill-hover` pill behind what takes the press on hover and
 * nothing at rest; a step that can't go on is `--chevron`, as a swiper's. A locked value is dim
 * with no marks. Outside a pane row a stepper and a date chip keep their box.
 */
.pane-row-content > :is(.swiper, .stepper-field, .date-chip) {
  flex: none;
  width: calc(100% + 2 * var(--mark-inset));
  max-width: none;
  margin-inline: calc(-1 * var(--mark-inset));
}
/* A swiper's ticks hang under its value, out of the row's centring: the value sits on its label's line. */
.pane-live .pane-row .swiper,
.pane-row .link-swiper {
  grid-template-rows: auto 0;
}
.pane-live .pane-row .swiper-ticks,
.pane-row .link-swiper > .swiper-ticks {
  align-self: start;
}
.pane-row .seg.stepper {
  flex: 1;
  justify-content: space-between;
  gap: 0;
  padding: 0;
  border: 0;
  background: none;
}
.pane-row .seg.stepper > button {
  width: var(--target-s);
  min-height: var(--target-s);
  color: var(--dim);
  border-radius: var(--radius);
}
.pane-row .seg.stepper > button > svg {
  width: var(--mark);
  height: var(--mark);
}
.pane-row .seg.stepper > button:hover:not(:disabled) {
  color: var(--txt);
  background: var(--fill-hover);
}
.pane-row .seg.stepper > button:disabled {
  color: var(--chevron);
  background: none;
  cursor: default;
  opacity: 1;
}
.pane-row .seg.stepper > output {
  min-width: 0;
  padding: 0 var(--s-1);
  font-size: var(--fs-sub);
}
/*
 * Off its default, the ↺ sits between the value and + (`resetAt` `value`: "− 12 wk ↺ +"): − and +
 * keep the column's edges, and the value and its ↺ are centred between them as one.
 */
.pane-row .seg.stepper:has(> .stepper-reset) > output {
  margin-left: auto;
  white-space: nowrap;
}
.pane-row .seg.stepper > .stepper-reset {
  margin-right: auto;
}
/*
 * A locked stepper (a build a race day shortened, a block page's row that can't change, ADR-0049
 * decision 1): its value dim, with no marks.
 */
.pane-row .stepper-field[data-locked] .seg.stepper > button {
  visibility: hidden;
}
.pane-row .stepper-field[data-locked] .seg.stepper > output {
  color: var(--dim);
}
/* The face fills the column, its caret at the end (`button`: outranks the chip's focus rule above). */
.pane-row-content > .date-chip > button.date-chip-face {
  flex: 1;
  justify-content: center;
  padding: 0 var(--target-s);
  border: 0;
  background: none;
}
.pane-row .date-chip-face:hover:not(:disabled) {
  background: var(--fill-hover);
}
.pane-row .date-chip-caret {
  position: absolute;
  right: var(--mark-inset);
}

/*
 * The Follow-ups drawer's notices and refusals: last, after every notice and alert rule
 * it out-ranks, so the file reads in rising specificity (noDescendingSpecificity).
 */
#follow-up-drawer .notice,
#follow-up-drawer [data-follow-up-refusals] [role="alert"] {
  margin: var(--s-2) 0 var(--s-3);
}

/*
 * Calendar week rows (calendar-rows.tsx): a component sheet, joined after base.css,
 * since two screens draw the rows: the Calendar, and the Add a block preview (#268),
 * which draws them read only. A week's seven ruled day columns, each its date over its
 * cards (a block's start, races, time off, rest, sessions and rides), then its summary
 * square: the block week, its time and TSS done over planned, and a bar. What only the
 * Calendar draws around them (the sticky toolbar and month heads, its drawers) stays in
 * screens/calendar.css. Every rule is scoped under the rows' `.cal-weeks` wrapper, so it
 * weighs what the Calendar's own scoped rules did.
 */
.cal-weeks {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/*
 * A week: its seven days, then its summary square (TrainerRoad's and intervals'): the
 * block week, the template's note, its time and TSS done over planned, and a bar of the
 * two. A hairline above and below the row, and before the square.
 */
.cal-weeks .cal-week {
  display: grid;
  --cal-sum-width: 8.5rem;
  grid-template-columns: minmax(0, 1fr) var(--cal-sum-width);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  container: cal-week / inline-size;
}
/*
 * Weeks run on as one grid. What sits between them (a month head, the notices, a
 * sentinel) keeps a space of its own above it, and so does the week after it.
 */
.cal-weeks > * + :not(.cal-week),
.cal-weeks > :not(.cal-week) + .cal-week {
  margin-top: var(--s-3);
}
/* A week with no summary square (Add a block's preview): the days take the row. */
.cal-weeks .cal-week[data-summary="none"] {
  grid-template-columns: minmax(0, 1fr);
}
/* A single hairline between two weeks. */
.cal-weeks .cal-week + .cal-week {
  border-top: 0;
}
.cal-weeks .cal-week-sum {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
  padding: var(--s-2);
  border-left: 1px solid var(--line);
  font-size: var(--fs-caption);
}
.cal-weeks .cal-week-label {
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--dim);
}
/* Recovery, deload, test, taper and re-entry weeks: the label says so a little louder. */
.cal-weeks .cal-week:not([data-week-kind="load"]):not([data-week-kind="none"]) .cal-week-label {
  color: var(--txt);
}
.cal-weeks a.cal-week-label:hover {
  color: var(--txt);
  text-decoration: none;
}
.cal-weeks .cal-week-note {
  margin: 0;
  font-size: var(--fs-caption);
}
/* Time and TSS, done / planned: the term faint over its figures. */
.cal-weeks dl.cal-week-totals {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  margin: 0;
}
.cal-weeks dl.cal-week-totals dt {
  color: var(--faint);
}
.cal-weeks dl.cal-week-totals dd {
  margin: 0;
  font-size: var(--fs-sub);
  font-weight: 600;
  white-space: nowrap;
}
.cal-weeks .cal-week-bar .meter {
  height: 6px;
  border-radius: 999px;
}

/* The days: ruled columns, no gaps. */
.cal-weeks ol.cal-days {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  /* Session and ride cards one height: the chart panel, a title line, the stats. */
  --cal-card-height: 10.5rem;
  /* The grid's own width decides how tight a card sets: beside a side panel, or on a tablet. */
  container: cal-days / inline-size;
}

/*
 * A day: a column, not a card. Its date labels it; the workout is the card. Today is a
 * faint wash behind the whole column.
 */
.cal-weeks .cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 2px var(--s-1) var(--s-1);
}
.cal-weeks .cal-day + .cal-day {
  border-left: 1px solid var(--line);
}
.cal-weeks .cal-day[aria-current="date"] {
  background: var(--accent-dim);
}
.cal-weeks .cal-day-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  min-height: 1.5rem;
  padding: 0 var(--s-1);
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--txt);
}
.cal-weeks .cal-flags {
  min-width: 0;
  overflow: hidden;
  font-size: var(--fs-micro);
  font-weight: 400;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--dim);
}

/*
 * The whole day is one target: the date's link stretches over the column, under the cards
 * and the day's other links, so a click on empty space opens the day menu (#460), what
 * can be added to the day. Under the cards, spare room with a "+" for that, shown on
 * hover and focus. Only where the day links: Add a block's preview reads as text.
 */
.cal-weeks .cal-day-link {
  flex: none;
  white-space: nowrap;
  color: inherit;
}
.cal-weeks a.cal-day-link:hover {
  color: inherit;
  text-decoration: none;
}
.cal-weeks a.cal-day-link::after {
  content: "+" / "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--s-2);
  color: var(--dim);
  font-size: var(--fs-value);
  font-weight: 500;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.cal-weeks .cal-day:hover a.cal-day-link::after,
.cal-weeks a.cal-day-link:focus-visible::after {
  opacity: 1;
}
.cal-weeks .cal-day:has(a.cal-day-link) {
  padding-bottom: var(--s-10);
  transition: background var(--t-fast) var(--ease);
}
.cal-weeks .cal-day:has(a.cal-day-link):hover {
  background: var(--fill-hover);
}
/* The link's focus ring goes round the column it stretches over. */
.cal-weeks a.cal-day-link:focus-visible {
  outline: none;
}
.cal-weeks .cal-day:has(a.cal-day-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/*
 * A proposal about the day (#258): the column turns pale yellow, hover included, with a
 * warning mark beside the date, the question in its title, a link to where it is decided.
 * It never sits on a card. The one colour outside charts on the Calendar.
 */
.cal-weeks .cal-day:has(.cal-decision),
.cal-weeks .cal-day:has(.cal-decision):hover {
  background: var(--decide-wash);
}
.cal-weeks .cal-day:has(.cal-decision) .cal-day-head {
  padding-inline: var(--s-6);
}
.cal-weeks a.cal-decision {
  position: absolute;
  z-index: 2;
  top: 3px;
  right: var(--s-1);
  display: grid;
  width: 1.375rem;
  height: 1.375rem;
  color: var(--decide-ink);
}
.cal-weeks a.cal-decision svg {
  width: 100%;
  height: 100%;
}

/*
 * A card (`.cal-card[data-cal-card]`): a session, a ride no session takes, a race, time
 * away. White, a thin grey edge, the chart panel across its top: the zones are a card's
 * only colour, a key session's included. A session or ride is one height; a race or time
 * away, with no chart, only as tall as its words. An optional one and time away are
 * dashed. A rest day has no card, only the word.
 */
.cal-weeks .cal-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: var(--cal-card-height);
  min-width: 0;
  overflow: hidden;
  background: var(--fill);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-s);
  transition: border-color var(--t-fast) var(--ease);
}
.cal-weeks .cal-card:is([data-optional], [data-cal-card="away"]) {
  border-style: dashed;
}
/* A race or time away has no chart: its words take the height they need. */
.cal-weeks .cal-card:is([data-cal-card="race"], [data-cal-card="away"], [data-cal-card="block"]) {
  height: auto;
  padding-bottom: var(--s-2);
}
/* A block start card's length, under its title. */
.cal-weeks .cal-card-sub {
  margin: 0;
  padding: 0 var(--s-2);
  font-size: var(--fs-caption);
}
/*
 * A card that opens nothing of its own (time away, rest, a race on intervals): a click
 * falls through to the day under it (#466).
 */
.cal-weeks .cal-card[data-falls-through] {
  pointer-events: none;
}
/* A planned day with nothing to ride: the word alone. */
.cal-weeks .cal-card[data-cal-card="rest"] {
  justify-content: center;
  align-items: center;
  background: none;
  border: 0;
}
/*
 * A card still being read (the Calendar's skeleton): a card's height and edge, the band
 * and lines in grey, a sheen sweeping over them until the read lands. A later day's sheen
 * starts a beat later, so it runs along the week as one wave. Grey, not the chart's black:
 * a black band reads as a card with nothing on it.
 */
.cal-weeks .cal-card[data-cal-card="loading"] {
  border-color: var(--line-2);
}
.cal-weeks .cal-card[data-cal-card="loading"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 25%, var(--shimmer) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: cal-loading 1.3s ease-in-out infinite;
}
.cal-weeks .cal-day:nth-child(2) .cal-card[data-cal-card="loading"]::after {
  animation-delay: 80ms;
}
.cal-weeks .cal-day:nth-child(3) .cal-card[data-cal-card="loading"]::after {
  animation-delay: 160ms;
}
.cal-weeks .cal-day:nth-child(4) .cal-card[data-cal-card="loading"]::after {
  animation-delay: 240ms;
}
.cal-weeks .cal-day:nth-child(5) .cal-card[data-cal-card="loading"]::after {
  animation-delay: 320ms;
}
.cal-weeks .cal-day:nth-child(6) .cal-card[data-cal-card="loading"]::after {
  animation-delay: 400ms;
}
.cal-weeks .cal-day:nth-child(7) .cal-card[data-cal-card="loading"]::after {
  animation-delay: 480ms;
}
.cal-weeks .cal-band.cal-loading-band {
  background: var(--fill-hover);
}
.cal-weeks .cal-loading-lines {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-2);
}
.cal-weeks .cal-loading-lines i {
  height: 10px;
  width: 80%;
  background: var(--fill-hover);
  border-radius: var(--radius-s);
}
.cal-weeks .cal-loading-lines i:first-child {
  width: 55%;
}
@keyframes cal-loading {
  to {
    transform: translateX(100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cal-weeks .cal-card[data-cal-card="loading"]::after {
    animation: none;
  }
}
/* The type word, over the chart panel; heading a race's or time away's card. */
.cal-weeks .cal-type {
  font-size: var(--fs-sub);
  font-weight: 700;
  line-height: 1.3;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-weeks .cal-card > .cal-type {
  padding: var(--s-2) var(--s-2) 0;
}
/*
 * The chart panel: black in either theme, the type word in white in its top strip
 * (--cal-type-strip), the chart under it (--cal-chart-height).
 */
.cal-weeks .cal-band {
  --cal-type-strip: 26px;
  --cal-chart-height: 72px;
  position: relative;
  flex: none;
  height: calc(var(--cal-type-strip) + var(--cal-chart-height));
  padding-top: var(--cal-type-strip);
  background: var(--chart-bg);
}
.cal-weeks .cal-band .cal-type {
  position: absolute;
  top: 6px;
  left: var(--s-2);
  right: var(--s-2);
  color: var(--on-chart);
}
/*
 * A Calendar card's strip lays its word and marks in a row. Only a card's: Add a block's
 * week card band keeps a bare word, which ends in an ellipsis only as a block.
 */
.cal-weeks .cal-card .cal-band .cal-type {
  display: flex;
  align-items: center;
}
.cal-weeks .cal-card[data-calendar-race="A"] .cal-type {
  color: var(--accent);
}
.cal-weeks .cal-band .cal-type:has(.cal-version) {
  padding-right: var(--s-6);
}
.cal-weeks .cal-band .workout-shape {
  display: block;
  height: var(--cal-chart-height);
}
/*
 * A card's marks after its type word: Extra's tag (ADR-0048), outlined, and an outdoor
 * ride's route (ADR-0055), in the word's white. Never a colour. In the strip the word
 * gives way first, so a long type word ends in an ellipsis and the marks stay whole.
 */
.cal-weeks .cal-type-word {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-weeks .cal-tag {
  flex: none;
  margin-left: var(--s-1);
  padding: 0 var(--s-1);
  border: 1px solid var(--on-chart-mute);
  border-radius: var(--radius);
  font-size: var(--fs-micro);
  font-weight: 600;
}
.cal-weeks .cal-glyph {
  display: inline-flex;
  flex: none;
  margin-left: var(--s-1);
}
/*
 * What a session is ridden as: four version bars in the panel's corner, Easier, Planned
 * and Harder rising like a signal, then Reduced, the planned level shortened, as tall as
 * Planned and set apart. The day's pick is lit, the rest dimmed; none lit, a Z2 ride
 * instead. The lit bar is amber when it isn't the plan's version. Lifted over the card's link, so its
 * title shows on a hover.
 */
.cal-weeks .cal-version {
  --lit: var(--on-chart);
  --unlit: var(--on-chart-dim);
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
}
.cal-weeks .cal-version[data-off-plan] {
  --lit: var(--on-chart-flag);
}
.cal-weeks .cal-version-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}
.cal-weeks .cal-version-bars i {
  width: 4px;
  height: 10px;
  background: var(--unlit);
}
.cal-weeks .cal-version-bars i[data-bar="easier"] {
  height: 6px;
}
.cal-weeks .cal-version-bars i[data-bar="harder"] {
  height: 14px;
}
.cal-weeks .cal-version-bars i[data-bar="reduced"] {
  margin-left: 3px;
}
.cal-weeks .cal-version-bars i[data-lit] {
  background: var(--lit);
}
/* A plan no ride answered fades. */
.cal-weeks
  .cal-card:is(
    [data-outcome="missed"],
    [data-outcome="not-ridden"],
    [data-outcome="not-paired"],
    [data-outcome="excused"]
  )
  .workout-shape {
  opacity: 0.35;
}
.cal-weeks .cal-title-row {
  --cal-title-line: 1.25;
  display: flex;
  align-items: flex-start;
  gap: var(--s-1);
  min-width: 0;
}
.cal-weeks .cal-title {
  flex: 1;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 6px var(--s-2) 0;
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: var(--cal-title-line);
  color: var(--txt);
  overflow-wrap: anywhere;
}
/* A rest card's title: the word alone. */
.cal-weeks .cal-card[data-cal-card="rest"] .cal-title {
  flex: none;
  padding: 0;
  font-weight: 400;
}
/* A ride's title stays on one line: the card's stats need the room. */
.cal-weeks .cal-card:is([data-cal-card="session"], [data-cal-card="ride"]) .cal-title {
  -webkit-line-clamp: 1;
}
.cal-weeks .cal-card[data-cal-card="away"] .cal-title {
  font-weight: 400;
}
/*
 * The whole card opens its drawer (#265, #459, #466): a session's, a ride's or a race's
 * added in Rensei. The title's link stretches over the card. Lifted over the link: the
 * chart, so the chart cursor (#264) still reads it, and the mark, so its words show on a
 * hover. A click on either is passed to the link (static/calendar-cards.js).
 */
.cal-weeks a.cal-title::after {
  content: "";
  position: absolute;
  inset: 0;
}
.cal-weeks .cal-card :is(a:not(.cal-title), .workout-shape, .cal-mark) {
  position: relative;
  z-index: 1;
}
/* The chart and glyphs pass a click to the title's link (static/calendar-cards.js). */
.cal-weeks .cal-card:has(a.cal-title) :is(.workout-shape, .cal-mark, .cal-version) {
  cursor: pointer;
}
/* Only a card that opens something answers a pointer: its edge one step up. */
.cal-weeks .cal-card:has(a.cal-title):hover {
  border-color: var(--edge-on);
}
/* The edge says the card opens; the title isn't a link of its own, so it never underlines. */
.cal-weeks a.cal-title:hover {
  text-decoration: none;
}
/* The link's focus ring goes round the card it stretches over. */
.cal-weeks a.cal-title:focus-visible {
  outline: none;
}
.cal-weeks .cal-card:has(a.cal-title:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* The ride's mark by the title: a tick once ridden, else a dot in the outcome's tone. */
.cal-weeks .cal-mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 1.5rem;
  margin: var(--s-1) var(--s-2) 0 0;
}
.cal-weeks .cal-mark .dot {
  margin: 0;
}
/* Time / TSS / IF: the plan's, or once a ride answers it the ride's. */
.cal-weeks dl.cal-card-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: var(--s-1);
  margin: auto 0 6px;
  padding: 0 var(--s-2);
}
.cal-weeks .cal-card-stats div {
  min-width: 0;
}
/* biome-ignore lint/style/noDescendingSpecificity: a card's stats are never a week's totals */
.cal-weeks .cal-card-stats dd {
  margin: 0;
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: 1.2;
  color: var(--txt);
  white-space: nowrap;
}
/* A plan no ride answered: its stats go faint too. */
.cal-weeks
  .cal-card:is(
    [data-outcome="missed"],
    [data-outcome="not-ridden"],
    [data-outcome="not-paired"],
    [data-outcome="excused"]
  )
  .cal-card-stats
  dd {
  color: var(--faint);
}
/* The one uppercase in the language: the reference's small bold stat labels. */
/* biome-ignore lint/style/noDescendingSpecificity: a card's stats are never a week's totals */
.cal-weeks .cal-card-stats dt {
  font-size: var(--fs-card-label);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--txt);
}

/*
 * Narrow columns, as Add a block's week rows draw beside its panel: smaller type, a
 * shorter chart and tighter stats, so a title takes two lines and all three stats fit. Not on a phone, where
 * the days are a list at full width.
 */
@media (min-width: 761px) {
  @container cal-days (max-width: 58rem) {
    .cal-weeks .cal-band {
      --cal-chart-height: 56px;
    }
    .cal-weeks .cal-card .cal-title,
    .cal-weeks .cal-card:is([data-cal-card="session"], [data-cal-card="ride"]) .cal-title {
      -webkit-line-clamp: 2;
      font-size: var(--fs-sub);
    }
    .cal-weeks .cal-card-stats dd {
      font-size: var(--fs-sub);
    }
    /* Half the side padding, so the three stats keep a gap in a 6rem card. */
    .cal-weeks dl.cal-card-stats {
      padding: 0 var(--s-1);
    }
  }
}

/*
 * A phone: the days of each week as a list, a rule between them. The spare room and the
 * "+" stay, always shown. A rest or empty day is one line, its "+" at the line's end.
 */
@media (max-width: 760px) {
  .cal-weeks .cal-week {
    grid-template-columns: minmax(0, 1fr);
  }
  /* The summary square becomes a line under the week's days. */
  .cal-weeks .cal-week-sum {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: var(--s-4);
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .cal-weeks dl.cal-week-totals {
    flex-direction: row;
    gap: var(--s-4);
  }
  .cal-weeks dl.cal-week-totals > div {
    display: flex;
    gap: var(--s-1);
  }
  .cal-weeks .cal-week-bar {
    display: none;
  }
  .cal-weeks ol.cal-days {
    grid-template-columns: minmax(0, 1fr);
  }
  .cal-weeks .cal-day + .cal-day {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .cal-weeks .cal-day-head {
    justify-content: flex-start;
  }
  .cal-weeks .cal-day:has(.cal-decision) .cal-day-head {
    padding-inline: var(--s-1) var(--s-6);
  }
  .cal-weeks .cal-day:has(a.cal-day-link) {
    padding-bottom: var(--s-8);
  }
  .cal-weeks a.cal-day-link::after {
    opacity: 1;
  }
  .cal-weeks :is(.cal-day.rest, .cal-day.unplanned),
  .cal-weeks :is(.cal-day.rest, .cal-day.unplanned):has(a.cal-day-link) {
    flex-direction: row;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-1);
  }
  .cal-weeks .cal-day.rest a.cal-day-link::after,
  .cal-weeks .cal-day.unplanned a.cal-day-link::after {
    align-items: center;
    justify-content: flex-end;
    padding: 0 var(--s-3);
  }
  .cal-weeks .cal-card[data-cal-card="rest"] {
    height: auto;
  }
}

/*
 * The workout charts' own sheet (charts/workout-shape.tsx, charts/ride-profile.tsx), joined
 * after base.css. The only stylesheet that uses the zone tokens (ADR-0024): bar colour
 * means intensity and nothing else, so a key session's bars look like anyone's. Every
 * workout chart is a black panel, in either theme, so zones and rides always read the same.
 * DESIGN_SYSTEM §1 and §3 Workout shape.
 */

/*
 * A planned workout's shape: a bar per step, its height the % FTP, its colour the
 * athlete's power zone as intervals has it (`data-zone`, z1…z7). The FTP line crosses
 * every shape at 100%.
 */
.workout-shape {
  display: block;
  width: 100%;
  height: 28px;
  background: var(--chart-bg);
}
/*
 * A zone's colour as `--zone`, one table for both hooks: a shape's bar (`data-zone`) and what
 * draws a ride's zones beside its chart rather than in it (`data-zone-colour`: the session
 * strip's rule in the ride's main zone, time in zone's bar and legend, #648).
 */
:is([data-zone="z1"], [data-zone-colour="z1"]) {
  --zone: var(--z1);
}
:is([data-zone="z2"], [data-zone-colour="z2"]) {
  --zone: var(--z2);
}
:is([data-zone="z3"], [data-zone-colour="z3"]) {
  --zone: var(--z3);
}
:is([data-zone="z4"], [data-zone-colour="z4"]) {
  --zone: var(--z4);
}
:is([data-zone="z5"], [data-zone-colour="z5"]) {
  --zone: var(--z5);
}
:is([data-zone="z6"], [data-zone-colour="z6"]) {
  --zone: var(--z6);
}
:is([data-zone="z7"], [data-zone-colour="z7"]) {
  --zone: var(--z7);
}
.workout-shape [data-zone] {
  fill: var(--zone);
}
.workout-shape [data-ftp-line] {
  stroke: var(--on-chart);
  stroke-opacity: 0.6;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

/*
 * The ride profile (charts/ride-profile.tsx, ADR-0024 decision 5): every interval row of a
 * ride a bar in its zone, like a planned step, against the target band. A row narrower than
 * a pixel still draws 1 px wide: the SVG stretches, so the minimum is a stroke in the
 * step's own colour that doesn't scale with it. A short rep, as the plan core names it,
 * needs a look: amber over its zone. A plan over the ride is an outline only, no fill.
 */
.workout-shape:has([data-ride-profile]) {
  height: 40px;
}
.workout-shape [data-target-band] {
  fill: var(--on-chart);
  fill-opacity: 0.18;
}
.workout-shape [data-ride-step] {
  stroke: var(--zone);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}
.workout-shape [data-ride-step][data-short] {
  --zone: var(--on-chart-flag);
}
.workout-shape [data-plan-outline] [data-zone] {
  fill: none;
  stroke: var(--on-chart);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

/*
 * The session drawer's main chart (charts/workout-chart.tsx): the shape drawn large, the FTP
 * line's label at its right end (no other power line, #648), the time axis under it. The labels are HTML over the plot, placed by `--y` and `--x` (a
 * share of the plot's height and width): text in the stretched SVG would stretch too.
 */
.workout-chart {
  margin: 0;
  min-width: 0;
}
.workout-chart-plot {
  position: relative;
}
.workout-chart .workout-shape,
.workout-chart .workout-shape:has([data-ride-profile]) {
  height: 160px;
}
.workout-chart-ftp {
  position: absolute;
  top: var(--y);
  margin: 0;
  padding-bottom: 2px;
  font-size: var(--fs-micro);
  line-height: 1;
  transform: translateY(-100%);
  pointer-events: none;
}
.workout-chart-ftp {
  right: 2px;
  font-weight: 600;
  color: var(--on-chart);
}
/* A label sits on the panel's black, so it reads over any zone's fill. */
.workout-chart-ftp {
  padding: 1px 3px;
  background: var(--chart-bg);
  border-radius: var(--radius-s);
}
.workout-chart-time {
  position: relative;
  height: 1.4em;
  list-style: none;
  margin: var(--s-1) 0 0;
  padding: 0;
  font-size: var(--fs-micro);
  color: var(--faint);
}
.workout-chart-time > li {
  position: absolute;
  left: var(--x);
  margin: 0;
  white-space: nowrap;
  transform: translateX(-50%);
}
.workout-chart-time > li:first-child {
  transform: none;
}
.workout-chart-time > li:last-child:not(:first-child) {
  transform: translateX(-100%);
}

/*
 * The cursor (static/charts.js, #264, ADR-0024): a crosshair at the time under the
 * pointer and a tooltip above the chart. The script draws both only once the pointer is
 * on a chart; without it, every step keeps its native title.
 */
.workout-shape [data-cursor] {
  stroke: var(--on-chart);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.chart-tip {
  position: fixed;
  left: var(--tip-x, 0);
  top: var(--tip-y, 0);
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
  background: var(--elevated);
  color: var(--txt);
  font-size: var(--fs-sub);
  white-space: nowrap;
  pointer-events: none;
}
.chart-tip[data-open] {
  display: flex;
}
.chart-tip .chart-tip-time {
  font-weight: 600;
}
.chart-tip .chart-tip-sub {
  color: var(--dim);
}
/* A term's line in force (static/glyph-tip.js): its name bold, the line at full strength. */
.chart-tip .chart-tip-sub[data-on] {
  color: var(--txt);
}
.chart-tip .chart-tip-sub strong {
  font-weight: 600;
}

/*
 * The picker (athlete-picker.tsx, #498): intervals' athletes as rows, on Connect intervals
 * and Add athletes, so scoped under the picker rather than one screen. Each row's label
 * holds the tick, the avatar and the name over the intervals id; the access pill sits at
 * its end. See docs/design/DESIGN_SYSTEM.md; tokens only.
 */
[data-picker] label.pick {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
[data-picker] [data-pickable="false"] label.pick {
  cursor: default;
}
[data-picker] label.pick .row-main {
  display: flex;
  flex-direction: column;
}
[data-picker] [data-pickable="false"] .row-title {
  color: var(--dim);
}

/*
 * The Athletes screen: the overview as a triage list (status, block and week, sync).
 * See docs/design/DESIGN_SYSTEM.md; tokens only.
 */

/* The athlete cell: an avatar whose initials CSS draws, so the cell reads as the name. */
[data-screen="athletes"] .overview [data-cell="athlete"] a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--txt);
  font-weight: 600;
  white-space: nowrap;
}
/* The name, the block and the week are the row's way in: no underline on hover. */
[data-screen="athletes"] .overview [data-cell="athlete"] a:hover {
  text-decoration: none;
}
[data-screen="athletes"] .overview td,
[data-screen="athletes"] .overview tbody th {
  vertical-align: middle;
}

/* Status: a dot and the word, then why on the line under it, lined up with the word. */
[data-screen="athletes"] .overview [data-cell="status"] {
  min-width: 10rem;
}
[data-screen="athletes"] .triage {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: var(--s-2);
  row-gap: var(--s-1);
  white-space: nowrap;
}
[data-screen="athletes"] [data-status-label] {
  font-weight: 500;
}
[data-screen="athletes"] .triage [data-status-why] {
  grid-column: 2;
  margin: 0;
}
[data-screen="athletes"] [data-cell="status"] a[data-status-why] {
  color: var(--accent);
}

/* The block cell: its title and week, each a link in primary ink, the progress under it. */
[data-screen="athletes"] .overview [data-cell="block"] {
  min-width: 12rem;
}
/* biome-ignore lint/style/noDescendingSpecificity: the block cell is never the athlete cell */
[data-screen="athletes"] [data-cell="block"] a {
  color: var(--txt);
}
/* biome-ignore lint/style/noDescendingSpecificity: the block cell is never the athlete cell */
[data-screen="athletes"] [data-cell="block"] a:hover {
  text-decoration: none;
}
[data-screen="athletes"] .block-name {
  font-weight: 500;
}
[data-screen="athletes"] [data-cell="block"] a.num {
  font-size: var(--fs-sub);
  color: var(--dim);
}
[data-screen="athletes"] [data-cell="block"] .meter {
  height: 8px;
  margin-top: var(--s-2);
  max-width: 12rem;
  border-radius: 999px;
}

/* Sync: the app bar's pill, as it reads there. */
[data-screen="athletes"] .overview [data-cell="sync"] {
  white-space: nowrap;
  font-size: var(--fs-sub);
}

/*
 * On a phone each athlete is a small block: the name and status on a line, then the block
 * and week, then the sync pill. The header stays for a screen reader.
 */
@media (max-width: 640px) {
  [data-screen="athletes"] .overview,
  [data-screen="athletes"] .overview tbody {
    display: block;
  }
  [data-screen="athletes"] .overview thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  [data-screen="athletes"] .overview tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--s-2) var(--s-4);
    padding: var(--s-3) 0;
    border-top: 1px solid var(--line);
  }
  [data-screen="athletes"] .overview tr:first-child {
    border-top: 0;
  }
  [data-screen="athletes"] .overview :is(th, td) {
    padding: 0;
    border: 0;
  }
  [data-screen="athletes"] .overview [data-cell="status"] {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
  [data-screen="athletes"] .overview :is([data-cell="block"], [data-cell="sync"]) {
    grid-column: 1 / -1;
  }
}

/*
 * The Calendar (calendar.tsx): week rows Monday to Sunday, a day cell per date. On a
 * phone the rows become a list of days grouped by week, and rest days shrink to a line.
 *
 * The rows themselves (week, day and session cells) are shared with the Add a block
 * preview, so they live in styles/calendar-rows.css; this sheet holds what only the
 * Calendar draws.
 *
 * The rows scroll continuously under a sticky toolbar (#262), the one place that shows
 * Today, the pager and the picker. Its month is the first row's until a month's head, a
 * plain title before that month's first week, scrolls under it; then it draws that head's
 * bar (month-bar.js). The first row's own head stays hidden: the toolbar already says it.
 *
 * The toolbar's invariant, which every rule below keeps:
 * - its month (.cal-range) is --cal-title-width wide (21rem; the full width on a phone) and
 *   --cal-bar high, and Today, the two steps and the longest month ("September 2026") must
 *   fit that width at its font size;
 * - stacking: the toolbar is z-index 3, over the rows' z-index 2. A picker is a popover, so
 *   it sits above them all;
 * - it sticks at --appbar-height, which must match the app bar's real height.
 */
[data-screen="calendar"] {
  --cal-bar: 48px;
  --cal-title-width: 21rem;
}

/* The skeleton's wrapper draws no box: the screen in it lays out as it does without. */
[data-screen="calendar"] .cal-loading {
  display: contents;
}
/* With no head to scroll past, the toolbar starts where it ends up, stuck to the app bar. */
[data-screen="calendar"] .cal-loading > .cal-toolbar:first-child {
  margin-top: calc(-1 * var(--s-6));
}

[data-screen="calendar"] .cal-toolbar {
  position: sticky;
  top: var(--appbar-height);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  height: var(--cal-bar);
  margin-bottom: var(--s-2);
  background: var(--bg);
}
/* The block the view is in, after the month: quieter than it, cut short when tight. */
[data-screen="calendar"] .cal-block-now {
  min-width: 0;
  overflow: hidden;
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--dim);
  white-space: nowrap;
  text-overflow: ellipsis;
}
[data-screen="calendar"] .cal-block-now[hidden] {
  display: none;
}
[data-screen="calendar"] a.cal-block-now:hover {
  color: var(--txt);
  text-decoration: none;
}
[data-screen="calendar"] .cal-range,
[data-screen="calendar"] .cal-month {
  height: var(--cal-bar);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-section-title);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
[data-screen="calendar"] .cal-range {
  width: var(--cal-title-width);
  background: var(--bg);
}
/* The slot for a head scrolled past: empty it draws nothing, filled it replaces the first row's month. */
[data-screen="calendar"] .cal-range:empty,
[data-screen="calendar"] .cal-range:not(:empty) ~ .cal-range {
  display: none;
}
/* Today and the title, which opens the picker: a heading's look, with a control's hover. */
[data-screen="calendar"] .cal-month-title {
  margin: 0;
  font-size: inherit;
}
[data-screen="calendar"] .cal-today,
[data-screen="calendar"] .cal-month-title button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--target-s);
  padding: 0 var(--s-2);
  font: inherit;
  color: var(--txt);
  background: none;
  border: 0;
  border-radius: var(--radius);
  transition: background var(--t-fast) var(--ease);
}
[data-screen="calendar"] .cal-today:hover,
[data-screen="calendar"] .cal-month-title button:hover {
  text-decoration: none;
  background: var(--fill-hover);
}
[data-screen="calendar"] .cal-month-title svg {
  color: var(--dim);
}
/* Today is the bar's one button: a soft fill, no line, on the rows' left edge. */
[data-screen="calendar"] .cal-today {
  padding: 0 var(--s-3);
  background: var(--fill-2);
}
/*
 * A shown head keeps its space above (the margin reset above would take it), and sits
 * right on its first week. A hidden one (below) leaves its week the space it would have
 * with no head: none at the top, else what follows a notice or a sentinel.
 */
[data-screen="calendar"] .cal-weeks > .cal-month {
  margin-top: var(--s-3);
}
/* Loading weeks above scrolls the old first row back under the toolbar, not beneath it. */
[data-screen="calendar"] .cal-week,
[data-screen="calendar"] .cal-notices {
  scroll-margin-top: calc(var(--cal-bar) - var(--s-2));
}
[data-screen="calendar"] .cal-week ~ .cal-month + .cal-week,
[data-screen="calendar"] .cal-month:first-child + .cal-week {
  margin-top: 0;
}
/*
 * A head with no week above it names the first row, as the title does, so only the title
 * shows; it returns once weeks load above it. The title stays because a first row in the
 * middle of a month has no head.
 */
[data-screen="calendar"] .cal-month:not(.cal-week ~ *) {
  display: none;
}
/* What the Calendar says, just above the week it opens on. */
[data-screen="calendar"] .cal-notices {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
[data-screen="calendar"] .cal-notices > * {
  margin: 0;
}
/* A sentinel: a line htmx watches for, loading the next weeks once it is in view. */
[data-screen="calendar"] .cal-more {
  height: 1px;
}
/*
 * The line above the first week (calendar-history.tsx): a quiet button that reads further
 * back, where the held history starts beside it, and a failed read's error under both.
 */
[data-screen="calendar"] .cal-history {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-3);
  padding: var(--s-2) 0;
}
[data-screen="calendar"] .cal-history > form {
  margin: 0;
}
[data-screen="calendar"] .cal-history > [role="alert"] {
  flex-basis: 100%;
  margin: 0;
}
/*
 * The month picker: each year as a grid of twelve, in a popover under the month's title.
 * Where anchoring isn't supported the browser centres it, as a popover's default.
 */
[data-screen="calendar"] .cal-picker {
  width: 17rem;
  padding: var(--s-3);
  color: var(--txt);
  background: var(--elevated);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
@supports (position-area: bottom) {
  [data-screen="calendar"] .cal-picker {
    inset: auto;
    margin: var(--s-1) 0 0;
    position-area: bottom span-right;
    position-try-fallbacks: flip-inline;
  }
}
[data-screen="calendar"] .cal-picker section + section {
  margin-top: var(--s-3);
}
[data-screen="calendar"] .cal-picker .caption {
  margin: 0 0 var(--s-1);
}
[data-screen="calendar"] .cal-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
[data-screen="calendar"] .cal-months a,
[data-screen="calendar"] .cal-months span {
  display: block;
  padding: var(--s-2) 0;
  font-size: var(--fs-sub);
  text-align: center;
  color: var(--txt);
  border-radius: var(--radius-s);
  transition: background var(--t-fast) var(--ease);
}
[data-screen="calendar"] .cal-months span {
  color: var(--faint);
}
[data-screen="calendar"] .cal-months a:hover {
  text-decoration: none;
  background: var(--fill-hover);
}
/* The month in view: a raised fill, as a chosen segment's. */
[data-screen="calendar"] .cal-months a[aria-current] {
  font-weight: 700;
  color: var(--txt);
  background: var(--seg-on);
  /* The picker is white in light, so the raised fill needs its edge to show. */
  box-shadow: inset 0 0 0 1px var(--seg-on-edge);
}

/*
 * The day menu (day-menu.tsx), the session drawer (session-drawer.tsx) and the ride drawer
 * (ride-drawer.tsx), drawers over the Calendar: the proposals about the day, the session
 * or the ride; the session with every version and its ride's evidence, a ride no session
 * took with its own; in the day menu, its add rows and "How was the day?".
 */
[data-screen="calendar"]
  :is([data-drawer="day-menu"], [data-drawer="session"], [data-drawer="ride"])
  .section {
  margin-top: var(--s-4);
}
/* A session's section in its drawer, and a ride's in its own (`.ride-section`). */
[data-screen="calendar"] :is(.day-session, .ride-section) {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line);
  /* An anchor to a session clears the drawer's sticky head. */
  scroll-margin-top: calc(var(--drawer-head-height) + var(--s-2));
}
/* What a draft swaps (`slotSwap`): no box of its own, so the section lays out its rows. */
[data-screen="calendar"] .day-session-workout {
  display: contents;
}
[data-screen="calendar"] :is(.day-session-head, .ride-section-head) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
[data-screen="calendar"] :is(.day-session, .ride-section) p {
  margin: 0;
}
/*
 * A session's workout (session-workout.tsx, extra-session-workout.tsx, #265): the main
 * chart, an extra session's with its planned stats beside it and its step text folded under
 * Steps. The session and ride drawers, and Add workout's picker (#528), are wider than the
 * other drawers so the chart, and a ride's interval table, reads like a training app's.
 */
[data-screen="calendar"]
  dialog.drawer:is([data-drawer="session"], [data-drawer="ride"], [data-drawer="add-workout"]) {
  --drawer-width: min(40rem, 100%);
}
/*
 * The session drawer (#648) takes Add a block's layout: wider, on the page's ground, the ride
 * on the left (the strip, then the rest of it) and, while it takes a pick, Add a block's side
 * pane on the right, stuck under the drawer's head, its top level with the strip's rule. The
 * section's own s-4 is the gap under the head, as Add a block's under the app bar.
 */
[data-screen="calendar"] dialog.drawer[data-drawer="session"]:has(.session-ride) {
  --drawer-width: min(50rem, 100%);
  background: var(--bg);
}
[data-screen="calendar"] dialog.drawer[data-drawer="session"]:has(.session-ride) .drawer-head {
  background: var(--bg);
}
[data-screen="calendar"] .day-session:has(> .session-ride) {
  border-top: 0;
}
[data-screen="calendar"] .session-ride {
  --add-stuck-top: calc(var(--drawer-head-height) + var(--s-4));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "strip" "rest";
  gap: var(--s-5);
  align-items: start;
}
/* The pane spans the ride's two rows; the second takes what the pane's height adds. */
[data-screen="calendar"] .session-ride:has(> .add-pane) {
  grid-template-columns: minmax(0, 1fr) var(--add-panel-width);
  grid-template-rows: auto 1fr;
  grid-template-areas: "strip pane" "rest pane";
}
[data-screen="calendar"] .session-ride > .add-strip {
  grid-area: strip;
}
[data-screen="calendar"] .session-ride > .add-pane {
  grid-area: pane;
}
/*
 * Beside the ride, the pane sticks under the drawer's head while the ride scrolls, and its
 * inputs scroll on their own when they run taller than the window.
 */
@media (min-width: 761px) {
  [data-screen="calendar"] .session-ride > .add-pane {
    position: sticky;
    top: var(--add-stuck-top);
    max-height: calc(100dvh - var(--add-stuck-top) - var(--add-stuck-gap));
  }
  [data-screen="calendar"] .session-ride .add-pane-body {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
/* The strip scrolls with the ride: its chart is too tall to stay stuck. */
[data-screen="calendar"] .session-strip {
  gap: var(--s-3);
  padding-bottom: var(--s-4);
}
/* A rule the ride's main zone colour (charts.css `--zone`), grey without one. */
[data-screen="calendar"] .session-strip[data-zone-colour] {
  --block: var(--zone);
}
[data-screen="calendar"] .session-ride-rest {
  grid-area: rest;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  min-width: 0;
}
/* A block of the ride: a small caps label, then what it says. */
[data-screen="calendar"] .session-block {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
[data-screen="calendar"] .session-block > h3 {
  margin: 0;
}
[data-screen="calendar"] .session-block p {
  font-size: var(--fs-sub);
}
[data-screen="calendar"] .session-rpe {
  font-weight: 600;
}
/* Time in zone: one bar, a zone's share of it each, then the legend. */
[data-screen="calendar"] .zone-time-bar {
  display: flex;
  gap: var(--add-bar-gap);
  height: var(--zone-bar-height);
  overflow: hidden;
  border-radius: var(--radius-s);
}
[data-screen="calendar"] .zone-time-bar > i {
  flex: var(--minutes) 1 0;
  min-width: var(--add-bar-gap);
  background: var(--zone);
}
[data-screen="calendar"] dl.zone-time-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--zone-legend-min), 1fr));
  gap: var(--s-1) var(--s-4);
  margin: 0;
  font-size: var(--fs-micro);
}
[data-screen="calendar"] .zone-time-legend > div {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
}
[data-screen="calendar"] .zone-time-legend dt {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--dim);
}
[data-screen="calendar"] .zone-time-legend dt > i {
  width: var(--zone-swatch);
  height: var(--zone-swatch);
  border-radius: var(--radius-s);
  background: var(--zone);
}
[data-screen="calendar"] .zone-time-legend dd {
  margin: 0;
}
/* Workout: a section's name, then its steps on the same line. */
[data-screen="calendar"] dl.workout-lines {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  font-size: var(--fs-sub);
}
[data-screen="calendar"] .workout-lines > div {
  display: grid;
  grid-template-columns: var(--workout-line-label) minmax(0, 1fr);
  gap: var(--s-3);
  align-items: baseline;
}
[data-screen="calendar"] .workout-lines dt {
  font-weight: 600;
}
[data-screen="calendar"] .workout-lines dd {
  margin: 0;
  color: var(--dim);
}
/* The FTP the session is written at, under the pane's rows, and where it changes. */
[data-screen="calendar"] .session-pane-ftp {
  margin: 0;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
  color: var(--dim);
}
[data-screen="calendar"] .session-pane-ftp strong {
  color: var(--txt);
}
[data-screen="calendar"] .session-pane-ftp a {
  color: inherit;
  text-decoration: underline;
}
/* The pane's foot: the hint or whose the ride is over its buttons. */
[data-screen="calendar"] .session-foot {
  flex-direction: column;
}
[data-screen="calendar"] .session-foot .hint {
  margin: 0;
  font-size: var(--fs-micro);
}
[data-screen="calendar"] :is(.draft-replace, .session-foot-clear) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
}
[data-screen="calendar"] .draft-replace-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
[data-screen="calendar"] .draft-replace-buttons form {
  margin: 0;
}
/* One column on a phone: the strip, then the pane, then the rest of the ride. Nothing sticks. */
@media (max-width: 760px) {
  [data-screen="calendar"] .session-ride:has(> .add-pane) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "strip" "pane" "rest";
  }
}
/*
 * A draft's Replace (session-draft.tsx), at the session pane's foot: what replacing does,
 * then Replace and Cancel. While it posts, the commit is the progress and Cancel waits.
 */
[data-screen="calendar"] .draft-replace:has(.htmx-request) [data-cancel-draft] {
  opacity: 0.6;
}
/* A press here would swap the slot and take the commit's progress away. */
[data-screen="calendar"]
  :is(.session-ride, .day-session-workout):has(form.htmx-request)
  :is(a, button) {
  pointer-events: none;
}
/*
 * An extra session's workout (extra-session-workout.tsx, ADR-0048): only an extra session's
 * drawer and Add workout's picker draw these. Its chart with its version over it and its
 * planned stats beside it, its rows, its rep scheme captions and its steps folded under Steps.
 */
[data-screen="calendar"] .main-workout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--s-2) var(--s-4);
}
[data-screen="calendar"] .main-workout-ride {
  grid-column: 1 / -1;
}
/* Add workout's pick: the workout's name is the drawer's subject, so it reads as a title. */
[data-screen="calendar"] .picked-title {
  margin: 0;
  font-size: var(--fs-section-title);
  font-weight: 600;
  color: var(--txt);
}
/* The planned stats are `dl.facts`, laid out as a column beside the chart. */
[data-screen="calendar"] dl.main-workout-stats {
  grid-template-columns: minmax(5.5rem, auto);
  gap: var(--s-2);
  margin: 0;
}
/* A rep scheme's caption, over its steps. */
[data-screen="calendar"] .rep-scheme-caption {
  margin: var(--s-3) 0 0;
}
/* Its rows (`SegmentRow`, pick-rows.tsx's stepper rows; the day menu's outdoor switch is one too): its
   lengths as totals under the chart (#296), then where its extra Z2 goes (#297). */
[data-screen="calendar"] .day-pick-row {
  margin-top: var(--s-3);
}
[data-screen="calendar"] .day-pick-row .caption {
  margin: 0;
}
[data-screen="calendar"] .day-steps > summary {
  color: var(--dim);
}
[data-screen="calendar"] .day-steps-of {
  margin-top: var(--s-3);
}
[data-screen="calendar"] .day-steps-of pre {
  margin-top: var(--s-1);
}
[data-screen="calendar"] .day-steps-of:not([data-prescribed]) pre {
  color: var(--dim);
}
[data-screen="calendar"] .day-ride dl.facts {
  margin: 0 0 var(--s-2);
}
[data-screen="calendar"] table.day-intervals th,
[data-screen="calendar"] table.day-intervals td {
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-sub);
}
[data-screen="calendar"] table.day-intervals tr:not(.work) td {
  color: var(--dim);
}
[data-screen="calendar"] .day-pairing {
  margin-top: var(--s-2);
  font-size: var(--fs-sub);
}
[data-screen="calendar"] .day-pairing > summary {
  color: var(--faint);
}
/* A test session's tested FTP: the value, then one field and Save. */
[data-screen="calendar"] .tested-forms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
[data-screen="calendar"] .tested-forms input {
  width: 6rem;
}
[data-screen="calendar"] .day-flags {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
[data-screen="calendar"] .day-flags li {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
}
[data-screen="calendar"] .day-flags form {
  flex: none;
}
[data-screen="calendar"] .day-flags button {
  min-width: 8.5rem;
}
[data-screen="calendar"] .day-flags .row-sub {
  margin: 0;
  color: var(--dim);
}
/* A waiting ride's question: the suggestion, the flags, the buttons, the evidence. */
[data-screen="calendar"] .ride-question {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-s);
}
[data-screen="calendar"] .ride-question .question {
  font-weight: 600;
  color: var(--txt);
}
[data-screen="calendar"] .ride-question .suggestion {
  color: var(--dim);
}
[data-screen="calendar"] .ride-question .suggestion strong {
  color: var(--txt);
}
[data-screen="calendar"] .ride-question form.flag strong {
  color: var(--gold);
}
[data-screen="calendar"] .ride-question[data-state="suggested"] .suggestion strong {
  color: var(--gold);
}
[data-screen="calendar"] .ride-question form.flag {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  color: var(--dim);
}
[data-screen="calendar"] .ride-question details,
[data-screen="calendar"] .ride-question details > p {
  font-size: var(--fs-sub);
}
[data-screen="calendar"] .ride-question details > summary {
  color: var(--faint);
}
[data-screen="calendar"] .ride-question ol.work {
  list-style: none;
  padding: 0;
  margin: var(--s-2) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}
[data-screen="calendar"] .ride-question ol.work > li {
  margin: 0;
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-sub);
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}
/* The day menu's add rows: full width, the drawer's edge to edge. */
[data-screen="calendar"] .day-menu-rows {
  margin-top: var(--s-2);
}

/* A phone: the days of each week as a list; a rest day is one quiet line. */
@media (max-width: 760px) {
  [data-screen="calendar"] {
    --cal-title-width: 100%;
  }
  /* The hint takes its own line here, so the bar stands taller. */
  [data-screen="calendar"] dialog.drawer[data-drawer="session"] {
    --drawer-bar-reserve: 140px;
  }
  [data-screen="calendar"] .cal-range,
  [data-screen="calendar"] .cal-month {
    gap: 0;
    font-size: var(--fs-row-title);
  }
  [data-screen="calendar"] .cal-today {
    padding: 0 var(--s-2);
  }
  /* No room beside the month: the block start card names the block. */
  [data-screen="calendar"] .cal-block-now {
    display: none;
  }
  [data-screen="calendar"] .main-workout {
    grid-template-columns: minmax(0, 1fr);
  }
  [data-screen="calendar"] dl.main-workout-stats {
    grid-template-columns: repeat(4, auto);
    justify-content: space-between;
  }
  /* The sentence on its own line, the buttons together at the bar's end. */
  [data-screen="calendar"] .drawer-actions > .hint {
    flex-basis: 100%;
  }
  [data-screen="calendar"] .day-flags li {
    flex-direction: column;
    gap: var(--s-1);
  }
}

/*
 * Reorder (#655, reorder.tsx): Reorder under a week's TSS bar; while a week is reordered, Save,
 * Cancel and Back to plan in its place, and the week's cards move as Add a block's week cards do
 * (season.js). A card that moves has its band as a button, its handle; a day that trades and
 * holds no plan session draws a dashed place to land; a fixed day (gone by, logged, ridden) and
 * a card that stays (an extra session, a race, a ride) are drawn faint. While a card moves, the
 * picked day and the day under a drag are a selection (an `--accent-dim` fill, an `--edge-on`
 * edge), the days it can go take a dashed `--ring` edge, and the ones it can't grey, with why.
 */
[data-screen="calendar"] .cal-reorder-open {
  align-self: flex-start;
}
[data-screen="calendar"] .cal-reorder {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}
[data-screen="calendar"] .cal-reorder form {
  display: contents;
}
[data-screen="calendar"] .cal-week[data-reordering] button.cal-band {
  display: block;
  width: 100%;
  margin: 0;
  padding-inline: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  cursor: grab;
  user-select: none;
}
[data-screen="calendar"] .cal-week[data-reordering] button.cal-band:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
[data-screen="calendar"] .cal-week[data-reordering] .cal-card:not(:has([data-card-band])) {
  opacity: 0.55;
}
[data-screen="calendar"] .cal-week[data-reordering] .cal-day[data-reorder="fixed"] {
  opacity: 0.55;
}
[data-screen="calendar"] .cal-week[data-reordering] button.cal-place {
  opacity: 1;
  min-height: var(--target);
  border: 1px dashed var(--line-2);
  background: transparent;
  cursor: default;
}
[data-screen="calendar"] .cal-reorder-why {
  display: none;
}
[data-screen="calendar"] .cal-week[data-moving] :is(button.cal-band, button.cal-place) {
  cursor: pointer;
}
[data-screen="calendar"]
  .cal-week[data-moving]
  .cal-day:not([data-source], [data-blocked])
  :is(.cal-card:has([data-card-band]), button.cal-place) {
  outline: 1px dashed var(--ring);
  outline-offset: -1px;
}
[data-screen="calendar"]
  .cal-week[data-moving]
  .cal-day:is([data-source], [data-over])
  :is(.cal-card:has([data-card-band]), button.cal-place) {
  outline: 1px solid var(--edge-on);
  outline-offset: -1px;
  background: var(--accent-dim);
}
[data-screen="calendar"] .cal-week[data-moving] .cal-day[data-blocked] {
  filter: grayscale(1);
  cursor: not-allowed;
}
[data-screen="calendar"] .cal-week[data-moving] .cal-day[data-blocked] .cal-reorder-why {
  display: block;
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-micro);
  line-height: 1.25;
  text-align: center;
  color: var(--txt);
  background: var(--fill-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
/* A placing on its way to the server: the week waits for the redraw. */
[data-screen="calendar"] .cal-week[data-busy] ol.cal-days {
  opacity: 0.6;
  pointer-events: none;
}
/* The week's line when a reorder leaves two hard days back to back (#657). */
[data-screen="calendar"] .cal-reorder-note {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--fs-micro);
}

/*
 * Pair in the session drawer (#664, ADR-0060): each ride a row, its ride profile a small
 * thumbnail before its name and stats, its own Pair at the end.
 */
[data-screen="calendar"] .pair-ride .row-main > * {
  display: block;
}
[data-screen="calendar"] .pair-thumb {
  flex: none;
  inline-size: 6rem;
}
[data-screen="calendar"] .pair-thumb .workout-shape {
  display: block;
  inline-size: 100%;
  block-size: 2.5rem;
}

/*
 * Connect intervals (connect.tsx, #497): once a key is stored, its form folds under
 * "Replace the key".
 */
[data-screen="connect"] [data-replace-key] > form {
  margin-top: var(--s-3);
}

/*
 * The Guide (guide.tsx): the page is a long reference page (base.css); these are its
 * own topics' details.
 */

[data-screen="guide"] .guide-steps > li + li {
  margin-top: var(--s-2);
}

/* The modes' hours, such as 8–11, on one line. */
[data-screen="guide"] #modes .doc-table td:nth-child(3) {
  white-space: nowrap;
}

/*
 * Suggestion quality (/inference): how often each version Rensei put forward is changed,
 * by where it was put forward and by source, and each athlete's switch. See docs/design/DESIGN_SYSTEM.md; tokens only.
 */

[data-screen="inference"] .rates td.confirmed {
  font-size: var(--fs-sub);
  color: var(--dim);
}
[data-screen="inference"] .rates th:first-child {
  width: 25%;
}
[data-screen="inference"] .rates th:last-child {
  width: 35%;
  padding-left: var(--s-6);
}
[data-screen="inference"] .rates td.confirmed {
  padding-left: var(--s-6);
}

[data-screen="inference"] [data-origins] {
  margin: var(--s-4) 0 var(--s-2);
}

/*
 * The label check screen: what it is for, the check's counts, then one row per past
 * ride with the labels to pick from, and the way back to Settings once it passes.
 * See docs/design/DESIGN_SYSTEM.md; tokens only.
 */

[data-screen="label-check"] [data-label-check-rule] {
  margin: calc(-1 * var(--s-2)) 0 var(--s-6);
}
[data-screen="label-check"] .stats {
  max-width: 36rem;
}

/* A history ride: the ride and Rensei's read on the left, its labels on the right. */
[data-screen="label-check"] .history > li {
  flex-wrap: wrap;
  align-items: flex-start;
}
[data-screen="label-check"] .history .row-main {
  flex: 1 1 16rem;
}
[data-screen="label-check"] .history .row-title a {
  color: var(--txt);
}
/* The ride's name is the row's title: no underline on hover. */
[data-screen="label-check"] .history .row-title a:hover {
  text-decoration: none;
}
[data-screen="label-check"] .history [data-read] {
  margin-top: var(--s-1);
}
[data-screen="label-check"] .history form.log {
  margin: 0;
}

/*
 * Races on dates (races.tsx, #235): the race drawer, Add race and its edit view. The
 * priorities are one choice a line, each with what it means.
 */
[data-drawer="race"] fieldset.race-priority {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
}
[data-drawer="race"] fieldset.race-priority > label.check {
  display: flex;
  align-items: flex-start;
  color: var(--txt);
}
[data-drawer="race"] fieldset.race-priority > label.check > input {
  width: var(--s-4);
  flex: none;
}
[data-drawer="race"] fieldset.race-priority .hint {
  color: var(--faint);
}
[data-drawer="race"] form[data-remove-race] {
  margin: 0;
}
/* The race's replan: its warning, then its card while it is open. */
[data-drawer="race"] ul.checks {
  margin-bottom: var(--s-4);
}

/*
 * Season (season.tsx), its Add a block page (add-block.tsx, add-block-panel.tsx, mode-picker.tsx,
 * block-form.tsx, week-cards.tsx) and the block page (block-page.tsx): the axis of months with the
 * blocks, races and today on it and the + after the last block, the checks, the block list, the
 * Add a block page (its side pane of inputs, the strip, the week's cards and the week rows), and
 * the block page laid out as Add a block, with its week table.
 * A block's identity colour (--block-*) is set once per template as --block and drawn
 * as a top rule and tint: the axis bar, and Add a block's strip head, bars and Time off kinds;
 * and the list row's index.
 */

/* ── Block identity ─────────────────────────────────────────────────── */
[data-screen="season"] .m-build-a {
  --block: var(--block-build);
}
[data-screen="season"] .m-maintain {
  --block: var(--block-maintain);
}
[data-screen="season"] .m-base-8,
[data-screen="season"] .m-base-6 {
  --block: var(--block-base);
}
[data-screen="season"] .m-unstructured {
  --block: var(--block-unstructured);
}
[data-screen="season"] .m-travel {
  --block: var(--block-travel);
}
[data-screen="season"] .m-re-entry {
  --block: var(--block-re-entry);
}

/* ── The block list: flat rows, the index in its block's colour ─────── */
[data-screen="season"] ol.ylist {
  list-style: none;
  padding: 0;
  margin: 0;
}
[data-screen="season"] ol.ylist > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-3) var(--s-2);
  margin: 0 calc(-1 * var(--s-2));
  border-top: 1px solid var(--line);
  transition: background var(--t-fast) var(--ease);
}
[data-screen="season"] ol.ylist > li:first-child {
  border-top-color: transparent;
}
/* Keyboard focus in a row tints it; a click leaves it plain. */
[data-screen="season"] ol.ylist > li:has(:focus-visible) {
  background: var(--fill-hover);
}
[data-screen="season"] ol.ylist .idx {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: var(--radius-s);
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--txt);
  background: color-mix(in srgb, var(--block, var(--line-2)) 14%, transparent);
}
[data-screen="season"] ol.ylist .row-main {
  flex: 1 1 14rem;
}
[data-screen="season"] ol.ylist .row-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--s-3);
}

/* The block page's in-app asks (#271): what Delete or Save does on intervals, then its buttons. */
[data-screen="season"] .confirm-edit p {
  margin: var(--s-1) 0 0;
}
[data-screen="season"] .confirm-edit .form-actions {
  margin-top: var(--s-3);
}

/* ── Add a block ── */
/*
 * One page (ADR-0049, amended by spec add-block-sidebar): the block in the main area on the
 * left, its inputs in a sticky side pane on the right, Add and Cancel pinned at the pane's foot.
 * The pane comes first in the page, so below 1024 px it is first and nothing sticks.
 */
[data-screen="season"] form.add-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--add-panel-width);
  grid-template-areas: "main pane";
  align-items: start;
  gap: var(--s-6);
  max-width: none;
  margin: 0;
}
[data-screen="season"] .add-main {
  grid-area: main;
  min-width: 0;
}
[data-screen="season"] .add-pane {
  grid-area: pane;
}
/*
 * Two columns: the pane sticks under the app bar while the block scrolls, and its inputs
 * scroll on their own when they run taller than the window.
 */
@media (min-width: 1024px) {
  [data-screen="season"] .add-pane {
    position: sticky;
    top: var(--add-stuck-top);
    max-height: calc(100dvh - var(--add-stuck-top) - var(--add-stuck-gap));
  }
  [data-screen="season"] .add-pane-body {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
@media (max-width: 1023px) {
  [data-screen="season"] form.add-block {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "pane" "main";
  }
}
/* htmx redraws the page as it changes, so the refresh button stands down. */
.htmx-live [data-screen="season"] [data-add-refresh] {
  display: none;
}
/* Help me choose's questions sit inset; the page's rows run edge to edge, hairlines full width. */
[data-screen="season"] .add-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-4);
}
[data-screen="season"] .add-body:has(> .add-inputs:not([data-picker])) {
  padding: 0;
}
[data-screen="season"] .add-body h2 {
  margin: 0;
}
/* Help me choose's questions keep a form's width. */
[data-screen="season"] form[data-add-step="help"] .add-body {
  max-width: var(--form-width);
}
[data-screen="season"] :is(.add-body, .add-result) :is(.hint, .prefill) {
  margin: 0;
}
[data-screen="season"] :is(.add-body, .add-result) .prefill.warn {
  color: var(--gold);
}
[data-screen="season"] form.add-block .field {
  gap: var(--s-2);
}

/* Time off's kinds, under GOAL, each radio in its kind's colour. */
[data-screen="season"] .add-off-modes {
  display: grid;
  gap: var(--s-2);
}
[data-screen="season"] .add-off-modes label.check {
  align-items: start;
  font-size: var(--fs-sub);
}
[data-screen="season"] .add-off-modes .hint {
  display: block;
  font-size: var(--fs-micro);
}
[data-screen="season"] .add-off-modes input {
  accent-color: var(--block);
}
/* The watts the sessions are written at, under the rep rows: each a name then its value. */
[data-screen="season"] .add-watts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
  color: var(--dim);
}
[data-screen="season"] .add-watts strong {
  color: var(--txt);
  font-variant-numeric: tabular-nums;
}
[data-screen="season"] .add-watts-link {
  margin-left: auto;
  color: var(--dim);
  text-decoration: underline;
}
[data-screen="season"] .add-watts-link:hover {
  color: var(--txt);
}

/* The picker's questions, one to a line. */
[data-screen="season"] .add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3);
}
[data-screen="season"] .add-row.add-checks label.check {
  flex-wrap: wrap;
}
[data-screen="season"] .add-row.add-checks :is(.prefill, .hint) {
  flex-basis: 100%;
}
/* Build weeks: the number, then its ↺ back to the pre-fill while it holds another answer. */
[data-screen="season"] .picker-number {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
[data-screen="season"] .picker-number > input {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 400;
}
[data-screen="season"] .picker-reset:empty {
  display: none;
}

/*
 * The week's cards (week-cards.tsx, ADR-0049 as amended 2026-11-10): over the week rows, the line
 * that says what they do, then a slot a day in the weeks' own columns (`.cal-weeks ol.cal-days`),
 * so each card sits over its day. A slot is its day's name over its card, or a rest day's dashed
 * place with Strength's chip. A card is the Calendar's: its band the chart ground, the type's
 * word over its glyph at one size, then its fields stacked, every card's first (length, Outdoor)
 * so the rows line up. While a card moves (the island's `data-moving`), the picked card and the
 * day under a drag are a selection (an `--accent-dim` fill, an `--edge-on` edge), the days it can
 * go take a quiet dashed `--ring` edge, and the ones it can't are greyed, with why.
 */
[data-screen="season"] .week-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-2);
}
/* "Can't add yet" lands the cards under the sticky strip, not behind it. */
@media (min-width: 1024px) {
  [data-screen="season"] .week-cards {
    scroll-margin-top: calc(var(--add-strip-height) + var(--add-stuck-gap));
  }
}
/* A locked week's disabled fieldset only disables its fields: it draws no box of its own. */
[data-screen="season"] fieldset.week-cards-locked {
  display: contents;
}
[data-screen="season"] .week-cards-caption {
  font-size: var(--fs-sub);
  color: var(--faint);
}
[data-screen="season"] .week-cards-caption strong {
  font-weight: 600;
  color: var(--txt);
}
/*
 * Ruled as a week row is, since it is one (`.cal-week`, `.cal-day`): its hairlines and padding,
 * and a list on a phone. A slot only lays its day's name over its card as a grid.
 */
[data-screen="season"] .week-card-slot {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--s-1);
}
[data-screen="season"] .week-card-day {
  text-align: center;
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--dim);
}
[data-screen="season"] .week-card {
  position: relative;
  display: grid;
  align-content: start;
  min-width: 0;
  overflow: hidden;
  background: var(--fill);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-s);
}
/* A day the week refuses, as a refused field is. */
[data-screen="season"] .week-card-slot[data-refused] :is(.week-card, .week-card-rest) {
  border-color: var(--warn-line);
  background: var(--warn-dim);
}

/* The band: the Calendar card's chart ground, the card's handle, a button. */
[data-screen="season"] .week-card-band {
  --cal-type-strip: var(--week-card-strip);
  --cal-chart-height: var(--week-card-chart);
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding-inline: 0;
  border: 0;
  border-radius: 0;
  text-align: left;
  cursor: grab;
  user-select: none;
}
[data-screen="season"] .week-card-band:hover {
  background: var(--chart-bg);
}
[data-screen="season"] .week-card-band:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
[data-screen="season"] .week-card-band .cal-type {
  top: var(--s-1);
  left: var(--s-2);
  right: var(--s-2);
  font-size: var(--fs-sub);
}
/* A length off the plan's puts its ↺ at the strip's end, on the type word's line. */
[data-screen="season"] .week-card:has(.stepper-reset) .week-card-band .cal-type {
  right: var(--week-card-strip);
}
/*
 * A day type's glyph, one size whatever the length, in its type's colour. Drawn as the
 * workout charts under it are: square steps on the band's floor, edge to edge.
 */
[data-screen="season"] .week-card-mark {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-1);
  height: var(--cal-chart-height);
}
[data-screen="season"] .week-card-mark > i {
  flex: 1;
  height: var(--p);
  box-sizing: border-box;
  background: var(--day-colour);
}
[data-screen="season"] .week-card-mark[data-day-type="hard"] {
  --day-colour: var(--day-hard);
}
[data-screen="season"] .week-card-mark[data-day-type="endurance"] {
  --day-colour: var(--day-endurance);
}
/* Steady rides sit under the reps, as a Z2 ride's block sits under intervals: Easy lower still. */
[data-screen="season"] .week-card-mark[data-day-type="endurance"] > i {
  height: 55%;
}
[data-screen="season"] .week-card-mark[data-day-type="easy"] {
  --day-colour: var(--day-easy);
}
[data-screen="season"] .week-card-mark[data-day-type="easy"] > i {
  height: 38%;
}
[data-screen="season"] .week-card-mark[data-optional] > i {
  border: 1.5px solid var(--day-colour);
  background: repeating-linear-gradient(135deg, var(--day-colour) 0 2px, transparent 2px 4.5px);
}

/* The fields, stacked: the length, then each switch a line, its word then its pill. */
[data-screen="season"] .week-card-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  padding: var(--s-1);
}
[data-screen="season"] .week-card-fields label.switch {
  gap: var(--s-1);
  min-height: calc(var(--target-s) - var(--s-1));
  padding: 0;
  font-size: var(--fs-sub);
}
/*
 * The length: values, not boxes, − and + at the card's edges. Its ↺, while the length is off the
 * plan's, sits at the end of the band's strip, on the type word's line: a card's column has no
 * room for it beside them, and the glyph keeps its one size.
 */
[data-screen="season"] .week-card-fields .stepper-field {
  display: flex;
  gap: 0;
  min-width: 0;
}
[data-screen="season"] .week-card-fields .stepper-field > .seg.stepper {
  flex: 1;
  justify-content: space-between;
  min-width: 0;
  padding: 0;
  gap: 0;
  background: none;
  border-color: transparent;
}
[data-screen="season"] .week-card-fields .stepper-field > .seg.stepper > button {
  flex: none;
  width: var(--s-5);
  min-height: calc(var(--target-s) - var(--s-1));
  color: var(--dim);
  border-radius: var(--radius);
}
[data-screen="season"] .week-card-fields .stepper-reset {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--week-card-strip);
  min-height: var(--week-card-strip);
  height: var(--week-card-strip);
  color: var(--on-chart-mute);
  border-radius: var(--radius);
}
[data-screen="season"] .week-card-fields .stepper-reset:hover {
  color: var(--on-chart);
  background: var(--on-chart-dim);
}
[data-screen="season"] .week-card-fields .stepper-field > .seg.stepper > button:disabled {
  color: var(--chevron);
  opacity: 1;
}
[data-screen="season"] .week-card-fields .stepper-field > .seg.stepper > output {
  min-width: 0;
  padding: 0;
  font-size: var(--fs-sub);
  white-space: nowrap;
}
/* A switch's word gives way before its pill does, in the narrowest columns. */
[data-screen="season"] .week-card-fields label.switch > .switch-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Columns narrower than 1440 px's (a laptop beside the pane): the fields' words a step smaller. */
@container cal-days (max-width: 46rem) {
  [data-screen="season"] .week-card-fields label.switch {
    font-size: var(--fs-micro);
  }
  [data-screen="season"] .week-card-fields .stepper-field > .seg.stepper > output {
    font-size: var(--fs-micro);
  }
}
/* A length the week refuses: its value in the refusal's colour. */
[data-screen="season"] .week-card-fields .stepper-field[data-length-refused] > .seg > output {
  color: var(--warn);
}

/* A rest day: a dashed place to land, "Rest", Strength's chip where the plan keeps it. */
[data-screen="season"] .week-card-rest {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s-1);
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: var(--s-2) 0;
  font-size: var(--fs-micro);
  font-weight: 400;
  color: var(--faint);
  background: none;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-s);
  cursor: default;
}
[data-screen="season"] .week-card-rest .badge {
  margin: 0;
}

/* Moving: where the card can go, where it can't and why. */
[data-screen="season"] .week-card-why {
  display: none;
}
[data-screen="season"] .week-cards[data-moving] .week-card-band,
[data-screen="season"] .week-cards[data-moving] .week-card-rest {
  cursor: pointer;
}
/* Where the card can go: a quiet dashed edge. */
[data-screen="season"]
  .week-cards[data-moving]
  .week-card-slot:not([data-source], [data-blocked])
  :is(.week-card, .week-card-rest) {
  border-style: dashed;
  border-color: var(--ring);
}
/* The picked card, and the day a drag is over: a selection, never an accent. */
[data-screen="season"]
  .week-cards[data-moving]
  .week-card-slot:is([data-source], [data-over])
  :is(.week-card, .week-card-rest) {
  border-style: solid;
  border-color: var(--edge-on);
  background: var(--accent-dim);
}
[data-screen="season"]
  .week-cards[data-moving]
  .week-card-slot[data-blocked]
  :is(.week-card, .week-card-rest) {
  opacity: 0.35;
  filter: grayscale(1);
  cursor: not-allowed;
}
[data-screen="season"] .week-cards[data-moving] .week-card-slot[data-blocked] .week-card-why {
  display: block;
  position: absolute;
  inset: 40% var(--s-1) auto;
  z-index: 2;
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-micro);
  line-height: 1.25;
  text-align: center;
  color: var(--txt);
  background: var(--fill-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
}
/* A swap on its way to the server: the cards wait for the redraw. */
[data-screen="season"] .week-cards[data-busy] .week-cards-row {
  opacity: 0.6;
  pointer-events: none;
}
/*
 * The result's block: the strip, then the explanations, what the add does and the week rows,
 * one column. On Help me choose it is Rensei's pick, nothing sticky.
 */
[data-screen="season"] .add-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--s-4);
}
[data-screen="season"] .add-plan > .notice {
  margin: 0;
}
[data-screen="season"] .add-plan p {
  margin: 0;
}
/*
 * The strip sticks under the app bar while the week rows scroll under it. About
 * --add-strip-height, which the week rows' scroll offset clears. Stuck, it keeps the page's gap
 * under the app bar, level with the pane; the shadow fills that gap with the page so rows don't
 * show through it.
 */
[data-screen="season"] .add-strip {
  position: sticky;
  top: var(--add-stuck-top);
  z-index: 2;
  box-shadow: 0 calc(-1 * var(--add-stuck-gap)) 0 var(--bg);
}
@media (max-width: 1023px) {
  [data-screen="season"] .add-strip {
    position: static;
  }
}
/* Why the block can't be added, where its bars would be; a link to the board on a week's. */
[data-screen="season"] .add-cant {
  margin: 0;
  font-size: var(--fs-sub);
  color: var(--gold);
}
[data-screen="season"] .add-cant a {
  color: inherit;
  text-decoration: underline;
}
/* The FTP-unconfirmed slot (#330), under the head: no gap while empty. */
[data-screen="season"] .ftp-unconfirmed:empty {
  display: none;
}
[data-screen="season"] .ftp-unconfirmed > .notice {
  margin: 0;
}
[data-screen="season"] .add-break {
  margin: 0;
  padding: var(--s-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
}
/* Planned TSS a week as small bars across the strip, read only. */
[data-screen="season"] .add-overview {
  margin: 0;
}
[data-screen="season"] .add-overview ol {
  list-style: none;
  display: flex;
  align-items: flex-end;
  gap: var(--add-bar-gap);
  height: var(--add-bars-height);
  margin: var(--s-1) 0 0;
  padding: 0;
}
/*
 * A bar is a week's share of the strip, an eighth at most: Maintain's eight weeks and Build's
 * twelve fill it, and a block shortened under eight reads as short.
 */
/* biome-ignore lint/style/noDescendingSpecificity: the overview is never the block list */
[data-screen="season"] .add-overview li {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: var(--add-bar-max);
  height: 100%;
  margin: 0;
}
/* The bar is a link to its week's row in Week by week. */
[data-screen="season"] .add-overview li > a {
  height: 100%;
  border-radius: 2px;
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
  font-size: var(--fs-card-label);
  line-height: 1.3;
}
[data-screen="season"] .add-overview .bar {
  display: block;
  flex: none;
  min-height: 2px;
  height: calc((100% - 2.6em) * var(--h));
  border-radius: 2px 2px 0 0;
  background: var(--block, var(--dim));
}
[data-screen="season"] .add-overview li:is([data-kind="recovery"], [data-kind="deload"]) .bar {
  background: color-mix(in srgb, var(--block, var(--dim)) 40%, transparent);
}
[data-screen="season"] .add-overview li:is([data-kind="test"], [data-kind="taper"]) .bar {
  background: var(--txt);
}
[data-screen="season"] .add-overview li > a:hover .bar {
  filter: brightness(0.85);
}
[data-screen="season"] .add-overview .tss {
  color: var(--dim);
}
[data-screen="season"] .add-overview li > a:is(:hover, :focus-visible) .tss {
  color: var(--txt);
}
@media (prefers-reduced-motion: no-preference) {
  html:has([data-screen="season"] [data-add-overview]) {
    scroll-behavior: smooth;
  }
}
[data-screen="season"] .add-overview .w {
  color: var(--faint);
}
[data-screen="season"] .add-overview ol:has(.race) {
  margin-bottom: 1lh;
}
[data-screen="season"] .add-overview .race {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
}

/* The races inside the block's weeks: compact rows under its facts. */
[data-screen="season"] .span-races {
  color: var(--dim);
}
[data-screen="season"] .span-races .rows > li {
  padding: var(--s-1) 0;
  color: var(--txt);
}
/* Plan-back's ask (#270): why the race becomes the build's A race, and the tick. */
[data-screen="season"] .a-race-ask {
  display: grid;
  gap: var(--s-2);
}
[data-screen="season"] ul[data-needs] {
  margin: var(--s-1) 0 0;
  padding-left: var(--s-5);
}
[data-screen="season"] .decision {
  display: grid;
  gap: var(--s-1);
}
[data-screen="season"] .decision .overline {
  display: block;
  color: var(--accent);
}
[data-screen="season"] .decision .mode {
  margin: 0;
  font-size: var(--fs-section-title);
  font-weight: 600;
}
[data-screen="season"] .decision .reason {
  margin: var(--s-2) 0;
}
[data-screen="season"] ol.path {
  list-style: none;
  padding: 0;
  margin: var(--s-2) 0 0;
}
/* biome-ignore lint/style/noDescendingSpecificity: this list is never inside .span-races */
[data-screen="season"] ol.path li {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  margin: 0;
  padding: 3px 0;
  font-size: var(--fs-sub);
  color: var(--dim);
}
[data-screen="season"] ol.path li .dot {
  width: 6px;
  height: 6px;
  transform: translateY(-1px);
}
[data-screen="season"] ol.path li[data-s="hit"] {
  color: var(--txt);
  font-weight: 600;
}
[data-screen="season"] ol.path li[data-s="skip"] {
  color: var(--faint);
}
/* What each outcome means: a compact grid. */
[data-screen="season"] dl.outcomes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: var(--s-3);
  margin: 0;
}
[data-screen="season"] dl.outcomes > div {
  border-top: 1px solid var(--line-2);
  padding-top: var(--s-2);
}
[data-screen="season"] dl.outcomes dt {
  font-weight: 600;
}
[data-screen="season"] dl.outcomes dd {
  margin: var(--s-1) 0 0;
  font-size: var(--fs-sub);
  color: var(--dim);
}
/*
 * The preview (#268): the Calendar's week rows (calendar-rows.css). Its month heads divide
 * the rows, smaller than a screen's, and don't stick: there is no Calendar toolbar here.
 */
[data-screen="season"] .add-preview {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
/* A bar's link lands its week's row under the sticky strip, not behind it. */
@media (min-width: 1024px) {
  [data-screen="season"] .add-preview section.cal-week {
    scroll-margin-top: calc(var(--add-strip-height) + var(--add-stuck-gap));
  }
}
[data-screen="season"] .add-preview .cal-month h2 {
  margin: 0;
  font-size: var(--fs-row-title);
}

/* ── The axis: months, then the blocks, the races and today on them ─── */
[data-screen="season"] .axis-scroll {
  margin: 0 0 var(--s-4);
  padding-bottom: var(--s-1);
  scrollbar-width: thin;
}
[data-screen="season"] .season-axis {
  position: relative;
  min-width: 48rem;
  /* Room under the races for today's label. */
  padding-bottom: 20px;
}
/* Each mark sits at its fraction of the axis (--at) and spans its share (--span). */
[data-screen="season"] .season-axis .months > li,
[data-screen="season"] .season-axis .blocks > [data-block],
[data-screen="season"] .season-axis .blocks > .add-block,
[data-screen="season"] .season-axis .races > li,
[data-screen="season"] .season-axis .today {
  position: absolute;
  left: calc(var(--at) * 100%);
}
[data-screen="season"] .season-axis .months {
  position: relative;
  height: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}
[data-screen="season"] .season-axis .months > li {
  top: 0;
  bottom: 0;
  width: calc(var(--span) * 100%);
  margin: 0;
  padding-left: 6px;
  overflow: hidden;
  white-space: nowrap;
  border-left: 1px solid var(--line);
  font-size: var(--fs-micro);
  font-weight: 600;
  line-height: 24px;
  color: var(--faint);
}
[data-screen="season"] .season-axis .months .year {
  color: var(--dim);
}
[data-screen="season"] .season-axis .lane {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}
[data-screen="season"] .season-axis .blocks {
  height: 64px;
  margin-top: var(--s-2);
}
[data-screen="season"] .season-axis .blocks > [data-block] {
  top: 0;
  bottom: 0;
  width: calc(var(--span) * 100% - 3px);
  padding: var(--s-2) var(--s-3);
  display: grid;
  align-content: start;
  gap: 2px;
  overflow: hidden;
  text-decoration: none;
  color: var(--txt);
  background: color-mix(in srgb, var(--block, var(--line-2)) 10%, transparent);
  border-top: 3px solid var(--block, var(--line-2));
  border-radius: 0 0 var(--radius-s) var(--radius-s);
  transition: background var(--t-fast) var(--ease);
}
[data-screen="season"] .season-axis .blocks > a[data-block]:hover {
  background: color-mix(in srgb, var(--block, var(--line-2)) 18%, transparent);
}
/* The + after the last block: the one way in to adding a block. */
[data-screen="season"] .season-axis .blocks > .add-block {
  top: 0;
  bottom: 0;
  width: 40px;
  margin-left: 2px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--ring);
  border-radius: var(--radius-s);
  font-size: var(--fs-section-title);
  color: var(--accent);
  text-decoration: none;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}
/* A hover tints it and keeps its dashed edge; only focus takes the accent ring. */
[data-screen="season"] .season-axis .blocks > .add-block:hover {
  background: var(--fill-hover);
}
[data-screen="season"] .season-axis .blocks > .add-block:focus-visible {
  border-color: var(--accent);
  background: var(--accent-dim);
}
[data-screen="season"] .season-axis .blocks b {
  min-width: 0;
  font-weight: 600;
  font-size: var(--fs-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-screen="season"] .season-axis .blocks small {
  font-size: var(--fs-micro);
  color: var(--dim);
  white-space: nowrap;
}
/* The races' lane, over a target per week that opens Add race on its Sunday (#235). */
[data-screen="season"] .season-axis .race-lane {
  position: relative;
  margin-top: var(--s-2);
}
[data-screen="season"] .season-axis .races {
  height: 28px;
  pointer-events: none;
}
[data-screen="season"] .season-axis .races a {
  pointer-events: auto;
  color: var(--txt);
}
[data-screen="season"] .season-axis .add-races > a {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--at) * 100%);
  width: calc(var(--span) * 100%);
  border-radius: var(--radius-s);
  transition: background var(--t-fast) var(--ease);
}
[data-screen="season"] .season-axis .add-races > a:hover {
  background: var(--fill-hover);
}
[data-screen="season"] .season-axis .races > li {
  top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 -4px;
  font-size: var(--fs-sub);
  white-space: nowrap;
}
/* The race marker: a small diamond, drawn, on the race's day. */
[data-screen="season"] .season-axis .races > li::before,
[data-screen="season"] ol.ylist .race::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  background: var(--txt);
  transform: rotate(45deg);
}
[data-screen="season"] .season-axis .race-label {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--dim);
}
[data-screen="season"] .season-axis .today {
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 0;
  /* A quiet grey rule: today places the axis, it isn't a selection. */
  border-left: 1px solid var(--ring);
  pointer-events: none;
}
[data-screen="season"] .season-axis .today-label {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 0 4px;
  background: var(--bg);
  font-size: var(--fs-micro);
  font-weight: 600;
  line-height: 20px;
  color: var(--dim);
}
[data-screen="season"] ol.ylist .race {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--txt);
  font-weight: 600;
}
[data-screen="season"] ol.ylist .race::before {
  width: 6px;
  height: 6px;
}

/* ── The block page (block-page.tsx, ADR-0058) ──────────────────────── */
/*
 * Laid out as Add a block (the rules above): its strip doesn't stick, since the week table under
 * it is the block's summary, read as one with the strip.
 */
[data-screen="season"] .block-strip {
  position: static;
}
/* A locked value a pane row says in words (FTP at start): dim, as a locked control. */
[data-screen="season"] .pane-locked-value {
  font-size: var(--fs-sub);
  color: var(--dim);
}
[data-screen="season"] .block-lands {
  margin: 0;
  font-size: var(--fs-caption);
  color: var(--dim);
}
/*
 * The foot (#622): the changes listed a line each, when they land, what the plan refuses, then
 * Save and Reset changes on one line.
 */
[data-screen="season"] .block-foot {
  flex-direction: column;
}
[data-screen="season"] .block-changes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--s-1);
  font-size: var(--fs-sub);
}
[data-screen="season"] .block-refusal > p {
  margin: 0;
}
[data-screen="season"] .block-foot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
/* FTP at start: a short watts field at the row's end, its note dim after it. */
[data-screen="season"] .block-start-ftp input[type="number"] {
  width: 5.5rem;
  text-align: right;
}
/*
 * The week table: a column per block week, the label column first. Recovery, test and taper
 * columns are tinted, today's is shaded, and a rule stands before the first week a change can
 * reach. Narrow, it scrolls sideways (`.scroll`) rather than crush a column.
 */
[data-screen="season"] .block-weeks-section {
  margin: var(--s-5) 0;
}
[data-screen="season"] table.block-weeks {
  width: 100%;
  min-width: calc(7rem + var(--weeks) * 3.5rem);
  table-layout: fixed;
  border-collapse: collapse;
}
[data-screen="season"] .block-weeks :is(thead td:first-child, th[scope="row"]) {
  width: 7rem;
  padding: var(--s-1) var(--s-2) var(--s-1) 0;
  text-align: left;
  vertical-align: middle;
}
[data-screen="season"] .block-weeks [data-week] {
  padding: var(--s-1) 2px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: bottom;
}
[data-screen="season"] .block-weeks [data-week]:not([data-kind="load"]) {
  background: color-mix(in srgb, var(--txt) 4%, transparent);
}
[data-screen="season"] .block-weeks [data-week][data-tense="now"] {
  background: var(--fill-2);
}
[data-screen="season"] .block-weeks [data-week][data-from] {
  border-left: 2px solid var(--edge-on);
}
[data-screen="season"] .block-weeks thead th {
  padding-block: var(--s-2);
  font-size: var(--fs-caption);
  font-weight: 400;
  color: var(--dim);
}
[data-screen="season"] .block-weeks thead th[data-tense="now"] {
  font-weight: 600;
  color: var(--txt);
}
[data-screen="season"] .block-weeks-kind {
  display: block;
  min-height: 1lh;
  font-size: var(--fs-micro);
}
/* A TSS bar: planned behind, done in front once ridden, each a link to its week's row. */
[data-screen="season"] .block-weeks-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  height: calc(var(--add-bars-height) + 1lh);
  color: var(--dim);
  font-size: var(--fs-micro);
  text-decoration: none;
}
[data-screen="season"] .block-weeks-link:is(:hover, :focus-visible),
[data-screen="season"] .block-weeks-tss [data-over] {
  color: var(--txt);
}
[data-screen="season"] .block-weeks-bar {
  position: relative;
  width: 60%;
  height: var(--add-bars-height);
}
[data-screen="season"] :is(.block-weeks-planned, .block-weeks-done) {
  position: absolute;
  bottom: 0;
  border-radius: 2px 2px 0 0;
}
[data-screen="season"] .block-weeks-planned {
  left: 0;
  right: 0;
  height: calc(100% * var(--planned));
  background: var(--block, var(--dim));
}
[data-screen="season"] .block-weeks-done {
  left: 20%;
  right: 20%;
  height: calc(100% * var(--done));
  background: var(--block, var(--dim));
}
/* Ridden, planned steps back so done reads in front of it; a coming week's kind colours it, as Add a block's bars. */
[data-screen="season"] .block-weeks-tss:not([data-tense="future"]) .block-weeks-planned {
  background: color-mix(in srgb, var(--block, var(--dim)) 35%, transparent);
}
[data-screen="season"]
  .block-weeks-tss:is([data-kind="recovery"], [data-kind="deload"])[data-tense="future"]
  .block-weeks-planned {
  background: color-mix(in srgb, var(--block, var(--dim)) 40%, transparent);
}
[data-screen="season"]
  .block-weeks-tss:is([data-kind="test"], [data-kind="taper"])[data-tense="future"]
  .block-weeks-planned {
  background: var(--txt);
}
/* A progression's cell: the session over its level and mark; a week still to come is lighter. */
[data-screen="season"] .block-weeks-session {
  vertical-align: middle;
}
[data-screen="season"] :is(.block-weeks-work, .block-weeks-at) {
  display: block;
  white-space: nowrap;
}
[data-screen="season"] .block-weeks-work {
  font-size: var(--fs-caption);
  font-weight: 600;
}
[data-screen="season"] .block-weeks-at {
  font-size: var(--fs-micro);
  color: var(--dim);
}
[data-screen="season"] .block-weeks-session[data-projected] .block-weeks-work {
  font-weight: 400;
  color: var(--dim);
}
[data-screen="season"] .block-weeks-meta {
  display: flex;
  justify-content: center;
  gap: var(--s-1);
  font-size: var(--fs-micro);
}
[data-screen="season"] .block-weeks-level {
  color: var(--faint);
}
[data-screen="season"] .block-weeks-level[data-moved] {
  font-weight: 600;
  color: var(--txt);
}
[data-screen="season"] .block-weeks-quiet {
  vertical-align: middle;
  color: var(--faint);
}
[data-screen="season"] :is(.block-weeks-mark, .block-weeks-legend) [data-mark],
[data-screen="season"] .block-weeks-mark[data-mark] {
  font-weight: 700;
}
[data-screen="season"] [data-mark="earned"] {
  color: var(--green);
}
[data-screen="season"] [data-mark="held"] {
  color: var(--gold);
}
[data-screen="season"] [data-mark="missed"] {
  color: var(--warn);
}
[data-screen="season"] [data-mark="now"] {
  color: var(--accent);
}
[data-screen="season"] .block-weeks-legend {
  margin: var(--s-2) 0 0;
  font-size: var(--fs-micro);
  color: var(--faint);
}

/*
 * Settings (/settings): one narrow column, the access notice (when Rensei can't write) over
 * the Athlete form and Suggestions. See docs/design/DESIGN_SYSTEM.md; tokens only.
 */

[data-screen="settings"] .settings-layout {
  max-width: 44rem;
}
/* The notice stands a section's gap over the first section. */
[data-screen="settings"] .settings-layout > .notice {
  margin: 0 0 var(--s-8);
}
[data-screen="settings"] .settings-layout > section.section:first-child,
[data-screen="settings"] .settings-layout > .notice + section.section {
  margin-top: 0;
}
/* A link a Copy just made: the whole address, in the notice's width, over the rows. */
[data-screen="settings"] [data-made-link] {
  margin-bottom: var(--s-4);
}
[data-screen="settings"] [data-made-link] input {
  width: 100%;
}

/*
 * Sign in, Sign up and the setup link (sign-in.tsx, ADR-0062): one form in the form's own
 * width, and the line to the other page under it. See docs/design/DESIGN_SYSTEM.md; tokens only.
 */
[data-screen="sign-in"] {
  max-width: calc(var(--form-width) + 2 * var(--gutter));
}
[data-screen="sign-in"] .sign-in-other {
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}

/*
 * The sync screen (sync-screen.tsx, ADR-0047 decision 5): the sync's state with Retry, Refresh
 * and Sync now, then the sync log (sync-log.tsx), one row per write. Colour follows the kind:
 * a new session is accent, a change gold, a removal red (§1); a refused write reads in warn.
 */

/* ── The sync's state ───────────────────────────────────────────────── */
[data-screen="sync"] [data-sync-state] {
  margin: var(--s-5) 0 0;
}
[data-screen="sync"] .cluster[data-sync-state] .status {
  margin: 0;
}

/* Access refused: the reason and Settings, above the log. */
[data-screen="sync"] .notice {
  margin: var(--s-5) 0 0;
}
[data-screen="sync"] .notice p {
  margin: var(--s-1) 0 0;
}

/* ── Nothing planned yet ────────────────────────────────────────────── */
[data-screen="sync"] .in-sync {
  margin: var(--s-5) 0 0;
}
[data-screen="sync"] .in-sync-title {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-row-title);
  font-weight: 600;
  color: var(--txt);
}
[data-screen="sync"] .in-sync .next-step {
  margin-top: var(--s-4);
}

/* ── The sync log ───────────────────────────────────────────────────── */
[data-screen="sync"] [data-sync-log] {
  margin-top: var(--s-8);
}
[data-screen="sync"] table.entries td {
  padding-top: var(--s-2);
  padding-bottom: var(--s-2);
}
[data-screen="sync"] table.entries td.when,
[data-screen="sync"] table.entries td.date {
  width: 8rem;
  white-space: nowrap;
  color: var(--dim);
  font-size: var(--fs-sub);
}
[data-screen="sync"] table.entries td.name {
  font-weight: 500;
}
[data-screen="sync"] table.entries td.op {
  width: 5.5rem;
}
[data-screen="sync"] table.entries td.op .badge {
  margin-left: 0;
}
[data-screen="sync"] table.entries td.why,
[data-screen="sync"] table.entries td.by,
[data-screen="sync"] table.entries td.result {
  font-size: var(--fs-sub);
  color: var(--dim);
}
[data-screen="sync"] table.entries tr[data-result="failed"] td.result {
  color: var(--warn);
}

/* ── Phone width: rows stack, the header goes ───────────────────────── */
@media (max-width: 640px) {
  [data-screen="sync"] table.entries thead {
    display: none;
  }
  [data-screen="sync"] table.entries tr {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px var(--s-3);
    padding: var(--s-2) 0;
    border-top: 1px solid var(--line);
  }
  [data-screen="sync"] table.entries tbody > tr:first-child {
    border-top: 0;
  }
  [data-screen="sync"] table.entries td {
    display: block;
    width: auto;
    padding: 0;
    border-top: 0;
  }
  [data-screen="sync"] table.entries td.name,
  [data-screen="sync"] table.entries td.result {
    grid-column: 1 / -1;
  }
}

/*
 * Training structure (training-structure.tsx and training-structure/): wider than the
 * Guide. The basics as terms beside how levels move; each family's levels as a grid, its
 * route lit; each plan a week to a row, its sessions in full folded under it as ruled blocks.
 */

[data-screen="training-structure"] .section > p {
  max-width: 46rem;
}
/* A plan's title stays in view through its weeks, and goes back to its grid. */
[data-screen="training-structure"] .doc-sections > section[id^="plan-"] > .section-head {
  position: sticky;
  top: var(--appbar-height);
  z-index: 2;
  padding-top: var(--s-2);
  background: var(--bg);
}
[data-screen="training-structure"] .section-head a {
  color: inherit;
}
/* The plan's title is the way back to its grid: no underline on hover. */
[data-screen="training-structure"] .section-head a:hover {
  text-decoration: none;
}
[data-screen="training-structure"] .structure-meta {
  display: block;
  font-size: var(--fs-caption);
  color: var(--faint);
}

/* The basics: the terms, and beside them how levels move. */
[data-screen="training-structure"] .structure-basics {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--s-6);
  margin-top: var(--s-4);
}
[data-screen="training-structure"] .structure-terms {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: var(--s-2) var(--s-4);
  max-width: 46rem;
  margin: 0;
  font-size: var(--fs-sub);
}
[data-screen="training-structure"] .section > .structure-terms {
  grid-template-columns: 9rem 1fr;
  margin-top: var(--s-4);
  font-size: inherit;
}
[data-screen="training-structure"] .structure-terms dt {
  font-weight: 600;
}
[data-screen="training-structure"] .structure-terms dd {
  margin: 0;
  color: var(--dim);
}
[data-screen="training-structure"] .structure-aside {
  align-self: start;
  padding: var(--s-4);
  border-radius: var(--radius-l);
  background: var(--fill-2);
  font-size: var(--fs-sub);
}
[data-screen="training-structure"] .structure-moves {
  margin: var(--s-2) 0 0;
  padding-left: var(--s-5);
}
[data-screen="training-structure"] .structure-moves li + li {
  margin-top: var(--s-1);
}

/* A section's own controls: a caption before each row of links. */
[data-screen="training-structure"] .structure-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-5);
  margin: var(--s-3) 0 0;
}
[data-screen="training-structure"] .structure-control {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

/* A family's levels: a grid, the levels off the strategy's route dimmed. */
[data-screen="training-structure"] .structure-levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: var(--s-3);
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
}
[data-screen="training-structure"] .structure-level {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-l);
  transition: opacity var(--t) var(--ease);
}
[data-screen="training-structure"] .structure-level[data-off-route] {
  opacity: 0.3;
}
[data-screen="training-structure"] .structure-level-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
[data-screen="training-structure"] .structure-level-number {
  font-size: var(--fs-value);
  font-weight: 700;
  line-height: 1;
}
[data-screen="training-structure"] .structure-level .workout-shape {
  margin-top: var(--s-2);
}

/* A fold under a section: VO2's switching table, a plan's sessions. */
[data-screen="training-structure"] .structure-fold {
  margin-top: var(--s-4);
}
[data-screen="training-structure"] .structure-switch {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--s-6);
}

/* A plan as a grid: a row per week, a column per progression, its hours last. */
[data-screen="training-structure"] .plan-grid {
  display: grid;
  grid-template-columns: 7.5rem repeat(var(--rides), minmax(0, 1fr)) 4.5rem;
  gap: var(--s-1) var(--s-2);
  margin-top: var(--s-3);
  align-items: stretch;
}
[data-screen="training-structure"] .plan-grid :where(thead, tbody, tr) {
  display: contents;
}
/* The table's own rules give way to the grid's: no cell padding, no rules between rows. */
[data-screen="training-structure"] .plan-grid :where(th, td) {
  padding: 0;
  border: 0;
}
[data-screen="training-structure"] .plan-grid thead th {
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--line);
}
[data-screen="training-structure"] .plan-grid-week {
  display: flex;
  flex-direction: column;
  justify-content: center;
  white-space: normal;
  font-size: var(--fs-caption);
  font-weight: 600;
}
[data-screen="training-structure"] .plan-grid-week .structure-meta {
  font-weight: 400;
}
[data-screen="training-structure"] .plan-grid-ride {
  display: grid;
  grid-template-columns: 2rem 1fr;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  min-width: 0;
}
[data-screen="training-structure"] .plan-grid-ride[data-reduced] {
  border-style: dashed;
}
[data-screen="training-structure"] .plan-grid-level {
  font-size: 1.375em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}
[data-screen="training-structure"] .plan-grid-text {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  min-width: 0;
}
[data-screen="training-structure"] .plan-grid-headline {
  font-size: var(--fs-caption);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-screen="training-structure"] .plan-grid-tag {
  color: var(--faint);
}
[data-screen="training-structure"] .plan-grid-ride .workout-shape {
  height: 1.75rem;
  margin: 0;
}
[data-screen="training-structure"] .plan-grid-none {
  display: flex;
  align-items: center;
  padding: 0 var(--s-3);
  min-height: 3.5rem;
  font-size: var(--fs-caption);
  color: var(--faint);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
[data-screen="training-structure"] .plan-grid-hours {
  align-self: center;
  text-align: right;
  font-size: var(--fs-caption);
  color: var(--dim);
}
[data-screen="training-structure"] .plan-grid thead .plan-grid-hours {
  align-self: end;
  color: var(--faint);
}

/* A session in full: its week a ruled block, its choices side by side. */
[data-screen="training-structure"] .structure-week {
  margin-top: var(--s-8);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line-2);
  scroll-margin-top: calc(var(--appbar-height) + var(--s-4));
}
[data-screen="training-structure"] .structure-session {
  margin-top: var(--s-6);
}
[data-screen="training-structure"] .structure-session p {
  max-width: 46rem;
  margin: var(--s-2) 0 0;
  color: var(--dim);
}
[data-screen="training-structure"] .structure-group {
  margin-top: var(--s-3);
}
[data-screen="training-structure"] .structure-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-1);
}
[data-screen="training-structure"] .structure-choice {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
[data-screen="training-structure"] .structure-choice pre {
  margin: var(--s-2) 0 0;
  padding: var(--s-2);
  font-size: var(--fs-caption);
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  [data-screen="training-structure"] .structure-basics {
    grid-template-columns: minmax(0, 1fr);
  }
  [data-screen="training-structure"] .plan-grid {
    grid-template-columns: 4.5rem repeat(var(--rides), minmax(0, 1fr)) 3.5rem;
  }
}
