/* IATHLETIX — consola de operación de competencias.
   Sistema visual compartido con el portal (federation/web/css/app.css): mismos NOMBRES de tokens.
   Oscuro por defecto («panel glass», pista nocturna); tema claro completo vía prefers-color-scheme o
   [data-theme]. Las hojas r3-*.css no declaran tokens ni hex: solo consumen estos. */

/* ---- tokens (oscuro, por defecto) ---------------------------------------------------- */
:root {
  color-scheme: dark;
  /* superficies: fondo profundo + paneles «glass» (borde translúcido y brillo de 1 px arriba) */
  --bg: #0E121A;
  --bg-depth: radial-gradient(1100px 560px at 12% -12%, rgba(48, 208, 240, 0.10), transparent 62%), radial-gradient(900px 520px at 100% 0%, rgba(30, 111, 217, 0.14), transparent 58%), radial-gradient(760px 420px at 50% 112%, rgba(25, 181, 166, 0.07), transparent 60%);
  --surface: #14181F;
  --surface-2: #1A2130;
  --surface-3: #232B37;
  --glass: rgba(255, 255, 255, 0.035);
  --glass-bd: rgba(255, 255, 255, 0.08);
  --glass-hi: rgba(255, 255, 255, 0.14);
  /* texto y separadores */
  --ink: #F3F6FA;
  --ink-2: #C5CFDA;
  --muted: #8A98A8;
  --line: #232B37;
  --line-strong: #34404E;
  /* marca (dorado de la consola) e interacción (cian) */
  --brand: #F5B700;
  --brand-ink: #F5B700;
  --accent: #30D0F0;
  --accent-ink: #5ADCF5;
  --accent-soft: rgba(48, 208, 240, 0.14);
  --accent-grad: linear-gradient(135deg, #1E6FD9 0%, #0E7C8F 100%);
  --accent-glow: 0 0 0 1px rgba(48, 208, 240, 0.45), 0 0 22px rgba(48, 208, 240, 0.22);
  --accent-2: #F08A4B;
  --on-accent: #06131A;
  --focus: #30D0F0;
  /* semánticos: color, fondo translúcido y borde al 35 % */
  --ok: #3DDC84;    --ok-bg: rgba(61, 220, 132, 0.14);   --ok-bd: rgba(61, 220, 132, 0.35);
  --neg: #F06464;   --neg-bg: rgba(240, 100, 100, 0.14); --neg-bd: rgba(240, 100, 100, 0.35);
  --warn: #F5B700;  --warn-bg: rgba(245, 183, 0, 0.14);  --warn-bd: rgba(245, 183, 0, 0.35);
  --info: #4FB3FF;  --info-bg: rgba(79, 179, 255, 0.14); --info-bd: rgba(79, 179, 255, 0.35);
  --live: #3DDC84;   --live-ink: #5CE69A;
  --danger: #F06464; --danger-ink: #F58A8A; --danger-soft: rgba(240, 100, 100, 0.12);
  --info-ink: #7CC8FF;
  --warn-ink: #F5B700;
  --input-bg: rgba(8, 12, 18, 0.55);
  --overlay: rgba(4, 8, 14, 0.62);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.25);
  --shadow-2: 0 12px 36px rgba(0, 0, 0, 0.50), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.50), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 0 1px rgba(48, 208, 240, 0.35), 0 0 28px rgba(48, 208, 240, 0.18);
  /* brand symbol (js/app.js brandMark()): plate + lanes + photo-finish line. The plate is the same in both
     themes (dark on the topbar), so the gold and the sky keep their dark-theme values on it — the light
     --brand-ink / --info would not work there. */
  --brand-plate: #2E3C50;
  --brand-plate-line: #4A5B72;
  --brand-lane: #F5B700;
  --brand-line: #38BDF8;

  --font-ui: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --hit: 40px;
  --platform-h: 37px; /* alto de la barra iAtletismo (36 px + borde): referencia de lo pegajoso */
  --gutter: clamp(12px, 3vw, 28px);
  --maxw: 1440px;
}

