/* ---------------------------------------------------------------------
   Atkinson Hyperlegible — chosen because its letterforms are drawn to be
   told apart by readers with low vision. Self-hosted rather than pulled
   from a CDN: the app has no external dependencies and shouldn't start
   now, and a font request would leak every visitor to a third party.
   Drop the four woff2 files in /fonts next to index.html. Until they are
   there the stack below falls back and everything still works.
   --------------------------------------------------------------------- */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-Italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('fonts/AtkinsonHyperlegible-BoldItalic.woff2') format('woff2');
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  /* Palette. Every colour on screen comes from here. */
  --ink: #000000;
  --ink-soft: #6E6E6E;
  --line: #C9CBCE;
  --line-soft: #E6E7E8;
  --paper: #ffffff;
  --canvas: #F4F5F6;

  /* The eleven-colour palette. Nothing on screen is outside this list. */
  --stone:     #D0CCBC;
  --purple:    #5A50AA;
  --teal:      #27AABE;
  --turquoise: #32C8B4;
  --mint:      #46D28C;
  --lime:      #98D433;
  --green:     #00AA46;
  --yellow:    #FDD724;
  --orange:    #FF9633;
  --burnt:     #D74E25;
  --red:       #CD2336;

  /* What each one means. Rules read these rather than the raw colours, so a
     colour can be reassigned in one place. */
  --published: var(--mint);
  --goal:      var(--yellow);
  --event:     var(--stone);
  --requested: var(--teal);
  --today:     var(--red);
  /* A runner who has not opened what was published for them.
   *
   * Pointedly NOT --stone, which already means "an event". Reusing it would
   * have put the same colour on a race and on somebody who has not looked
   * at their programme, and the legend would have been wrong about one of
   * them. --grey-bar is the existing neutral and adds no twelfth colour to
   * the palette above. */
  --unseen:    #AAB4BE;

  /* The two planes of the Runners Roll.
   *
   * The roll is no longer one flat panel. It is a frozen pane: the names
   * and the dates stay put, the week blocks move under them, and the two
   * are told apart by the ground they sit on rather than by a line alone.
   * Everything that does NOT move with the weeks shares --plane-frozen;
   * everything that does sits on --plane-weeks.
   *
   * --plane-weeks is the same value as --line-soft today and is a separate
   * token anyway. They mean different things — one is the ground under the
   * weeks, the other is the app's lightest line — and a change to either
   * has no business dragging the other with it. */
  --plane-frozen: #C8D2DC;
  --plane-weeks:  #E6E7E8;

  /* A week already run. It takes the frozen plane as its fill, which ties
     the weeks behind you to the furniture that does not move and leaves
     the live weeks as the only things on the lighter ground. Its outline
     and its number are the one colour in the roll that is neither black
     nor one of the planes. */
  --past-ink:     #646E78;

  /* The shadow either seam casts, and the distance it is held back from
     the corner where the two seams meet.
   *
   * One number does both jobs on purpose. The vertical seam's shadow
   * starts this far below the seam's top; the horizontal seam's starts
   * this far right of its left end. Both therefore fall AWAY from the
   * corner, they can never overlap into a double-strength patch, and the
   * notch they leave at the corner is exactly this square. */
  --seam-px: 6px;
  --seam-ink: rgba(0, 0, 0, 0.5);

  /* Aliases kept so rules written before the palette landed still read
     naturally. --purple and --burnt are unreferenced here: they exist for
     coaches to assign to their own categories. */
  --gold: var(--yellow);
  --slate: var(--stone);
  --proposed: var(--teal);
  --pub-green: var(--mint);
  --pub-green-soft: #C8EEDB;
  --proposed-soft: #D2EFF4;
  --grey-bar: #C9CBCE;

  --shadow-hard: 5px 5px 0 #000;
  --shadow-hard-sm: 4px 4px 0 #000;
  /* The same four pixels as a bare length, for the places that have to
     leave room for that shadow rather than draw it. Stated beside it so
     the two cannot drift. */
  --shadow-sm-px: 4px;
  --panel-w: 250px;
  font-family: 'Atkinson Hyperlegible', 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* Focus has to stay visible — this whole design is built for readability. */
:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

/* ---------- Shared hard-edged controls ---------- */

.hard-btn {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard-sm);
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 400;
  text-align: center;
  color: var(--ink);
}
.hard-btn:hover { background: var(--canvas); }
.hard-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.hard-btn.lg { font-size: 18px; padding: 12px 30px; }
.hard-btn.danger { background: var(--red); color: #fff; }
.hard-btn.danger:hover { background: #A81C2C; }
.hard-btn.go { background: var(--mint); color: var(--ink); }
.hard-btn.go:hover { background: #35BF7C; }
.hard-btn[disabled] { opacity: 0.4; box-shadow: none; cursor: not-allowed; }
.hard-btn[disabled]:active { transform: none; }

.icon-btn {
  width: 30px; height: 30px;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard-sm);
  font-size: 15px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  /* Stated, both of them.
   *
   * There was no background here at all, and the colour was paper — so a
   * plain icon button took the browser's own grey and drew a white mark on
   * it. It went unnoticed for as long as the only marks were characters
   * nobody looked at twice. Paper and ink unless a modifier says otherwise. */
  background: var(--paper); color: var(--ink);
}
.icon-btn:hover { background: var(--canvas); }
/* Dismissing and destroying are not the same act, and since 0.39.0 they do
   not share a colour. The X that closes a panel is paper, like Cancel; the
   X that deletes the thing under it is red, like Delete. Both are the same
   mark of Baz's — only the face changes. */
.icon-btn.close { background: var(--paper); color: var(--ink); }
.icon-btn.close:hover { background: var(--canvas); }
.icon-btn.destructive { background: var(--red); color: var(--paper); }
.icon-btn.confirm { background: var(--mint); color: var(--ink); }
.icon-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }

/* Baz's marks.
 *
 * The span is the box and the svg fills it; the mark inside is drawn in
 * currentColor, so it takes the colour of the button it is sitting in and
 * needs no variant of its own. Sized in em so a mark grows with the type
 * around it rather than being pinned to a pixel count that only suits one
 * of the dozen places it appears.
 *
 * `vertical-align: -0.125em` puts the optical centre of the mark on the
 * text baseline's middle, which is where a character would have sat. */
.ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1em; height: 1em; vertical-align: -0.125em; flex: none;
}
.ic svg { width: 100%; height: 100%; display: block; overflow: visible; }
/* Sized where they are used, not once for everywhere.
 *
 * Each symbol is framed on its own ink by the build, so an em of box is an
 * em of mark and these numbers mean what they say. Before that they were
 * framed on the button face the artwork was drawn on, the mark filled a
 * third of it, and everything came out looking half the size asked for. */
.icon-btn .ic { font-size: 17px; }
.mc-btn .ic { font-size: 16px; }
.pencil .ic { font-size: 15px; }
.carousel-arrow .ic { font-size: 20px; }
.back-btn .ic { font-size: 13px; }
.drag-handle .ic { font-size: 15px; }
.sort-arrows .ic { font-size: 15px; }
.code-refresh .ic { font-size: 16px; }
.move-btn .ic { font-size: 13px; }
.cat-toggle .ic, .mc-expand .ic { font-size: 14px; }
.chart-scroll-cue .ic { font-size: 15px; }
/* The two that are a single line rather than a shape read as a hairline at
   the size the others want, so they are given a little more room. */
.ic-collapse { font-size: 1.25em; }

/* A pair of Cancel / Confirm at the foot of a panel, mirroring the ✕ / ✓
   in its header — same actions, reachable without scrolling back up. */
.commit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.commit-row .hard-btn { width: 100%; }

.pencil { border: none; background: none; font-size: 14px; padding: 2px 4px; color: inherit; }
.pop-acts { display: inline-flex; align-items: center; gap: 2px; flex: none; }

/* Races falling on the day being edited. Inside the day panel, under the
   session and above the runner's note — after what the day IS, before what
   the runner said about it. */
.day-races { border-top: 2px solid var(--ink); padding: 10px 12px; }
.day-races-head {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.day-race {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  width: 100%; text-align: left; margin-bottom: 6px;
  border: 2px solid var(--ink); background: var(--paper);
  box-shadow: var(--shadow-hard-sm); padding: 7px 10px; cursor: pointer;
}
.day-race:hover { background: var(--canvas); }
.day-race:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
/* Already on it: filled in the event colour, the same gold the day takes. */
.day-race.on { background: var(--event); }
.day-race-name { font-size: 13px; }
.day-race-state {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); flex: none;
}
.day-race.on .day-race-state { color: var(--ink); }
.pencil:hover { opacity: 0.6; }

/* ---------- Welcome ---------- */

.welcome {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px;
}
.welcome-title { font-size: 34px; font-weight: 700; margin: 0 0 26px; letter-spacing: -0.01em; }
.welcome-actions { display: flex; gap: 22px; margin-bottom: 60px; }
.welcome-quote {
  max-width: 420px; text-align: center;
  font-size: 17px; font-style: italic; line-height: 1.5; margin: 0 0 14px;
}
.welcome-attrib { font-size: 15px; font-weight: 700; font-style: italic; }

/* The quote and its credit both go to dumbrunner.com. Underlined on hover
   rather than always, so the welcome screen does not read as a page of links,
   but the colour stays black — the underline on hover is the affordance and
   the cursor confirms it. */
.quote-link { color: inherit; text-decoration: none; }
.quote-link:hover, .quote-link:focus-visible { text-decoration: underline; }
.quote-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.welcome-hint {
  margin-top: 54px; font-size: 12px; color: var(--ink-soft);
  border: 1px dashed var(--line); padding: 10px 14px; text-align: center; line-height: 1.6;
}

/* ---------- Auth modal ---------- */

.auth-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,24,31,0.25);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 24px; overflow-y: auto; z-index: 90;
}
.auth-wrap { width: 520px; max-width: 100%; }
.auth-heading { text-align: center; font-size: 30px; font-weight: 700; margin: 0 0 14px; }

.auth-card {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard);
  padding: 34px 32px 28px;
}
.auth-close { position: absolute; top: -16px; right: -14px; }

.auth-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px; align-items: start;
  margin-bottom: 14px;
}
.auth-label { text-align: right; font-size: 15px; padding-top: 9px; line-height: 1.25; }
.auth-input {
  width: 100%;
  border: 2px solid var(--ink);
  padding: 9px 11px;
  font-size: 14px;
  background: var(--paper);
}
.auth-input::placeholder { font-style: italic; font-size: 11.5px; color: #b9bec6; }
.auth-sub { font-size: 11.5px; font-style: italic; color: var(--ink-soft); margin-top: 4px; }
.auth-inline { display: flex; gap: 10px; align-items: flex-start; }
.auth-inline .auth-input { flex: 1; }
.auth-inline .auth-sub { flex: 1.1; margin-top: 10px; }

.auth-forgot {
  border: none; background: none; padding: 2px 0;
  font-size: 12.5px; font-style: italic; color: var(--ink); text-decoration: underline;
}

.auth-actions { display: flex; justify-content: flex-end; margin-top: 20px; }

.auth-error {
  border: 2px solid var(--red);
  background: #fdecec;
  color: #9b2018;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* The app's own confirm and prompt.
 *
 * A dialog sits over whatever asked it, so its backdrop is a shade darker than
 * a modal's to read as a further layer rather than a replacement. It is
 * narrow, because a question should not look like a form.
 *
 * Red is spent on exactly one thing here: the destructive verb. Cancel is
 * plain, so a red button means "this cannot be undone" and nothing else. */
.dialog-backdrop { background: rgba(0, 0, 0, 0.35); z-index: 90; }
.dialog { width: 400px; max-width: calc(100vw - 32px); }
.dialog-body { font-size: 15px; line-height: 1.55; margin: 6px 0 14px; }
.dialog-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.dialog-actions .hard-btn { flex: 1; }
/* Three or more answers stack, Cancel on top, so no button is squeezed to a
   word it cannot fit. */
.dialog-actions.stacked { flex-direction: column; }
.dialog-actions.stacked .hard-btn { flex: none; width: 100%; }

/* Destructive, and only destructive. This used to be spelled `danger` and
   meant Cancel — every Cancel on the site was red, so red meant "leave" as
   often as it meant "destroy". Now it is the one colour for the one action
   that cannot be taken back. */
.hard-btn.destructive {
  background: var(--red); color: #fff; border-color: var(--ink);
}
.hard-btn.destructive:hover { filter: brightness(0.94); }

/* What Cancel looks like, in one place, so the experiment can be reversed by
   changing one value. Set to var(--red) and every Cancel is red again. */
:root { --cancel-bg: var(--paper); --cancel-ink: var(--ink); }
.hard-btn.cancel { background: var(--cancel-bg); color: var(--cancel-ink); }

/* A week that has already started and has nothing in it. The forward-looking
   notice is a prompt to get ahead; this one is a runner opening the app today
   and finding empty boxes, so it carries the colour that means now. */
.signup-notice.unwritten.live { border-color: var(--red); }

/* The group's completion on a day.
 *
 * A white ground filling green from nothing, with no orange and no threshold.
 * It began as a proportion of a fixed ground with a colour change at half —
 * but once completion became something a member claims rather than something
 * assumed of them, a bar that started nearly full and fell would have been
 * describing the opposite of what it measures. Filling from empty is the
 * honest direction for a count of who has spoken up.
 *
 * The whole bar is the button. It is the only thing in the panel that opens
 * the names, so a separate control beside it would be a second thing to
 * explain. */
.group-bar-wrap { margin-top: 16px; }
.group-bar {
  display: block;
  width: 100%;
  height: 26px;
  padding: 0;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard-sm);
  background: var(--paper);
  cursor: pointer;
  overflow: hidden;
}
.group-bar-fill {
  display: block;
  height: 100%;
  background: var(--lime);
  /* No transition. The bar is redrawn from scratch on every render, so an
     animation would run from zero every time the panel repainted for an
     unrelated reason. */
}
.group-bar:hover { background: var(--canvas); }
.group-bar:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* The fraction, because the fill is a colour and a colour is not a number.
   Nobody reads seventeen of twenty-three off a length. */
.group-bar-count {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.group-names {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.7;
}
.group-names li { border-bottom: 1px solid var(--line-soft); padding: 2px 0; }
.group-names li:last-child { border-bottom: none; }

/* A group expands to the people in it, in place. Opening a second panel
   would replace the list somebody was reading to answer a question about one
   row of it. */
.mc-expand {
  flex: none;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  width: 24px; height: 24px;
  font-size: 12px; line-height: 1;
  cursor: pointer;
  padding: 0;
}
.mc-expand:hover { background: var(--canvas); }

.mc-members {
  border-left: 2px solid var(--ink);
  margin: 0 0 8px 12px;
  padding-left: 10px;
}
.mc-member { font-size: 15px; }
/* A request is waiting on the coach, and it is the only row in this panel
   that is. Orange rather than red: it is something to do, not something
   wrong. */
.mc-member.is-pending .mc-name { font-weight: 700; }
.mc-member.is-pending { border-left: 4px solid var(--orange); padding-left: 6px; }
.mc-member-empty,
.mc-member-note {
  font-size: 13px;
  color: #5c6470;
  padding: 6px 0;
}
.mc-waiting {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border: 2px solid var(--ink);
  background: var(--orange);
  font-size: 12px; font-weight: 700;
}

/* Runner or group, on the panel that makes one. Two buttons rather than the
   switch: this is not a setting being toggled, it is a choice about what is
   about to be created, and it should look like the other things you press. */
.nc-opts { display: flex; gap: 10px; }
.nc-opt { flex: 1; }
.nc-opt.on {
  background: var(--lime);
  font-weight: 700;
}

/* The group a code joins, named on the form before anybody commits to it —
   the consent line sits under this and has to have something to refer to. */
.auth-joining {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 10px 12px;
  font-weight: 700;
  font-size: 16px;
}

/* What somebody sees instead of being signed in, when their request has gone
   to their coach. One sentence and a way out; there is nothing for them to do
   here and nothing they can usefully be shown. */
.auth-pending {
  font-size: 16px;
  line-height: 1.55;
  margin: 6px 0 18px;
}

/* The role toggle's styles are gone with it. The control let somebody choose
   a role the invite code had already decided, and choosing the other one only
   earned them a message saying a good code was not recognised. */

/* ---------- App chrome ---------- */

/* The bar and the rule beneath it are one unit: the account dropdown hangs
   off that rule, so they share the same horizontal padding. */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 24px 32px 0;
}
.app-title {
  font-size: 34px; font-weight: 700; margin: 0;
  letter-spacing: -0.005em; text-transform: uppercase;
  display: flex; align-items: baseline; gap: 14px;
}
/* Underlined, because it behaves like a link — it opens the release notes. */
.app-version {
  font-size: 15px; font-weight: 400; text-transform: none;
  letter-spacing: 0; color: var(--ink);
  background: none; border: none; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.app-version:hover { color: var(--purple); }

.inline-new-event {
  border: 2px solid var(--ink); background: var(--canvas);
  padding: 10px; margin-top: 8px;
}
.app-title-rule { border-bottom: 3px solid var(--ink); margin: 6px 32px 0; }

/* A dropdown's top edge meets the rule it falls from, and the button it
   belongs to loses its bottom border so the two read as one object. */
.account-menu { position: relative; }
.account-menu > .hard-btn { font-weight: 700; padding: 10px 26px; }
.account-menu.open > .hard-btn {
  box-shadow: none; border-bottom: none; position: relative; z-index: 71;
}
.account-drop {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-hard);
  min-width: 300px; padding: 18px; z-index: 70;
}
.account-drop .who {
  font-size: 16px; color: var(--ink); margin-bottom: 16px;
  line-height: 1.5; text-align: center;
}
.account-drop .who .sub { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
/* Direct children only, and the child combinator is the whole point.

   Written as a descendant selector this also caught the two halves of every
   preference switch, because each half is a button. :first-of-type counts
   within its own parent, so inside each switch the left half matched it and
   got margin-top: 0 while the right half kept the 10px. The row stretches to
   a shared height, so the right half ended up 10px shorter than the left and
   sitting 10px lower — which is precisely what the switches looked like, and
   no amount of correcting the switch's own rules would have fixed it. */
.account-drop > button { width: 100%; margin-top: 10px; }
.account-drop > button:first-of-type { margin-top: 0; }

/* ---------- Notifications ---------- */

/* Waiting messages read as a count in a hard box, not a bare dot: the number
   is the difference between "look now" and "look when you get a moment". It
   rides on the Notifications button inside the account menu now, rather than
   on a button of its own in the header — same box, same colour as the mark on
   the avatar, so the two are obviously the same news. */
/* Orange rather than burnt orange. A count of things waiting for you is news,
   not a warning — the darker, redder fill made three unread notes look like
   something had gone wrong. The friendlier colour says the same number.
 *
 * Black on it, not white. White measures 4.2:1 against this orange, under the
 * floor for type at this size, and it is black text on every other warm fill
 * in the app — the switches included. The harness computes both rather than
 * taking this comment's word for it. */
.notif-count {
  display: inline-block; margin-left: 10px; min-width: 22px;
  padding: 1px 5px;
  background: var(--orange); color: var(--ink);
  border: 2px solid var(--ink);
  font-size: 14px; font-weight: 700; line-height: 1.3;
}

/* Catches the click that closes the drop without dimming the page under it. */
.drop-backdrop { position: fixed; inset: 0; z-index: 65; background: transparent; }

/* Was anchored under the header button that opened it. That button is gone —
   it lives in the account menu now — so it hangs off the same right-hand
   gutter the avatar sits in. */
.notif-drop {
  position: absolute; right: 16px; top: 78px;
  width: 420px; max-width: calc(100vw - 32px);
  background: var(--paper); border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard);
  z-index: 70;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 2px solid var(--ink);
}
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item {
  display: grid; grid-template-columns: minmax(0,1fr) auto;
  gap: 2px 12px; width: 100%; text-align: left;
  padding: 12px 16px; border: none; border-bottom: 1px solid var(--line);
  background: var(--paper); cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--canvas); }
.notif-who { font-weight: 700; font-size: 15px; }
/* Two kinds of thing share this list now — a note somebody wrote and an event
   somebody has asked for. They want different answers from the coach, so the
   row says which it is rather than leaving it to be inferred from the text. */
.notif-kind {
  display: inline-block; margin-left: 8px; padding: 0 5px;
  background: var(--requested); color: var(--ink);
  border: 1.5px solid var(--ink);
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; vertical-align: 1px;
}
/* A missed day is a third kind. Its chip is yellow rather than the requested
   blue, so the two are told apart at a glance and neither is mistaken for the
   other's kind of answer — a request wants a decision, a miss wants a look. */
