:root {
  color-scheme: light dark;

  /* Semantic accent tints — one source of truth so the nav's creational/destructive/attention
     colours (WP0) stay consistent. Kept as raw hues here; always *used* through color-mix so
     light/dark survives. */
  --accent-create: #1b7a3d;
  --accent-danger: #b00020;
  --accent-attention: #e0a400;

  /* Repeated structural mixes. currentColor inside a custom property resolves at the element that
     references it, so these behave exactly like the inline color-mix they replace. */
  --rule: color-mix(in srgb, currentColor 15%, transparent);   /* hairline dividers / borders */
  --hover: color-mix(in srgb, currentColor 6%, transparent);   /* row-hover wash */

  /* Page shell width (v3 UI). One consistent fluid width for the header AND every view, so the
     header is static and content follows it (no per-page 52rem↔76rem jump). Symmetric side margins
     scale with the viewport; a min-width floors it for the assumed ≥1280px business-laptop screen
     (below that the page scrolls). Tune here — these are the only three knobs. */
  --page-side-margin: 5%;
  --page-min-width: 1280px;
}

/* Central focus ring — previously absent. Matters for the nav-as-buttons, the <details> fold-out,
   and row-clickable tables (WP1+). currentColor keeps it theme-adaptive. */
:focus-visible {
  outline: 2px solid color-mix(in srgb, currentColor 55%, transparent);
  outline-offset: 2px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  box-sizing: border-box;
  width: 100%;
  min-width: var(--page-min-width);
  margin: 1.5rem 0;
  padding: 0 var(--page-side-margin);
}

/* The old per-page .wide toggle (52rem↔76rem) is what made the header jump between pages. Every page
   now shares the one fluid width above, so .wide is vestigial — kept as a harmless no-op so the flag
   plumbing (and its test) needn't be torn out in this touch-up. */

h1 { font-size: 1.6rem; }

/* --- Two-tier navigation shell (v3 UI refactor WP1) ----------------------------------------
   Tier 1: brand + section buckets (left) | flex spacer | ＋Register round + a fixed-width identity
   slot (right), so ＋Register round is pinned regardless of name length or the admin badge.
   Tier 2: the active bucket's views (left) + its actions (right). */
.topbar { border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent); margin-bottom: 1.5rem; }
.tier1 { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; }
.tier1 .brand { font-weight: 600; text-decoration: none; color: inherit; padding: 0.3rem 0.45rem; border-radius: 4px; white-space: nowrap; }
.tier1 .brand.active { background: var(--hover); }
.tier1 .spacer { flex: 1 1 auto; }

/* Section buckets: flat square view-buttons; active = filled bg + weight. */
.buckets { display: flex; align-items: center; gap: 0.25rem; }
.bucket { text-decoration: none; color: inherit; padding: 0.35rem 0.7rem; border-radius: 4px; white-space: nowrap; }
.bucket:hover { background: var(--hover); }
.bucket.active { background: color-mix(in srgb, currentColor 12%, transparent); font-weight: 600; }

/* Identity slot: the acting player + ⋯ fold-out, right-aligned. Fixed width keeps a long name from
   pushing the bar around (it truncates instead). ＋Register round is now a tier-2 action, not a
   tier-1 pill, so there's no CTA to pin here anymore. */
.identity-slot { width: 12rem; flex: 0 0 12rem; display: flex; justify-content: flex-end; }
details.menu { position: relative; }
details.menu > summary {
  list-style: none; cursor: pointer; max-width: 100%;
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.55rem; border-radius: 4px;
}
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::marker { content: ""; }
details.menu > summary:hover { background: var(--hover); }
details.menu .who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.menu .admin-badge {
  flex: none; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 0.05rem 0.3rem; border-radius: 3px;
  color: color-mix(in srgb, currentColor 70%, crimson);
  border: 1px solid color-mix(in srgb, currentColor 35%, crimson);
}
details.menu .caret { flex: none; opacity: 0.55; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 30; min-width: 12rem;
  display: flex; flex-direction: column; gap: 0.1rem; padding: 0.3rem;
  background: Canvas; color: CanvasText;
  border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.menu-panel a, .menu-panel button {
  text-align: left; text-decoration: none; color: inherit; font: inherit;
  padding: 0.4rem 0.6rem; border-radius: 4px;
  background: none; border: none; cursor: pointer; width: 100%;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--hover); }
.menu-name { padding: 0.35rem 0.6rem; font-weight: 600; opacity: 0.65; cursor: default; }
.menu-panel hr { border: none; border-top: 1px solid var(--rule); margin: 0.25rem 0; width: 100%; }
.menu-panel form { margin: 0; }

/* Tier 2: bucket views (left, active = 3px bottom rule) + actions (right). A constant min-height so
   the header doesn't jump when a bucket has no actions. */
.subbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; min-height: 2.3rem; background: color-mix(in srgb, currentColor 4%, transparent); padding-top: 0.25rem; }
.subviews { display: flex; align-items: flex-end; gap: 0.1rem; }
.subview { text-decoration: none; color: inherit; padding: 0.4rem 0.7rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subview:hover { background: var(--hover); }
.subview.active { border-bottom-color: currentColor; font-weight: 600; }
.subactions { display: flex; align-items: center; gap: 0.5rem; padding-bottom: 0.3rem; }

/* Tier-2 action buttons: rounded; creational green/blue tint, destructive red, neutral plain. */
.action { text-decoration: none; color: inherit; white-space: nowrap; font-size: 0.9rem; padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--rule); }
.action:hover { background: var(--hover); }
.action.create { border-color: color-mix(in srgb, var(--accent-create) 40%, transparent); background: color-mix(in srgb, var(--accent-create) 12%, transparent); }
.action.create:hover { background: color-mix(in srgb, var(--accent-create) 22%, transparent); }
.action.destructive { color: var(--accent-danger); border-color: color-mix(in srgb, var(--accent-danger) 40%, transparent); background: color-mix(in srgb, var(--accent-danger) 10%, transparent); }

.inline { display: inline; margin: 0; }

/* Login form: stacked labels with the field on its own line. */
form.login { display: flex; flex-direction: column; gap: 0.75rem; max-width: 20rem; }
form.login label { display: flex; flex-direction: column; gap: 0.25rem; }
form.login input { padding: 0.4rem; font: inherit; }
form.login button { align-self: start; }

.error {
  color: var(--accent-danger);
  background: color-mix(in srgb, var(--accent-danger) 12%, transparent);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}
.saved {
  color: var(--accent-create);
  background: color-mix(in srgb, var(--accent-create) 14%, transparent);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

/* Settings form: stacked fields with a helper line under each control. */
form.settings { display: flex; flex-direction: column; gap: 1.25rem; max-width: 26rem; margin-top: 1.25rem; }
form.settings label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
form.settings input, form.settings select { padding: 0.4rem; font: inherit; font-weight: 400; }
form.settings small { font-weight: 400; opacity: 0.7; }
form.settings button { align-self: start; padding: 0.5rem 1.25rem; font: inherit; }
form.settings textarea { padding: 0.4rem; font: inherit; font-weight: 400; resize: vertical; }
label.paste-label { display: block; margin: 0.75rem 0; }
textarea.paste-box { display: block; width: 100%; box-sizing: border-box; margin-top: 0.3rem; padding: 0.5rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; line-height: 1.4; resize: vertical; }
form.settings fieldset.home-courses { display: flex; flex-direction: column; gap: 0.3rem; border: 1px solid color-mix(in srgb, currentColor 20%, transparent); border-radius: 4px; padding: 0.6rem 0.8rem; }
form.settings fieldset.home-courses legend { font-weight: 600; padding: 0 0.3rem; }
form.settings label.check { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 400; }
form.settings label.check input { width: auto; }

/* Profile card (self-view). */
.profile-card { max-width: 34rem; margin-top: 1.25rem; }
.profile-desc { margin: 1rem 0; line-height: 1.5; }
.profile-section { margin: 1.25rem 0; }
.profile-section h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; margin-bottom: 0.4rem; }
.profile-courses { margin: 0; padding-left: 1.1rem; }
.profile-links { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1.5rem; }


/* Reusable stat strip: a hairline-divided cell grid, each cell a value above a small-caps monospace
   label. Shared by home's pooled summary, the Overview strip (WP3, 7 cells) and the Putting strip
   (WP4, 5 cells). Cells size evenly to however many there are; a narrow viewport scrolls rather than
   crushing the cells. */
.statstrip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--rule);
  border-radius: 6px;
  margin: 1rem 0 1.5rem;
  overflow-x: auto;
}
.statstrip .cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.85rem;
  border-left: 1px solid var(--rule);
}
.statstrip .cell:first-child { border-left: none; }
.statstrip .cell b { font-size: 1.4rem; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.statstrip .cell span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
  white-space: nowrap;
}

/* Pill for a small tokenised value: a putting distance (WP4), a session's clubs (WP5). */
.chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1.4;
  background: var(--hover);
  border: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- Scorecard · Overview (v3 WP3) --------------------------------------------------------- */
.range-caption { margin: -0.25rem 0 1rem; opacity: 0.6; font-size: 0.9rem; }

/* Two columns: recent rounds (fluid) + the where-to-improve rail (fixed 300px), top-aligned. */
.overview-cols { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.overview-cols h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }

