:root {
  /* This page is light-only — without this, browsers/OSes in dark mode
     render native controls (mainly <select> dropdowns) with dark system
     chrome even though every custom-styled element here stays light,
     producing mismatched/unreadable colors on those controls. */
  color-scheme: light;
  --bg: #f4faf5;
  --surface: #ffffff;
  --fg: #1d2835;
  --muted: #647181;
  --border: #d7dee7;
  /* Brand green + gold — tuned from the original values so text set in
     these colors reads on the dark canvas hero image too (see body{}),
     not just on white cards. Every rule below that already referenced
     --accent/--action keeps working unchanged. */
  --accent: #2f8f42;
  --accent-deep: #0d3b22;
  --accent-soft: #e7f5ea;
  --action: #ffc93c;
  --action-deep: #8a5b00;
  --success: #157a48;
  --success-soft: #e5f6ee;
  --warning: #a3660a;
  --warning-soft: #fff4db;
  --danger: #a53030;
  --danger-soft: #fdeaea;
  --pending: #596675;
  --pending-soft: #edf1f5;
  --shadow: rgba(0, 0, 0, 0.34);
  --glass: rgba(4, 18, 31, 0.62);
  --glass-border: rgba(255, 255, 255, 0.22);
  --card-border-color: #2f8f42;
  /* Dark-canvas tokens: body's real background is the hero image (near-
     black navy), not --bg — anything sitting loose on it (not inside a
     white .card) needs these instead of --fg/--muted. */
  --ink: #0a0f1a;
  --ink-2: #111b2e;
  --tx-on-dark: #f3f6fb;
  --tx-on-dark-soft: rgba(243, 246, 251, 0.66);
  --line-on-dark: rgba(255, 255, 255, 0.14);
  --font-display: "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
  --fs-body: 15px;
  --fs-meta: 12px;
  --gap-xs: 8px;
  --gap-sm: 12px;
  --gap-md: 20px;
  --gap-lg: 32px;
  --radius: 10px;
  --radius-lg: 16px;
  --container: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  position: relative;
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  background:
    var(--bg)
    url("/imagenes/background_irteerak.jpg")
    center / cover no-repeat fixed;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}
/* Faint chevron / track-line motif over the hero image, echoing the same
   diagonal shapes already in background_image_sin_logo.png — kept quiet,
   fixed so it doesn't scroll with long pages. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(115deg, transparent 0 64px, color-mix(in oklch, var(--accent) 55%, transparent) 64px 66px, transparent 66px 130px),
    repeating-linear-gradient(115deg, transparent 0 64px, color-mix(in oklch, var(--action) 45%, transparent) 132px 134px, transparent 134px 260px);
}
body > * { position: relative; z-index: 1; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { text-wrap: pretty; }
h1, h2, h3 { margin-top: 0; font-family: var(--font-display); }
/* Since the sidebar redesign, the dark hero canvas is contained inside
   .sidebar only — .main (where every h1 on these pages lives) has the
   light --bg background, so h1 needs dark text like everything else in
   .main, not the --tx-on-dark used inside the sidebar itself. */
