@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;800&display=swap');

:root {
  --tinta:    #0F1B33;
  --sup:      #17253F;
  --sup-alta: #1F304F;
  --linea:    #2B3D5E;
  --senal:    #FFC400;
  --rf:       #5BE0D8;
  --alerta:   #FF6B5E;
  --texto:    #F4F2EC;
  --tenue:    #8496B3;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--tinta);
  color: var(--texto);
  font: 400 16px/1.45 Archivo, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 88px; }

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ---------------------------------------------------------- estructura */

.barra {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: baseline; gap: 10px;
  padding: 18px 20px 14px;
  background: var(--tinta);
  border-bottom: 1px solid var(--linea);
}
.marca { font-weight: 800; font-size: 21px; letter-spacing: -.03em; }
.marca span { color: var(--senal); }
.sello { margin-left: auto; font-size: 12.5px; color: var(--tenue); }

.hoja { padding: 22px 20px 24px; max-width: 640px; margin: 0 auto; }
.hoja[hidden] { display: none; }

.titulo { margin: 0 0 4px; font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.bajada { margin: 0 0 24px; color: var(--tenue); font-size: 15px; max-width: 46ch; }

/* --------------------------------------------------------------- form */

.campo { margin-bottom: 16px; }
.campo label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--tenue); }
.campo input {
  width: 100%; padding: 13px 14px;
  background: var(--sup); border: 1px solid var(--linea); border-radius: 10px;
  outline: none; transition: border-color .15s;
}
.campo input:focus { border-color: var(--rf); }
.campo input::placeholder { color: #5D6E8C; }
.pista { margin: 6px 0 0; font-size: 13px; color: var(--tenue); line-height: 1.4; }
.pista a { color: var(--rf); }

.principal {
  width: 100%; padding: 16px;
  background: var(--senal); color: #0B1425;
  font-weight: 800; font-size: 17px; letter-spacing: -.01em;
  border-radius: 12px;
}
.principal:disabled { opacity: .45; }
.principal:active:not(:disabled) { transform: translateY(1px); }

.secundario {
  padding: 12px 16px; border: 1px solid var(--linea); border-radius: 10px;
  font-weight: 600; font-size: 15px; color: var(--texto);
}
.secundario.riesgo { color: var(--alerta); border-color: #4A2A2E; }

.aviso {
  margin: 0 0 18px; padding: 12px 14px;
  border-left: 3px solid var(--senal); background: #1D2842;
  font-size: 14px; line-height: 1.45; border-radius: 0 8px 8px 0;
}
.aviso.mal { border-color: var(--alerta); }

/* --------------------------------------------------- el momento: grabar */

.diana {
  position: relative;
  display: grid; place-items: center;
  width: 232px; height: 232px;
  margin: 8px auto 26px;
  transition: width .2s, height .2s;
}
.onda {
  position: absolute; inset: 0;
  border: 2px solid var(--rf); border-radius: 50%;
  opacity: 0;
}
.esperando .onda { animation: latir 2.4s cubic-bezier(.2,.6,.3,1) infinite; }
.esperando .onda:nth-child(2) { animation-delay: .8s; }
.esperando .onda:nth-child(3) { animation-delay: 1.6s; }
@keyframes latir {
  0%   { transform: scale(.42); opacity: .85; }
  100% { transform: scale(1);   opacity: 0; }
}
.nucleo {
  width: 98px; height: 98px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sup-alta); border: 2px solid var(--linea);
  font-size: 40px; transition: background .25s, border-color .25s;
}
.esperando .nucleo { border-color: var(--rf); }
.listo .nucleo { background: var(--rf); border-color: var(--rf); color: #0B1425; }
.fallo .nucleo { border-color: var(--alerta); }

.estado { text-align: center; margin-bottom: 26px; }
.estado h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.estado p { margin: 0 auto; max-width: 34ch; color: var(--tenue); font-size: 15px; }

.ficha {
  padding: 16px; margin-bottom: 20px;
  background: var(--sup); border-radius: 12px;
}
.ficha dt { font-size: 13px; color: var(--tenue); margin-bottom: 3px; }
.ficha dd { margin: 0 0 13px; font-weight: 600; word-break: break-all; }
.ficha dd:last-child { margin-bottom: 0; }
.codigo { font-size: 26px; font-weight: 800; letter-spacing: .06em; color: var(--senal); }

@media (max-height: 730px) {
  .diana { width: 176px; height: 176px; margin: 0 auto 18px; }
  .nucleo { width: 78px; height: 78px; font-size: 32px; }
  .estado { margin-bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .esperando .onda { animation: none; opacity: .3; }
}

/* -------------------------------------------------------------- listado */

.placa {
  display: block; width: 100%; text-align: left;
  padding: 15px 16px; margin-bottom: 10px;
  background: var(--sup); border-radius: 12px;
  border-left: 3px solid var(--rf);
}
.placa.off { border-left-color: #45536E; opacity: .55; }
.placa.sin-grabar { border-left-color: var(--senal); }
.placa h3 { margin: 0 0 3px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.placa .meta { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; color: var(--tenue); }
.placa .cuenta { margin-left: auto; font-size: 19px; font-weight: 800; color: var(--texto); }
.placa .cuenta small { font-size: 12px; font-weight: 500; color: var(--tenue); margin-left: 3px; }

.vacio { padding: 48px 20px; text-align: center; color: var(--tenue); }
.vacio p { margin: 0 0 18px; }

/* ------------------------------------------------------------- detalle */

.numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 22px; }
.numeros div { padding: 14px 12px; background: var(--sup); border-radius: 10px; }
.numeros b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.numeros span { font-size: 12.5px; color: var(--tenue); }

.horas { display: flex; align-items: flex-end; gap: 2px; height: 88px; margin-bottom: 6px; }
.horas i { flex: 1; background: var(--rf); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .8; }
.reglas { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--tenue); margin-bottom: 24px; }

.acciones { display: grid; gap: 9px; }

/* --------------------------------------------------------------- barra */

.pie {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: #0C1729; border-top: 1px solid var(--linea);
}
.pie button {
  flex: 1; padding: 11px 4px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--tenue);
}
.pie button[aria-current='true'] { color: var(--senal); background: #17253F; }

.cargando { padding: 40px; text-align: center; color: var(--tenue); }

/* --------------------------------------------------------------- login */

.entrada { display: grid; place-content: center; min-height: 100vh; padding: 32px; text-align: center; }
.entrada .marca { font-size: 38px; margin-bottom: 8px; }
.entrada p { color: var(--tenue); margin: 0 0 28px; }
.entrada input { width: min(320px, 80vw); text-align: center; margin-bottom: 12px; }

/* cámara del escáner de QR */
#camara {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 14px; margin-bottom: 14px;
  background: #0A1424; border: 2px solid var(--rf);
}
#camara[hidden] { display: none !important; }
