/* PACE web app: the design draft's look (claude.ai/artifact/XzgNYNBNPnP6EJ7JMFTxDQ) as one design
   system. Four layers, in this order, and no late overrides: a rule lives in one place.
   tokens: colours (light and dark), the data colours, type, space, radii, motion.
   base: elements. components: the parts the templates use. utilities: one-job helpers. */
@layer tokens, base, components, utilities;

/* Fonts served from this site, not Google (GDPR: no visitor IP to a third party; review R17).
   SIL Open Font License 1.1: static/fonts/OFL.txt. Latin subset from Fontsource. */
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/static/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("/static/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 800;
  font-display: swap; src: url("/static/fonts/outfit-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800;
  font-display: swap; src: url("/static/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); }

@layer tokens {
  :root {
    color-scheme: light dark;
    /* surfaces and text */
    --bg: #FAF8FC; --card: #FFFFFF; --ink: #24102D; --mute: #6B5A73; --line: #E6DEEA;
    --chip: #EFE8F2; --soft: #F3EEF6; --field: #8A7E90;
    /* tones: each with a soft background made from it */
    --acc: #D61C72; --acc-ink: #B0155F; --alert: #B42318; --warn: #8A5300; --ok: #1B7A43;
    --admin: #5B3FA6;  /* the admin's violet (D73), light and dark */
    --info: #2F5FA8; --neutral: var(--mute);
    --acc-soft: color-mix(in oklch, var(--acc) 12%, var(--card));
    --alert-soft: color-mix(in oklch, var(--alert) 12%, var(--card));
    --warn-soft: color-mix(in oklch, var(--warn) 14%, var(--card));
    --ok-soft: color-mix(in oklch, var(--ok) 12%, var(--card));
    /* the original plans (D76): one colour for "this is how it was", light and dark alike */
    --orig: color-mix(in oklch, var(--info) 16%, var(--card));
    --orig-line: color-mix(in oklch, var(--info) 38%, var(--card));
    --info-soft: color-mix(in oklch, var(--info) 12%, var(--card));

    /* the plan hero: dark on a light page, a calm card on a dark page */
    --hero-bg: var(--ink); --hero-ink: var(--bg);
    /* data colours: one per kind of session, the heart-rate zones, the chart's plain bar */
    --kind-run: #C2410C; --kind-gym: #2747A8; --kind-rehab: #0B6E64; --kind-bike: #6D3FC0;
    --kind-sauna: #7A5C3E; --kind-other: #4F5B55; --kind-rest: #8A948E; --kind-resting: #AEB7B1;
    --zone-1: #8AB4DC; --zone-2: #4A86C5; --zone-3: #E39A4F; --zone-4: #D0632A; --zone-5: #B42318;
    --bar: #858F89;
    /* meal thumbnails */
    --thumb: color-mix(in oklch, var(--acc) 18%, var(--card));
    --thumb-breakfast: color-mix(in oklch, #D9A21B 22%, var(--card));
    --thumb-lunch: color-mix(in oklch, var(--ok) 18%, var(--card));
    /* brand (webapp/brand/_index.md): the logo's gradient and the wordmark */
    --brand: linear-gradient(135deg, #FF8C2B 0%, #F72585 50%, #7209B7 100%);
    --wordmark: #3B0A45; --wordmark-font: 'Outfit', var(--display);
    /* type: Atkinson for reading, Bricolage for headings and numbers */
    --display: 'Bricolage Grotesque', 'Atkinson Hyperlegible', system-ui, sans-serif;
    --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
    --step--2: 0.8125rem;  /* 13px: the smallest text anywhere */
    --step--1: 0.875rem;   /* 14px */
    --step-0: 1rem;        /* 16px */
    --step-0b: 1.125rem;   /* 18px: a small heading or number */
    --step-1: 1.25rem;     /* 20px */
    --step-2: 1.5rem;      /* 24px */
    --step-3: clamp(1.625rem, 1.4rem + 1vw, 1.875rem);  /* h1 */
    --step-4: 2.5rem;      /* the big number */
    /* space and shape */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
    --r-xs: 4px; --r-s: 10px; --r-m: 14px; --r-l: 18px; --r-xl: 22px; --r-full: 999px;
    --tap: 44px;
    /* one look (D98): two content widths on a PC, the side bar, the page behind the cards */
    --w-read: 720px; --w-wide: 1120px; --side: 216px;
    --side-bg: #2B0B36; --side-ink: #FFFFFF; --page: #F4EFF7;
    --shadow: 0 1px 2px rgb(36 16 45 / .05), 0 6px 20px rgb(36 16 45 / .05);
    --ease: cubic-bezier(.2, .7, .2, 1); --fast: 120ms; --slow: 240ms;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #13091C; --card: #1E1229; --ink: #F3ECF6; --mute: #B5A6BD; --line: #35243F;
      --chip: #2C1D36; --soft: #2C1D36; --field: #7D6E86;
      --acc: #FF6FAE; --acc-ink: #FF6FAE; --alert: #F2867A; --warn: #E2B15C; --ok: #6FCB93;
      --info: #8FB3EE;
      --warn-soft: color-mix(in oklch, var(--warn) 16%, var(--card));
      --hero-bg: #2C1D36; --hero-ink: var(--ink); --wordmark: #F3ECF6;
      --side-bg: #1A0E24; --page: var(--bg); --shadow: none;
      --kind-run: #F08A55; --kind-gym: #7D9BF0; --kind-rehab: #4FC2B4; --kind-bike: #B395F0;
      --kind-sauna: #C9A27C; --kind-other: #A7B1AB; --kind-rest: #7C8781; --kind-resting: #66716B;
      --zone-1: #C5DCEF; --zone-2: #7FB0DB; --zone-3: #F2B880; --zone-4: #E57A44; --zone-5: #F2867A;
      --bar: #7C8781;
      --thumb: var(--soft); --thumb-breakfast: var(--soft); --thumb-lunch: var(--soft);
    }
  }
}

@layer base {
  * { box-sizing: border-box; }
  @view-transition { navigation: auto; }
  body { margin: 0; background: var(--bg); color: var(--ink); font: var(--step-0)/1.45 var(--body);
    overflow-wrap: break-word; -webkit-tap-highlight-color: transparent; }
  /* Long text may break inside a word; a label, button or heading never does. */
  p, li, dd { hyphens: auto; }
  main { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px;
    padding: max(20px, env(safe-area-inset-top)) max(var(--sp-4), env(safe-area-inset-right))
      calc(96px + env(safe-area-inset-bottom)) max(var(--sp-4), env(safe-area-inset-left)); }
  a { color: var(--ink); }
  @media (hover: hover) { a:hover { color: var(--acc); } a.btn:hover, a.card:hover { color: inherit; } }
  h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
  h1 { font-size: var(--step-3); line-height: 1.1; }
  h2 { font-size: var(--step-1); }
  :focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
  details summary { cursor: pointer; font-weight: 700; min-height: var(--tap); display: flex;
    align-items: center; }
  details ul { margin: 0; padding-left: 20px; font-size: var(--step--1); }
  select, textarea, input { font: inherit; }
  @media (min-width: 600px) { main { max-width: var(--w-read); } }  /* a tablet reads wider (D98) */
  fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
  legend { padding: 0; }
  input[type=radio], input[type=checkbox] { margin: 0; }
}

@layer components {
  /* Icons: an inline SVG sprite in base.html (Lucide, MIT) */
  .i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }

  /* Numbers in the display face, with digits of one width */
  .num { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0;
    font-variant-numeric: tabular-nums; }
  .title-m { font-size: var(--step-1); }
  .big { font-size: var(--step-4); line-height: 1; }
  .big span { font-size: var(--step-0b); font-weight: 500; }

  /* Header: a title with an optional line under it and an action on the side */
  header p { margin: var(--sp-1) 0 0; }
  header .row { margin-top: var(--sp-2); }
  .back { min-height: var(--tap); display: inline-flex; align-items: center; font-weight: 700;
    text-decoration: none; align-self: flex-start; margin-block: -8px -12px; }

  /* Card */
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
    padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3);
    box-shadow: var(--shadow); }
  .card p { margin: 0; }
  button.card { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
  .card.alt { flex-direction: row; justify-content: space-between; align-items: center; }
  /* One tappable card (D90): a link card has no underline; with .between its chevron sits right */
  a.card, .card > a.between { color: inherit; text-decoration: none; }  /* a row link in a card too */
  .card > a.between { align-items: center; }
  a.card.between, button.card.between { flex-direction: row; align-items: center; }
  @media (hover: hover) { a.card:hover, button.card:hover, .timeline .block:hover { border-color: var(--acc); } }  /* .tile keeps the admin colour */
  .later { padding: var(--sp-3) var(--sp-4); }
  .next { background: var(--acc-soft); border-color: transparent; gap: 10px; }
  .next .num { font-size: 1.375rem; line-height: 1.15; }
  .next .chip { background: var(--card); }
  .empty h2 { font-size: var(--step-1); }

  /* Diary banner on Today (D75): one narrow tap row above "Up next" */
  .banner { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
    min-height: var(--tap); padding: 8px 14px; border-radius: var(--r-m);
    background: var(--acc-soft); color: var(--ink); text-decoration: none;
    font-size: var(--step--1); }
  .banner.filled { background: var(--ok-soft); }
  .banner.filled b { color: var(--ok); }
  .day-nav { align-items: center; }

  /* Callout: one component for every message, its tone in --tone (and a word, never colour
     alone: the `when` line or the text says what it is) */
  [hidden] { display: none !important; }  /* `hidden` wins over a component's display (D88 z) */
  .callout { --tone: var(--neutral); margin: 0; padding: 10px 14px; border-radius: var(--r-m);
    border-inline-start: 4px solid var(--tone); background: var(--soft);
    background: color-mix(in oklch, var(--tone) 12%, var(--card)); color: var(--ink);
    display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--step--1); }
  .callout.ok { --tone: var(--ok); }
  .callout.warn { --tone: var(--warn); }
  .callout.alert { --tone: var(--alert); }
  .callout.info { --tone: var(--info); }
  .callout.big { padding: 14px var(--sp-4); font-size: var(--step-0); }
  .watch-fold summary { min-height: 0; color: var(--ink); }
  .watch-fold ul { margin: var(--sp-2) 0 var(--sp-3); display: grid; gap: 6px; font-size: var(--step--1); }
  .callout .when { display: block; color: var(--tone); font-size: var(--step--2); font-weight: 700; }
  .callout b { color: var(--ink); }
  .callout.ok > b:first-child { color: var(--ok); }
  .callout.action { gap: 10px; align-items: flex-start; padding: var(--sp-4); }
  .hint { font-size: var(--step--1); color: var(--mute); margin: 0; }  /* O.9.25: 14 px, 13 was too small to read */
  .kicker { font-size: var(--step--2); color: var(--acc-ink); font-weight: 700; }
  .warn-line { font-size: var(--step--2); color: var(--warn); font-weight: 700; }

  /* Chips */
  .chip { display: inline-flex; padding: var(--sp-1) 10px; border-radius: var(--r-full);
    background: var(--chip); font-size: var(--step--2); font-weight: 700; white-space: nowrap;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; gap: var(--sp-1); align-items: center; }
  .chip.ok { background: var(--ok-soft); color: var(--ok); }
  /* D80 (F7.7.34): done clearly green, skipped clearly red (struck through), moved labelled;
     the check, the strike and the arrow stay, so colour is never the only sign */
  .chip.skip { background: var(--alert-soft); color: var(--alert); }
  .chip.moved { background: var(--info-soft); color: var(--info); }
  .card.done, .session.done { background: var(--ok-soft); box-shadow: inset 0 0 0 1.5px var(--ok); }
  .card.skipped, .session.skipped { background: var(--alert-soft); box-shadow: inset 0 0 0 1.5px var(--alert); }
  .card.skipped b, .session.skipped b, .cal-ev.skipped b { text-decoration: line-through; }
  .session.done, .session.skipped { padding: 10px; border-radius: var(--r-s); border-top-color: transparent; }
  .cal-ev.done { background: var(--ok-soft); border-left-color: var(--ok); box-shadow: inset 0 0 0 1.5px var(--ok); }
  .cal-ev.skipped { background: var(--alert-soft); border-left-color: var(--alert); box-shadow: inset 0 0 0 1.5px var(--alert); }
  .cal-ev.done span { color: var(--ok); }
  .cal-ev.skipped span { color: var(--alert); }
  /* review 2026-11-10: on a block only a mark before the title, no status words */
  .cal-ev .mark { font-style: normal; }
  .cal-ev.done .mark { color: var(--ok); }
  .cal-ev.skipped .mark { color: var(--alert); }
  .cal-ev .mark.moved { color: var(--info); }
  .cal-ev.skipped b { text-decoration: none; }  /* the <s> title only, not its mark */
  .sheet-head.done { background: var(--ok-soft); }
  .sheet-head.skipped { background: var(--alert-soft); }
  .sheet-head.skipped h2 { text-decoration: line-through; }
  .sheet-state { margin-top: var(--sp-2); flex-wrap: wrap; gap: var(--sp-2); }
  .notdone-skip { border-top: 1px solid var(--line); padding-top: var(--sp-3); margin-top: var(--sp-3); }
  .chip.warn { background: var(--warn-soft); color: var(--warn); }
  .chip.strong { background: var(--ink); color: var(--bg); }

  /* Buttons (D98): .btn the one main action of a card, .ghost any other, .danger what removes,
     .quiet a small action in a list row; .sm is the small size. From 600 px a button in a
     card or on the page is as wide as its text, on a phone it fills the row. */
  .btn { min-height: 48px; padding: 0 18px; border: 0; border-radius: var(--r-m);
    background: var(--ink); color: var(--bg); font: inherit; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    text-decoration: none; }
  .btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--field); }
  .btn.danger { color: var(--alert); border-color: var(--alert); }
  .btn.danger:not(.ghost) { background: var(--alert); color: var(--bg); }  /* the one main step of a danger popup */
  .btn.sm { min-height: var(--tap); padding: 0 14px; font-size: var(--step--1); }
  .btn.quiet { background: none; border: 0; color: var(--mute); text-decoration: underline;
    padding: 0 var(--sp-2); }
  @media (hover: hover) { .btn.quiet:hover { color: var(--alert); } }
  @media (min-width: 600px) {
    body:has(nav.tabs) main > .btn, body:has(nav.tabs) .card:not(.alt, .hero) > .btn,
    body:has(nav.tabs) .card:not(.alt) > form > .btn, body:has(nav.tabs) .to-watch > .btn {
      align-self: flex-start; min-width: 11rem; }
    body:has(nav.tabs) .card > .btn.sm, body:has(nav.tabs) main > .btn.sm { min-width: 0; }
  }
  .btn.wide { flex: 1; }
  .btn:disabled { opacity: .5; cursor: default; }
  .card.alt .btn { min-height: var(--tap); }
  /* a toggle is a ghost button; pressed it is filled, like a chosen day or tab (D90) */
  .btn.ghost[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .soon { min-height: 48px; padding: 0 var(--sp-4); border-radius: var(--r-m);
    border: 1.5px dashed var(--line); background: none; color: var(--mute); font: inherit;
    font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
    gap: var(--sp-2); cursor: not-allowed; }
  .soon.small { min-height: 36px; padding: 0 10px; font-size: var(--step--2); }
  .soon.wide { flex: 1; }
  .link { color: var(--mute); font-size: var(--step--1); text-align: center; min-height: var(--tap);
    display: inline-flex; align-items: center; justify-content: center; }
  .inline-tap { display: inline-flex; min-height: var(--tap); align-items: center; }
  .close { width: var(--tap); height: var(--tap); border-radius: var(--r-full);
    border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; padding: 0; }

  /* Tap feedback: a press shows; a form on its way shows it is busy */
  .btn, button.card, a.card, .session, .daypick a, nav.tabs a, .seg a, .plan-week,
  .timeline .block, .close {
    transition: transform var(--fast) var(--ease), background-color var(--fast) var(--ease),
      border-color var(--fast) var(--ease); }
  .btn:active, button.card:active, a.card:active, .daypick a:active, .seg a:active,
  .close:active, .timeline .block:active { transform: scale(.98); }
  .session:active, .plan-week:active, nav.tabs a:active { background: var(--soft); }
  form[inert] [type=submit] { opacity: .6; cursor: progress; }

  /* Avatar and brand */
  .avatar { width: var(--tap); height: var(--tap); border-radius: var(--r-full); background: var(--ink);
    color: var(--bg); display: flex; align-items: center; justify-content: center;
    font-weight: 700; text-decoration: none; flex: none; }
  .big-avatar { width: 64px; height: 64px; font-size: 1.75rem; background: var(--acc); color: var(--bg); }
  .brand { display: flex; align-items: center; gap: var(--sp-3); }
  .wordmark { font-family: var(--wordmark-font); font-weight: 800; letter-spacing: -0.03em;
    text-transform: lowercase; color: var(--wordmark); }
  .logo img { width: 100%; height: 100%; border-radius: inherit; display: block; }
  .logo { width: 48px; height: 48px; border-radius: var(--r-m); background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-family: var(--display);
    font-size: 1.625rem; font-weight: 700; flex: none; }

  /* Day picker: the day strip on Today and the week of days on Food */
  .daypick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .daypick a { position: relative; border: 1px solid var(--line); background: var(--card);
    border-radius: var(--r-m); padding: var(--sp-2) 0 9px; display: flex; flex-direction: column;
    align-items: center; gap: 2px; min-height: 64px; text-decoration: none;
    font-variant-numeric: tabular-nums; }
  .daypick a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .daypick a.off { color: var(--mute); border-style: dashed; }
  .daypick small { font-size: var(--step--2); opacity: .85; }
  .daypick b { font-family: var(--display); font-size: var(--step-0b); }
  .daypick.kcal b { font-size: var(--step-0); }
  .strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 calc(-1 * var(--sp-4)); padding: 0 var(--sp-4); scroll-padding: 0 var(--sp-4); }
  .strip::-webkit-scrollbar { display: none; }
  .wk { flex: 0 0 100%; scroll-snap-align: start; padding-right: 6px; }
  .wk-label { grid-column: 1 / -1; text-align: center; font-size: var(--step--2); color: var(--mute); }
  .strip-wrap { position: relative; }
  .strip-arrow { display: none; }
  @media (hover: hover) and (pointer: fine) and (min-width: 640px) {
    .strip-arrow { display: flex; position: absolute; top: 10px; z-index: 1; width: var(--tap); height: var(--tap);
      border-radius: var(--r-full); border: 1px solid var(--line); background: var(--card);
      color: var(--ink); align-items: center; justify-content: center; cursor: pointer; padding: 0; }
    .strip-arrow.prev { left: -30px; }
    .strip-arrow.next { right: -30px; }
  }
  .dots { display: flex; gap: 3px; height: 7px; }
  .dot { width: 7px; height: 7px; border-radius: var(--r-full); }
  .dot.rest { border: 1.5px solid var(--mute); }
  .flagdot { position: absolute; top: 4px; right: 5px; width: 8px; height: 8px;
    border-radius: var(--r-full); background: var(--warn); }

  /* Data colours: a class per kind of session and per zone */
  .k-run { background: var(--kind-run); }
  .k-gym { background: var(--kind-gym); }
  .k-rehab { background: var(--kind-rehab); }
  .k-bike { background: var(--kind-bike); }
  .k-sauna { background: var(--kind-sauna); }
  .k-other { background: var(--kind-other); }
  .k-rest { background: var(--kind-rest); }
  .k-resting { background: var(--kind-resting); }

  /* Week as a calendar (D76, F7.7.18): from 900 px Monday to Sunday side by side on an hour
     grid; the phone keeps the list. Python gives each block its row, span and lane. */
  .week-list { display: flex; flex-direction: column; gap: 18px; }  /* as main's own gap */
  .week-cal { display: none; }
  .cal-head, .cal-body { display: grid; grid-template-columns: 3.25rem repeat(7, minmax(0, 1fr)); }
  .cal-head { position: sticky; top: 0; z-index: 1; background: var(--card); padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--line); }
  .cal-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
    border-radius: var(--r-s); text-align: center; }
  .cal-day.today { background: var(--soft); }
  .week-cal { --slot: 16px; }
  .cal-body { padding-top: var(--sp-2); }
  /* D80 (F7.7.35): the whole day in a box that shows 07-20 at first and scrolls; the day heads
     sit above the box, so they stay; the same gutter keeps their columns over the grid's */
  .cal-scroll { position: relative; overflow-y: auto; scrollbar-gutter: stable;
    max-height: calc(var(--slot) * 4 * 13 + var(--sp-2)); }
  .cal-head { overflow-y: hidden; scrollbar-gutter: stable; }
  .cal-hours, .cal-col { display: grid; grid-template-rows: repeat(var(--rows), var(--slot)); }
  .cal-hours span { font-size: var(--step--2); color: var(--mute); text-align: right; padding-right: 8px;
    transform: translateY(-.55em); }
  .cal-col { column-gap: 2px; padding: 0 3px; border-left: 1px solid var(--line);
    background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px calc(var(--slot) * 4)); }
  .cal-col.today { background-color: color-mix(in srgb, var(--acc) 7%, transparent); }
  .cal-col.blocked { background-color: var(--soft); }
  .cal-ev { --k: var(--kind-other); min-width: 0; overflow: hidden; display: flex; flex-direction: column;
    gap: 1px; margin: 1px 0; padding: 3px 6px; border: 0; border-left: 3px solid var(--k);
    border-radius: 6px; background: color-mix(in srgb, var(--k) 26%, var(--card)); color: var(--ink);
    font: inherit; font-size: var(--step--2); line-height: 1.25; text-align: left; cursor: pointer; }
  .cal-ev b { font-size: var(--step--1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-ev span { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cal-ev:hover, .cal-ev:focus-visible { background: color-mix(in srgb, var(--k) 40%, var(--card)); }
  .cal-ev.conflict { outline: 1.5px dashed var(--warn); outline-offset: -1.5px; }
  /* Drag and drop (D76, F7.7.23): the block follows the pointer, its target day lights up */
  .cal-ev[data-move-key] { cursor: grab; touch-action: manipulation; user-select: none; }
  .cal-ev.dragging { cursor: grabbing; z-index: 3; opacity: .9; box-shadow: 0 8px 24px rgb(0 0 0 / .35);
    position: relative; overflow: visible; }
  .cal-ev.dragging::after { content: attr(data-drop); position: absolute; left: 0; bottom: 100%; margin-bottom: 4px;
    padding: 2px 8px; border-radius: var(--r-s); background: var(--ink); color: var(--card); font-size: var(--step--2);
    font-weight: 700; white-space: nowrap; }
  .cal-col.drop { background-color: color-mix(in oklch, var(--acc) 10%, transparent); }
  /* The Undo snackbar after a move (D76) */
  .snackbar { position: fixed; left: 50%; bottom: max(84px, calc(env(safe-area-inset-bottom) + 84px)); z-index: 20;
    transform: translateX(-50%); display: flex; align-items: center; gap: var(--sp-3);
    width: max-content; max-width: calc(100vw - 32px); padding: 10px 10px 10px 16px; border-radius: var(--r-m);
    background: var(--ink); color: var(--card); box-shadow: 0 8px 24px rgb(0 0 0 / .3);
    transition: opacity var(--slow) var(--ease), transform var(--slow) var(--ease); }
  .snackbar form { margin: 0; }
  .snackbar .btn { background: var(--card); color: var(--ink); }
  .snackbar.gone { opacity: 0; transform: translate(-50%, 12px); visibility: hidden; pointer-events: none; }
  @media (min-width: 900px) { .snackbar { bottom: 24px; margin-left: calc(var(--side) / 2); } }
  /* The ghost plan (D76): the original where it differs, faded and dashed, under the blocks */
  .cal-ev.ghost { background: var(--orig); border: 1.5px dashed var(--orig-line); border-left: 3px solid var(--k); }
  .cal-ev.ghost:hover, .cal-ev.ghost:focus-visible { background: color-mix(in oklch, var(--info) 26%, var(--card)); }
  .cal-ev.ghost b { font-weight: 600; color: var(--mute); }
  /* Every original plan (D76, F7.7.21): a row per plan above the hour grid, per day */
  .cal-label { padding: var(--sp-3) 0 var(--sp-1); font-weight: 700; }
  .orig-panel { margin-top: var(--sp-3); padding: 0 var(--sp-3) var(--sp-2); border-radius: var(--r-m);
    background: var(--orig); border: 1px solid var(--orig-line); }
  .orig-panel .cal-orig:last-child { border-bottom: 0; }
  .cal-orig { display: grid; grid-template-columns: 3.25rem repeat(7, minmax(0, 1fr));
    padding-bottom: var(--sp-2); border-bottom: 1px solid var(--orig-line); }
  .cal-orig-name { grid-column: 1 / -1; padding: 6px 0 4px; font-size: var(--step--1); }
  .cal-orig-day { display: flex; flex-direction: column; gap: 2px; padding: 0 3px; min-width: 0; }
  .cal-ev.orig { padding: 2px 6px; background: color-mix(in oklch, var(--k) 22%, var(--orig)); }
  .cal-ev.orig span { color: var(--ink); white-space: normal; }
  .pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
  .orig { display: grid; gap: 2px; padding: var(--sp-2) 0; border-top: 1px solid var(--orig-line); }
  .orig-line { font-size: var(--step--1); }
  .week-tools { flex-wrap: wrap; }
  .week-tools .btn { white-space: nowrap; }
  .ghost-line { display: flex; gap: 10px; align-items: stretch; width: 100%; margin: 4px 0; padding: 6px 8px;
    border: 0; border-radius: var(--r-s); background: var(--orig); color: var(--ink); font: inherit;
    font-size: var(--step--1); text-align: left; cursor: pointer; }
  .orig-card { background: var(--orig); border-color: var(--orig-line); }
  .orig-item { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border: 1px solid var(--orig-line);
    border-radius: var(--r-s); background: var(--card); color: var(--ink); font: inherit;
    font-size: var(--step--1); cursor: pointer; }
  .orig-item:hover, .orig-item:focus-visible { border-color: var(--info); }
  .ghost-line .stripe { opacity: .5; }
  .cal-ev.k-run { --k: var(--kind-run); }
  .cal-ev.k-gym { --k: var(--kind-gym); }
  .cal-ev.k-rehab { --k: var(--kind-rehab); }
  .cal-ev.k-bike { --k: var(--kind-bike); }
  .cal-ev.k-sauna { --k: var(--kind-sauna); }
  @media (min-width: 900px) {
    .week-list { display: none; }
    .week-cal { display: block; padding: var(--sp-3) var(--sp-3) var(--sp-4); }
    main > .pager { justify-content: center; gap: var(--sp-5); }  /* the arrows next to the title */
  }
  /* Today (D79, F7.7.29): one column on a phone, To watch last; two columns from 900 px */
  .today-cols, .today-main, .today-side, .to-watch { display: flex; flex-direction: column; gap: 18px; }
  .today-side .to-watch { order: 9; }
  @media (min-width: 900px) {
    .today-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px;
      align-items: start; }
    .today-cols.solo { grid-template-columns: minmax(0, 1fr); max-width: var(--w-read); }
    .today-side .to-watch { order: 0; }
    .today-side { position: sticky; top: 16px; }  /* D90: energy and To watch stay in view */
  }
  .z1 { background: var(--zone-1); }
  .z2 { background: var(--zone-2); }
  .z3 { background: var(--zone-3); }
  .z4 { background: var(--zone-4); }
  .z5 { background: var(--zone-5); }

  /* Sessions */
  h2.part { font-size: var(--step--1); text-transform: uppercase; letter-spacing: .06em;
    color: var(--mute); margin: 6px 0 -6px; }
  h2.part.next-part { color: var(--acc-ink); }
  .zones { display: flex; gap: 3px; height: 12px; width: 100%; }
  .zones > * { border-radius: 2px; }
  .zones > :first-child { border-radius: 4px 2px 2px 4px; }
  .zones > :last-child { border-radius: 2px 4px 4px 2px; }
  .day { display: flex; flex-direction: column; gap: var(--sp-2); }
  .day.today { box-shadow: inset 0 0 0 1px var(--ink); border-color: var(--ink); }
  .session { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; width: 100%;
    border: 0; border-top: 1px solid var(--line); background: none; color: inherit; font: inherit;
    text-align: left; cursor: pointer; }
  .stripe { width: 6px; align-self: stretch; border-radius: 3px; flex: none; }
  .session .what { flex: 1; display: flex; flex-direction: column; gap: 2px; }
  .left-out { font-size: var(--step--1); color: var(--mute); }
  /* Change time / date (D76): a small popup over the sheet, the browser's own picker */
  .picker { width: min(24rem, calc(100vw - 32px)); border: 0; border-radius: var(--r-l); padding: var(--sp-4);
    background: var(--card); color: var(--ink); box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
  .picker::backdrop { background: rgb(20 8 30 / .5); }
  .picker h2, .picker p { margin: 0; }
  .picker .dialog-btns { display: flex; justify-content: flex-end; gap: var(--sp-2); }
  .two-btns > .btn { flex: 1; }
  .card.closed { background: var(--soft); border-style: dashed; display: grid; gap: 10px; }
  .wk-closed { display: flex; gap: 10px; align-items: stretch; margin: 4px 0; padding: 6px 8px;
    border: 1px dashed var(--line); border-radius: var(--r-s); background: var(--soft); color: var(--ink);
    font-size: var(--step--1); text-decoration: none; }
  .wk-closed .stripe { opacity: .5; }
  .wk-closed-n { font-size: var(--step--1); color: var(--ink); }

  /* Session sheet: a popover that rises from the bottom */
  .sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 600px;
    max-height: 88vh; max-height: 88dvh; overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom); overflow-y: auto;
    border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--card); color: var(--ink);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .25);
    transition: transform var(--slow) var(--ease), overlay var(--slow) allow-discrete,
      display var(--slow) allow-discrete; transform: translateY(100%); }
  .sheet:popover-open { transform: none; }
  @starting-style { .sheet:popover-open { transform: translateY(100%); } }
  .sheet::backdrop { background: rgba(0, 0, 0, .45); }
  .sheet-head { display: flex; gap: var(--sp-3); align-items: flex-start; padding: 18px var(--sp-4) var(--sp-2); }
  .sheet-title { flex: 1; }
  .tabs-in { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 var(--sp-4) var(--sp-5); }
  .tabs-in.two { grid-template-columns: repeat(2, 1fr); }
  .tabs-in input { position: absolute; opacity: 0; pointer-events: none; }
  .tabs-in label { min-height: var(--tap); display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: var(--mute); border-bottom: 2px solid var(--line); cursor: pointer; }
  .tabs-in input:checked + label { color: var(--ink); border-bottom-color: var(--acc); }
  .tabs-in input:focus-visible + label { outline: 2px solid var(--acc); outline-offset: -2px; }
  .pane { grid-column: 1 / -1; grid-row: 2; display: none; flex-direction: column; gap: var(--sp-3);
    padding-top: var(--sp-4); }
  .tabs-in input:nth-of-type(1):checked ~ .pane:nth-of-type(1),
  .tabs-in input:nth-of-type(2):checked ~ .pane:nth-of-type(2),
  .tabs-in input:nth-of-type(3):checked ~ .pane:nth-of-type(3) { display: flex; }
  .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .facts div { background: var(--soft); border-radius: var(--r-m); padding: 10px var(--sp-3);
    display: flex; flex-direction: column; }
  .steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
  .steps li > .btn { display: flex; margin-top: var(--sp-2); }  /* a step's own button (F9.8c) */

  /* Energy and ranges */
  .bar { position: relative; height: 12px; background: var(--soft); border-radius: 6px; margin-top: 6px; }
  .bar .aim { position: absolute; top: 0; bottom: 0; background: var(--ok-soft);
    border: 1.5px solid var(--ok); border-radius: 6px; }
  .bar .mark { position: absolute; top: -4px; width: 4px; height: 20px; background: var(--ink);
    border-radius: 2px; margin-left: -2px; }
  .range-head { font-size: var(--step--1); }
  .parts { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
  .parts + .legend { margin-top: 6px; }
  .legend { display: flex; flex-wrap: wrap; gap: 6px var(--sp-3); font-size: var(--step--2); color: var(--mute); }
  .legend i { display: inline-block; width: 10px; height: 10px; border-radius: var(--r-full);
    margin-right: var(--sp-1); vertical-align: -1px; }
  .legend i.sq { border-radius: 3px; }
  .legend i.now { background: var(--ink); }
  .legend i.hit { background: var(--acc); }
  .legend b { color: var(--ink); }

  /* Meals */
  .meal { display: grid; grid-template-columns: 52px 1fr; gap: 2px 10px; padding: var(--sp-2) 0;
    border-top: 1px solid var(--line); }
  .meal:first-of-type { border-top: 0; }
  .meal time { color: var(--mute); font-size: var(--step--1); }
  .food-meal { flex-direction: row; padding: var(--sp-3); }
  .food-meal .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
  .food-meal .what a { text-decoration: none; line-height: 1.25; }
  .thumb { width: 64px; height: 64px; border-radius: var(--r-m); background: var(--thumb);
    display: flex; align-items: center; justify-content: center; font-size: 1.625rem; flex: none;
    text-decoration: none; }
  .thumb.breakfast { background: var(--thumb-breakfast); }
  .thumb.lunch { background: var(--thumb-lunch); }
  .stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line);
    border-radius: var(--r-s); }
  .stepper b { min-width: 30px; text-align: center; font-size: var(--step--1); padding: 0 var(--sp-1); }
  .stepper button { width: var(--tap); height: var(--tap); border: 0; background: none; color: var(--mute);
    font: inherit; font-size: var(--step-0b); font-weight: 700; cursor: not-allowed; opacity: .5; }
  .stepper.on button { color: var(--ink); cursor: pointer; opacity: 1; }
  .stepper.on button:disabled { color: var(--mute); cursor: default; opacity: .5; }
  .stepper button:focus-visible { outline: 3px solid var(--acc); outline-offset: -3px; }
  .big-step { background: var(--card); }
  .big-step button { width: var(--tap); height: var(--tap); }
  .to-go { display: flex; align-items: center; gap: var(--sp-3); padding: 14px var(--sp-4);
    border-radius: var(--r-l); border: 1.5px dashed var(--line); }
  .to-go > div { flex: 1; }
  .ingredients { margin: 0; padding: 0; list-style: none; }
  .ingredients li { padding: 10px 0; border-top: 1px solid var(--line); }
  .ingredients li:first-child { border-top: 0; }
  .recipe-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
  .send { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
  .send button { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1);
    padding: 14px; min-height: 96px; border-radius: var(--r-l); border: 1.5px dashed var(--line);
    background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: not-allowed; }
  .send button.live { border-style: solid; cursor: pointer; }
  .shop { display: flex; align-items: flex-start; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line);
    cursor: pointer; }
  .shop:first-child { border-top: 0; }
  .shop > span { display: flex; flex-direction: column; }
  .shop { --tick: var(--ok); }
  .shop input { margin: 2px 0 0; }
  .shop:has(input:checked) .shop-what { text-decoration: line-through; color: var(--mute); }
  /* Food on a PC (D87, F7.7.46; D90): meals left and wide, energy right and in view, as Today */
  .food-cols, .food-side { display: flex; flex-direction: column; gap: 18px; }
  @media (min-width: 900px) {
    .food-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; align-items: start; }
    .food-cols > .food-side:first-child { order: 2; position: sticky; top: 16px; }
  }
  /* Groceries on paper (F7.7.43): only the list */
  @media print {
    nav, header, .back, .pager a, .send, .callout, [data-share-status], h2 + label.row, .shop input { display: none !important; }
    .shop:has(input:checked) .shop-what { text-decoration: none; color: inherit; }
    body, .card { background: #fff !important; color: #000 !important; box-shadow: none !important; border: 0 !important; }
  }

  /* Week */
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); padding: var(--sp-3); }
  .stat .num { font-size: var(--step-2); }
  .book-min { margin: var(--sp-2) 0 0; font-size: var(--step--1); }
  .pager { display: flex; justify-content: space-between; align-items: center; }
  .pager > div { text-align: center; }
  .pager a, .pager > span { min-height: var(--tap); min-width: var(--tap); display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; text-decoration: none; }
  .pager > span { color: var(--line); }

  /* Bottom tabs: an icon over a label */
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card);
    padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line);
    display: flex; justify-content: center; }
  nav.tabs div { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; max-width: 560px; }
  nav.tabs a { min-height: 60px; display: flex; flex-direction: column; gap: 2px; align-items: center;
    justify-content: center; font-size: var(--step--2); font-weight: 700; text-decoration: none;
    color: var(--mute); }
  nav.tabs a .i { width: 22px; height: 22px; }
  nav.tabs a.on { color: var(--ink); box-shadow: inset 0 3px 0 var(--acc); }
  nav.tabs a.side-brand { display: none; }

  /* Forms */
  .login { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 420px; width: 100%;
    margin: 8vh auto 0; }
  .form { display: flex; flex-direction: column; gap: 14px; }
  .form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
  /* a field is never wider than a line you can read (D98); the coach's two-by-two form fills its cells */
  @media (min-width: 600px) {
    body:has(nav.tabs) .form:not(.two) label > :is(input, select, .pw) { max-width: 30rem; }
  }
  /* O.9.29: the coach's page on a wide screen: short fields two by two, the rest full width. */
  @media (min-width: 900px) {
    .form.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px var(--sp-4); }
    .form.two > .full, .form.two > .check, .form.two > .btn { grid-column: 1 / -1; }
    .form.two > .btn { justify-self: start; min-width: 11rem; }
  }
  .form input:not([type=radio], [type=checkbox]), .form textarea, .form select, .search input,
  .row select, .card select, .diary-form input[type=number], .diary-form textarea {
    min-height: var(--tap); padding: 10px var(--sp-3); border-radius: var(--r-s);
    border: 1.5px solid var(--field); background: var(--bg); color: var(--ink);
    font: inherit; font-size: 16px; font-weight: 400; }
  .form input:not([type=radio], [type=checkbox]) { min-height: 48px; }
  .form input[aria-invalid="true"] { border-color: var(--alert); }
  .form .check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; min-height: var(--tap); }
  .search { display: flex; gap: var(--sp-2); }
  .search input { flex: 1; min-height: 48px; min-width: 0; }
  .diary-form { display: grid; gap: 10px; }
  .diary-form .feel, .add-hand .feel, .start-form .feel, .edit-form .feel { border: 0; padding: 0; margin: 0; display: flex; gap: 6px; }
  .diary-form .feel label, .add-hand .feel label, .start-form .feel label, .edit-form .feel label { flex: 1; }
  .diary-form .feel input, .add-hand .feel input, .start-form .feel input, .edit-form .feel input { position: absolute; opacity: 0; }
  .diary-form .feel label > span, .add-hand .feel label > span, .start-form .feel label > span, .edit-form .feel label > span { display: grid; place-items: center;
    min-height: var(--tap); font-size: 1.375rem; border: 1.5px solid var(--field); border-radius: var(--r-m); }
  .add-hand .feel label > span, .start-form .feel label > span, .edit-form .feel label > span { font-size: var(--step-0); font-weight: 700; }
  .diary-form .feel input:checked + span, .add-hand .feel input:checked + span, .start-form .feel input:checked + span, .edit-form .feel input:checked + span { border-color: var(--acc); background: var(--acc-soft); box-shadow: inset 0 0 0 1px var(--acc); }
  .diary-form .feel input:focus-visible + span, .add-hand .feel input:focus-visible + span, .start-form .feel input:focus-visible + span, .edit-form .feel input:focus-visible + span { outline: 3px solid var(--acc); outline-offset: 2px; }
  /* Your starting point (D83, F2.13.6): many tap choices wrap on a phone */
  .start-form .feel { flex-wrap: wrap; }
  .start-form .feel legend { width: 100%; margin-bottom: 4px; }
  .start-form .feel label { flex: 1 0 44px; }
  .start-form .feel label:last-of-type { flex-basis: 96px; }
  /* Blocked days and the week template (D92, F5.20.11): tap choices that wrap, a list of rows */
  .edit-form { display: grid; gap: 10px; }
  .edit-form .feel { flex-wrap: wrap; }
  .edit-form .feel legend { width: 100%; margin-bottom: 4px; }
  .edit-form .feel label { flex: 1 0 92px; }
  .edit-form .feel input:disabled + span { opacity: .45; border-style: dashed; }
  .edit-list { list-style: none; margin: 0; padding: 0; }
  .edit-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
    min-height: var(--tap); border-top: 1px solid var(--line); }
  .edit-list li:first-child { border-top: 0; }
  .slot-sauna { gap: 10px; margin: 0; padding: 0; border: 0; }
  .race-row { display: grid; gap: 2px; padding: 6px 0; }
  .race-chip { background: var(--info-soft); color: var(--info); }
  .race-line { display: block; color: var(--mute); font-size: var(--step--1); }
  .adapt-out span, .adapt-lost { color: var(--warn); }
  .slot-sauna, .edit-form .slot-label { display: none; }
  .edit-form:has(select[name=kind] option[value="sauna"]:checked) .slot-sauna { display: grid; }
  .edit-form:has(select[name=kind] option[value="other"]:checked) .slot-label { display: flex; }
  .week-slot { display: grid; gap: 2px; padding: 6px 0; color: inherit; text-decoration: none; }
  .adapt-weeks { display: flex; flex-wrap: wrap; gap: 6px; }
  .adapt-more { margin-top: 6px; }
  .adapt-more > summary { list-style: none; display: inline-flex; margin-bottom: 6px; }
  .adapt-more > summary::-webkit-details-marker { display: none; }
  /* The week review (D103): facts, the 6-week chart (numbers only), the close form. */
  .review-pager { display: flex; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
  .review-facts { margin: var(--sp-2) 0 0; padding-left: 1.2em; }
  .review-facts li + li { margin-top: var(--sp-1); }
  .load-chart { display: block; width: 100%; height: 180px; margin-top: var(--sp-2);
    background: var(--soft); border-radius: var(--r-s); }
  .load-chart polyline { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke;
    stroke-linejoin: round; }
  /* Neutral tones, told apart by pattern too (WCAG 1.4.1): no colour that reads as good or bad (N3). */
  .load-chart .ctl { stroke: var(--info); }
  .load-chart .atl { stroke: var(--mute); stroke-dasharray: 6 4; }
  .load-chart .tsb { stroke: var(--ink); stroke-dasharray: 2 3; }
  .legend i.line-ctl, .legend i.line-atl, .legend i.line-tsb { width: 18px; height: 0;
    border-radius: 0; background: none; border-top: 3px solid var(--info); }
  .legend i.line-atl { border-top: 3px dashed var(--mute); }
  .legend i.line-tsb { border-top: 3px dotted var(--ink); }
  .load-chart .zero { stroke: var(--mute); stroke-width: 1; stroke-dasharray: 3 3;
    vector-effect: non-scaling-stroke; }
  .review-axis { font-size: var(--step--2); margin-top: var(--sp-1); }
  @media (min-width: 30rem) { .stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  .athlete-wrap { display: flex; flex-direction: column; }
  .review-link { display: inline-flex; align-items: center; align-self: flex-start;
    min-height: var(--tap); font-size: var(--step--1); }
  .adapt-weeks a[aria-current] { border-color: var(--acc); background: var(--acc-soft); box-shadow: inset 0 0 0 1px var(--acc); }
  .adapt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .adapt-list li { display: grid; gap: 2px; padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
  .adapt-list li:first-child { border-top: 0; }
  /* Add a workout on a free slot (D81, F7.7.39) */
  .add-time label, .add-hand .row label, .add-pick .row label { min-width: 5rem; font-weight: 700; }
  .add-time input, .add-hand input[type=number], .add-pick input[type=number] { width: 7rem; min-height: var(--tap); }
  .add-hand input[type=text] { flex: 1; min-width: 0; min-height: var(--tap); }
  .add-hand, .add-pick.card { display: grid; gap: 10px; }
  .add-pick fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; }
  .add-pick legend { font-weight: 700; padding: 0 0 4px; }
  .add-choice { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
    width: 100%; min-height: var(--tap); padding: 6px var(--sp-2); border: 0; border-top: 1px solid var(--line);
    background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
  .add-choice:active { background: var(--soft); }
  /* The choice card (D98): a radio or a tick with its name and one line under it */
  label.add-choice, .form label.add-choice { flex-direction: row; justify-content: flex-start;
    font-weight: 400; padding: var(--sp-3) 14px; border: 1.5px solid var(--line);
    border-radius: var(--r-m); background: var(--card); }
  label.add-choice > span { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
  label.add-choice:has(input:checked), .level-row:has(input:checked) { border-color: var(--acc);
    background: var(--acc-soft); box-shadow: inset 0 0 0 1px var(--acc); }
  label.add-choice:has(input:focus-visible) { outline: 3px solid var(--acc); outline-offset: 2px; }
  .choices { display: grid; gap: var(--sp-2); }
  /* Icon tiles on one row (F7.15.13, gender): the icon, its word under it, the radio hidden */
  .tiles-legend { font-weight: 700; margin-bottom: var(--sp-2); }
  .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }
  label.tile, .form label.tile { position: relative; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 4px;
    border: 1.5px solid var(--line); border-radius: var(--r-m); background: var(--card);
    font-weight: 400; font-size: .9em; line-height: 1.2; text-align: center; cursor: pointer; }
  label.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
  label.tile .i { width: 28px; height: 28px; }
  label.tile:has(input:checked) { border-color: var(--acc); background: var(--acc-soft);
    box-shadow: inset 0 0 0 1px var(--acc); }
  label.tile:has(input:focus-visible) { outline: 3px solid var(--acc); outline-offset: 2px; }
  .choices > legend { font-weight: 700; margin-bottom: var(--sp-2); }
  .choices > p { margin: 0 0 var(--sp-1); }
  /* The steps of a new plan (D98, F7.7.54) */
  .step-bar { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--step--1);
    font-weight: 700; color: var(--mute); }
  .step-bar i { flex: 1; height: 6px; border-radius: var(--r-full); background: var(--line); }
  .step-bar i.on { background: var(--acc); }
  .picked { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px var(--sp-3);
    font-size: var(--step--1); }
  .picked dt { color: var(--mute); }
  .picked dd { margin: 0; font-weight: 700; }
  .weeks { width: 100%; border-collapse: collapse; font-size: var(--step--1);
    font-variant-numeric: tabular-nums; }
  .weeks th, .weeks td { text-align: left; padding: 8px var(--sp-2) 8px 0; border-top: 1px solid var(--line); }
  .weeks th { border-top: 0; color: var(--mute); }
  /* A settings row inside a card (D98): a name and a chevron, as on You */
  .set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
    min-height: 48px; padding: var(--sp-2) 0; border-top: 1px solid var(--line); color: inherit;
    text-decoration: none; font-weight: 700; }
  .set-row .mute { font-weight: 400; }
  .set-row:first-of-type { border-top: 0; }
  h2 + .set-row { border-top: 0; }
  .add-link { margin-top: var(--sp-2); }
  /* The level list on Plan (D91) */
  .level-list { border: 0; margin: 0 0 var(--sp-3); padding: 0; }
  .level-list legend { margin-bottom: var(--sp-2); }
  .level-list { display: grid; gap: var(--sp-2); }
  .level-row { display: flex; align-items: flex-start; gap: var(--sp-3); min-height: var(--tap);
    padding: var(--sp-3) 14px; border: 1.5px solid var(--line); border-radius: var(--r-m); cursor: pointer; }
  .level-row input { margin-top: 2px; }
  .level-row .grow { display: flex; flex-direction: column; gap: 2px; }
  .level-row q { font-style: italic; }
  .level-row summary { cursor: pointer; }
  .level-row .level-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .cal-add { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-full);
    font-weight: 700; color: var(--acc); text-decoration: none; }
  .cal-add:hover { background: var(--soft); }
  .cal-body[data-add] .cal-col { cursor: copy; }
  .cal-hover { grid-column: 1 / -1; pointer-events: none; z-index: 1; display: flex; align-items: center;
    padding: 0 6px; border: 1.5px dashed var(--acc); border-radius: var(--r-s, 6px);
    background: color-mix(in srgb, var(--acc) 10%, transparent); color: var(--acc);
    font-size: var(--step--2); font-weight: 700; white-space: nowrap; overflow: hidden; }
  .diary-form input[type=number] { width: 72px; }
  /* A score 0-10 per condition (D75): grey until picked, then the pain rule's colour */
  .diary-form .scales { border: 0; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }
  .diary-form .scales legend { padding: 0; margin-bottom: var(--sp-2); font-size: var(--step--1);
    text-transform: uppercase; letter-spacing: .06em; color: var(--mute); font-weight: 700; }
  .scale { display: grid; gap: 6px; }
  .scale label { display: grid; gap: 2px; }
  .scale .q { color: var(--mute); }
  .slider { --tone: var(--field); display: grid; grid-template-columns: 1fr auto;
    gap: 2px var(--sp-3); align-items: center; }
  .slider.set { --tone: var(--ink); }
  .slider.set[data-color=green] { --tone: var(--ok); }
  .slider.set[data-color=orange] { --tone: var(--warn); }
  .slider.set[data-color=red] { --tone: var(--alert); }
  .slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; margin: 0;
    height: var(--tap); background: transparent; cursor: pointer; touch-action: pan-y; }
  .slider input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: var(--r-full);
    background: var(--tone); }
  .slider input[type=range]::-moz-range-track { height: 10px; border-radius: var(--r-full);
    background: var(--tone); }
  .slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px;
    margin-top: -10px; border-radius: 50%; background: var(--card); border: 3px solid var(--tone); }
  .slider input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%;
    background: var(--card); border: 3px solid var(--tone); }
  .slider:not(.set) input[type=range]::-webkit-slider-thumb { opacity: .55; }
  .slider:not(.set) input[type=range]::-moz-range-thumb { opacity: .55; }
  .slider input[type=range]:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
  .slider output { min-width: 2ch; text-align: right; font-weight: 700; font-size: var(--step-1);
    color: var(--tone); }
  .slider .ends { display: flex; justify-content: space-between; font-size: var(--step--2);
    color: var(--mute); }
  .slider .clear { min-height: 32px; padding: 0 var(--sp-1); font-size: var(--step--2); background: none;
    border: 0; color: var(--mute); text-decoration: underline; cursor: pointer; }
  .slider:not(.set) .clear { visibility: hidden; }

  /* Lists: athletes, coaches, users */
  .users a { display: flex; justify-content: space-between; min-height: 52px; align-items: center;
    font-weight: 700; text-decoration: none; border-top: 1px solid var(--line); }
  .users a:first-child { border-top: 0; }
  .offer .num { font-size: var(--step-2); }
  .offer.off { border-style: dashed; background: var(--soft); }
  .offer .btn { align-self: flex-start; }

  /* The plan catalogue's paths (D94 (2), F5.20.42c): a photo tile per path, the path's own
     colour under it until a photo is there; a path without plans is dimmed with "soon". */
  .paths { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3);
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
  .path { --tone: var(--acc); position: relative; display: flex; align-items: flex-end;
    min-height: 160px; padding: var(--sp-3); border-radius: var(--r-l); overflow: hidden;
    color: #FFFFFF; background: var(--tone) center / cover no-repeat; }
  .path.photo::before { content: ""; position: absolute; inset: 0;
    background: linear-gradient(to top, rgb(0 0 0 / 0.65), rgb(0 0 0 / 0.05) 60%); }
  .path-text { position: relative; display: flex; flex-direction: column; gap: var(--sp-1); }
  .path-text .num { font-size: var(--step-2); }
  .path.soon { filter: grayscale(0.7); opacity: 0.75; }
  .path .chip { align-self: flex-start; }
  a.path-text { position: static; color: inherit; text-decoration: none; }
  a.path-text > * { position: relative; }
  a.path-text::after { content: ""; position: absolute; inset: 0; z-index: 1; }  /* the whole tile taps */
  .path:has(a.path-text):hover { outline: 3px solid var(--acc); outline-offset: 2px; }
  /* F5.20.42d-e: distances and plan cards */
  .distances { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
  .distances a { text-decoration: none; color: inherit; border-left: 6px solid var(--tone); }
  .distances a:hover { border-color: var(--acc); }
  .plan-cards { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
  .plan-card { display: flex; flex-direction: column; gap: var(--sp-3); }
  .plan-card .stats > div { background: var(--soft); border-radius: var(--r-m); padding: var(--sp-2) var(--sp-3); }
  .plan-card .stats .num { font-size: var(--step-1); }
  .path-running { --tone: var(--kind-run); }
  .path-cycling { --tone: var(--kind-bike); }
  .path-fitness { --tone: var(--kind-gym); }
  .path-rehab { --tone: var(--kind-rehab); }
  .path-nutrition { --tone: var(--ok); }
  /* `.card.athlete`, never bare `.athlete`: `body.athlete` (a coach in an athlete's screens) is a
     class of its own, and a container on `body` stops its background reaching the whole window. */
  .coach, .card.athlete { text-decoration: none; color: inherit; }
  .coach:hover, .card.athlete:hover { border-color: var(--acc); }
  .card.athlete { container-type: inline-size; }
  .card.athlete.watch { border-left: 4px solid var(--warn); }  /* O.9.29: this one needs a look */
  .athletes, .coach-list { display: flex; flex-direction: column; gap: 18px; }
  .coach-head { display: flex; gap: 14px; align-items: center; }
  .about { margin: 0; white-space: pre-line; }
  .progress { display: block; height: 8px; border-radius: var(--r-xs); background: var(--soft); overflow: hidden; }
  .progress span { display: block; height: 100%; background: var(--acc); border-radius: var(--r-xs); }
  .facts3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
  .facts3 > span { display: flex; flex-direction: column; background: var(--soft);
    border-radius: var(--r-m); padding: var(--sp-2) 10px; min-width: 0; }
  .facts3 b { font-family: var(--display); font-size: var(--step-0b); text-transform: capitalize;
    font-variant-numeric: tabular-nums; }
  .facts3 b.watch { color: var(--warn); }
  @container (max-width: 340px) { .facts3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

  /* Plan (F7.7.7) */
  .hero { background: var(--hero-bg); color: var(--hero-ink); border-color: var(--hero-bg);
    border-radius: var(--r-xl); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
  .hero .lead { font-size: var(--step--1); opacity: .8; }
  .hero .goal { font: 700 1.75rem/1.1 var(--display); letter-spacing: -.02em; }
  .hero .num { font: 700 1.375rem/1.2 var(--display); }
  .hero .stats > div { background: none; border: 0; padding: 0; }
  .hero .progress { background: rgba(127, 127, 127, .3); }
  .hero-week { font-size: var(--step--2); margin-bottom: 6px; }
  .seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-m); background: var(--soft);
    margin: var(--sp-3) 0 var(--sp-4); }
  .seg a { flex: 1; min-height: var(--tap); display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-s); font-size: var(--step--2); font-weight: 700; color: var(--mute);
    text-decoration: none; }
  .seg a.on { background: var(--ink); color: var(--bg); }  /* O.9.29: the chosen one is plain to see */
  .chart { position: relative; display: flex; gap: var(--sp-1); }
  .chart a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
    gap: var(--sp-1); text-decoration: none; color: var(--mute); }
  .chart .col { height: 180px; width: 100%; display: flex; align-items: flex-end; }
  .chart .col span { width: 100%; min-height: 2px; background: var(--bar); border-radius: 5px 5px 2px 2px; }
  .chart small { height: 16px; font-size: var(--step--2); line-height: 16px;
    font-variant-numeric: tabular-nums; }
  .chart a.hit .col span { background: var(--acc); }
  .chart a.now .col span { background: var(--ink); }
  .chart a.now small { color: var(--ink); font-weight: 700; }
  .goal-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--acc); pointer-events: none; }
  .goal-line span { position: absolute; left: 0; bottom: 2px; font-size: var(--step--2); font-weight: 700;
    color: var(--acc); background: var(--card); padding: 0 var(--sp-1); }
  /* D77 (F7.7.24): each bar's value above it; with many weeks on a phone it stands upright */
  .chart { padding-top: 18px; }
  .chart .col span { position: relative; }
  .chart .col em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    padding-bottom: 2px; font: 700 10px/1 var(--body); font-style: normal; color: var(--mute);
    white-space: nowrap; font-variant-numeric: tabular-nums; }
  .chart a.now .col em { color: var(--ink); }
  @media (max-width: 600px) {
    .chart.many { padding-top: 32px; }
    .chart.many .col em { writing-mode: vertical-rl; transform: translateX(-50%) rotate(180deg); }
  }
  /* D77 (F7.7.25): open, the "Show all" line goes; "Show fewer" sits at the bottom */
  details.more[open] > summary { display: none; }
  details.more .fewer { margin-top: var(--sp-3); }
  details.more:not([open]) .fewer { display: none; }
  /* D77 (F7.7.26): an earlier plan from the time line in the "how it was" colour (D76) */
  body.past { background: var(--orig); }
  .past-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--sp-2) var(--sp-3); padding: 12px 14px; border: 1px solid var(--orig-line);
    border-left: 4px solid var(--info); border-radius: var(--r-m); background: var(--card); }
  .past-band div { display: grid; gap: 2px; }
  .past-band span { color: var(--mute); font-size: var(--step--1); }
  /* D85 (F7.4.19): a coach inside an athlete's screens: a band with the name and a frame */
  .athlete-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--sp-2) var(--sp-3); padding: 12px 14px; border: 1px solid var(--line);
    border-left: 4px solid var(--acc); border-radius: var(--r-m); background: var(--acc-soft); }
  /* O.9.29: one slim line (name, then what it is), the way back is the band's own button. */
  .athlete-band { padding: 6px 8px 6px 14px; }
  .athlete-band div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--sp-3); }
  .athlete-band span { color: var(--mute); font-size: var(--step--1); }
  body.athlete::after { content: ""; position: fixed; inset: 0; border: 3px solid var(--acc);
    pointer-events: none; z-index: 40; }
  .plan-week { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; min-height: 52px;
    border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
  .plan-week .num { font: 700 1.125rem var(--display); width: 30px; }

  /* The history time line (K1, F5.20.32): one block per plan on a line, newest on top. */
  .timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line);
    display: grid; gap: 10px; }
  .timeline .block { display: grid; gap: var(--sp-1); padding: var(--sp-3) 14px; border: 1px solid var(--line);
    border-radius: var(--r-m); text-decoration: none; color: var(--ink); min-height: var(--tap); }
  .timeline .block.on { border-color: var(--ink); }

  /* Cooking step by step (F7.7.4) */
  .cook-bar { height: 8px; border-radius: var(--r-xs); background: var(--line); overflow: hidden; }
  .cook-bar i { display: block; height: 100%; background: var(--ink); }
  .cook-step p { font-size: var(--step-1); line-height: 1.5; }
  .cook-nav .btn { flex: 1; }
}

