:root {
  --ink: #f5f7f2;
  --muted: #8f9a9a;
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(18, 25, 28, 0.88);
  --panel-strong: #151d20;
  --ground: #090e10;
  --acid: #c8ff3d;
  --acid-soft: rgba(200, 255, 61, 0.12);
  --orange: #ff6b35;
  --cyan: #41d9ff;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 83% 6%, rgba(65, 217, 255, 0.08), transparent 27rem),
    linear-gradient(135deg, rgba(200, 255, 61, 0.025) 25%, transparent 25%) 0 0 / 28px 28px,
    var(--ground);
}

button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 76px;
  padding: 0 clamp(18px, 4vw, 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 14, 16, 0.86);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 19px; letter-spacing: -0.04em; }
.brand small { display: block; color: var(--acid); font-size: 9px; letter-spacing: 0.22em; margin-top: 2px; }
.brand-mark { width: 32px; height: 32px; display: flex; gap: 3px; align-items: end; transform: skew(-12deg); }
.brand-mark i { display: block; width: 8px; background: var(--acid); }
.brand-mark i:nth-child(1) { height: 15px; opacity: 0.45; }
.brand-mark i:nth-child(2) { height: 24px; opacity: 0.72; }
.brand-mark i:nth-child(3) { height: 32px; }

.page-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.025);
}
.page-nav a {
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-decoration: none;
  text-transform: uppercase;
}
.page-nav a:hover { color: var(--ink); background: rgba(255,255,255,.045); }
.page-nav a.active { color: #11180a; background: var(--acid); }
.header-meta [data-admin-logout] {
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.header-meta [data-admin-logout]:hover { color: var(--orange); border-color: var(--orange); background: rgba(255,255,255,.045); }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(440px, 100%); margin: 0; padding: 0; }
.login-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0,0,0,.35);
}
.login-brand { width: max-content; margin-bottom: 52px; }
.login-heading h1 { margin: 0; font-size: 42px; letter-spacing: -.05em; }
.login-heading p { margin: 12px 0 28px; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 10px; }
.login-form label { margin-top: 8px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.login-form input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; outline: none;
  color: var(--ink); background: #0c1214;
}
.login-form input:focus { border-color: var(--acid); box-shadow: 0 0 0 3px var(--acid-soft); }
.login-form button {
  min-height: 44px; margin-top: 18px; border: 1px solid var(--acid); border-radius: 8px;
  color: #11180a; background: var(--acid); font-size: 11px; font-weight: 800; letter-spacing: .08em;
}
.login-form button:disabled { cursor: wait; opacity: .6; }
.login-error { margin-bottom: 18px; }

.header-meta { display: flex; align-items: center; gap: 20px; }
.event-label { color: var(--muted); font-size: 11px; letter-spacing: 0.16em; }
.connection-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 10px; letter-spacing: 0.1em; }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.connection-pill.is-online .signal-dot { background: var(--acid); box-shadow: 0 0 12px var(--acid); }
.connection-pill.is-error .signal-dot { background: var(--orange); }