.recent-rounds .row-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
/* Neutral rounded action buttons. */
.btn {
  display: inline-block; text-decoration: none; color: inherit; white-space: nowrap;
  padding: 0.35rem 0.85rem; border: 1px solid var(--rule); border-radius: 999px; font-size: 0.9rem;
}
.btn:hover { background: var(--hover); }
/* The far-right per-row action column (rows now have >1 action: open + edit). */
table.rounds th:last-child, table.rounds td.act { text-align: right; width: 1%; }
table.rounds td.act a { text-decoration: none; opacity: 0.5; }
table.rounds td.act a:hover { opacity: 1; }

/* --- Practice · Putting (v3 WP4): sessions + make-rate-by-band ----------------------------- */
.putting-cols { display: grid; grid-template-columns: 1fr 330px; gap: 24px; align-items: start; }
.putting-cols h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.muted { opacity: 0.6; }
.delta.up { color: var(--accent-create); }
.delta.down { color: var(--accent-danger); }
table.rounds td .chip { margin-right: 0.15rem; }

/* Horizontal make-rate bars, one per distance band; value at the right. */
.bands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.band { display: grid; grid-template-columns: 3.6rem 1fr 2.8rem; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.band-label { opacity: 0.75; font-variant-numeric: tabular-nums; }
.bar-track { height: 0.9rem; background: var(--hover); border-radius: 3px; overflow: hidden; }
.bar { display: block; height: 100%; background: color-mix(in srgb, currentColor 55%, transparent); }
.band-val { text-align: right; font-variant-numeric: tabular-nums; opacity: 0.8; }
/* The weakest sufficiently-sampled band is the "where to improve" signal — amber. */
.band.weakest .bar { background: color-mix(in srgb, var(--accent-attention) 78%, transparent); }
.band.weakest .band-label { color: color-mix(in srgb, currentColor 55%, var(--accent-attention)); font-weight: 600; }
/* Thin band (n < 5): a hatched amber fill in place of a plotted rate. */
.bar.thin {
  width: 100%;
  background: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--accent-attention) 32%, transparent) 0 4px,
    transparent 4px 8px);
}
.band.thin .band-val { opacity: 0.6; }

/* --- Practice · Trackman coverage (v3 WP5): grouped coverage + distance ladder ------------- */
/* Single column: club coverage (the bag contents) full-width, then Sessions + ladder + tools below
   it. The session list's club chips need the full width — in the old 1fr/360px split they blew the
   360px track out horizontally. A little vertical scroll is the accepted trade (owner's call). */
.trackman-cols { display: block; }
.trackman-cols > .coverage { margin-bottom: 2rem; }
.trackman-cols .trackman-side { max-width: 52rem; }
.trackman-side table.rounds td .chip { display: inline-block; margin-bottom: 0.15rem; }
.trackman-cols h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
/* Bag picker (Trackman + On Course): a tidy inline neutral control, not a bare <select> + a raw grey
   button. menu.js auto-submits on change and hides the Show button; without JS the button stays and
   submits normally. */
.pick.bag-pick { align-items: center; gap: 0.55rem; margin: 0.75rem 0 1.5rem; }
.pick.bag-pick label { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 0.9rem; opacity: 0.75; }
.bag-pick select {
  font: inherit; padding: 0.32rem 0.7rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: transparent; color: inherit;
}
.bag-pick select:hover { background: var(--hover); }
.bag-pick .bag-show {
  font: inherit; padding: 0.3rem 0.8rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: transparent; color: inherit;
}
.bag-pick .bag-show:hover { background: var(--hover); }
.bag-pick .units-toggle {
  text-decoration: none; color: inherit; font-size: 0.8rem; opacity: 0.7;
  padding: 0.26rem 0.65rem; border-radius: 999px; border: 1px solid var(--rule);
}
.bag-pick .units-toggle:hover { background: var(--hover); opacity: 1; }
.units-toggle { font-size: 0.85rem; text-decoration: none; opacity: 0.7; align-self: center; }

/* §6 group-header rows + counts. */
table.coverage-table tr.group-head th {
  text-align: left; padding: 0.6rem 0.6rem 0.25rem; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.04em; opacity: 0.7; border-bottom: 1px solid var(--rule);
}
table.coverage-table tr.group-head .group-count { opacity: 0.6; font-weight: 400; }
/* A club with no Trackman data — the whole row amber; the gap that is the call to action. */
table.coverage-table tr.nodata { background: color-mix(in srgb, var(--accent-attention) 12%, transparent); }
table.coverage-table tr.nodata td { color: color-mix(in srgb, currentColor 62%, transparent); }