/* ---- tokens (claro) ------------------------------------------------------------------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #EEF2F7;
    --bg-depth: radial-gradient(1100px 560px at 12% -12%, rgba(14, 124, 143, 0.12), transparent 62%), radial-gradient(900px 520px at 100% 0%, rgba(30, 111, 217, 0.10), transparent 58%);
    --surface: #FFFFFF; --surface-2: #F3F6FA; --surface-3: #E6ECF3;
    --glass: rgba(255, 255, 255, 0.72); --glass-bd: rgba(15, 23, 34, 0.10); --glass-hi: rgba(255, 255, 255, 0.90);
    --ink: #0F1722; --ink-2: #2E3C4D; --muted: #52606F; --line: #D8DFE8; --line-strong: #B9C4D1;
    --brand: #7C5110; --brand-ink: #7C5110;
    --accent: #0E7C8F; --accent-ink: #0A6373; --accent-soft: rgba(14, 124, 143, 0.12);
    --accent-grad: linear-gradient(135deg, #1E6FD9 0%, #0E7C8F 100%);
    --accent-glow: 0 0 0 1px rgba(14, 124, 143, 0.45), 0 0 18px rgba(14, 124, 143, 0.20);
    --accent-2: #C2410C; --on-accent: #FFFFFF; --focus: #0E7C8F;
    --ok: #15803D;    --ok-bg: rgba(21, 128, 61, 0.12);    --ok-bd: rgba(21, 128, 61, 0.35);
    --neg: #C62828;   --neg-bg: rgba(198, 40, 40, 0.10);   --neg-bd: rgba(198, 40, 40, 0.35);
    --warn: #B45309;  --warn-bg: rgba(180, 83, 9, 0.12);   --warn-bd: rgba(180, 83, 9, 0.35);
    --info: #0369A1;  --info-bg: rgba(3, 105, 161, 0.10);  --info-bd: rgba(3, 105, 161, 0.35);
    --live: #15803D; --live-ink: #166534; --danger: #C62828; --danger-ink: #B42318; --danger-soft: rgba(198, 40, 40, 0.08);
    --info-ink: #075985; --warn-ink: #8A3C0C;
    --input-bg: #FFFFFF; --overlay: rgba(15, 23, 34, 0.45);
    --shadow-1: 0 1px 2px rgba(15, 23, 34, 0.06), 0 1px 1px rgba(15, 23, 34, 0.04);
    --shadow-2: 0 8px 28px rgba(15, 23, 34, 0.14), 0 2px 6px rgba(15, 23, 34, 0.08);
    --shadow: 0 8px 28px rgba(15, 23, 34, 0.14), 0 2px 6px rgba(15, 23, 34, 0.08);
    --shadow-glow: 0 0 0 1px rgba(14, 124, 143, 0.35), 0 0 24px rgba(14, 124, 143, 0.16);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #EEF2F7;
  --bg-depth: radial-gradient(1100px 560px at 12% -12%, rgba(14, 124, 143, 0.12), transparent 62%), radial-gradient(900px 520px at 100% 0%, rgba(30, 111, 217, 0.10), transparent 58%);
  --surface: #FFFFFF; --surface-2: #F3F6FA; --surface-3: #E6ECF3;
  --glass: rgba(255, 255, 255, 0.72); --glass-bd: rgba(15, 23, 34, 0.10); --glass-hi: rgba(255, 255, 255, 0.90);
  --ink: #0F1722; --ink-2: #2E3C4D; --muted: #52606F; --line: #D8DFE8; --line-strong: #B9C4D1;
  --brand: #7C5110; --brand-ink: #7C5110;
  --accent: #0E7C8F; --accent-ink: #0A6373; --accent-soft: rgba(14, 124, 143, 0.12);
  --accent-grad: linear-gradient(135deg, #1E6FD9 0%, #0E7C8F 100%);
  --accent-glow: 0 0 0 1px rgba(14, 124, 143, 0.45), 0 0 18px rgba(14, 124, 143, 0.20);
  --accent-2: #C2410C; --on-accent: #FFFFFF; --focus: #0E7C8F;
  --ok: #15803D;    --ok-bg: rgba(21, 128, 61, 0.12);    --ok-bd: rgba(21, 128, 61, 0.35);
  --neg: #C62828;   --neg-bg: rgba(198, 40, 40, 0.10);   --neg-bd: rgba(198, 40, 40, 0.35);
  --warn: #B45309;  --warn-bg: rgba(180, 83, 9, 0.12);   --warn-bd: rgba(180, 83, 9, 0.35);
  --info: #0369A1;  --info-bg: rgba(3, 105, 161, 0.10);  --info-bd: rgba(3, 105, 161, 0.35);
  --live: #15803D; --live-ink: #166534; --danger: #C62828; --danger-ink: #B42318; --danger-soft: rgba(198, 40, 40, 0.08);
  --info-ink: #075985; --warn-ink: #8A3C0C;
  --input-bg: #FFFFFF; --overlay: rgba(15, 23, 34, 0.45);
  --shadow-1: 0 1px 2px rgba(15, 23, 34, 0.06), 0 1px 1px rgba(15, 23, 34, 0.04);
  --shadow-2: 0 8px 28px rgba(15, 23, 34, 0.14), 0 2px 6px rgba(15, 23, 34, 0.08);
  --shadow: 0 8px 28px rgba(15, 23, 34, 0.14), 0 2px 6px rgba(15, 23, 34, 0.08);
  --shadow-glow: 0 0 0 1px rgba(14, 124, 143, 0.35), 0 0 24px rgba(14, 124, 143, 0.16);
}

/* ---- base ---------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); background-image: var(--bg-depth); background-repeat: no-repeat; color: var(--ink);
  font: 15px/1.5 var(--font-ui); overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .35em; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 5px; background: var(--glass); font-size: .82em; line-height: 1.5; text-align: center;
}
/* Barras de desplazamiento finas (recetas compartidas con el portal) */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 22%, transparent); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }
.icon { flex: none; display: inline-block; vertical-align: -0.2em; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
/* Headings receive programmatic focus on route/tab changes (screen readers); no ring for them. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 10px; }

/* ---- iAtletismo platform bar (same markup above the FedHub portal) --------------------- */
.platform-bar { background: color-mix(in srgb, var(--surface-2) 70%, transparent); border-bottom: 1px solid var(--glass-bd); font-size: .84rem; }
.platform-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; gap: 8px 12px;
  flex-wrap: wrap; min-height: 36px;
}
.platform-brand { font-weight: 800; letter-spacing: .01em; color: var(--ink); white-space: nowrap; }
.platform-brand span { color: var(--brand-ink); }
.platform-nav { display: flex; gap: 2px; margin-left: auto; }
.platform-nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.platform-nav a:hover { color: var(--ink); background: var(--glass); }
.platform-nav a[aria-current="page"] { color: var(--accent-ink); box-shadow: inset 0 -2px 0 var(--accent); }
.links-row a { white-space: nowrap; }
.login-portal { margin-top: 4px; }

/* ---- top bar ------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--glass-bd);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 8px var(--gutter);
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-height: var(--hit); }
.brand-mark { width: 34px; height: 34px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; letter-spacing: -.01em; font-size: 1.1rem; }
.brand-name span { color: var(--brand); }
.brand-sub { font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.meet-picker { display: flex; align-items: center; gap: 8px; flex: 1 1 180px; max-width: 460px; min-width: 0; }
.meet-picker .select { width: 100%; min-width: 0; }
/* atajo visible del buscador («Ctrl K» enfoca el combobox); oculto en pantallas estrechas */
.picker-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: inline-flex; gap: 3px; pointer-events: none; }
.picker-kbd kbd { font: 650 .68rem/1.4 var(--font-ui); color: var(--muted); background: var(--glass); border-color: var(--glass-bd); border-bottom-width: 1px; min-width: 0; padding: 0 5px; }
.meet-picker .input:focus-visible ~ .picker-kbd, .meet-picker .input:not(:placeholder-shown) ~ .picker-kbd { display: none; }
.top-action { display: flex; align-items: center; }
.top-action .btn { white-space: nowrap; }
.topbar-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar .menu-btn { display: none; }

/* ---- riel de iconos + barra lateral (≥ 1024 px) / cajón (< 1024 px) ------------------------ */
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; padding: 10px 0 12px;
  background: color-mix(in srgb, var(--surface) 80%, transparent); border-right: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi);
}
.rail-brand { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 12px; text-decoration: none; }
.rail-brand .brand-mark { width: 36px; height: 36px; }
.rail-group { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px solid var(--glass-bd); width: 44px; }
.rail-end { margin-top: auto; }
.rail-item {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--muted); text-decoration: none;
  background: var(--glass); border: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi); transition: color .15s, border-color .15s, box-shadow .15s, background-color .15s;
}
.rail-item:hover { color: var(--ink); background: var(--surface-3); border-color: var(--line-strong); }
.rail-item[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-bd)); box-shadow: var(--shadow-glow); }
.sidebar {
  display: flex; flex-direction: column; gap: 18px; width: 260px; padding: 12px 12px 16px;
  background: color-mix(in srgb, var(--surface) 80%, transparent); border-right: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 4px; }