main { width: min(1480px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0 64px; }
.race-hero { position: relative; padding: 10px 0 10px; }
.eyebrow { display: block; margin-bottom: 9px; color: var(--acid); font-size: 10px; font-weight: 700; letter-spacing: 0.19em; }
.virtual-clock { font-size: clamp(29px, 4vw, 59px); line-height: 0.92; letter-spacing: -0.065em; font-weight: 700; }
.virtual-date { margin-top: 12px; color: var(--muted); font-size: 14px; }

.status-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 34px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.metric-card { padding: 18px 20px; background: rgba(16, 23, 25, 0.94); }
.metric-card span { color: var(--muted); font-size: 9px; letter-spacing: 0.15em; }
.metric-card strong { display: block; margin-top: 5px; font-size: clamp(18px, 2vw, 27px); letter-spacing: -0.035em; }
.metric-status strong { color: var(--acid); text-transform: uppercase; }
.progress-track { height: 3px; background: rgba(255,255,255,0.08); margin-top: 18px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--acid), var(--cyan)); transition: width .25s ease; }
.progress-labels { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 22px 70px rgba(0,0,0,.22); }
.control-panel { padding: 15px; margin: 10px 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading h1, .section-heading h2 { margin: 0; letter-spacing: -0.035em; }
.section-heading h1 { font-size: 25px; }
.section-heading h2 { font-size: 20px; }
.section-heading.compact { padding: 22px 22px 17px; border-bottom: 1px solid var(--line); }
.section-heading.compact .eyebrow { margin-bottom: 5px; }
.docs-link { color: var(--muted); text-decoration: none; font-size: 10px; letter-spacing: .12em; }
.docs-link:hover { color: var(--acid); }

.control-grid { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr; gap: 28px; margin-top: 24px; }
.transport-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-content: start; }
.control-button, .speed-presets button, .inline-form button, .team-search button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255,255,255,.035);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  transition: border-color .15s, background .15s, transform .15s;
}
.control-button { min-height: 42px; }
.control-button:hover, .speed-presets button:hover, .inline-form button:hover, .team-search button:hover { border-color: var(--acid); background: var(--acid-soft); }
.control-button:active, .speed-presets button:active { transform: translateY(1px); }
.control-button.primary { color: #11180a; border-color: var(--acid); background: var(--acid); }
.control-button.danger { color: #ff9874; }
.control-button:disabled { cursor: not-allowed; opacity: .32; }

.control-group { display: flex; flex-direction: column; gap: 9px; }
.control-group label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.speed-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.speed-presets button { min-height: 34px; padding: 0 5px; }
.speed-presets button.active { border-color: var(--acid); color: var(--acid); background: var(--acid-soft); }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.inline-form input, .team-search input {
  width: 100%; min-width: 0; height: 39px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px; outline: none;
  color: var(--ink); background: #0c1214;
}
.inline-form input:focus, .team-search input:focus { border-color: var(--acid); box-shadow: 0 0 0 3px var(--acid-soft); }
.inline-form button { padding: 0 12px; font-size: 9px; }
.seek-control { gap: 7px; }

.live-page { padding-top: 34px; }
.live-page-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 2px 28px;
}
.live-page-hero h1 { margin: 0; font-size: clamp(38px, 6vw, 72px); letter-spacing: -.055em; }
.live-page-hero p { max-width: 720px; margin: 14px 0 0; color: var(--muted); line-height: 1.55; }
.live-capture-panel { margin: 0; overflow: hidden; }
.live-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.live-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255,255,255,.035);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .06em;
}
.live-actions button:hover { border-color: var(--cyan); background: rgba(65,217,255,.09); }
.live-actions button:disabled { cursor: not-allowed; opacity: .34; }
.live-capture-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}
.live-capture-grid > div { min-width: 0; padding: 14px 16px; background: rgba(12,18,20,.94); }
.live-capture-grid > div.wide { grid-column: span 2; }
.live-capture-grid span { display: block; color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.live-capture-grid strong { display: block; margin-top: 6px; overflow: hidden; color: var(--cyan); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.live-capture-grid #live-status { color: var(--acid); text-transform: uppercase; }
.live-capture-error { padding: 11px 16px; color: #ffc0a9; background: rgba(255,107,53,.1); font-size: 12px; }
.live-assurance {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(65,217,255,.22);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(65,217,255,.045);
  font-size: 12px;
  line-height: 1.5;
}
.live-assurance strong { color: var(--cyan); font-size: 10px; letter-spacing: .1em; }

.add-event-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .72fr);
  gap: 32px;
  align-items: center;
  padding: 24px;
}
.add-event-panel h2, .events-heading h2 { margin: 0; letter-spacing: -.035em; }
.add-event-panel p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.add-event-panel code { color: var(--cyan); }
.add-event-form label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.add-event-form > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.add-event-form input, .dialog-input, .contest-input {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: #0c1214;
}
.contest-input { max-width: 260px; }
.add-event-form input:focus, .dialog-input:focus, .contest-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(65,217,255,.09); }
.add-event-form button, .event-actions button, .dialog-actions button {
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255,255,255,.04);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .055em;
}
.add-event-form button { color: #071217; border-color: var(--cyan); background: var(--cyan); }
.events-section { margin-top: 34px; }
.events-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding: 0 2px; }
.events-list { display: grid; gap: 14px; }
.events-empty { padding: 70px 24px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.event-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.event-card-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 21px 22px; }
.event-card-header h3 { margin: 8px 0 2px; font-size: 24px; letter-spacing: -.04em; }
.event-card-header p { margin: 0; color: var(--muted); font-size: 11px; }
.runtime-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.runtime-status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.runtime-status.is-running { color: var(--acid); }
.runtime-status.is-running::before { box-shadow: 0 0 9px currentColor; }
.runtime-status.is-error, .has-errors { color: var(--orange) !important; }
.event-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.event-actions button { min-height: 34px; }
.event-actions button:hover, .dialog-actions button:hover { border-color: var(--cyan); background: rgba(65,217,255,.08); }
.event-actions button:disabled { cursor: not-allowed; opacity: .28; }
.event-summary-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.event-summary-grid > div { padding: 13px 16px; background: #0d1416; }
.event-summary-grid span, .event-meta-grid span { display: block; color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.event-summary-grid strong, .event-meta-grid strong { display: block; margin-top: 5px; font-size: 13px; }
.event-lists-table { overflow: auto; border-top: 1px solid var(--line); }
.event-lists-table table { min-width: 1530px; }
.event-lists-table td strong { display: block; }
.event-lists-table td small { display: block; max-width: 340px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.compact-empty { height: 80px; }
.event-runtime-error { padding: 10px 22px; color: #ffc0a9; background: rgba(255,107,53,.09); font-size: 11px; }

.event-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 16px;
  color: var(--ink);
  background: #101719;
  box-shadow: 0 35px 100px rgba(0,0,0,.62);
}
.event-dialog::backdrop { background: rgba(3,7,8,.76); backdrop-filter: blur(5px); }
.event-dialog form { padding: 24px; }
.event-dialog header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.event-dialog h2 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.dialog-close { border: 0; color: var(--muted); background: transparent; font-size: 28px; line-height: 1; }
.event-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0; }
.event-meta-grid > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.event-meta-grid strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-field { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.dialog-input { width: 100%; }
.lists-fieldset { margin: 22px 0 0; padding: 0; border: 0; }
.lists-fieldset legend { margin-bottom: 9px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.config-list-options { display: grid; gap: 7px; }
.config-list-option { display: grid; grid-template-columns: auto 1fr 84px; gap: 11px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.config-list-option > input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--acid); }
.config-list-option strong, .config-list-option small { display: block; }
.config-list-option small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.contest-input { width: 84px; height: 34px; text-align: center; }
.dialog-actions { display: flex; gap: 8px; margin-top: 24px; }
.dialog-actions button { min-height: 38px; }
.dialog-spacer { flex: 1; }
.dialog-actions .primary-action { color: #11180a; border-color: var(--acid); background: var(--acid); }
.dialog-actions .danger-action { color: #ff9874; }

.hero-action {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--acid);
  border-radius: 8px;
  color: #11180a;
  background: var(--acid);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .07em;
}
.races-list-panel { overflow: hidden; }
.race-table-heading { padding: 22px 22px 8px; }
.race-table-wrap { overflow: auto; }
.race-table { min-width: 920px; }
.race-table td strong { font-size: 14px; }
.race-id { color: var(--cyan); }
.race-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.race-row-actions button, .race-row-actions .race-open-action {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255,255,255,.035);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .05em;
  text-decoration: none;
}
.race-row-actions .race-open-action { color: #11180a; border-color: var(--acid); background: var(--acid); }
.race-row-actions .danger-action { color: #ff9874; }
.race-dialog { width: min(920px, calc(100% - 28px)); }
.race-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 22px; }
.race-fields-grid label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.race-fields-grid label > small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.race-event-field { grid-column: 1 / -1; }
.race-enabled-field { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 12px; }
.race-enabled-field input { width: 17px; height: 17px; accent-color: var(--acid); }
.race-sources-fieldset code { color: var(--cyan); }
.fieldset-help { margin: -2px 0 12px; color: var(--muted); font-size: 10px; }
.race-source-options { display: grid; gap: 10px; }
.race-source { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.022); }
.race-source h3 { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 13px 15px; border-bottom: 1px solid var(--line); font-size: 12px; }
.race-group-options { display: grid; }
.race-group-option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 15px; border-top: 1px solid rgba(255,255,255,.045); font-size: 11px; line-height: 1.4; }
.race-group-option:first-child { border-top: 0; }
.race-group-option:hover { background: var(--acid-soft); }
.race-group-option input { width: 16px; height: 16px; accent-color: var(--acid); }
.race-group-option small { display: block; margin-top: 3px; color: var(--orange); font-size: 9px; }
.race-group-option.is-absent { background: rgba(255,107,53,.045); }
.race-group-option.race-all-categories { color: var(--acid); background: rgba(200,255,61,.045); font-weight: 750; }
.race-group-option.race-all-categories small { color: var(--muted); font-weight: 500; }
.no-known-groups { padding: 19px 15px; color: var(--muted); font-size: 11px; }
.compact-source-empty { padding: 34px 18px; }
.mapping-badge { display: inline-flex; padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.mapping-badge.is-complete { color: var(--acid); border-color: rgba(200,255,61,.35); background: rgba(200,255,61,.07); }
.mapping-badge.is-invalid { color: var(--orange); border-color: rgba(255,107,53,.4); background: rgba(255,107,53,.08); }
.source-mapping { padding: 15px; border-top: 1px solid var(--line); background: rgba(65,217,255,.025); }
.source-mapping-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.source-mapping-heading > span { color: var(--cyan); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.source-mapping-heading > small { color: var(--muted); font-size: 9px; }
.source-mapping-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.source-mapping-grid label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; letter-spacing: .07em; text-transform: uppercase; }
.mapping-input { width: 100%; }
.mapping-warning { display: block; margin: 5px 0 0; color: var(--orange); font-size: 9px; }
.field-samples { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(65,217,255,.16); }
.field-samples .source-mapping-heading { margin-bottom: 8px; }
.field-samples table { width: max-content; min-width: 100%; font-size: 10px; }
.field-samples th, .field-samples td { max-width: 220px; padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-samples th { color: var(--cyan); font-size: 8px; letter-spacing: .05em; }
.field-samples-empty { margin-top: 14px; padding: 12px; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); font-size: 10px; }
.race-preview { margin-top: 20px; padding: 15px; border: 1px solid rgba(65,217,255,.3); border-radius: 10px; background: rgba(65,217,255,.035); }
.preview-source { margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #0d1416; }
.preview-source > h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 12px 14px; font-size: 11px; }
.preview-source > .mapping-warning { padding: 0 14px 10px; }
.preview-group { border-top: 1px solid var(--line); }
.preview-group h4 { margin: 0; padding: 10px 14px; color: var(--muted); font-size: 10px; font-weight: 650; }
.preview-group table { min-width: 560px; }
.preview-group th, .preview-group td { padding: 9px 14px; }
.preview-empty { color: var(--muted); text-align: center; }
.dialog-error { margin-top: 20px; padding: 12px 14px; border: 1px solid rgba(255,107,53,.5); border-radius: 8px; color: #ffc0a9; background: rgba(255,107,53,.1); font-size: 12px; line-height: 1.45; }
.dialog-error:focus { outline: 2px solid rgba(255,107,53,.45); outline-offset: 2px; }

.race-monitor-page { display: grid; gap: 18px; }
.race-monitor-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 6px 0 12px; }
.race-monitor-hero h1 { margin: 0; font-size: clamp(30px, 4vw, 58px); line-height: .98; letter-spacing: -.055em; }
.race-monitor-hero p { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.monitor-back-link { display: inline-block; margin-bottom: 24px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .12em; text-decoration: none; }
.monitor-back-link:hover { color: var(--acid); }
.monitor-actions { display: flex; align-items: center; gap: 10px; padding-bottom: 4px; }
.monitor-actions .hero-action { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.monitor-actions .secondary-action { color: var(--acid); background: transparent; }
.monitor-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.monitor-kpis article { min-height: 112px; padding: 20px; background: rgba(16,23,25,.96); }
.monitor-kpis span, .monitor-kpis small { display: block; color: var(--muted); font-size: 9px; letter-spacing: .11em; }
.monitor-kpis strong { display: block; margin: 8px 0 5px; color: var(--acid); font-size: clamp(22px, 2.5vw, 34px); letter-spacing: -.04em; }
.monitor-panel { overflow: hidden; }
.monitor-heading { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.monitor-tabs { display: flex; gap: 5px; }
.monitor-tabs button { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 9px; font-weight: 800; letter-spacing: .07em; }
.monitor-tabs button[aria-selected="true"] { color: #11180a; border-color: var(--acid); background: var(--acid); }
.monitor-filters { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 12px; padding: 15px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.018); }
.monitor-filters label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.playback-control-bar { display: grid; grid-template-columns: auto minmax(150px, 220px) auto 1fr; align-items: end; gap: 14px; padding: 16px 22px; border-top: 1px solid var(--line); background: rgba(255,255,255,.018); }
.playback-control-bar label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 8px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.playback-control-bar p { align-self: center; margin: 0; color: var(--muted); font-size: 11px; }
.playback-kpis { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.monitor-table-wrap { max-height: min(62vh, 720px); overflow: auto; }
.monitor-table { min-width: 900px; }
.monitor-table td { vertical-align: top; }
.monitor-table td > small, .monitor-table td > strong + small { display: block; max-width: 420px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.monitor-table time { color: var(--cyan); font-weight: 700; }
.warning-text { color: var(--orange) !important; }
.group-diagnostic-detail { margin: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 9px; background: rgba(7,12,18,.72); }
.group-member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .55rem; }
.group-member-grid article { display: grid; gap: .2rem; padding: .7rem; border-left: 3px solid rgba(200,255,61,.55); background: rgba(255,255,255,.035); }
.group-member-grid article span, .group-member-grid article small { color: var(--muted); font-size: .78rem; }
.is-highlighted-group { background: rgba(255,193,74,.12) !important; box-shadow: inset 3px 0 #ffc14a; }
.table-link { border: 0; background: transparent; color: var(--acid); font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
.provenance-details summary { cursor: pointer; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.provenance-details[open] { min-width: 300px; }
.provenance-details dl { display: grid; grid-template-columns: 58px 1fr; gap: 5px 9px; margin: 10px 0 0; font-size: 9px; }
.provenance-details dt { color: var(--muted); }
.provenance-details dd { margin: 0; overflow-wrap: anywhere; }
.is-new-crossing { animation: new-crossing 2.4s ease-out; }
@keyframes new-crossing { from { background: rgba(200,255,61,.28); box-shadow: inset 4px 0 0 var(--acid); } to { background: transparent; box-shadow: inset 0 0 0 transparent; } }

.public-lap-warning { display: block; margin-top: 4px; color: var(--orange); font-size: 9px; white-space: nowrap; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr); gap: 18px; margin-top: 18px; }
.groups-panel, .detail-panel { min-height: 450px; overflow: hidden; }
.table-wrap { overflow: auto; max-height: 470px; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; color: var(--muted); background: rgba(255,255,255,.02); font-size: 9px; letter-spacing: .12em; text-align: left; text-transform: uppercase; position: sticky; top: 0; }
td { padding: 13px 18px; border-top: 1px solid rgba(255,255,255,.055); font-size: 13px; }
th.numeric, td.numeric { text-align: right; }
#groups-body tr { cursor: pointer; transition: background .15s; }
#groups-body tr:hover, #groups-body tr.selected { background: var(--acid-soft); }
#groups-body tr.target-current-group {
  background: linear-gradient(90deg, rgba(200, 255, 61, .22), rgba(200, 255, 61, .07));
  box-shadow: inset 4px 0 0 var(--acid);
}
#groups-body tr.target-current-group.selected {
  outline: 1px solid rgba(200, 255, 61, .55);
  outline-offset: -1px;
}
.group-code { color: var(--acid); font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.target-group-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 5px;
  border-radius: 4px;
  color: #11180a;
  background: var(--acid);
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .08em;
  vertical-align: 1px;
}
.empty-cell { height: 180px; color: var(--muted); text-align: center; }
.updated-label { color: var(--muted); font-size: 10px; }
.groups-heading-actions { display: flex; align-items: flex-end; gap: 14px; }
.group-filter-form { display: grid; grid-template-columns: auto 62px; align-items: center; gap: 6px; }
.group-filter-form label { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.group-filter-form input {
  width: 62px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  color: var(--ink);
  background: #0c1214;
  text-align: right;
}
.group-filter-form input:focus { border-color: var(--acid); box-shadow: 0 0 0 3px var(--acid-soft); }
.copy-groups-button {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255,255,255,.035);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
}
.copy-groups-button:hover:not(:disabled) { border-color: var(--acid); background: var(--acid-soft); }
.copy-groups-button:disabled { cursor: not-allowed; opacity: .45; }
.copy-groups-button.is-copied { border-color: var(--acid); color: #11180a; background: var(--acid); }
.size-badge { min-width: 38px; padding: 7px 9px; border-radius: 8px; color: #101509; background: var(--acid); font-weight: 800; text-align: center; }
.detail-summary { padding: 20px 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 12px; }
.detail-summary div { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.detail-summary span { display: block; color: var(--muted); font-size: 9px; letter-spacing: .1em; }
.detail-summary strong { display: block; margin-top: 5px; }
.detail-summary.muted-copy { display: block; color: var(--muted); line-height: 1.6; }
.members-wrap { max-height: 340px; overflow: auto; border-top: 1px solid var(--line); }
.members-table td { padding: 10px 18px; }
.member-name { display: block; max-width: 170px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 10px; margin-top: 3px; }
.members-table tr.member-inactive { opacity: .58; }
.member-status { white-space: nowrap; font-size: 10px; font-weight: 700; }
.member-status.is-active { color: var(--acid); }
.member-status.is-inactive { color: var(--muted); }

.lower-grid { grid-template-columns: minmax(320px, .85fr) minmax(0, 1.65fr); }
.team-panel, .participant-history-panel, .crossings-panel { min-height: 350px; overflow: hidden; }
.crossings-row { margin-top: 18px; }
.team-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 18px 22px; }
.team-search button { padding: 0 17px; }
.team-results { margin: -8px 22px 15px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.team-results button { width: 100%; padding: 10px 12px; display: flex; justify-content: space-between; gap: 12px; border: 0; border-top: 1px solid var(--line); color: var(--ink); background: #0d1416; text-align: left; }
.team-results button:first-child { border-top: 0; }
.team-results button:hover { background: var(--acid-soft); }
.team-results small { color: var(--muted); }
.team-empty { margin: 0 22px 22px; padding: 35px 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; line-height: 1.5; }
.team-card { padding: 2px 22px 22px; }
.team-identity { display: flex; align-items: end; justify-content: space-between; gap: 15px; padding: 5px 0 18px; }
.team-number { color: var(--acid); font-size: 40px; font-weight: 800; letter-spacing: -.05em; }
.team-name { color: var(--muted); font-size: 12px; text-align: right; }
.team-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.team-stat { padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
.team-stat span { display: block; color: var(--muted); font-size: 9px; letter-spacing: .09em; }
.team-stat strong { display: block; margin-top: 5px; font-size: 16px; }

.crossing-feed { list-style: none; margin: 0; padding: 10px 22px 20px; max-height: 320px; overflow: auto; }
.crossing-feed li { display: grid; grid-template-columns: 86px 75px 1fr 66px; gap: 12px; align-items: center; min-height: 39px; border-bottom: 1px solid rgba(255,255,255,.055); font-size: 12px; }
.crossing-feed time { color: var(--muted); }
.feed-team { color: var(--acid); font-weight: 700; }
.feed-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.feed-lap { color: var(--muted); text-align: right; }
.crossing-feed .empty-feed { display: block; padding: 40px 0; color: var(--muted); text-align: center; }
.participant-history-panel { overflow: hidden; }
.participant-history-table { min-width: 560px; }

.error-banner { margin: 0 0 18px; padding: 13px 16px; border: 1px solid rgba(255,107,53,.5); border-radius: 9px; color: #ffc0a9; background: rgba(255,107,53,.1); font-size: 13px; }
footer { width: min(1480px, calc(100% - 36px)); margin: 0 auto; padding: 22px 0 38px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; letter-spacing: .14em; }

@media (max-width: 1050px) {
  .control-grid { grid-template-columns: 1fr 1fr; }
  .seek-control { grid-column: 1 / -1; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-panel { min-height: 320px; }
  .lower-grid { grid-template-columns: 1fr 1fr; }
  .live-capture-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .event-summary-grid { grid-template-columns: repeat(3, 1fr); }
  .monitor-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-filters { grid-template-columns: 1fr 1fr; }
  .participant-filter { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .topbar { height: 66px; padding: 0 16px; }
  .event-label { display: none; }
  .topbar .brand small { display: none; }
  .page-nav a { padding: 7px 8px; font-size: 8px; }
  main { width: min(100% - 24px, 1480px); padding-top: 28px; }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .control-grid, .lower-grid { grid-template-columns: 1fr; }
  .seek-control { grid-column: auto; }
  .transport-controls { grid-template-columns: repeat(2, 1fr); }
  .speed-presets { grid-template-columns: repeat(3, 1fr); }
  .live-capture-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-actions { justify-content: flex-start; }
  .live-page-hero { display: block; }
  .live-page-hero .docs-link { display: inline-block; margin-top: 18px; }
  .live-assurance { grid-template-columns: 1fr; gap: 7px; }
  .add-event-panel { grid-template-columns: 1fr; gap: 20px; }
  .event-card-header { display: block; }
  .event-actions { justify-content: flex-start; margin-top: 17px; }
  .event-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .event-meta-grid { grid-template-columns: 1fr; }
  .config-list-option { grid-template-columns: auto 1fr; }
  .contest-input { grid-column: 2; width: 100%; }
  .dialog-actions { flex-wrap: wrap; }
  .race-fields-grid { grid-template-columns: 1fr; }
  .race-event-field, .race-enabled-field { grid-column: auto; }
  .source-mapping-grid { grid-template-columns: 1fr; }
  .race-monitor-hero, .monitor-heading { align-items: flex-start; flex-direction: column; }
  .monitor-actions { width: 100%; flex-wrap: wrap; }
  .monitor-tabs { width: 100%; overflow-x: auto; }
  .monitor-kpis, .monitor-filters { grid-template-columns: 1fr; }
  .playback-control-bar { grid-template-columns: 1fr; align-items: stretch; }
  .participant-filter { grid-column: auto; }
  .dialog-spacer { display: none; }
  .virtual-clock { font-size: 58px; }
  .control-panel { padding: 20px 16px; }
  .groups-panel { min-height: 380px; }
  .groups-panel .section-heading { align-items: flex-start; flex-direction: column; }
  .groups-heading-actions { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  th, td { padding-left: 12px; padding-right: 12px; }
  .crossing-feed li { grid-template-columns: 70px 58px 1fr; }
  .feed-lap { display: none; }
  footer { flex-direction: column; }
}
