:root {
  --azul: #1a373e;
  --azul2: #244a52;
  --acento: #0f7f86;
  --acento-suave: #e2f5f4;
  --verde: #12805c;
  --verde-suave: #e3f5ee;
  --ambar: #b26a00;
  --ambar-suave: #fff3dc;
  --rojo: #c62828;
  --rojo-suave: #fdecec;
  --gris: #64748b;
  --linea: #e2e8f0;
  --fondo: #f4f6fa;
  --blanco: #fff;
  --texto: #1e293b;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(26, 55, 62, .06), 0 4px 14px rgba(26, 55, 62, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--fondo); color: var(--texto); font-size: 15px; line-height: 1.45; }
a { color: var(--acento); }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
.oculto { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gris { color: var(--gris); }
.peq { font-size: .85rem; }
.derecha { text-align: right; }
.fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.crece { flex: 1; }

/* ── Layout ── */
.barra { background: var(--azul); color: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 18px; position: sticky; top: 0; z-index: 20; }
.barra img { height: 40px; width: auto; display: block; }
.barra .marca { border-left: 1px solid rgba(255,255,255,.25); padding-left: 14px; }
.barra { border-bottom: 3px solid #4fd1c5; }
.barra .marca { font-weight: 700; letter-spacing: .2px; }
.barra .marca small { display: block; font-weight: 400; opacity: .75; font-size: .78rem; }
.barra .usuario { margin-left: auto; font-size: .9rem; opacity: .9; text-align: right; }
.barra button { background: rgba(255,255,255,.12); color: #fff; border: 0; }
.barra button:hover { background: rgba(255,255,255,.22); }
.menuBtn { display: none; }
.app { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 56px); }
nav.lateral { background: var(--blanco); border-right: 1px solid var(--linea); padding: 14px 10px; }
nav.lateral a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 9px; color: var(--texto); text-decoration: none; font-weight: 500; margin-bottom: 2px; }
nav.lateral a:hover { background: var(--fondo); }
nav.lateral a.activo { background: var(--acento-suave); color: var(--acento); }
nav.lateral .sep { height: 1px; background: var(--linea); margin: 10px 6px; }
.badge { background: var(--rojo); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: .75rem; font-weight: 700; }
main { padding: 22px; max-width: 1200px; width: 100%; }

/* ── Componentes ── */
.tarjeta { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; }
.kpi .t { color: var(--gris); font-size: .85rem; }
.kpi .v { font-size: 1.55rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.rojo .v { color: var(--rojo); } .kpi.ambar .v { color: var(--ambar); } .kpi.verde .v { color: var(--verde); }
button, .boton { font: inherit; border: 1px solid var(--linea); background: var(--blanco); color: var(--texto); padding: 9px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .boton:hover { border-color: #cbd5e1; }
button.prim, .boton.prim { background: var(--acento); border-color: var(--acento); color: #fff; }
button.prim:hover { background: #0b6a70; }
button.ok { background: var(--verde); border-color: var(--verde); color: #fff; font-size: 1rem; padding: 11px 16px; }
button.ok:hover { background: #0e6a4c; }
button.peligro { color: var(--rojo); border-color: #f3c2c2; }
button.peligro.lleno { background: var(--rojo); color: #fff; border-color: var(--rojo); }
button.wa { background: #25d366; border-color: #25d366; color: #fff; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.chico { padding: 5px 10px; font-size: .85rem; }
input, select, textarea { font: inherit; width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7ecea; border-color: var(--acento); }
label { display: block; font-size: .85rem; color: var(--gris); font-weight: 600; margin-bottom: 4px; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; }
.campo { margin-bottom: 2px; }
.campo.ancho { grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
th { font-size: .8rem; color: var(--gris); text-transform: uppercase; letter-spacing: .3px; font-weight: 700; background: #f8fafc; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f8fafc; }
.tabla { overflow-x: auto; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.chip.verde { background: var(--verde-suave); color: var(--verde); }
.chip.ambar { background: var(--ambar-suave); color: var(--ambar); }
.chip.rojo { background: var(--rojo-suave); color: var(--rojo); }
.chip.azul { background: var(--acento-suave); color: var(--acento); }
.chip.gris { background: #eef2f6; color: var(--gris); }
.alerta { border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: .9rem; }
.alerta.alto { background: var(--rojo-suave); color: #8e1c1c; border: 1px solid #f5c6c6; }
.alerta.medio { background: var(--ambar-suave); color: #7a4a00; border: 1px solid #f5dca8; }
.alerta.bajo, .alerta.info { background: var(--acento-suave); color: #0b5a5f; border: 1px solid #bfe6e3; }
.aviso-clave { background: var(--ambar-suave); border: 1px solid #f5dca8; color: #7a4a00; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.barra-avance { height: 8px; background: #e8edf3; border-radius: 99px; overflow: hidden; }
.barra-avance > div { height: 100%; background: var(--verde); border-radius: 99px; }
.vacio { text-align: center; color: var(--gris); padding: 30px 10px; }
.miniatura { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--linea); cursor: zoom-in; background: #f1f5f9; }

/* Verificación */
.verif { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 18px; }
.verif .foto { background: #0b1b30; border-radius: 10px; display: flex; align-items: center; justify-content: center; min-height: 260px; overflow: hidden; cursor: zoom-in; }
.verif .foto img { max-width: 100%; max-height: 520px; display: block; }
.verif .foto .sin { color: #9fb3cc; padding: 30px; text-align: center; }
.datos dl { display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 6px 12px; margin: 0 0 12px; }
.datos dt { color: var(--gris); font-size: .88rem; }
.datos dd { margin: 0; font-weight: 600; }
.monto-grande { font-size: 1.8rem; font-weight: 800; color: var(--azul); font-variant-numeric: tabular-nums; }
.pasos-verif { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 10px 14px; font-size: .88rem; color: #334155; margin: 10px 0; }
.pasos-verif ol { margin: 4px 0 0; padding-left: 20px; }

/* Modal */
.modal-fondo { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.ancho { max-width: 900px; }
.modal .pie { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.visor { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 60; display: flex; align-items: center; justify-content: center; cursor: zoom-out; overflow: auto; }
.visor img { max-width: 96vw; max-height: 96vh; }
.visor.zoom img { max-width: none; max-height: none; }
.preview-img { max-width: 100%; max-height: 300px; border-radius: 10px; border: 1px solid var(--linea); display: block; margin-top: 8px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--azul); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 80; box-shadow: var(--sombra); max-width: 90vw; }
.toast.error { background: var(--rojo); }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #10262b, var(--azul) 55%, #1f5359); padding: 20px; }
.login .tarjeta { width: 100%; max-width: 380px; padding: 28px; }
.login img { width: 230px; max-width: 80%; height: auto; display: block; margin: 0 auto 14px; }
.login h1 { text-align: center; }

/* Plan */
.resumen-plan { background: var(--acento-suave); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.resumen-plan div span { display: block; font-size: .8rem; color: var(--gris); }
.resumen-plan div b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.cuota-vencida td { background: #fff7f7; }
.cuota-pagada td { color: var(--gris); }

/* Impresión */
.solo-impresion { display: none; }
@media print {
  .barra, nav.lateral, .no-imprimir, .toast { display: none !important; }
  .app { display: block; } main { padding: 0; max-width: none; }
  .tarjeta { box-shadow: none; padding: 0; margin-bottom: 12px; }
  .solo-impresion { display: block; }
  body { background: #fff; font-size: 12px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  nav.lateral { display: none; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; z-index: 30; overflow-y: auto; }
  nav.lateral.abierto { display: block; }
  .menuBtn { display: inline-flex; }
  main { padding: 14px; }
  .verif { grid-template-columns: 1fr; }
  .verif .foto { min-height: 110px; }
  .datos dl { grid-template-columns: 120px 1fr; }
  .barra .usuario span.nombre { display: none; }
}