/* Desktop (O.8.11, D70; D98): from 900 px the tabs become a dark side bar in the wordmark's
   purple with the brand on top; a page is `--w-read` wide, or `--w-wide` when it holds columns,
   a calendar, a grid or the admin's tables. Phones and tablets keep the bottom tabs. */
@layer components {
  @media (min-width: 900px) {
    body:has(nav.tabs) { padding-left: var(--side); background: var(--page); }
    body.past:has(nav.tabs) { background: var(--orig); }
    body:has(nav.tabs) main { max-width: var(--w-read); padding-top: 28px;
      padding-bottom: max(40px, env(safe-area-inset-bottom)); }
    body:has(nav.tabs):is(:has(.week-cal), :has(.today-cols:not(.solo)), :has(.food-cols), :has(.admin-band),
      :has(.athletes), :has(.coach-list), :has(.paths), :has(.plan-cards)) main { max-width: var(--w-wide); }
    nav.tabs { top: 0; right: auto; width: var(--side); border: 0; background: var(--side-bg);
      flex-direction: column; justify-content: flex-start; align-items: stretch; gap: var(--sp-5);
      padding: max(20px, env(safe-area-inset-top)) var(--sp-3) env(safe-area-inset-bottom); }
    nav.tabs div { grid-auto-flow: row; grid-auto-rows: auto; gap: var(--sp-1); max-width: none; }
    nav.tabs a { flex-direction: row; justify-content: flex-start; gap: var(--sp-3); min-height: 48px;
      padding: 0 var(--sp-3); border-radius: var(--r-s); font-size: var(--step--1);
      color: color-mix(in srgb, var(--side-ink) 72%, transparent); }
    nav.tabs a:hover, nav.tabs a:active { color: var(--side-ink);
      background: color-mix(in srgb, var(--side-ink) 9%, transparent); }
    nav.tabs a.on { color: var(--side-ink); background: color-mix(in srgb, var(--side-ink) 15%, transparent);
      box-shadow: inset 3px 0 0 var(--acc); }
    nav.tabs a.side-brand { display: flex; gap: 10px; padding: 0 var(--sp-2); font-size: 1.75rem;
      color: var(--side-ink); background: none; }
    nav.tabs a.side-brand .logo { width: 36px; height: 36px; border-radius: var(--r-s); }
    nav.tabs :focus-visible { outline-color: var(--side-ink); }
    .athletes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }
    /* D90: coaches side by side */
    .coach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--sp-4); }
    .coach-list > section { grid-column: 1 / -1; }
  }
}

