/* =============================================================================
   Club Corredores · Inscripciones
   Identidad: azul del club (#1D4E9E), blanco y amarillo lima (#E8EC1B) del logo.
   Tipografía: Barlow (texto) y Barlow Condensed (títulos y números, estilo dorsal).
   ============================================================================= */
:root {
  /* Colores del club */
  --azul: #1D4E9E;          /* azul del logo: menú, cabeceras, botones principales */
  --azul-hover: #2660BC;
  --azul-noche: #0F2A5C;    /* textos sobre amarillo, títulos */
  --amarillo: #E8EC1B;      /* amarillo lima del logo: opción activa y acción principal del usuario */
  --amarillo-suave: #F6F8C8;
  --cielo: #EAF0FA;         /* fondo general, blanco azulado */
  --cielo-2: #F4F7FC;

  /* Uso */
  --ink: #13213B; --ink-2: #3E4C66; --muted: #74819A; --line: #D7E0EE; --bg: var(--cielo); --card: #fff;
  --side: var(--azul); --side-ink: #D5E1F5;
  --accent: var(--azul); --accent-2: var(--azul-hover);
  --warn: #D9480F;          /* solo para "cierra pronto" */
  --ok: #1F7A3A; --ok-bg: #E3F4E8; --err: #C02626; --err-bg: #FCE9E9; --info-bg: #E2EBFA; --info: var(--azul);
  --radius: 12px; --radius-sm: 8px;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Barlow", "Arial Narrow", system-ui, sans-serif;
  --sombra: 0 1px 2px rgba(15, 42, 92, .06), 0 4px 14px rgba(15, 42, 92, .05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); color: var(--azul-noche); letter-spacing: .005em; }
h1 { font-size: 34px; line-height: 1.05; font-weight: 700; margin: 0 0 6px; }
h2 { font-size: 19px; font-weight: 700; margin: 0; }
h3 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.muted { color: var(--muted); margin: 0; }
small { font-size: 12px; }
a { color: var(--azul); }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }

