* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #f6f7f6; color: #111; }
main { max-width: 480px; margin: 0 auto; padding: 16px; }
h1 { color: #14532d; }
form { display: flex; flex-direction: column; gap: 12px; }
input, button { font-size: 18px; padding: 12px; border-radius: 8px; border: 1px solid #bbb; }
button { background: #14532d; color: #fff; border: 0; }
#error-login { color: #b91c1c; min-height: 1.2em; margin: 0; }
#sin-conexion { background: #fde68a; padding: 8px 12px; border-radius: 8px; }
[hidden] { display: none !important; }
#cap-vivo { position: fixed; inset: 0; background: #000; z-index: 5; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#cap-guia { position: absolute; top: 0; left: 0; right: 0; padding: 14px 16px; background: rgba(0,0,0,.75); color: #fff; font-size: 20px; font-weight: 600; min-height: 56px; }
#cap-indicadores { position: absolute; top: 72px; left: 8px; right: 8px; display: flex; gap: 8px; }
.ind { flex: 1; padding: 14px 10px; border-radius: 10px; background: #4b5563; color: #fff; font-size: 18px; font-weight: 700; text-align: center; }
.ind.ok { background: #15803d; }
#cap-panel { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
#cap-panel > div { display: flex; flex-direction: column; gap: 8px; }
#cap-panel .fila { flex-direction: row; }
#cap-panel .fila button { flex: 1; }
#cap-panel label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
#cap-aviso { margin: 0; color: #b91c1c; font-weight: 600; min-height: 1.2em; }
button { min-height: 48px; }
button.sec { background: #374151; }
button:disabled { opacity: .5; }
#cap-error { color: #b91c1c; }
#tabs { display: flex; gap: 8px; margin-top: 16px; }
#tabs button { flex: 1; }
#tabs button.activa { background: #14532d; }
#principal ul { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
#principal li { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
#principal li span { color: #555; font-size: 15px; }
#tarjeta-guardado { position: absolute; left: 12px; right: 12px; top: 140px; display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; background: #15803d; color: #fff; }
#tarjeta-guardado img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #fff; }
#tarjeta-guardado div { display: flex; flex-direction: column; gap: 4px; }
#tarjeta-guardado strong { font-size: 20px; }
#tarjeta-guardado span { font-size: 16px; }
#principal li.lote { flex-direction: row; gap: 12px; align-items: center; }
#principal li.lote .texto, #principal li.revisar { display: flex; flex-direction: column; gap: 2px; }
#principal li small { color: #777; font-size: 12px; }
.foto { object-fit: cover; border-radius: 8px; background: #e5e7eb; }
.foto.chica { width: 56px; height: 56px; flex: none; }
.foto.grande { width: 100%; max-height: 180px; }
.foto.vacia { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; color: #555; overflow: hidden; padding: 2px; }
.foto.vacia.grande { height: 120px; }
.fotos { display: flex; flex-direction: column; gap: 6px; }
.fecha.rojo { color: #b91c1c; font-weight: 700; }
.fecha.naranja { color: #c2410c; font-weight: 700; }
.fecha.verde { color: #15803d; }
#principal li.revisar .fila { display: flex; flex-direction: row; gap: 6px; }
#principal li.revisar .fila button { flex: 1; font-size: 15px; padding: 8px; }
#principal li .error { color: #b91c1c; }
#tabs button { font-size: 15px; padding: 8px; }

/* ===== Hito 3: base visual del original (solo clases nuevas; no toca la captura) ===== */
@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-regular.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-medium.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-semibold.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/inter-bold.woff2") format("woff2"); }

:root {
  --green: #178056;
  --green-bright: #1e9e6a;
  --green-dark: #0e6a40;
  --ink: #163028;
  --muted: #24362f;
  --card: #ffffff;
  --line: #e1eee7;
  --field: #d5e4dc;
  --red: #b91c36;
  --red-dark: #9f1239;
  --shadow: 0 10px 28px rgba(24, 70, 48, 0.08), 0 1px 2px rgba(24, 70, 48, 0.04);
}

.tipo-inter { font-family: Inter, system-ui, sans-serif; color: var(--ink); }

.tarjeta {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  font-family: Inter, system-ui, sans-serif;
  overflow-wrap: anywhere;
}
.tarjeta.destello { box-shadow: 0 0 0 3px var(--green), var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: 0; border-radius: 16px;
  background: var(--green); color: #fff;
  font-family: Inter, system-ui, sans-serif; font-size: 1rem; font-weight: 700;
  cursor: pointer;
}
.btn:active { background: var(--green-dark); }
.btn:disabled { opacity: .5; }
.btn-sec { background: #fff; color: var(--green-dark); border: 1px solid var(--field); }
.btn-peligro { background: var(--red); }
.btn-peligro:active { background: var(--red-dark); }

.badge-vencido, .badge-7, .badge-30, .badge-ok, .badge-ilegible {
  display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px;
  border-radius: 999px; font-family: Inter, system-ui, sans-serif;
  font-size: 0.78rem; font-weight: 700;
}
.badge-vencido { background: #f8d0d6; color: #8e1b32; }
.badge-7 { background: #c2410c; color: #fff; }
.badge-30 { background: #ffe14a; color: #3f2a00; }
.badge-ok { background: #d5f3e4; color: #0e6a40; }
.badge-ilegible { background: #e6e9ed; color: #3e4a55; }

.barra-pestanas {
  position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); display: flex; align-items: stretch; justify-content: space-between;
  height: calc(68px + env(safe-area-inset-bottom));
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(23, 128, 86, 0.08);
  box-shadow: 0 -10px 30px rgba(24, 70, 48, 0.08);
  overflow: visible;
}
.barra-pestanas .pestana {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 48px; padding: 4px 2px 2px;
  border: 0; border-radius: 16px; background: transparent; color: var(--muted);
  font-family: Inter, system-ui, sans-serif; font-size: 0.68rem; font-weight: 600; line-height: 1.15;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
}
.barra-pestanas .pestana svg { width: 22px; height: 22px; }
.barra-pestanas .pestana.activa { color: var(--green-dark); }
.pestana-texto { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Boton central (Escanear), sobresale de la barra */
.barra-pestanas .pestana-central { overflow: visible; }
.pestana-central-boton {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  width: 58px; height: 58px; border-radius: 50%; background: var(--green-bright); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 20px rgba(30, 158, 106, 0.34), 0 0 0 4px #f4fbf7;
}
.pestana-central-boton svg { width: 26px; height: 26px; color: #fff; }

/* Boton flotante (feedback) */
.fab {
  position: fixed; z-index: 35; right: max(16px, calc(50% - 224px));
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: 48px; height: 48px; min-width: 48px; min-height: 48px; padding: 0;
  border: 0; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 18px rgba(24, 70, 48, 0.18);
}
.fab svg { width: 22px; height: 22px; }

/* ===== Hito 3 T4: vistas con pestañas ===== */
.vista { padding-bottom: calc(96px + env(safe-area-inset-bottom)); font-family: Inter, system-ui, sans-serif; color: var(--ink); }
.vista h2 { margin: 16px 0 8px; }
.lista-tarjetas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.producto-cab { display: flex; gap: 12px; align-items: center; }
.producto-cab .texto { display: flex; flex-direction: column; gap: 2px; }
.lote-fila { margin-top: 8px; }
.lote-boton { width: 100%; display: flex; gap: 8px; align-items: center; justify-content: space-between; background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font-size: 0.9rem; padding: 8px; }
.editor-lote { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.editor-lote input { flex: 1 1 140px; }
.contador { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 0.7rem; }

.banner { background: #fef3c7; color: #92400e; padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.lista-sel { list-style: none; padding: 0; margin: 0 0 8px; }
.lista-sel label { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--field); }
.tarea.listo { opacity: .6; }
.tarea span { display: block; color: var(--muted, #6b7280); font-size: .85rem; }
#fac-error { color: var(--red); }
#vista-facturas .fila { display: flex; flex-direction: row; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* Sin zoom ni ajuste automático de texto: el diseño se descuadra (pedido de Chris, 9-nov-2026). */
html, body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: none; }
