/* =====================================================================
   Escáner IA: estilos
   ===================================================================== */
:root {
  --fondo: #070a14;
  --fondo-2: #0d1222;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-solido: #121829;
  --borde: rgba(255, 255, 255, 0.09);
  --texto: #eef1fa;
  --suave: #8d96b0;
  --tenue: #5b6480;
  --acento-1: #22d3ee;
  --acento-2: #8b5cf6;
  --degradado: linear-gradient(135deg, var(--acento-1), var(--acento-2));
  --exito: #34d399;
  --alerta: #fbbf24;
  --peligro: #f87171;
  --sombra: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --radio: 20px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --fondo: #eef2fb;
    --fondo-2: #e3e9f7;
    --panel: rgba(255, 255, 255, 0.75);
    --panel-solido: #ffffff;
    --borde: rgba(20, 30, 60, 0.09);
    --texto: #111729;
    --suave: #5a6480;
    --tenue: #9aa3bb;
    --acento-1: #0891b2;
    --acento-2: #7c3aed;
    --sombra: 0 20px 45px -25px rgba(30, 40, 90, 0.35);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto);
  background:
    radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, var(--acento-2) 22%, transparent), transparent 60%),
    radial-gradient(700px 500px at 110% 10%, color-mix(in srgb, var(--acento-1) 16%, transparent), transparent 60%),
    var(--fondo);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}
.contenedor { max-width: 520px; margin: 0 auto; padding: 16px 16px 48px; }
svg.icono { width: 1.25em; height: 1.25em; flex: none; }

/* ---------- Encabezado ---------- */
.barra {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0 18px;
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texto); }
.logo {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--degradado); color: #fff;
  box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--acento-2) 70%, transparent);
}
.logo svg { width: 22px; height: 22px; }
.marca strong { font-size: 1.05rem; letter-spacing: -.01em; }
.marca small { display: block; color: var(--suave); font-size: .75rem; font-weight: 500; margin-top: -2px; }
.enlace {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--suave); text-decoration: none; font-size: .85rem; font-weight: 600;
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--borde); background: var(--panel);
  cursor: pointer;
}
.enlace:hover { color: var(--texto); }

/* ---------- Paneles ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--sombra);
}
h1, h2, h3, h4 { letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 0 0 4px; }
.titulo-seccion {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--suave); margin: 28px 4px 12px;
}

/* ---------- Héroe (login) ---------- */
.heroe { text-align: center; padding: 28px 0 22px; }
.heroe .logo { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 16px; }
.heroe .logo svg { width: 40px; height: 40px; }
.heroe h1 {
  font-size: 2rem; margin: 0; font-weight: 800;
  background: var(--degradado); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.heroe p { color: var(--suave); margin: 6px 0 0; }

/* ---------- Formularios ---------- */
label { display: block; font-size: .8rem; font-weight: 600; color: var(--suave); margin: 14px 0 6px; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; padding: 14px 16px; font: inherit; font-size: 1rem;
  border: 1px solid var(--borde); border-radius: 14px;
  background: color-mix(in srgb, var(--fondo) 60%, transparent); color: var(--texto);
  transition: border-color .2s, box-shadow .2s;
}
input:focus {
  outline: none; border-color: var(--acento-1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--acento-1) 20%, transparent);
}
input.codigo-input {
  text-transform: uppercase; letter-spacing: .45em; font-size: 1.6rem; font-weight: 800;
  text-align: center; font-family: ui-monospace, "SF Mono", Menlo, monospace; padding: 16px;
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--acento-2); }

/* ---------- Botones ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px 18px; margin-top: 14px;
  font: inherit; font-size: 1rem; font-weight: 700;
  border: none; border-radius: 16px; cursor: pointer; text-decoration: none;
  background: var(--degradado); color: #fff;
  box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--acento-2) 80%, transparent);
  transition: transform .15s, filter .2s, opacity .2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.secundario {
  background: var(--panel); color: var(--texto); border: 1px solid var(--borde); box-shadow: none;
}
.btn.texto { background: none; box-shadow: none; color: var(--suave); font-weight: 600; font-size: .9rem; }
.btn.texto:hover { color: var(--texto); }
.btn.pequeno { width: auto; margin: 0; padding: 9px 14px; font-size: .85rem; border-radius: 12px; }

/* Botón obturador (modo control) */
.obturador {
  width: 100%; margin: 18px 0 6px; padding: 22px; border-radius: 24px;
  font-size: 1.2rem; flex-direction: column; gap: 6px;
}
.obturador svg { width: 34px; height: 34px; }
.obturador small { font-weight: 500; opacity: .85; font-size: .8rem; }