@layer utilities {
  .mute { color: var(--mute); font-size: var(--step--1); }
  /* O.9.25: on the photo of an open screen, as large and as white as the tagline. It lives here because
     this layer beats `components`: a `.splash .mute` rule there never applied. */
  .splash .mute { font-size: var(--step-0); color: rgb(255 255 255 / .92);
    text-shadow: 0 2px 16px rgb(19 9 28 / .6); }
  .row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
  .row .grow, .grow { flex: 1; }
  .between { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
  .between > * { min-width: 0; }
  .between.base { align-items: baseline; }
  .between.mid { align-items: center; }
  .end { text-align: end; }
  .mt-2 { margin-top: 6px; }
  input[type=radio], input[type=checkbox] { -webkit-appearance: none; appearance: none; flex: none;
    width: 22px; height: 22px; min-height: 0; padding: 0; display: inline-grid; place-content: center;
    border: 2px solid var(--field); background: var(--card); cursor: pointer; }
  input[type=radio] { border-radius: 50%; }
  input[type=checkbox] { border-radius: 6px; }
  input[type=radio]::before { content: ""; width: 10px; height: 10px; border-radius: 50%;
    background: var(--tick, var(--acc)); transform: scale(0); }
  input[type=checkbox]::before { content: ""; width: 12px; height: 12px; background: var(--card);
    clip-path: polygon(14% 44%, 0 65%, 43% 100%, 100% 18%, 82% 4%, 40% 66%); transform: scale(0); }
  input:is([type=radio], [type=checkbox]):checked { border-color: var(--tick, var(--acc)); }
  input[type=checkbox]:checked { background: var(--tick, var(--acc)); }
  input:is([type=radio], [type=checkbox]):checked::before { transform: scale(1); }
  input:is([type=radio], [type=checkbox]):disabled { opacity: .5; cursor: default; }
  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Splash: the login page (D73, F7.15). A sports photo (Unsplash licence, self-hosted) coloured by
   the brand gradient that slowly drifts, white speed lines, the form on a glass card (from 900 px on the left, the runner free on the right). The global
   reduced-motion rule below stops every animation here. */
@layer components {
  body.splash { background: #13091C; color: #fff; min-height: 100dvh; }
  .splash main { min-height: 100dvh; justify-content: center; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .stage { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #13091C
      url("/static/img/login-run-1920.jpg") 38% 60% / cover no-repeat; }
  @media (max-width: 700px) { .stage { background-image: url("/static/img/login-run-900.jpg"); } }
  .stage::before { content: ""; position: absolute; inset: 0; mix-blend-mode: color; opacity: .9;
    background: linear-gradient(120deg, #FF8C2B, #F72585, #7209B7, #F72585, #FF8C2B) 0% 50% / 300% 300%;
    animation: splash-drift 22s ease-in-out infinite alternate; }
  .stage::after { content: ""; position: absolute; inset: 0;
    background: radial-gradient(120% 80% at 38% 45%, transparent 30%, rgb(19 9 28 / .55) 100%),
      linear-gradient(180deg, rgb(19 9 28 / .15) 0%, rgb(19 9 28 / .35) 55%, rgb(19 9 28 / .8) 100%); }
  .stage i { position: absolute; left: 0; height: 2px; width: 38vw; border-radius: 2px; opacity: 0;
    background: linear-gradient(90deg, transparent, rgb(255 255 255 / .9), transparent);
    transform: translateX(-60vw) rotate(-14deg); animation: splash-streak 5.5s cubic-bezier(.4, 0, .2, 1) infinite; }
  .stage i:nth-child(1) { top: 18%; animation-delay: 0s; }
  .stage i:nth-child(2) { top: 32%; width: 22vw; animation-delay: 1.4s; animation-duration: 4.2s; }
  .stage i:nth-child(3) { top: 47%; width: 46vw; animation-delay: 2.6s; animation-duration: 6.4s; }
  .stage i:nth-child(4) { top: 61%; width: 18vw; animation-delay: .7s; animation-duration: 3.8s; }
  .stage i:nth-child(5) { top: 74%; width: 30vw; animation-delay: 3.5s; }
  .stage i:nth-child(6) { top: 88%; width: 26vw; animation-delay: 2s; animation-duration: 4.8s; }
  @keyframes splash-drift { to { background-position: 100% 50%; } }
  @keyframes splash-streak {
    0% { transform: translateX(-60vw) rotate(-14deg); opacity: 0; }
    15% { opacity: .7; }
    60%, 100% { transform: translateX(160vw) rotate(-14deg); opacity: 0; } }

  .splash .login { margin: 0 auto; gap: var(--sp-4); animation: splash-in .8s cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes splash-in { from { opacity: 0; transform: translateY(16px); } }
  .splash .brand { gap: var(--sp-3); }
  .splash .logo { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 30px rgb(247 37 133 / .45); }
  /* The language before login (D82, D88 k): one button, a list opens under it. */
  .lang-menu { position: relative; display: flex; justify-content: center; font-size: var(--step--1); }
  .lang-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 6px;
    min-height: var(--tap); padding: 0 12px; border-radius: 999px; cursor: pointer; font-weight: 700;
    border: 1px solid var(--line); background: var(--card); color: var(--ink); }
  .lang-menu summary::-webkit-details-marker { display: none; }
  .lang-menu .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
  .lang-menu[open] .caret { transform: rotate(180deg); }
  .lang-menu ul { position: absolute; top: calc(100% + 6px); z-index: 5; min-width: 180px; margin: 0;
    padding: 6px; list-style: none; border-radius: var(--r-m); background: var(--card); color: var(--ink);
    border: 1px solid var(--line); box-shadow: 0 12px 32px rgb(0 0 0 / .25); left: 50%; transform: translateX(-50%); }
  .lang-menu a, .lang-menu b { display: flex; justify-content: space-between; align-items: center;
    min-height: var(--tap); padding: 0 12px; border-radius: var(--r-s); color: inherit; text-decoration: none; }
  .lang-menu a:hover, .lang-menu a:focus-visible { background: var(--line); }
  .splash .lang-menu summary { background: rgb(28 12 40 / .45); color: #fff; border-color: rgb(255 255 255 / .35);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .splash .lang-menu ul { background: #fff; color: #1B1020; border-color: transparent; }
  .splash .lang-menu a { color: #1B1020; }
  .splash .lang-menu a:hover, .splash .lang-menu a:focus-visible { background: #F1E9F5; }
  .splash .wordmark { color: #fff; font-size: clamp(3.25rem, 12vw, 4.5rem); line-height: .9;
    text-shadow: 0 4px 24px rgb(19 9 28 / .5); }
  .tagline { margin: 0; font-family: var(--wordmark-font); font-weight: 800; font-size: var(--step-2);
    line-height: 1.15; letter-spacing: -0.02em; text-shadow: 0 2px 16px rgb(19 9 28 / .6); }
  .tagline span { font-family: var(--body); font-weight: 400; font-size: var(--step-0); letter-spacing: 0;
    color: rgb(255 255 255 / .88); }
  .splash .card { background: rgb(28 12 40 / .42); border: 1px solid rgb(255 255 255 / .22); color: #fff;
    backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
    box-shadow: 0 20px 50px rgb(0 0 0 / .35); }
  .splash .form input { background: rgb(255 255 255 / .94); color: #1B1020; border-color: transparent; }
  .splash .form input[aria-invalid="true"] { border-color: #FF6FAE; }
  .splash a { color: #fff; }
  .splash .btn:not(.ghost) { background: linear-gradient(135deg, #D61C72, #7209B7); color: #fff;
    box-shadow: 0 8px 24px rgb(214 28 114 / .4); }
  .splash .btn.ghost { background: transparent; color: #fff; border-color: rgb(255 255 255 / .7); }
  .splash :focus-visible { outline-color: #fff; }
  /* The login path round (D88, F7.15.1-F7.15.9). */
  .splash .card.alt { flex-direction: column; align-items: stretch; text-align: center; gap: var(--sp-2); }
  .splash h1 { color: #fff; margin: 0; }
  .splash .hint, .splash .link { color: rgb(255 255 255 / .85); }
  .splash .form textarea { background: rgb(255 255 255 / .94); color: #1B1020; border-color: transparent; }
  .splash.still .stage::before { animation: none; }
  .lang-top { position: absolute; top: max(8px, env(safe-area-inset-top)); right: 16px; z-index: 1; }
  .lang-top .lang-menu ul { left: auto; right: 0; transform: none; }
  .or { display: flex; align-items: center; gap: var(--sp-3); margin: 0; font-size: var(--step--1);
    color: var(--mute); }
  .splash .or { color: rgb(255 255 255 / .85); }
  .or::before, .or::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .4; }
  /* Show password (F7.15.4): the button sits inside the field, on the right. */
  .pw { position: relative; display: flex; }
  .pw input { flex: 1; padding-inline-end: 72px; }
  .pw-show { position: absolute; inset-block: 0; inset-inline-end: 0; min-width: var(--tap); padding: 0 14px;
    border: 0; background: none; font: inherit; font-size: var(--step--1); font-weight: 700;
    color: var(--acc); cursor: pointer; }
  .splash .pw-show { color: #7209B7; }
  /* "Continue with Google" as on other sites (F7.15.6): Google's light button. */
  .btn.gbtn, .splash .btn.gbtn { background: #fff; color: #1F1F1F; border: 1px solid #747775; box-shadow: none;
    gap: 12px; font-weight: 600; }
  .btn.gbtn .g { width: 20px; height: 20px; flex: none; }
  @media (min-width: 900px) {
    .splash main { max-width: none; margin: 0; align-items: flex-start; padding-left: 8vw; }
    .splash .login { margin: 0; }
    .stage { background-position: 0% 60%; }
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* The admin's band (D73, F7.14.2): a calm violet strip on every admin page, so an admin
   session never looks like a user's or a coach's. */
@layer components {
  .admin-band { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
    margin: 0; padding: .5rem 1rem; background: var(--admin); color: #FFFFFF; font-size: var(--step--1); }
  .admin-band .btn, .admin-band .btn.ghost { background: transparent; color: #FFFFFF;
    border-color: rgb(255 255 255 / .6); }
  .admin-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
  .admin-table th, .admin-table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
  .admin-table th { color: var(--mute); font-weight: 700; }
  .admin-scroll { overflow-x: auto; }
  .admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
  /* O.9.30: what cannot be undone sits apart, at the far end; an everyday action is the quiet one. */
  .admin-actions > .danger, .admin-actions > form:has(.danger) { margin-left: auto; }
  .admin-actions .btn.ghost:not(.danger) { border-color: var(--line); }
  .admin-table .nw { white-space: nowrap; }  /* a date never breaks at its hyphen */
  /* a small setting on a wide admin page stays a small card */
  body:has(.admin-band) form[action="/me/lang"] { max-width: 30rem; }
  .admin-actions form { display: flex; gap: .3rem; align-items: center; }
  .admin-actions input { max-width: 11rem; }

  /* The shared list frame (D74, F7.14.4): header, toolbar, sortable heads, pager, popups.
     Every field 16px, so iOS does not zoom in on a tap. */
  .admin-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-3); }
  .admin-head h1 { margin: 0; }
  .admin-head .count { color: var(--mute); }
  .admin-head > .btn { margin-left: auto; align-self: center; }
  .subtabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  .subtabs a { min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 .9rem;
    border-radius: var(--r-full); color: var(--ink); text-decoration: none;
    border: 1.5px solid var(--line); font-size: var(--step--1); font-weight: 700; }
  .subtabs a[aria-current] { background: var(--admin); border-color: var(--admin); color: #FFFFFF; }
  .toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); }
  .toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: var(--step--1); font-weight: 600; }
  .toolbar .grow { flex: 1 1 12rem; }
  .toolbar input, .toolbar select, .admin-dialog input, .admin-dialog select, .admin-actions input {
    min-height: var(--tap); padding: 8px var(--sp-3); border-radius: var(--r-s);
    border: 1.5px solid var(--field); background: var(--bg); color: var(--ink);
    font: inherit; font-size: 16px; font-weight: 400; }
  .admin-table a.sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center;
    min-height: var(--tap); }
  .admin-table a.sort:hover, .admin-table a.sort:focus-visible { text-decoration: underline; }
  .admin-table th[aria-sort] { color: var(--ink); }
  .admin-table .empty-row { color: var(--mute); padding: var(--sp-5) .5rem; text-align: center; }
  .admin-table .why { color: var(--mute); font-size: var(--step--2); }
  .admin-pager { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); color: var(--mute);
    font-size: var(--step--1); }
  .admin-dialog { width: min(28rem, calc(100vw - 32px)); border: 0; border-radius: var(--r-l);
    padding: var(--sp-4); background: var(--card); color: var(--ink); box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
  .admin-dialog::backdrop { background: rgb(20 8 30 / .5); }
  .admin-dialog h2 { margin: 0; }
  .admin-dialog .dialog-btns { display: flex; justify-content: flex-end; gap: var(--sp-2); }
  .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: var(--sp-3); }
  .tile { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-4); border-radius: var(--r-l);
    background: var(--card); border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; }
  .tile:hover, .tile:focus-visible { border-color: var(--admin); }
  .tile.todo { border-color: var(--warn); background: var(--warn-soft); }  /* something waits on the admin */
  .tile.todo b { color: var(--warn); }
  .admin-dialog .callout { margin: 0; }
  .admin-dialog [hidden] { display: none; }
  /* On a phone a row is a small card: each cell under its column's name (app.js sets data-th). */
  @media (max-width: 600px) {
    .admin-table thead { display: none; }
    .admin-table tr { display: grid; gap: 4px; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
    .admin-table td { border: 0; padding: 0; }
    .admin-table td[data-th]::before { content: attr(data-th); display: block; color: var(--mute);
      font-size: var(--step--2); font-weight: 700; }
  }
  .tile b { font-size: var(--step-3); line-height: 1.1; }
  .tile span { color: var(--mute); font-size: var(--step--1); }
}

/* The birth date in three fields (F7.2.2c): day and year narrow, the month wide */
@layer components {
  .date3 { border: 0; padding: 0; margin: 0; }
  .date3 legend { font-weight: 700; padding: 0; margin-bottom: var(--sp-1); }
  .date3 .row { align-items: flex-end; flex-wrap: nowrap; }
  .date3 label:not(.grow) { flex: 0 0 4.5rem; }
  .date3 label.grow { min-width: 0; }
}

/* The pick page (D95, F5.20.43b): the reason shows only the date it asks for. */
.form:has(.pick-why):not(:has(input[name="reason"][value="just_because"]:checked)) .by-start,
.form:has(.pick-why):not(:has(input[name="reason"][value="race"]:checked)) .by-end { display: none; }
