/* Cotejo — estilos. Azul marino (control) y ámbar (paquete). Pantallas de color grandes para el almacén. */
:root {
  --fondo: #F3F5F8; --tarjeta: #fff; --texto: #1B2430; --suave: #5D6B7A; --linea: #DCE2E9;
  --prim: #1F3A5F; --prim-2: #2B5287; --ambar: #F2B544; --verde: #1E8E4E; --rojo: #C62828; --naranja: #E06D10; --amarillo: #E3B000; --azul: #2D6CDF; --gris: #7A8590;
  --radio: 14px; --sombra: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fondo); color: var(--texto); font-size: 16px; line-height: 1.4; }
body.sin-scroll { overflow: hidden; }
h1, h2, h3 { margin: .2em 0 .6em; line-height: 1.2; }
h2 { font-size: 1.35rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h3 { font-size: 1.05rem; }
a { color: var(--prim-2); }
small { color: var(--suave); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .3px; word-break: break-all; }
.cargando { padding: 3rem 1rem; text-align: center; color: var(--suave); }

/* Barra y menú */
.barra { background: var(--prim); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: .6rem 16px; position: sticky; top: 0; z-index: 500; }
.marca-mini { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; }
.marca-mini img { width: 30px; height: 30px; }
.quien { text-align: right; font-size: .9rem; display: flex; flex-direction: column; }
.quien small { color: #C9D6E8; }
.menu { display: flex; gap: .2rem; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--linea); padding: .3rem .5rem; position: sticky; top: 50px; z-index: 499; }
.menu a { flex: 1 0 auto; min-width: 60px; display: flex; flex-direction: column; align-items: center; padding: .35rem; border-radius: 10px; text-decoration: none; color: var(--suave); font-size: .78rem; }
.menu a span { font-size: 1.2rem; }
.menu a.activo { background: #E5ECF6; color: var(--prim); font-weight: 700; }
main { max-width: 860px; margin: 0 auto; padding: 1rem 16px 4rem; }

/* Tarjetas y formularios */
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1rem; margin-bottom: 1rem; }
label { display: block; font-weight: 600; font-size: .92rem; margin: .7rem 0 .25rem; }
input, select, textarea { width: 100%; font: inherit; padding: .7rem .8rem; border: 1px solid var(--linea); border-radius: 10px; background: #fff; color: var(--texto); margin-top: .25rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--prim-2); border-color: transparent; }
input[type=checkbox] { width: auto; margin: 0 .4rem 0 0; transform: scale(1.25); }
label.check { display: flex; align-items: flex-start; gap: .3rem; font-weight: 500; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.ayuda { color: var(--suave); font-size: .88rem; margin: .4rem 0; }
.alerta { background: #FFF4E5; border-left: 4px solid var(--naranja); padding: .6rem .8rem; border-radius: 8px; margin: .6rem 0; }
.con-ojo { position: relative; }
.con-ojo input { padding-right: 3.2rem; }
.ojo { position: absolute; right: .3rem; top: calc(50% + .125rem); transform: translateY(-50%); border: 0; background: none; font-size: 1.35rem; padding: .4rem .5rem; cursor: pointer; line-height: 1; }
.con-boton { display: flex; gap: .5rem; align-items: center; }
.con-boton input { margin-top: 0; }
.con-boton .btn { width: auto; flex: 0 0 auto; margin: 0; }
.busca { margin: .6rem 0; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: .4rem; width: 100%; padding: .75rem 1rem; margin-top: .8rem; border: 0; border-radius: 12px; background: var(--prim); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.sec { background: #E5ECF6; color: var(--prim); }
.btn.rojo { background: var(--rojo); }
.btn.grande { padding: 1rem; font-size: 1.08rem; }
.btn.link { background: none; color: var(--prim-2); width: auto; padding: .3rem .4rem; margin: 0; font-weight: 600; }
.btn.link.blanco { color: #fff; }
.rojo-txt { color: var(--rojo) !important; }
.naranja-txt { color: var(--naranja) !important; }
.verde-txt { color: var(--verde) !important; }
.fila-btn { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.fila-btn .btn:not(.link) { flex: 1 1 150px; }
.fila-btn select { flex: 1 1 200px; margin-top: .8rem; }
.acciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .6rem; margin: .6rem 0 1rem; }
.acciones .btn { margin: 0; }

.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.chip.azul { background: #E3ECFB; color: var(--azul); } .chip.verde { background: #E2F4EA; color: var(--verde); }
.chip.rojo { background: #FCE6E6; color: var(--rojo); } .chip.gris { background: #ECEFF2; color: var(--gris); }
.chip.ambar-chip { background: #FFF3B0; color: #0B2559; }
.chip.naranja { background: #FDEBDD; color: var(--naranja); }

/* Cifras */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin: .6rem 0 1rem; }
.cifra { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: .8rem; display: flex; flex-direction: column; border-top: 4px solid var(--linea); }
.cifra b { font-size: 1.9rem; line-height: 1.1; }
.cifra span { font-weight: 700; }
.cifra small { font-size: .78rem; }
.cifra.azul { border-top-color: var(--azul); } .cifra.verde { border-top-color: var(--verde); }
.cifra.rojo { border-top-color: var(--rojo); background: #FFF5F5; } .cifra.rojo b { color: var(--rojo); }
.cifra.naranja { border-top-color: var(--naranja); } .cifra.naranja b { color: var(--naranja); }
.veredicto { padding: 1rem; border-radius: var(--radio); font-size: 1.05rem; margin-bottom: .6rem; }
.veredicto.mal { background: #FDECEC; border: 2px solid var(--rojo); }
.veredicto.bien { background: #E6F6EC; border: 2px solid var(--verde); }

/* Listas */
.lista-cotejos { padding: .3rem; }
.fila-cotejo { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding: .8rem; border-bottom: 1px solid var(--linea); text-decoration: none; color: inherit; flex-wrap: wrap; }
.fila-cotejo:last-child { border-bottom: 0; }
.fila-cotejo:hover { background: #F7F9FC; }
.mini-cifras { display: flex; gap: .7rem; font-weight: 700; font-size: .92rem; flex-wrap: wrap; }
.ultimos { list-style: none; margin: 0; padding: 0; }
.ultimos li { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; justify-content: space-between; padding: .5rem .2rem; border-bottom: 1px solid var(--linea); }
.ultimos li:last-child { border-bottom: 0; }
.bitacora { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.bitacora li { padding: .45rem 0; border-bottom: 1px solid var(--linea); font-size: .92rem; }
.fila-usuario { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--linea); }
.fila-usuario:last-child { border-bottom: 0; }
.pestanas { display: flex; gap: .3rem; overflow-x: auto; margin: .6rem 0; }
.pestanas button { flex: 0 0 auto; border: 1px solid var(--linea); background: #fff; border-radius: 99px; padding: .5rem .9rem; font: inherit; font-weight: 600; color: var(--suave); cursor: pointer; }
.pestanas button.activa { background: var(--prim); color: #fff; border-color: var(--prim); }
.tabla-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--linea); white-space: nowrap; }
th { font-size: .78rem; color: var(--suave); }
.grupos { display: flex; flex-direction: column; gap: .4rem; }
.grupo { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; border: 1px solid var(--linea); border-radius: 10px; padding: .6rem; margin: 0; }
.tipos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .2rem .8rem; }
.clave-temp { background: #F3F5F8; padding: .8rem; border-radius: 10px; font-size: 1.1rem; text-align: center; }
.clave-temp b { font-size: 1.4rem; }
.banner-version { background: var(--ambar); padding: .6rem 16px; display: flex; gap: .6rem; align-items: center; justify-content: space-between; font-weight: 600; }
.banner-version .btn { width: auto; margin: 0; padding: .5rem .9rem; }

/* Entrada */
.entrada { max-width: 420px; margin: 0 auto; padding: 2.5rem 16px; }
.marca { text-align: center; margin-bottom: 1.2rem; }
.marca img { width: 76px; height: 76px; }
.marca h1 { font-size: 2rem; margin: .4rem 0 .2rem; color: var(--prim); }
.marca p { color: var(--suave); margin: 0; }
.legal { text-align: center; }

/* Ventanas y avisos */
.modal-fondo { position: fixed; inset: 0; background: rgba(15,25,40,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 3000; }
.modal { background: #fff; color: var(--texto); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 1.2rem 16px 1.5rem; position: relative; }
.modal.ancho { max-width: 760px; }
@media (min-width: 700px) { .modal-fondo { align-items: center; } .modal { border-radius: 18px; } }
.modal .cerrar { position: absolute; top: .5rem; right: .6rem; border: 0; background: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--suave); }
.confirmar-txt { font-size: 1.05rem; margin-top: 1.2rem; }
#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%) translateY(150%); background: #1B2430; color: #fff; padding: .75rem 1.1rem; border-radius: 12px; max-width: calc(100% - 32px); z-index: 5000; transition: transform .25s; font-weight: 600; }
#toast.on { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--rojo); }

/* ===== Pantalla de escaneo ===== */
.escaneo { position: fixed; inset: 0; z-index: 2000; background: #0E1622; color: #fff; display: flex; flex-direction: column; overflow-y: auto; }
.esc-barra { display: flex; align-items: center; gap: .5rem; padding: .5rem 12px; background: #13213A; }
.esc-titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.esc-titulo b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esc-titulo small { color: #9FB2CC; }
.esc-sync { font-size: .8rem; font-weight: 700; color: #8FE3AE; text-align: right; max-width: 40%; }
.esc-sync.pend { color: var(--ambar); }
.esc-contador { text-align: center; padding: .6rem 12px .3rem; }
.esc-contador b { display: block; font-size: 3.4rem; line-height: 1; }
.esc-contador span { font-weight: 700; color: #C9D6E8; }
.esc-contador small { display: block; color: #9FB2CC; margin-top: .2rem; }
.visor { position: relative; margin: .4rem 12px; height: 38vh; min-height: 220px; background: #000; border-radius: 16px; overflow: hidden; flex: 0 0 auto; }
.visor video { width: 100%; height: 100%; object-fit: cover; display: none; }
.camara-on .visor video { display: block; }
.recuadro { position: absolute; left: 10%; right: 10%; top: 22%; bottom: 22%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); display: none; }
.camara-on .recuadro { display: block; }
.recuadro i { position: absolute; left: 4%; right: 4%; top: 50%; height: 2px; background: #FF5252; box-shadow: 0 0 8px #FF5252; animation: barrido 1.6s ease-in-out infinite alternate; }
@keyframes barrido { from { top: 12%; } to { top: 88%; } }
.visor-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem; color: #C9D6E8; }
.esc-botones { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: .5rem; padding: 0 12px; }
.esc-botones .btn { margin-top: .5rem; }
.esc-hw { margin: .7rem 12px .2rem; font-size: .88rem; color: #C9D6E8; }
.esc-ultimos { list-style: none; margin: .3rem 12px 1.5rem; padding: 0; }
.esc-ultimos li { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; padding: .45rem .6rem; border-left: 5px solid var(--verde); background: #172338; border-radius: 6px; margin-bottom: .3rem; }
.esc-ultimos li span { font-family: ui-monospace, Consolas, monospace; font-weight: 700; word-break: break-all; }
.esc-ultimos li small { color: #9FB2CC; }
.esc-ultimos li.amarillo { border-left-color: var(--amarillo); }
.esc-ultimos li.naranja { border-left-color: var(--naranja); }

.flash { position: fixed; inset: 0; z-index: 2500; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 16px; color: #fff; }
.flash[hidden] { display: none; }
.flash.verde { background: rgba(30,142,78,.96); }
.flash.naranja { background: rgba(224,109,16,.97); }
.flash.amarillo { background: rgba(227,176,0,.97); color: #1B2430; }
.flash.rojo { background: #C62828; animation: parpadeo .35s 3; }
@keyframes parpadeo { 50% { background: #8E0000; } }
.flash-ico { font-size: 6rem; line-height: 1; font-weight: 900; }
.flash-tit { font-size: 2rem; font-weight: 900; margin: .4rem 0; }
.flash-cod { font-family: ui-monospace, Consolas, monospace; font-size: 1.5rem; font-weight: 800; background: rgba(0,0,0,.2); padding: .3rem .8rem; border-radius: 10px; word-break: break-all; }
.flash-det { font-size: 1.3rem; font-weight: 700; margin-top: .8rem; max-width: 520px; }
.flash-toca { margin-top: 1.5rem; opacity: .85; }

/* ===== Tema "Águilas" (azul marino y amarillo). Lo asigna el súper admin por usuario.
   Solo cambia la decoración: las pantallas de escaneo (verde, amarillo, rojo) se quedan igual. ===== */
[data-tema=america] { --prim: #0B2559; --prim-2: #16408C; --ambar: #FFD100; --fondo: #F4F6FB; }
[data-tema=america] body { background: var(--fondo) linear-gradient(180deg, #FFF8D6 0, var(--fondo) 220px) no-repeat; }
[data-tema=america] .barra { background: linear-gradient(90deg, #0B2559 0%, #0B2559 70%, #16408C 100%); border-bottom: 4px solid #FFD100; }
[data-tema=america] .marca-mini b { color: #FFD100; letter-spacing: .5px; }
[data-tema=america] .quien small { color: #FFD100; font-weight: 700; }
[data-tema=america] .franja-tema { height: 6px; background: repeating-linear-gradient(90deg, #FFD100 0 28px, #0B2559 28px 56px); }
[data-tema=america] .menu a.activo { background: #FFD100; color: #0B2559; }
[data-tema=america] .btn:not(.sec):not(.link):not(.rojo) { background: #FFD100; color: #0B2559; box-shadow: 0 2px 0 #C9A400; }
[data-tema=america] .btn.sec { background: #0B2559; color: #FFD100; }
[data-tema=america] .tarjeta, [data-tema=america] .cifra { border-left: 4px solid #FFD100; }
[data-tema=america] main h2::after { content: " 🦅"; }
[data-tema=america] .pestanas button.activa { background: #0B2559; color: #FFD100; border-color: #0B2559; }
[data-tema=america] .escaneo { background: #071A40; }
[data-tema=america] .esc-barra { background: #0B2559; border-bottom: 3px solid #FFD100; }
[data-tema=america] .esc-contador b { color: #FFD100; }
[data-tema=america] .recuadro { border-color: #FFD100; }
[data-tema=america] .esc-botones .btn.sec { background: #FFD100; color: #0B2559; }
[data-tema=america] .marca-mini img.escudo-tema { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 0 2px rgba(255,255,255,.6)); }
