/* ============================================================ Race */
.main-race { max-width: 980px; padding-top: 0; }
.race-head {
  position: sticky; top: var(--appbar-h); z-index: 20;
  margin-inline: calc(-1 * var(--gutter)); padding: 12px var(--gutter) 14px;
  background: var(--paper); border-bottom: 2px solid var(--ink);
}
.race-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 20px; }
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.state i { width: 10px; height: 10px; border-radius: 50%; background: var(--pin); }
.state.running i { background: var(--fox); animation: pulse 1.4s infinite; }
.state.stopped i { background: var(--ink); border-radius: 2px; }
.sync { font: 500 11.5px/1 var(--f-time); letter-spacing: -0.02em; color: var(--ink-3); text-align: right; }
.sync.bad { color: var(--err); }
.race-clock {
  margin-top: 8px;
  font: 600 clamp(46px, 15vw, 88px)/1 var(--f-time); letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.race-clock .ms { font-size: 0.56em; color: var(--ink-3); letter-spacing: -0.03em; }
.race-clock.frozen { color: var(--fox-deep); }
.race-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.race-actions .btn { min-height: 50px; }

.race-body { display: grid; gap: 10px; padding-top: 14px; }
.bibs-view, .rush-view { display: grid; gap: 10px; }

.modes { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--card); }
.modes button {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 6px 10px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; text-align: left;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.modes button + button { border-left: 1.5px solid var(--ink); }
.modes button .bi { width: 18px; height: 18px; }
.modes button span { display: grid; line-height: 1.2; }
.modes button b { font: 800 16px/1.1 var(--f-num); letter-spacing: 0.1em; text-transform: uppercase; }
.modes button small { display: none; font-size: 11.5px; color: var(--ink-3); }
.modes [aria-pressed="true"] { background: var(--ink); color: #fff; }
.modes [aria-pressed="true"] small { color: var(--on-ink); }
.modes [aria-pressed="true"] .bi { color: var(--ember); }
@media (min-width: 480px) { .modes button small { display: block; } }

.rush-pad {
  position: relative; display: grid; place-content: center; justify-items: center; gap: 6px;
  width: 100%; min-height: clamp(220px, 42dvh, 380px); padding: 20px;
  border: 2px solid var(--ink); border-radius: 18px; background: var(--fox-deep); color: #fff;
  cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}
.rush-pad:active { background: var(--ink); }
.rush-pad.hit { animation: rush-hit 0.25s ease-out; }
.rush-pad:disabled { background: var(--muted-bg); border-color: var(--line-2); color: var(--ink-3); cursor: default; box-shadow: none; }
.rush-label { font: 900 clamp(56px, 16vw, 104px)/0.9 var(--f-num); letter-spacing: 0.06em; text-transform: uppercase; }
.rush-sub { font-size: 14px; font-weight: 600; opacity: 0.9; }
.rush-no {
  position: absolute; top: 12px; right: 14px; min-width: 44px; padding: 4px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.22); font: 800 26px/1 var(--f-num); text-align: center;
}
.rush-pad:disabled .rush-no { background: var(--card); color: var(--ink-2); }
@keyframes rush-hit { from { background: var(--fox); transform: scale(0.985); } }
.rush-recent { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1.5px solid var(--ink); }
.rush-recent li {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  min-height: 40px; border-bottom: 1px solid var(--rule); font-size: 14px;
}
.rush-recent .no { font: 800 20px/1 var(--f-num); }
.rush-recent .t { font: 500 14px/1 var(--f-time); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.rush-recent .s { font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-align: right; }
.rush-recent .s small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.rush-recent .given .s { color: var(--ok); }
.rush-recent .pending .s { color: var(--fox-text); }
.rush-recent .removed { color: var(--faint); text-decoration: line-through; }
.race-body .count, .bib-section { font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.race-body .count { margin-top: 2px; }
.queue-note { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--err-soft); color: var(--err); font-size: 14px; font-weight: 600; }
.queue-note.sending { background: var(--fox-soft); color: var(--fox-text); }
.bib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.race-body.idle .bib:not(.done):not(.pending) { opacity: 0.55; cursor: default; }
.race-body.idle .bib:not(.done):not(.pending):active { transform: none; }
.bib-section { grid-column: 1 / -1; margin-top: 8px; }
.race-body .empty { background: var(--card); border: 1.5px dashed var(--line-2); border-radius: 8px; display: grid; gap: 12px; justify-items: center; }
@media (min-width: 600px) {
  .bib-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
  .bib .no { font-size: 44px; }
}

/* ============================================================ Runners */
.lock {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  margin-bottom: 16px; padding: 12px 16px; border-radius: 8px;
  background: var(--fox-deep); color: #fff; font-size: 14.5px;
}
.lock .bi { width: 18px; height: 18px; }
.lock b { font: 800 17px/1 var(--f-num); letter-spacing: 0.12em; text-transform: uppercase; }
.lock span { flex: 1 1 260px; }
.lock .btn { border-color: #fff; }

.past { display: grid; gap: 6px; margin-top: -4px; }
.past-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.past-list { display: grid; margin: 0; padding: 0; list-style: none; border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--card); }
.past-list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 44px; padding: 10px 12px;
  border-bottom: 1px solid var(--rule); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.past-list li:last-child { border-bottom: 0; }
.past-list li:hover, .past-list li[aria-selected="true"] { background: var(--fox-soft); }
.past-list b { font-size: 15px; }
.past-list small { flex: none; font-size: 12px; color: var(--ink-3); }

.runners-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 900px) { .runners-layout { grid-template-columns: 340px minmax(0, 1fr); gap: 24px; } }
@media (min-width: 900px) { .reg { position: sticky; top: calc(var(--appbar-h) + 24px); } }

.reg-body { display: grid; gap: 14px; padding: 16px 18px 18px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.numrow { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 14px; align-items: end; }
.field .num-input { height: 58px; font: 900 32px/1 var(--f-num); letter-spacing: 0.02em; }
.btnrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.reg.is-editing .btnrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.reg.is-editing { box-shadow: 0 0 0 4px var(--fox-soft); }
.reg.is-editing > .band { background: var(--ink); }
.btnrow .btn { min-height: 50px; padding-inline: 12px; font-size: 16px; white-space: nowrap; }

.roster-tools { padding: 12px 14px; border-bottom: 1.5px solid var(--ink); }
.table-scroll { position: relative; overflow-x: auto; }  /* also clips the hidden "Actions" header */
.roster { container-type: inline-size; }
.roster table { width: 100%; min-width: 440px; border-collapse: collapse; font-size: 14.5px; }
.roster th {
  padding: 9px 10px; border-bottom: 1.5px solid var(--ink); text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
}
.roster td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.roster tr:last-child td { border-bottom: 0; }
.roster td.no { width: 72px; font: 900 26px/1 var(--f-num); }
.roster td.acts { text-align: right; white-space: nowrap; }
.roster td.acts .btn { margin-left: 6px; }
@container (max-width: 620px) { .roster td.acts .btn:not(.warn) .lbl, .roster td.acts .wide { display: none; } }
.roster td.acts .btn.warn { background: var(--fox-deep); border-color: var(--fox-deep); color: #fff; }
.roster tr.editing td { background: #FDEEE5; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--fox); }
.chip.on { background: var(--fox-soft); color: var(--fox-text); }
.chip.fin { background: var(--ink); color: #fff; }
.chip.fin span { font: 500 11.5px/1 var(--f-time); letter-spacing: -0.03em; color: var(--ember); }
.chip.new { box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); }
.chip.gone { background: var(--muted-bg); color: var(--ink-3); }
.chip.pick { background: var(--fox-deep); color: #fff; }
.chip.you { background: var(--fox-soft); color: var(--fox-text); }
.chip.role { box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); }
.chip.role-admin { background: var(--ink); color: #fff; box-shadow: none; }

/* ============================================================ Results */
.results-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 1000px) { .results-layout { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; } }
.res-body { display: grid; gap: 16px; padding: 18px; }

.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; max-width: 460px; width: 100%; justify-self: center; }
.podium > div { display: grid; gap: 4px; min-width: 0; text-align: center; }
.podium .who { font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .bn { font: 800 15px/1 var(--f-num); color: var(--fox-deep); }
.podium .t { font: 500 12px/1 var(--f-time); letter-spacing: -0.04em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.podium .step { display: grid; place-items: center; border-radius: 6px 6px 0 0; color: #fff; font: 900 40px/1 var(--f-num); }
.podium .p1 .step { height: 116px; background: var(--fox); }
.podium .p2 .step { height: 86px; background: var(--ink); }
.podium .p3 .step { height: 62px; background: #5B6368; }

.topn { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 14px; font-weight: 700; }
.topn-acts { display: flex; gap: 8px; margin-left: auto; }
.stepper { display: inline-grid; grid-template-columns: 42px 62px 42px; height: 42px; border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--card); }
.stepper button { display: grid; place-items: center; border: 0; background: var(--card); color: var(--ink); cursor: pointer; touch-action: manipulation; }
.stepper button:active { background: var(--ink); color: #fff; }
.stepper button .bi { width: 16px; height: 16px; }
.stepper input {
  width: 100%; min-width: 0; border: 0; border-inline: 1.5px solid var(--ink); border-radius: 0;
  background: var(--card); color: var(--ink); text-align: center;
  font: 900 24px/1 var(--f-num); -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper :disabled { background: var(--muted-bg); color: var(--faint); cursor: default; }
[data-all][aria-pressed="true"] { background: var(--ink); color: #fff; }
.bib.done .band { padding-inline: 5px; letter-spacing: 0.06em; }  /* room for who stopped it */
.race-body .bib.done.locked { cursor: not-allowed; }
.race-body .bib.done.locked:active { transform: none; }

.standings { margin: 0; padding: 0; list-style: none; border-top: 1.5px solid var(--ink); }
.standings li {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(56px, 0.45fr) 104px; gap: 8px; align-items: center;
  min-height: 42px; border-bottom: 1px solid var(--rule); font-size: 15px;
}
.standings li.head {
  min-height: 30px; font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}
.standings .pl { font: 800 20px/1 var(--f-num); }
.standings .rn { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.standings .bn { flex: none; min-width: 44px; font: 800 20px/1 var(--f-num); color: var(--fox-deep); }
.standings .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.standings .by { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) {  /* phones: the bib sits over the name so both columns keep their words */
  .standings li { grid-template-columns: 36px minmax(0, 1fr) minmax(0, 0.8fr) 80px; gap: 6px; }
  .standings li.head { font-size: 10px; letter-spacing: 0.05em; }
  .standings .tm { font-size: 12.5px; }
  .standings .by { font-size: 12.5px; }
  .standings li:not(.head) { padding-block: 6px; }
  .standings .rn { flex-direction: column; align-items: stretch; gap: 3px; }
  .standings .rn .nm { font-size: 14px; }
  .standings .rn .bn { font-size: 18px; }
}
.standings li.head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standings li.head span:last-child { text-align: right; }  /* every row is its own grid: fixed time column */
.standings .tm { text-align: right; font: 500 13.5px/1 var(--f-time); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.standings li.open { grid-template-columns: minmax(0, 1fr); color: var(--ink-3); font-size: 14px; }
.foot { font-size: 13px; color: var(--ink-3); }
.foot b { color: var(--ink); }

.saved-list { display: grid; }
.saved-list details { border-bottom: 1px solid var(--rule); }
.saved-list details:last-child { border-bottom: 0; }
.saved-list summary {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 16px;
  cursor: pointer; list-style: none;
}
.saved-list summary::-webkit-details-marker { display: none; }
.saved-list summary .bi { width: 16px; height: 16px; color: var(--ink-3); }
.saved-list summary .chev { margin-left: auto; transition: transform 0.15s; }
.saved-list details[open] .chev { transform: rotate(180deg); }
.saved-list summary b { font: 800 18px/1 var(--f-num); letter-spacing: 0.04em; text-transform: uppercase; }
.saved-list summary span { font-size: 13px; color: var(--ink-3); }
.saved-body { display: grid; gap: 10px; padding: 0 16px 16px; }
.saved-body .standings li:not(.head) { min-height: 36px; font-size: 14px; }
.saved-body .menu-list { left: 0; }
.saved-body .dnf { font-size: 13.5px; color: var(--ink-2); }
.saved-body .dnf span { white-space: nowrap; }

/* ============================================================ Finishes */
/* Phones: give a bib, the list, then swaps. Wider: give a bib and swaps side by side, the list below. */
.finishes-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.finishes-side { display: contents; }
.finishes-layout .next { order: 1; }
.finishes-layout .times { order: 2; }
.finishes-layout .swap { order: 3; }
@media (min-width: 900px) {
  .finishes-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px;
    grid-template-areas: "next swap" "times times";
  }
  .finishes-layout .next { grid-area: next; align-self: stretch; }
  .finishes-layout .swap { grid-area: swap; align-self: stretch; }
  .finishes-layout .times { grid-area: times; }
  .swap-log { max-height: 176px; overflow-y: auto; }  /* keeps the top row short */
}
.next-body, .swap-body { display: grid; gap: 12px; padding: 16px 18px 18px; }
.next-time {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 2px 12px;
  padding: 12px 14px; border-radius: 10px; background: var(--ink); color: #fff;
}
.next-time .k { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--on-ink); }
.next-time .no { font: 900 40px/1 var(--f-num); }
.next-time .t { justify-self: end; font: 600 clamp(22px, 7vw, 30px)/1 var(--f-time); letter-spacing: -0.05em; color: var(--ember); font-variant-numeric: tabular-nums; }
.next-time .by { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: var(--on-ink); }
.next-time.picked { background: var(--fox-deep); }
.next-time.picked .t { color: #fff; }
.next-time.none { background: var(--muted-bg); color: var(--ink-3); }
.next-time.none .k, .next-time.none .t, .next-time.none .by { color: var(--ink-3); }
.next-who { min-height: 1.5em; font-size: 14.5px; color: var(--ink-2); }
.next-who b { color: var(--ink); }
.next-who .t { font-family: var(--f-time); font-weight: 600; }
.next-who.err { color: var(--err); font-weight: 600; }

.times { container-type: inline-size; }
.times-tools { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1.5px solid var(--ink); }
.times-tools [aria-pressed="true"] { background: var(--ink); color: #fff; }
.times table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 14.5px; }
.times th {
  padding: 9px 10px; border-bottom: 1.5px solid var(--ink); text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
}
.times td { padding: 7px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.times tr:last-child td { border-bottom: 0; }
.times td.no { width: 60px; font: 800 22px/1 var(--f-num); }
.times td.tm { width: 110px; font: 500 14px/1 var(--f-time); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.times td.who .bn { margin-right: 8px; font: 800 20px/1 var(--f-num); color: var(--fox-deep); }
.times td.who .nm { font-weight: 600; }
.times td.who .by, .times td.tap small { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-3); }
.times td.tap { white-space: nowrap; }
.times td.tm small { display: none; margin-top: 3px; font: 600 12px/1.2 var(--f-ui); letter-spacing: 0; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.times td.tap small { font-family: var(--f-time); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.times td.acts { text-align: right; white-space: nowrap; }
.times td.acts .btn { margin-left: 6px; }
.times td.acts .btn.warn { background: var(--fox-deep); border-color: var(--fox-deep); color: #fff; }
.times td.acts .btn.on:not(:disabled) { background: var(--ink); color: #fff; }
.times tr.target td { background: #FDEEE5; }
.times tr.removed td.no, .times tr.removed td.tm { color: var(--faint); text-decoration: line-through; }
@container (max-width: 560px) {
  .times td.acts .btn:not(.warn) .lbl { display: none; }
  .times table { min-width: 400px; }
  .times .tap { display: none; }  /* who tapped moves under the race time */
  .times td.tm small { display: block; }
}

.swap-preview { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; border-radius: 8px; background: var(--muted-bg); font-size: 14px; }
.swap-preview > .bi { width: 16px; height: 16px; color: var(--fox-deep); }
.swap-preview b { font: 800 18px/1 var(--f-num); }
.swap-preview .t { font: 500 13px/1 var(--f-time); letter-spacing: -0.03em; }
.swap-preview .err { color: var(--err); font-weight: 600; }
.swap-preview .ph { color: var(--faint); }
.swap-log-wrap { padding: 12px 18px 16px; border-top: 1.5px solid var(--ink); }
.swap-log-wrap h3 { margin-bottom: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.swap-log { display: grid; margin: 0; padding: 0; list-style: none; }
.swap-log li { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.swap-log li:last-child { border-bottom: 0; }
.swap-log .pair { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-weight: 600; }
.swap-log .pair b { font: 800 16px/1 var(--f-num); color: var(--fox-deep); }
.swap-log .pair .bi { width: 13px; height: 13px; color: var(--ink-3); }
.swap-log .was { font: 500 12px/1.3 var(--f-time); color: var(--ink-3); }
.swap-log .why { color: var(--ink-2); }
.swap-log .none { color: var(--ink-3); }

/* ============================================================ Admin */
.main-admin { max-width: 1040px; }
.admin { display: grid; gap: 18px; }
.admin-panel { display: grid; gap: 18px; align-content: start; min-width: 0; }
.admin-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--card);
}
.admin-tabs button {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 6px 10px; border: 0; background: transparent; color: var(--ink-2);
  font: 800 16px/1.1 var(--f-num); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.admin-tabs button + button { border-left: 1.5px solid var(--ink); }
.admin-tabs .bi { width: 17px; height: 17px; }
.admin-tabs button:hover { background: var(--muted-bg); }
.admin-tabs [aria-selected="true"], .admin-tabs [aria-selected="true"]:hover { background: var(--ink); color: #fff; }
.admin-tabs [aria-selected="true"] .bi { color: var(--ember); }
.tab-count {
  min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--muted-bg); color: var(--ink-2);
  font: 700 12px/20px var(--f-ui); font-style: normal; letter-spacing: 0; text-align: center;
}
[aria-selected="true"] .tab-count { background: var(--ink-raised); color: #fff; }
.tab-count:empty { display: none; }
@media (max-width: 599px) {
  .admin-tabs button { flex-direction: column; gap: 3px; min-height: 58px; padding-inline: 4px; font-size: 13px; letter-spacing: 0.05em; }
  .tab-count { position: absolute; top: 5px; right: 6px; font-size: 11px; line-height: 18px; min-width: 18px; }
}

/* general settings */
.setting {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 16px 20px; border-bottom: 1px solid var(--rule);
}
.setting:last-child { border-bottom: 0; }
.setting-text { display: grid; gap: 3px; flex: 1 1 320px; min-width: 0; }
.setting-text b { font-size: 15px; }
.setting-text small { font-size: 13px; color: var(--ink-3); }
.setting-control { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.setting-control .btn:not(.btn-sm) { min-height: 44px; }
[data-gen-all][aria-pressed="true"] { background: var(--ink); color: #fff; }

/* register or edit a user */
.acct-card { width: 100%; }
.acct-card.is-editing { box-shadow: 0 0 0 4px var(--fox-soft); }
.acct-card.is-editing > .band { background: var(--ink); }
.acct-body { display: grid; gap: 14px; padding: 18px 20px 20px; }
.acct-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.roles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
@media (min-width: 560px) { .roles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .roles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.roles legend { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.roles legend small { margin-left: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.acct-card .btnrow { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* the list of users */
.users { container-type: inline-size; }
.users-tools { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-bottom: 1.5px solid var(--ink); }
.users-tools .find { flex: 1 1 240px; }
.users-tools .btn { flex: 0 1 auto; min-height: 48px; }
.users table { width: 100%; min-width: 340px; border-collapse: collapse; font-size: 14.5px; }
.users th {
  padding: 9px 12px; border-bottom: 1.5px solid var(--ink); text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
}
.users td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.users tr:last-child td { border-bottom: 0; }
.users tr.editing td { background: #FDEEE5; }
.users td.uname { white-space: nowrap; }
.users td.uname .bi { width: 18px; height: 18px; margin-right: 8px; vertical-align: -4px; color: var(--ink-3); }
.users td.uname b { font-size: 15.5px; }
.users td.uname .chip { margin-left: 8px; }
.users td.uroles { min-width: 120px; }
.users td.uroles .chip { margin: 2px 4px 2px 0; }
.users .added { width: 1%; white-space: nowrap; font-size: 13px; color: var(--ink-3); }
.users td.acts { width: 1%; text-align: right; white-space: nowrap; }
.users td.acts .btn { margin-left: 6px; }
.users td.acts .btn.warn { background: var(--fox-deep); border-color: var(--fox-deep); color: #fff; }
@container (max-width: 640px) {
  .users .added { display: none; }
  .users td.acts .btn:not(.warn) .lbl { display: none; }
}
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
  border-top: 1.5px solid var(--ink); font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.pager [data-page="-1"] .bi { transform: rotate(90deg); }
.pager [data-page="1"] .bi { transform: rotate(-90deg); }

/* history */
.hist-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat {
  display: grid; align-content: start; gap: 4px; min-width: 0; padding: 12px 16px;
  border: 1.5px solid var(--ink); border-radius: 10px; background: var(--card);
}
.stat b { font: 800 32px/1 var(--f-num); }
.stat b.t { font: 600 24px/1.2 var(--f-time); letter-spacing: -0.05em; color: var(--fox-deep); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); }
.stat small { overflow: hidden; font-size: 12.5px; color: var(--ink-2); text-overflow: ellipsis; white-space: nowrap; }
.history { container-type: inline-size; }
.hist-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1.5px solid var(--ink); }
.seg { display: flex; gap: 6px; }
.seg [aria-pressed="true"] { background: var(--ink); color: #fff; }
.hist-find { flex: 1 1 240px; }
.saved-list .run-head { display: grid; flex: 1; gap: 4px; min-width: 0; }
.saved-list .run-head span { font-size: 13px; color: var(--ink-3); }
.hist-runs .run-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.hist-runs .run-name i { font-size: 12px; font-style: normal; font-weight: 700; color: var(--ink-3); }
.hist-runs .run-win { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.hist-runs .run-win .bi { width: 13px; height: 13px; color: var(--fox); }
.hist-runs .run-win em { font: normal 500 12.5px var(--f-time); letter-spacing: -0.03em; }
.run-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.past-runners { width: 100%; min-width: 360px; border-collapse: collapse; font-size: 14.5px; }
.past-runners th {
  padding: 9px 12px; border-bottom: 1.5px solid var(--ink); text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
}
.past-runners td { padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.past-runners tr:last-child td { border-bottom: 0; }
.past-runners .rname { font-weight: 600; }
.past-runners .num { width: 1%; text-align: right; font-variant-numeric: tabular-nums; }
.past-runners td.tm { white-space: nowrap; font: 500 13.5px/1 var(--f-time); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.past-runners .last { width: 1%; white-space: nowrap; font-size: 13px; color: var(--ink-3); }
.past-runners td.acts { width: 1%; text-align: right; white-space: nowrap; }
.past-runners td.acts .btn.warn { background: var(--fox-deep); border-color: var(--fox-deep); color: #fff; }
@container (max-width: 620px) {
  .past-runners .last { display: none; }
  .past-runners td.acts .btn:not(.warn) .lbl { display: none; }
  .past-runners th, .past-runners td { padding-inline: 8px; }
}

/* audit log */
.act-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px 14px; border-bottom: 1.5px solid var(--ink); }
.act-tools .btn { min-height: 46px; }
@media (max-width: 480px) { .act-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .act-tools .btn { grid-column: 1 / -1; } }
.act-list { display: grid; margin: 0; padding: 0; list-style: none; }
.act-list .act-day {
  position: sticky; top: var(--appbar-h); z-index: 1; padding: 8px 16px 6px; background: var(--muted-bg);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
}
.act {
  display: grid; grid-template-columns: 18px auto minmax(0, 1fr); gap: 2px 10px; align-items: baseline;
  padding: 9px 16px; border-bottom: 1px solid var(--rule); font-size: 14px;
}
.act > .bi { width: 14px; height: 14px; align-self: center; color: var(--ink-3); }
.act time { font: 500 12.5px/1.3 var(--f-time); letter-spacing: -0.03em; color: var(--ink-3); white-space: nowrap; }
.act-who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-who i { font-weight: 500; color: var(--ink-3); }
.act-what { grid-column: 2 / -1; color: var(--ink-2); overflow-wrap: anywhere; }
@media (min-width: 760px) {  /* one line per entry: time, who, what */
  .act { grid-template-columns: 18px 112px 150px minmax(0, 1fr); padding-block: 10px; }
  .act-what { grid-column: auto; }
}
.act-tap { display: block; margin-top: 2px; font: 500 12px/1.3 var(--f-time); letter-spacing: -0.03em; color: var(--ink-3); }
.act.warn > .bi, .act.warn .act-what { color: var(--err); }
.act-more { display: grid; justify-items: center; padding: 12px; }

/* ============================================================ Sign in / set password */
.auth {
  min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px;
  padding: 32px var(--gutter);
}
.auth-mark { width: 112px; height: 112px; }
.auth-card { width: min(420px, calc(100vw - 32px)); }
.auth-body { display: grid; gap: 14px; padding: 18px 20px 22px; }
.auth-body > p:first-child { color: var(--ink-2); }