.sidebar .sidebar-close { display: none; }
.sidebar-group { display: grid; gap: 6px; }
.sidebar-group .section-title { padding: 0 6px 2px; }
.sidebar-group .section-title::after { content: ""; flex: 1; height: 1px; background: var(--glass-bd); }
.sidebar-meet { padding: 0 6px 4px; font-size: .84rem; font-weight: 650; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; min-height: var(--hit); padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 600; background: var(--glass); border: 1px solid var(--glass-bd);
  box-shadow: inset 0 1px 0 var(--glass-hi); transition: color .15s, border-color .15s, box-shadow .15s, background-color .15s;
}
.sidebar-link:hover { color: var(--ink); background: var(--surface-3); border-color: var(--line-strong); }
.sidebar-link[aria-current="page"] { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-bd)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow-glow); }
.sidebar-link > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-backdrop { position: fixed; inset: 0; z-index: 55; background: var(--overlay); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@media (min-width: 1024px) {
  /* rejilla del body: barra de plataforma arriba; riel | barra lateral | (topbar, banda demo, main) */
  body.has-nav { display: grid; grid-template-columns: 64px 260px minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); align-content: start; }
  body.has-nav > .platform-bar { grid-column: 1 / -1; grid-row: 1; position: sticky; top: 0; z-index: 35; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  body.has-nav > .rail { grid-column: 1; grid-row: 2 / -1; position: sticky; top: var(--platform-h); height: calc(100vh - var(--platform-h)); overflow-y: auto; }
  body.has-nav > .sidebar { grid-column: 2; grid-row: 2 / -1; position: sticky; top: var(--platform-h); height: calc(100vh - var(--platform-h)); overflow-y: auto; }
  body.has-nav > .topbar { grid-column: 3; grid-row: 2; top: var(--platform-h); }
  body.has-nav > #mock-banner { grid-column: 3; grid-row: 3; }
  body.has-nav > main { grid-column: 3; grid-row: 4; width: 100%; }
  body.has-nav .topbar .brand, body.has-nav .topbar-settings { display: none; }
  .nav-backdrop { display: none; }
}
@media (max-width: 1023px) {
  .rail { display: none; }
  .topbar .menu-btn { display: inline-flex; }
  .sidebar { display: none; }
  body[data-nav="open"] .sidebar {
    display: flex; position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(320px, 100vw); overflow-y: auto; border-right: 1px solid var(--glass-bd);
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-2); animation: drawer-in .2s ease-out;
  }
  body[data-nav="open"] { overflow: hidden; }
  .sidebar .sidebar-close { display: inline-flex; }
}
.fed-badge {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--hit); padding: 4px 12px 4px 10px; border-radius: 999px;
  border: 1px solid var(--glass-bd); background: var(--glass); color: var(--ink); text-decoration: none; font-size: .84rem; line-height: 1.15;
  max-width: 300px; box-shadow: inset 0 1px 0 var(--glass-hi);
}
.fed-badge:hover { border-color: var(--line-strong); }
.fed-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 25%, transparent); }
.fed-badge[data-state="ok"] .fed-dot { background: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 28%, transparent); }
.fed-badge[data-state="down"] .fed-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 28%, transparent); }
.fed-text { display: flex; flex-direction: column; min-width: 0; }
.fed-text strong { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fed-text span { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-tag {
  font: 700 .66rem/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border-radius: 5px;
  background: color-mix(in srgb, var(--brand) 22%, transparent); color: var(--brand-ink);
}
.env-tag[data-env="production"] { background: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger-ink); }
.mock-banner {
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--warn) 16%, var(--surface)) 0 12px, color-mix(in srgb, var(--warn) 9%, var(--surface)) 12px 24px);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
}
.mock-banner-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 6px var(--gutter); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center;
  font-size: .86rem;
}
.mock-banner strong { color: var(--warn-ink); }
.view-as { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-weight: 600; white-space: nowrap; }
.select.select-sm { min-height: 32px; padding-top: 2px; padding-bottom: 2px; font-size: .86rem; }

/* ---- account menu -------------------------------------------------------------------- */
.user-menu { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--hit); padding: 3px 4px; border-radius: 999px;
  border: 1px solid var(--glass-bd); background: var(--glass); color: var(--ink); cursor: pointer; max-width: 240px; text-align: left;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.user-btn:hover { border-color: var(--line-strong); }
.user-btn[aria-expanded="true"] { border-color: var(--accent); }
.avatar {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font: 800 .8rem var(--font-ui);
  background: var(--surface-3); color: var(--ink); letter-spacing: .02em;
}
.avatar[data-role="admin"] { background: var(--accent); color: var(--on-accent); }
.avatar[data-role="operador"] { background: color-mix(in srgb, var(--info) 30%, var(--surface-3)); }
.avatar[data-role="juez"] { background: color-mix(in srgb, var(--live) 28%, var(--surface-3)); }
.user-text { display: none; flex-direction: column; min-width: 0; max-width: 140px; line-height: 1.15; }
/* name + role next to the avatar only where the bar (max 1440 px) still fits on one line */
@media (min-width: 1440px) { .user-text { display: flex; } .user-btn { padding-right: 12px; } }
.user-text strong { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-text span { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: min(300px, calc(100vw - 24px)); padding: 6px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-bd); border-radius: var(--radius); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow);
}
.user-pop-head { display: grid; gap: 3px; justify-items: start; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.user-pop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.user-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--hit); padding: 0 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; text-align: left;
}
.user-item:hover { background: var(--surface-2); }
.user-item.is-danger { color: var(--danger-ink); }
.user-chip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--hit); padding: 0 12px; border-radius: 999px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: .84rem; font-weight: 600; }