/* --- Estructura de administración ------------------------------------------- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--azul); color: var(--side-ink); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; color: #fff; text-decoration: none; }
.brand img { display: block; }
.brand small { font: 600 13px/1 var(--font-display); color: var(--amarillo); letter-spacing: .03em; }
.sidebar .brand { padding: 0 8px; }
.sidebar .brand img { width: 150px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a, .sidebar nav .soon { position: relative; padding: 10px 12px 10px 16px; border-radius: var(--radius-sm); color: var(--side-ink); text-decoration: none; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.13); color: #fff; font-weight: 700; }
.sidebar nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--amarillo); }
.sidebar nav .soon { opacity: .45; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sidebar nav .soon em { font-size: 11px; font-style: normal; }
/* Apartados del menú con opciones (Competiciones, Administrar atletas, Gestión económica) */
.grupo-menu { display: flex; flex-direction: column; }
.grupo-tit { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 10px 12px 10px 16px; border-radius: var(--radius-sm); color: var(--side-ink); font: inherit; font-weight: 500; }
.grupo-tit:hover { background: rgba(255,255,255,.09); color: #fff; }
.grupo-tit.activo { color: #fff; font-weight: 700; }
.grupo-tit .flecha { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s; opacity: .8; flex: none; }
.grupo-menu.abierto .grupo-tit .flecha { transform: rotate(-135deg); margin-top: 4px; }
.grupo-menu .sub { display: none; flex-direction: column; gap: 1px; margin: 2px 0 6px 14px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.18); }
.grupo-menu.abierto .sub { display: flex; }
.sidebar nav .grupo-menu .sub a, .sidebar nav .grupo-menu .sub .soon { padding: 8px 10px 8px 12px; font-size: 14px; }
.logout { margin-top: auto; }
button.link { background: none; border: 0; color: var(--side-ink); cursor: pointer; padding: 0 16px; font: inherit; }
button.link:hover { color: #fff; text-decoration: underline; }

.content { padding: 30px 34px 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Botones ------------------------------------------------------------------ */
.btn { font: 600 14px/1.2 var(--font); border: 1px solid var(--line); background: #fff; color: var(--azul-noche); padding: 9px 15px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; list-style: none; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: background .12s, border-color .12s; }
.btn:hover { border-color: #B8C6DD; background: var(--cielo-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--azul-hover); border-color: var(--azul-hover); }
.btn.amarillo { background: var(--amarillo); border-color: #CDD116; color: var(--azul-noche); font-weight: 700; }
.btn.amarillo:hover:not(:disabled) { background: #F0F33A; }
.btn.tiny { padding: 4px 9px; font-size: 12px; }

/* --- Tarjetas y cifras -------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--sombra); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
details summary { cursor: pointer; }
details > summary h2 { display: inline; }
details[open] > summary { margin-bottom: 10px; }
.inline-form { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 0; color: var(--ink-2); box-shadow: var(--sombra); border-top: 4px solid var(--azul); }
.stat:first-child { border-top-color: var(--amarillo); }
.stat-n { font: 700 40px/1.05 var(--font-display); color: var(--azul-noche); font-variant-numeric: tabular-nums; }
.stat-n.small { font-size: 20px; line-height: 1.15; padding: 8px 0 6px; }

/* --- Barra de herramientas y tablas ------------------------------------------ */
.toolbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 12px 14px; }
.search { flex: 1 1 320px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--cielo-2); }
.search:focus { background: #fff; border-color: var(--azul); outline: none; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.check input { accent-color: var(--azul); }
.cols-picker { position: relative; }
.cols-picker summary::-webkit-details-marker { display: none; }
.cols-picker #cols-list { position: absolute; right: 0; top: 42px; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; display: grid; gap: 6px; box-shadow: 0 12px 30px rgba(15,42,92,.15); min-width: 220px; }
#contador { margin-left: auto; font-variant-numeric: tabular-nums; }

.table-wrap { overflow: auto; }
.table-wrap.tall { max-height: calc(100vh - 270px); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.grid th, .grid td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.grid thead th { position: sticky; top: 0; background: var(--cielo-2); z-index: 2; font: 700 13px/1.2 var(--font-display); letter-spacing: .02em; color: var(--azul-noche); border-bottom: 2px solid var(--azul); }
.grid thead tr.filters th { top: 37px; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); }
.grid thead tr.heads th[data-sort] { cursor: pointer; user-select: none; }
.grid thead tr.heads th.asc::after { content: " ▲"; font-size: 9px; color: var(--azul); }
.grid thead tr.heads th.desc::after { content: " ▼"; font-size: 9px; color: var(--azul); }
.grid thead input, .grid thead select { width: 100%; min-width: 90px; font: 400 12px var(--font); padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
#tabla tbody tr.clicable { cursor: pointer; }
.grid tbody tr:hover td { background: #F3F7FD; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.msg { white-space: normal; min-width: 220px; max-width: 420px; overflow-wrap: anywhere; }
.grid td.empty { text-align: center; color: var(--muted); padding: 32px; }
.grid tr.retirada td { color: var(--muted); text-decoration: line-through; text-decoration-color: #C3CEE0; }
.grid.compact th, .grid.compact td { padding: 6px 8px; }
.grid.compact thead th { white-space: normal; vertical-align: bottom; }

/* --- Etiquetas -------------------------------------------------------------------- */
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #EDF1F8; color: var(--ink-2); text-decoration: none; }
.pill.ok, .pill.t-atleta_nuevo, .pill.t-licencia_nueva { background: var(--ok-bg); color: var(--ok); }
.pill.error, .pill.t-licencia_retirada, .pill.t-fila_descartada { background: var(--err-bg); color: var(--err); }
.pill.en_curso, #sync-status, .pill.t-atleta_actualizado, .pill.t-licencia_actualizada { background: var(--info-bg); color: var(--azul); }
.pill.amb-N { background: var(--amarillo-suave); color: #5F6200; }
.pill.amb-T { background: #EDF1F8; color: var(--ink-2); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--azul); color: #fff; font-size: 11px; text-align: center; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); }
.pager select { font: inherit; padding: 6px; border-radius: 6px; border: 1px solid var(--line); }

/* --- Ventanas ------------------------------------------------------------------- */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(760px, 94vw); box-shadow: 0 30px 80px rgba(15,42,92,.3); }
.modal.wide { width: min(1100px, 96vw); }
.modal::backdrop { background: rgba(15,42,92,.5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 3; box-shadow: inset 0 4px 0 var(--azul); }
.modal-head h2 { font-size: 22px; }
.modal-body { padding: 16px 20px 22px; max-height: 75vh; overflow: auto; }
.close { border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.close:hover { color: var(--azul-noche); }
.ficha { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.ficha dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.ficha dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.historial { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }

.alert { padding: 9px 12px; border-radius: var(--radius-sm); }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--azul-noche); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(15,42,92,.3); z-index: 100; max-width: 420px; border-left: 4px solid var(--amarillo); }
.toast.error { background: var(--err); border-left-color: #fff; }

/* --- Pantallas de acceso (administración y usuarios) ------------------------ */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--azul); position: relative; overflow: hidden; }
.login-page::after { /* franja de pista: tres calles con el amarillo del club */
  content: ""; position: absolute; left: -10%; right: -10%; bottom: 9vh; height: 34px; transform: rotate(-4deg);
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.14) 0 2px, transparent 2px 16px), linear-gradient(var(--amarillo), var(--amarillo)) 0 100% / 100% 3px no-repeat; pointer-events: none; }
.login-logo { width: min(260px, 70vw); margin: 0 auto 4px; display: block; position: relative; z-index: 1; }
.login-wrap { display: grid; gap: 18px; justify-items: center; position: relative; z-index: 1; width: min(380px, 100%); }
.login-card { background: #fff; padding: 26px 28px; border-radius: 16px; width: 100%; display: grid; gap: 14px; box-shadow: 0 24px 60px rgba(5, 20, 50, .35); }
.login-card h1 { font-size: 28px; margin: 0; }
.login-card label { display: grid; gap: 5px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.login-card input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--cielo-2); }
.login-card input:focus { border-color: var(--azul); background: #fff; outline: none; }
.login-card .btn { justify-content: center; padding: 11px; font-size: 15px; }

/* --- Dorsal: la cuenta atrás de las competiciones en la web de usuarios ------ */
.dorsal { position: relative; background: #fff; border: 2px solid var(--azul-noche); border-radius: 6px; padding: 14px 22px 10px; min-width: 190px; text-align: center; box-shadow: 0 3px 0 var(--azul-noche); }
.dorsal::before, .dorsal::after { /* agujeros de los imperdibles */
  content: ""; position: absolute; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--cielo); border: 1.5px solid #9AA9C2; box-shadow: 0 0 0 0 transparent; }
.dorsal::before { left: 8px; } .dorsal::after { right: 8px; }
.dorsal .dorsal-cab { font: 600 12px/1 var(--font-display); color: var(--azul); letter-spacing: .04em; border-bottom: 3px solid var(--amarillo); padding-bottom: 5px; margin: 0 6px 4px; }
.dorsal .cuenta { font: 700 34px/1.05 var(--font-display); color: var(--azul-noche); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dorsal .cuenta.urgente { color: var(--warn); }
.dorsal .cuenta.cerrado { color: var(--muted); font-size: 22px; }
.dorsal .dorsal-pie { font-size: 12px; color: var(--ink-2); }
/* Menos de 24 h para el cierre: dorsal rojo con todo en blanco */
.dorsal.urgente { background: #C92A2A; border-color: #8F1D1D; box-shadow: 0 3px 0 #8F1D1D; transition: background .3s; }
.dorsal.urgente::before, .dorsal.urgente::after { background: #fff; border-color: #fff; }
.dorsal.urgente .dorsal-cab { color: #fff; border-bottom-color: #fff; }
.dorsal.urgente .cuenta, .dorsal.urgente .cuenta.urgente, .dorsal.urgente .dorsal-pie { color: #fff; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .sidebar .brand img { width: 96px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 20px 16px 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ficha { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- Cabecera común de la parte de usuario (portal, módulos) ------------------- */
.cab-club { background: var(--azul); color: #fff; position: relative; }
.cab-club::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--amarillo); }
.cab-club-in { max-width: 1200px; margin: 0 auto; padding: 12px 20px 16px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.cab-club-marca { display: flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.cab-club-marca img { width: 96px; display: block; }
.cab-club-marca span { font: 700 24px/1.05 var(--font-display); }
.cab-club-marca small { display: block; font: 500 13px var(--font); color: var(--side-ink); margin-top: 3px; }
.cab-club-sesion { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--side-ink); flex-wrap: wrap; justify-content: flex-end; }
.cab-club-sesion a, .cab-club-sesion button { color: #fff; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; text-decoration: none; }
.cab-club-sesion a:hover, .cab-club-sesion button:hover { text-decoration: underline; }
.cab-club-sesion form { display: inline; margin: 0; }
.cab-club-volver { max-width: 1200px; margin: 18px auto 0; padding: 0 20px; }
.cab-club-volver .btn:hover { border-color: var(--azul); color: var(--azul); }
@media (max-width: 640px) { .cab-club-marca img { width: 70px; } .cab-club-marca span { font-size: 19px; } }
.cab-club-sesion a.cab-club-yo { padding: 6px 12px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; }
.cab-club-sesion a.cab-club-yo:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* --- Menús de módulos (portal y submenús) --- */
.portal { max-width: 1100px; margin: 0 auto; padding: 34px 20px 60px; }
.portal h1 { font-size: 42px; margin: 0 0 6px; }
.portal .intro { color: var(--ink-2); margin: 0 0 28px; max-width: 60ch; font-size: 16px; }
.modulos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.modulo { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 230px; padding: 24px 24px 22px;
          background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sombra);
          color: var(--ink); text-decoration: none; overflow: hidden; transition: border-color .15s, transform .15s; }
.modulo::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--azul); }
a.modulo:hover { border-color: var(--azul); transform: translateY(-2px); }
a.modulo:hover::before { background: var(--amarillo); }
.modulo .icono { width: 54px; height: 54px; border-radius: 14px; background: var(--info-bg); display: grid; place-items: center; }
.modulo .icono svg { width: 30px; height: 30px; stroke: var(--azul); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modulo h2 { font-size: 26px; line-height: 1.1; margin: 4px 0 0; }
.modulo p { margin: 0; color: var(--ink-2); font-size: 15px; }
.modulo .pie { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; color: var(--azul); }
.modulo .dato { font: 700 15px var(--font-display); color: var(--azul-noche); background: var(--amarillo-suave); border-radius: 99px; padding: 3px 11px; }
.modulo.pronto { background: var(--cielo-2); cursor: default; }
.modulo.pronto::before { background: #B8C6DD; }
.modulo.pronto .icono { background: #E6EBF3; }
.modulo.pronto .icono svg { stroke: var(--muted); }
.modulo.pronto .pie { color: var(--muted); }
@media (max-width: 900px) { .modulos { grid-template-columns: 1fr; } .modulo { min-height: 0; } .portal h1 { font-size: 32px; } }
.modulos.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; }
@media (max-width: 900px) { .modulos.dos { grid-template-columns: 1fr; } }
.grid thead tr.heads th.ordenable { cursor: pointer; user-select: none; }
.grid thead tr.heads th.ordenable .flecha { font-size: 9px; color: var(--azul); }

/* ============================================================================================
   Móvil y app instalada (PWA)
   ============================================================================================ */
html { -webkit-text-size-adjust: 100%; }
a, button, label, summary, [role="button"], [data-aid], [data-fid] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Pantallas táctiles: al menos 16 px en los campos para que el iPhone no haga zoom al escribir */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; }
  .btn { min-height: 40px; }
  .btn.tiny { min-height: 34px; }
}

/* Zonas seguras (muesca y barra inferior) cuando la web ocupa toda la pantalla (viewport-fit=cover) */
.cab-club-in { padding-top: calc(12px + env(safe-area-inset-top)); padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
body { padding-bottom: env(safe-area-inset-bottom); }
@media (display-mode: standalone) {
  /* Administración desde la app: la barra de estado del móvil, sobre azul */
  body:has(> .layout) { padding-top: env(safe-area-inset-top); background-color: var(--azul); }
  body:has(> .layout) > .layout { background: var(--bg); }
}
.toast { bottom: calc(20px + env(safe-area-inset-bottom)) !important; }

@media (max-width: 640px) {
  /* Cabecera compacta en una sola fila */
  .cab-club-in { padding-bottom: 12px; gap: 10px; flex-wrap: nowrap; }
  .cab-club-marca { gap: 10px; min-width: 0; }
  .cab-club-marca img { width: 52px; flex: none; }
  .cab-club-marca span { font-size: 17px; line-height: 1.15; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .cab-club-marca small { display: none; }
  .cab-club-sesion { flex-wrap: nowrap; gap: 8px; flex: none; }
  .cab-club-sesion a.cab-club-yo { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 10px; }
  .cab-club-volver { margin-top: 12px; padding: 0 max(14px, env(safe-area-inset-left)); }
  .cab-club-volver .btn { padding: 6px 12px; font-size: 13px; min-height: 0; }

  /* Títulos y márgenes más contenidos */
  body main[class] h1 { font-size: 28px; line-height: 1.12; letter-spacing: -.2px; }
  main[class] { padding-left: max(14px, env(safe-area-inset-left)) !important; padding-right: max(14px, env(safe-area-inset-right)) !important; }
  .portal { padding-top: 18px; }

  /* Menú principal y submenús: tarjetas en forma de lista, como en una app */
  .modulos, .modulos.dos { gap: 10px; }
  .modulo { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "icono titulo dato" "icono texto texto";
            gap: 2px 12px; align-items: center; padding: 14px 34px 14px 16px; min-height: 0; border-radius: 14px; }
  .modulo::before { width: 5px; }
  .modulo::after { content: "›"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--azul); line-height: 1; }
  .modulo.pronto::after { content: none; }
  .modulo .icono { grid-area: icono; width: 44px; height: 44px; border-radius: 12px; align-self: start; }
  .modulo .icono svg { width: 24px; height: 24px; }
  .modulo h2 { grid-area: titulo; font-size: 18px; margin: 0; }
  .modulo p { grid-area: texto; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .modulo .pie { grid-area: dato; margin: 0; }
  .modulo .pie > span:first-child { display: none; }
  .modulo .dato { font-size: 12px; padding: 2px 9px; white-space: nowrap; }
  a.modulo:hover { transform: none; }

  /* Ventanas a pantalla completa */
  dialog.modal, dialog.editor { width: 100vw !important; max-width: 100vw !important; height: 100dvh; max-height: 100dvh !important; margin: 0; border-radius: 0 !important; }
  dialog.modal[open] { display: flex; flex-direction: column; }
  dialog.modal[open] > .modal-body, dialog.modal[open] > form.modal-body { max-height: none; flex: 1 1 auto; overflow: auto; align-content: start; }
  dialog.modal[open] > :not(.modal-head):not(.modal-body):not(datalist) { flex: none; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  dialog.editor[open] > form { display: flex; flex-direction: column; height: 100%; }
  dialog.editor[open] .ed-cuerpo { flex: 1; overflow: auto; }
  dialog.editor .ed-cab { padding-top: calc(16px + env(safe-area-inset-top)); }
  dialog.editor .ed-pie { padding-bottom: max(18px, env(safe-area-inset-bottom)); }

  /* Tablas: se deslizan de lado dentro de su caja, sin descolocar la página */
  .table-wrap, .tabla-wrap { -webkit-overflow-scrolling: touch; }
  .grid th, .grid td { padding: 8px 10px; }
}

/* App instalada (abierta desde el icono): sin selección de texto accidental en botones y sin «rebote» de la página */
@media (display-mode: standalone) {
  html, body { overscroll-behavior-y: none; }
  .btn, button, .modulo, nav a { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

/* Administración en el móvil (y en la app «Admin Corredores»): barra superior compacta con menú desplegable */
.menu-movil { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) {
  .layout { grid-template-rows: auto 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 50; height: auto; min-height: 0; align-content: flex-start; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px;
             padding-top: max(10px, env(safe-area-inset-top)); box-shadow: 0 2px 10px rgba(19,33,59,.25); }
  @media (display-mode: standalone) { body:has(> .layout) { padding-top: 0; } }
  .sidebar .brand { display: flex; align-items: center; gap: 8px; padding: 0; }
  .sidebar .brand img { width: 74px; }
  .sidebar .brand small { display: none; }
  .menu-movil { display: flex; align-items: center; gap: 10px; margin-left: auto; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
                border-radius: 10px; padding: 8px 12px; font: 600 15px var(--font-body, inherit); cursor: pointer; max-width: calc(100% - 90px); }
  .menu-movil .mm-actual { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-movil .mm-ico { font-size: 20px; line-height: 1; }
  .sidebar nav, .sidebar .logout { display: none; flex-basis: 100%; }
  .sidebar.abierto nav { display: flex; flex-direction: column; gap: 2px; max-height: calc(100dvh - 140px); overflow-y: auto; }
  .sidebar.abierto .logout { display: block; padding: 4px 0 6px; }
  .sidebar.abierto .menu-movil { background: rgba(255,255,255,.22); }
  .sidebar nav a { padding: 12px 14px 12px 18px; }
}