h1 { color: var(--fg); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.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;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 30;
  /* Solid brand blue, not a translucent-white blur: the IRTEERA_LIVE.png
     logo's wordmark is white and reads as invisible against a light
     header, and a solid dark bar matches the hero canvas underneath. */
  background: linear-gradient(180deg, var(--ink-2), var(--ink) 70%);
  border-bottom: 3px solid var(--action);
  box-shadow: 0 4px 18px var(--shadow);
}
.admin-header-inner {
  width: min(100% - 32px, var(--container));
  min-height: 68px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand img { width: 178px; }
.admin-brand span {
  padding-left: 12px;
  border-left: 1px solid var(--line-on-dark);
  color: var(--tx-on-dark-soft);
  font-size: 13px;
  font-weight: 700;
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.user-email { color: var(--tx-on-dark-soft); font-size: 13px; }
.admin-header .btn-ghost { color: var(--tx-on-dark); border-color: var(--line-on-dark); }
.admin-header .btn-ghost:hover { border-color: var(--tx-on-dark); background: rgba(255, 255, 255, 0.12); }
/* Same dark-canvas issue as the header: these "back" links sit directly on
   the page background image, not inside a .card, so the default dark-blue
   .btn-ghost text is low-contrast here too. */
.setup-container > .btn-ghost,
.columns-container > .btn-ghost {
  color: var(--tx-on-dark);
  border-color: var(--line-on-dark);
}
.setup-container > .btn-ghost:hover,
.columns-container > .btn-ghost:hover {
  border-color: var(--tx-on-dark);
  background: rgba(255, 255, 255, 0.12);
}

.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}
.page {
  padding-block: clamp(28px, 5vw, 56px);
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
/* --action (gold) reads great on the sidebar's dark canvas, which is
   where this color choice came from — but .eyebrow sits in the light
   .main area, where gold-on-near-white has ~1.4:1 contrast (need
   4.5:1). --accent (brand blue) is already proven at this exact
   contrast job elsewhere in this stylesheet. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  background: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 16px; height: 2px; background: var(--accent); display: block; }
.page-heading h1 {
  margin-bottom: 6px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}
/* Same .main-is-light reasoning as h1 above. */
.lead { margin: 0; color: var(--muted); max-width: 62ch; font-size: 16px; }

.card {
  border: 0;
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 18px 40px -22px rgba(5, 10, 30, 0.55);
}
/* Alternate the accent rail between brand blue and gold across stacked
   cards so a long page of white cards on the dark canvas doesn't read as
   one undifferentiated block — purely decorative, no markup changes. */
.dashboard-grid + .dashboard-grid .card,
.dashboard-grid:nth-of-type(2n) .card {
  border-top-color: var(--action);
}
/* Quick-nav card (switch between races) — tinted so it reads as
   navigation, not another content card identical to the ones below it. */
.race-switcher-card {
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  border-top: 4px solid var(--accent);
  background: var(--accent-soft);
}
.race-switcher-card .section-heading h2 { color: var(--accent-deep); }
.card-section { padding: 26px; }
.card-section + .card-section { border-top: 1px solid var(--border); }
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.section-heading h2 { margin-bottom: 3px; font-size: 20px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field label { color: var(--fg); font-size: 13px; font-weight: 700; }
.field-hint { color: var(--muted); font-size: 12px; }
.control {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
}
.control:hover { border-color: var(--muted); }
.control:focus-visible,
.btn:focus-visible,
.check-card:focus-within {
  outline: 3px solid color-mix(in oklch, var(--action) 74%, transparent);
  outline-offset: 2px;
}
textarea.control { min-height: 96px; resize: vertical; }
input[type="file"].control { padding: 9px; }

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  font-weight: 750;
  transition: transform 100ms ease, border-color 140ms ease, background-color 140ms ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.btn-primary:hover { background: color-mix(in oklch, var(--accent) 88%, black); }
.btn-action { border-color: var(--action); background: var(--action); color: var(--accent-deep); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn-danger { color: var(--danger); }
.btn:disabled { cursor: not-allowed; opacity: 0.54; }

.checkbox-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check-card {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
}
.check-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.check-card input { min-width: 24px; min-height: 24px; accent-color: var(--accent); }

.repeat-list { display: flex; flex-direction: column; gap: 10px; }
.repeat-row {
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
/* Prize rules need more fields than the default 2-field + button
   .repeat-row grid (label, accepted values, top N, split-by-sex, delete). */
.prize-rule-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
}
.prize-rule-row > .field { flex: 1 1 200px; min-width: 0; }
.prize-rule-row > .field:has([data-prize-top]) { flex: 0 0 90px; }
.prize-rule-row .check-card { white-space: nowrap; }
/* The value picker gets its own full-width line below the basic fields:
   a race can have thousands of distinct values, so the list scrolls
   inside a bounded box instead of stretching the rule card. */
.prize-rule-row > .prize-values-field { flex: 1 1 100%; order: 10; }
.prize-picker { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.prize-picker-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.prize-picker-search { flex: 1 1 200px; min-width: 0; }
.prize-picker-count { margin-left: auto; font-weight: 600; color: var(--accent-deep); }
.prize-value-checklist {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #fff);
}
.prize-value-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.prize-value-item:last-child { border-bottom: 0; }
.prize-value-item:has(input:checked) { background: var(--accent-soft); }
.prize-value-item input { min-width: 18px; min-height: 18px; accent-color: var(--accent); }
.prize-value-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.prize-value-reason { font-size: 12px; color: var(--muted, #6b7280); }
.prize-value-count { font-size: 12px; color: var(--muted, #6b7280); min-width: 28px; text-align: right; }
.prize-rule-row > [data-remove-prize-rule],
.prize-rule-row > [data-open-unreviewed] { order: 5; }
/* Checkpoint rows (3 fields + delete) also don't fit the default
   1fr/150px/auto grid — without this the MyLaps-column select was
   landing in the wide 1fr slot meant for a text field, so it rendered
   nearly the whole row's width for a couple of characters of text. */
.checkpoint-row { grid-template-columns: 170px 1fr 130px auto; }
.checkpoint-correction-row { grid-template-columns: 1fr 130px 140px auto; }

.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--surface) 95%, transparent);
  box-shadow: 0 -8px 24px var(--shadow);
  backdrop-filter: blur(12px);
}
.action-group { display: flex; gap: 10px; }
.form-status { min-height: 20px; color: var(--muted); font-size: 13px; }
.form-status.error { color: var(--danger); }
.form-status.success { color: var(--success); }

/* ---- race pick lists (resultados.html search, crear-carrera.html browser) ---- */
.race-pick-list { display: grid; gap: 8px; margin-top: 12px; }
.race-pick-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; }
.race-pick-row:hover { border-color: var(--accent); }
.race-pick-row .name { font-weight: 700; }
.race-pick-row .meta { color: var(--muted); font-size: 13px; }
.race-pick-row .finalized-badge { color: var(--danger); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; }
.race-pick-row .hidden-badge { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.year-group { margin-bottom: 18px; }
.year-toggle { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--accent-soft); border: 0; padding: 12px 16px; border-radius: var(--radius); cursor: pointer; font-weight: 700; color: var(--accent-deep); }
.year-toggle .count { font-weight: 400; color: var(--muted); }
.year-races { display: none; padding-top: 10px; gap: 8px; }
.year-races.open { display: grid; }

.login-page {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(250px, 0.85fr);
}
.login-visual {
  position: relative;
  display: flex;
  min-height: 100svh;
  align-items: flex-end;
  padding: clamp(32px, 6vw, 80px);
  overflow: hidden;
  background: var(--accent) url("/imagenes/background_image_sin_logo.png") center / cover no-repeat;
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 45, 80, 0.18), rgba(0, 35, 64, 0.82));
}
.login-brandmark {
  position: absolute;
  top: clamp(24px, 6vh, 54px);
  left: 50%;
  transform: translateX(-50%);
  width: min(72%, 360px);
  background: transparent;
}
.login-brandmark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.login-message { position: relative; z-index: 1; max-width: 560px; color: var(--surface); }
.login-message img { width: 220px; margin-bottom: 28px; }
.login-message h1 { margin-bottom: 14px; font-size: clamp(36px, 6vw, 68px); line-height: 1.02; letter-spacing: -0.035em; color: var(--surface); }
.login-message p { margin: 0; max-width: 46ch; color: color-mix(in oklch, var(--surface) 78%, transparent); font-size: 17px; }
.login-panel {
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--surface);
}
.login-box { width: min(100%, 420px); }
.login-box h2 { margin-bottom: 8px; font-size: 30px; }
.login-box > p { margin: 0 0 28px; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-note {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.7fr); gap: 20px; }
.race-card {
  overflow: hidden;
  border: 0;
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 18px 40px -22px rgba(5, 10, 30, 0.55);
}
.race-card-top {
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--gap-xs);
  padding: 24px;
}
.race-card-top h2 {
  margin: 0;
  color: var(--accent-deep);
  font-size: 28px;
}
.race-card-top p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}
.race-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.meta-item { padding: 18px; border-right: 1px solid var(--border); }
.meta-item:last-child { border-right: 0; }
.meta-item span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; font-family: var(--font-mono); letter-spacing: 0.05em; }
.meta-item strong { display: block; margin-top: 4px; font-family: var(--font-mono); }
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 18px; border-top: 1px solid var(--border); }
.quick-actions .btn {
  border-color: var(--border);
  background: var(--surface);
  color: var(--fg);
  font-weight: 750;
}
.quick-actions .btn:hover { border-color: var(--accent); color: var(--accent); }
.quick-actions .btn-action {
  border-color: var(--action);
  background: var(--action);
  color: var(--action-deep);
  font-weight: 800;
}
.quick-actions .btn-action:hover { background: color-mix(in oklch, var(--action) 88%, white); }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--pending-soft);
  color: var(--pending);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.status-badge.published { background: var(--success-soft); color: var(--success); }