/* Distance ladder: each club's carry range stacked on a shared scale, avg marked. */
.ladder-head { margin-top: 1.5rem; }
.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ladder-row { display: grid; grid-template-columns: 4.5rem 1fr 3rem; align-items: center; gap: 0.5rem; font-size: 0.82rem; }
.ladder-name { opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ladder-track { position: relative; height: 0.8rem; background: var(--hover); border-radius: 3px; }
.ladder-bar { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, currentColor 45%, transparent); border-radius: 3px; }
.ladder-avg { position: absolute; top: -1px; bottom: -1px; width: 2px; background: color-mix(in srgb, currentColor 85%, transparent); }
.ladder-val { text-align: right; font-variant-numeric: tabular-nums; opacity: 0.8; }

.session-tools { margin-top: 1.5rem; }
.session-tools summary { cursor: pointer; opacity: 0.75; font-size: 0.9rem; }

/* Where-to-improve rail: a bordered panel, max two ranked findings, no charts. */
.rail { border: 1px solid var(--rule); border-radius: 8px; padding: 0.9rem 1rem; }
.rail-caption { margin: -0.35rem 0 0.75rem; opacity: 0.55; font-size: 0.8rem; }
.finding { padding: 0.7rem 0; border-top: 1px solid var(--rule); }
.finding:first-of-type { border-top: none; padding-top: 0.1rem; }
.finding-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.finding-claim { margin: 0.1rem 0; font-weight: 600; line-height: 1.3; }
.finding-evidence { margin: 0.15rem 0 0.45rem; font-size: 0.85rem; opacity: 0.7; line-height: 1.35; }
.finding .practise { text-decoration: none; font-size: 0.85rem; }
.rail .empty { font-size: 0.9rem; line-height: 1.4; }

.table-wrap { overflow-x: auto; }
table.rounds { border-collapse: collapse; width: 100%; }
table.rounds th, table.rounds td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.rounds th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; }
table.rounds .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { opacity: 0.8; }

/* Rows enhanced by rows.js: the whole row is clickable (the in-row link stays for keyboard users). */
tr.rowlink { cursor: pointer; }
tr.rowlink:hover { background: var(--hover); }

/* Round view: header meta, stats grid, per-hole table. */
.back { margin: 0 0 0.5rem; font-size: 0.9rem; }
.round-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.round-head h1 { margin: 0; }
/* Shared "✏️ Edit" affordance: the round view header and each bag's summary use the same treatment. */
.edit-round, .edit-link { font-size: 0.9rem; white-space: nowrap; }
.round-meta { margin: 0.25rem 0; opacity: 0.85; }
.edited { font-style: italic; }
/* Putts-lost-to-putting panel on the round view (putting-attribution.md). */
.putting-attr { margin: 1.75rem 0 0; }
.putting-attr h2 { font-size: 1.1rem; margin: 0 0 0.25rem; }
.comment { margin: 0.5rem 0; font-style: italic; }
.badge {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  vertical-align: middle; padding: 0.1rem 0.4rem; border-radius: 4px;
  background: var(--rule);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.75rem 1rem;
  margin: 1.25rem 0;
}
.stats .stat { display: flex; flex-direction: column; line-height: 1.2; }
.stats .stat b { font-size: 1.3rem; }
.stats .stat span { font-size: 0.8rem; opacity: 0.7; }

table.holes { border-collapse: collapse; width: 100%; }
/* The round card reads like a scorecard: cells are centered (a right-aligned hole number sat under
   "Par" and looked like a par value). Tabular figures keep the digits an even width. */
table.holes th, table.holes td {
  text-align: center;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.holes th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; }

/* Per-hole visual indicators (round view).
   Score shapes: a birdie is circled, an eagle-or-better double-circled, a bogey squared, a
   double-bogey-or-worse double-squared (par is plain) — the standard scorecard convention. The
   double ring uses two box-shadows with the page background colour (the `Canvas` system colour,
   which respects the light/dark scheme) as the gap between the inner border and the outer ring. */
.score { display: inline-block; min-width: 1.5em; padding: 0.05em 0.2em; text-align: center; line-height: 1.25; }
.score.birdie, .score.eagle,
.score.bogey, .score.double { border: 1.5px solid currentColor; }
.score.birdie, .score.eagle { border-radius: 999px; }
.score.bogey, .score.double { border-radius: 3px; }
.score.eagle, .score.double { box-shadow: 0 0 0 2px Canvas, 0 0 0 3.5px currentColor; }

/* Handicap "ball": net score vs par on the hole. Green = net par or better, amber = net bogey,
   red = net double or worse. Fixed hues (not currentColor) since the meaning is the colour; a thin
   inset edge keeps them legible on either theme. */
