/* Laboratorio de cédulas — mismos colores del Express, claro por defecto. */
:root {
  --brand: #0F2D4A; --accent: #1D9E75; --accent-light: #E1F5EE; --accent-dark: #085041;
  --bg: #F4F6F9; --card: #FFFFFF; --input: #F8FAFC; --surface: #EEF2F6;
  --text: #0F2D4A; --text-2: #475569; --muted: #66707F; --border: #E2E8F0; --border-strong: #CBD5E1;
  --danger: #C83A39; --danger-light: #FCEBEB; --warning: #9A5F0E; --warning-light: #FAEEDA;
  --info: #2B6CB0; --info-light: #E6F1FB; --control: #B45309; --control-bg: #FEF3C7;
  --font: 'DM Sans', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'DM Mono', 'Cascadia Code', Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020B18; --card: #0F172A; --input: #0B1120; --surface: #1E293B;
    --text: #F1F5F9; --text-2: #AEB9CB; --muted: #94A0B5; --border: #1E293B; --border-strong: #334155;
    --accent-light: #022C22; --accent-dark: #5DCAA5; --danger: #F07171; --danger-light: #451A1A;
    --warning: #E9A94B; --warning-light: #3D2A0A; --info: #7FB2F0; --info-light: #0C1F3F;
    --control: #FBBF24; --control-bg: #3B2A05;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; background: var(--bg); color: var(--text); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }

.barra { position: sticky; top: 0; z-index: 2; background: linear-gradient(120deg, var(--brand), #16506B); color: #fff;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
.barra h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.barra p { margin: 0; font-size: 12px; color: #A9BCD0; }
.local { font-size: 11.5px; font-weight: 700; color: #9BEBCF; border: 1px solid #2B6E5C; background: #0E3B3A; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

.contenido { max-width: 760px; margin: 0 auto; display: grid; gap: 14px;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.tarjeta { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.rotulo { margin: 0 0 -4px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--border-strong); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--text-2); min-height: 40px; }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-light); color: var(--accent-dark); }

.botones { display: flex; flex-wrap: wrap; gap: 10px; }
.boton { min-height: 44px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.boton:disabled { opacity: .45; cursor: not-allowed; }
.boton--grande { flex: 1 1 220px; min-height: 56px; background: var(--accent); font-size: 16px; }
.boton--grande svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.boton--claro { background: var(--card); color: var(--text); border: 1.5px solid var(--border-strong); }
.boton--chico { min-height: 36px; font-size: 13px; padding: 0 12px; }
.boton--peligro { background: var(--card); color: var(--danger); border: 1.5px solid var(--danger); }
.consejos { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); display: grid; gap: 4px; }
.estado { margin: 0; font-size: 14px; font-weight: 600; min-height: 1.5em; }
.estado.error { color: var(--danger); }
.estado.ok { color: var(--accent-dark); }

.sesion-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sesion-cab h2 { margin: 0; font-size: 16px; }
.sesion-cab h2 span { color: var(--muted); font-weight: 500; }
.nota { margin: 0; font-size: 12.5px; color: var(--muted); }
.con-datos { border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 10px; }
.con-datos summary { font-size: 13.5px; font-weight: 700; color: var(--text-2); cursor: pointer; }
.con-datos[open] { gap: 10px; }
.con-datos > * + * { margin-top: 10px; }
.permiso { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.permiso input { width: 20px; height: 20px; accent-color: var(--accent); }

#resultados { display: grid; gap: 14px; }
.prueba { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; min-width: 0; }
.prueba-cab { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px; align-items: center; border-bottom: 1px solid var(--border); }
.prueba-cab--sin-foto { grid-template-columns: minmax(0, 1fr); }
.prueba-cab img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--surface); }
.prueba-cab b { display: block; font-size: 15px; }
.prueba-cab small { font-size: 12.5px; color: var(--muted); }
.pildora { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.t-verde { background: var(--accent-light); color: var(--accent-dark); }
.t-ambar { background: var(--warning-light); color: var(--warning); }
.t-rojo { background: var(--danger-light); color: var(--danger); }
.t-azul { background: var(--info-light); color: var(--info); }

.codigo { padding: 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--border); min-width: 0; }
.codigo:last-child { border-bottom: 0; }
.codigo-cab { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.codigo-cab .formato { font-weight: 700; font-size: 15px; margin-right: 4px; }
.datos { display: flex; flex-wrap: wrap; gap: 6px; }
.dato { font-family: var(--mono); font-size: 11.5px; background: var(--surface); color: var(--text-2); border-radius: 6px; padding: 2px 7px; }
.pestanas { display: flex; gap: 4px; background: var(--surface); border-radius: 10px; padding: 3px; overflow-x: auto; }
.pestanas button { flex: 1 0 auto; border: 0; background: none; border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); min-height: 36px; }
.pestanas button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.vista { min-width: 0; }
.caja-texto { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: var(--input); border: 1px solid var(--border); border-radius: 10px; padding: 10px; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.ctrl { display: inline-block; font-size: 10.5px; line-height: 1.4; background: var(--control-bg); color: var(--control); border-radius: 4px; padding: 0 4px; margin: 0 1px; font-weight: 600; }
.hex { white-space: pre; word-break: normal; font-size: 11.5px; }
.lineas { margin: 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 4px; color: var(--text-2); }
.lineas b { color: var(--text); }
.ficha-amarilla { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 13.5px; margin: 0; }
.ficha-amarilla dt { color: var(--muted); }
.ficha-amarilla dd { margin: 0; font-weight: 600; }
.mas { justify-self: start; }
.vacio { padding: 14px 12px; font-size: 14px; color: var(--text-2); display: grid; gap: 6px; }