.status-badge.draft { background: var(--pending-soft); color: var(--pending); }
.side-list { display: flex; flex-direction: column; }
.side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.side-item:last-child { border-bottom: 0; }
.side-item span { color: var(--muted); font-size: 13px; }
.side-item strong { font-family: var(--font-mono); }

/* ---- stat tiles (participantes.html) ---- */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-tile { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 14px 30px -20px rgba(5, 10, 30, 0.5); }
.stat-tile .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 8px; }
.stat-tile .v { font-family: var(--font-mono); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-tile .v small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.stat-tile.ok .v { color: var(--success); }
.stat-tile.warn .v { color: var(--warning); }
.cat-pill { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--bg); color: var(--muted); }

/* ---- connection / hardware rows (cronometraje.html) ---- */
.conn-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.conn-row:last-child { border-bottom: 0; }
.conn-row .lhs { display: flex; align-items: center; gap: 14px; }
.conn-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.conn-dot.ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.conn-dot.pend { background: var(--pending); box-shadow: 0 0 0 4px var(--pending-soft); }
.conn-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.conn-row .name { font-weight: 700; font-size: 14px; }
.conn-row .sub { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }

.assign-row { display: grid; grid-template-columns: 28px 1fr 24px 1fr; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.assign-row:last-child { border-bottom: 0; }
.assign-row .cp-num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.assign-row .cp-name { font-weight: 700; font-size: 13.5px; }
.assign-row .arrow { color: var(--muted); text-align: center; }

.radio-pair { display: flex; gap: 8px; }
.radio-pill { flex: 1; text-align: center; padding: 10px; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.radio-pill.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }

/* ---- sidebar navigation shell (panel-carrera / participantes /
   cronometraje / crear-carrera / columns-setup) — reuses the same
   dark-canvas + brand/gold tokens as .admin-header above, just laid
   out as a persistent side rail instead of a top bar. ---- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100svh; }
.sidebar {
  background: linear-gradient(180deg, var(--ink-2), var(--ink) 75%);
  color: var(--tx-on-dark);
  display: flex;
  flex-direction: column;
  border-right: 3px solid var(--action);
  position: sticky;
  top: 0;
  height: 100svh;
  overflow-y: auto;
}
.sb-brand { display: flex; align-items: center; padding: 20px 20px 16px; border-bottom: 1px solid var(--line-on-dark); }
/* White backing plate — the logo's wordmark is dark, needs contrast
   against the sidebar's dark canvas. */
.sb-brand img { width: 140px; background: var(--surface); border-radius: 8px; padding: 8px 10px; }

.sb-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--tx-on-dark-soft);
  font-size: 13.5px;
  font-weight: 650;
}
.sb-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sb-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--tx-on-dark); }
.sb-link.active { background: var(--surface); color: var(--accent-deep); font-weight: 800; }
.sb-link.active svg { opacity: 1; }
.sb-link .badge { margin-left: auto; padding: 2px 6px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-family: var(--font-mono); font-size: 10px; font-weight: 800; }
.sb-group-label { padding: 16px 12px 6px; color: var(--tx-on-dark-soft); font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }

.sb-foot { padding: 14px 20px; border-top: 1px solid var(--line-on-dark); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sb-foot .user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot .btn-ghost { flex-shrink: 0; min-height: 32px; padding: 6px 10px; color: var(--tx-on-dark); border-color: var(--line-on-dark); font-size: 11.5px; }
.sb-foot .btn-ghost:hover { border-color: var(--tx-on-dark); background: rgba(255, 255, 255, 0.12); }

.main { background: var(--bg); overflow-y: auto; min-width: 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 3px solid var(--action); }
}

/* ---- honest "not built yet" empty state ---- */
.empty-state {
  padding: 40px 28px;
  text-align: center;
  color: var(--muted);
}
.empty-state .glyph { font-size: 28px; margin-bottom: 10px; }
.empty-state h3 { margin: 0 0 6px; color: var(--fg); font-size: 16px; }
.empty-state p { margin: 0 auto; max-width: 48ch; font-size: 13.5px; }

@media (max-width: 640px) {
  body { background-attachment: scroll; }
  body::before { position: absolute; }
}

@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 28svh; padding: 32px; }
  .login-message h1 { font-size: 32px; }
  .login-message p { display: none; }
  .login-message img { width: 174px; margin-bottom: 16px; }
  .login-panel { min-height: 66svh; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .checkbox-grid { grid-template-columns: repeat(2, 1fr); }
  .race-card-top h2 { font-size: 22px; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .assign-row { grid-template-columns: 24px 1fr; row-gap: 6px; }
  .assign-row .arrow { display: none; }
}

@media (max-width: 580px) {
  .admin-header-inner,
  .container { width: min(100% - 20px, var(--container)); }
  .admin-header-inner { min-height: 56px; }
  .admin-brand img { width: 90px; }
  .admin-brand span,
  .user-email { display: none; }
  .page { padding-block: clamp(16px, 4vw, 32px); }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .grid-2,
  .grid-3,
  .checkbox-grid { grid-template-columns: 1fr; }
  .repeat-row { grid-template-columns: 1fr 110px auto; }
  .card-section { padding: 16px; }
   .form-actions { padding: 12px; gap: 8px; align-items: stretch; flex-direction: column; }
  .action-group { width: 100%; }
  .action-group .btn { flex: 1; }
  .check-card { min-height: 44px; padding: 8px 10px; font-size: 12px; }
  .control { min-height: 44px; padding: 8px 10px; }
  .btn { min-height: 44px; padding: 8px 12px; }
  .section-heading h2 { font-size: 17px; }
  .login-visual { min-height: 30svh; }
  .login-panel { min-height: 70svh; padding: 20px 16px; align-items: start; }
  .login-box h2 { font-size: 24px; }
  .race-card-top { min-height: 120px; padding: 16px; }
  .race-card-top h2 { font-size: 20px; }
  .race-card-top p { font-size: 13px; }
  .race-meta { grid-template-columns: 1fr; }
  .meta-item { border-right: 0; border-bottom: 1px solid var(--border); }
  .meta-item:last-child { border-bottom: 0; }
  .quick-actions { grid-template-columns: 1fr; }
  .side-item { padding: 12px 0; }
  .status-badge { font-size: 10px; padding: 4px 7px; }
  .stat-row { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .admin-header-inner { min-height: 48px; gap: 8px; }
  .admin-brand img { width: 72px; }
  .page { padding-block: 12px; }
  .container { width: min(100% - 16px, var(--container)); }
  .card-section { padding: 14px; }
  .login-panel { padding: 16px 12px; }
  .login-box { width: 100%; }
  .login-box h2 { font-size: 20px; }
  .login-visual { min-height: 24svh; padding: 20px; }
  .login-message h1 { font-size: 26px; }
  .login-brandmark { width: 60%; padding: 8px 12px; }
  .form-actions { padding: 10px; flex-direction: column; }
  .action-group { width: 100%; flex-direction: column; }
  .action-group .btn { width: 100%; }
  .form-status { font-size: 12px; }
  .eyebrow { font-size: 10px; }
  .page-heading { margin-bottom: 16px; }
  .repeat-row { grid-template-columns: 1fr; }
  .repeat-row .field:last-of-type input { margin-bottom: 8px; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .check-card { font-size: 13px; padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ── Race editor tabs (crear-carrera.html) ──────────────────────────── */
.race-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px -22px rgba(5, 10, 30, 0.55);
  margin-bottom: 20px;
}
.race-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.race-tab:hover { background: var(--bg); color: var(--fg); }
.race-tab.active { background: var(--accent); color: #fff; }
.race-tab[disabled] { opacity: 0.5; cursor: not-allowed; }
.race-tab[disabled]:hover { background: transparent; color: var(--muted); }
.race-panel { display: none; }
.race-panel.active { display: block; }
.race-panel-locked {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
#race-form.is-finalized .race-panel .control,
#race-form.is-finalized .race-panel select,
#race-form.is-finalized .race-panel input,
#race-form.is-finalized .race-panel button,
#race-form.is-finalized .race-panel textarea {
  pointer-events: none;
  opacity: 0.55;
}
@media (max-width: 720px) {
  .race-tabbar { gap: 2px; }
  .race-tab { padding: 8px 10px; font-size: 12px; }
}
