/* Paleta: web oficial La Positiva (#ff6d46, #00cec5, texto #2a2a2e) + Manual de Marca (lavanda, mango, verdes).
   Tipografía: IBM Plex (la de Mirai es propietaria; se usa la misma que la app de referencia ISF).
   REGLA: sin bordes de color. Contraste "flotante": tarjetas blancas con sombra suave sobre fondo gris.
   Los estados se distinguen con color de texto o fondo tenue, nunca con borde. */
:root {
  --bg: #f5f5f4; --surface: #fff; --border: #e2e2df; --border-focus: #a8a8a3; --line: #ececea; --text: #2a2a2e; --text-muted: #78786e;
  --accent: #ff6d46; --accent-dark: #e5532c; --accent-light: #fff0eb;
  --teal: #00cec5; --teal-light: #e6fbfa; --lavanda: #7878be; --lavanda-light: #efeff8;
  --mango: #ef9c21; --mango-light: #fdf3e1; --bosque: #00733f; --bosque-light: #e5f1ea;
  --danger: #dc2626; --danger-light: #fdecec;
  --sombra: 0 4px 18px rgba(30, 30, 40, .08);
  --sans: 'IBM Plex Sans', sans-serif; --mono: 'IBM Plex Mono', monospace;
}
html { zoom: .9; }   /* pantalla optimizada: se ve como el navegador al 90% en cualquier laptop */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 14px; min-height: 100vh; }
button { font: inherit; cursor: pointer; }
.contenedor { max-width: 1360px; margin: 0 auto; padding: 32px 24px; }   /* con márgenes laterales, como ISF */
.carga { max-width: 880px; margin: 0 auto; }

/* cabecera: misma estructura que la app ISF (ancho completo, logo + nombre del proyecto a la izquierda, línea neutra abajo) */
header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 32px; height: 72px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; }
.logo-img { height: 52px; width: auto; display: block; }
.cab-der { display: flex; align-items: center; gap: 10px; }
.chip-demo { background: var(--mango-light); color: #a86a00; font-family: var(--sans); font-size: 11px; padding: 2px 10px; border-radius: 99px; font-weight: 500; }

/* botones */
.btn { border: 0; background: var(--lavanda-light); padding: 9px 16px; border-radius: 10px; color: var(--text); }
.btn:hover:not(:disabled) { background: #e3e3f2; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primario { background: var(--accent); color: #fff; font-weight: 500; }
.btn-primario:hover:not(:disabled) { background: var(--accent-dark); }
.btn-chico { padding: 4px 11px; font-size: 12px; border-radius: 8px; }

/* acceso */
.pin-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
/* login: mismas medidas y textos que ISF (nombre del proyecto, "Código de acceso", subtítulo) */
.pin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2.5rem 2rem; width: 100%; max-width: 360px; text-align: center; box-shadow: var(--sombra); }
.pin-logo { font-family: var(--mono); font-size: 12px; color: var(--text-muted); margin-bottom: 1.75rem; letter-spacing: .03em; }
.pin-title { font-size: 17px; font-weight: 500; margin-bottom: .4rem; }
.pin-subtitle { font-size: 13px; color: var(--text-muted); }
.pin-container { display: flex; gap: 10px; justify-content: center; margin: 1.75rem 0 .75rem; }
.pin-input { width: 52px; height: 60px; text-align: center; font: 500 22px var(--mono); border: 2px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); outline: none; }
.pin-input:focus { border-color: var(--border-focus); }
.pin-input.filled { background: var(--teal-light); }   /* relleno tenue, sin borde de color */
.msg-error { color: var(--danger); min-height: 18px; margin-top: .25rem; font-size: 13px; }

