/* Coach-facing UX: sticky action bar, field validation, paste-a-list, snackbar, signed-in chip, thanks page.
   Loaded after app.css; spacing, type, radii and the sticky stack come from tokens.css. */

.stack-gap { margin-bottom: var(--s4); }
.stack-top { margin-top: var(--s4); }

/* ---------- Fields and validation (GOV.UK pattern: summary on top, message by the field) ---------- */
.field { font-size: 13px; font-weight: 600; color: var(--muted); }
.field > label { display: block; }
.field > label > span { display: block; margin-bottom: var(--s1); }
.field.has-err > label > span { color: var(--err); }
.field.has-err input { border-color: var(--err); border-width: 2px; }
.field .err-text { font-weight: 600; display: flex; gap: var(--s2); align-items: baseline; }
.field .err-text::before { content: "!"; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--err); color: #fff; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; transform: translateY(2px); }

.err-summary { background: #fff; border: 2px solid var(--err); border-radius: var(--r); padding: var(--s4); margin-bottom: var(--s4); }
.err-summary:focus { outline: 3px solid #F4B7B7; outline-offset: 2px; }
.err-summary-title { font-size: 16px; font-weight: 800; color: var(--err); margin-bottom: var(--s2); }
.err-summary ul { margin: 0; padding-left: var(--s5); }
.err-summary li { margin: 2px 0; }
.err-summary .linkbtn { color: var(--err); text-decoration: underline; text-underline-offset: 3px; text-align: left; padding: var(--s1) 0; font-size: 15px; }

.prefill-note { font-size: 14px; margin-bottom: var(--s4); }
.prefill-note a { color: inherit; font-weight: 600; }

/* ---------- Draft restore offer ---------- */
.draft-offer { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); border: 1.5px solid var(--light); }
.draft-actions { display: flex; gap: var(--s2); align-items: center; }

/* ---------- Paste a list ---------- */
.paste-open { font-size: var(--fs-sm); padding: 0 var(--s3); min-height: var(--tap); }
.paste { width: 100%; margin-top: var(--s2); padding: var(--s3); border-radius: 12px; background: #fff; border: 1.5px dashed var(--light); }
.paste textarea { display: block; width: 100%; margin-top: var(--s1); font: inherit; font-size: var(--fs-input); color: var(--ink); padding: var(--s3) var(--s3); border: 1.5px solid var(--line); border-radius: 10px; resize: vertical; min-height: 112px; }
.paste textarea:focus { outline: none; border-color: var(--mid); box-shadow: 0 0 0 3px var(--pale); }
.paste-actions { display: flex; gap: var(--s3); align-items: center; margin-top: var(--s2); }

/* ---------- Phone sticky action bar (<=900px) ---------- */
.actionbar { display: none; }
@media (max-width: 900px) {
  .actionbar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(18,71,188,.08);
  }
  .actionbar-sum { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
  .actionbar-count { font-size: 13px; font-weight: 600; color: var(--muted); }
  .actionbar-amt { font-size: 20px; font-weight: 800; color: var(--blue); }
  .actionbar-btn { flex: none; min-width: 148px; }
  .actionbar-btn.busy { opacity: .7; }
  body:has(.actionbar) { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }

  /* the bar carries the total and the forward action; Back stays in the card. One total per screen: no summary card here */
  .enter-page .summary { display: none; }
  .enter-page .layout-enter { gap: var(--s4); }
}

/* ---------- Snackbar (M3): bottom-left on desktop, bottom-centre on phone, above the action bar ---------- */
.snackbar-region { position: fixed; left: var(--s5); bottom: var(--s5); z-index: 40; pointer-events: none; max-width: min(480px, calc(100% - 32px)); }
.snackbar {
  pointer-events: auto; display: flex; align-items: center; gap: var(--s3);
  background: var(--snack); color: #fff; font-size: 14px; font-weight: 500; line-height: 1.4;
  padding: var(--s3) var(--s2) var(--s3) var(--s4); border-radius: 10px; min-height: 48px;
  box-shadow: 0 6px 24px rgba(27,36,64,.28);
  animation: snack-in .2s cubic-bezier(.2,.8,.2,1);
}
.snackbar-text { flex: 1; min-width: 0; }
.snackbar-action { background: none; border: 0; color: var(--cyan); font: inherit; font-weight: 700; padding: 0 var(--s3); min-height: var(--tap); cursor: pointer; border-radius: 6px; }
.snackbar-close { background: none; border: 0; color: #B8C3DC; font-size: 20px; line-height: 1; width: var(--tap); height: var(--tap); border-radius: 6px; cursor: pointer; flex: none; }
.snackbar-close:hover, .snackbar-action:hover { background: rgba(255,255,255,.08); }
@keyframes snack-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .snackbar-region { left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: none; display: flex; justify-content: center; }
  .snackbar { width: 100%; max-width: 480px; }
  body:has(.actionbar) .snackbar-region { bottom: calc(var(--bar-h) + 8px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .snackbar { animation: none; } }

/* ---------- Signed-in chip in the header ---------- */
.topbar nav a.signed-chip { display: inline-flex; align-items: center; gap: var(--s2); background: var(--pale); color: var(--blue-2); border-radius: 999px; padding: var(--s2) var(--s3); max-width: 320px; }
.topbar nav a.signed-chip:hover { background: var(--light); }
.signed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.signed-label { white-space: nowrap; }
.signed-email { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 899px) { .topnav .signed-email { display: none; } }
/* in the phone menu sheet the chip is a full-width row */
.topbar nav.navsheet a.signed-chip { max-width: none; border-radius: var(--r-ctl); padding: 0 var(--s3); }

/* ---------- Thanks page ---------- */
.thanks-band { padding-bottom: var(--s6); }
.thanks-check { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; margin-bottom: var(--s4); box-shadow: 0 0 0 6px rgba(255,255,255,.14); }
.band p.lead.thanks-lead { margin: 0; font-size: 16px; }
.band p.lead.thanks-lead b { color: #fff; }
.thanks-foot { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); }
.thanks-foot p { margin: 0; font-size: var(--fs-sm); }
@media (max-width: 599px) { .thanks-foot .btn { width: 100%; } }

/* =====================================================================================================
   Coach sections: one order = one grouped section, the same on My entries, the thank-you page, the
   review tab and the edit page. Venue colour runs along the top: Oxford blue, London purple, cyan while
   the organisers still have to place the club.
   ===================================================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.coach-stack .wrap > * + * { margin-top: var(--s4); }
.num, .tnum { font-variant-numeric: tabular-nums; }

.order {
  --accent: var(--cyan); --accent-bg: #E6F7FB; --accent-ink: #0A5F72;
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow);
  border-top: 4px solid var(--accent); overflow: hidden;
}
.order.ox { --accent: var(--blue); --accent-bg: var(--pale); --accent-ink: var(--blue-2); }
.order.ld { --accent: var(--purple); --accent-bg: var(--purple-pale); --accent-ink: var(--purple); }
/* inside a card (the review tab) the section is outlined instead of floating */
.card .order { box-shadow: none; border: 1px solid var(--line); border-top: 4px solid var(--accent); }

.order-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); padding: var(--card-pad) var(--card-pad) var(--s3); }
.order-blade { width: 56px; height: auto; flex: none; }
.order-title { flex: 1 1 0; min-width: 0; }
.order-ref { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.order-club { font-size: var(--fs-lg); font-weight: 800; line-height: 1.2; margin: 2px 0; overflow-wrap: anywhere; }
.order-index { display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; color: var(--blue); background: var(--pale); border-radius: 6px; padding: 2px var(--s2); vertical-align: 3px; }
.order-coach { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.order-chips { display: flex; flex-wrap: wrap; gap: var(--s2); flex: 1 1 100%; }
@media (min-width: 600px) {
  .order-blade { width: 64px; }
  .order-chips { flex: none; align-self: flex-start; justify-content: flex-end; max-width: 50%; }
}

/* chips: venue (solid in its colour) and payment status */
.vchip, .schip { display: inline-flex; align-items: center; gap: var(--s2); min-height: 28px; padding: 0 var(--s3); border-radius: var(--r-pill); font-size: 13px; font-weight: 700; white-space: nowrap; line-height: 1; }
.vchip { background: #E6F7FB; color: #0A5F72; }
.vchip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); flex: none; }
.vchip.ox { background: var(--blue); color: #fff; }
.vchip.ld { background: var(--purple); color: #fff; }
.vchip.ox .vchip-dot, .vchip.ld .vchip-dot { background: var(--cyan); box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.vchip-sub { font-weight: 500; opacity: .85; }
.schip.ok { background: var(--ok-bg); color: var(--ok); }
.schip.ok::before { content: ""; width: 10px; height: 6px; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-2px) rotate(-45deg); }
.schip.warn { background: var(--warn-bg); color: var(--warn); }
.schip.grey { background: #EEF0F4; color: var(--muted); }

.order-part { padding: var(--s4) var(--card-pad); }
.order-part + .order-part { border-top: 1px solid var(--line); }
.part-label { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s2); margin: 0 0 var(--s3); font-size: var(--fs-xs); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; line-height: 1.3; }
.part-meta { letter-spacing: 0; text-transform: none; font-weight: 600; font-size: var(--fs-sm); color: var(--ink); font-variant-numeric: tabular-nums; }
.part-label .part-edit, .order-ref .part-edit { margin: calc(-1 * var(--s3)) 0 calc(-1 * var(--s3)) auto; min-height: var(--tap); padding: 0 var(--s2); font-size: var(--fs-sm); letter-spacing: 0; text-transform: none; }

/* athletes by event */
.evg { display: grid; gap: var(--s2); }
@media (min-width: 600px) { .evg { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.evg-item { min-width: 0; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-ctl); background: #FAFBFE; }
.evg-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.evg-label { margin: 0; font-size: var(--fs-md); font-weight: 800; line-height: 1.25; }
.evg-count { flex: none; min-width: 24px; height: 24px; padding: 0 var(--s2); border-radius: var(--r-pill); background: var(--pale); color: var(--blue); font-size: var(--fs-xs); font-weight: 800; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.evg-races { margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.evg-names { list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1); font-size: var(--fs-sm); }
.evg-names li { display: inline-flex; align-items: center; gap: var(--s1); padding: 2px var(--s2); background: #fff; border: 1px solid var(--line); border-radius: 6px; line-height: 1.4; max-width: 100%; overflow-wrap: anywhere; }
.pr-tag { font-size: 11px; font-weight: 800; letter-spacing: .04em; color: #0A5F72; background: #E6F7FB; border-radius: 4px; padding: 0 var(--s1); }
/* relay choice per athlete: "Relay" quietly in brand blue, "Individual only" in grey */
.rl-tag { font-size: 11px; font-weight: 700; color: var(--blue); background: var(--pale); border-radius: 4px; padding: 0 var(--s1); white-space: nowrap; }
.rl-tag.off { color: var(--muted); background: #EEF0F4; }

/* payment & documents */
.pay-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4); }
.pay-sum { display: flex; flex-direction: column; gap: 2px; }
.pay-amt { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pay-meta { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.pay-docs { display: flex; flex-wrap: wrap; gap: var(--s2); }
@media (max-width: 599px) {
  .pay-docs { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .pay-docs .btn { width: 100%; }
  .pay-docs .btn:first-child { grid-column: 1 / -1; }
}


/* calendar and receipt: one quiet disclosure under the payment row */
.pay-more { margin-top: var(--s3); font-size: var(--fs-sm); }
.pay-more > summary { display: inline-flex; align-items: center; min-height: var(--tap); cursor: pointer; color: var(--blue); font-weight: 600; }
.pay-more-links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.pay-more-links a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }

/* ---------- My entries: one slim signed-in line, then the entries ---------- */
.my-signed { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 var(--s3); font-size: var(--fs-sm); color: var(--muted); }
.my-signed b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.my-signed form { margin: 0; }
.my-signed-acts { display: inline-flex; align-items: center; gap: var(--s3); }
.my-more { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }
.my-signout { min-height: var(--tap); padding: 0 var(--s2); margin-right: calc(-1 * var(--s2)); font-size: var(--fs-sm); }


/* ---------- Sign-in: one compact centred card ---------- */
.auth-card { padding: var(--s5) var(--card-pad); }
@media (min-width: 600px) { .auth-card { padding: var(--s6); } }
.auth-title { font-size: var(--fs-lg); margin: 0 0 var(--s2); }
.auth-text { margin: 0 0 var(--s4); font-size: var(--fs-sm); color: var(--muted); }
.auth-form { display: grid; gap: var(--s3); }
.auth-form .field-hint { margin-top: calc(-1 * var(--s2)); }
.auth-card .notice { margin-bottom: var(--s3); font-size: var(--fs-sm); }
.auth-foot { margin: var(--s5) 0 0; padding-top: var(--s4); border-top: 1px solid var(--line); text-align: center; font-size: var(--fs-sm); color: var(--muted); }
.auth-foot a { font-weight: 600; }
input.otp-input { font-size: 24px; font-weight: 700; letter-spacing: .4em; padding-left: calc(var(--s3) + .4em); text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Review tab ---------- */
.review-part { padding-block: var(--s3); }
.review-part .part-label { margin-bottom: var(--s1); }
.review-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); overflow-wrap: anywhere; }
.review-line .muted { font-size: var(--fs-sm); }

/* ---------- Back link on a slim band ---------- */
.back-link { display: inline-flex; align-items: center; min-height: var(--tap); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.back-link.on-band { color: #fff; margin: calc(-1 * var(--s3)) 0 0 calc(-1 * var(--s1)); padding: 0 var(--s1); }
.overlap { position: relative; margin-top: calc(-1 * var(--s7)); }

/* orders fold to their header when a coach has several */
details.order > summary { list-style: none; cursor: default; }
details.order > summary::-webkit-details-marker { display: none; }
details.order.fold > summary { cursor: pointer; }
details.order.fold:not([open]) > summary { border-bottom: 0; }
details.order.fold:not([open]) { padding-bottom: 0; }
.order-fold-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s; margin: 0 var(--s1) var(--s1) var(--s2); display: inline-block; }
details.order[open] .order-chev { transform: rotate(-135deg); margin-bottom: -3px; }
details.order.fold:not([open]) > :not(summary) { display: none; }

/* ---------- Entry form: small notes inside the step cards ---------- */
.step-note { margin-top: var(--s3); font-size: var(--fs-sm); }
.club-found { margin: 0; color: var(--ok); }
.club-region { color: var(--muted); font-size: var(--fs-sm); }
.alt-club-manual { margin-top: var(--s2); }
.alt-club-fields { margin-top: var(--s3); }
.venue-pick { margin-top: var(--s3); }

/* ---------- Motion (resting style is the end state, see motion.css; steps slide with .m-step-fwd/back) ---------- */
@keyframes amt-pulse { from { transform: scale(1.08); color: var(--blue-2); } }
.sum-total .amt, .actionbar-amt { display: inline-block; transform-origin: right center; animation: amt-pulse var(--mo-2) var(--e-settle); }
.actionbar-amt { transform-origin: left center; }
.thanks-tick { stroke-dasharray: 1; stroke-dashoffset: 0; animation: m-draw 180ms var(--e-ink) 60ms both; }
.thanks-wait { display: flex; align-items: center; gap: var(--s3); }
.thanks-wait .m-live-dot { --m-c: var(--blue); flex: none; }
@media (prefers-reduced-motion: reduce) {
  .sum-total .amt, .actionbar-amt, .thanks-tick { animation: none; }
}

/* ---------- Coach empty states sit in a card ---------- */
.card > .es { padding-block: var(--s5); }
.es .btn { min-width: 180px; }

/* Review step: card or invoice */
.pay-opts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.pay-opt { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1.5px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.pay-opt input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--blue); }
.pay-opt b { display: block; font-weight: 700; }
.pay-opt small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.pay-opt.on { border-color: var(--blue); background: var(--pale); }
.bill-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s3); }
.bill-fields .field { display: grid; gap: var(--s1); align-content: start; }
.bill-fields .field > label > span { font-weight: 600; font-size: 14px; margin: 0; }
.bill-fields .bill-from { grid-column: 1 / -1; margin-top: calc(-1 * var(--s1)); }
.bill-fields .field.wide { grid-column: 1 / -1; }
.bill-fields .hint { color: var(--muted); font-size: 12px; }
.thanks-foot .btn + .btn { margin-left: var(--s2); }
@media (max-width: 640px) { .pay-opts, .bill-fields { grid-template-columns: 1fr; } }

/* ---------- Entering as an individual (no British Rowing club) ---------- */
.ind-toggle { display: flex; align-items: flex-start; gap: var(--s3); margin-top: var(--s4); padding: var(--s3) var(--s4); border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: #fff; cursor: pointer;
  transition: border-color var(--mo-2) var(--e-settle), background-color var(--mo-2) var(--e-settle); }
.ind-toggle:hover { border-color: var(--light); }
.ind-toggle.on { border-color: var(--blue); background: var(--pale); }
.ind-toggle input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--blue); }
.ind-toggle b { display: block; font: var(--t-head); font-size: var(--fs-md); color: var(--ink); }
.ind-toggle small { display: block; font: var(--t-meta); color: var(--muted); margin-top: 2px; }
.ind-fields { display: grid; gap: var(--s3); margin-top: var(--s4); }
@media (min-width: 600px) { .ind-fields { grid-template-columns: 1fr 1fr; align-items: start; } }
.ind-card { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); border-radius: var(--r-ctl); background: var(--bg); }
.ind-card .club-name { font-size: var(--fs-md); }
.ind-card .club-region { font-size: var(--fs-xs); line-height: 1.4; }
.ind-card .av { width: 40px; height: 40px; }

/* ---------- Athletes: event picker beside the roster (CRM-style compact rows) ---------- */
.av { flex: none; width: 20px; height: 20px; border-radius: 50%; display: block; }
.crm { display: grid; gap: var(--s4); align-items: start; }
.ev-group { font: var(--t-label); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: var(--s3) 0 var(--s1); }
.ev-group:first-child { margin-top: 0; }
.evtable { display: grid; gap: var(--s1); }
.evrow { display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr); gap: var(--s1); align-items: center; }
.evlabel { font: var(--t-head); font-size: 13px; white-space: nowrap; }
.evbtn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s1); min-height: 40px; padding: 0 var(--s1) 0 var(--s2);
  border: 1px solid var(--line); border-radius: var(--r-pill); background: #fff; font: var(--t-body); font-weight: 600; color: var(--ink); cursor: pointer;
  transition: background-color var(--mo-2) var(--e-settle), border-color var(--mo-2) var(--e-settle), color var(--mo-2) var(--e-settle), transform var(--mo-1) ease; }
.evbtn:hover { border-color: var(--mid); }
.evbtn:active { transform: scale(.97); }
.evbtn.has { background: var(--pale); border-color: var(--light); color: var(--blue-2); }
.evbtn.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.evbtn .badge { min-width: 20px; height: 20px; font-size: 11px; padding: 0 var(--s1); }
.evbtn.on .badge { background: #fff; color: var(--blue); }
.evpanel-empty { color: var(--muted); display: grid; place-items: center; min-height: 160px; text-align: center; font: var(--t-body); }

.roster { display: grid; gap: var(--s2); min-width: 0; }
.rg { border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff; transition: border-color var(--mo-2) var(--e-settle), box-shadow var(--mo-2) var(--e-settle); }
.rg.on { border-color: var(--light); box-shadow: 0 0 0 3px var(--pale); }
.rg-head { display: flex; align-items: baseline; gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); background: #FAFBFE; border-radius: var(--r-ctl) var(--r-ctl) 0 0; }
.rg-title { border: 0; background: none; padding: 0; font: var(--t-head); color: var(--ink); cursor: pointer; }
.rg.on .rg-title { color: var(--blue); }
.rg-races { flex: 1; min-width: 0; font: var(--t-meta); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-count { flex: none; min-width: 22px; height: 20px; padding: 0 var(--s2); border-radius: var(--r-pill); background: var(--pale); color: var(--blue); font: var(--t-label); display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; align-self: center; }
.rg-rows { list-style: none; margin: 0; padding: var(--s1) 0; }
.ath { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s2); padding: 2px var(--s2) 2px var(--s3); min-height: 40px; }
.ath + .ath { border-top: 1px solid #F0F2F7; }
.ath:hover { background: #FAFBFE; }
.ath .av { width: 28px; height: 28px; }
.av.add { display: grid; place-items: center; border: 1.5px dashed var(--light); color: var(--mid); font-weight: 700; font-size: 16px; line-height: 1; }
/* names read as text until touched: no box, a hairline on hover, the usual ring on focus */
.ath-name { flex: 1 1 140px; min-width: 0; min-height: 34px; padding: var(--s1) var(--s2); border-color: transparent; background: transparent; font-weight: 600; }
.ath-name:hover { border-color: var(--line); }
.ath-name:focus { background: #fff; }
.ath.add .ath-name { font-weight: 400; }
.ath-name.dup { border-color: #E8C46A; background: #FFFCF3; }
.dup-note { order: 9; flex-basis: 100%; padding: 0 0 var(--s1) 44px; color: var(--warn); font: var(--t-meta); font-weight: 600; }
.ath .pr { width: 74px; flex: none; min-height: 32px; padding: 2px var(--s2); font-size: var(--fs-ctl); }
/* relay: a small pill switch, blue when on */
.relay-opt { position: relative; display: inline-flex; align-items: center; gap: var(--s2); flex: none; min-height: 28px; padding: 0 var(--s3) 0 var(--s2); border-radius: var(--r-pill);
  background: #EEF0F4; color: var(--muted); font: var(--t-label); letter-spacing: .02em; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background-color var(--mo-2) var(--e-settle), color var(--mo-2) var(--e-settle); }
.relay-opt::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; transition: opacity var(--mo-2), transform var(--mo-2) var(--e-float); }
.relay-opt.on { background: var(--pale); color: var(--blue); }
.relay-opt.on::before { opacity: 1; transform: scale(1.15); }
.relay-opt input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.relay-opt:has(input:focus-visible) { outline: 3px solid var(--mid); outline-offset: 2px; }
.ath .xbtn { width: 32px; height: 32px; font-size: 18px; }
@media (hover: hover) {
  .ath .xbtn { opacity: 0; transition: opacity var(--mo-2) var(--e-settle); }
  .ath:hover .xbtn, .ath:focus-within .xbtn { opacity: 1; }
}
.rg-foot { padding: 0 var(--s2) var(--s1); border-top: 1px dashed var(--line); }
.evg-names .av { margin-left: -4px; }

@media (min-width: 900px) {
  .crm { grid-template-columns: 196px minmax(0, 1fr); gap: var(--s5); }
  .evpick { position: sticky; top: 76px; }
  .evbtn { min-height: 30px; }
}
/* phone: the roster first, the picker under it */
@media (max-width: 899px) { .roster { order: -1; } .ath .xbtn { width: var(--tap); height: var(--tap); } }
@media (min-width: 900px) { .ath-name { font-size: var(--fs-ctl); } }
@media (max-width: 599px) { .ath .pr { width: 64px; } .ath-name { flex-basis: 96px; } }