th.net, td.net { text-align: center; }
.ball {
  display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%;
  vertical-align: middle; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.ball.good { background: #2e9b4e; }
.ball.over { background: var(--accent-attention); }
.ball.bad  { background: #d23b3b; }

/* A picked-up (not-scored) hole: still shown so the card reads 1..N with no silent gap, but tinted
   amber and badged so a glance says "something's off here". The tint uses color-mix so it works on
   either theme; the score columns collapse into one "picked up" badge (there's nothing to score). */
table.holes tr.picked-up { background: color-mix(in srgb, var(--accent-attention) 15%, transparent); }
table.holes tr.picked-up td { color: color-mix(in srgb, currentColor 62%, transparent); }
.pickup-cell { text-align: center; }
.pickup-badge {
  display: inline-block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.05em 0.55em; border-radius: 999px;
  background: color-mix(in srgb, var(--accent-attention) 32%, transparent);
  color: color-mix(in srgb, currentColor 88%, transparent);
}
/* Header note explaining a shortened par/total when holes were picked up. */
.pickup-note {
  margin: 0.5rem 0; padding: 0.35rem 0.6rem; font-size: 0.85rem;
  border-left: 3px solid var(--accent-attention);
  background: color-mix(in srgb, var(--accent-attention) 10%, transparent);
  border-radius: 0 4px 4px 0;
}
.pickup-swatch {
  display: inline-block; width: 0.9em; height: 0.9em; border-radius: 3px;
  background: color-mix(in srgb, var(--accent-attention) 32%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-attention) 55%, transparent);
}

/* Legend under the per-hole table + the honest handicap-basis caption. */
.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem;
  margin: 0.75rem 0 0.25rem; font-size: 0.8rem; opacity: 0.85;
}
.legend .key { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend .score { min-width: 1.3em; font-size: 0.72rem; }
.legend .sep { width: 1px; align-self: stretch; background: color-mix(in srgb, currentColor 20%, transparent); }
.hcp-basis { font-size: 0.8rem; opacity: 0.7; }

/* Course index: each course is a card with its own tee/segment "print a blank card" form. */
.course-list { display: flex; flex-direction: column; gap: 1.25rem; margin: 1.25rem 0; }
.course-card {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.25rem;
}
.course-card h2 { font-size: 1.15rem; margin: 0 0 0.15rem; }
.course-card .round-meta { margin: 0 0 0.5rem; }
.course-card form.pick { margin: 0.5rem 0 0; }

/* New round: the course picker and the editable entry grid (M6). */
form.pick, .round-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin: 1rem 0 1.5rem;
}
form.pick label, .round-fields label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
form.pick select, form.pick button, form.pick input,
.round-fields input, .round-fields select { padding: 0.4rem; font: inherit; }
form.pick input[type="number"] { width: 5rem; }
.round-fields label.wide { flex: 1 1 12rem; }
.round-fields label.wide input { width: 100%; }

table.entry { border-collapse: collapse; width: 100%; }
table.entry th, table.entry td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  white-space: nowrap;
}
table.entry th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; }
table.entry .num { text-align: right; font-variant-numeric: tabular-nums; }
table.entry input { width: 2.8rem; padding: 0.25rem; font: inherit; text-align: right; }
table.entry input.hcomment { width: 14rem; text-align: left; }
table.entry select.fir, table.entry select.penalty-type { font: inherit; padding: 0.2rem; }
table.entry td.total, table.entry td.topar { opacity: 0.75; }
table.entry .na { opacity: 0.5; }

/* Implicit played bag on the round editor (my-bag WP1.5): the bag-switch mini form (a GET reload
   that re-seeds the checklist below) and the played-clubs checklist itself. */
form.bag-switch { margin: 0 0 1rem; }
.played-bag { margin: 0 0 1.5rem; }
.played-bag-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.played-bag-head h2 { font-size: 1.05rem; margin: 0; }
.club-checklist { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-top: 0.5rem; }
.club-check { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; }

.entry-summary { margin: 1rem 0 0.25rem; font-variant-numeric: tabular-nums; font-weight: 600; min-height: 1.4em; }
.hint { margin: 0.25rem 0 0; font-size: 0.85rem; opacity: 0.7; }
.grid-note { margin: 0.5rem 0 0; font-size: 0.85rem; opacity: 0.7; max-width: 48rem; line-height: 1.4; }
.entry-actions { margin: 1.5rem 0; }
.entry-actions button { padding: 0.5rem 1.25rem; font: inherit; }

/* Stats / trends page (M7 WP7.4): handicap headline, small-multiple SVG charts, snapshot table. */
.handicap { margin: 1rem 0 1.5rem; }
.handicap .stat { display: inline-flex; flex-direction: column; line-height: 1.1; }
.handicap .stat b { font-size: 2rem; font-variant-numeric: tabular-nums; }
.handicap .stat span { font-size: 0.8rem; opacity: 0.7; }
.handicap .round-meta { margin-top: 0.35rem; }

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem 1.5rem;
  margin: 1rem 0 2rem;
}
.chart { margin: 0; }
.chart figcaption {
  font-size: 0.85rem; font-weight: 600; margin-bottom: 0.25rem;
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem;
}
.chart figcaption .pooled { font-weight: 400; opacity: 0.65; font-variant-numeric: tabular-nums; }
.chart .empty { font-size: 0.8rem; opacity: 0.6; margin: 0.5rem 0; }
.chart .chart-desc { font-size: 0.75rem; font-weight: 400; opacity: 0.65; margin-top: 0.35rem; line-height: 1.35; display: block; }