.notif-item.missed .notif-kind { background: var(--yellow); }
.notif-when { font-size: 13px; color: var(--ink-soft); text-align: right; }
.notif-text {
  grid-column: 1 / -1; font-size: 15px; color: var(--ink);
  overflow-wrap: anywhere;
}
.notif-empty { padding: 20px 16px; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.link-btn {
  border: none; background: none; padding: 0;
  font-size: 14px; font-weight: 700; color: var(--ink);
  text-decoration: underline; cursor: pointer;
}

/* ---------- Coaches on the platform ---------- */

.coach-dir { width: 460px; max-width: calc(100vw - 32px); }

/* ---------- Manage clients ---------- */

.manage-clients { width: 640px; max-width: calc(100vw - 32px); }

/* Stone rather than red. A paused account is a considered state somebody put
   it in, not a fault — red would read as something having gone wrong. */
.paused-banner {
  border: 2px solid var(--ink); background: var(--event); color: var(--ink);
  padding: 10px 16px; font-size: 14px; line-height: 1.5;
  margin: 0 0 14px;
}

/* Tabs as one bar of joined boxes, sharing their seams, the way the week
   block's controls do. The third is present and disabled: squads are coming
   and the shape does not change, so saying so is better than a surprise. */
.mc-tabs { display: flex; margin: 14px 0 0; }
.mc-tabs > * + * { margin-left: -2px; }
.mc-tab {
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 15px; padding: 7px 20px; cursor: pointer;
  box-shadow: var(--shadow-hard-sm);
}
.mc-tab.on { background: var(--turquoise); }
.mc-tab.off { background: var(--canvas); color: var(--ink-soft); cursor: default; box-shadow: none; }

.mc-filter { display: flex; align-items: stretch; margin: 18px 0 0; }
.mc-filter-lbl {
  background: var(--ink); color: var(--paper);
  font-size: 14px; padding: 6px 14px; display: flex; align-items: center;
}
.mc-filter-sel {
  border: 2px solid var(--ink); border-left: none; background: var(--event);
  font: inherit; font-size: 14px; padding: 6px 10px;
}
/* Green for the list you work from, stone for the one you have set aside.
   Not red: archived is a filter, not a warning. */
.mc-filter-sel.active { background: var(--lime); }

.mc-rows { margin-top: 2px; max-height: 52vh; overflow-y: auto; }
.mc-row {
  display: flex; align-items: center; gap: 12px;
  border-bottom: 2px solid var(--ink);
  padding: 10px 2px 10px 6px; min-height: 46px;
}
.mc-row.is-self { background: var(--canvas); }
/* A paused row is stated in words as well as colour — the fill alone would
   mean nothing to somebody arriving at this panel for the first time. */
.mc-row.is-paused .mc-name { color: var(--ink-soft); }
.mc-name { flex: 1 1 auto; min-width: 0; font-size: 16px; }
.mc-state { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.mc-count { font-size: 16px; min-width: 32px; text-align: right; }
.mc-self-note { font-size: 12px; color: var(--ink-soft); }
.mc-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.mc-btn {
  border: 2px solid var(--ink); background: var(--event); color: var(--ink);
  font: inherit; font-size: 13px; line-height: 1; padding: 7px 9px;
  cursor: pointer; box-shadow: var(--shadow-hard-sm); min-width: 34px;
}
.mc-btn.warn { background: var(--orange); }
.mc-btn.del { background: var(--burnt); color: #fff; }
.mc-btn.go { background: var(--lime); }
.mc-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.mc-rename { flex: 1 1 auto; min-width: 0; border: 2px solid var(--ink); font: inherit; font-size: 15px; padding: 5px 8px; }

/* A phone gets the same panel with the buttons under the name rather than
   beside it — three controls and a name do not fit on one line at 390px. */
@media (max-width: 760px) {
  .mc-row { flex-wrap: wrap; }
  .mc-name { flex: 1 1 100%; }
  .mc-actions { margin-left: auto; }
}
.coach-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.coach-table th, .coach-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.coach-table th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.coach-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.coach-table tr.is-self { background: var(--canvas); }
.coach-table .tag {
  display: inline-block; margin-left: 8px; padding: 1px 6px;
  border: 2px solid var(--ink); font-size: 12px; font-weight: 700;
  text-transform: uppercase;
}
.coach-table .tag.new { background: var(--today); color: #fff; }
.coach-dir-note {
  margin-top: 16px; font-size: 14px; color: var(--ink-soft); line-height: 1.5;
}

/* The horizontal padding is a variable because the Runners Roll has to
   undo it to bleed to both edges. One number, read in two places. */
.page { --page-pad-x: 32px; padding: 18px var(--page-pad-x) 60px; min-height: 60vh; transition: padding-right .15s ease; }
.page.panel-open { padding-right: calc(var(--panel-w) + 28px); }

/* Section headings sit in a solid block, with a hatched rule running out to
   the right so the eye reads the row as one band. The hatching is drawn in
   CSS — no image to ship or fail to load. */
.section-band { display: flex; align-items: stretch; gap: 0; margin: 0 0 14px; min-height: 34px; }
.section-heading {
  background: var(--ink); color: var(--paper);
  font-size: 21px; font-weight: 400; margin: 0;
  padding: 4px 16px 6px; display: flex; align-items: center;
  white-space: nowrap;
}
/* True 45°: the gradient's angle names the direction it travels, and the
   stripes sit perpendicular to it, so -45deg is what draws "/////". */
/* The stripes are gone; the spacer stays.
 *
 * It was a run of 45-degree hatching out to the right of every heading —
 * the "/////" in the wireframes. Dropped in 0.44.0 in the interests of
 * simplicity: on a phone it was decoration competing with the one or two
 * real controls beside it, and once it had gone from there, leaving it on
 * the desktop would have made the two screens different for no reason.
 *
 * The element is kept because it is doing a second, invisible job: it is
 * the flexible gap that holds the band open and pushes a trailing control
 * to the right-hand end. Deleting it would collapse every band onto its
 * heading. */
.section-hatch {
  flex: 1 1 auto; min-width: 24px; margin-left: 10px;
  align-self: center; height: 11px;
}
/* Where the band carries controls or a legend, the hatch gives up its room.
   flex-basis rather than min-width, so the span is what it says it is. */
.section-band .band-tail { display: flex; align-items: center; gap: 16px; padding-left: 12px; }
/* The same height as the heading beside it.
 *
 * The heading is a filled block with its own padding, so a button sized
 * by its own padding came out shorter and sat floating against a taller
 * neighbour. Stretching both the tail and the button to the band means
 * the two tops and the two bottoms line up whatever the type does. */
.section-band .band-tail { align-self: stretch; }
.section-band .band-tail .hard-btn {
  align-self: stretch;
  display: flex; align-items: center;
  padding: 0 12px; font-size: 15px; line-height: 1;
}
.section-hatch.short { flex: 0 0 auto; width: 130px; min-width: 130px; }

/* ---------- Season overview ---------- */

/* Eighteen months is more than fits, so the strip scrolls sideways. Months
   are a fixed width — fluid columns would have squeezed a day to nothing. */
.season-scroll {
  overflow-x: auto; overflow-y: hidden;
  /* No rule underneath. The Runners Roll below it is a bordered panel on
     its own ground, which separates the two already — a line as well read
     as a double edge. */
  padding-bottom: 10px; margin-bottom: 6px;
  scrollbar-color: var(--ink) var(--paper);
}
.season-scroll::-webkit-scrollbar { height: 12px; }
.season-scroll::-webkit-scrollbar-track { background: var(--paper); border: 2px solid var(--ink); }
.season-scroll::-webkit-scrollbar-thumb {
  background: var(--paper); border: 2px solid var(--ink); box-shadow: inset -3px -3px 0 var(--ink);
}

:root { --season-month-w: 118px; }   /* must match SEASON_MONTH_W in the JS */

.season {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--season-month-w);
  gap: 10px;
}

.month { min-width: 0; }
.month-name {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  text-align: center; margin-bottom: 4px; white-space: nowrap;
}
.month-year { font-weight: 400; color: var(--ink-soft); margin-left: 4px; letter-spacing: 0; }
/* The current month is the one the season is centred on. */
.month.current-month .month-name { color: var(--red); }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.month-dow {
  font-size: 7px; text-align: center; color: var(--ink-soft); font-weight: 700;
  padding-bottom: 2px; border-bottom: 1px solid var(--line); margin-bottom: 2px;
}
.month-day {
  font-size: 8px; font-weight: 700; text-align: center; padding: 1px 0;
  border: none; background: none; color: var(--ink-soft); line-height: 1.4;
}
.month-day:hover { background: var(--line-soft); outline: 1px solid var(--ink); }
.month-day.blank { visibility: hidden; }
.month-day.has-event { background: var(--event); color: var(--ink); }
.month-day.is-goal { background: var(--goal); color: var(--ink); }
.month-day.is-proposed { background: var(--requested); color: var(--ink); }
.month-day.today { background: var(--today); color: #fff; }

/* ---------- Runners Roll ---------- */

/* minmax(0, …) lets the grid column shrink below the table's natural width,
   which is what allows the runners grid to scroll rather than stretch the
   page. Without it the table forces the column — and the page — wider. */
/* The roll, then the events panel, then the event card when it is open.
 *
 * One grid doing both layouts. On a desktop the events are a 300px panel
 * beside the roll; below 760px the whole thing collapses to a single
 * column and they fall underneath at full width, which is where a phone
 * wants them. The markup does not change between the two. */
.board-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; margin-top: 22px; }
.board-split.with-event { grid-template-columns: minmax(0, 1fr) 300px 300px; }
.board-split > div { min-width: 0; }
/* The event card's wrapper. On a wide screen it is display: contents — it
   generates no box, and the card is a column of the grid exactly as it
   always was. Its scrim and its top close button belong to the panel only. */
.event-sheet { display: contents; }
.event-sheet-scrim { display: none; }
.event-card .sheet-close { display: none; }

@media (max-width: 1100px) {
  /* The card used to wrap into the grid's next row here, under the whole
     Runners Roll. This comment once said it "takes the events' place", and
     nothing ever made that true: measured on the live site, it opened
     1,405px down at 1000px wide and 1,860px down on a phone, so tapping a
     day appeared to do nothing at all. */
  .board-split.with-event { grid-template-columns: minmax(0, 1fr) 300px; }

  /* So below 1100px it is a panel over the page instead.
   *
   * Fixed, not placed in the page and scrolled to. The phone page has a
   * sticky calendar that collapses on scroll and compensates the scroll
   * position as it does, and a scroll position that iOS has misreported
   * before; a card dropped into that flow would have to be scrolled to
   * through all of it. A fixed panel is on screen wherever the page is,
   * whatever the calendar is doing, and moves nothing.
   *
   * The panel scrolls INSIDE itself — the same arrangement the app's other
   * dialogs use on a phone, which is what keeps a long card and the
   * on-screen keyboard workable. overscroll-behavior stops a scroll that
   * reaches the end of the card from carrying on into the page behind,
   * which would otherwise trip the calendar's collapse underneath it.
   */
  .event-sheet {
    display: block;
    position: fixed; inset: 0; z-index: 60;
    overflow-y: auto; overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px 32px;
  }
  .event-sheet-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(20, 24, 31, 0.28);
  }
  .event-sheet > .event-card {
    position: relative;
    max-width: 440px;
    margin: 0 auto;
  }
  .event-card .sheet-close { display: inline-flex; }
}
@media (max-width: 760px) {
  .board-split, .board-split.with-event { grid-template-columns: minmax(0, 1fr); }
}

/* The sticky column sits above the scrolling weeks on the z axis, and is
   drawn to say so: a rule down its left, a rule down its right, and an open
   bottom edge running to the same line as the scrollbar rather than a closed
   box. Both rules are set off from their contents so the column reads as a
   panel with air in it, not a table border. */
/* Row heights are pinned so the names table and the weeks table keep step.
   They are separate tables — see the note in renderRunnersGrid — so nothing
   but these numbers holds their rows in line. */
:root {
  --rg-row-h: 44px;         /* one runner row, cell + spacing */
  --rg-datehead-h: 44px;    /* the dates, and the sort control beside them */
  /* Every block in the roll is this tall: a runner's name, a week cell,
     the sort control and the date above it. They sit in two separate
     tables that only line up because these numbers agree, and three
     different heights is what made the weeks and the names disagree by a
     few pixels down the whole board. */
  --rg-block-h: 34px;
}

/* The gap either side of the name column, and why the two numbers differ.
 *
 * The buttons carry a hard shadow drawn 4px to the right and OUTSIDE the box,
 * so a right-hand gap of 18px only looks like 14 — the shadow is sitting in
 * four of them. With both sides set to 18 the left read as too airy and the
 * right as though the buttons were running into the rule.
 *
 * So the clearance is stated once, as what the eye should see, and the right
 * side adds the shadow back. Change --rg-gutter and both edges move together;
 * change the shadow and this is the one place that needs to know. */
.runners-frame {
  position: relative;
  --rg-gutter: 14px;
  padding-left: var(--rg-gutter);
}
/* The caption row is gone, so its height is no longer part of the rhythm
   the two tables are held to. Left defined — removing a custom property
   that nothing reads is a separate tidy-up, and leaving it costs nothing
   — but nothing should start depending on it again. */
/* No rule down the left any more.
 *
 * It drew the pane's left edge when the roll sat on paper and needed an
 * edge of its own. The roll has a bordered grey panel around it now, and
 * the panel's own left border is two pixels away from where this was —
 * two parallel lines a hair apart, which reads as a mistake rather than
 * as structure. */

.runners-layout { display: flex; align-items: flex-start; }

/* The names pane. Fixed width, and its right edge is a real border, so it is
   one unbroken line — nothing paints over it, because nothing is on top of
   it any more. */
.runners-names {
  flex: 0 0 auto;
  /* Sized to the longest name, not pinned to a guess.
   *
   * This was width: 176px, and a table cannot be squeezed below the width of
   * its own content — so "Kerry the Conqueror" pushed the table 36px wider
   * than the pane holding it. The border-right is drawn at the pane's edge,
   * which put the line THROUGH the name buttons rather than beside them, and
   * their shadows another 4px past it. Measured on the live board: the right
   * gap was −16.8px.
   *
   * Letting the pane size to its content puts the border where the names
   * actually end. The maximum is there so one absurd name cannot take a
   * third of the board; past it, and only past it, a name is trimmed. */
  width: auto;
  min-width: 176px;
  max-width: 300px;
  border-right: 2px solid var(--ink);
  /* The gutter, less the 2px the left-hand line occupies, plus the 4px the
     shadow needs, less the 5px of border-spacing already inside the table.
     Comes to a visible 17px either side — the same figure the left measures.
     See --rg-gutter above. */
  /* The gutter, PLUS the four pixels the buttons' shadows occupy.
   *
   * A hard shadow is drawn outside the box and takes no layout space, so
   * whatever the pane's padding is, the shadow eats four of it — and at
   * +2px the names' shadows crossed the pane's own border and sat on the
   * weeks. The shadow's width is read from the variable that draws it
   * rather than typed in again. */
  padding-right: calc(var(--rg-gutter) + var(--shadow-sm-px));
}
.runners-names .runners-grid { width: 100%; }
/* Only bites when max-width above has capped the pane. Below that the pane
   grows and nothing is trimmed — the names being cut off is the complaint
   this whole arrangement exists to answer. */
.runners-names .rg-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.runners-scroll {
  /* No bottom border. It drew a line between the last week and the add
     button, which is a join rather than a boundary — the button belongs
     to the roll, not to something after it. */
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 14px;
}

/* A hard-edged scrollbar, matching everything else. WebKit and Blink read the
   ::-webkit- rules; Firefox reads scrollbar-color and scrollbar-width and
   gets a plainer but still dark bar. Anything that understands neither falls
   back to its own scrollbar, which is fine — nothing here is load-bearing. */
.runners-scroll::-webkit-scrollbar { height: 16px; }
.runners-scroll::-webkit-scrollbar-track {
  background: var(--paper); border: 2px solid var(--ink);
}
.runners-scroll::-webkit-scrollbar-thumb {
  background: var(--paper); border: 2px solid var(--ink);
  box-shadow: inset -4px -4px 0 var(--ink);
}
.runners-scroll::-webkit-scrollbar-thumb:hover { background: var(--line-soft); }
.runners-scroll { scrollbar-color: var(--ink) var(--paper); scrollbar-width: auto; }

.runners-grid { border-collapse: separate; border-spacing: 5px; }
.runners-grid th, .runners-grid td { padding: 0; }

/* The two tables are held to the same rhythm by these three heights. */
.runners-grid .rg-datehead-row th { height: var(--rg-datehead-h); }
.runners-grid tbody tr { height: var(--rg-row-h); }

.rg-datehead {
  font-size: 13px; font-weight: 400; text-align: center;
  white-space: nowrap; padding: 0 6px;
  color: var(--ink);
  /* Middle, not bottom. The sort control beside it is a bordered box
     centred in the same row, and a date sitting on the row's baseline sat
     visibly lower than the words in that box. */
  vertical-align: middle;
}
/* Today's week is called out by a filled header cell. It has to be a box of
   its own rather than the <th> itself: a table cell stretches to the tallest
   in its row, so filling the cell made the red block tower over the dates. */
.rg-datehead .datehead-inner { display: block; padding: 2px 4px; }
/* The current week's block sits flush between the two rules: no horizontal
   padding on the cell, and the block fills it edge to edge. The 5px of
   border-spacing either side is bridged the same way the rules are, so the red
   meets the black rather than floating between two gaps.
 *
 * It fills the cell's full height as well, so its top edge is where the two
 * vertical rules would have started. That is what makes it read as a cap on
 * the column rather than a label that happens to be red: the block's own
 * border IS the top of the rails, and they run down from its bottom corners.
 * Before this it sat at the bottom of a taller cell and the rules began in
 * the empty space above it, which is the gap in Baz's first screenshot.
 *
 * Regular weight. Reversed-out type already carries plenty of emphasis, and
 * bolding it as well made the one date on the row shout. */
.rg-datehead.current { padding: 0; }
.rg-datehead.current .datehead-inner {
  background: var(--today); color: #fff; font-weight: 400;
  border: 2px solid var(--ink);
  padding: 4px 6px;
  /* Flush with the cells below it, not overhanging them.
   *
   * It used to carry margin: 0 -5px so that it bridged the grid's
   * border-spacing and met the two vertical rules either side. That made
   * the red block five pixels wider than every cell in its own column, so
   * the date and the numbers under it did not line up — visible as soon as
   * the board was drawn at phone size, where the columns are narrow enough
   * for ten pixels to be a tenth of the width. The rules have moved to the
   * column's own edges instead, so nothing needs bridging. */
  height: var(--rg-block-h); box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
}

/* "DATE (week ending)" captions the whole strip, on its own row above the
   dates, so the corner cell and the date cells no longer fight for height. */
.rg-caption {
  font-size: 17px; text-align: left; font-weight: 400;
  padding: 0 0 10px 4px; white-space: nowrap;
}
.rg-corner { text-align: left; padding-right: 18px; vertical-align: middle; }
.rg-corner-spacer { padding: 0; }

.sort-btn { border: none; background: none; font-size: 13px; padding: 2px 4px; }
.sort-btn:hover { color: var(--red); }

.rg-name {
  min-width: 128px;
  height: var(--rg-block-h);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard-sm);
  background: var(--paper);
  padding: 0 12px;
  font-size: 16px; font-weight: 400;
  text-align: center; width: 100%;
  white-space: nowrap;
}
.rg-name:hover { background: var(--canvas); }

/* A group's line on the board.
 *
 * The name and a count of runners, because the mark that sits on a runner's
 * name — published, not opened yet — is a question about a person and a group
 * is not one. Thirty members have thirty answers to it.
 *
 * The count is not a badge and is deliberately quiet: it is context for the
 * name beside it, not a number anyone came to the board to read. */
.rg-name.is-group {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left;
}
.rg-name.is-group .rg-name-text {
  overflow: hidden; text-overflow: ellipsis;
}
.rg-group-count {
  flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  border-left: 2px solid var(--ink);
  padding-left: 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Somebody is waiting to be let in. A dot rather than a second number: the
   coach acts on it in the account menu, and two numbers side by side on a
   board of twenty would read as a score. */
.rg-waiting {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange);
}


.rg-name:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }

/* Published, but not opened since. The whole name fills yellow.
 *
 * It used to be a small red square pinned to the corner. Red is the colour of
 * now everywhere else on this screen — the current week's column, the marker
 * on the chart — and spending it on "has not looked yet" made a mild fact
 * look like an urgent one. Filling the name is calmer and easier to scan down
 * a list of twenty.
 *
 * The bold went with the square: two signals for one fact is one too many,
 * and the fill is the louder of them.
 *
 * Yellow is also the goal-race colour, but that lives in the week columns as
 * a flat cell while this is a bordered button with a shadow in the name
 * column. They never share a region, and black on this yellow is 14.9:1. */
/* A runner who has not opened what was published for them.
 *
 * Grey rather than yellow since 0.44.0. Yellow is a colour this palette
 * spends on things that are happening — a race week, a note waiting to be
 * read — and "has not looked yet" is the absence of something happening.
 * Grey says it without competing with the week cells beside it, which are
 * the part of the row carrying the information. */
.rg-name.unseen { background: var(--unseen); }
.rg-name.unseen:hover { background: var(--unseen); filter: brightness(0.96); }

/* Across the whole roll, names and weeks together. It used to be the last
   row of the names table, which made it look like an action on the column
   of names rather than on the roll. */
.rg-add {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 14px;
  /* The frozen plane, which is also what the names and the dates sit on.
     The button spans names and weeks together, so taking the colour of
     either side would have tied it to one of them.
   *
   * The outline takes the colour of the WORDS, not of the fill. A border
   * matching the background is a border nobody can see, which left the
   * button as floating text with no edge to aim at — and it is a tap
   * target, so it needs one. */
  border: 2px solid var(--past-ink);
  box-shadow: none;
  background: var(--plane-frozen);
  color: var(--past-ink);
  padding: 12px; font-size: 17px;
}
.rg-add:hover { background: var(--canvas); }
.rg-add:active { transform: translate(2px, 2px); }
/* The row button is a wide target, so the mark is given a little more than
   the 17px the row's own type would hand it. */
.rg-add .ic { font-size: 20px; }

/* ---------- The Runners Roll panel ---------- */

/* A solid ground behind the whole roll — heading, names, weeks and the add
 * button — so it reads as one object rather than as a list that happens to
 * follow a title. Site-wide, not a phone treatment: the same reasoning
 * applies on a desktop, where the roll sits between a calendar and a list
 * of events and needs the same separation from both.
 *
 * The ground IS the frozen plane. The roll is a frozen pane, and everything
 * in it that does not travel with the weeks — the band, the names, the sort
 * control's surround, the add button — belongs to the part that stays put.
 * Only the week scroller paints over this, with its own lighter plane.
 *
 * That is why the names column needs no background of its own: it is not a
 * separate surface, it is this one showing through. One plane declared once
 * and one painted over it, rather than two that have to be kept in step.
 */
.runners-roll {
  background: var(--plane-frozen);
  border: 2px solid var(--ink);
  border-left: none; border-right: none;
  padding: 16px 14px 18px;
  /* Out to both edges of the screen, past the page's own padding.
   *
   * The padding is a variable so this does not have to repeat it — it
   * differs between the desktop page and the phone, and a hardcoded pair
   * of negative margins would have been right on one and wrong on the
   * other. The side borders go with it: a border on an edge that is off
   * the screen is a border nobody sees. */
  margin-left: calc(-1 * var(--page-pad-x));
  margin-right: calc(-1 * var(--page-pad-x));
}
/* The right-hand bleed is for the single-column layout only.
 *
 * On a wide screen the roll is the left column of a two-column board, and
 * a negative right margin does not reach the edge of the SCREEN — it
 * reaches across the gutter and under the Events panel beside it. The grey
 * ground and the last week columns both ran underneath the events, which
 * is what Baz saw. Bleeding left still works there, because to the left
 * there really is nothing but page padding, so the band keeps its edge-to
 * -edge feel on the side where that means something. */
@media (min-width: 761px) {
  .board-split .runners-roll { margin-right: 0; }
}
/* The heading keeps its reversed-out block, which now sits on the grey
   rather than on paper. */
.runners-roll .section-band { margin-bottom: 16px; }
/* The frame adds its own gutter on the left, so the panel takes that much
   off its own padding there — otherwise the names sit further from the
   panel edge than the weeks do from the other side. */
.runners-roll .runners-frame { margin-left: calc(-1 * var(--rg-gutter)); }
@media (max-width: 760px) {
  /* The panel bleeds to both edges of the screen and pads its contents
     back in by the page's own inset — so a heading inside the roll lines
     up with a heading outside it, and the runner names start where the
     words above them start.
   *
   * Deliberately NOT the same number as the gutter beside the names. The
   * page inset and the gap between blocks are two different measurements
   * in Baz's spec — 15 to the edge of the screen, 12 between one block
   * and the next — and the pair of them used to be held equal by a check
   * that predates the distinction. */
  .runners-roll { padding: var(--page-pad-x) var(--page-pad-x) 18px; }
}

/* ---------- A board with nobody on it ---------- */

/* Centred in the space the grid would have filled, with enough room above
   and below that it reads as the point of the page rather than as something
   left over. The height is a floor, not a fixed size: the panel grows if the
   line wraps on a narrow screen. */
.board-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  min-height: 300px;
  padding: 40px 20px;
  text-align: center;
}
.board-empty-line {
  margin: 0;
  font-size: 22px; font-weight: 800; line-height: 1.3;
}
/* Larger than an ordinary button because it is the only one on the page.
   Square, so the plus sits in the middle of it rather than being stretched
   across a wide box — the words above already say what it does. */
.board-empty-add {
  width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-hard);
  background: var(--paper);
}
.board-empty-add .ic { font-size: 42px; }
.board-empty-add:hover { background: var(--canvas); }
/* Pressed: the box moves onto its own shadow, the same 3px and the same
   1px remainder every other hard button uses. Stated rather than inherited
   because this one sets its own border width and shadow — and left at 3px
   rather than the 5px the shadow is offset by, so the shadow is still
   visible under a held finger instead of vanishing completely. */
.board-empty-add:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}
@media (max-width: 760px) {
  .board-empty { min-height: 220px; padding: 30px 16px; gap: 14px; }
  .board-empty-line { font-size: 19px; }
  .board-empty-add { width: 76px; height: 76px; }
  .board-empty-add .ic { font-size: 36px; }
}

/* An unpublished week has no fill of its own.
 *
 * It used to be white on a grey panel, which is a fill — and once the week
 * scroller got a plane of its own there were two pale greys in the same
 * region saying slightly different things. The block is now an outline and
 * nothing else: whatever plane it is drawn on shows straight through it.
 *
 * That is also what makes "all unpublished blocks are the same colour" true
 * by construction rather than by agreement. There is no colour to keep in
 * step, because there is no colour. */
.rg-cell {
  width: 56px; height: var(--rg-block-h);
  border: 2px solid var(--ink);
  background: transparent;
  font-size: 15px; font-weight: 400;
  color: var(--ink);
  display: block; margin: 0 auto;
}
.rg-cell.empty { border-color: var(--line); background: transparent; cursor: default; }
/* A week already run.
 *
 * Filled with the FROZEN plane, not the weeks plane it sits on — so it
 * reads as belonging with the furniture that does not move rather than
 * with the live weeks around it. Filled rather than outlined because an
 * outline is now what "nothing published here yet" means, and a week
 * that has been and gone is not that. */
.rg-cell.past {
  background: var(--plane-frozen);
  color: var(--past-ink);
  border-color: var(--past-ink);
}

/* Published weeks read green; unpublished stay white. Declared before the
   goal/event rules so a race or event week keeps its own colour. */
.rg-cell.published { background: var(--published); border-color: var(--ink); color: var(--ink); }
.rg-cell.past.published { background: var(--pub-green-soft); border-color: var(--past-ink); color: var(--past-ink); }

/* A week carrying a race is marked with a notch in its corner rather than a
   full fill, so the fill can go on saying whether the week is published. */
.rg-cell { position: relative; }
.rg-flag {
  position: absolute; top: 0; right: 0;
  width: 16px; height: 14px;
  border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
}
.rg-flag.goal { background: var(--goal); }
.rg-flag.event { background: var(--event); }
.rg-flag.proposed { background: var(--requested); }
.rg-cell.past .rg-flag { border-color: var(--past-ink); opacity: 0.55; }

/* Published, and carrying an event: the run type takes the whole cell. These
   are declared after the .published rule so the event colour wins over the
   green, and after .past so a week gone by still shows what was in it. Black
   figures clear 4.5:1 on all three fills — the harness checks, rather than
   trusting this comment. */
.rg-cell.filled { border-color: var(--ink); color: var(--ink); }
.rg-cell.filled.goal { background: var(--goal); }
.rg-cell.filled.event { background: var(--event); }
.rg-cell.filled.proposed { background: var(--requested); }
.rg-cell.past.filled { border-color: var(--past-ink); opacity: 0.55; }

.rg-cell:not(.empty):hover { outline: 2px solid var(--ink); outline-offset: 2px; }

/* An empty cell can be squeezed to nothing when the table redistributes at
   narrow widths, which is how the current-week rules disappeared. A real box
   inside with its own min-width cannot be collapsed. */
/* The current week is marked by a bold number, not by rules beside it.
 *
 * It used to be two 2px rules in columns of their own, running from the date
 * block down past the last runner. They cost two extra cells on every row,
 * they had to bridge the grid's border-spacing to avoid reading as a column
 * of dashes, and they put the mark in the gaps BETWEEN the weeks rather than
 * on the week itself.
 *
 * Bolding the number puts it on the thing it is about, costs no cells, and
 * survives the column being paged off the screen and back — which the rules
 * did not, because half of a pair either side is just a line. The red cap on
 * the date above it still says which column this is; the weight says the
 * same thing on every row beneath. */
.rg-cell.current { font-weight: 800; }

/* The legend rides in the heading band, so it is compact and doesn't wrap
   until it has to. */
.board-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.board-legend .sw {
  width: 18px; height: 13px; border: 1.5px solid var(--ink);
  display: inline-block; vertical-align: -2px; margin-right: 5px;
}
.board-legend .note { color: var(--ink-soft); }

/* ---------- Event card ---------- */

.event-card {
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard);
  background: var(--paper);
  padding: 16px;
  align-self: start;
}
.event-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 8px; margin-bottom: 16px;
}
/* Reading a saved event, the name is the heading and the date sits under it.
   Creating one, the date is all there is to go on, so it takes the heading. */
.event-card-title { font-size: 21px; font-weight: 400; }
.event-card-title.datehead { font-weight: 700; }
.event-card-date { font-size: 15px; font-weight: 700; margin: -8px 0 16px; }
.event-sub { font-size: 17px; font-weight: 700; border-bottom: 1.5px solid var(--ink); padding-bottom: 5px; margin: 22px 0 10px; }
.event-roll-item {
  display: flex; align-items: stretch; gap: 0; margin-bottom: 8px;
}
.event-roll-item .hard-btn {
  flex: 1; padding: 8px 11px; font-size: 15px; text-align: left;
  box-shadow: none; border-right-width: 0;
}
.event-roll-item .hard-btn:active { transform: none; }
/* The assigned distance rides on the end of the name as a solid chip. Gold
   marks the runner's goal race — with black on it, because white on this
   gold measures 1.9:1 and cannot be read. */
.roll-dist-tag {
  background: var(--ink); color: var(--paper);
  font-size: 14px; padding: 8px 11px; border: 2px solid var(--ink);
  display: flex; align-items: center; white-space: nowrap;
}
.roll-dist-tag.goal { background: var(--goal); color: var(--ink); }
/* Tan for a race they are simply entered for — same shape, different meaning. */
.roll-dist-tag.event { background: var(--event); color: var(--ink); }
.event-notes { font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.event-actions-float { display: flex; gap: 8px; }
.event-field {
  width: 100%; border: 2px solid var(--ink); padding: 8px 10px; font-size: 15px; margin-bottom: 12px;
}
.event-field::placeholder { color: var(--ink-soft); }
.event-field-lbl {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 4px; color: var(--ink);
}
textarea.event-field { min-height: 88px; resize: vertical; line-height: 1.45; }

/* The name field carries a merge control, for when the same race has landed
   on the board twice under different names. */
.event-name-row { display: flex; align-items: stretch; gap: 0; margin-bottom: 12px; }
.event-name-row .event-field { margin-bottom: 0; border-right-width: 0; }
.merge-btn {
  border: 2px solid var(--ink); background: var(--paper);
  padding: 0 10px; font-size: 15px; line-height: 1;
  display: flex; align-items: center;
}
.merge-btn:hover { background: var(--canvas); }
.merge-btn.on { background: var(--ink); color: var(--paper); }
.merge-panel { border: 2px solid var(--ink); padding: 10px; margin-bottom: 12px; }
.merge-panel .event-field-lbl { margin-bottom: 6px; }
.merge-choice {
  width: 100%; border: 2px solid var(--ink); background: var(--paper);
  padding: 8px 10px; font-size: 15px; text-align: left; margin-bottom: 6px;
}
.merge-choice:last-child { margin-bottom: 0; }
.merge-choice:hover { background: var(--canvas); }
.merge-choice.on { background: var(--ink); color: var(--paper); }
.merge-note { font-size: 12px; color: var(--ink-soft); line-height: 1.45; margin-top: 8px; }

.roll-picker { display: flex; flex-direction: column; gap: 6px; }
.roll-pick {
  border: 2px solid var(--ink); background: var(--paper);
  padding: 8px 11px; font-size: 15px; text-align: left;
  display: flex; justify-content: space-between; align-items: center;
}
.roll-pick.on { background: var(--ink); color: var(--paper); }

.goal-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--goal); color: var(--ink); padding: 3px 6px; border: 1.5px solid var(--ink);
}

/* ---------- Programme builder ---------- */

/* A button rather than a line of underlined text, and on a wide screen it
   rides in the header ahead of the title instead of taking a row of its own.
   Padding is deliberately generous either side of the words: it is the only
   way out of this view and it should not look like an afterthought. */
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font-size: 16px; font-weight: 400; padding: 7px 18px; line-height: 1.2;
  box-shadow: var(--shadow-hard-sm); cursor: pointer;
}
.back-btn:hover { background: var(--canvas); }
.back-btn.in-header { align-self: center; margin-right: 22px; flex: none; }
/* Two buttons exist and only one is ever shown: the header carries it on a
   wide screen, the page carries it on a phone. Rendering both and hiding one
   beats a header that has to know what width it is. */
.back-btn.on-phone { display: none; margin-bottom: 16px; }

/* On the band, not above it. The name, the hatch and the key are one row —
   the same arrangement the Coach Board uses for its own headings — rather
   than a row for the name and a row for everything else. */
.runner-title { font-size: 24px; margin: 0; font-weight: 400; white-space: nowrap; align-self: center; }
.season-band { align-items: center; gap: 14px; margin-bottom: 10px; }
.season-band .section-hatch { align-self: stretch; }
.runner-title strong { font-weight: 700; }

.toolbar { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0 24px; }
.tool-card {
  background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-hard);
  padding: 11px 18px; min-width: 178px; text-align: center;
}
.tool-card:hover { background: var(--canvas); }
.tool-card.active { background: var(--ink); color: var(--paper); }
.tool-card.active .tool-card-sub { color: #c8ccd2; }
.tool-card-title { font-size: 16px; font-weight: 700; }
.tool-card-sub { font-size: 11.5px; font-style: italic; color: var(--ink-soft); margin-top: 2px; line-height: 1.35; }

/* The Programme Overview and the Week View are separate panels now: each
   scrolls on its own, so reading down the weeks no longer drags the curve
   out of sight. The rule between them is the seam. */
.workspace { display: grid; gap: 28px; align-items: start; }
/* No border here any more. The rule past the week-ending dates, inside the
   chart, does the same job one column earlier and does it without a second
   line sitting a few pixels away from the first. */
/* The padding on the left is not decoration. overflow-y: auto forces the
   other axis to clip too, and the current week's frame is drawn four pixels
   outside the row — so without room to sit in, its left border was cut off
   and the week counter appeared to have no edge on that side. */
.workspace.with-detail > div:first-child {
  max-height: calc(100vh - 240px); overflow-y: auto;
  padding-left: 6px; padding-right: 18px;
}
.workspace.single { grid-template-columns: minmax(420px, 560px); }
.workspace.with-detail { grid-template-columns: 340px minmax(0, 1fr); }
.page.panel-open .workspace.with-detail { grid-template-columns: 270px minmax(0, 1fr); }
@media (max-width: 1360px) {
  .workspace.with-detail { grid-template-columns: 280px minmax(0, 1fr); }
  .page.panel-open .workspace.with-detail { grid-template-columns: 210px minmax(0, 1fr); }
}

.chart { position: relative; user-select: none; --num-w: 26px; --date-w: 58px; --col-gap: 6px; }
.workspace.with-detail .chart { --num-w: 22px; --date-w: 50px; }

.chart-axis-head { display: grid; grid-template-columns: 1fr var(--date-w); margin-bottom: 4px; }
/* The scale carries its own unit on each marker. A separate "KM" heading
   above the panel said the same thing while costing a whole line. */
.axis-scale { position: relative; height: 20px; font-size: 11px; font-weight: 700; }
.axis-scale .axis-min { position: absolute; left: 0; top: 0; }
.axis-scale .axis-mid { position: absolute; left: 50%; transform: translateX(-50%); top: 0; }
.axis-scale .axis-max { position: absolute; right: 0; top: 0; }

/* Only one border left on the body: the rule past the week-ending dates. It
   is the seam between the overview and the day tiles now that the panel's own
   divider has gone. The left border went because it framed the whole chart,
   number column and all, so it never lined up with anything the chart was
   actually measuring. */
/* The chart scrolls inside a box of its own rather than growing the page.
 *
 * Reaching further ahead adds rows, and without this every press would make
 * the whole page taller until the overview was mostly empty weeks. The box
 * holds its height and the rows move within it.
 *
 * The scrolling is on a WRAPPER, not on the body itself. The three rules are
 * absolutely positioned to the body's full height; if the body were the
 * scrolling box they would size to what is visible instead and stop partway
 * down the chart. */
.chart-scroll { max-height: calc(100vh - 300px); min-height: 190px; overflow-y: auto; }
.chart-body { position: relative; border-right: 2px solid var(--ink); }

/* Three rules, one formula. Zero on the left, the halfway mark, and the top
   of the scale — each at the edge it names, which means the left and right
   ones sit exactly on the ends of the bar track rather than around the whole
   chart. The week number and the date live outside them, which is the point:
   the rules bound what is being measured, not what is being labelled.
 *
 * Drawn before the rows and given no z-index, so the rows — which are
 * positioned — paint over them. The rules pass behind every bar and show only
 * in the gaps, which is what puts them in the back. */
.chart-rule {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--ink); pointer-events: none;
}
.chart-rule.at-zero { left: var(--num-w); }
.chart-rule.at-max  { right: var(--date-w); }
/* The midline is a reference, not a boundary — it says "half the scale", it
 * does not enclose anything. At the same weight as the two rules that DO
 * bound the chart it claimed the same importance as them. One pixel puts it
 * behind them without losing it. */
.chart-midline {
  position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink); pointer-events: none;
  left: calc(var(--num-w) + ((100% - var(--num-w) - var(--date-w)) * 0.5));
}

/* No column gap, and no margin standing in for one either.
 *
 * 0.28 turned the gap into a margin on the track so the number and the date
 * could reach the row's edges. That left six pixels of paper between each red
 * block and the track — invisible while the frame around the current week was
 * filled white, and a white bar down the inside of both red blocks the moment
 * that fill was removed. The answer is not another fill: it is for the track
 * to butt against the blocks, which is what the artwork shows.
 *
 * The three rules move with it, all four measurements coming off num-w and
 * date-w alone now. */
.week-row {
  display: grid; grid-template-columns: var(--num-w) 1fr var(--date-w);
  align-items: center; gap: 0; height: 27px; position: relative;
}
.week-row .bar-track { margin: 0; }
/* The same 5px the current week's red block holds its number off its right
   edge. Without it the black numbers ended five pixels further right than the
   red one and the column read as ragged. */
.week-num { font-size: 11px; text-align: right; padding-right: 5px; }
.week-date { font-size: 11.5px; padding-left: 8px; white-space: nowrap; }
.workspace.with-detail .week-date { font-size: 10px; padding-left: 5px; }
.workspace.with-detail .week-num { font-size: 10px; }
.workspace.with-detail .bar-total { font-size: 9.5px; padding: 1px 3px; }
.workspace.with-detail .axis-scale { font-size: 10px; }

.bar-track { position: relative; height: 17px; }
.bar { position: absolute; left: 0; top: 0; height: 100%; display: flex; }
/* Blank, not grey. These are the weeks either side of the programme and
   there is nothing in them; a grey bar suggested a volume nobody had set. The
   row stays so the chart keeps its shape and the rules run past it. */