/* ---------- Menú de modos ---------- */
.usuario { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--degradado); color: #fff; font-weight: 800; font-size: 1.1rem; text-transform: uppercase;
}
.modo {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; margin-bottom: 14px; border-radius: var(--radio);
  background: var(--panel); border: 1px solid var(--borde); color: var(--texto);
  text-decoration: none; box-shadow: var(--sombra);
  transition: transform .15s, border-color .2s;
}
.modo:hover { border-color: color-mix(in srgb, var(--acento-1) 50%, transparent); }
.modo:active { transform: scale(.98); }
.modo .icono-modo {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--acento-1) 14%, transparent); color: var(--acento-1);
}
.modo.violeta .icono-modo { background: color-mix(in srgb, var(--acento-2) 16%, transparent); color: var(--acento-2); }
.modo .icono-modo svg { width: 28px; height: 28px; }
.modo strong { display: block; font-size: 1.05rem; }
.modo span { color: var(--suave); font-size: .88rem; }
.modo .flecha { margin-left: auto; color: var(--tenue); }

/* ---------- Código de sala ---------- */
.etiqueta { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--suave); }
.codigo {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 2.3rem; font-weight: 800; letter-spacing: .32em; text-align: center;
  padding: 14px 8px 14px calc(8px + .32em); margin: 10px 0 4px;
  border: 1.5px dashed color-mix(in srgb, var(--acento-1) 45%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--acento-1) 7%, transparent);
  color: var(--texto);
}
.codigo.compacto { font-size: 1.3rem; padding: 6px 12px 6px calc(12px + .32em); margin: 4px 0 0; text-align: left; display: inline-block; }

/* ---------- Píldoras de estado ---------- */
.pildora {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: var(--panel); border: 1px solid var(--borde); color: var(--suave);
}
.pildora::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor;
}
.pildora.ok { color: var(--exito); background: color-mix(in srgb, var(--exito) 12%, transparent); border-color: transparent; }
.pildora.ok::before { animation: latido 1.6s infinite; }
.pildora.mal { color: var(--peligro); background: color-mix(in srgb, var(--peligro) 12%, transparent); border-color: transparent; }
.pildora.espera { color: var(--alerta); background: color-mix(in srgb, var(--alerta) 12%, transparent); border-color: transparent; }
@keyframes latido {
  0% { box-shadow: 0 0 0 0 currentColor; }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.centrado { text-align: center; }

/* ---------- Cámara ---------- */
.camara {
  position: relative; width: 100%; aspect-ratio: 3 / 4;
  background: #000; border-radius: 26px; overflow: hidden;
  border: 1px solid var(--borde); box-shadow: var(--sombra);
}
.camara video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camara .marco { position: absolute; inset: 14%; pointer-events: none; }
.camara .marco i {
  position: absolute; width: 38px; height: 38px; border: 4px solid #fff; opacity: .9;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, .6));
}
.camara .marco i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.camara .marco i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.camara .marco i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.camara .marco i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }
.camara .linea {
  position: absolute; left: 4%; right: 4%; height: 2px; top: 0;
  background: linear-gradient(90deg, transparent, var(--acento-1), transparent);
  box-shadow: 0 0 16px 2px var(--acento-1);
  animation: escanear 2.6s ease-in-out infinite alternate;
}
@keyframes escanear { from { top: 2%; } to { top: 98%; } }
.camara .en-vivo {
  position: absolute; top: 14px; left: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .08em;
  background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px);
}
.camara .en-vivo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: latido 1.4s infinite; color: #ef4444; }
.camara .aviso {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; text-align: center; padding: 24px;
  background: radial-gradient(circle at center, rgba(20, 25, 45, .85), rgba(0, 0, 0, .95));
}
.camara .aviso svg { width: 48px; height: 48px; opacity: .8; margin-bottom: 8px; }
.flash { animation: flash .35s; }
@keyframes flash { from { filter: brightness(4); } to { filter: none; } }

