/* Registro de bicicletas: identidad visual
   Idea central: el DORSAL. Cada bicicleta tiene un número y se muestra como la placa
   amarilla de una carrera ciclista. Todo lo demás es sobrio para que el dorsal mande:
   tinta azul profunda, superficies blancas sobre gris cemento y celeste como apoyo.
   Tipografías: Anton (números y títulos, como los dorsales) y Atkinson Hyperlegible
   (texto; hecha para leerse rápido y sin confundir letras). */
:root {
  --tinta: #14213D;        /* texto y acciones principales */
  --amarillo: #FFC914;     /* dorsal */
  --cemento: #F2F4F8;      /* fondo */
  --celeste: #D9ECFA;      /* apoyo: selección suave, fichas */
  --blanco: #FFFFFF;
  --suave: #47536A;
  --borde: #C3CBD8;
  --linea: #D8DEE8;
  --verde: #0E6B3B;
  --rojo: #B42318;
  --rojo-claro: #FEF3F2;
  --naranjo: #B54708;
  --naranjo-claro: #FFF6ED;
  /* nombres usados por la página */
  --fondo: var(--cemento);
  --texto: var(--tinta);
  --azul: var(--tinta);
  --azul-claro: var(--celeste);
  --display: Anton, 'Arial Narrow', Impact, sans-serif;
  --lectura: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--fondo); }
body { overflow-wrap: anywhere; font-family: var(--lectura); color: var(--texto); font-size: 18px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.cargando { padding: 48px 24px; text-align: center; color: var(--suave); }
h1 { margin: 0; font-family: var(--lectura); font-weight: 700; font-size: 28px; line-height: 1.15; letter-spacing: -.2px; }
h2 { margin: 0; font-size: 20px; font-weight: 700; }
p { margin: 0; }
a { color: var(--tinta); }
.pantalla { flex: 1; padding: 24px 20px 28px; display: flex; flex-direction: column; gap: 18px; }
.pantalla.con-menu { padding-bottom: 112px; }
.sub { font-size: 15px; color: var(--suave); }
.fila { display: flex; align-items: center; gap: 12px; }
.entre { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grilla2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.empuja { margin-top: auto; }
.centro { text-align: center; }

/* El dorsal: placa amarilla con el número de la bicicleta */
.dorsal {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  background: var(--amarillo); color: var(--tinta); border: 3px solid var(--tinta); border-radius: 10px;
  font-family: var(--display); font-weight: 400; line-height: 1; letter-spacing: 2px;
  font-size: 34px; padding: 14px 18px 8px; min-width: 96px;
}
.dorsal::before, .dorsal::after {   /* perforaciones para las amarras */
  content: ''; position: absolute; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--tinta);
}
.dorsal::before { left: 7px; }
.dorsal::after { right: 7px; }
.dorsal.grande { font-size: 84px; padding: 26px 30px 12px; border-width: 5px; border-radius: 16px; letter-spacing: 4px; }
.dorsal.grande::before, .dorsal.grande::after { top: 9px; width: 10px; height: 10px; }
.dorsal.grande::before { left: 12px; }
.dorsal.grande::after { right: 12px; }
.dorsal.chico { font-size: 22px; padding: 11px 8px 5px; min-width: 66px; border-width: 2px; border-radius: 8px; letter-spacing: 1px; flex-shrink: 0; }
.dorsal.chico::before, .dorsal.chico::after { top: 3px; width: 4px; height: 4px; }
.dorsal.marca { width: 84px; min-width: 0; height: 72px; padding: 12px 0 0; }
.dorsal.marca svg { width: 44px; height: 44px; }

/* Formularios */
label, .etq { font-size: 18px; font-weight: 700; }
input, select, textarea {
  width: 100%; min-height: 52px; border: 1.5px solid var(--borde); border-radius: 12px;
  padding: 12px 16px; font: inherit; font-size: 18px; background: var(--blanco); color: var(--texto);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--tinta); box-shadow: 0 0 0 3px var(--celeste); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; box-shadow: 0 0 0 5px var(--tinta); }