/* carga */
.titulo { font-size: 18px; font-weight: 600; margin: 4px 0 12px; color: #5f5fa8; }
.bandejas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; background: var(--surface); border-radius: 16px; box-shadow: var(--sombra); padding: 20px; }
.etiqueta { font-size: 11px; font-weight: 500; color: #6767b0; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
/* zona de arrastre (referencia del usuario): celeste suave, borde punteado, título en negrita + "o haz clic" */
.bandeja { cursor: pointer; background: #def5f4; border: 2px dashed #7fbfb6; border-radius: 14px; min-height: 360px; padding: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; transition: background .15s; }
.bandeja:hover, .bandeja.sobre { background: #cdeeec; }
.bandeja.ok { background: var(--bosque-light); border-color: #86bfa3; }
.bandeja h2 { font-size: 15px; font-weight: 600; }
.bandeja .detalle { color: var(--text-muted); font-size: 12px; }
.verificacion { background: var(--surface); border-radius: 14px; box-shadow: var(--sombra); padding: 14px 18px; margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.verificacion .grow { flex: 1; }
.verificacion .btn { white-space: nowrap; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; background: var(--lavanda-light); color: var(--lavanda); }
.chip.ok { background: var(--bosque-light); color: var(--bosque); }
.chip.warn { background: var(--mango-light); color: #a86a00; }
.chip.err { background: var(--danger-light); color: var(--danger); }
.barra { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 8px; width: 80%; }
.barra > i { display: block; height: 100%; background: var(--teal); width: 0; transition: width .3s; }

/* tabla de archivos: filas SIEMPRE de una línea; el texto largo se corta con "…" (título completo al pasar el mouse) y nunca invade la columna vecina */
.panel { background: var(--surface); border-radius: 16px; box-shadow: var(--sombra); overflow: hidden; }
.tabla-wrap { height: calc(100vh / .9 - 292px); min-height: 320px; overflow: auto; }   /* llena la pantalla (compensa el zoom .9) */
table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
th { position: sticky; top: 0; z-index: 1; background: var(--accent); color: #fff; text-align: left; padding: 10px 8px; font-weight: 600; overflow: hidden; vertical-align: middle; white-space: nowrap; }
th + th { box-shadow: inset 1px 0 0 rgba(255, 255, 255, .5); }   /* división visible entre columnas, como en Excel */
th small { display: block; font-weight: 400; color: var(--text-muted); font-size: 10.5px; margin-top: 1px; line-height: 1.25; }
td { padding: 3px 8px; height: 30px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.mono { font-family: var(--mono); font-size: 12px; }
.c-paso { text-align: center; } .c-act { text-align: right; overflow: visible; }
.grip { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; touch-action: none; }
.grip:hover { background: rgba(255, 255, 255, .4); } /* .c-obs toma el espacio restante */
td.c-obs { color: var(--text-muted); font-size: 12px; }
tr.fila-pend td { background: var(--mango-light); }
tr.fila-pend td:nth-child(2) { font-weight: 600; }   /* el ID se nota en lo que hay que regularizar */
tr.fila-sel td { background: var(--lavanda-light); }
td .btn { color: #5d5dab; font-weight: 500; }
td.clic { cursor: pointer; }
td.clic:hover { text-decoration: underline; }
/* omitido = fila apagada (gris tenue), para ver de un vistazo que no seguirá */
tr.fila-omitida { opacity: .42; }
tr.fila-omitida td, tr.fila-omitida input { color: #8a8a82 !important; font-weight: 400 !important; }
.m-ok { color: var(--bosque); font-size: 15px; font-weight: 600; }
.m-fail { color: var(--danger); font-size: 15px; font-weight: 600; }
.m-na { color: #b5b5ad; }
.resumen-todos { color: var(--bosque); } .resumen-algunos { color: var(--text-muted); }
.m-completo { color: var(--text-muted); font-size: 11px; }
td.monto-dif, td.monto-dif input { color: var(--danger); font-weight: 500; }
.celda-edit { width: 100%; border: 0; background: transparent; font: inherit; color: inherit; padding: 3px 4px; border-radius: 6px; }
.celda-edit:hover { background: var(--bg); }
.celda-edit:focus { outline: none; background: var(--accent-light); }
.split { display: flex; gap: 16px; align-items: flex-start; }
.proceso { flex: 1 1 auto; min-width: 0; }
body.con-visor .contenedor { max-width: 1700px; }
.visor { flex: 0 0 34%; position: sticky; top: 12px; height: calc(100vh / .9 - 96px); background: var(--surface); border-radius: 16px; box-shadow: var(--sombra); display: flex; flex-direction: column; overflow: hidden; }
.visor-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; box-shadow: 0 1px 0 var(--line); font-size: 13px; }
.visor-cab strong { font-family: var(--mono); font-size: 15px; margin-right: 8px; }
.visor-cab span { color: var(--text-muted); }
.visor-paginas { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 14px; background: var(--bg); }
.v-hoja { width: var(--vw, 65%); margin: 0 auto; }
.v-hoja img { width: 100%; display: block; border-radius: 6px; background: #fff; box-shadow: var(--sombra); min-height: 220px; }
.v-hoja figcaption { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.vacio { padding: 50px; text-align: center; color: var(--text-muted); }

/* pasos: colores de marca a fondo completo (sin bordes). Disponible = lavanda; bloqueado = lavanda medio (se ve, sin competir);
   en curso = barra cian con el %; completo = cian; por regularizar = naranja de marca. */
.pasos { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.paso { flex: 1 1 150px; border: 0; border-radius: 14px; box-shadow: var(--sombra); padding: 12px 14px; text-align: left; background: var(--accent); color: #fff; transition: filter .15s; }
.paso small { display: block; font-size: 11px; margin-bottom: 2px; opacity: .85; }
.paso strong { font-weight: 500; }
.desc-paso { display: block; font-size: 11px; margin-top: 2px; opacity: .9; line-height: 1.25; }
.estado-paso { display: block; font-size: 11px; margin-top: 6px; opacity: .95; }
.estado-paso.ok { display: inline-block; background: #00736d; color: #fff; font-weight: 600; padding: 2px 10px; border-radius: 99px; opacity: 1; }   /* ✓ completo: se nota de lejos */
.estado-paso.en_curso { font-weight: 600; }
.estado-paso.regularizar { font-weight: 600; }
.paso:hover:not(:disabled) { filter: brightness(1.08); }
.paso:disabled { cursor: default; }
.paso.pendiente:disabled { background: #ffcdbd; color: #5d5dab; box-shadow: none; cursor: not-allowed; }
.paso.en_curso { background: linear-gradient(90deg, var(--teal) var(--pct, 0%), #c6f1ef var(--pct, 0%)); color: #00403c; }
.paso.ok { background: var(--teal); color: #00403c; }
.paso.regularizar { background: var(--lavanda); color: #fff; }

/* modal */
.modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal { background: var(--surface); border-radius: 16px; padding: 24px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; box-shadow: var(--sombra); }
.modal h3 { font-weight: 500; margin-bottom: 4px; }
.modal .id-grande { font: 600 24px var(--mono); margin: 2px 0; letter-spacing: .02em; }
.modal .detalle { color: var(--text-muted); font-size: 12px; }
.modal .motivo { background: var(--mango-light); padding: 9px 12px; border-radius: 10px; margin: 12px 0; font-size: 13px; }
.modal label { display: block; font-size: 12px; color: var(--text-muted); margin: 10px 0 4px; }
.modal input { width: 100%; padding: 9px 11px; border: 0; background: var(--bg); border-radius: 10px; font: inherit; }
.modal input:focus { outline: none; background: var(--accent-light); }
.modal .acciones { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal.ancho { max-width: 1280px; width: 96vw; display: flex; flex-direction: column; max-height: calc(100vh / .9 - 32px); }   /* cabecera y botones siempre visibles; solo las hojas se desplazan */
.editor-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.modal .ayuda { font-size: 13px; color: var(--text); margin: 4px 0 8px; line-height: 1.4; }
.modal .bandeja { min-height: 220px; margin-top: 10px; }
.enlace { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--text); text-decoration: underline; cursor: pointer; }
.modal .nota { font-size: 12px; color: var(--text-muted); margin-top: 12px; }
.dropzone { background: var(--bg); border-radius: 12px; padding: 26px 16px; text-align: center; color: var(--text-muted); cursor: pointer; margin-top: 10px; transition: background .15s; }
.dropzone.sobre { background: var(--accent-light); color: var(--text); }
.editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--min, 300px), 1fr)); gap: 14px; margin-top: 10px; flex: 1; min-height: 160px; overflow: auto; padding: 4px; align-content: start; }
.editor-barra { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.editor-barra .nota { margin: 0; }
.tam { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.slider { width: 160px; accent-color: var(--lavanda); }
.hoja { background: var(--surface); border-radius: 10px; box-shadow: var(--sombra); padding: 6px; cursor: grab; }
.hoja img { width: 100%; display: block; border-radius: 6px; background: var(--bg); min-height: 160px; }
.hoja-pie { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; }
.hoja-acc { display: flex; gap: 2px; }
.mini { border: 0; background: var(--lavanda-light); color: var(--lavanda); border-radius: 6px; width: 24px; height: 24px; font-size: 11px; }
.mini:hover { background: #e3e3f2; } .mini.x { color: var(--danger); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; }

@media (max-width: 720px) {
  .bandejas { grid-template-columns: 1fr; } .bandeja { min-height: 170px; }
  header { padding: 0 14px; height: 60px; } .logo-img { height: 40px; }
}

/* carga: KPI arriba, bandejas altas y "Continuar" de borde a borde (naranja de marca) */
.kpis-carga { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi-c { background: var(--surface); border-radius: 14px; box-shadow: var(--sombra); padding: 12px 16px; }
.kpi-c span { display: block; font: 600 28px var(--mono); color: #6767b0; line-height: 1.2; }
.kpi-c small { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.continuar { display: block; width: 100%; margin-top: 14px; padding: 17px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font: 600 16px var(--sans); box-shadow: var(--sombra); cursor: pointer; transition: background .15s; }
.continuar:hover:not(:disabled) { background: var(--accent-dark); }
.continuar:disabled { opacity: .35; cursor: not-allowed; }
.carga .enlace { color: #6767b0; }

/* encabezado: Descargar ZIP y Limpiar memoria más grandes; el ZIP parpadea suave al terminar */
.btn-grande { padding: 11px 22px; font-size: 14px; border-radius: 12px; }
.btn.btn-grande:not(.btn-primario) { color: #5d5dab; font-weight: 500; }
@keyframes pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 109, 70, .55); }
  50% { box-shadow: 0 0 0 10px rgba(255, 109, 70, 0); }
}
.pulso { animation: pulso 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulso { animation: none; } }
@media (max-width: 720px) { .kpis-carga { grid-template-columns: 1fr 1fr; } }

.turnstile { display: flex; justify-content: center; margin-top: 14px; }
.turnstile:empty { display: none; }
