/* ============================================================================
   Score Management · Tema base
   Tokens tomados del boceto del dashboard (logo original).
   ========================================================================== */

:root {
  --sm-red: #98141A; --sm-red-dark: #7A0F14; --sm-red-soft: #F7E6E7;
  --sm-charcoal: #575756; --sm-gray: #9D9D9C; --sm-ink: #242424;
  --bg: #F4F4F5; --surface: #FFFFFF; --text: #242424; --muted: #6B6B6A; --line: #E4E4E5;
  --side: #242424; --side-text: #D9D9D9; --side-hover: #ffffff14; --side-active: #98141A;
  --ok: #2E7D4F; --warn: #C98A12; --danger: #B3261E;
  --font: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0,0,0,0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161616; --surface: #202020; --text: #EFEFEF; --muted: #A0A0A0; --line: #333;
    --side: #0F0F0F; --sm-red-soft: #3A1215; --shadow: 0 2px 10px rgba(0,0,0,0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #161616; --surface: #202020; --text: #EFEFEF; --muted: #A0A0A0; --line: #333;
  --side: #0F0F0F; --sm-red-soft: #3A1215; --shadow: 0 2px 10px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

/* ── Layout general ─────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
main { padding: 22px 26px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.top h1 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.top p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar { display: flex; align-items: center; gap: 10px; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
aside {
  background: var(--side); color: var(--side-text); padding: 20px 14px;
  display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.logo {
  width: 40px; height: 40px; background: var(--sm-red); color: #fff; font-weight: 800;
  display: grid; place-items: center;
  clip-path: polygon(50% 0, 100% 20%, 100% 80%, 50% 100%, 0 80%, 0 20%);
  font-size: 13px; flex: 0 0 auto;
}
.brand b { display: block; letter-spacing: .3em; font-weight: 300; font-size: 12px; color: #fff; }
.brand span { font-weight: 700; font-size: 11px; color: var(--sm-gray); letter-spacing: .05em; }
nav { flex: 1; }
nav a {
  display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--side-text); text-decoration: none; margin-bottom: 2px; cursor: pointer;
  font-size: 13px;
}
nav a.on { background: var(--side-active); color: #fff; font-weight: 600; }
nav a:hover:not(.on) { background: var(--side-hover); }
nav a.disabled { opacity: 0.4; cursor: not-allowed; }
nav small { display: block; margin: 18px 12px 6px; color: var(--sm-gray); font-size: 10px; letter-spacing: .15em; }
.side-user { margin-top: 18px; padding: 12px; border-radius: 10px; background: var(--side-hover); font-size: 12px; }
.side-user b { display: block; color: #fff; }
.side-user span { color: var(--sm-gray); }

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn {
  background: var(--sm-red); color: #fff; border: 0; padding: 10px 16px; border-radius: 8px;
  font-weight: 600; cursor: pointer; font-family: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.btn:hover { background: var(--sm-red-dark); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--sm-red-soft); color: var(--sm-red); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Botones de icono (tablas de catálogos) ─────────────────────────────── */
.icon-btn {
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0;
  cursor: pointer; font-size: 14px; line-height: 1; color: var(--text); transition: .15s;
  vertical-align: middle;
}
.icon-btn + .icon-btn { margin-left: 4px; }
.icon-btn:hover { background: var(--sm-red-soft); border-color: var(--sm-red); }
.icon-btn.danger:hover { background: #B3261E1a; border-color: var(--danger); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Lista reordenable (drag & drop, SortableJS) ────────────────────────── */
.sort-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sort-list li {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.sort-list li .drag-handle { cursor: grab; color: var(--muted); font-size: 16px; user-select: none; }
.sort-list li .ord-nombre { font-weight: 600; }
.sort-ghost { opacity: .45; }

/* ── Captura de scores ──────────────────────────────────────────────────── */
.score-grid td { vertical-align: middle; }
.sc-atleta { display: flex; flex-direction: column; gap: 2px; }
.sc-atleta b { line-height: 1.15; }
.sc-duo { display: flex; gap: 6px; }
.sc-duo .sc-time { flex: 1 1 auto; }
.sc-duo .sc-reps { width: 130px; flex: 0 0 auto; }
.sc-inp {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--text); font: inherit; font-weight: 600; font-size: 15px;
  font-variant-numeric: tabular-nums; text-align: center; transition: .15s;
}
.sc-inp:focus { outline: 2px solid var(--sm-red); border-color: var(--sm-red); }
.sc-inp::placeholder { font-weight: 400; font-size: 12px; color: var(--muted); }
.sc-time { letter-spacing: .05em; }
.sc-estado {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; font-weight: 700; font-size: 13px;
}
.sc-estado[data-estado="ok"] { border-left-color: var(--ok); color: var(--ok); }
.sc-estado[data-estado="cap"] { border-left-color: var(--warn); color: var(--warn); }
.sc-estado[data-estado="dnf"], .sc-estado[data-estado="dq"], .sc-estado[data-estado="no_show"] { border-left-color: var(--danger); color: var(--danger); }
.sc-acciones { white-space: nowrap; }

/* ── Live badge ─────────────────────────────────────────────────────────── */
.live { display: inline-flex; align-items: center; gap: 6px; background: var(--sm-red-soft); color: var(--sm-red); padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--sm-red); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ── KPIs ───────────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.kpi { border-top: 3px solid var(--sm-red); }
.kpi span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.kpi b { display: block; font-size: 28px; margin-top: 4px; }
.kpi em { font-style: normal; font-size: 11px; color: var(--ok); }

/* ── Grids ──────────────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.card h2 { margin: 0 0 12px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sub { color: var(--muted); font-size: 11px; font-weight: 400; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 99px; cursor: pointer; font-size: 12px; font-family: inherit; }
.tabs button.on { background: var(--sm-red); border-color: var(--sm-red); color: #fff; font-weight: 600; }

/* ── Tablas ─────────────────────────────────────────────────────────────── */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--sm-red-soft); }
.pos { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--bg); font-weight: 700; font-size: 12px; }
.p1 { background: var(--sm-red); color: #fff; }
.p2 { background: var(--sm-charcoal); color: #fff; }
.p3 { background: var(--sm-gray); color: #fff; }

/* ── Pills / badges ─────────────────────────────────────────────────────── */
.pill { padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill.done { background: #2E7D4F22; color: var(--ok); }
.pill.run { background: var(--sm-red-soft); color: var(--sm-red); }
.pill.next { background: #C98A1222; color: var(--warn); }
.pill.neutral { background: var(--bg); color: var(--muted); }

/* ── Listas / rows ──────────────────────────────────────────────────────── */
.list { display: grid; gap: 10px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.row b { display: block; }
.bar { height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--sm-red); }

/* ── Formularios ────────────────────────────────────────────────────────── */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label { font-size: 12px; color: var(--text); display: grid; gap: 5px; font-weight: 600; }
.form label > span.req { color: var(--sm-red); }
.form input, .form select, .form textarea {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  color: var(--text); font: inherit; font-weight: 400; width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--sm-red); border-color: var(--sm-red); }
.form .full { grid-column: 1 / -1; }
.form .switch { display: flex; align-items: center; gap: 8px; }
.form .switch input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; }
legend { font-size: 12px; font-weight: 700; padding: 0 8px; color: var(--muted); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); width: min(680px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal.lg { width: min(920px, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.modal .form input[type="checkbox"] { width: auto; }

/* ── Toolbar de listado ─────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"], .toolbar select {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit;
}
.toolbar .grow { flex: 1; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-brand { background: var(--side); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 48px; }
.login-brand .logo { width: 64px; height: 64px; font-size: 20px; }
.login-brand h1 { font-size: 28px; margin: 22px 0 8px; letter-spacing: .04em; }
.login-brand p { color: var(--sm-gray); margin: 0; max-width: 360px; font-size: 13px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { width: min(380px, 100%); }
.login-card h2 { margin: 0 0 4px; font-size: 20px; }
.login-card .muted { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .form input { padding: 12px; font-size: 14px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; padding: 13px; }
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert.danger { background: var(--sm-red-soft); color: var(--sm-red); }
.alert.success { background: #2E7D4F22; color: var(--ok); }
.alert.info { background: #C98A1222; color: var(--warn); }
.pass-toggle { position: relative; }
.pass-toggle .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 15px; }

/* ── Estados y mensajes ─────────────────────────────────────────────────── */
.is-empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.is-empty .big { font-size: 34px; margin-bottom: 8px; }
.loader { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--sm-red-soft); border-top-color: var(--sm-red); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mini-tabla de integrantes ──────────────────────────────────────────── */
.integrantes { width: 100%; }
.integrantes td:last-child { text-align: right; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  aside { display: none; min-height: auto; position: static; }
  .grid { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}
@media (min-width: 901px) {
  .mobile-menu { display: none; }
}

/* ============================================================================
   App móvil de captura (captura.html)
   ========================================================================== */
body.cap { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.cap-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: var(--side); color: #fff; border-bottom: 1px solid var(--line);
}
.cap-head .logo { width: 34px; height: 34px; font-size: 11px; }
.cap-brand { display: flex; align-items: center; gap: 10px; }
.cap-brand b { display: block; letter-spacing: .25em; font-size: 12px; }
.cap-brand span { font-size: 10px; color: var(--sm-gray); }
.cap-badge {
  position: absolute; top: -6px; right: -6px; background: var(--sm-red); color: #fff;
  font-size: 10px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 99px;
  display: grid; place-items: center; padding: 0 4px;
}
.cap-nav {
  display: grid; grid-template-columns: repeat(3, 1fr); background: var(--side);
  padding: 6px 10px calc(env(safe-area-inset-bottom, 0px) + 6px); gap: 6px;
}
.cap-nav button {
  border: 0; border-radius: 10px; padding: 13px 6px; font: inherit; font-weight: 700;
  background: transparent; color: var(--side-text); cursor: pointer;
}
.cap-nav button.on { background: var(--sm-red); color: #fff; }
.cap-selector { display: grid; gap: 10px; margin-bottom: 14px; }
.cap-selector label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.cap-selector select, .cap-input {
  padding: 13px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; width: 100%;
}
.cap-wod-info { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cap-wod-info b { display: block; font-size: 15px; }
.cap-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }

/* Cronómetro */
.cap-stopwatch {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 14px; text-align: center;
}
.cap-clock {
  font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--sm-red); line-height: 1.1; margin-bottom: 10px;
}
.cap-stopfila { display: flex; gap: 8px; justify-content: center; }
.cap-stopfila .btn { min-height: 44px; }

/* Tarjetas de atletas */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cap-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 14px 12px 12px 46px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left;
  min-height: 96px; cursor: pointer; transition: .12s;
}
.cap-card:active { transform: scale(.97); }
.cap-card.ok { border-color: var(--ok); background: #2E7D4F14; }
.cap-carril {
  position: absolute; top: 10px; left: 10px; width: 28px; height: 28px; border-radius: 8px;
  background: var(--sm-red); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px;
}
.cap-bib { font-size: 11px; font-weight: 800; color: var(--sm-red); }
.cap-nombre { font-weight: 700; font-size: 14px; line-height: 1.15; }
.cap-valor { font-size: 16px; font-weight: 800; color: var(--ok); }

/* Hoja (sheet) de captura */
.cap-sheet-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
}
.cap-sheet {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 16px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  box-shadow: 0 -6px 30px rgba(0,0,0,.3);
}
.cap-sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 12px; }
.cap-sheet-head b { display: block; }
.cap-x { background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; }
.cap-sheet-body { display: grid; gap: 12px; }
.cap-input { font-size: 28px; text-align: center; font-weight: 800; }
.cap-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cap-key {
  padding: 18px 0; font-size: 26px; font-weight: 700; border: 1px solid var(--line);
  border-radius: 12px; background: var(--bg); color: var(--text); cursor: pointer; font-family: inherit;
}
.cap-key:active { background: var(--sm-red); color: #fff; }
.cap-estados { display: flex; gap: 6px; flex-wrap: wrap; }
.cap-estados .btn.on { background: var(--sm-red); color: #fff; }
.cap-sheet-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* Cola */
.cap-panel-pad { padding: 4px 2px; }
.cap-panel-pad h3 { margin: 0 0 12px; font-size: 15px; }
.cap-list { display: grid; gap: 8px; margin-bottom: 14px; }
.btn.full { width: 100%; justify-content: center; }

/* ============================================================================
   Página pública de competencia (c.html) y vista TV (tv.html)
   ========================================================================== */
.pub { background: var(--bg); }
.pub-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 18px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 20;
}
.pub-top .brand b { color: #fff; }
.pub-top-acciones { display: flex; gap: 8px; }
.pub-alerts { max-width: 1080px; margin: 12px auto 0; padding: 0 16px; }
.pub-main { max-width: 1080px; margin: 0 auto; padding: 18px 16px 40px; }
.pub-hero {
  border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); margin-bottom: 16px;
}
.pub-hero .pub-hero-img { height: 140px; background-size: cover; background-position: center; background-color: var(--sm-ink); }
.pub-hero .pub-hero-body { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.pub-hero h1 { margin: 0; font-size: 22px; }
.pub-redes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pub-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pub-tabs button { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 99px; cursor: pointer; font: inherit; font-weight: 600; }
.pub-tabs button.on { background: var(--sm-red); border-color: var(--sm-red); color: #fff; }
.pub-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pub-chips button { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 99px; cursor: pointer; font: inherit; font-size: 12px; }
.pub-chips button.on { background: var(--sm-charcoal); border-color: var(--sm-charcoal); color: #fff; }
.pub-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.pub-card h2 { margin: 0 0 10px; font-size: 15px; }
.pub-sponsors { display: flex; gap: 10px; flex-wrap: wrap; }
.pub-sponsors span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--muted); }
.pub-heat { margin-bottom: 10px; }
.pub-heat .pub-heat-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.pub-heat-atletas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pub-heat-atletas span { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
.pub .live { vertical-align: middle; }

/* Vista TV */
body.tv { background: #0b0b0b; color: #fff; height: 100dvh; overflow: hidden; margin: 0; }
.tv-wrap { height: 100dvh; display: flex; flex-direction: column; padding: 20px 28px; gap: 14px; }
.tv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tv-head h1 { margin: 0; font-size: 32px; letter-spacing: .02em; }
.tv-head .tv-sub { color: var(--sm-gray); font-size: 16px; }
.tv-cat { font-size: 24px; font-weight: 700; color: var(--sm-gray); }
.tv-table { flex: 1; overflow: hidden; }
.tv-table table { width: 100%; border-collapse: collapse; }
.tv-table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--sm-gray); padding: 8px 12px; border-bottom: 1px solid #333; }
.tv-table td { font-size: 22px; padding: 12px; border-bottom: 1px solid #222; }
.tv-table tr:nth-child(1) td { font-size: 26px; }
.tv-pos { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #222; font-weight: 800; }
.tv-pos.p1 { background: var(--sm-red); } .tv-pos.p2 { background: var(--sm-charcoal); } .tv-pos.p3 { background: var(--sm-gray); }
.tv-foot { display: flex; justify-content: space-between; color: var(--sm-gray); font-size: 14px; }

/* ============================================================================
   Panel del atleta (inscripcion.html / scoremgt/atleta) — mobile-first
   ========================================================================== */
body.atleta .app { min-height: 100dvh; }
body.atleta .menu-backdrop { display: none; }

@media (max-width: 900px) {
  body.atleta .app { grid-template-columns: 1fr; }
  /* El sidebar pasa a ser un drawer fuera de pantalla */
  body.atleta aside {
    display: flex; position: fixed; top: 0; left: 0; bottom: 0;
    width: 268px; max-width: 84vw; z-index: 80; min-height: 100dvh;
    padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
    transform: translateX(-100%); transition: transform .25s ease;
  }
  body.atleta .app.menu-abierto aside { transform: none; box-shadow: 0 0 46px rgba(0,0,0,.55); }
  body.atleta .menu-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 70;
  }
  body.atleta .app.menu-abierto .menu-backdrop { display: block; }

  /* Las filas de heat se reacomodan en vertical */
  body.atleta .heat-fila { display: flex; flex-wrap: wrap; gap: 6px 16px; }
  body.atleta .heat-fila > div:first-child { flex: 1 1 100%; }
  body.atleta .heat-fila > div:not(:first-child) { flex: 0 0 auto; text-align: left !important; }

  /* El título no debe empujar los botones fuera del ancho */
  body.atleta .top { gap: 8px; }
  body.atleta .top h1 { font-size: 17px; }
}