/* ---- layout ------------------------------------------------------------------------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 20px var(--gutter) 64px; outline: none; }
.page { display: grid; gap: 20px; min-width: 0; }
.page > *, .tab-panel > *, .card-body > *, .stack > *, .disclosure-body > *, .dialog-body > *, .pf-layout > *, .grid-2 > * { min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.page-head .titles { display: grid; gap: 6px; min-width: 0; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.subtitle { color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.subtitle .sep::before { content: "·"; margin-right: 14px; color: var(--line-strong); }
.crumbs { font-size: .86rem; color: var(--muted); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li + li::before { content: "›"; margin: 0 6px 0 2px; color: var(--line-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.grid-2.grid-sheet { grid-template-columns: minmax(0, 1fr) 330px; }
.grid-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.stack { display: grid; gap: 14px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* Superficie «glass»: panel translúcido, borde fino, brillo de 1 px arriba. Misma receta en el portal. */
.card { background: color-mix(in srgb, var(--surface) 86%, transparent); border: 1px solid var(--glass-bd); border-radius: var(--radius-lg); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-1); min-width: 0; }
.card.is-active, .card.glow { border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-bd)); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-glow); }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--glass-bd); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px; display: grid; gap: 14px; min-width: 0; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--glass-bd); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.card.flush .card-body { padding: 0; }
.section-title { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

/* ---- buttons ------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--hit); padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 650; cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s, transform .06s; user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; position: relative; }
.btn[aria-busy="true"]::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
/* Primario: gradiente azul→teal con brillo (texto blanco ≥ 4,5:1 en ambos extremos); secundario «glass». */
.btn-primary { background: var(--accent-grad); color: #FFFFFF; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 18px rgba(30, 111, 217, 0.28); }
.btn-primary:hover:not(:disabled) { background: var(--accent-grad); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 0 0 1px rgba(48, 208, 240, 0.35), 0 8px 24px rgba(30, 111, 217, 0.40); }
.btn-secondary { background: var(--glass); color: var(--ink); border-color: var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi); }
.btn-secondary:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--glass); }
.btn-danger { background: var(--neg-bg); color: var(--danger-ink); border-color: var(--neg-bd); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--neg) 24%, transparent); border-color: var(--neg); }
.btn-live { background: var(--live); color: #04140A; }
.btn-sm { min-height: var(--hit); padding: 0 12px; font-size: .9rem; }
.btn-icon { width: var(--hit); padding: 0; }
.btn-block { width: 100%; white-space: normal; text-align: center; }

/* ---- forms --------------------------------------------------------------------------- */
.form-grid { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); align-items: start; }
.form-grid > :not(.field) { align-self: end; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .label { font-size: .82rem; font-weight: 650; color: var(--muted); }
.field-hint { font-size: .78rem; color: var(--muted); }
.input, .select, textarea.input {
  width: 100%; min-height: var(--hit); padding: 8px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--input-bg); color: var(--ink); min-width: 0;
}
.select { padding-right: 32px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input, .select, textarea.input { transition: border-color .15s, box-shadow .15s; }
.input:hover, .select:hover { border-color: var(--muted); }
.input:focus-visible, .select:focus-visible, textarea.input:focus-visible { outline: 2px solid transparent; outline-offset: 0; border-color: var(--accent); box-shadow: var(--accent-glow); }
.input[aria-invalid="true"] { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--input-bg)); }
.input[readonly] { background: var(--glass); border-color: var(--glass-bd); cursor: default; }
.select:disabled, .input:disabled { opacity: .6; cursor: not-allowed; }
.input.mono, .input.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.input.num { text-align: right; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--hit); cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: var(--hit); cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(18px); background: var(--on-accent); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.form-error { color: var(--danger-ink); font-weight: 600; }
.file-input { position: relative; display: inline-flex; }
.file-input input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file-input input[type="file"]:focus-visible + .btn { outline: 3px solid var(--focus); outline-offset: 2px; }
input.input[type="file"] { padding: 4px 6px; color: var(--muted); font-size: .86rem; }
input.input[type="file"]::file-selector-button {
  margin-right: 10px; min-height: 30px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink); font: 600 .86rem var(--font-ui); cursor: pointer;
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px 14px; margin: 0; min-width: 0; }
legend { padding: 0 6px; font-size: .82rem; font-weight: 650; color: var(--muted); }
details.disclosure { border: 1px solid var(--glass-bd); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 86%, transparent); box-shadow: inset 0 1px 0 var(--glass-hi); }
details.disclosure > summary {
  list-style: none; cursor: pointer; min-height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 10px; font-weight: 650;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: "+"; margin-left: auto; font: 700 1.2rem var(--font-mono); color: var(--muted); }
details.disclosure[open] > summary::after { content: "−"; }
details.disclosure[open] > summary { border-bottom: 1px solid var(--line); }
details.disclosure > .disclosure-body { padding: 16px; display: grid; gap: 14px; }