/* Botones */
button { font: inherit; cursor: pointer; }
.btn { min-height: 64px; border: none; border-radius: 14px; background: var(--tinta); color: #fff; font-size: 20px; font-weight: 700; padding: 0 20px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sec { min-height: 60px; border: 2px solid var(--tinta); border-radius: 14px; background: var(--blanco); color: var(--tinta); font-size: 18px; font-weight: 700; padding: 0 16px; width: 100%; }
.btn-peligro { min-height: 60px; border: 2px solid var(--rojo); border-radius: 14px; background: var(--blanco); color: var(--rojo); font-size: 18px; font-weight: 700; width: 100%; }
.btn-icono { width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px; border: 2px solid var(--tinta); background: var(--blanco); color: var(--tinta); display: flex; align-items: center; justify-content: center; padding: 0; }
.enlace { background: none; border: none; color: var(--tinta); font-weight: 700; font-size: 17px; text-decoration: underline; text-underline-offset: 3px; padding: 8px; }

/* Portería */
.escanear { flex: 1; min-height: 320px; border: none; border-radius: 28px; background: var(--tinta); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.escanear svg { color: var(--amarillo); }
.escanear b { font-weight: 700; font-size: 32px; line-height: 1.1; }
.escanear span { font-size: 17px; color: #D5DDEC; }
.cuadro { height: 88px; border-radius: 16px; border: 2px solid var(--tinta); background: var(--blanco); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--tinta); font-size: 17px; font-weight: 700; }
.cuadro.alerta { border-color: var(--naranjo); background: var(--naranjo-claro); color: #7A2E0E; }
.dato { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--blanco); border: 1px solid var(--linea); }
.dato b { font-weight: 700; font-size: 24px; }

.camara { position: relative; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; }
.camara video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camara .marco { position: absolute; inset: 18%; border: 4px solid var(--amarillo); border-radius: 20px; box-shadow: 0 0 0 999px rgba(0,0,0,.4); }

.resultado { min-height: 100vh; padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }
.resultado.ok { background: var(--verde); color: #fff; }
.resultado.mal { background: var(--rojo-claro); border-top: 12px solid var(--rojo); }
.resultado .titulo { font-weight: 700; font-size: 30px; line-height: 1.1; }
.sello { width: 56px; height: 56px; border-radius: 28px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tarjeta-bici { background: var(--blanco); color: var(--texto); border-radius: 24px; padding: 14px 14px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tarjeta-bici .dorsal { margin: 8px 0 4px; }
.foto { width: 100%; height: 190px; border-radius: 16px; object-fit: cover; background: var(--cemento); }
.sin-foto { width: 100%; height: 110px; border-radius: 16px; background: var(--cemento); border: 2px dashed var(--borde); display: flex; align-items: center; justify-content: center; color: var(--suave); font-size: 15px; font-weight: 700; }
.numero { font-family: var(--display); font-size: 68px; line-height: 1; letter-spacing: 2px; }
.pregunta { font-size: 21px; font-weight: 700; text-align: center; }
.btn-ok { min-height: 76px; border: none; border-radius: 18px; background: #fff; color: var(--verde); font-size: 24px; font-weight: 700; width: 100%; }
.btn-ok-sec { min-height: 68px; border: 3px solid #fff; border-radius: 18px; background: transparent; color: #fff; font-size: 21px; font-weight: 700; width: 100%; }
.btn-rojo { min-height: 72px; border: none; border-radius: 18px; background: var(--rojo); color: #fff; font-size: 22px; font-weight: 700; width: 100%; }
.caja { background: var(--blanco); border: 1px solid var(--linea); border-radius: 16px; padding: 16px; }
.caja.marcada { border: 2px solid var(--tinta); }
.caja.roja { border: 2px solid #FDA29B; }

/* Listas y fichas */
.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--blanco); border: 1px solid var(--linea); text-align: left; width: 100%; color: var(--texto); }
button.item { min-height: 72px; }
.item .icono { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--celeste); }
.item .txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.item .txt b { font-size: 18px; }
.item .txt span { font-size: 15px; color: var(--suave); }
button.chip { border: none; font-family: inherit; min-height: 36px; padding: 6px 12px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--celeste); color: var(--tinta); white-space: nowrap; }
.chip.naranjo { background: var(--naranjo-claro); color: #7A2E0E; }
.chip.gris { background: var(--cemento); color: var(--suave); }
.chip.rojo { background: var(--rojo-claro); color: #7A271A; }
.vacio { padding: 24px; text-align: center; color: var(--suave); background: var(--blanco); border: 2px dashed var(--borde); border-radius: 16px; }
.segmentos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; background: #DFE4EC; padding: 6px; border-radius: 14px; }
.segmentos button { min-height: 48px; border: none; border-radius: 10px; background: transparent; font-weight: 700; font-size: 17px; color: var(--suave); }
.segmentos button[aria-pressed="true"] { background: var(--tinta); color: #fff; }
.opciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opcion { min-height: 60px; border-radius: 14px; border: 2px solid var(--borde); background: var(--blanco); display: flex; align-items: center; gap: 12px; padding: 8px 14px; font-size: 18px; font-weight: 700; color: var(--texto); text-align: left; }
.opcion[aria-pressed="true"] { border-color: var(--tinta); background: var(--tinta); color: #fff; }
.opcion:disabled { opacity: .45; }
.pinta { width: 28px; height: 28px; border-radius: 14px; flex-shrink: 0; border: 2px solid rgba(20,33,61,.25); }
.opcion[aria-pressed="true"] .pinta { border-color: #fff; }
.pasos { display: grid; gap: 6px; }
.pasos div { height: 8px; border-radius: 4px; background: var(--borde); }
.pasos div.hecho { background: var(--tinta); }
.qr { display: flex; justify-content: center; }
.qr canvas { width: 100%; max-width: 320px; height: auto; border-radius: 14px; border: 1px solid var(--linea); }

/* Zonas de bicicleteros */
details.zona { background: var(--blanco); border: 1px solid var(--linea); border-radius: 16px; }
details.zona summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 12px; min-height: 56px; border-radius: 16px; }
details.zona summary::-webkit-details-marker { display: none; }
details.zona summary::after { content: '▾'; margin-left: auto; color: var(--suave); font-size: 20px; }
details.zona[open] summary::after { content: '▴'; }
details.zona .txt { display: flex; flex-direction: column; gap: 2px; }
details.zona .txt b { font-size: 18px; }
details.zona .txt span { font-size: 15px; color: var(--suave); }
.fichas { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }

/* Menú inferior */
.menu { position: fixed; left: 0; right: 0; bottom: 0; background: var(--blanco); border-top: 1px solid var(--linea); box-shadow: 0 -4px 16px rgba(20,33,61,.06); padding: 0 8px calc(10px + env(safe-area-inset-bottom)); }
.menu div { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.menu button { min-height: 66px; border: none; border-top: 4px solid transparent; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--suave); font-size: 13px; font-weight: 700; }
.menu button[aria-current="page"] { color: var(--tinta); border-top-color: var(--amarillo); }
.banda { padding: 12px 16px; border-radius: 14px; font-size: 16px; font-weight: 700; }
.banda.naranjo { background: var(--naranjo-claro); color: #7A2E0E; border: 2px solid var(--naranjo); }
.banda.rojo { background: var(--rojo-claro); color: #7A271A; border: 2px solid var(--rojo); }

#aviso { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); max-width: 92vw; background: var(--tinta); color: #fff; padding: 14px 20px; border-radius: 14px; border-left: 8px solid var(--amarillo); font-size: 17px; font-weight: 700; box-shadow: 0 8px 28px rgba(20,33,61,.35); z-index: 10; }
dialog { border: none; border-radius: 20px; padding: 24px; max-width: 92vw; width: 420px; color: var(--texto); }
dialog::backdrop { background: rgba(20,33,61,.55); }
@media (prefers-reduced-motion: no-preference) {
  .btn, .btn-sec, .opcion, .cuadro, .escanear { transition: transform .08s ease; }
  .btn:active, .btn-sec:active, .opcion:active, .cuadro:active, .escanear:active { transform: scale(.985); }
}

/* Estadísticas: gráficos de una sola serie, en tinta; el valor se lee al tocar */
.cifra { font-weight: 700; font-size: 30px; line-height: 1.1; }
.graf-col { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--borde); padding-top: 4px; }
.barra-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; padding: 0; border: none; background: none; color: var(--suave); }
.barra-col .barra { width: 100%; max-width: 28px; background: var(--tinta); border-radius: 4px 4px 0 0; }
.barra-col:hover .barra, .barra-col:active .barra { background: #3A4E7A; }
.barra-col .valor { font-size: 13px; font-weight: 700; color: var(--tinta); min-height: 16px; }
.barra-col .et { font-size: 12px; height: 18px; line-height: 18px; margin-bottom: -22px; }
.graf-col + * { margin-top: 18px; }
.graf-bar { display: flex; flex-direction: column; gap: 8px; }
.fila-bar { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 10px; font-size: 16px; }
.fila-bar .et { font-weight: 700; }
.fila-bar .pista { height: 18px; }
.fila-bar .barra { display: block; height: 100%; background: var(--tinta); border-radius: 0 4px 4px 0; }
.fila-bar .valor { text-align: right; font-weight: 700; }
.tabla-datos summary { cursor: pointer; color: var(--tinta); font-weight: 700; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; }
.tabla-datos table { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 6px; }
.tabla-datos td { padding: 6px 4px; border-bottom: 1px solid var(--linea); }
.tabla-datos td:last-child { text-align: right; font-weight: 700; }

/* Teléfonos muy angostos: que los nombres del menú no se toquen */
@media (max-width: 350px) { .menu { padding-left: 2px; padding-right: 2px; } .menu button { font-size: 11.5px; } }

/* Pantalla de entrada: compacta, con íconos en los campos */
.entrada { gap: 20px; padding-top: 20px; }
.marca-app { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 24px; letter-spacing: .5px; color: var(--tinta); }
.dorsal.mini { width: 44px; height: 38px; min-width: 0; padding: 6px 0 0; border-width: 2px; border-radius: 8px; }
.dorsal.mini::before, .dorsal.mini::after { top: 3px; width: 4px; height: 4px; }
.dorsal.mini::before { left: 4px; } .dorsal.mini::after { right: 4px; }
.dorsal.mini svg { width: 24px; height: 24px; }
.entrada h1 { font-size: 30px; }
.campo { position: relative; }
.campo > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--suave); pointer-events: none; }
.campo input { padding-left: 44px; }
.campo input#f-clave { padding-right: 52px; }
.ver-clave { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: none; background: none; color: var(--suave); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.enlace.derecha { align-self: flex-end; margin-top: -8px; padding: 6px 2px; font-size: 16px; }
.separador { display: flex; align-items: center; gap: 12px; color: var(--suave); font-size: 15px; }
.separador::before, .separador::after { content: ''; flex: 1; height: 1px; background: var(--linea); }
.pie { margin-top: auto; text-align: center; font-size: 14px; color: var(--suave); }

.menu button svg { width: 22px; height: 22px; }

/* Inicio de administración */
.cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cabecera .condo { font-size: 18px; font-weight: 700; }
.btn-perfil { width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--linea); background: var(--blanco); color: var(--tinta); display: flex; align-items: center; justify-content: center; padding: 0; }
.estado-ok { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: #EAF4EE; border: 1px solid #C7E1D1; }
.estado-ok .icono { color: var(--verde); display: flex; }
.estado-ok .txt { display: flex; flex-direction: column; gap: 2px; }
.estado-ok .txt b { font-size: 18px; }
.estado-ok .txt span { font-size: 15px; color: var(--suave); }
.indicador { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 16px; background: var(--blanco); border: 1px solid var(--linea); }
.indicador .ic { color: var(--suave); display: flex; margin-bottom: 4px; }
.indicador b { font-size: 34px; line-height: 1.05; font-weight: 700; }
.indicador > span:last-child { font-size: 15px; color: var(--suave); }
.tarjeta-estad { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 18px; border: none; border-radius: 16px; background: var(--tinta); color: #fff; text-align: left; }
.tarjeta-estad .txt { display: flex; flex-direction: column; gap: 4px; }
.tarjeta-estad .txt b { font-size: 19px; }
.tarjeta-estad .txt span { font-size: 15px; color: #D5DDEC; }
.tarjeta-estad .ic { color: var(--amarillo); display: flex; flex-shrink: 0; }
.indicador .ic svg { width: 24px; height: 24px; }

/* Casilla de aceptación */
.casilla { display: flex; align-items: flex-start; gap: 12px; font-weight: 400; font-size: 17px; cursor: pointer; }
.casilla input { width: 26px; height: 26px; min-height: 0; flex-shrink: 0; margin: 2px 0 0; padding: 0; accent-color: var(--tinta); }