/* SVG line chart. currentColor + opacity so it adapts to the light/dark theme. */
.spark { width: 100%; height: auto; display: block; overflow: visible; }
.spark .axis { stroke: currentColor; stroke-width: 1; opacity: 0.25; }
.spark .lbl { fill: currentColor; opacity: 0.55; font-size: 9px; }
.spark .roll { fill: none; stroke: currentColor; stroke-width: 2; opacity: 0.9; stroke-linejoin: round; stroke-linecap: round; }
.spark .val { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0.3; }
.spark .dot { fill: currentColor; opacity: 0.5; }
.spark .zero { stroke: currentColor; stroke-width: 1; opacity: 0.35; stroke-dasharray: 3 2; }
.spark.scatter .pt { fill: currentColor; opacity: 0.7; }

table.rounds tfoot .overall td, table.entry tfoot .overall td { font-weight: 600; border-top: 2px solid color-mix(in srgb, currentColor 30%, transparent); }

/* Garage + bags (my-bag WP1.5). Bag cards reuse the course-card look; the club table gets its own
   compact action buttons (assign/unassign/dispose, each a tiny inline POST form). */
.bags-section, .clubs-section { margin: 0 0 2.5rem; }
.bag-list { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0 1.5rem; }
.bag-card {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
  min-width: 12rem;
}
.bag-card h3 { font-size: 1.05rem; margin: 0 0 0.15rem; }
.bag-card .round-meta { margin: 0 0 0.4rem; }
.bag-card form { margin-top: 0.4rem; }
.full-badge { background: color-mix(in srgb, var(--accent-attention) 32%, transparent); }

/* Inventory grouped per bag: each bag is an expandable <details> section holding its own clubs
   (v2-enhancements.md → Inventory sorting), with the garage as a flat list underneath. */