/* ---- pills --------------------------------------------------------------------------- */
.pill {
  --tone: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; min-height: 24px; border-radius: 999px; white-space: nowrap;
  font-size: .76rem; font-weight: 700; letter-spacing: .02em; line-height: 1.2;
  background: color-mix(in srgb, var(--tone) 16%, transparent); color: var(--tone-ink, var(--tone));
  border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
}
.pill-neutral { --tone: var(--muted); color: var(--ink-2); background: var(--glass); border-color: var(--glass-bd); }
.pill-warn { --tone: var(--warn); --tone-ink: var(--warn-ink); }
.pill-brand { --tone: var(--brand); --tone-ink: var(--brand-ink); }
.pill-info { --tone: var(--info); --tone-ink: var(--info-ink); }
.pill-live { --tone: var(--live); --tone-ink: var(--live-ink); }
.pill-accent { --tone: var(--accent); --tone-ink: var(--accent-ink); }
.pill-danger { --tone: var(--danger); --tone-ink: var(--danger-ink); }
.pill-live-solid { background: var(--live); color: #04140A; border-color: var(--live); }
.pill-info-solid { background: var(--info); color: #04121C; border-color: var(--info); }
.pill-accent-solid { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
:root[data-theme="light"] .pill-live-solid, :root[data-theme="light"] .pill-info-solid { color: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .pill-live-solid, :root:not([data-theme="dark"]) .pill-info-solid { color: #fff; } }
.pill-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ---- tables -------------------------------------------------------------------------- */
/* position: relative keeps the .sr-only texts of wide tables (absolutely positioned) inside the scroll
   box: otherwise they stretch the dialog or page around it and add a horizontal scroll on phones. */
.table-wrap { position: relative; overflow-x: auto; max-width: 100%; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: -3px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
table.data caption { text-align: left; padding: 0 0 8px; color: var(--muted); font-size: .84rem; }
table.data th, table.data td { padding: 8px 12px; border-bottom: 1px solid var(--glass-bd); text-align: left; vertical-align: middle; font-variant-numeric: tabular-nums; }
table.data thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700; white-space: nowrap;
}
table.data tbody tr:hover td { background: color-mix(in srgb, var(--ink) 5%, transparent); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; }
table.data td.place { font: 800 1.02rem var(--font-mono); text-align: center; width: 3.2em; }
table.data th.place { text-align: center; width: 3.2em; }
table.data tr.is-scratched td { opacity: .55; }
table.data tr.is-scratched td.name { text-decoration: line-through; }
table.data tr.is-selected td { background: var(--accent-soft); }
.cell-name { font-weight: 650; }
.cell-sub { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.mark { font: 700 1rem var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lane-badge {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--surface-3);
  font: 800 .98rem var(--font-mono); color: var(--ink);
}
.bib { font-family: var(--font-mono); font-weight: 700; }
.medal-1 .place { color: var(--brand-ink); }

/* ---- tabs ---------------------------------------------------------------------------- */
/* Píldoras-pestaña con icono (fila desplazable en pantallas estrechas) */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--hit); padding: 0 14px; border: 1px solid var(--glass-bd); border-radius: 999px;
  background: var(--glass); color: var(--muted); font-weight: 650; cursor: pointer; white-space: nowrap; box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: color .15s, border-color .15s, box-shadow .15s, background-color .15s;
}
.tab:hover { color: var(--ink); background: var(--surface-3); border-color: var(--line-strong); }
.tab .icon { color: var(--muted); }
.tab.is-active { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-bd)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow-glow); }
.tab.is-active .icon { color: var(--accent-ink); }
.tab-badge { font: 700 .72rem var(--font-mono); padding: 1px 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-bd); color: var(--muted); }
.tab.is-active .tab-badge { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.tab-panel { padding-top: 18px; outline: none; display: grid; gap: 18px; min-width: 0; }
.route-view, .tab-view { display: contents; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 10px; background: var(--glass); border: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi); }
.seg { min-height: 36px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 650; cursor: pointer; transition: background-color .15s, color .15s; }
.seg[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.seg:hover { color: var(--ink); }

/* ---- stats / timeline ---------------------------------------------------------------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stats.stats-rich { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
/* Tarjeta de estadística: etiqueta pequeña, número grande (sans 600, tabular) sobre glass. */
.stat { padding: 14px 16px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 86%, transparent); border: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi); display: grid; gap: 2px; }
.stat-value { font: 600 2rem/1.1 var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat.is-accent .stat-value { color: var(--accent-ink); }
.stat.is-live .stat-value { color: var(--live-ink); }
/* con icono en tile, valor grande y mini-gráfico SVG (barras / progreso) a todo el ancho, debajo */
.stat.stat-rich { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 2px 12px; align-items: center; padding-bottom: 12px; }
.stat.stat-rich .icon-tile { grid-row: 1 / 3; width: 42px; height: 42px; }
.stat.stat-rich .stat-label { grid-column: 2; grid-row: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.stat-rich .stat-value { grid-column: 2; grid-row: 2; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.stat.stat-rich .stat-value .stat-sub { font: 600 .74rem/1.3 var(--font-ui); color: var(--muted); white-space: nowrap; }
.stat.stat-rich .mini-chart { grid-column: 1 / -1; grid-row: 3; margin-top: 8px; }
.mini-chart { display: block; width: 100%; height: 32px; overflow: visible; }
.mini-chart .bar { fill: color-mix(in srgb, var(--ink) 9%, transparent); }
.mini-chart .bar.is-hi { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 45%, transparent)); }
.mini-chart .track { fill: color-mix(in srgb, var(--ink) 9%, transparent); }
.mini-chart .fill { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 45%, transparent)); }
.mini-chart .series { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mini-chart .pt { fill: var(--accent); filter: drop-shadow(0 0 5px var(--accent)); }
.area-grad-start { stop-color: var(--accent); stop-opacity: .95; }
.area-grad-end { stop-color: var(--accent); stop-opacity: .18; }
.stat.is-live .mini-chart .series, .stat.is-live .mini-chart .pt { stroke: var(--live); fill: var(--live); }
/* tarjetas «agente» (próximas pruebas): icono en tile, píldora de estado, título, subtítulo, mini-tiles */
.agent-card .card-body { gap: 10px; }
.agent-card .agent-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.agent-card h3 { font-size: 1.08rem; font-weight: 650; }
.agent-card .agent-sub { color: var(--muted); font-size: .88rem; }
a.agent-card { text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
a.agent-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-bd)); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-glow); }
.agent-card[data-status="in_progress"] .icon-tile { color: var(--live-ink); border-color: color-mix(in srgb, var(--live) 45%, var(--glass-bd)); }
.agent-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
/* tarjeta lateral clave/valor del panel («Global Risk» de la referencia) */
.meet-facts .kv { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
.meet-facts .kv dd { font-weight: 600; }
.balance-pill { --tone: var(--accent); --tone-ink: var(--accent-ink); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 22%, transparent); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.tl-item { display: grid; grid-template-columns: 64px 18px minmax(0, 1fr); gap: 0 12px; align-items: stretch; }
.tl-time { font: 700 1rem var(--font-mono); padding-top: 14px; text-align: right; color: var(--ink); }
.tl-rail { position: relative; }
.tl-rail::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-rail::after {
  content: ""; position: absolute; left: 3px; top: 18px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-strong);
}
.tl-item[data-status="in_progress"] .tl-rail::after { background: var(--live); border-color: var(--live); }
.tl-item[data-status="official"] .tl-rail::after, .tl-item[data-status="synced"] .tl-rail::after { background: var(--info); border-color: var(--info); }
.tl-item[data-status="finished"] .tl-rail::after { background: var(--accent); border-color: var(--accent); }
.tl-item[data-status="seeded"] .tl-rail::after { border-color: var(--info); }
.tl-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; margin: 6px 0; padding: 12px 14px;
  border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 86%, transparent); border: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi); color: var(--ink); text-decoration: none; min-height: 64px;
  transition: border-color .15s, box-shadow .15s;
}
a.tl-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-bd)); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-glow); }
.tl-title { font-weight: 700; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.tl-num { font: 700 .82rem var(--font-mono); color: var(--muted); }
.tl-card > .pill { justify-self: start; }
.tl-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .84rem; }
.tl-meta span { display: inline-flex; gap: 5px; align-items: center; }
.tl-date { margin: 14px 0 4px 76px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---- meets list ---------------------------------------------------------------------- */
.meet-card { display: grid; gap: 10px; padding: 16px; text-decoration: none; color: var(--ink); }
.meet-card .meet-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.meet-card .meet-top .pills { justify-content: flex-end; }
.meet-card.is-today { border-color: color-mix(in srgb, var(--live) 45%, var(--glass-bd)); }
.meet-card.is-today .icon-tile { color: var(--live-ink); border-color: color-mix(in srgb, var(--live) 45%, var(--glass-bd)); }
a.meet-card { transition: border-color .15s, box-shadow .15s; }
a.meet-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-bd)); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow-glow); }
.meet-card h3 { font-size: 1.06rem; }
.meet-card .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .86rem; }
.meet-card .meta span { display: inline-flex; align-items: center; gap: 5px; }
.meet-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.empty {
  display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 18px; border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg); color: var(--muted); background: var(--glass);
}
.empty h3 { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- heats / lanes ------------------------------------------------------------------- */
.heat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.heat-card .card-head { gap: 10px; }
.heat-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.heat-controls .field { width: 130px; }
.lane-table td.empty-lane { color: var(--muted); font-style: italic; }

/* ---- results entry grid -------------------------------------------------------------- */
.results-grid input.input { min-height: 40px; }
.results-grid .in-mark { width: 7.5em; font: 700 1.05rem var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.results-grid .in-rt { width: 5.6em; font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.results-grid .in-status { width: 6.4em; }
.results-grid tr.is-dirty td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.results-grid tr.is-error td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.results-grid .cell-msg { display: block; font-size: .76rem; color: var(--danger-ink); margin-top: 2px; }
.results-grid .cell-preview { display: block; font: 600 .78rem var(--font-mono); color: var(--muted); margin-top: 2px; }
.results-grid .mark-cell { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.results-grid .mark-cell .in-mark { flex: 0 1 7.5em; min-width: 0; }
.mil-toggle { min-width: 3.4em; padding: 0 6px; font: 700 .8rem var(--font-mono); color: var(--muted); border: 1px solid var(--line); }
.mil-toggle[aria-pressed="true"] { color: var(--accent-ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.precise { color: var(--muted); font-weight: 500; font-size: .86em; font-family: var(--font-mono); }
.wind-input { display: flex; align-items: stretch; gap: 4px; }
.wind-input .input { flex: 1 1 auto; min-width: 0; }
.wind-sign { flex: 0 0 var(--hit); font: 700 1.05rem var(--font-mono); }
.wind-sign[aria-pressed="true"] { color: var(--info-ink); border-color: var(--info); }
.heat-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.heat-bar .field { width: 150px; }
.heat-controls .field:has(.wind-input) { width: 150px; }
.kbd-hint { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .82rem; align-items: center; }
.save-state { font-size: .84rem; color: var(--muted); }
.save-state.is-dirty { color: var(--accent-ink); font-weight: 650; }
.rt-warn { color: var(--danger-ink); font-weight: 700; }

@media (max-width: 640px) {
  .results-grid table, .results-grid tbody { display: block; }
  .results-grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .results-grid tr {
    display: grid; gap: 6px 8px; padding: 10px 4px; border-bottom: 1px solid var(--line);
    grid-template-columns: 36px minmax(0, 1.25fr) minmax(84px, .8fr) minmax(0, .55fr) 40px;
    grid-template-areas: "lane name name bib place" "mark mark status rt rt" "flags flags flags flags flags";
  }
  .results-grid table.data td { padding: 0; border: 0; display: block; }
  .results-grid td.place { grid-area: place; align-self: center; width: auto; }
  .results-grid td.c-lane { grid-area: lane; align-self: center; }
  .results-grid td.c-bib { grid-area: bib; align-self: center; }
  .results-grid td.c-bib::before { content: "#"; color: var(--muted); font-weight: 400; }
  .results-grid td.c-name { grid-area: name; align-self: center; min-width: 0; }
  .results-grid td.c-mark { grid-area: mark; }
  .results-grid td.c-status { grid-area: status; }
  .results-grid td.c-rt { grid-area: rt; }
  .results-grid td.c-flags { grid-area: flags; }
  .results-grid td.c-flags:empty, .results-grid td.c-flags:not(:has(.pill)) { display: none; }
  .results-grid .in-mark, .results-grid .in-rt, .results-grid .in-status { width: 100%; }
  .results-grid .mark-cell .in-mark { flex: 1 1 auto; padding-left: 6px; padding-right: 6px; }
  .results-grid .mark-cell { justify-content: stretch; }
  .results-grid .mil-toggle { min-width: 0; padding: 0 5px; font-size: .74rem; }
  .results-grid tbody tr:hover td { background: none; }
}

/* ---- field cards --------------------------------------------------------------------- */
.field-sheet input.input { min-height: 40px; width: 4.2em; padding: 6px 6px; text-align: center; font: 700 .98rem var(--font-mono); font-variant-numeric: tabular-nums; }
.field-sheet input.wind { width: 4.4em; font-weight: 500; font-size: .8rem; min-height: 32px; margin-top: 4px; color: var(--muted); }
.field-sheet input.wind:focus, .field-sheet input.wind:not(:placeholder-shown) { color: var(--ink); }
.field-sheet.is-vertical input.input { font-family: var(--font-ui); letter-spacing: .04em; }
.field-sheet td.who { min-width: 180px; }
/* The athlete column stays visible while the attempts scroll sideways (narrow screens). */
.field-sheet td.who, .field-sheet thead th:nth-child(3) { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.field-sheet thead th:nth-child(3) { background: var(--surface-2); z-index: 2; }
.field-sheet tbody tr:hover td.who { background: var(--surface); }
.field-sheet td.who .cell-name { white-space: nowrap; }
.field-sheet td.att { padding: 6px 3px; text-align: center; }
.field-sheet th:first-child, .field-sheet td:first-child { padding-left: 8px; padding-right: 6px; }
.field-sheet td.att.is-best input:not(.wind) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-ink); }
.field-sheet td.att.is-foul input:not(.wind) { color: var(--danger-ink); }
.field-sheet th.att { text-align: center; }
.field-sheet tr.is-out td:not(.who) { opacity: .6; }
.field-sheet tr.is-out td.who { color: var(--muted); }
.field-sheet .row-state { font-size: .74rem; color: var(--muted); display: block; }
.field-sheet .row-state.is-saving { color: var(--info-ink); }
.field-sheet .row-state.is-error { color: var(--danger-ink); }
.vh-col { min-width: 84px; }
.height-head { display: grid; gap: 2px; justify-items: center; text-transform: none; letter-spacing: 0; }
.height-head .mono { font-size: .86rem; color: var(--ink); }
.ranking-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ranking-list li { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.ranking-list .place { font: 800 1.05rem var(--font-mono); text-align: center; }
.ranking-list li.p1 .place { color: var(--accent-ink); }

/* ---- photo-finish -------------------------------------------------------------------- */
.pf-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.pfv { display: grid; gap: 8px; min-width: 0; }
.pf-stage { position: relative; height: clamp(260px, 48vh, 520px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-strong); background: #0B0F14; }
.pf-canvas { width: 100%; height: 100%; cursor: crosshair; touch-action: none; border-radius: var(--radius); }
.pf-canvas.is-panning { cursor: grabbing; }
.pf-canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.pf-statusbar { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: .86rem; }
.pf-stat-label { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.pf-readout { font-weight: 700; color: var(--info-ink); min-width: 0; overflow-wrap: anywhere; }
.pf-stat-sep { width: 1px; height: 16px; background: var(--line-strong); }
.pf-help { font-size: .8rem; color: var(--muted); line-height: 1.9; }
.pf-toolbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: end; }
.pf-toolbar .group { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; padding-right: 10px; border-right: 1px solid var(--line); }
.pf-toolbar .group:last-child { border-right: 0; }
.pf-toolbar .field { width: 160px; }
.athlete-picker { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.athlete-picker button {
  width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left;
  min-height: 48px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer;
}
.athlete-picker button:hover { border-color: var(--line-strong); }
.athlete-picker button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); box-shadow: inset 3px 0 0 var(--accent); }
.athlete-picker .who { min-width: 0; }
.athlete-picker .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.athlete-picker .who span { display: block; color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.athlete-picker .t { font: 700 .95rem var(--font-mono); color: var(--accent-ink); }
.athlete-picker .t.is-empty { color: var(--muted); font: 500 .74rem var(--font-ui); }
.confidence { display: inline-flex; align-items: center; gap: 8px; }
.meter { width: 64px; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--live); }
.meter.mid > span { background: var(--accent); }
.meter.low > span { background: var(--danger); }

/* ---- sync / json --------------------------------------------------------------------- */
.issue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.issue { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--line-strong); }
.issue.is-error { border-left-color: var(--danger); }
.issue.is-warning { border-left-color: var(--accent); }
.issue code { font-size: .8rem; color: var(--info-ink); overflow-wrap: anywhere; }
.issue .msg { grid-column: 1 / -1; font-size: .9rem; }
.sync-rec { display: grid; gap: 10px; }
.sync-rec .meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: .84rem; }
.event-checks { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.event-checks label { display: flex; align-items: center; gap: 10px; min-height: var(--hit); padding: 4px 10px; border-radius: 8px; background: var(--surface-2); cursor: pointer; }
pre.code {
  margin: 0; padding: 14px; border-radius: var(--radius-sm); background: var(--input-bg); border: 1px solid var(--line); max-height: 360px;
  overflow: auto; font: .8rem/1.5 var(--font-mono); white-space: pre; color: var(--ink);
}
.export-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.export-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.export-item .what strong { display: block; font-family: var(--font-mono); }
.export-item .what span { color: var(--muted); font-size: .84rem; }
.export-item .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.export-item pre.code { grid-column: 1 / -1; }

/* ---- dialogs ------------------------------------------------------------------------- */
dialog.dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--glass-bd);
  border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: inset 0 1px 0 var(--glass-hi), 0 24px 60px rgba(0, 0, 0, .45);
}
dialog.dialog-wide { width: min(860px, calc(100vw - 24px)); }
dialog.dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--glass-bd); }
.dialog-body { padding: 18px; display: grid; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--glass-bd); }

