@font-face { font-family: "Plus Jakarta Sans"; src: url("fuentes/plus-jakarta-sans_200-800.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fuentes/ibm-plex-mono_500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --noche: #071430; --marino: #0b1f4d; --azul: #1244a0; --celeste: #6cc4ff;
  --papel: #f1f4fa; --tinta: #0d1a36; --gris: #5b6684; --linea: #dbe2ef; --tarjeta: #fbfcfe;
  --sube: #b42318; --baja: #12704a; --wsp: #25d366;
  --r: 22px; --sombra: 0 18px 40px rgba(13, 26, 54, .10);
  --nav: 72px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--papel); color: var(--tinta); }
body { font: 500 16px/1.45 "Plus Jakarta Sans", system-ui, sans-serif; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
a { color: var(--azul); }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; line-height: 1.1; font-weight: 800; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gris); }
.oculto { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 0; background: var(--azul); color: #fff; font-weight: 700; cursor: pointer;
  transition: transform .12s ease, background .15s ease, opacity .15s; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.claro { background: #fff; color: var(--azul); box-shadow: inset 0 0 0 1.5px var(--linea); }
.btn.peligro { background: #fff; color: var(--sube); box-shadow: inset 0 0 0 1.5px #f3c7c2; }
.btn.chico { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn.ancho { width: 100%; }
.btn svg { width: 20px; height: 20px; }
.icono { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Campos */
label.campo { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--gris); }
.entrada { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--linea);
  background: #fff; color: var(--tinta); font-weight: 600; outline: none; transition: border-color .15s; }
.entrada:focus { border-color: var(--azul); }
.buscador { position: relative; }
.buscador .icono { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--gris); width: 20px; height: 20px; }
.buscador .entrada { padding-left: 44px; border-radius: 999px; min-height: 50px; }

/* Entrada */
.entrada-pantalla { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 70% at 50% 0%, #1f5fd0 0%, var(--noche) 60%); color: #f6f8fc; }
.entrada-caja { width: min(380px, 100%); display: grid; gap: 18px; }
.entrada-caja h1 { font-size: 40px; }
.entrada-caja h1 b { color: var(--celeste); font-weight: 800; }
.entrada-caja p { margin: 0; color: #e2e9f8; }
.entrada-caja .entrada { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: #fff; }
.entrada-caja .entrada:focus { border-color: var(--celeste); }
.entrada-caja label.campo { color: #e2e9f8; }
.entrada-caja .btn { background: var(--celeste); color: var(--noche); }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; }
.marca img { width: 30px; height: 30px; }

/* App */
.cabecera { position: sticky; top: 0; z-index: 5; background: rgba(241,244,250,.92); backdrop-filter: blur(10px);
  padding: calc(env(safe-area-inset-top) + 12px) 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cabecera .negocio { font-size: 13px; color: var(--gris); font-weight: 700; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { padding: 4px 18px calc(var(--nav) + 32px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.vista { display: grid; gap: 14px; animation: entra .22s ease-out; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.titulo { font-size: 28px; }

.aviso { border-radius: 16px; padding: 12px 14px; font-size: 14px; font-weight: 600; background: #fff4d6; color: #6b4a00; }
.aviso.mal { background: #fde8e6; color: #7a1a12; }
.aviso.info { background: #e3efff; color: #123a80; }

/* Navegación inferior */
nav.barra { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--nav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff; box-shadow: 0 -10px 30px rgba(13,26,54,.08);
  display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; }
nav.barra.dos { grid-template-columns: repeat(2, 1fr); }
nav.barra button { background: none; border: 0; display: grid; justify-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--gris); cursor: pointer; padding: 8px 0; }
nav.barra button.activo { color: var(--azul); }
nav.barra button.foto span.circulo { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin-top: -26px;
  background: linear-gradient(135deg, var(--celeste), var(--azul)); color: #fff; box-shadow: 0 12px 26px rgba(18,68,160,.35); transition: transform .12s; }
nav.barra button.foto:active span.circulo { transform: scale(.94); }
nav.barra button.foto .icono { width: 26px; height: 26px; }

/* Tarjetas y listas */
.tarjeta { background: var(--tarjeta); border-radius: var(--r); box-shadow: var(--sombra); padding: 16px; }
.lista { display: grid; gap: 10px; }
.fila { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: #fff; border-radius: 18px;
  padding: 14px 16px; box-shadow: 0 6px 18px rgba(13,26,54,.06); cursor: pointer; border: 0; text-align: left; width: 100%; transition: transform .12s; }
.fila:active { transform: scale(.985); }
.fila .nombre { font-weight: 800; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.fila .sub { font-size: 13px; color: var(--gris); font-weight: 600; grid-column: 1; overflow-wrap: anywhere; }
.fila .derecha { text-align: right; grid-row: 1 / span 2; grid-column: 2; display: grid; gap: 4px; justify-items: end; }
.fila .monto { font-weight: 800; font-size: 16px; }
.grupo-mes { margin: 10px 2px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.chip.sube { background: #fde8e6; color: var(--sube); }
.chip.baja { background: #ddf3e8; color: var(--baja); }
.chip.neutro { background: #e8edf7; color: var(--gris); }
.vacio { text-align: center; color: var(--gris); padding: 40px 10px; display: grid; gap: 10px; justify-items: center; }
.vacio .icono { width: 40px; height: 40px; color: var(--celeste); }

/* Foto */
.foto-inicio { display: grid; gap: 14px; text-align: center; padding: 26px 18px; }
.foto-inicio .grande { min-height: 64px; font-size: 18px; }
.foto-inicio p { margin: 0; color: var(--gris); }
.leyendo { display: grid; gap: 16px; justify-items: center; text-align: center; padding: 30px 10px; }
.leyendo img { max-height: 46vh; max-width: 100%; border-radius: 16px; box-shadow: var(--sombra); }
.barra-progreso { width: min(320px, 90%); height: 8px; border-radius: 999px; background: var(--linea); overflow: hidden; }
.barra-progreso i { display: block; height: 100%; width: 40%; border-radius: 999px; background: linear-gradient(90deg, var(--celeste), var(--azul)); animation: carga 1.4s ease-in-out infinite; }
@keyframes carga { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* Formulario de revisión */
.rev-cab { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rev-cab .ancho2 { grid-column: span 2; }
.miniatura { width: 100%; max-height: 180px; object-fit: cover; object-position: top; border-radius: 16px; cursor: zoom-in; display: block; }
.linea-ed { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; padding: 12px; border-radius: 16px; background: #fff; box-shadow: 0 4px 14px rgba(13,26,54,.05); }
.linea-ed .prod { grid-column: 1 / -1; }
.linea-ed .entrada { min-height: 42px; padding: 8px 10px; font-size: 15px; }
.linea-ed .quitar { align-self: end; width: 42px; height: 42px; border-radius: 12px; border: 0; background: #fde8e6; color: var(--sube); cursor: pointer; display: grid; place-items: center; }
.linea-ed .mini { font-size: 11px; color: var(--gris); font-weight: 700; display: grid; gap: 3px; }
.cuadre { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; padding: 12px 14px; border-radius: 14px; }
.cuadre.ok { background: #ddf3e8; color: var(--baja); }
.cuadre.mal { background: #fff4d6; color: #6b4a00; }
.pie-fijo { position: sticky; bottom: calc(var(--nav) + 34px + env(safe-area-inset-bottom)); display: flex; gap: 10px; padding-top: 6px; }
.pie-fijo .btn { flex: 1; box-shadow: 0 10px 24px rgba(18,68,160,.25); }
.interruptor { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--gris); }
.interruptor input { width: 22px; height: 22px; accent-color: var(--azul); }

/* Detalle */
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 11px; color: var(--gris); font-weight: 700; padding: 6px 4px; border-bottom: 1.5px solid var(--linea); }
.tabla td { padding: 10px 4px; border-bottom: 1px solid var(--linea); vertical-align: top; }
.tabla td.d, .tabla th.d { text-align: right; white-space: nowrap; }
.totales { display: grid; gap: 4px; justify-items: end; font-weight: 700; }
.totales .grande { font-size: 22px; font-weight: 800; }
.dato { display: grid; gap: 2px; }
.dato span { font-size: 12px; color: var(--gris); font-weight: 700; }
.datos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; }
.volver { background: none; border: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--azul); padding: 6px 0; cursor: pointer; }

/* Historial de producto */
.grafico { width: 100%; height: 120px; }
.resumen-prod { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.resumen-prod .tarjeta { padding: 12px; }
.resumen-prod b { font-size: 18px; display: block; }

/* Cuenta */
.uso { height: 12px; border-radius: 999px; background: var(--linea); overflow: hidden; }
.uso i { display: block; height: 100%; background: linear-gradient(90deg, var(--celeste), var(--azul)); border-radius: 999px; }
.clave-nueva { font-family: "IBM Plex Mono", monospace; font-size: 18px; background: #e3efff; padding: 10px 14px; border-radius: 12px; user-select: all; }

/* Visor de foto */
.visor { position: fixed; inset: 0; z-index: 50; background: rgba(7,20,48,.94); display: grid; place-items: center; padding: 16px; overflow: auto; }
.visor img, .visor iframe { max-width: 100%; max-height: 92dvh; border-radius: 12px; background: #fff; }
.visor iframe { width: 100%; height: 92dvh; border: 0; }
.visor .cerrar { position: fixed; top: 14px; right: 14px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: var(--tinta); cursor: pointer; display: grid; place-items: center; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav) + 24px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 60;
  background: var(--noche); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: 0 16px 34px rgba(7,20,48,.35); animation: entra .2s ease-out; max-width: 90vw; text-align: center; }

.credito { text-align: center; font-size: 12px; color: var(--gris); padding: 20px 0 0; }
.credito a { color: var(--gris); font-weight: 700; }

@media (min-width: 900px) {
  nav.barra { left: 50%; translate: -50% 0; bottom: 16px; width: 520px; border-radius: 24px; height: var(--nav); padding: 0; box-shadow: 0 16px 40px rgba(13,26,54,.16); }
  main { padding-bottom: calc(var(--nav) + 60px); }
  .pie-fijo { bottom: calc(var(--nav) + 26px); }
}