.bag-details-list { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0 1.5rem; }
.bag-details {
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.bag-summary {
  cursor: pointer;
  padding: 0.7rem 1.1rem;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.bag-summary .bag-title { font-weight: 600; font-size: 1.05rem; }
.bag-summary .bag-count { margin-left: auto; opacity: 0.7; font-size: 0.85rem; }
.bag-body { padding: 0 1.1rem 0.9rem; }
.bag-actions { display: flex; align-items: center; gap: 0.8rem; margin: 0 0 0.6rem; }
.bag-actions form.inline { margin: 0; }

.clubs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }
.clubs-head h2 { margin: 0; }
.disposed-head { margin: 1.5rem 0 0; font-size: 1rem; opacity: 0.8; }
/* The "Add a club" heading is a scroll anchor (#add-club): a rejected add scrolls here so its error
   shows next to the form, not just as a top-of-page banner. scroll-margin keeps it clear of the top. */
.add-club-head { margin: 1.75rem 0 0.5rem; font-size: 1.1rem; scroll-margin-top: 1rem; }

table.clubs { border-collapse: collapse; width: 100%; margin-top: 0.75rem; }
table.clubs th, table.clubs td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.clubs th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; }
tr.disposed-row { opacity: 0.6; }
.club-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.club-actions form { display: inline-flex; gap: 0.3rem; align-items: center; }
.club-actions select { padding: 0.2rem; font: inherit; }
.club-actions button { padding: 0.25rem 0.6rem; font: inherit; font-size: 0.85rem; }
table.clubs .num { text-align: right; font-variant-numeric: tabular-nums; }
table.clubs .na { opacity: 0.45; }
.bag-block { margin: 1rem 0 1.75rem; }
.bag-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.bag-head .bag-title { margin: 0; font-size: 1.1rem; }
.bag-head .bag-count { opacity: 0.7; font-size: 0.85rem; }
section.bag-table { margin: 1rem 0 1.5rem; }
table.compare-gear .trend { text-align: center; font-weight: 700; }
table.compare-gear .trend-up { color: #1a8f3c; }
table.compare-gear .trend-down { color: #c0392b; }
table.compare-gear .trend-flat, table.compare-gear .trend-none { opacity: 0.5; }
button.danger { color: var(--accent-danger); border-color: color-mix(in srgb, var(--accent-danger) 45%, currentColor); }

form.club-form { align-items: flex-end; }

/* Trackman (v2 Phase 4): per-club length + dispersion bars on the session detail. currentColor +
   opacity so they adapt to the light/dark theme, matching the SVG trend charts. */
.trackman-club { margin: 1.5rem 0 2rem; }
.trackman-club h2 { margin: 0 0 0.5rem; font-size: 1.1rem; display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.trackman-bar-wrap {
  position: relative;
  height: 1.1rem;
  background: color-mix(in srgb, currentColor 8%, transparent);
  border-radius: 3px;
  margin-bottom: 0.35rem;
  overflow: hidden;
}
.trackman-bar-tail, .trackman-bar-carry, .trackman-bar-range {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
}
.trackman-bar-tail { background: color-mix(in srgb, currentColor 18%, transparent); }
.trackman-bar-carry { background: color-mix(in srgb, currentColor 55%, transparent); }
.trackman-bar-range {
  top: 60%;
  bottom: 0;
  background: color-mix(in srgb, currentColor 85%, transparent);
  border-radius: 2px;
}
.trackman-club .round-meta { margin: 0 0 0.6rem; }

/* --- Nest drill entry (v3 UI, 5a / handoff §8) --------------------------------------------------
   Per-station tabs (pure-CSS radio switch, works without JS) → a geometry pad + a grouped 10-bucket
   tally + live figures. All tints are color-mix over the tokens so light/dark survives. */
.nest-entry .pick { margin-bottom: 1rem; }

/* Station tabs: the radios are visually hidden; their labels are square view-buttons (design
   vocabulary), and the :checked radio reveals its matching panel + marks its tab active. */
.nest-tabradio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.nest-tablabels { display: flex; gap: 0.35rem; border-bottom: 1px solid var(--rule); margin-bottom: 1rem; }
.nest-tab {
  cursor: pointer; padding: 0.4rem 0.9rem; border-radius: 4px 4px 0 0; margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: none; font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.nest-tab:hover { background: var(--hover); }
.nest-tabcount {
  display: inline-block; min-width: 1.4em; text-align: center; margin-left: 0.15rem;
  font-size: 0.72rem; padding: 0 0.3rem; border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent); opacity: 0.75;
}
.nest-station { display: none; }
/* one reveal rule per preset station (fixed set: 5/10/15/20 m) */
#nesttab-0:checked ~ [data-station-panel="0"],
#nesttab-1:checked ~ [data-station-panel="1"],
#nesttab-2:checked ~ [data-station-panel="2"],
#nesttab-3:checked ~ [data-station-panel="3"] { display: block; }
#nesttab-0:checked ~ .nest-tablabels label:nth-child(1),
#nesttab-1:checked ~ .nest-tablabels label:nth-child(2),
#nesttab-2:checked ~ .nest-tablabels label:nth-child(3),
#nesttab-3:checked ~ .nest-tablabels label:nth-child(4) {
  background: color-mix(in srgb, currentColor 9%, transparent);
  border-color: var(--rule); font-weight: 600;
  border-bottom: 3px solid color-mix(in srgb, var(--accent-create) 60%, transparent);
}
/* Keyboard focus lands on the (visually hidden) radio; surface it on the matching tab label. */
#nesttab-0:focus-visible ~ .nest-tablabels label:nth-child(1),
#nesttab-1:focus-visible ~ .nest-tablabels label:nth-child(2),
#nesttab-2:focus-visible ~ .nest-tablabels label:nth-child(3),
#nesttab-3:focus-visible ~ .nest-tablabels label:nth-child(4) {
  outline: 2px solid color-mix(in srgb, currentColor 55%, transparent); outline-offset: 2px;
}

.nest-grid { display: flex; flex-wrap: wrap; gap: 1.4rem; align-items: flex-start; }

/* The geometry pad: three concentric squares (ring2 outer border, ::before = ring1, ::after = ring0)
   with the two diagonals drawn behind, and ten absolutely-positioned wedge buttons clipped so each
   catches clicks only in its own zone. */
.nestpad {
  position: relative; width: 280px; height: 280px; flex: 0 0 auto;
  border: 1px solid var(--rule); border-radius: 4px;
  background-image:
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), var(--rule) calc(50% - 0.5px), var(--rule) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom left, transparent calc(50% - 0.5px), var(--rule) calc(50% - 0.5px), var(--rule) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}
.nestpad::before { content: ""; position: absolute; inset: 18%; border: 1px solid var(--rule); pointer-events: none; }
.nestpad::after { content: ""; position: absolute; inset: 34%; border: 1px solid color-mix(in srgb, var(--accent-create) 45%, transparent); border-radius: 3px; pointer-events: none; }