/* ---------- Mensajes ---------- */
.mensaje { margin: 10px 2px 0; font-size: .88rem; min-height: 1.3em; color: var(--suave); }
.mensaje:empty { display: none; }
.error { color: var(--peligro) !important; }
.meta { color: var(--suave); font-size: .85rem; margin: 2px 0; }
.vacio {
  text-align: center; color: var(--suave); padding: 32px 16px;
  border: 1.5px dashed var(--borde); border-radius: var(--radio);
}
.vacio svg { width: 40px; height: 40px; opacity: .5; display: block; margin: 0 auto 8px; }

/* ---------- Tarjetas de resultado ---------- */
.tarjeta {
  background: var(--panel-solido); border: 1px solid var(--borde);
  border-radius: 24px; overflow: hidden; margin-bottom: 16px; box-shadow: var(--sombra);
  animation: aparecer .35s ease-out;
}
@keyframes aparecer { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tarjeta .foto { position: relative; }
.tarjeta .foto img { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.tarjeta .foto .pildora { position: absolute; top: 12px; left: 12px; backdrop-filter: blur(8px); background: rgba(0,0,0,.55); border: none; }
.tarjeta .foto .hora {
  position: absolute; top: 12px; right: 12px; font-size: .75rem; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff;
}
.tarjeta .info { padding: 18px 18px 20px; }
.tarjeta h3 { margin: 0; font-size: 1.3rem; line-height: 1.25; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.chip {
  font-size: .78rem; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--acento-2) 14%, transparent); color: var(--acento-2);
}
.chip.cian { background: color-mix(in srgb, var(--acento-1) 14%, transparent); color: var(--acento-1); }
.precio {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 14px; margin: 12px 0;
  background: color-mix(in srgb, var(--exito) 10%, transparent);
}
.precio span { color: var(--suave); font-size: .8rem; font-weight: 600; }
.precio strong { color: var(--exito); font-size: 1.1rem; }
.tarjeta p { margin: 8px 0; color: color-mix(in srgb, var(--texto) 85%, var(--suave)); }
.tarjeta h4 {
  margin: 16px 0 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--suave);
}
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lista li { position: relative; padding-left: 26px; font-size: .93rem; }
.lista li::before {
  content: "✓"; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff;
  background: var(--degradado);
}
.lista.tips li::before { content: "★"; background: var(--alerta); font-size: 10px; }
.confianza { margin-top: 16px; }
.confianza .fila { font-size: .8rem; color: var(--suave); font-weight: 600; }
.barra-confianza { height: 6px; border-radius: 999px; background: var(--borde); margin-top: 6px; overflow: hidden; }
.barra-confianza i { display: block; height: 100%; border-radius: inherit; background: var(--degradado); }

/* Esqueleto mientras analiza */
.esqueleto { display: grid; gap: 10px; }
.esqueleto i {
  display: block; height: 14px; border-radius: 8px;
  background: linear-gradient(90deg, var(--borde) 25%, color-mix(in srgb, var(--acento-1) 18%, transparent) 50%, var(--borde) 75%);
  background-size: 200% 100%; animation: brillo 1.3s infinite linear;
}
.esqueleto i:nth-child(1) { width: 60%; height: 22px; }
.esqueleto i:nth-child(3) { width: 85%; }
@keyframes brillo { to { background-position: -200% 0; } }

/* ---------- Utilidades ---------- */
.fila { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.oculto { display: none !important; }
.interruptor {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 0; padding: 12px 14px;
  border-radius: 14px; background: color-mix(in srgb, var(--fondo) 50%, transparent);
  color: var(--suave); font-size: .88rem; font-weight: 600; cursor: pointer;
}
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acciones .btn { margin-top: 14px; }