/* ---- toasts -------------------------------------------------------------------------- */
.toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast-stack { display: grid; gap: 8px; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 10px 12px 14px;
  border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow); animation: toast-in .18s ease-out;
}
.toast-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--glass); border: 1px solid var(--glass-bd); }
.toast-success .toast-icon { background: color-mix(in srgb, var(--live) 22%, transparent); color: var(--live-ink); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.toast-error .toast-icon { background: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--danger-ink); }
.toast-warning .toast-icon { background: var(--warn-bg); color: var(--warn-ink); }
.toast-info .toast-icon { color: var(--info-ink); }
.toast-msg { font-weight: 600; overflow-wrap: anywhere; }
.toast-detail { font-size: .8rem; color: var(--muted); font-family: var(--font-mono); }
.toast-close { width: 32px; height: 32px; border: 0; background: none; color: var(--muted); border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.toast-close:hover { background: var(--surface-2); color: var(--ink); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }

/* ---- login, roles, users, audit ------------------------------------------------------ */
/* Ingreso: tarjeta glass centrada con el símbolo en tile y halo cian */
.login-page { min-height: calc(100vh - 200px); place-items: center; }
.login-card { width: min(440px, 100%); }
.login-card .card-body { padding: 26px 24px; gap: 16px; }
.login-head { display: grid; gap: 10px; justify-items: center; text-align: center; }
.login-head > div { display: grid; gap: 4px; min-width: 0; }
.login-icon {
  flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-ink); box-shadow: var(--shadow-glow), inset 0 1px 0 var(--glass-hi);
}
.login-card .notice p { margin-top: 4px; }
.login-card .form-error:empty { display: none; }
.notice.readonly { display: flex; gap: 8px; align-items: flex-start; }
.notice.readonly .icon { margin-top: 2px; color: var(--info-ink); }
.notice.lock-note, .notice.manual-warning { display: flex; gap: 8px; align-items: flex-start; }
.notice.lock-note .icon, .notice.manual-warning .icon { margin-top: 2px; color: var(--accent-ink); flex: none; }
.lock-note { margin-bottom: 12px; }
.draw-info .row { gap: 8px; color: var(--muted); font-size: .88rem; }
.draw-info .row .icon { color: var(--accent-ink); flex: none; }
.file-input .btn.is-disabled { opacity: .55; }
.file-input input[type="file"]:disabled { cursor: not-allowed; }
/* club combobox (manual athlete) */
.combo-box { position: relative; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 15rem; overflow-y: auto; margin: 0; padding: 4px;
  list-style: none; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--glass-bd); border-radius: var(--radius-sm); box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