.nestpad .zone { position: absolute; inset: 0; border: none; padding: 0; margin: 0; cursor: pointer; background: color-mix(in srgb, currentColor 5%, transparent); }
.nestpad .zone:hover { background: color-mix(in srgb, currentColor 16%, transparent); }
.nestpad .zone.r2 { z-index: 1; }
.nestpad .zone.r1 { inset: 18%; z-index: 2; background: color-mix(in srgb, currentColor 9%, transparent); }
.nestpad .zone.r1:hover { background: color-mix(in srgb, currentColor 20%, transparent); }
.nestpad .zone.r0 { inset: 34%; z-index: 3; border-radius: 3px; background: color-mix(in srgb, var(--accent-create) 15%, transparent); }
.nestpad .zone.r0:hover { background: color-mix(in srgb, var(--accent-create) 28%, transparent); }
.zone.long  { clip-path: polygon(0 0, 100% 0, 50% 50%); }
.zone.right { clip-path: polygon(100% 0, 100% 100%, 50% 50%); }
.zone.short { clip-path: polygon(100% 100%, 0 100%, 50% 50%); }
.zone.left  { clip-path: polygon(0 100%, 0 0, 50% 50%); }

.nestpad-labels { position: absolute; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.nestpad-labels .plabel { position: absolute; transform: translate(-50%, -50%); font-size: 0.85rem; opacity: 0.85; }
.nestpad-labels .p-r0 { font-size: 1.35rem; font-weight: 700; color: color-mix(in srgb, var(--accent-create) 85%, currentColor); left: 50%; top: 50%; }
.plabel.p-r1-long  { left: 50%; top: 27%; } .plabel.p-r1-short { left: 50%; top: 73%; }
.plabel.p-r1-left  { left: 27%; top: 50%; } .plabel.p-r1-right { left: 73%; top: 50%; }
.plabel.p-r2-long  { left: 50%; top: 8%; }  .plabel.p-r2-short { left: 50%; top: 92%; }
.plabel.p-r2-left  { left: 8%;  top: 50%; } .plabel.p-r2-right { left: 92%; top: 50%; }

/* ring2 dimmed below 15 m — the outer wedges + their labels fade, mirroring the table group. */
.nest-station[data-ring2="off"] .nestpad .zone.r2 { opacity: 0.32; cursor: not-allowed; }
.nest-station[data-ring2="off"] .nestpad-labels .plabel.p-r2-long,
.nest-station[data-ring2="off"] .nestpad-labels .plabel.p-r2-short,
.nest-station[data-ring2="off"] .nestpad-labels .plabel.p-r2-left,
.nest-station[data-ring2="off"] .nestpad-labels .plabel.p-r2-right { opacity: 0.3; }

.miss-zone {
  display: block; width: 280px; margin-top: 0.6rem; cursor: pointer;
  padding: 0.45rem 0.7rem; border-radius: 4px; font: inherit; text-align: left;
  border: 1px dashed color-mix(in srgb, var(--accent-danger) 40%, transparent);
  background: color-mix(in srgb, var(--accent-danger) 6%, transparent);
}
.miss-zone:hover { background: color-mix(in srgb, var(--accent-danger) 12%, transparent); }
.miss-count { float: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* The grouped bucket table beside the pad — the labeled source of truth + ± steppers. */
.nest-side { flex: 1 1 320px; min-width: 300px; }
.nest-bhead { font-weight: 600; margin-bottom: 0.5rem; }
.nest-btable { border-collapse: collapse; width: 100%; max-width: 26rem; }
.nest-btable .grp th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  opacity: 0.65; font-weight: 600; padding: 0.55rem 0 0.2rem;
}
.nest-btable .grp.dim th { opacity: 0.4; }
.nest-btable .brow td { padding: 0.15rem 0; border-bottom: 1px solid var(--rule); }
.nest-btable .brow.dim { opacity: 0.5; }
.nest-btable .bname { width: 5rem; }
.nest-btable .bctl { width: 2rem; text-align: center; }
.nest-btable .bval { width: 4rem; }
.nest-btable .bval input { width: 3.2rem; padding: 0.2rem; font: inherit; text-align: center; font-variant-numeric: tabular-nums; }
.nest-btable .step {
  width: 1.7rem; height: 1.7rem; border-radius: 999px; border: 1px solid var(--rule);
  background: transparent; cursor: pointer; font: inherit; line-height: 1; color: inherit;
}
.nest-btable .step:hover { background: var(--hover); }
.nest-btable .r0row .bval input { border-color: color-mix(in srgb, var(--accent-create) 45%, transparent); }

.nest-figs { display: flex; gap: 1px; margin-top: 1rem; max-width: 26rem; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.nest-figs .fig { flex: 1; padding: 0.5rem 0.6rem; background: color-mix(in srgb, currentColor 3%, transparent); }
.nest-figs .fig + .fig { border-left: 1px solid var(--rule); }
.nest-figs .fig b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.nest-figs .fig span { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.6; }
.nest-figs .fig.signed b { color: color-mix(in srgb, var(--accent-attention) 80%, currentColor); }

.nest-actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 1.4rem; }
.nest-actions .action.create { padding: 0.45rem 1.1rem; font-size: 0.95rem; }