.bar.pad { background: none; }

/* Every session in the week is its own outlined block, so where one ends and
   the next begins is a drawn line rather than a change of colour. Two greens
   next to each other used to run together into one longer green.
 *
 * The segments share their seams: each takes the previous one's right-hand
 * border as its own left, so the join is a single 2px line and not a 4px
 * band. The whole bar therefore measures the same as it did before, which
 * matters — its width is the week's distance against the axis, and thickening
 * it would make short weeks read long.
 *
 * A very short session on a long week can end up narrower than its own two
 * borders. min-width keeps it visible as a sliver rather than collapsing to
 * a line, at the cost of a fraction of a kilometre's accuracy on the rarest
 * case — the alternative is a run that vanishes. */
.bar-seg {
  height: 100%;
  border: 2px solid var(--ink);
  min-width: 5px;
  box-sizing: border-box;
}
.bar-seg + .bar-seg { margin-left: -2px; }
/* A week at peak volume has no room to put its figure beyond the axis, so
   the badge straddles the end instead — half over the bar, half over the
   line — rather than being shoved outside the frame or hidden under it. */
.bar-total.at-max { transform: translate(-50%, -50%); }

.bar-total {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; font-weight: 400; background: var(--paper);
  border: 2px solid var(--ink); padding: 1px 5px; white-space: nowrap; pointer-events: none;
}
.week-row.clickable .bar { cursor: pointer; }
.week-row.clickable:hover .bar { outline: 1.5px solid var(--ink); outline-offset: 1px; }
/* The frame says "this is the one you are looking at", and nothing else. It
   is drawn outside the flow on purpose: given height it would grow the row,
   and every week below would jump a few pixels each time a different one was
   clicked. */
/* No fill. It used to paint paper, which reached four pixels past the row and
   laid white over the rule beyond the week-ending date — a small white notch
   in the line, on the current week only, which is exactly where the eye goes.
   The frame is a border and a shadow; the rules behind it show through, which
   is where they belong. */
.week-row.selected::before {
  content: ''; position: absolute; left: -4px; right: -4px; top: -2px; bottom: -2px;
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard-sm); z-index: -1;
}
.week-row.selected { z-index: 1; }
.week-row.drop-target .bar-track { outline: 2px dashed var(--ink); outline-offset: 2px; }

.resize-handle { position: absolute; top: -2px; width: 9px; height: calc(100% + 4px); cursor: ew-resize; z-index: 3; }
.resize-handle::after { content: ''; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; }
.resize-handle:hover::after { background: var(--ink); }

.marker-current, .marker-race {
  position: absolute; left: -32px; top: 50%; transform: translateY(-50%);
  font-size: 14px; line-height: 1; color: var(--red);
}

.chart-scroll-cue { text-align: center; font-size: 18px; color: var(--ink-soft); margin-top: 6px; line-height: 1; }
/* Under the chart: how much further ahead to look. */
.chart-reach { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 8px; }
.chart-reach-btn { font-size: 12px; padding: 5px 12px; display: inline-flex; align-items: center; gap: 6px; }
.chart-reach-note { font-size: 11.5px; color: var(--ink-soft); font-style: italic; }
/* A week that is not in the programme yet but can be dropped on. Dashed,
   because it is an outline of something that would be created rather than a
   thing that is there. */
.week-row-future .bar-track { box-shadow: inset 0 0 0 2px var(--line); }
.week-row-future .week-date { color: var(--ink-soft); }
.week-row-future.drop-target .bar-track { outline: 2px dashed var(--ink); outline-offset: 2px; }
.empty-note { font-size: 13.5px; color: var(--ink-soft); font-style: italic; margin-top: 14px; }

/* Week detail stack — every week is present and scrollable */
.week-stack {
  display: flex; flex-direction: column; gap: 16px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding: 4px 6px 12px 2px;
  scroll-behavior: smooth;
}

/* Non-focused weeks are shaded but stay fully interactive. */
.week-block { opacity: 1; transition: opacity .12s ease; }

/* The end of the programme, and the ways on from it. Sits inside the week
   stack so it scrolls with the weeks rather than floating over them. */
.prog-tail { border: 2px dashed var(--line); padding: 16px; text-align: center; }
.prog-tail-note { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }
.prog-tail-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 767px) {
  .prog-tail-acts { flex-direction: column; }
  .prog-tail-acts .hard-btn { width: 100%; }
}
.week-block.faded { opacity: 0.5; }
.week-block.faded:hover { opacity: 0.85; }

/* The buttons share edges rather than floating apart: one control made of
   parts, which is how the design reads it. The negative margin collapses the
   two 2px borders into one so the seam is a single line.

   Stretch is what keeps the row honest: every item is the same height and
   shares a top and bottom edge, whatever its own padding and type size.
   The only thing that ever breaks that line is a shadow, and the shadow
   belongs to the buttons alone — the week's figure is a caption and carries
   none. So the shadow begins under the first real button and runs unbroken to
   the end of the row, because each button's shadow is offset further than the
   2px the next one steals back. */
.week-block-bar { display: flex; align-items: stretch; gap: 0; margin-bottom: 6px; flex-wrap: wrap; }
.week-block-bar > * + * { margin-left: -2px; }
/* Whichever is hovered or active comes forward so its border is unbroken. */
.week-block-bar > *:hover, .week-block-bar > *:focus-visible { position: relative; z-index: 2; }

/* The week's figure is a label, not a control — it states how far out the week
   is and how far it runs to. So it takes the border and none of the shadow:
   in this design the shadow is what marks a thing as pressable, and spending
   it on a caption makes every real button beside it mean less. Regular weight
   for the same reason; the capitals carry it. It stays clickable, which is
   why it keeps a hover, but it no longer advertises itself as a button. */
.week-block-head {
  border: 2px solid var(--ink); box-shadow: none;
  padding: 4px 12px; font-size: 12.5px; font-weight: 400; background: var(--paper);
  color: var(--ink);
}
.week-block-head:hover { background: var(--canvas); }
.week-block.faded .week-block-head { border-color: var(--ink-soft); color: var(--ink-soft); }

.save-tmpl-btn {
  border: 2px solid var(--ink); background: var(--paper);
  box-shadow: var(--shadow-hard-sm);
  font-size: 10.5px; font-weight: 400; padding: 4px 9px; color: var(--ink);
}
.save-tmpl-btn:hover { background: var(--ink); color: var(--paper); }
.week-block.faded .save-tmpl-btn { border-color: var(--ink-soft); color: var(--ink-soft); box-shadow: none; }

/* Publish toggle — on/off, sitting between the week figure and Save. */
/* Published reads as a filled state, not a control with an indicator on it —
   the colour is the whole message, and it matches the board's green. */
.publish-btn {
  display: inline-flex; align-items: center;
  border: 2px solid var(--ink); background: var(--paper);
  box-shadow: var(--shadow-hard-sm);
  font-size: 12px; font-weight: 400; padding: 3px 12px; color: var(--ink);
  letter-spacing: 0;
}
.publish-btn .publish-dot { display: none; }
.publish-btn.on { background: var(--published); font-weight: 400; }
/* A week with a day still undecided cannot go out. Dimmed rather than
   disabled, because it is still worth pressing: the toast names the days
   that are missing, which is the thing the coach needs to know. */
/* Dimmed by colour, not by opacity.
 *
 * opacity below 1 makes an element its own stacking context, and CSS paints
 * those after ordinary siblings — so this button and its 4px shadow were
 * being drawn ON TOP of Save week beside it, instead of tucking underneath.
 * The buttons in this bar deliberately overlap by 2px so their borders join,
 * which made it plain to see. Soft ink and no shadow is what a faded week's
 * Save button already does, so this now matches it. */
.publish-btn.blocked {
  border-color: var(--ink-soft); color: var(--ink-soft); box-shadow: none;
}
/* The shadow is now permanent, so hover can no longer be "gains a shadow".
   Brightening is what the day cards already do, and it works on the filled
   green state as well as the empty one. */
.publish-btn:hover { filter: brightness(1.06); }
.week-block.faded .publish-btn { border-color: var(--ink-soft); color: var(--ink-soft); box-shadow: none; }

.day-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
/* Regular, like everything else in and above a day tile. Size carries the
   hierarchy now, not weight. */
.day-head {
  font-size: 10.5px; font-weight: 400; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-block.faded .day-head { color: var(--ink-soft); }

/* The border is the design's, not decoration: every other surface in the app
   is a bordered box, and the day cards were the one thing floating on colour
   alone. It costs 4px of the card's inside, which the preview clamp below
   accounts for. */
.day-card {
  position: relative; height: 128px; border: 2px solid var(--ink); padding: 6px 5px 22px;
  text-align: left; font-size: 11.5px; font-weight: 600;
  /* Packed to the top, so the title on every day in the week sits on the same
     line however much or little each one has to say. */
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  width: 100%; min-width: 0; overflow: hidden;
}
.week-block:not(.faded) .day-card { box-shadow: var(--shadow-hard-sm); }
/* Except an empty one.
 *
 * The shadow is what marks a tile as pressable, and a day with nothing set
 * is the one tile with nothing behind it yet. It is also the only white
 * tile in the app, and on a white page the 2px border and the 4px shadow
 * ran together into one uneven black mass down two sides — so the tile read
 * as having a different stroke weight on each edge. Without the shadow it
 * is simply a box, even the whole way round. */
.week-block:not(.faded) .day-card.is-unset { box-shadow: none; }
.week-block:not(.faded) .day-card:hover { filter: brightness(1.06); }
.day-card.compact { height: 96px; }
.day-card-session { display: block; font-size: 10px; font-weight: 400; margin-top: 4px; line-height: 1.3; }
/* Butted hard into the bottom-right corner, sharing the card's own border.
 *
 * The badge has a top and a left edge of its own and no others: at 0,0 inside
 * the card it meets the inner face of the card's border, so the card's line
 * IS the badge's right and bottom. That is what the artwork shows, and it is
 * why the earlier attempt at "flush" read as a smear — it kept all four of
 * its own edges and laid two of them alongside the card's.
 *
 * Session text can run under it. That is accepted: the tile is a summary and
 * the runner opens it for the detail. */
.day-card-km {
  position: absolute; right: 0; bottom: 0;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-right: 0; border-bottom: 0;
  font-size: 10px; font-weight: 400; padding: 0 4px; min-width: 20px; text-align: center;
}
.day-card.drop-target { outline: 3px dashed var(--ink); outline-offset: -3px; }
/* Both markers ride together in the top-right corner, and the title reserves
   room for them — sitting the status over on the left put it straight on top
   of the session name. */
/* One bordered box holding one or two cells: a note the runner left, and a
   run they missed. The completion dot has gone — now that a day gone by reads
   as done, a mark saying "done" would be on nearly every card and would
   therefore say nothing. These mark the exceptions, which is the only thing
   worth a glance.

   Cells share a seam rather than sitting apart: it is one piece of news about
   one day, not two badges. */
/* One box, equal inset from the card's top and right edges, and square cells
   so the two glyphs read as a matched pair rather than as one wide mark and
   one narrow one. The seam between them is a single 2px line: the second cell
   takes the first one's edge as its own, exactly as the volume bar segments
   do, so the divider matches the outer border instead of doubling it. */
.day-marks {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  display: flex; align-items: stretch;
  border: 2px solid var(--ink); color: var(--ink);
}
.day-mark {
  display: flex; align-items: center; justify-content: center;
  width: 12px; height: 12px; padding: 0; line-height: 0;
  background: var(--paper);
}
.day-mark + .day-mark { border-left: 2px solid var(--ink); }
/* Seen: the fill drops away and the card's own colour comes through, so the
   mark is still there to be read but has stopped asking. Per cell, because a
   coach can have taken in the note and not the fact that the day was missed.
   Only ever applied on the coach's side — see dayMarks() in data.js. */
.day-mark.seen { background: transparent; }
.day-marks:empty { display: none; }
/* The box is 30px wide and sits 4px in, so the title stops clear of it. */
.day-card-title { padding-right: 36px; }

.day-status-dot {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.5px solid currentColor; background: transparent; flex: none;
}
/* Completed fills; skipped gets a bar through it. Both drawn in the card's
   own ink, so they read on any palette colour. */
.day-status-dot.completed { background: currentColor; }
.day-status-dot.skipped { position: relative; }
.day-status-dot.skipped::after {
  content: ''; position: absolute; left: 1px; right: 1px; top: 50%;
  height: 2px; background: currentColor; transform: translateY(-50%);
}

/* Note markers ride in .day-marks with the status, rather than owning a
   corner of their own. */
.note-flag { line-height: 0; display: block; flex: none; }
.note-flag.mine { font-size: 12px; line-height: 1; color: inherit; }

/* Unpublished weeks read as blank boxes on the runner's side. */
.day-card.unpublished {
  background: repeating-linear-gradient(45deg, #f2f3f5 0 6px, #e9ebee 6px 12px);
  border: 2px dashed var(--line);
  box-shadow: none;
  cursor: default;
}

.not-published-note {
  border: 2px solid var(--ink); background: var(--canvas);
  padding: 10px 14px; font-size: 13px; margin: 10px 0 0; max-width: 460px;
}

/* Runner note / coach reply thread */
.runner-note-block {
  border-top: 2px solid var(--ink);
  background: #fffdf3;
  padding: 10px;
}
.runner-note-head, .coach-reply-head {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 4px;
}
.coach-reply-head { margin-top: 10px; }
.runner-note-body, .coach-reply-body {
  font-size: 12px; line-height: 1.5; white-space: pre-wrap;
}
.coach-reply-body { padding-left: 8px; border-left: 3px solid var(--pub-green); }
.reply-input {
  width: 100%; border: 2px solid var(--ink); padding: 6px 8px;
  font-size: 12px; line-height: 1.45; min-height: 70px; resize: vertical; margin-top: 4px;
}
.reply-toggle, .reply-save { width: 100%; margin-top: 8px; font-size: 12px; padding: 6px 10px; }
.note-state { font-size: 10.5px; font-style: italic; color: var(--ink-soft); margin-top: 6px; }

/* Side panel */
.side-panel {
  position: fixed; top: 0; right: 0; width: var(--panel-w); height: 100vh;
  background: var(--paper); border-left: 2px solid var(--ink);
  padding: 18px; overflow-y: auto; z-index: 60;
}
.side-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.side-panel-title { border: 2px solid var(--ink); box-shadow: var(--shadow-hard-sm); padding: 6px 12px; font-size: 14px; font-weight: 700; }
.panel-hint { font-size: 11.5px; font-style: italic; color: var(--ink-soft); margin-bottom: 14px; line-height: 1.4; }
.tmpl-group-label { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; margin: 18px 0 10px; }
.tmpl-group-label:first-of-type { margin-top: 0; }
.tmpl-item { display: block; width: 100%; margin-bottom: 12px; cursor: grab; }
.tmpl-item.as-static { cursor: default; margin-bottom: 0; flex: 1; }
.tmpl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

/* Reordering, shown only while managing. The two arrows stack so a row of
   templates stays the same height as it is when not managing. */
.tmpl-move { display: flex; flex-direction: column; gap: 2px; flex: none; }
.tmpl-group-label .tmpl-move { margin-left: auto; }
.move-btn {
  width: 20px; height: 15px; padding: 0; line-height: 1;
  font-size: 8px; font-family: inherit;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  border-radius: 3px; cursor: pointer;
}
.move-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.move-btn:disabled { opacity: 0.25; cursor: default; }

.panel-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.panel-add { flex: 1; padding: 8px 10px; font-size: 13px; }
.panel-manage { padding: 8px 12px; font-size: 13px; }
.panel-manage.on { background: var(--ink); color: var(--paper); }

.storage-note {
  font-size: 11px; color: var(--ink-soft); line-height: 1.45;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}

/* Modals (builder) */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,24,31,0.28);
  z-index: 80;
  display: flex;
  justify-content: center;
  /* flex-start + auto margins on the child, rather than align-items:center.
     Centring a flex item taller than its container makes the top overflow
     unreachable; auto margins centre it only when there is room. */
  align-items: flex-start;
  /* The backdrop does the scrolling, so the modal never needs overflow of
     its own. Top padding leaves room for the tab and buttons that overhang. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 46px 24px 40px;
}
.modal {
  position: relative; background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-hard);
  width: 520px; max-width: 100%;
  padding: 34px 32px 28px;
  margin: auto;
  /* Must stay visible: .modal-tab and .modal-actions-float sit at top:-18px
     and any overflow value other than visible clips them (Safari included). */
  overflow: visible;
}
.modal-tab {
  position: absolute; top: -18px; left: 130px; background: var(--paper);
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard-sm);
  padding: 6px 16px; font-size: 15px; font-weight: 700;
}
.modal-actions-float { position: absolute; top: -18px; right: 16px; display: flex; gap: 8px; }

