:root {
  --fondo: #eef0ea;
  --hoja: #fbfbf7;
  --tinta: #1c2622;
  --suave: #5d6a64;
  --linea: #d9ddd3;
  --renglon: #e8ece4;
  --verde: #1f3b33;
  --verde-2: #2f6b57;
  --verde-claro: #e2eee8;
  --rojo: #a5392b;
  --ambar: #9a6a12;
  --azul: #2d5a8a;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); color: var(--tinta); font: 15.5px/1.5 var(--sans); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--verde-2); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.envoltura { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--rojo); }

.cab { background: var(--verde); color: #f1f4ef; padding: 26px 0 22px; margin-bottom: 22px; }
.marca { display: flex; gap: 14px; align-items: center; }
.sello { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid #8fb3a4; display: grid; place-items: center; font-size: 22px; flex: none; }
.cab h1 { font-size: 24px; letter-spacing: -.01em; }
.cab .marca p { margin: 2px 0 0; color: #c6d6ce; }
.privado { margin: 14px 0 0; font-size: 14px; color: #c6d6ce; border-left: 2px solid #8fb3a4; padding-left: 12px; }
.privado b { color: #fff; font-weight: 600; }

/* La hoja tiene renglones de libro contable de fondo */
.hoja { background: var(--hoja); border: 1px solid var(--linea); border-radius: 10px; padding: 22px; margin-bottom: 18px;
  background-image: linear-gradient(var(--renglon) 1px, transparent 1px); background-size: 100% 32px; background-position: 0 70px; background-repeat: repeat-y; }
.hoja-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.hoja h2 { font-size: 18px; }
.ayuda { color: var(--suave); font-size: 14px; margin: 4px 0 14px; }

.boton { border: 0; border-radius: 8px; padding: 10px 18px; background: var(--verde); color: #fff; font-weight: 600; cursor: pointer; }
.boton:hover { background: var(--verde-2); }
.boton:disabled { opacity: .45; cursor: default; background: var(--verde); }
.boton.claro { background: var(--hoja); color: var(--tinta); border: 1px solid var(--linea); font-weight: 500; }
.boton.claro:hover { border-color: var(--verde-2); color: var(--verde-2); }
.acciones { display: flex; gap: 8px; }

.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.archivo { background: #fff; border: 1px solid var(--linea); border-radius: 10px; padding: 16px; }
.archivo h3 { font-size: 15px; margin-bottom: 10px; }
.soltar { display: grid; place-items: center; min-height: 92px; border: 1.5px dashed #b9c2b6; border-radius: 8px; color: var(--suave); cursor: pointer; text-align: center; padding: 12px; transition: background .15s, border-color .15s; }
.soltar:hover, .soltar.encima { border-color: var(--verde-2); background: var(--verde-claro); color: var(--verde); }
.archivo.cargado .soltar { min-height: 0; padding: 8px; font-size: 13px; }
.nombre { margin: 12px 0 8px; font-size: 13.5px; color: var(--suave); overflow-wrap: anywhere; }
.nombre b { color: var(--tinta); }
.mapeo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.mapeo label, .saldo { display: grid; gap: 3px; font-size: 12.5px; color: var(--suave); }
.mapeo select, .saldo input, .opciones select { border: 1px solid var(--linea); border-radius: 6px; padding: 6px 8px; background: #fff; font-size: 14px; min-width: 0; }
.saldo { margin-top: 10px; }
.saldo input { font-family: var(--mono); }
.vista { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.vista td { padding: 4px 6px; border-top: 1px solid var(--renglon); }
.vista td:nth-child(2) { color: var(--suave); max-width: 0; width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.opciones { display: flex; gap: 18px; align-items: end; flex-wrap: wrap; margin-top: 16px; }
.opciones > label { display: grid; gap: 3px; font-size: 13px; color: var(--suave); }
.opciones .check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--tinta); padding-bottom: 8px; }
.opciones .boton { margin-left: auto; padding: 11px 28px; }
.error { color: var(--rojo); font-size: 14px; margin: 10px 0 0; min-height: 1em; }

.cifras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; scroll-margin-top: 16px; }
.cifra { background: var(--hoja); border: 1px solid var(--linea); border-radius: 10px; padding: 14px 16px; }
.cifra b { display: block; font: 600 26px/1.15 var(--mono); }
.cifra span { font-size: 13px; color: var(--suave); }
.cifra.bien { border-color: #9cc5b2; background: var(--verde-claro); }
.cifra.bien b { color: var(--verde-2); }
.cifra.mal { border-color: #e2b3aa; background: #fbecea; }
.cifra.mal b { color: var(--rojo); }

.estado { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 10px; }
.estado table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; }
.estado caption { text-align: left; font-weight: 600; padding: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); }
.estado td { padding: 9px 14px; border-top: 1px solid var(--renglon); }
.estado tr.base td { font-weight: 600; border-top: 0; }
.estado tr.total td { font-weight: 700; border-top: 2px solid var(--tinta); background: #f4f6f1; }
.veredicto { grid-column: 1 / -1; margin: 0; padding: 12px 14px; border-radius: 8px; background: #f1f2ee; font-size: 14.5px; }
.veredicto.bien { background: var(--verde-claro); color: var(--verde); }
.veredicto.mal { background: #fbecea; color: #6f261c; }
.pistas { margin-top: 14px; border: 1px solid #ecd7a8; background: #fdf6e6; border-radius: 8px; padding: 12px 14px; }
.pistas h3 { font-size: 14px; margin-bottom: 4px; color: var(--ambar); }
.pistas p { margin: 4px 0 0; font-size: 14px; }

.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--linea); margin: 12px 0 4px; overflow-x: auto; }
.pestanas button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px; cursor: pointer; color: var(--suave); white-space: nowrap; }
.pestanas button span { font-family: var(--mono); font-size: 12.5px; background: #e9ece5; border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.pestanas button[aria-selected="true"] { color: var(--tinta); border-bottom-color: var(--verde-2); font-weight: 600; }

.tabla { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.tabla th, .tabla td { padding: 8px 10px; border-bottom: 1px solid var(--renglon); text-align: left; vertical-align: top; }
.tabla thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); font-weight: 600; }
.tabla .ref { font-family: var(--mono); font-size: 12.5px; color: var(--suave); }
.tabla td.num, .tabla th.num { text-align: right; }
.motivo { display: inline-block; font-size: 12.5px; padding: 2px 8px; border-radius: 99px; background: #eef0ea; }
.motivo[class*="nd_"] { background: #fbecea; color: #7d2c20; }
.motivo[class*="nc_"] { background: var(--verde-claro); color: var(--verde); }
.motivo.cheque_girado, .motivo.pago_transito { background: #e8eef7; color: var(--azul); }
.motivo.deposito_transito { background: #fdf3df; color: var(--ambar); }
.vacio { color: var(--suave); padding: 18px; text-align: center; border: 1px dashed var(--linea); border-radius: 8px; background: #fff; }

.pares { display: grid; gap: 10px; }
.par { border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; background: #fff; }
.par-cab { display: flex; gap: 12px; align-items: center; padding: 7px 10px; background: #f4f6f1; font-size: 13px; color: var(--suave); }
.par-cab b { margin-left: auto; color: var(--tinta); }
.tipo { font-weight: 600; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #e9ece5; color: var(--tinta); }
.tipo.referencia { background: #e8eef7; color: var(--azul); }
.tipo.agrupado { background: #fdf3df; color: var(--ambar); }
.tabla.mini th { width: 70px; font-size: 12px; color: var(--suave); font-weight: 600; }
.tabla.mini tr:last-child td, .tabla.mini tr:last-child th { border-bottom: 0; }

.pie { color: var(--suave); font-size: 13px; text-align: center; padding: 18px 20px 36px; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .dos, .estado, .mapeo { grid-template-columns: 1fr; }
  .cifras { grid-template-columns: 1fr 1fr; }
  .opciones .boton { margin-left: 0; width: 100%; }
  .hoja { padding: 16px; }
  .tabla .ref, .tabla thead th:nth-child(2) { display: none; }
}
@media print {
  body { background: #fff; }
  .cab, .opciones, .acciones, .pestanas, .pie, #subida { display: none; }
  .hoja { border: 0; padding: 0; background: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
