/* 4PL Veintiséis87 · Almacén con lector óptico (Urovo DT50 5", Zebra, Honeywell o cualquier Android)
 * Alto contraste, letra grande, objetivos de 56 px para usar con guantes y una mano. */
:root {
  color-scheme: light;
  --azul: #008FBE; --verde: #00A887; --navy: #063a4f; --navy-2: #0a4a63; --navy-50: #eaf5f9; --noche: #011329; --marino: #061a35;
  --ink: #0d1117; --ink-2: #3f4852; --ink-3: #6b7480; --line: #e2ddd1; --bg: #f4efe3; --surface: #fbf8f1;
  --good: #0ca30c; --good-bg: #e7f6e7; --good-ink: #0a6b0a; --warn: #fab219; --warn-bg: #fff4d6; --warn-ink: #7a5000;
  --crit: #d03b3b; --crit-bg: #fdecec; --crit-ink: #a22323; --info-bg: #e8f1fc; --info-ink: #1c5cab;
  --mono: "JetBrains Mono", ui-monospace, "Roboto Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--sans); font-size: 17px; line-height: 1.35; color: var(--ink); background: var(--bg) url('../assets/marca/marca-agua.svg') center / 360px repeat fixed; overscroll-behavior-y: contain; -webkit-user-select: none; user-select: none; }
input, select, textarea { -webkit-user-select: text; user-select: text; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
[hidden], .oculto { display: none !important; }
svg.ic { width: 22px; height: 22px; flex: none; }

/* Barra */
.barra { position: sticky; top: 0; z-index: 30; background: radial-gradient(140% 220% at 0% 0%, #0b2545 0%, var(--marino) 45%, var(--noche) 100%); color: #fff; padding: 6px 10px; display: flex; align-items: center; gap: 8px; min-height: 52px; }
.barra::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--azul), var(--verde)); }
.barra .logo { width: 34px; height: 34px; flex: none; }
.barra .t { line-height: 1.12; min-width: 0; flex: 1; }
.barra .t b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra .t span { font-size: 12px; color: #b7c6d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.barra .der { display: flex; gap: 6px; align-items: center; }
.btn-barra { background: rgba(255,255,255,.14); border: 0; color: #fff; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; cursor: pointer; flex: none; }
.chip-red { font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 999px; display: inline-flex; gap: 6px; align-items: center; background: rgba(255,255,255,.14); white-space: nowrap; }
.chip-red i { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; }
.chip-red.off i { background: #fbbf24; }
.chip-red.cola i { background: #60a5fa; }

/* Campo de lectura: siempre arriba, siempre con foco */
.lectura { position: sticky; top: 52px; z-index: 25; background: var(--navy); padding: 8px 10px; display: flex; gap: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.scan { flex: 1; min-width: 0; height: 52px; border-radius: 12px; border: 3px solid transparent; background: var(--surface); padding: 0 14px; font: 700 20px var(--mono); letter-spacing: .02em; outline: none; caret-color: var(--azul); }
.scan:focus { border-color: var(--verde); }
.scan::placeholder { color: #8a95a1; font-family: var(--sans); font-weight: 600; }
.btn-teclado { width: 52px; height: 52px; border-radius: 12px; border: 0; background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; flex: none; }
.btn-teclado.activo { background: var(--verde); }

main#vista { padding: 12px 12px calc(28px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
h1.v { font-size: 21px; margin: 2px 0 2px; letter-spacing: -.01em; }
p.sub { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; }
.cargando { text-align: center; color: var(--ink-3); padding: 40px 0; }

/* Paso actual: lo que tiene que escanear ahora */
.paso { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 2px solid var(--navy); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.paso .n { width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.paso b { font-size: 18px; display: block; }
.paso span { color: var(--ink-2); font-size: 14.5px; }
.paso.ok { border-color: var(--good); }
.paso.ok .n { background: var(--good); }

/* Destino gigante (ubicación a la que ir, bulto, etc.) */
.grande { background: var(--noche); color: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.grande .et { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #9fb4c9; font-weight: 700; }
.grande .cod { font: 800 34px var(--mono); letter-spacing: .01em; line-height: 1.1; word-break: break-all; }
.grande .det { font-size: 16px; margin-top: 6px; color: #dbe6f1; }
.grande .cant { font: 800 44px var(--sans); color: #7ee2c7; line-height: 1; }
.grande.verde { background: #054d3d; }

.tarjeta { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.tarjeta h3 { margin: 0 0 6px; font-size: 16px; }
.fila { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 4px 0; }
.fila + .fila { border-top: 1px dashed var(--line); }
.fila b.num { font-variant-numeric: tabular-nums; font-size: 18px; }

/* Mosaico de procesos */
.mosaico { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mosaico button { min-height: 96px; border: 0; border-radius: 16px; background: var(--surface); box-shadow: 0 1px 0 var(--line), 0 1px 4px rgba(0,0,0,.06); display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 12px 14px; text-align: left; cursor: pointer; }
.mosaico button svg { width: 30px; height: 30px; color: var(--navy-2); }
.mosaico button b { font-size: 17px; display: block; }
.mosaico button span { font-size: 12.5px; color: var(--ink-3); line-height: 1.25; display: block; margin-top: 2px; }
.mosaico button.destacado { background: var(--navy); color: #fff; }
.mosaico button.destacado svg, .mosaico button.destacado span { color: #cfe4f2; }
.mosaico button:active { transform: scale(.98); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 16px; border-radius: 13px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 16px; cursor: pointer; }
.btn.pri { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ok { background: var(--good); border-color: var(--good); color: #fff; }
.btn.mal { background: var(--surface); border-color: #f0b8b8; color: var(--crit-ink); }
.btn.ancho { width: 100%; }
.btn:disabled { opacity: .5; }
.botones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.botones .ancho { grid-column: 1 / -1; }

/* Campos */
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.campo label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.campo input, .campo select { height: 52px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); padding: 0 12px; font-size: 18px; }
.campo input:focus, .campo select:focus { outline: none; border-color: var(--azul); }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cantidad { display: flex; align-items: center; gap: 8px; }
.cantidad button { width: 56px; height: 56px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-size: 28px; font-weight: 800; }
.cantidad input { width: 96px; height: 56px; text-align: center; font: 800 26px var(--sans); border-radius: 14px; border: 2px solid var(--navy); }
.cantidad label { font-weight: 700; font-size: 14px; color: var(--ink-2); }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; padding: 6px 0; }
.check input { width: 24px; height: 24px; }

/* Historial de lecturas */
.historial { list-style: none; margin: 0; padding: 0; }
.historial li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
.historial li .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font-weight: 800; }
.historial li.ok .ico { background: var(--good); }
.historial li.mal .ico { background: var(--crit); }
.historial li.aviso .ico { background: var(--warn); color: #3b2800; }
.historial li .tx { min-width: 0; flex: 1; }
.historial li .tx b { display: block; font-size: 15px; word-break: break-all; }
.historial li .tx span { display: block; font-size: 13px; color: var(--ink-2); }
.historial li .q { font: 800 18px var(--sans); font-variant-numeric: tabular-nums; }

/* Listas para elegir (olas, cargas, órdenes) */
.opciones { display: flex; flex-direction: column; gap: 8px; }
.opciones button { text-align: left; min-height: 64px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 12px; cursor: pointer; }
.opciones button .tx { flex: 1; min-width: 0; }
.opciones button b { display: block; font-size: 16px; }
.opciones button span { font-size: 13px; color: var(--ink-2); }
.opciones button .q { font: 800 17px var(--sans); color: var(--navy); white-space: nowrap; }

.barra-avance { height: 12px; border-radius: 6px; background: #dfe6ec; overflow: hidden; margin: 6px 0 10px; }
.barra-avance i { display: block; height: 100%; background: linear-gradient(90deg, var(--azul), var(--verde)); }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--navy-50); color: var(--navy-2); }
.pill.bien { background: var(--good-bg); color: var(--good-ink); }
.pill.mal { background: var(--crit-bg); color: var(--crit-ink); }
.pill.aviso { background: var(--warn-bg); color: var(--warn-ink); }

/* Respuesta visual a cada lectura: un marco de color en toda la pantalla */
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 50; border: 0 solid transparent; transition: border-width .08s; }
#flash.ok { border: 12px solid rgba(12,163,12,.85); }
#flash.mal { border: 14px solid rgba(208,59,59,.9); background: rgba(208,59,59,.08); }
#flash.aviso { border: 12px solid rgba(250,178,25,.9); }
#toast { position: fixed; left: 10px; right: 10px; bottom: calc(14px + var(--safe-b)); z-index: 60; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#toast div { background: #0d1117; color: #fff; padding: 12px 14px; border-radius: 12px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
#toast div.mal { background: var(--crit); }
#toast div.ok { background: #067a06; }
#toast div.aviso { background: #8a5a00; }

/* Hoja (diálogo) */
.velo { position: fixed; inset: 0; background: rgba(1,19,41,.55); z-index: 40; display: flex; align-items: flex-end; }
.hoja { background: var(--surface); width: 100%; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 14px calc(16px + var(--safe-b)); }
.hoja h2 { margin: 0 0 10px; font-size: 19px; }
video.cam { width: 100%; border-radius: 14px; background: #000; max-height: 50vh; object-fit: cover; }

/* Etiqueta en pantalla */
.etiqueta { background: #fff; border: 2px dashed var(--ink-3); border-radius: 12px; padding: 12px; text-align: center; }
.etiqueta svg { width: 100%; height: 90px; }
.etiqueta .c { font: 800 22px var(--mono); letter-spacing: .04em; }
.etiqueta .n { font: 800 34px var(--sans); }
@media print { .barra, .lectura, #toast, #flash, .no-print { display: none !important; } main#vista { padding: 0; } .etiqueta { border: 0; } }
@media (min-width: 560px) { .mosaico { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Firma de APX Vektr: sólo en la pantalla de acceso (marca/ESTANDAR-DE-MARCA.md) */
.apx { margin: 16px 0 0; text-align: center; font-size: 11.5px; letter-spacing: .04em; color: var(--ink-3); }