.field-row { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 14px; margin-bottom: 14px; }
.field-label { text-align: right; font-size: 14.5px; line-height: 1.3; }
.field-input { border: 2px solid var(--ink); padding: 8px 10px; font-size: 14px; width: 100%; background: var(--paper); }
.field-combo { display: flex; }
.field-combo .field-input { flex: 1; border-right: none; }
.field-combo select { border: 2px solid var(--ink); background: var(--paper); font-size: 12.5px; padding: 0 6px; }
.subfield-note { font-size: 11.5px; font-style: italic; color: var(--ink-soft); text-align: right; line-height: 1.35; margin-top: 2px; }
.week-select-row { display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.week-select-row span { font-size: 14.5px; }

.day-toggle-row { display: flex; gap: 5px; }
.day-toggle { width: 38px; height: 34px; border: 2px solid var(--ink); background: var(--paper); font-size: 14px; font-weight: 600; }
.day-toggle.on { background: var(--ink); color: var(--paper); }
.day-toggle.dim { color: #c3c7cd; border-color: #c3c7cd; }

.notes-modal-body textarea {
  width: 100%; min-height: 200px; border: 2px solid var(--ink);
  padding: 10px; font-size: 13.5px; line-height: 1.5; resize: vertical;
}
.info-card-sub { font-size: 12.5px; font-style: italic; color: var(--ink-soft); margin-bottom: 12px; }
.pb-edit-row { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.pb-edit-row label { font-size: 13.5px; font-weight: 700; }

/* Session popover — anchored to the day card, but clamped so it always fits
   on screen. max-height is set inline from the clamped top offset. */
.session-pop {
  position: fixed; z-index: 95; width: 250px;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: var(--shadow-hard);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.session-pop-head { padding: 8px 10px; color: var(--paper); display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 700; }
.session-line { padding: 4px 10px; font-size: 11.5px; color: var(--paper); border-bottom: 1px solid rgba(255,255,255,0.35); line-height: 1.35; }
.session-line.indent { padding-left: 22px; }
.session-km-tag { display: flex; justify-content: flex-end; padding: 4px 6px; }
.session-km-tag span { background: var(--paper); border: 1.5px solid var(--ink); font-size: 10.5px; font-weight: 700; padding: 0 5px; }
.session-notes { background: var(--paper); border-top: 2px solid var(--ink); padding: 10px; }
.session-notes-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; }
.session-notes-sub { font-size: 10.5px; font-style: italic; color: var(--ink-soft); margin-bottom: 8px; }
.session-notes-body { font-size: 11.5px; line-height: 1.45; white-space: pre-wrap; }
.session-empty { padding: 12px 10px; font-size: 11.5px; color: var(--paper); font-style: italic; }
.session-edit-form { padding: 10px; border-top: 2px solid var(--ink); background: var(--canvas); }
.session-edit-form label { display: block; font-size: 11px; font-weight: 700; margin-bottom: 3px; }
.session-edit-form input, .session-edit-form textarea, .session-edit-form select {
  width: 100%; border: 2px solid var(--ink); padding: 5px 6px; font-size: 11.5px; margin-bottom: 8px; background: var(--paper);
}
.session-edit-form textarea { min-height: 88px; resize: vertical; }
/* v0.43.1: a day refusing to save without a name. The message is the same
   red-on-pink the account and details forms use, scaled to this panel's
   smaller type, and the field it is about is outlined to match so the eye
   lands on the box rather than only on the sentence. */
.session-edit-form .acct-error {
  font-size: 11.5px; padding: 6px 7px; margin-bottom: 8px; line-height: 1.35;
}
.session-edit-form input.field-wanted { border-color: var(--red); }

/* v0.43.1: archiving from the details panel. Ruled off from the fields
   above it — this acts on the whole client rather than editing a value, and
   it is the only thing in the panel that does not wait for Save. */
.detail-archive {
  margin-top: 22px; padding-top: 16px; border-top: 2px solid var(--line);
}
.detail-archive .event-sub { margin-top: 0; }
.detail-archive .rail-placeholder { margin-bottom: 10px; }
/* Keep Save reachable even when the form is scrolled inside the popover. */
.session-edit-form .hard-btn {
  position: sticky; bottom: 0; margin-bottom: 0;
}

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 18px; font-size: 11.5px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
/* Same weight as the season key at the top of the page. Two keys on one
   screen drawn differently reads as two different kinds of thing. */
.legend-swatch { width: 13px; height: 13px; border: 1.5px solid var(--ink); }

/* ---------- Runner-facing week view ---------- */

.runner-page { max-width: 1080px; margin: 0 auto; }
.runner-weeknav { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; }
.week-nav-btn {
  border: 2px solid var(--ink); background: var(--paper); width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.week-nav-btn:disabled { opacity: 0.3; cursor: default; }

.coach-note-card {
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard); padding: 14px 16px;
  max-width: 460px; margin-bottom: 20px;
}
.coach-note-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.coach-note-body { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.coach-note-empty { font-size: 12.5px; font-style: italic; color: var(--ink-soft); }

.status-select { border: 2px solid var(--ink); padding: 5px 8px; font-size: 12.5px; background: var(--paper); width: 100%; }

.pb-card { border: 2px solid var(--ink); box-shadow: var(--shadow-hard); padding: 14px 18px; max-width: 260px; }
.pb-list { font-size: 13.5px; line-height: 1.8; }

/* ---------- Failed save banner ---------- */

.sync-error {
  margin: 12px 32px 0;
  border: 2px solid var(--red);
  background: #fdecec;
  padding: 14px 16px;
}
.sync-error-head { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.sync-error-body {
  font-size: 13px; line-height: 1.5; margin-bottom: 10px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-word;
}
.sync-error-actions { display: flex; gap: 10px; margin-bottom: 8px; }
.sync-error-actions .hard-btn { padding: 6px 14px; font-size: 13px; }
.sync-error-hint { font-size: 11.5px; font-style: italic; color: var(--ink-soft); }

/* ---------- Toast ---------- */

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 9px 18px; font-size: 13px; font-weight: 600;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.toast.show { opacity: 1; }


/* ---------- Proposed events ---------- */

.event-card.proposed { border-color: var(--proposed); }
.proposed-banner {
  border: 2px solid var(--proposed); background: var(--proposed-soft);
  padding: 10px 12px; margin-bottom: 14px; font-size: 13px; line-height: 1.45;
}
.proposed-sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- Runner: proposing an event ---------- */

.propose-panel {
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard);
  padding: 14px 16px; margin-top: 16px; max-width: 560px;
}
.propose-head { font-size: 16px; font-weight: 700; }
.propose-sub { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; margin-top: 2px; }
.propose-list { margin-top: 12px; }
.propose-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 2px solid var(--proposed); background: var(--proposed-soft);
  padding: 8px 10px; margin-bottom: 8px; font-size: 13px;
}
.propose-date { font-size: 11.5px; color: var(--ink-soft); }
.propose-status {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--proposed); color: #fff; padding: 3px 7px; white-space: nowrap;
}
.propose-form { margin-top: 12px; border-top: 2px solid var(--line); padding-top: 12px; }

/* ---------- Runner: personal bests ---------- */

.pb-panel {
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard);
  padding: 14px 16px; max-width: 460px;
}
.pb-table { width: 100%; border-collapse: collapse; }
.pb-table td { padding: 4px 0; vertical-align: middle; }
.pb-dist { font-weight: 700; font-size: 14px; width: 78px; }
.pb-time { padding: 6px 8px; font-size: 13.5px; }
.pb-remove { width: 28px; text-align: right; }
.pb-add { margin-top: 14px; border-top: 2px solid var(--line); padding-top: 12px; }
.pb-add-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 8px; }
.pb-add-row .field-input { padding: 7px 9px; font-size: 13.5px; }

/* ---------- v0.11.0 additions ---------- */

.board-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.board-refresh { padding: 6px 14px; font-size: 13px; }

/* Sort selector on the runners grid corner */
/* Sort control: the current mode reads as a label with the arrows in their
   own cell beside it, and the alternatives drop out underneath. Built by hand
   because a native <select> cannot be drawn as two joined cells. */
/* Fills its column rather than sitting inset in it. The control and the
   list that drops out of it are exactly as wide as the runner buttons
   underneath, so the left and right edges of the whole stack line up. */
.sort-box { position: relative; display: flex; width: 100%; align-items: stretch; }
.sort-box .sort-current { flex: 1; min-width: 0; }
/* The sort control takes the WEEKS plane, not the frozen one it stands on.
   It is the corner of the pane — the one block belonging to both the names
   below it and the dates beside it — and giving it the ground of the half
   that moves stops it disappearing into the half that does not. */
.sort-current, .sort-arrows {
  border: 2px solid var(--ink); background: var(--plane-weeks); color: var(--ink);
  font-size: 15px; line-height: 1; padding: 0 12px;
  /* The same height as every other block in the roll. It was padded to
     whatever its type needed, which made the control a few pixels taller
     than the red date block beside it and the names below it. */
  height: var(--rg-block-h);
  display: flex; align-items: center;
}
.sort-current { text-align: left; }
.sort-arrows { border-left: none; padding: 8px 10px; }
/* One pair of arrows, turned over rather than reordered.
   The two characters used to swap places to say which way the list ran,
   which meant the control changed width as well as meaning. Baz's mark is
   a fixed pair, so descending simply turns it upside down. */
.sort-arrows.desc .ic { transform: scaleY(-1); }
.sort-current:hover, .sort-arrows:hover { background: var(--canvas); }
.sort-box.open .sort-current, .sort-box.open .sort-arrows { background: var(--canvas); }

/* The menu hangs off the bottom edge of the control, as the account panel
   does off the header rule. */
.sort-menu {
  position: absolute; top: 100%; left: 0; right: 0;
  border: 2px solid var(--ink); border-top: none;
  background: var(--paper); z-index: 12;
}
.sort-option {
  display: block; width: 100%; text-align: left;
  border: none; background: none; color: var(--ink);
  font-size: 15px; padding: 8px 12px;
}
.sort-option + .sort-option { border-top: 2px solid var(--line); }
.sort-option:hover { background: var(--canvas); }

/* Runner admin */
.runner-edit { font-size: 15px; margin-left: 6px; vertical-align: baseline; }
.archived-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--ink-soft); color: #fff; padding: 2px 7px; margin-left: 8px; vertical-align: middle;
}

/* Runner calendar: run type as an outline, today filled in */
.month-day.run-outline {
  border: 1.5px solid transparent;   /* colour supplied inline per day type */
  font-weight: 600;
}
.month-day.run-today {
  border: 1.5px solid transparent;
  font-weight: 700;
  outline: none;                     /* the fill already says "today" */
}
/* An event on the same day keeps its own fill; the outline still shows the run. */
.month-day.has-event.run-outline,
.month-day.is-goal.run-outline,
.month-day.is-proposed.run-outline { border-width: 2px; }

.cal-key {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin: 8px 0 4px; font-size: 11px; color: var(--ink);
}
.cal-key-item { display: inline-flex; align-items: center; gap: 5px; }
.cal-key-swatch {
  width: 12px; height: 12px; border: 2px solid var(--ink); display: inline-block;
}
.cal-key-swatch.solid { border-width: 2px; }
/* A run type is shown as an underline on the calendar, so the key shows one
   too rather than a filled square that means something else. */
.cal-key-swatch.underline {
  border: none; border-bottom: 3px solid transparent;
  width: 14px; height: 12px; vertical-align: -1px;
}

/* ---------- v0.12.0: event distances, requests, signup notice ---------- */

.event-switch { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.event-switch-btn {
  border: 2px solid var(--ink); background: var(--paper);
  font-size: 11px; font-weight: 600; padding: 4px 8px; color: var(--ink);
}
.event-switch-btn.on { background: var(--ink); color: var(--paper); }
.event-switch-btn.proposed { border-color: var(--proposed); color: var(--proposed); }
.event-switch-btn.proposed.on { background: var(--proposed); color: #fff; }
.event-switch-btn.add { border-style: dashed; }

.dist-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dist-chip {
  border: 2px solid var(--ink); background: var(--paper);
  font-size: 12px; font-weight: 700; padding: 5px 10px; color: var(--ink);
}
.dist-chip.on { background: var(--ink); color: var(--paper); }
.dist-chip.custom { border-style: dashed; }
.dist-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 6px; }
.dist-add .field-input { padding: 6px 8px; font-size: 13px; }
.dist-add .hard-btn { padding: 6px 12px; font-size: 13px; }

.roll-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.roll-row .roll-pick { margin: 0; }
.roll-dist { border: 2px solid var(--ink); background: var(--paper); font-size: 12px; padding: 6px 4px; }
.roll-dist-tag {
  font-size: 10px; font-weight: 700; background: var(--ink); color: #fff;
  padding: 2px 6px; white-space: nowrap;
}

/* A day carrying an unanswered request */
.day-card.has-request { box-shadow: var(--shadow-hard-sm), inset 0 0 0 3px rgba(255,255,255,0.5); }

.signup-notice {
  border: 2px solid var(--green); background: #eaf7ee;
  padding: 12px 16px; margin-bottom: 14px;
  /* align-items: center, not stretch.
   *
   * The default stretches every child to the tallest, and the actions
   * group is taller than one line of text — so on the warning, which has
   * no actions beside it, the text block was stretched to a height it did
   * not need and the spare room showed as padding under the last line.
   * The box now closes up to whatever the words take. */
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
/* With nothing beside it the text is the whole row, so it may use the
   width and the box takes its height from the lines, however many. */
.signup-notice.unwritten .signup-notice-text { flex: 1 1 auto; }
.signup-notice-text { font-size: 13.5px; line-height: 1.5; }
.signup-notice-actions { display: flex; gap: 8px; }
.signup-notice-actions .hard-btn { padding: 6px 12px; font-size: 13px; }
/* The unwritten-week warning wears the same shape as the signup notice and a
   different colour, because it says the opposite kind of thing. Stone rather
   than red: red is today, and a week that has not been written yet is a job
   on the list, not an emergency. */
/* Orange since 0.44.0, from a near-white canvas.
 *
 * It is the one thing on the board that is asking the coach to do
 * something, and at canvas grey it read as a caption. Orange is the
 * palette's "needs you" — the same colour the unread mark on the avatar
 * uses — and it is still not red, because a week not yet written is a job
 * on the list rather than an emergency. */
.signup-notice.unwritten { border-color: var(--ink); background: var(--orange); }

/* The foot of the runner's session panel: Close and Send note, one line.
   Equal halves rather than sized to their words, so neither reads as the
   lesser of the two — closing without sending is a perfectly ordinary thing
   to do, and a narrow Close beside a wide Send would suggest otherwise. */
.session-foot { display: flex; gap: 10px; margin-top: 12px; }
.session-foot .hard-btn { flex: 1 1 0; min-width: 0; }
/* Green for the one that sends something, matching every other send in the
   app. Close keeps the paper fill: it is the way out, not the action. */
.session-foot .hard-btn.send { background: var(--lime); }
.session-foot .hard-btn[disabled] { opacity: 0.45; cursor: default; box-shadow: none; }

/* ---------- Week template preview ---------- */

/* The seven days at a glance, so a coach can tell one base week from another
   without applying it to find out. Seven rows of three columns rather than
   the full day tiles: this answers "which template is this", not "what is in
   Tuesday". */
.wk-prev { border: 2px solid var(--ink); }
.wk-prev-row {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) 52px;
  gap: 8px; align-items: baseline;
  padding: 6px 8px; font-size: 13px;
}
.wk-prev-row + .wk-prev-row { border-top: 1px solid var(--ink); }
.wk-prev-day { font-weight: 700; font-size: 11px; text-transform: uppercase; }
.wk-prev-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-prev-km { text-align: right; font-variant-numeric: tabular-nums; }

/* Renaming a saved day or week in the Manage list. */
.tmpl-rename {
  flex: 1 1 auto; min-width: 0;
  border: 2px solid var(--ink); font: inherit; font-size: 13px; padding: 4px 7px;
}

/* ---------- v0.14.0: release notes, account editing ---------- */

/* The version number opens this. Deliberately not a history — a tester wants
   to know what moved since they last looked, not to read an archive. */
.notes-list { margin: 0; padding: 0; list-style: none; }
.notes-list li {
  font-size: 15px; line-height: 1.55; margin-bottom: 12px;
  padding-left: 18px; position: relative;
}
.notes-list li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 8px; height: 8px; background: var(--ink);
}
.notes-headline { font-size: 19px; font-weight: 700; margin: 0 0 4px; }
.notes-meta { font-size: 13px; color: var(--ink-soft); margin: 0 0 18px; }

.acct-form .field-row { display: block; margin-bottom: 14px; }
.acct-form .field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.acct-form .field-input { width: 100%; }
.acct-form .acct-optional { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: 0.6; margin-left: 4px; }
.acct-form .birth-inputs { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; }
.acct-form .birth-inputs + .acct-note { margin-top: 6px; }
.detail-readonly { font-size: 14px; padding: 8px 0; }
.acct-divider {
  border-top: 2px solid var(--ink); margin: 20px 0 16px; padding-top: 14px;
}
.acct-note { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 14px; }
.acct-error {
  border: 2px solid var(--red); background: #F7E9E9; color: var(--red);
  padding: 9px 11px; font-size: 14px; margin-bottom: 14px;
}

/* ---------- v0.15.0: right-hand rail, categories, runner details ---------- */

/* Everything the coach can open about a runner lives in one rail, and a panel
   replaces the list in place rather than appearing wherever its button was. */
.builder-split { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); gap: 24px; align-items: start; }
.builder-split > .workspace { min-width: 0; }

/* Custom Days and Custom Weeks open as a panel fixed to the right edge, and
   .page.panel-open pads the page across to make room for it. The grid was
   still holding its own 300px column open as well, so about 600px was reserved
   for a 300px panel and the week cards were squeezed into what was left. One
   panel, one reservation: while the fixed one is open the rail column closes. */
/* The Custom Days and Custom Weeks panel is position:fixed, so it paints
   against the right edge — but it is still a CHILD of the rail. The rail's
   grid column was therefore standing empty at its full width while the page
   ALSO padded across for the panel, reserving about twice the space needed and
   squeezing the week cards.

   The column collapses to nothing; the rail element stays. Hiding the rail
   outright took the panel with it, because the panel lives inside it — which
   is exactly what happened the first time this was "fixed". */
.page.panel-open .builder-split { grid-template-columns: minmax(0, 1fr) 0; gap: 0; }
.page.panel-open .builder-split > .rail { width: 0; overflow: visible; }

.rail { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
/* Narrower, so the day tiles get the difference. The constraint is the
   longest label — "Runner's Notes (visible to athlete)" — so the type comes
   down a step with the panel rather than the words being allowed to collide
   with the border. Wrapping is left on: if a label does outgrow the width on
   some other font stack, it takes two lines instead of running out of the
   button. */
.rail-item {
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-hard-sm);
  padding: 11px 12px; font-size: 15px; text-align: center;
  white-space: normal; overflow-wrap: break-word;
}
.rail-item:hover:not([disabled]) { background: var(--canvas); }
.rail-item:active:not([disabled]) { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.rail-item[disabled] { opacity: 0.4; box-shadow: none; cursor: not-allowed; }
.rail-note { font-style: italic; font-size: 12px; }

.rail-panel {
  border: 2px solid var(--ink); background: var(--paper);
  box-shadow: var(--shadow-hard); padding: 16px;
}
.rail-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px;
  font-size: 19px; font-weight: 700;
}
.rail-placeholder { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }

/* Runner details */
.detail-name-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: 14px; }
.detail-name-row .field-input { flex: 1; min-width: 0; }
.invite-code {
  border: 2px solid var(--ink); padding: 8px 10px; font-size: 15px;
  letter-spacing: 0.08em; display: flex; align-items: center; white-space: nowrap;
}
.invite-code.used { color: var(--ink-soft); text-decoration: line-through; }
.code-refresh { padding: 8px 10px; font-size: 15px; line-height: 1; }
.detail-field { margin-bottom: 14px; }
.detail-field .field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.detail-field .field-input { width: 100%; }
.detail-pb { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.detail-pb-label { font-weight: 700; }

/* Category folders */
.add-category { width: 100%; margin-bottom: 14px; font-size: 14px; padding: 7px 10px; }
.cat-block { margin-bottom: 14px; }
.cat-head {
  display: flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink); padding: 6px 8px;
  /* The same 12px the days and weeks below hold between themselves.
   *
   * Without it the first one butted straight up against the coloured bar and
   * read as part of it, so coaches reaching for the run took hold of the
   * category title instead and wondered why it would not drag. */
  margin-bottom: 12px;
}

.cat-name {
  flex: 1; min-width: 0; border: none; background: none;
  font-size: 15px; font-weight: 700; text-align: left;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-toggle { border: none; background: none; font-size: 13px; padding: 2px 4px; }
.cat-del {
  border: 2px solid var(--ink); background: var(--red); color: #fff;
  font-size: 13px; padding: 3px 8px;
}
.cat-empty { margin: 6px 0 0; font-style: italic; }
.cat-edit {
  display: flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink); padding: 5px 6px;
}
.cat-name-input { flex: 1; min-width: 0; border: 2px solid var(--ink); padding: 5px 7px; font-size: 15px; }
.cat-swatches { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0 4px; margin-bottom: 12px; }
.cat-swatch { width: 22px; height: 22px; border: 2px solid var(--ink); padding: 0; }
.cat-swatch.on { box-shadow: inset 0 0 0 2px var(--paper); }

/* Dragging a custom day to a new place in the list */
.drag-handle { cursor: grab; font-size: 15px; padding: 0 2px; color: var(--ink); flex: none; }
.tmpl-row[draggable="true"] { cursor: grab; }
.tmpl-row.drop-target { outline: 3px dashed var(--ink); outline-offset: 2px; }
.reorder-tail { height: 14px; }
.reorder-tail.drop-target { outline: 3px dashed var(--ink); outline-offset: -2px; }

/* Day cards: a title with a rule under it, then as much of the workout as
   fits. The clamp is what puts the ellipsis in — the alternative was cutting
   text off mid-letter at the box edge. */