.combo-option { display: flex; justify-content: space-between; gap: 10px; min-height: var(--hit); align-items: center; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.combo-option:hover { background: var(--surface-2); }
.combo-option[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); outline: 2px solid var(--focus); outline-offset: -2px; }
.combo .form-error { font-size: .8rem; }
.candidates:empty { display: none; }
.candidates h3 { margin: 0; font-size: 1rem; }
.candidate-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.candidate-list li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.candidate-list li > span { min-width: 0; }
.import-table tr.is-skipped td { color: var(--muted); }
.import-table .import-warning { color: var(--accent-ink); max-width: 36ch; white-space: normal; }
.import-table .import-warning.is-blocking { color: var(--danger-ink); }
.roles-table th.role-name { font-weight: 400; min-width: 11em; }
.roles-table tbody tr.is-selected th { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.roles-table tbody tr:hover th { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
/* deactivated account: muted (not struck through: it still exists and can be reactivated) */
.users-table tr.is-inactive td, .users-table tr.is-inactive .cell-name { color: var(--muted); }
.roles-table th.role-name .pill { margin-top: 4px; }
.roles-table td.rank { font: 800 1.1rem var(--font-mono); width: 4.5em; text-align: center; }
.roles-table td, .roles-table th { vertical-align: top; }
.perm-list { margin: 4px 0 0; padding-left: 1.1em; display: grid; gap: 2px; font-size: .88rem; }
.users-table code.cell-sub, .roles-table code.cell-sub { font-size: .78rem; }
.audit-details { overflow-wrap: anywhere; min-width: 14em; color: var(--muted); }

/* ---- round 3 shared components ------------------------------------------------------ */
/* generic combobox (components/combobox.js): popup with a listbox and an aria-live message */
.combo-popup {
  position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: min(560px, calc(100vw - 24px));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--glass-bd); border-radius: var(--radius-sm); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); padding: 4px;
}
/* inside a dialog the popup is as wide as its field: no sideways scroll of the dialog body */
dialog .combo-popup { width: auto; right: 0; max-width: none; }
.combo-popup .combo-list { position: static; max-height: 18rem; border: 0; box-shadow: none; padding: 0; background: none; }
.combo-popup .combo-list:empty { display: none; }
.combo-option-2, .combo-action { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; line-height: 1.25; }
.combo-title { font-weight: 600; overflow-wrap: anywhere; }
.combo-detail { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.combo-action { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); color: var(--info-ink); }
.combo-action .combo-title { font-weight: 650; }
.combo-msg { padding: 8px 10px; color: var(--muted); font-size: .88rem; }
.meet-picker .field { gap: 0; width: 100%; margin: 0; }
.meet-picker .field > .field-hint, .meet-picker .field > .form-error { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.meet-picker .combo-box { width: 100%; }
.meet-picker .input { width: 100%; min-width: 0; padding-left: 34px; }
.meet-picker .combo-box > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.meet-picker .combo-popup { max-width: min(520px, calc(100vw - 2 * var(--gutter))); }
@media (max-width: 820px) { .meet-picker .combo-popup { width: 100%; } }
/* the picker shares the row with the brand, the action and the account from 821 px; below it gets its own row */
.meet-picker .input { padding-right: 74px; }
@media (max-width: 820px) { .meet-picker .input { padding-right: 11px; } .picker-kbd { display: none; } }
/* generic 3-step import dialog (components/file-import-dialog.js): the body scrolls, steps and buttons stay */
dialog.file-import[open] { display: flex; flex-direction: column; }
dialog.file-import .dialog-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.import-steps-wrap { padding: 10px 18px 0; }
.import-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: .86rem; color: var(--muted); }
.import-steps li { display: inline-flex; align-items: center; gap: 6px; }
.import-step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong); font: 700 .8rem var(--font-mono); }
.import-steps li[aria-current="step"] { color: var(--ink); font-weight: 650; }
.import-steps li[aria-current="step"] .import-step-n { background: var(--accent-grad); border-color: transparent; color: #FFFFFF; }
.import-steps li.is-done .import-step-n { background: color-mix(in srgb, var(--live) 22%, transparent); border-color: var(--live); color: var(--live-ink); }
.import-step-title { font-size: 1rem; }
.import-drop {
  display: grid; justify-items: center; gap: 6px; padding: 18px 14px; text-align: center; border: 2px dashed var(--line-strong);
  border-radius: var(--radius); background: var(--surface-2); color: var(--muted);
}
.import-drop.is-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.import-drop .btn { color: var(--ink); }
.import-drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.import-file-name { color: var(--ink); overflow-wrap: anywhere; }
.import-columns td.import-what { min-width: 16em; white-space: normal; }
.import-messages ul { margin: 0; padding-left: 1.1em; white-space: normal; }
.import-messages { min-width: 14em; white-space: normal; }
.import-preview-table tr.is-error td { background: color-mix(in srgb, var(--danger) 6%, transparent); }
.import-preview-table tr.is-duplicate td { color: var(--muted); }
.import-mistakes { margin: 4px 0 0; padding-left: 1.1em; display: grid; gap: 2px; }
.import-apply-note { margin-right: auto; align-self: center; }
.import-done { display: flex; gap: 6px; align-items: center; }

/* ---- loading ------------------------------------------------------------------------- */
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 18px 0; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; opacity: .9; }
.error-box { padding: 16px; border-radius: var(--radius); border: 1px solid var(--neg-bd); background: var(--neg-bg); display: grid; gap: 10px; }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-bg); border: 1px solid var(--info-bd); font-size: .9rem; }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-bd); }
.notice.danger { background: var(--neg-bg); border-color: var(--neg-bd); }
/* Lista clave/valor: filas separadas por línea tenue; valores con tono semántico (.is-pos/.is-neg/.is-info). */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .84rem; font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.kv-lines { gap: 0; }
.kv.kv-lines dt, .kv.kv-lines dd { padding: 8px 0; border-bottom: 1px solid var(--glass-bd); }
.kv.kv-lines dd { text-align: right; font-variant-numeric: tabular-nums; }
.kv.kv-lines dt:nth-last-of-type(1), .kv.kv-lines dd:last-of-type { border-bottom: 0; }
.kv dd.is-pos, .is-pos { color: var(--live-ink); }
.kv dd.is-neg, .is-neg { color: var(--danger-ink); }
.kv dd.is-info, .is-info { color: var(--info-ink); }
/* Mini-tiles clave/valor (base de las tarjetas «agente»): rejilla de 2 tiles glass. */
.mini-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini-tile { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--glass); border: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi); min-width: 0; }
.mini-tile .k { display: block; color: var(--muted); font-size: .74rem; }
.mini-tile .v { display: block; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* Icono en tile (tarjetas de estadística y de «agente»). */
.icon-tile { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--glass); border: 1px solid var(--glass-bd); box-shadow: inset 0 1px 0 var(--glass-hi); color: var(--accent-ink); flex: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes drawer-in { from { transform: translateX(-24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- responsive ---------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .pf-layout { grid-template-columns: minmax(0, 1fr); }
  .grid-2, .grid-2.grid-sheet { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .topbar { position: static; }
  .meet-picker { order: 4; flex-basis: 100%; max-width: none; }
  .top-action { order: 5; }
  .topbar-end { margin-left: auto; }
  .fed-text span { display: none; }
}
@media (max-width: 640px) {
  /* roles table as stacked cards: no sideways scrolling to read the permissions */
  table.data.roles-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data.roles-table, .roles-table tbody, .roles-table tr, table.data.roles-table td, table.data.roles-table th { display: block; width: auto; }
  .roles-table tbody tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .roles-table tbody tr:last-child { border-bottom: 0; }
  table.data.roles-table td, table.data.roles-table th { border: 0; padding: 2px 0; text-align: left; white-space: normal; }
  table.data.roles-table td.rank { width: auto; text-align: left; font-size: .9rem; }
  .roles-table td.rank::before { content: "Rango "; font: 600 .78rem var(--font-ui); color: var(--muted); }
  .roles-table th.role-name .cell-sub { display: inline; margin-left: 6px; }
  /* users and audit tables: one card per row, each value with its column name */
  table.data.stack-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data.stack-sm, table.data.stack-sm tbody, table.data.stack-sm tr, table.data.stack-sm td { display: block; width: auto; }
  table.data.stack-sm tbody tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.data.stack-sm tbody tr:last-child { border-bottom: 0; }
  table.data.stack-sm td { border: 0; padding: 2px 0; text-align: left; white-space: normal; min-width: 0; }
  table.data.stack-sm td.hide-sm { display: none; }
  table.data.stack-sm td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font: 600 .8rem var(--font-ui); }
  table.data.stack-sm td.row-actions { padding-top: 6px; }
  .view-as { margin-left: 0; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .user-chip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .user-chip { padding: 0 10px; }
  .hide-sm { display: none; }
  .data .cell-name { min-width: 8em; }
  .fed-text { display: none; }
  .fed-badge { padding: 4px 10px; }
  .field-sheet td.who { min-width: 132px; max-width: 150px; }
  .field-sheet td.who .cell-name { white-space: normal; }
  main { padding-top: 14px; }
  /* the iAtletismo wordmark is in the platform bar: the header says which site this is */
  .brand-name { display: none; }
  .brand-sub { font-size: .9rem; font-weight: 700; color: var(--ink); }
  .fed-badge { max-width: 170px; }
  .fed-text strong { max-width: 110px; }
  .tl-item { grid-template-columns: 52px 14px minmax(0, 1fr); gap: 0 8px; }
  .stats.stats-rich { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat.stat-rich { padding: 12px; }
  .stat.stat-rich .icon-tile { width: 36px; height: 36px; }
  .tl-rail::before { left: 6px; }
  .tl-rail::after { left: 1px; }
  .tl-date { margin-left: 0; }
  .tl-card { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .heat-controls .field, .heat-bar .field, .pf-toolbar .field { width: calc(50% - 6px); }
  .pf-toolbar .group { border-right: 0; padding-right: 0; }
  .export-item { grid-template-columns: minmax(0, 1fr); }
  .export-item .btns { justify-content: flex-start; }
  .card-head, .card-body { padding-left: 12px; padding-right: 12px; }
  .tab { padding: 0 12px; }
  .tab .icon { display: none; }
}
@media (max-width: 480px) {
  .top-action { width: 100%; }
  .top-action .btn { width: 100%; }
}
@media (max-width: 420px) {
  .fed-badge { padding-right: 8px; }
  .platform-bar { font-size: .78rem; }
  .platform-nav a { padding: 0 7px; }
}
@media print {
  .platform-bar, .topbar, .mock-banner, .toasts, .tabs, .btn, .notice.readonly, .rail, .sidebar, .nav-backdrop { display: none !important; }
  body, body.has-nav { display: block; background: #fff; color: #000; }
}