.day-card-title {
  display: block; font-weight: 400; font-size: 12px;
  border-bottom: 1.5px solid currentColor; padding-bottom: 3px; margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Five lines rather than six. The border took 4px from the card's inside and
   the padding another 2, and six lines no longer clear the km badge — the
   text ran under it. The clamp is what keeps the ellipsis honest, so it has
   to match what actually fits rather than what used to. */
.day-card-preview {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5;
  line-clamp: 5; overflow: hidden;
  font-size: 10.5px; font-weight: 400; line-height: 1.35;
}
.day-card.compact .day-card-preview { -webkit-line-clamp: 3; line-clamp: 3; }
.preview-line { display: block; }
.preview-line.indent { padding-left: 10px; }

/* Runner season: the run type shows as an underline on the date, and only
   for weeks that have actually been published. */
.runner-season .month-day.run-underline,
.season .month-day.run-underline {
  border-bottom: 2.5px solid transparent;   /* colour supplied inline */
  font-weight: 700; color: var(--ink);
}
/* Today fills red; the run underneath it stays visible as the underline. */
/* Today fills red and reverses its figure out. Declared after the underline
   rules so the run colour cannot put the black text back on the red. */
.month-day.today,
.month-day.run-underline.today {
  background: var(--today); color: #fff; font-weight: 700;
  border-bottom-color: #fff;
}

/* ---------- v0.16.0: the runner's own board ---------- */

/* An unpublished week is an empty track, not a zero-length bar — the
   difference between "nothing yet" and "no training". */
.bar.unpublished { background: none; }
/* The week's outline is an inset shadow rather than a border, and the reason
   is the segments sitting inside it.
 *
 * A border belongs to the track's own box, so the segments start where it
 * ends and their 2px lands against the track's 2px — a 4px band down the top,
 * the bottom and the left of every filled week, twice as heavy as the lines
 * drawn between the sessions.
 *
 * An inset shadow paints in the track's background layer, underneath its
 * children, so the first segment's border covers it exactly and the join
 * reads as one 2px line. It also takes up no space: the track keeps the same
 * content box it had before it was outlined at all, which matters because a
 * bar's width IS the week's distance against the axis and the midline is
 * positioned off the same arithmetic. */
/* Two pixels, like every other line in this panel.
 *
 * This was 1px on the reasoning that fifteen stacked rows at 2px would read
 * as a ladder competing with the bars in front of them. In practice the
 * opposite was the problem: a low-volume week is almost all track, so it was
 * drawn almost entirely in the lighter weight and was hard to pick out from
 * the week above and below it.
 *
 * The midline stays at 1px and the hover outline at 1.5px. Those two are
 * deliberately lighter for their own reasons and are not part of this. */
.week-row .bar-track { box-shadow: inset 0 0 0 2px var(--ink); background: var(--paper); }
/* Red always means NOW, whatever is selected. The number and the date fill
   solid and reverse out, and they keep doing it when the coach is looking at
   some other week — losing the marker the moment you clicked elsewhere was
   the thing that made the old treatment confusing.
 *
 * The bar itself is left alone. It used to take a red border to say the same
 * thing, which put "now" in two places and meant the track could not simply
 * be drawn like every other bordered box in the app. */
.week-row.is-current .week-num,
.week-row.is-current .week-date {
  align-self: stretch;
  display: flex; align-items: center;
  background: var(--today); color: #fff;
  font-weight: 400;
}
/* The red block closes on its outer edge.
 *
 * Every other box in the chart is drawn with a line around it; the current
 * week's number block was the one that ran off the left with an open side,
 * because the frame that used to close it only appears when that week happens
 * to be the selected one. Inset, so it takes no width — the number column is
 * an exact measurement the three rules are positioned from. */
.week-row.is-current .week-num {
  justify-content: flex-end;
  box-shadow: inset 2px 0 0 var(--ink);
}

/* The frame hugs the row when the current week is the selected one.
 *
 * It is drawn four pixels wide of the row on both sides, which is right for
 * an ordinary selected week — the lip is paper on paper and reads as breathing
 * room. On the current week the row's left edge is red, so the same lip became
 * a white sliver between the frame and the block. On the right the chart's own
 * rule already sits there and closes it; on the left there is nothing, so the
 * frame closes it instead. The shadow still overhangs, which is the part that
 * was meant to. */
.week-row.is-current.selected::before { left: 0; }
.week-row.is-current .week-date { justify-content: flex-start; }

/* An event's distance rides on the end of the track in the colour that says
   what kind of event it is, so a blank week still shows the race in it. */
.bar-event {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  border: 1.5px solid var(--ink); color: var(--ink);
  font-size: 10.5px; font-weight: 700; padding: 1px 5px; min-width: 22px;
  text-align: center; pointer-events: none;
}

/* Upcoming events */
.upcoming { margin-bottom: 8px; }
.upcoming-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard-sm);
  padding: 8px 10px; font-size: 15px; color: var(--ink); text-align: left;
}
.upcoming-row:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.upcoming-date { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.upcoming-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-km { font-size: 12px; font-weight: 700; white-space: nowrap; }
.upcoming-detail { border: 2px solid var(--ink); border-top: none; padding: 12px 10px; }
.upcoming.editing { border: 2px solid var(--ink); padding: 12px 10px; }

/* Personal bests on the rail */
.pb-row {
  display: flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink); padding: 6px 8px; margin-bottom: 6px; font-size: 15px;
}
.pb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-inline { width: 90px; flex: none; }
.pb-btn { padding: 4px 10px; font-size: 13px; box-shadow: none; }
.pb-add-row { display: flex; gap: 6px; margin-top: 8px; }
.pb-add-row .field-input { min-width: 0; }

/* A code meant to be read aloud or typed from a screenshot. */
.invite-code-big {
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard-sm);
  font-size: 30px; font-weight: 700; letter-spacing: 0.16em;
  text-align: center; padding: 16px 10px; margin: 14px 0;
}

/* Runner roll: who is entered, with the rest behind an Add. A coach with
   eighty runners should never scroll eighty to see the three who are going. */
.roll-row { display: flex; align-items: stretch; gap: 6px; margin-bottom: 6px; }
.roll-entered {
  flex: 1; min-width: 0; border: 2px solid var(--ink); padding: 7px 10px;
  font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.roll-entered.goal { background: var(--goal); }
.roll-add { border: 2px solid var(--ink); padding: 10px; margin-top: 8px; }
.roll-choices { max-height: 200px; overflow-y: auto; margin-top: 8px; }
.roll-choice {
  display: block; width: 100%; text-align: left;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  padding: 7px 10px; font-size: 15px; margin-bottom: 5px;
}
.roll-choice:hover { background: var(--canvas); }

/* Every marked day on every season calendar carries a dark outline — events
   of all kinds, and today. The fill alone asks the eye to tell five colours
   apart at 8px; the outline gives the mark an edge that does not depend on
   distinguishing them, which is the whole point. Today was left out of this
   first time round on the reasoning that it is not an event; but the outline
   is an accessibility device, not a category label, and it belongs on
   anything the calendar is trying to point at. All three seasons share these
   classes, so this reaches the board, the builder and the runner's view. */
.month-day.is-goal,
.month-day.has-event,
.month-day.is-proposed,
.month-day.today,
.month-day.band { box-shadow: 0 0 0 1.5px var(--ink); }

/* A stage race reads as one band across its dates rather than a run of
   separate marks, so only its two ends are rounded. */
.month-day.band { border-radius: 0; }
.month-day.band-start { border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
.month-day.band-end { border-top-right-radius: 3px; border-bottom-right-radius: 3px; }

.date-row { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.date-row .event-field { margin-bottom: 0; min-width: 0; }
.date-to { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; }
.date-mode { padding: 8px 12px; font-size: 14px; white-space: nowrap; }
.event-days {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  border: 1.5px solid var(--ink); padding: 1px 6px; margin-left: 6px;
}

/* ==================================================================== */
/* Phones — the runner's screen rearranged                              */
/* ==================================================================== */

/* The breakpoint must match NARROW_MAX in app.js. The JS decides which markup
   to emit and this decides how it looks; if they disagree, one of them is
   styling a screen that is not there. A test holds the two together. */

.page.narrow { --page-pad-x: 12px; padding: 14px var(--page-pad-x) 40px; }
.section-band.tight { margin-top: 20px; }

/* ---------- Today ---------- */

.today-wrap { margin-bottom: 4px; }
.today-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.today-label { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.today-date { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* Deliberately large. This is the one thing a runner opens the app to read,
   often outdoors, often at arm's length, and often in a hurry. */
.today-card {
  position: relative; display: block; width: 100%; text-align: left;
  border: 2px solid var(--ink); box-shadow: var(--shadow-hard);
  padding: 16px 16px 44px; min-height: 132px;
}
.today-card.none {
  background: var(--paper); color: var(--ink);
  border-style: dashed; box-shadow: none; min-height: 96px; padding-bottom: 16px;
}
.today-title { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; padding-right: 76px; }
.today-sub { display: block; margin-top: 8px; font-size: 15px; color: var(--ink-soft); line-height: 1.4; }
.today-km {
  position: absolute; top: 14px; right: 14px;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  font-size: 20px; font-weight: 800; padding: 2px 8px; line-height: 1.2;
}
.today-km small { font-size: 11px; font-weight: 700; margin-left: 2px; }
.today-structure { display: block; margin-top: 12px; font-size: 14px; font-weight: 500; line-height: 1.5; }
.today-tap {
  position: absolute; left: 16px; bottom: 14px;
  font-size: 12px; font-weight: 700; text-decoration: underline;
}
.today-marks { position: absolute; top: 14px; left: 14px; display: flex; gap: 6px; }

/* ---------- Carousels ---------- */

.carousel { margin-top: 10px; }
.carousel-bar {
  display: flex; align-items: stretch; gap: 8px; margin-bottom: 10px;
}
.carousel-title {
  flex: 1; min-width: 0; text-align: center;
  border: 2px solid var(--ink); background: var(--paper);
  padding: 6px 8px;
  display: flex; flex-direction: column; justify-content: center;
}
.carousel-week { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; }
.carousel-dates { font-size: 12px; font-weight: 600; color: var(--ink-soft); }

/* 48px square: a thumb-sized target, which is the whole reason these exist
   rather than relying on a swipe. */
.carousel-arrow {
  width: 48px; min-height: 48px; flex: 0 0 48px;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-hard-sm);
  font-size: 26px; font-weight: 700; line-height: 1;
}
.carousel-arrow:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.carousel-arrow[disabled] {
  border-color: var(--line); color: var(--line); box-shadow: none;
  background: var(--canvas);
}
/* Aligned with the week panel between the arrows rather than spanning the
   whole width, and carrying a shadow — full width and flat, it read as a
   coloured bar rather than as something to press.

   The arrows are 48px wide with an 8px gap either side of the title, so
   matching that inset puts it exactly under the panel it returns you to. */
.carousel-back {
  display: block; margin: 0 56px 10px;
  border: 2px solid var(--ink); background: var(--today); color: #fff;
  box-shadow: var(--shadow-hard-sm);
  font-size: 13px; font-weight: 700; padding: 8px;
  width: calc(100% - 112px);
}
.carousel-back:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.narrow-panel { margin-top: 10px; }
.narrow-panel .rail-panel { width: 100%; max-width: none; }
.narrow-chart { margin-top: 10px; overflow-x: auto; }

@media (max-width: 760px) {
  /* The 0.30 header changes are a desktop matter. On a phone the button goes
     back to the top of the page, because the narrow bar is one line that must
     not wrap, and the page below it has room the header does not. */
  .back-btn.on-phone { display: inline-flex; }
  .back-btn.in-header { display: none; }

  /* The seven days become a list. At this width seven columns give each day
     about fifty pixels, which is not enough for a session name — and the
     session name is the point. */
  /* Room for the shadow to land on.
   *
   * A hard shadow is drawn OUTSIDE the box and occupies no layout space. On a
   * desktop the day tiles sit in a seven-column grid with gaps, so each one's
   * shadow falls into the gap beside it and nobody notices. Given a single
   * full-width column there is no gap on the right, so the shadow — and the
   * 2px border under it — fell off the edge of the screen. The Today card
   * above escaped it by not being in this grid at all, which is why only half
   * the page looked wrong.
   *
   * Four pixels, matching --shadow-hard-sm exactly. */
  /* minmax(0, 1fr), never a bare 1fr.
   *
   * `1fr` means `minmax(auto, 1fr)`, and that `auto` floors the track at the
   * item's min-content width — so a tile whose contents will not compress any
   * further makes its own column wider than the container and hangs off the
   * side of the screen. Measured at 382px in a 366px grid, which is exactly
   * what was running off the right edge on a phone.
   *
   * The seven-column rule this overrides was already written as
   * minmax(0, 1fr) for precisely this reason. Writing the phone override as a
   * bare 1fr threw that away, and the failure only shows at a width narrow
   * enough for the contents to stop fitting — which is to say, on a phone and
   * nowhere else.
   *
   * The padding is a separate matter and still needed: a hard shadow is drawn
   * outside the box and occupies no layout space, so without four pixels to
   * land on it falls off the edge even when the tile itself fits. */
  .page.narrow .day-grid {
    grid-template-columns: minmax(0, 1fr); gap: 8px;
    padding-right: 4px;
  }
  .page.narrow .day-card {
    height: auto; min-height: 60px; padding: 10px 88px 10px 12px; font-size: 15px;
  }
  /* The phone keeps the weights it had. The regular-everywhere change is a
     desktop tile matter, and at 15px on a small screen the name needs the
     weight to separate from the session text under it. */
  .page.narrow .day-card-title { font-size: 15px; font-weight: 700; }
  .page.narrow .day-card-session { font-size: 13px; }
  .page.narrow .day-head { font-weight: 700; }
  .page.narrow .day-card-km { font-weight: 700; }
  /* The phone badge floats on the right-hand edge rather than sitting in a
     corner, so it keeps all four of its own sides. */
  .page.narrow .day-card-km {
    top: 50%; right: 3px; bottom: auto; transform: translateY(-50%);
    border: 1.5px solid var(--ink);
    font-size: 13px; padding: 2px 7px; min-width: 30px;
  }
  .page.narrow .day-head { font-size: 12px; margin-bottom: 2px; }

  /* Two months across, whatever the phone's width, and still draggable. */
  /* Half the scroller rather than a sum against 100vw, which counts the
     width a vertical scrollbar takes and so overflowed by a scrollbar
     wherever the browser draws a classic one. Same change as the coach's
     board below, and the same reason. */
  .page.narrow .season { grid-auto-columns: calc(50% - 5px); }
  .page.narrow .season-scroll { scroll-behavior: smooth; }
  .page.narrow .month-day { font-size: 11px; }

  /* Full width for anything that was sized for a desktop column. */
  .page.narrow .week-block,
  .page.narrow .rail-panel,
  .page.narrow .chart-wrap { width: 100%; max-width: none; }

  /* The outer rule goes on a phone.
   *
   * On a desktop that border is a seam: the day tiles sit immediately to the
   * right of the chart and something has to divide them. On a phone the
   * sections are stacked, so there is nothing to its right at all and it
   * reads as an arbitrary line down the edge of the screen.
   *
   * Taking it away leaves the current week's date block open on its outer
   * side, because that rule was what closed it. So the block closes itself,
   * the same way its number block does at the other end of the row. */
  .page.narrow .chart-body { border-right: none; }
  .page.narrow .week-row.is-current .week-date {
    box-shadow: inset -2px 0 0 var(--ink);
  }

  /* The top bar has three things on it and a phone has room for two. */
  .topbar { flex-wrap: wrap; gap: 8px; }
  .app-title { font-size: 22px; }
  .notif-drop { right: 8px; left: 8px; width: auto; top: 84px; }
  .account-drop { min-width: 0; width: calc(100vw - 24px); right: -8px; }

  /* A modal sized for a laptop cannot be dismissed on a phone if its close
     button is off the right-hand edge. The scrolling goes on the backdrop, not
     on the modal: the modal's tab and action buttons deliberately overhang its
     edges, and any overflow other than visible cuts them off. */
  .modal { width: calc(100vw - 24px) !important; max-width: none; }
  .modal-backdrop {
    align-items: flex-start; overflow-y: auto;
    padding: 56px 0 24px;
  }

  /* ---------- Welcome, log in and sign up ---------- */

  .welcome { padding: 32px 20px; }
  .welcome-title { font-size: 27px; margin-bottom: 22px; }
  /* Side by side these two came to about 150px each with a gap between them.
     Stacked and full width they are unambiguous and easy to hit. */
  .welcome-actions {
    flex-direction: column; align-items: stretch;
    gap: 12px; width: 100%; max-width: 320px; margin-bottom: 44px;
  }
  .welcome-actions .hard-btn.lg { width: 100%; }
  .welcome-quote { font-size: 16px; }

  .auth-backdrop { padding: 24px 12px 40px; }
  .auth-heading { font-size: 24px; }
  .auth-card { width: calc(100vw - 24px); max-width: none; padding: 26px 18px 22px; }
  /* The close button hangs off the card's corner. With the card now nearly as
     wide as the screen, hanging it outside puts it past the edge. */
  .auth-close { top: -14px; right: -4px; }

  /* The label was a 130px right-aligned column, which left the input about the
     same width again on a phone — the single biggest reason the signup form
     felt broken. Stacked, the input gets the full width. */
  .auth-row { grid-template-columns: 1fr; gap: 6px; margin-bottom: 16px; }
  .auth-label { text-align: left; padding-top: 0; font-size: 14px; font-weight: 700; }
  /* A <br> in a label is a desktop line break; in one column it just splits a
     short phrase in half. */
  .auth-label br { display: none; }

  /* Safari on iOS zooms the page in whenever a focused input is under 16px,
     and does not zoom back out afterwards. 16px is the whole fix. */
  .auth-input { font-size: 16px; padding: 11px 12px; }
  .auth-input::placeholder { font-size: 13px; }

  /* The code and its explanation shared a row about half and half, which is
     why a short sentence came out one word per line. */
  .auth-inline { flex-direction: column; gap: 4px; }
  .auth-inline .auth-sub { margin-top: 0; }
  .auth-sub { font-size: 13px; }

  .auth-actions { justify-content: stretch; }
  .auth-actions .hard-btn { width: 100%; }
}

/* Same 44px floor as the rest of the phone layout. */
@media (max-width: 760px) and (pointer: coarse) {
  .auth-input,
  .auth-actions .hard-btn,
  .welcome-actions .hard-btn { min-height: 44px; }
}

/* Fingers, not cursors: every control gets a 44px target on a touch screen,
   which is the smallest reliably hittable size. */
@media (max-width: 760px) and (pointer: coarse) {
  .page.narrow .hard-btn,
  .page.narrow .day-card,
  .carousel-arrow,
  .carousel-back { min-height: 44px; }
}

/* ---------- The coach's note on a week ---------- */

/* Sits in the day grid as a column of its own, ahead of Monday, so the week
   reads left to right as intent then execution.

   The same 128px as a day card, and built the same way, so the row is seven
   equal tiles and not six plus an odd one. Whatever the note's length, the
   tile's size never changes — the text is clamped and the rest is behind a
   click. */
.week-note {
  position: relative;
  height: 128px; width: 100%; min-width: 0;
  border: 2px solid var(--ink);
  background: var(--paper); color: var(--ink);
  padding: 8px 10px;
  text-align: left; font: inherit;
  display: flex; flex-direction: column; align-items: stretch;
  overflow: hidden; cursor: pointer;
}
/* Matching the day cards, which lose theirs on a faded week too. */
.week-block:not(.faded) .week-note { box-shadow: var(--shadow-hard-sm); }
.week-block:not(.faded) .week-note:hover { filter: brightness(1.06); }

.week-note-head {
  display: block; flex: none;
  font-size: 12px; font-weight: 700;
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 3px; margin-bottom: 5px;
}
/* The clamp is what draws the ellipsis. The max-height underneath it is the
   floor: on anything that ignores line-clamp the text is still cut at the
   tile's edge rather than spilling out of it — no ellipsis, but no overflow
   either, and the whole note is one click away regardless. */
.week-note-body {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 6; line-clamp: 6;
  flex: 1 1 auto; min-height: 0;
  max-height: calc(10.5px * 1.35 * 6);
  overflow: hidden;
  font-size: 10.5px; font-weight: 400; line-height: 1.35;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
/* ---------- Ethos ---------- */

/* Long-form prose rather than interface text, so it gets the measure and the
   leading of something meant to be read rather than scanned. */
.ethos-body { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.ethos-para {
  font-size: 15px; line-height: 1.6; margin: 0 0 14px;
}
.ethos-para:last-of-type { margin-bottom: 0; }
/* Set apart the way a letter is signed, not run on as another paragraph. */
.ethos-sign {
  font-size: 15px; font-weight: 700; margin: 18px 0 0;
  padding-top: 14px; border-top: 2px solid var(--ink);
}

/* In the popup there is room, so the note is simply itself. */
.week-note-full {
  font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 60vh; overflow-y: auto;
}
/* One more column than there are days, only on the weeks that have a note. */
.day-grid:has(.week-note) { grid-template-columns: repeat(8, minmax(0, 1fr)); }

/* A written note is marked on the coach's button, so the bar says at a glance
   which weeks have one without opening them. */
/* A week carrying a note fills lime, the same way a published week fills
   green: colour as state, rather than an extra mark to decode. */
.save-tmpl-btn.has-note { background: var(--lime); color: var(--ink); }
/* Pushed to the far end of the bar, over the last day tile. Its own margin
   rather than the -2px every other button in the bar takes, because it is
   not joined to the group on the left — it is a separate act. */
.week-block-bar > .week-bar-end { margin-left: auto; }
.dup-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; margin-bottom: 16px; }
.dup-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border: 2px solid var(--ink); background: var(--paper); box-shadow: var(--shadow-hard-sm);
  padding: 9px 12px; text-align: left; width: 100%; cursor: pointer;
}
.dup-row:hover { background: var(--canvas); }
.dup-row:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.dup-name { font-size: 14px; }
/* What it would cost them, said on the row rather than discovered after the
   choice — which runner to pick depends on it. */
.dup-why { font-size: 11px; color: var(--ink-soft); font-style: italic; text-align: right; }
.dup-row.out-of-reach { opacity: 1; border-color: var(--line); color: var(--ink-soft); box-shadow: none; cursor: not-allowed; }
@media (max-width: 767px) {
  /* The bar wraps on a phone, where "aligned right" would put it alone on a
     line of its own against the edge. */
  .week-block-bar > .week-bar-end { margin-left: -2px; }
}

@media (max-width: 760px) {
  /* The days are a single column on a phone, so the note is simply the first
     thing in that column rather than a column of its own. It sizes itself the
     way the narrow day cards do, and the head above it collapses — there are
     no weekday labels to line up with down here. */
  /* minmax(0, 1fr) here too, and this one matters more: it is the more
     specific selector, so on any week carrying a note it wins outright and a
     bare 1fr would have gone on overflowing after the rule above was fixed. */
  .page.narrow .day-grid:has(.week-note) { grid-template-columns: minmax(0, 1fr); }
  .page.narrow .week-note {
    height: auto; min-height: 60px; padding: 10px 12px;
  }
  .page.narrow .week-note-spacer { display: none; }
  .page.narrow .week-note-head { font-size: 15px; }
  .page.narrow .week-note-body {
    font-size: 13px; line-height: 1.45;
    -webkit-line-clamp: 4; line-clamp: 4;
    max-height: calc(13px * 1.45 * 4);
  }
}

/* ==================================================================== */
/* Phones — header, and the refinements to the runner's screen          */
/* ==================================================================== */

/* ---------- The bar ---------- */

/* One row that cannot wrap. The old header put a title, a version link and a
   button on one line; on a phone that became three lines and pushed the page
   down before anything useful appeared. The version has moved into the menu,
   and the button has become the avatar. */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px 12px;
}
/* Edge to edge, like every other line separating one section from the
   next. It was inset 16px to match the bar's own padding, which read as a
   rule belonging to the logo rather than as the boundary of the header. */
.navbar-rule { border-bottom: 3px solid var(--ink); margin: 0; }
.navbar-logo {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 21px; letter-spacing: -0.01em;
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.logo-mark { font-weight: 800; }
.logo-slash { font-weight: 800; }
.logo-coach {
  font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.navbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* Initials rather than the word "Account": established enough to be read as a
   menu, and it holds its width whatever the name. White on the palette purple
   is 6.6:1. The same button on every screen now, desktop and phone, coach and
   runner — it used to be this on a phone and the word "Account" on a desktop.

   Border and shadow because it is a button, and in this design that is what
   says so. A hard shadow offset from a circle reads as a second disc behind
   the first, which is the drawing. */
.avatar {
  position: relative;
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 50%; border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard-sm);
  background: var(--purple); color: #fff;
  font-size: 16px; font-weight: 700; letter-spacing: 0.02em;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
/* Open reads as pressed, the same as the chosen half of a switch. The outline
   this used before sat exactly where the shadow now is, and the two together
   were a muddle. */
.avatar.open { box-shadow: none; }

/* A coach with unread notes. Deliberately just a mark: the number is on the
   Notifications button inside the menu, where there is room to read it and
   something to do about it. It breaks the circle's edge so it reads as
   attached to the button rather than floating near it. */
.avatar-dot {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px; border-radius: 50%;
  /* The same orange as the count inside the menu. They are one piece of news
     seen from two distances, and a check fails the build if they drift. */
  background: var(--orange); border: 2px solid var(--ink);
}

/* ---------- The menu ---------- */

/* A block under the bar rather than a card floating beside it, carrying the
   same hard shadow as everything else that sits above the page. */
.nav-backdrop { position: fixed; inset: 0; z-index: 68; background: transparent; }
.nav-drop {
  position: relative; z-index: 69;
  margin: 0 16px;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-hard);
}
.nav-item {
  display: block; width: 100%;
  border: none; border-bottom: 3px solid var(--ink);
  background: var(--paper); color: var(--ink);
  font-size: 20px; font-weight: 400; text-align: center;
  padding: 14px 16px;
  cursor: pointer;
}
.nav-item:last-of-type { border-bottom: none; }
.nav-item:active { background: var(--canvas); }
.nav-item[disabled] { color: var(--line); cursor: default; }
/* The version sits at the head of the menu, still behaving as a link. */
.nav-item.version {
  font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
}
.nav-drop .storage-note {
  border-top: 3px solid var(--ink);
  padding: 10px 16px; font-size: 12px; color: var(--ink-soft); text-align: center;
}

@media (max-width: 760px) {
  /* ---------- Section bands ---------- */

  /* The hatch ran to a fixed 130px, which left it stopping in the middle of
     the screen. It fills whatever is left of the row instead. */
  .page.narrow .section-hatch,
  .page.narrow .section-hatch.short {
    flex: 1 1 auto; width: auto; min-width: 24px;
  }
  .page.narrow .section-heading { font-size: 25px; padding: 5px 16px 7px; }
  .page.narrow .section-band { margin-bottom: 16px; }
  .page.narrow .section-band.tight { margin-top: 34px; }

  /* ---------- Today ---------- */

  .today-head { align-items: center; }
  .today-label { font-size: 30px; }
  .today-date { font-size: 15px; font-weight: 700; text-transform: uppercase; color: var(--ink); }

  /* ---------- The week ---------- */

  .carousel-week { font-size: 15px; font-weight: 800; }
  .carousel-dates { font-size: 14px; font-weight: 400; margin-top: 2px; }
  .carousel-title { padding: 8px; }

  /* The week's figure and date range are in the carousel title directly above,
     so the block's own head is the same information twice. */
  .page.narrow .week-block-bar { display: none; }

  /* ---------- Day cards ---------- */

  .page.narrow .day-head {
    font-size: 13px; font-weight: 400; text-transform: uppercase;
    margin-bottom: 5px;
  }
  .page.narrow .day-grid { gap: 14px; }
  .page.narrow .day-card { padding: 12px 14px 14px; min-height: 0; }
  /* Top right with its unit, matching the Today card, rather than centred on
     the right-hand edge. */
  .page.narrow .day-card-km {
    top: 12px; right: 12px; bottom: auto; transform: none;
    border: 2px solid var(--ink);
    border-right-width: 2px; border-bottom-width: 2px;
    font-size: 17px; font-weight: 800; padding: 3px 7px; min-width: 0;
  }
  .page.narrow .day-card-km small { font-size: 10px; font-weight: 700; margin-left: 1px; }
  /* The title reserves room for the badge; everything under it runs full width. */
  .page.narrow .day-card-title {
    font-size: 20px; font-weight: 800; padding-right: 74px;
    border-bottom-width: 2px; padding-bottom: 6px; margin-bottom: 8px;
    display: block;
  }
  .page.narrow .day-card-session { font-size: 14px; font-weight: 400; line-height: 1.45; margin-top: 0; }
}

/* The unit is a phone refinement; the desktop badge is a bare number in a much
   smaller box and has no room for it. */
@media (min-width: 761px) {
  .day-card-km small { display: none; }
}

/* ---------- Confirming an email address ---------- */

/* Its own screen rather than a modal: they have arrived from an inbox, quite
   possibly not signed in, and the only question is whether it worked. */
.confirm-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.confirm-card {
  width: 100%; max-width: 640px;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-hard);
  background: var(--paper);
  padding: 26px 28px 30px;
}
.confirm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.confirm-logo { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.confirm-hatch {
  flex: 1 1 auto; height: 11px; min-width: 24px;
  background-image: repeating-linear-gradient(-45deg, var(--ink) 0 2px, transparent 2px 8px);
  background-size: auto 11px; background-repeat: repeat-x; background-position: 0 50%;
}
/* The title sits in a box with the mint block behind it, as in the design. */
.confirm-title-wrap { display: flex; justify-content: center; margin-bottom: 34px; }
.confirm-title {
  position: relative; margin: 0;
  border: 3px solid var(--ink); background: var(--paper);
  padding: 10px 26px; font-size: 30px; font-weight: 800;
  box-shadow: 8px 8px 0 var(--turquoise);
}
.confirm-body { font-size: 17px; line-height: 1.55; margin: 0 0 18px; }
.confirm-body a { color: var(--ink); }
.confirm-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

@media (max-width: 760px) {
  .confirm-card { padding: 20px 18px 24px; border-width: 2px; }
  .confirm-logo { font-size: 19px; }
  .confirm-title { font-size: 23px; padding: 8px 18px; box-shadow: 6px 6px 0 var(--turquoise); }
  .confirm-title-wrap { margin-bottom: 26px; }
  .confirm-body { font-size: 16px; }
  .confirm-actions { flex-direction: column; }
  .confirm-actions .hard-btn { width: 100%; }
}

/* ---------- Preference switches ---------- */

/* A labelled pair rather than a toggle. A toggle makes you work out which way
   it is; a pair tells you. The chosen side is depressed — filled, and with no
   shadow, because it is pushed in — and the unchosen side keeps its shadow so
   the difference reads as depth rather than only as colour. */
.pref { margin-top: 16px; }
.pref-label { font-size: 15px; font-weight: 700; text-align: center; margin-bottom: 8px; }
/* Both sides stretch to the same height, so the only thing that ever breaks
   below the pair's bottom edge is the raised side's shadow.

   70% of the menu's width and centred, rather than filling it. The pair is a
   setting, not an action, and at full width it competed with the buttons
   above it for the same attention. Width only — the padding and the 16px type
   are untouched, so the box shrinks around type that stays readable rather
   than everything scaling down together.

   The phone is deliberately left alone further down. There the switch is the
   tap target, and 70% of it lands under the size a thumb reliably hits. */
/* The switch itself is now the button. It carries no chrome of its own — the
   two faces inside draw the box — so it has to give up everything a button
   is handed by default. */
.switch {
  display: flex; align-items: stretch;
  width: 70%; margin-left: auto; margin-right: auto;
  padding: 0; border: none; background: none;
  font: inherit; color: inherit; cursor: pointer;
}
.switch-opt {
  flex: 1;
  border: 2px solid var(--ink);
  background: var(--paper); color: var(--ink);
  /* No shadow on either half.
   *
   * The shadow was carrying the state: the raised side was the one you had
   * not chosen. That works, and it also made the control the loudest thing in
   * a panel of quiet buttons — two stacked pairs of it, on a menu you open to
   * read rather than to act. The fill and the single word say the state on
   * their own, so the depth is doing nothing the colour is not. */
  box-shadow: none;
  /* 7px rather than 10px: about 15% off the height of the control.
     19px of type, 4px of border and 14px of padding comes to 37px, where
     20px of padding made it 43. The switch is a setting you glance at, not
     the thing you came to the menu to do. */
  padding: 7px 8px; font-size: 16px;
  cursor: pointer;
  /* Stated, not inherited.
   *
   * When the two halves became spans inside one button, the button was given
   * `text-align: inherit` on the reasoning that a control should not impose
   * its own alignment. That was wrong: a <button> centres its text by
   * default, so inheriting picked up the panel's left alignment instead and
   * the word sat against the left edge of its half for a whole release. The
   * hatch looked centred only because it is a block with auto margins.
   *
   * The alignment belongs on the half, which is the box the word sits in. */
  text-align: center;
  /* Centred both ways, which text-align alone cannot do.
   *
   * The word is a line box and fills the height; the hatch is a 15px block
   * inside a 19px one, so it sat at the top with the extra 4px below it and
   * read as slightly high. `background-position: 50%` centres the stripes
   * inside the hatch's own box — it cannot centre that box inside this one. */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* The two halves must be the same box, and the only way to guarantee that
     is to refuse any margin an ancestor's button rule might hand them. One
     such rule gave the right half 10px on top and not the left, and stretch
     turned that into a visible difference in height. */
  margin: 0;
}
.switch-opt + .switch-opt { margin-left: -2px; }

/* The unchosen side stays in front so its border is whole at the seam. The
   shadow it used to cast has gone, but the seam is still two 2px borders
   overlapping by one, and one of them has to win. */
.switch-opt:not(.on):not(.off) { z-index: 2; }

/* Tactile ridges, not hatching.
 *
 * The mark on the unchosen half is the moulded grip you used to find on a
 * physical switch — the ribbing that told your thumb where to push. It is
 * skeuomorphism on purpose, in an interface that already draws everything as
 * a hard-edged object with a shadow under it.
 *
 * Measured from Baz's asset rather than approximated: four bars, each 2px
 * wide with 2px between them, 14px across and 15px tall, centred in the half.
 * The first version of this guessed at 3px bars with 8px gaps, which read as
 * a texture rather than a grip — too sparse to be ridges and too regular to
 * be anything else.
 *
 * The measurements are absolute rather than proportional. Ridges are a
 * physical detail at a physical size; scaling them with the button would make
 * them a pattern, which is the thing they are not.
 *
 * Still deliberately NOT the 45° hatch the section bands use — that mark
 * means "this band continues", and two jobs should not share a texture. */
.switch-hatch {
  display: block; margin: 0 auto;
  width: 14px; height: 15px;
  background-image: repeating-linear-gradient(
    90deg, var(--ink) 0 2px, transparent 2px 4px);
  background-position: 0 50%;
  background-repeat: repeat-x;
}

/* On, and chosen: green, and behind at the seam. */
.switch-opt.on {
  background: var(--lime); font-weight: 700;
  z-index: 1;
}
/* Off, and chosen: the same treatment in orange, so the state is legible
   without relying on which side is filled. */
.switch-opt.off {
  background: var(--orange); font-weight: 700;
  z-index: 1;
}

/* Whichever side holds the keyboard comes above both, or the raised
   neighbour would cut the focus ring in half along the seam. */
.switch:focus-visible .switch-opt { z-index: 3; }

.switch:hover .switch-opt:not(.on):not(.off) { background: var(--canvas); }

/* Both palette colours carry black text well above 4.5:1 — the harness
   computes it rather than trusting this comment. */

.account-drop .pref-label { color: var(--ink); }

/* Not built yet.
 *
 * Grey throughout — border, words and shadow — so the button reads as a place
 * something will be rather than a thing that has stopped working. It keeps its
 * shape and its shadow so the row still looks like a row; only the ink
 * changes. Nothing wears this unless it genuinely does nothing: greying a
 * working control to tidy an interface hides a fault instead of fixing it. */
.hard-btn.not-yet,
.acct-item.not-yet {
  border-color: var(--ink-soft); color: var(--ink-soft);
  box-shadow: 4px 4px 0 var(--ink-soft);
  cursor: default;
}
.hard-btn.not-yet:active,
.acct-item.not-yet:active { transform: none; box-shadow: 4px 4px 0 var(--ink-soft); }

/* On a phone the switch is the tap target. Full width keeps each half around
   the size a thumb actually hits; at 70% they are under it, and this is the
   control that turns somebody's email on and off. */
@media (max-width: 760px) {
  .switch { width: 100%; }
}

.nav-drop .pref { padding: 0 16px 4px; }
.nav-drop .pref:first-of-type { border-top: 3px solid var(--ink); padding-top: 14px; }

/* ---------- Archived runners ---------- */

.arch-list { margin-top: 6px; max-height: 50vh; overflow-y: auto; }
.arch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.arch-row:last-child { border-bottom: none; }
.arch-name { font-size: 17px; }
.arch-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.arch-actions .hard-btn { padding: 7px 14px; font-size: 14px; }
.arch-note { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin-top: 14px; }

/* The confirmation replaces the list rather than stacking on top of it, so
   there is one thing on screen to read and one decision to make. */
.arch-confirm { padding: 6px 0 2px; }
.arch-confirm-q { font-size: 24px; font-weight: 800; margin: 0 0 12px; }
.arch-confirm-body { font-size: 17px; line-height: 1.5; margin: 0 0 22px; }
.arch-confirm-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.arch-confirm-actions .hard-btn { flex: 1 1 auto; }

/* ---------- Undo ---------- */

/* Sits above the week it applies to, saying what it will reverse. An Undo
   button that does not name its action is one nobody dares press.

   The bar is an announcement and carries no shadow: in this design a shadow
   means pressable, and spending it on a strip of text makes the one thing on
   it you can actually press mean less. Only Undo has one. */
.undo-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 2px solid var(--ink); background: var(--yellow);
  box-shadow: none;
  padding: 8px 10px 8px 14px; margin-bottom: 12px;
}
.undo-what { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.undo-bar .hard-btn {
  padding: 6px 16px; font-size: 14px; flex: 0 0 auto;
  box-shadow: var(--shadow-hard-sm);
}

/* A switch that says "on" while nothing can be delivered is a lie the reader
   has no way of catching. This is the correction, sitting under the pair it
   corrects rather than replacing them — the preference is real and kept, it
   simply cannot be acted on yet. */
.unverified-note {
  border: 2px solid var(--ink); background: var(--yellow); color: var(--ink);
  padding: 9px 11px; margin-top: 10px; font-size: 13px; line-height: 1.45;
}
.unverified-note .link-btn { display: block; margin-top: 6px; }

/* chevron:begin */
/* Built by dev/build-icons.py. Do not edit by hand.

   Every <select> on the site wears Baz's chevron instead of the one
   the operating system draws, which is a different shape on every
   machine and cannot be made to match anything else here. */
select, .status-select, .session-edit-form select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 10'%3E%3Cpolyline points='2 2.5 8.5 7.5 15 2.5' style='fill: none; stroke: %23000; stroke-miterlimit: 10; stroke-width: 2px;'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 11px 7px;
  padding-right: 30px;
}
/* The narrow ones — inside a combo, inside a session form — keep the
   mark but pull it in tight, because there is no room to spare. */
.field-combo select, .session-edit-form select {
  background-position: right 5px center; background-size: 9px 6px; padding-right: 18px;
}
select[disabled] { opacity: 0.5; }
/* chevron:end */

/* ==================================================================== */
/* v0.44.0 — the coach's board on a phone                               */
/* ==================================================================== */

/* The coach's events, as a list.
 *
 * New in 0.44.0 and not a phone-only thing: a coach could only ever reach an
 * event by finding its day on the calendar, which works while five months
 * are on screen and does not while two are. The list is the same information
 * arranged so it can be read rather than hunted for, and every row opens the
 * same event card a calendar day opens.
 *
 * Desktop gets it too. Having built it, hiding it above 760px would mean one
 * of the two screens going on without a thing the other one has. */
.board-events { margin-top: 28px; }
.coach-events { display: flex; flex-direction: column; gap: 8px; }
/* Opened, the list scrolls within itself rather than running down the page.
 *
 * A height in vh rather than a count of rows: the panel sits beside a board
 * whose height is the number of runners, and the useful question is how
 * much screen there is, not how many events there happen to be. The floor
 * keeps it taller than the four it replaced on a short window. */
.coach-events.open {
  max-height: max(260px, 42vh);
  overflow-y: auto;
  /* Room for the scrollbar so it does not sit on the event blocks' own
     hard shadows, which are drawn outside their boxes. */
  padding-right: 6px;
}
.events-more {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 10px;
}
.coach-event {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline; gap: 12px;
  width: 100%; text-align: left;
  border: 2px solid var(--ink); background: var(--paper);
  box-shadow: var(--shadow-hard-sm);
  padding: 10px 12px;
}
.coach-event:hover { background: var(--canvas); }
.coach-event:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
/* Tabular figures so a column of dates lines up down the list. */
.coach-event-when {
  font-size: 13px; font-weight: 700; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.coach-event-name {
  font-size: 15px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.coach-event-who { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
/* The same two colours the calendar uses for the same two states, so the
   list and the months agree without a key between them. */
.coach-event.is-goal { background: var(--goal); }
.coach-event.is-proposed { background: var(--requested); }

/* The calendar's bar, and the button that comes back to this week, are both
   phone furniture. A desktop shows the whole calendar and scrolls fifteen
   weeks at once, so neither has anything to do there. Written into the
   markup unconditionally and hidden here, because both are toggled by a
   class rather than by a re-render and an element that is sometimes absent
   cannot be toggled. */
.calendar-bar { display: none; }
.board-current { display: none; }
.board-current.shown { display: inline-flex; }
/* The one red control on the board. It appears only when the current week
   has been paged off the screen, which is exactly when it is worth the
   loudest colour in the palette. */
.board-current {
  background: var(--red); color: #fff; border-color: var(--ink);
  font-weight: 700; letter-spacing: 0.04em;
}
.board-current:hover { background: var(--burnt); color: #fff; }

/* The month heading is a control on a phone and a heading everywhere else.
   Written as a button in the markup either way — one piece of HTML, and the
   affordance comes and goes with the screen. */
.month-name {
  border: none; background: none; color: inherit; font: inherit;
  letter-spacing: inherit; width: 100%; padding: 0; cursor: default;
}

@media (max-width: 760px) {
  /* 15px of air at both edges, and one number for all of it.
   *
   * Every band, notice, heading and event block reads this, and the two
   * things that bleed past it — the calendar and the Runners Roll — do so
   * by negating the same variable. Nothing on this page states its own
   * distance from the edge of the screen. */
  .page.board { --page-pad-x: 15px; padding: 14px var(--page-pad-x) 40px; }

  /* The rhythm of the roll, stated once.
   *
   * Everything else about the grid is derived from these two: a row is a
   * block plus a gap, the header is a block plus a gap, and the gap is the
   * distance between any two blocks and between a block and a seam. The
   * two tables keep step because they read the same pair of numbers, not
   * because three heights were typed out to agree. */
  .page.board {
    --rg-block-h: 40px;
    --rg-gap: 12px;
    --rg-row-h: calc(var(--rg-block-h) + var(--rg-gap));
    --rg-datehead-h: calc(var(--rg-block-h) + var(--rg-gap));
    /* The collapsed calendar's two parts, named so the sticky date row can
       add them up rather than being told the answer. Pinning the bar's
       height is the whole reason the date row can know where to stop
       without measuring anything on every frame. */
    --cal-bar-h: 34px;
    --cal-pad-b: 6px;
    --rg-sticky-top: calc(var(--cal-bar-h) + var(--cal-pad-b));
  }

  /* A heading band may never be wider than the screen.
   *
   * The Archived button sat at the end of one of these and was wider than
   * the room left beside the heading, so the band ran off the right-hand
   * edge — and because nothing was clipping it, the whole PAGE became
   * scrollable sideways. Scrolling the weeks then slid the runner names
   * out of view with everything else, which looked like the sticky names
   * failing rather than the page moving underneath them.
   *
   * That button has gone, but the next control added to a band would do
   * it again. Wrapping is the fix that does not need overflow hidden
   * anywhere near the sticky calendar, where it would break the sticking. */
  .page.board .section-band { flex-wrap: wrap; }
  .page.board .band-tail { flex-wrap: wrap; min-width: 0; }
  .page.board .band-tail .hard-btn { max-width: 100%; }

  /* Two months across, which is what fits with days big enough to hit.
   *
   * A percentage of the scroller, NOT a sum against 100vw. The viewport
   * arithmetic has to know this page's padding and the gap between the
   * months, and it was still wrong: 100vw counts the width a vertical
   * scrollbar occupies, so wherever the browser draws a classic one the
   * second month ran off the right-hand edge by about fifteen pixels.
   * Half the scroller, less half the gap, needs none of that. */
  .page.board .season { grid-auto-columns: calc(50% - 5px); }
  .page.board .season-scroll { scroll-behavior: smooth; scroll-snap-type: x mandatory; }
  .page.board .month { scroll-snap-align: start; }

  /* A day is a target now, not a dot. 8px type in a 1px-padded box came to
     about 14px of tappable height; this is 30, which is still under the 44
     Apple asks for and as much as seven columns of a phone will give. The
     type grows with it or the number is lost inside the box. */
  .page.board .month-day {
    font-size: 13px; padding: 0; min-height: 30px;
    display: flex; align-items: center; justify-content: center;
  }
  .page.board .month-dow { font-size: 10px; padding-bottom: 4px; }
  .page.board .month-name { font-size: 12px; cursor: pointer; margin-bottom: 6px; }
  .page.board .month-grid { gap: 2px; }

  /* One month on its own: the days get the whole width. */
  .page.board.month-open .season { grid-auto-columns: 100%; }
  .page.board.month-open .month-day { min-height: 42px; font-size: 16px; }
  .page.board.month-open .month-dow { font-size: 12px; }
  .page.board.month-open .month-name { font-size: 15px; cursor: default; }
  .month-open-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 10px;
  }
  .month-open-name { font-size: 15px; font-weight: 800; }

  /* The calendar stays put while the lists below it move.
   *
   * Sticky on the PAGE, not inside a scrolling box of its own. Nesting a
   * scroller inside a scroller is the arrangement iOS handles worst, and
   * the two lists underneath are long enough that it would be noticed.
   * Everything below simply flows past it. */
  /* Full width, so nothing passes it at the sides.
   *
   * It was sticky but inside the page's padding, which left twelve pixels
   * of bare page either side of it — and the Runners Roll, which bleeds
   * to both edges, slid up through those two gaps as the page scrolled.
   * The calendar now bleeds the same amount and pads itself back in, so
   * the opaque band is the full width of the screen. */
  .page.board .board-calendar {
    position: sticky; top: 0; z-index: 4;
    background: var(--paper);
    margin-left: calc(-1 * var(--page-pad-x));
    margin-right: calc(-1 * var(--page-pad-x));
    padding: 0 var(--page-pad-x) var(--cal-pad-b);
    margin-bottom: 0;
    /* The line under the calendar runs the full width of the screen, like
       every other line separating one section from the next. It can,
       because the band it belongs to already bleeds past the page's
       padding in order to be opaque from edge to edge. */
    border-bottom: 2px solid var(--ink);
  }
  /* Nothing between that line and the roll.
   *
   * There were two gaps and two lines: the calendar's own bottom margin,
   * the board-split's top margin, and then the roll's top border drawing
   * a second rule a few pixels below the first. Collapsed, that read as
   * an empty white band of its own rather than as the calendar sitting
   * on the roll. One line now, the calendar's, and the roll starts
   * immediately under it. */
  .page.board .board-split { margin-top: 0; }
  .page.board .runners-roll { border-top: none; }

  /* ---------- The calendar's bar ---------- */

  /* Pinned height, not padded to fit its type.
   *
   * The sticky date row below has to know where the collapsed calendar
   * ends, and the choice is between measuring that on every scroll frame
   * or declaring it once. Declared: --cal-bar-h is read both here and by
   * --rg-sticky-top, so the bar cannot change height without the row that
   * sits beneath it following. */
  .page.board .calendar-bar {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: var(--cal-bar-h);
    border: none; background: none; color: var(--ink);
    font-size: 15px; font-weight: 700; letter-spacing: 0.08em;
    padding: 0;
  }
  .page.board .calendar-bar .ic { font-size: 18px; }
  .page.board.cal-shut .calendar-body { display: none; }

  /* Three weeks across, current week first.
   *
   * ONE number, not six. The width of a week column is the viewport less
   * everything to the left of the scroller, and that used to be written
   * out as a chain of literals — page padding, gutter, names pane, its
   * padding, its border — which missed the scroller's own 16px margin and
   * pushed the third column off the screen. Those parts are now set from
   * --rg-names-w and --rg-gutter here, and the column subtracts the same
   * variables, so the two cannot disagree.
   *
   * The 14px covers the names pane's right padding, its border and the
   * 4px its buttons' shadows need; the 8px is the scroller's margin. */
  /* 12px of air either side of the names, not 6.
   *
   * The right-hand gap is this gutter plus the four pixels a hard shadow
   * occupies outside its box, so at 6 the visible gap was two pixels and
   * the border looked stuck to the buttons. The panel's own left padding
   * is moved to match, below, so the two sides stay equal — which is the
   * thing the desktop check holds and the thing that drifts if only one
   * of them is touched. The pane is six pixels wider to pay for it. */
  .page.board .runners-frame { --rg-gutter: var(--rg-gap); --rg-names-w: 128px; }
  .page.board .runners-names {
    flex: 0 0 auto;
    width: var(--rg-names-w); min-width: var(--rg-names-w); max-width: var(--rg-names-w);
  }
  /* The floor on the button has to go too, or the cell refuses to narrow
     and the pane's border is drawn through the names rather than beside
     them — the same fault the desktop pane was widened to fix. */
  .page.board .runners-names .rg-name { min-width: 0; }
  /* Room inside the pane for the shadow the buttons cast.
   *
   * A hard shadow is drawn outside the box and takes no layout space, so at
   * this width the 4px landed on — and past — the pane's right border, and
   * the rule down the side of the names was crossed by four little black
   * tails. The padding is the shadow's own width plus the gutter. */
  /* The line down the right of the names, with the buttons clear of it.
   *
   * The pane's border IS that line. Everything to its left belongs to the
   * names; everything to its right scrolls. The padding has to cover the
   * four pixels a hard shadow occupies outside its box as well as the
   * gutter, or the shadows are drawn across the line — which is what they
   * were doing, and why the two areas did not read as separate.
   *
   * Written off the same variables the desktop rule uses rather than as
   * its own number, so the two cannot drift apart. */
  /* The pane's own border IS the vertical seam. The padding that holds the
   * buttons clear of it has moved onto the CELLS rather than the pane,
   * which matters more than it sounds: it means the header cell reaches
   * the seam, so the horizontal seam it draws reaches it too. With the
   * padding on the pane there was a sixteen-pixel hole in the line where
   * the two should have met. */
  .page.board .runners-names {
    position: relative;
    padding-right: 0;
    border-right: 2px solid var(--ink);
  }
  /* The names table may not be wider than the pane holding it.
   *
   * Without this it was, by about sixty pixels, and the overflow was drawn
   * straight over the first week column — which is what "the runner names
   * overlap the week blocks" was. A table laid out automatically cannot be
   * squeezed below the width of its own content, so "Stuart Douthwaite"
   * set the width of the column and the pane's 128px did nothing but clip
   * the box, not the table inside it. min-width: 0 on the button does not
   * help: the table is sized before the button gets a say.
   *
   * Fixed layout is the only thing that actually settles it. The column
   * becomes exactly the pane's content width, and the button's existing
   * ellipsis does the truncating — which is what it was there for.
   *
   * The weeks' table has been fixed since the paging landed, for the same
   * reason in a different costume: both halves of the pane have to be a
   * width we chose rather than a width their contents chose. */
  .page.board .runners-names .runners-grid { table-layout: fixed; width: 100%; }

  /* ---------- The frozen pane ---------- */

  /* Four regions, each with its own permissions: the corner moves in
   * neither direction, the dates move sideways only, the names move
   * vertically only, the weeks move both ways.
   *
   * Vertical movement is the PAGE's own scroll, for all of it — the names
   * and the weeks simply flow past, and only the header row is held back.
   * Nothing here owns a vertical scroller of its own, which is deliberate:
   * a box with its own scrollbar would never let the page move, and the
   * calendar above collapses on page scroll.
   *
   * Sideways, the weeks are PAGED rather than scrolled. See applyWeekPage.
   * The reason the two can coexist is below. */
  .page.board .runners-scroll {
    margin-left: 0;
    /* The weeks' own plane, painted over the roll's.
     *
     * This was missing, and its absence is why the week blocks came out
     * the colour of the frozen pane: an unpublished block has no fill by
     * design, so whatever is behind the scroller shows straight through
     * it — and with no background here, that was the roll's ground. The
     * blocks were not the wrong colour; there was nothing under them. */
    background: var(--plane-weeks);
    /* The fallback, for a browser without overflow: clip. It scrolls, the
       date row is not sticky inside it, and the board still works. */
    overflow-x: auto;
    overflow-y: hidden;
  }
  /* The plane fills the pane's full height rather than only its table's,
     so it does not stop short wherever the two columns disagree. */
  .page.board .runners-layout { align-items: stretch; }

  /* clip, not hidden, and the distinction is the whole arrangement.
   *
   * overflow-x: hidden forces the other axis to compute to auto, which
   * makes the box a scroll container — and a sticky row inside a scroll
   * container sticks to THAT box rather than to the page, so the dates
   * would scroll away with the weeks they are meant to outlast. clip
   * creates no scroll container at all, so the nearest scrollport is
   * still the document and the dates stick where they should.
   *
   * It is also why the weeks are moved by a margin rather than a
   * transform: a transformed ancestor would take the sticky row's
   * containing block away from the page as surely as a scroller would. */
  @supports (overflow: clip) {
    .page.board .runners-scroll {
      overflow-x: clip;
      overflow-y: visible;
    }
  }

  /* Which way a finger may move what it lands on.
   *
   * pan-y over the names: they travel with the page and nothing else, so
   * a sideways drag there does nothing rather than half-turning the
   * board. pan-y over the weeks too, because the sideways half of that
   * gesture is ours — the browser must not try to scroll anything while
   * weekSwipeEnd decides whether a page has been turned.
   *
   * pinch-zoom is named explicitly in both. Leaving it out of a
   * touch-action list disables it, and taking pinch-to-zoom away from
   * somebody reading small type on a phone is not a trade this layout
   * is entitled to make. */
  .page.board .runners-names { touch-action: pan-y pinch-zoom; }
  .page.board .runners-scroll { touch-action: pan-y pinch-zoom; }

  /* Exactly three columns in view, by construction rather than by sum.
   *
   * The table is made --wk-cols thirds wide, so one column is a third of
   * the scroller whatever the scroller turns out to be. Nothing subtracts
   * the page padding, the names pane, its border, its shadow or the gap —
   * the chain of literals that pushed the third column off the screen in
   * 0.44.0 has no terms left in it.
   *
   * border-spacing goes to zero and the gap becomes cell padding, so the
   * table's width is exactly its columns and that third is exact. With
   * spacing it would have been (n+1) gaps plus n columns, and the paging
   * arithmetic would have drifted a little further with every page. */
  .page.board .runners-scroll .runners-grid {
    table-layout: fixed;
    width: calc(100% * var(--wk-cols) / 3);
    transition: margin-left .22s ease;
  }
  .page.board .runners-grid { border-spacing: 0; }

  /* Every cell's padding stated once, in full, per table and per section.
   *
   * Four complete declarations rather than a set of overlapping partial
   * ones. The first attempt had the horizontal padding in a shorthand and
   * the vertical gap in a separate rule underneath, and the shorthand —
   * being the more specific of the two — quietly reset the gap back to
   * zero. A shorthand that resets three sides it was not thinking about
   * is the oldest trap in a stylesheet, and the cure is to give every
   * cell one rule that says all four.
   *
   * The gap sits ABOVE each row rather than below it, so the first row of
   * weeks is held clear of the seam and the last row does not carry a gap
   * belonging to nothing. On the names, the right-hand padding is the gap
   * plus the four pixels a hard shadow occupies outside its box — without
   * that the shadows are drawn across the seam. */
  .page.board .runners-scroll .runners-grid thead th {
    padding: 0 0 var(--rg-gap) var(--rg-gap);
  }
  .page.board .runners-scroll .runners-grid tbody td {
    padding: var(--rg-gap) 0 0 var(--rg-gap);
  }
  .page.board .runners-names thead th {
    padding: 0 calc(var(--rg-gap) + var(--shadow-sm-px)) var(--rg-gap) 0;
  }
  .page.board .runners-names tbody td {
    padding: var(--rg-gap) calc(var(--rg-gap) + var(--shadow-sm-px)) 0 0;
  }

  .page.board .rg-cell { width: 100%; height: var(--rg-block-h); font-size: 14px; }
  /* The same height as a week block, which is what Baz asked for and what
     the pinned row rhythm needs anyway: two tables cannot stay in step if
     the blocks inside them are different sizes. */
  .page.board .rg-name { height: var(--rg-block-h); font-size: 14px; padding: 0 6px; }

  /* ---------- The two seams, and the shadows they cast ---------- */

  /* The header row is the only thing held back from the page's scroll.
   *
   * Its top is the collapsed calendar's height, which is declared rather
   * than measured — see --cal-bar-h. Opaque, because the weeks pass
   * underneath it, and each half takes the plane it belongs to: the dates
   * sit on the weeks' ground, the corner on the frozen one. */
  .page.board .runners-grid .rg-datehead-row th {
    position: sticky;
    top: var(--rg-sticky-top);
    z-index: 3;
  }
  .page.board .runners-scroll .rg-datehead {
    /* The FROZEN plane, the same as the corner beside it and the names
       below it. The dates belong to the furniture, not to the weeks they
       sit above — they travel sideways with the columns but they do not
       scroll away up the page, and the colour says which half of the
       pane they are part of. It is the one strip of frozen plane that
       moves, which is exactly why it needs to look frozen. */
    background: var(--plane-frozen);
    border-bottom: 2px solid var(--ink);
    /* The horizontal seam's shadow, for the part of it over the weeks.
       No sideways offset here: this stretch of seam is nowhere near the
       corner the offset exists to keep clear. */
    box-shadow: 0 var(--seam-px) 0 var(--seam-ink);
  }
  .page.board .rg-corner { background: var(--plane-frozen); }
  /* The corner draws its stretch of the seam with pseudo-elements rather
     than a border and a box-shadow, because this is the one place the
     shadow has to start somewhere other than where the line does. Both
     run 2px past the pane's own border so they meet the dates' half
     without a gap at the join. */
  .page.board .rg-corner::before {
    content: ''; position: absolute;
    left: 0; right: -2px; top: 100%;
    height: 2px; background: var(--ink);
  }
  .page.board .rg-corner::after {
    content: ''; position: absolute;
    left: var(--seam-px); right: -2px; top: calc(100% + 2px);
    height: var(--seam-px); background: var(--seam-ink);
  }

  /* The vertical seam's shadow.
   *
   * It begins one shadow's width BELOW the horizontal seam's shadow ends,
   * not at the top of the pane. The two bands would otherwise cross where
   * the seams do and lay 50% black over 50% black, which reads as a dark
   * square someone forgot about. Starting here leaves a clean notch at
   * the crossing and keeps both shadows falling away from it — the same
   * rule, applied to the one place the two could have met. */
  .page.board .runners-names::after {
    content: ''; position: absolute;
    left: calc(100% + 2px);
    top: calc(var(--rg-datehead-h) + 2px + var(--seam-px));
    bottom: 0;
    width: var(--seam-px);
    background: var(--seam-ink);
    pointer-events: none;
    z-index: 2;
  }

  /* The legend is a desktop luxury: five swatches and their words take four
     lines on a phone, above the thing they describe. */
  .page.board .board-legend { display: none; }

  /* Events: a column, the name taking what the date and the count leave. */
  .coach-event { gap: 8px; padding: 9px 10px; }
  .coach-event-when { font-size: 12px; }
  .coach-event-name { font-size: 14px; }
  .coach-event-who { font-size: 11px; }
}

/* ======================================================================
   RunningCalendar — races looked up by day, and the credit they carry
   ====================================================================== */

/* The list above the blank event form.
 *
 * Quiet on purpose: it is an offer, not the form. A coach who knows the
 * race they want ignores it and types; a coach looking at a Saturday gets
 * what is on, one tap from filled in. */
.rc-picks { margin: 4px 0 14px; }
.rc-pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left;
  border: 2px solid var(--ink); background: var(--paper);
  padding: 8px 10px; margin-bottom: 6px;
}
.rc-pick:hover { background: var(--canvas); }
.rc-pick-name { font-weight: 700; font-size: 15px; }
.rc-pick-meta { font-size: 12px; color: var(--ink-soft); }
/* Already on this coach's calendar. Tapping it opens that one, so it says
   so, rather than looking like an offer to make a second copy. */
.rc-pick.have { background: var(--line-soft); }
.rc-pick-have { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.rc-quiet { font-size: 13px; color: var(--ink-soft); padding: 4px 0 8px; }
.rc-or {
  font-size: 12px; color: var(--ink-soft); text-align: center;
  margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--line-soft);
}

/* A race picked from the list, with the way back to a blank form. */
.rc-picked {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  border: 2px solid var(--ink); background: var(--line-soft);
  padding: 8px 10px; margin: 4px 0 14px;
}
.rc-picked-name { flex: 1 1 auto; font-weight: 700; }
.rc-picked .rc-credit { flex-basis: 100%; }

/* The credit. §2 of the API terms: visible wherever the event is shown.
 *
 * Small, but never hidden — it is a condition of the key, and a credit set
 * in a colour nobody can read is a credit in name only. --ink-soft on
 * white clears 4.5:1. */
.rc-credit {
  display: inline-block;
  font-size: 12px; color: var(--ink-soft);
  margin-top: 6px;
}
a.rc-credit { text-decoration: underline; text-underline-offset: 2px; }
a.rc-credit:hover { color: var(--ink); }
/* Inside a row that is itself a button: text only, on its own line under
   the name, because a link inside a button is invalid markup. */
.rc-credit-inline {
  display: block;
  font-size: 11px; font-weight: 400; opacity: 0.75;
}
/* On a day card, the line under the race's name. */
.day-card-credit {
  display: block;
  font-size: 10px; line-height: 1.2; opacity: 0.75;
  margin-top: 2px;
}

/* Locked fields: shown so the coach can read them, plainly not editable. */
.event-field.locked, .field-input.locked {
  background: var(--line-soft); color: var(--ink-soft);
  cursor: not-allowed;
}

/* A race the nightly refresh has moved, or one RunningCalendar no longer
   lists. The second is struck through wherever it appears, because a race
   that may not happen should not read like one that will. */
.rc-changed, .rc-withdrawn {
  border: 2px solid var(--ink); padding: 8px 10px; margin: 8px 0;
  font-size: 13px;
}
.rc-changed { background: var(--yellow); }
.rc-withdrawn { background: var(--line-soft); }
.coach-event.is-withdrawn .coach-event-name { text-decoration: line-through; }
.signup-notice.rc-change { border-color: var(--ink); background: var(--yellow); }
.signup-notice.rc-change.withdrawn { background: var(--line-soft); }
.signup-notice.rc-change .signup-notice-text { flex: 1 1 auto; }
.signup-notice.rc-change .rc-credit { margin-left: 6px; margin-top: 0; }
