/* Gestión PAS — azul marino, dorado y fondo claro. Contrastes verificados (texto ≥ 4.5:1). */
:root {
  --navy: #0E1F3D; --navy-2: #172B52; --navy-3: #22396A;
  --oro: #C9A24B; --oro-osc: #8A6514; --oro-claro: #F5ECD7;
  --fondo: #F6F4EE; --sup: #FFFFFF; --tinta: #14213D; --mut: #586175; --linea: #E2DED3;
  --ok: #1D6B3A; --ok-f: #E5F2E9; --warn: #8A4B06; --warn-f: #FCEFD9; --bad: #A32116; --bad-f: #FBE7E4; --neu: #3E4853; --neu-f: #ECEDEA;
  --radio: 14px; --sombra: 0 1px 2px rgba(14, 31, 61, .06), 0 4px 16px rgba(14, 31, 61, .05);
  --fuente: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 var(--fuente); color: var(--tinta); background: var(--fondo); }
a { color: var(--navy-3); }
a:hover { color: var(--navy); }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
h2, h3 { margin: 0; }
p { margin: 0 0 8px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; }
.mut { color: var(--mut); }
.cap::first-letter { text-transform: uppercase; }
.pre { white-space: pre-wrap; }
.txt-ok { color: var(--ok); } .txt-warn { color: var(--warn); } .txt-bad { color: var(--bad); }

/* ---------- estructura */
#app { min-height: 100vh; }
.lateral { display: none; }
.principal { min-height: 100vh; padding-bottom: 92px; }
.cabecera { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: var(--navy); color: #fff; border-bottom: 3px solid var(--oro); }
.cabecera-txt { display: flex; flex-direction: column; line-height: 1.2; }
.cabecera-txt small { color: #C9D2E6; font-size: 12px; }
main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 24px; outline: none; }
.marca-logo { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--oro); color: var(--navy); font-weight: 800; letter-spacing: .02em; flex: none; }
.marca-logo.chico { width: 32px; height: 32px; font-size: 13px; border-radius: 8px; }
.marca-logo.grande { width: 64px; height: 64px; font-size: 24px; border-radius: 16px; margin: 0 auto 12px; display: flex; }

.inferior { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--sup); border-top: 1px solid var(--linea); padding: 6px 4px max(8px, env(safe-area-inset-bottom)); }
.inferior a, .inferior button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px;
  color: var(--mut); text-decoration: none; font: 500 11px var(--fuente); background: none; border: 0; cursor: pointer; }
.inferior a.activo { color: var(--navy); font-weight: 700; }
.inferior a.activo svg { color: var(--oro-osc); }
.inferior .central span { width: 52px; height: 52px; border-radius: 16px; background: var(--navy); color: var(--oro); display: flex; align-items: center; justify-content: center; box-shadow: var(--sombra); }

@media (min-width: 900px) {
  #app { display: flex; }
  .lateral { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; width: 248px; flex: none;
    background: var(--navy); color: #fff; padding: 20px 14px; overflow-y: auto; }
  .marca { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; border-bottom: 1px solid var(--navy-3); margin-bottom: 8px; }
  .marca span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
  .marca small { color: #C9D2E6; font-size: 12px; }
  .lateral nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
  .lateral nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #DCE3F1; text-decoration: none; font-weight: 500; }
  .lateral nav a:hover { background: var(--navy-2); color: #fff; }
  .lateral nav a.activo { background: var(--navy-3); color: #fff; box-shadow: inset 3px 0 0 var(--oro); }
  .lateral nav a.activo svg { color: var(--oro); }
  .lateral .salir { margin-top: auto; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #C9D2E6; padding: 10px 12px; cursor: pointer; font: 500 14px var(--fuente); border-radius: 10px; }
  .lateral .salir:hover { background: var(--navy-2); color: #fff; }
  .version { color: #8E9BB8; padding: 0 12px; }
  .principal { flex: 1; min-width: 0; padding-bottom: 24px; }
  .cabecera, .inferior { display: none; }
  main { padding: 28px 32px; }
  .solo-escritorio { display: inline-flex !important; }
}
.solo-escritorio { display: none !important; }

/* ---------- acceso */
.acceso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(180deg, var(--navy) 0, var(--navy) 42%, var(--fondo) 42%); }
.acceso-caja { width: 100%; max-width: 400px; background: var(--sup); border-radius: 18px; padding: 28px 22px; box-shadow: 0 10px 40px rgba(14,31,61,.18); text-align: center; }
.acceso-caja .campo, .acceso-caja .error, .acceso-caja .ayuda { text-align: left; }
.acceso-caja h1 { margin-bottom: 4px; }
.acceso-caja .btn { margin-top: 8px; }

/* ---------- componentes */
.titulo-vista { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.titulo-vista h1 .chip { vertical-align: middle; margin-left: 6px; }
.volver { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; text-decoration: none; font-weight: 600; min-height: 44px; }
.etiqueta { font-size: 13px; font-weight: 700; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.cuenta { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 99px; background: var(--neu-f); color: var(--neu); font-size: 12px; font-weight: 700; text-align: center; text-transform: none; letter-spacing: 0; vertical-align: middle; }
h1 .cuenta { font-size: 14px; }
.tarjeta { background: var(--sup); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); }
.pad { padding: 16px; }
.bloque-seccion { margin-bottom: 18px; }
.fila-tit { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.fila-tit .etiqueta { margin-bottom: 0; }
.par { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; }
.separador { height: 1px; background: var(--linea); margin: 14px 0; }
.ayuda { font-size: 13px; color: var(--mut); }
.vacio { text-align: center; padding: 28px 16px; color: var(--mut); }
.cargando { padding: 40px 0; text-align: center; color: var(--mut); }

.lista { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.lista > li + li { border-top: 1px solid var(--linea); }
.fila { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; color: inherit; text-decoration: none; }
a.fila:hover, .boton-fila:hover { background: #FAF8F2; }
.boton-fila { width: 100%; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.fila-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.fila-txt strong { overflow-wrap: anywhere; }
.fila-txt small { color: var(--mut); font-size: 13px; }
.flecha { color: var(--mut); font-size: 22px; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.punto.bad { background: var(--bad); } .punto.warn { background: #C27A0E; } .punto.neu { background: #8A93A3; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--oro-claro); color: var(--oro-osc); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.num { width: 28px; height: 28px; border-radius: 8px; background: var(--neu-f); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.resalta-bad { background: #FFF8F7; } .resalta-warn { background: #FFFBF3; }

.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.ok { background: var(--ok-f); color: var(--ok); } .chip.warn { background: var(--warn-f); color: var(--warn); }
.chip.bad { background: var(--bad-f); color: var(--bad); } .chip.neu { background: var(--neu-f); color: var(--neu); }
.nota { padding: 10px 14px; border-radius: 12px; margin: 0 0 14px; font-size: 14px; background: var(--neu-f); }
.nota.ok { background: var(--ok-f); color: var(--ok); } .nota.warn { background: var(--warn-f); color: var(--warn); } .nota.bad { background: var(--bad-f); color: var(--bad); }
.nota .btn { margin-left: 8px; }

.indicadores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
@media (min-width: 700px) { .indicadores { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.indicadores.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.indicador { padding: 14px 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.indicador small { color: var(--mut); font-size: 13px; }
.indicador strong { font-size: 22px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
a.indicador:hover { border-color: var(--oro); }

.barra { height: 8px; background: var(--neu-f); border-radius: 99px; overflow: hidden; margin: 6px 0 12px; }
.barra span { display: block; height: 100%; background: var(--navy-3); border-radius: 99px; }
.barra.alerta span { background: var(--bad); }

.datos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 6px 0 12px; }
.datos dt { color: var(--mut); font-size: 14px; }
.datos dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .datos { grid-template-columns: 1fr; gap: 0; } .datos dd { margin-bottom: 8px; } }

.contacto { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--navy); background: var(--navy); color: #fff; font: 600 15px var(--fuente); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--navy-2); color: #fff; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.oro { background: var(--oro); border-color: var(--oro); color: var(--navy); }
.btn.oro:hover { background: #D4B05E; color: var(--navy); }
.btn.sec { background: var(--sup); color: var(--navy); border-color: #C9CEC6; }
.btn.sec:hover { border-color: var(--navy); background: #FBFAF6; color: var(--navy); }
.btn.peligro { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.texto { background: none; border-color: transparent; color: var(--navy-3); padding: 0 8px; }
.btn.texto.peligro { color: var(--bad); }
.btn.chico { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.bloque { width: 100%; }
.btn-icono { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--linea); background: var(--sup); color: var(--navy); cursor: pointer; flex: none; text-decoration: none; }
.btn-icono:hover { border-color: var(--navy); }
.grupo-btn { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chico-mb { margin-bottom: 12px; }
.acciones { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.acciones-pie { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.acciones.fija { position: sticky; bottom: 76px; background: var(--fondo); padding: 12px 0; margin: 0; z-index: 5; }
@media (min-width: 900px) { .acciones.fija { bottom: 0; } }

/* ---------- formularios */
.form { display: block; }
.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.campo > span { font-size: 14px; font-weight: 600; color: var(--mut); }
.campo.en-linea { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #C9CEC6; border-radius: 10px; background: var(--sup);
  font: 16px var(--fuente); color: var(--tinta); }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-3); outline: 2px solid var(--oro-claro); }
input:disabled, select:disabled { background: #F2F1EC; color: var(--mut); }
.grilla2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 560px) { .grilla2 { grid-template-columns: 1fr; } }
.opcion { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-right: 12px; }
.opcion input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--navy); }
.error { color: var(--bad); background: var(--bad-f); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.desplegable { margin: 4px 0 8px; }
.desplegable summary { cursor: pointer; font-weight: 600; color: var(--navy-3); min-height: 44px; display: flex; align-items: center; }
.buscador { display: flex; align-items: center; gap: 8px; background: var(--sup); border: 1px solid #C9CEC6; border-radius: 12px; padding: 0 12px; margin-bottom: 12px; color: var(--mut); }
.buscador input { border: 0; outline: none; padding-left: 0; }
.opciones-cliente:empty { display: none; }
.opciones-cliente { margin-bottom: 10px; }

.filtros { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.filtro { flex: none; padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 99px; border: 1px solid #C9CEC6; background: var(--sup); color: var(--navy); text-decoration: none; font-weight: 600; font-size: 14px; }
.filtro.activo { background: var(--navy); color: #fff; border-color: var(--navy); }

.tabla-cuotas { width: 100%; border-collapse: collapse; margin: 10px 0; }
.tabla-cuotas th { text-align: left; font-size: 13px; color: var(--mut); padding: 6px 4px; }
.tabla-cuotas td { padding: 4px; vertical-align: middle; }
.tabla-cuotas td:first-child { width: 32px; font-weight: 700; }
.tabla-cuotas input { min-height: 42px; }
.tabla-envoltura { overflow-x: auto; background: var(--sup); border: 1px solid var(--linea); border-radius: var(--radio); }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { padding: 10px 12px; border-bottom: 1px solid var(--linea); text-align: left; white-space: nowrap; }
.tabla th { color: var(--mut); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.der { text-align: right !important; font-variant-numeric: tabular-nums; }

.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #A9B0A6; background: var(--sup); flex: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.check:hover { border-color: var(--ok); }
.check.hecho { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ---------- ventanas y avisos */
.ventana-fondo { position: fixed; inset: 0; z-index: 50; background: rgba(14, 31, 61, .45); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .ventana-fondo { align-items: center; padding: 20px; } }
.ventana { background: var(--sup); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 640px) { .ventana { border-radius: 18px; } }
.ventana-cab { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--linea); position: sticky; top: 0; background: var(--sup); z-index: 1; }
.ventana-cab h2 { font-size: 18px; }
.ventana-cuerpo { padding: 16px; }
.hoja { background: var(--sup); width: 100%; border-radius: 18px 18px 0 0; padding: 10px 10px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.hoja a, .hoja button { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 14px; border-radius: 12px; color: var(--navy); text-decoration: none; background: none; border: 0; font: 600 16px var(--fuente); cursor: pointer; }
.hoja a:hover, .hoja button:hover { background: var(--fondo); }
.hoja .sec { justify-content: center; color: var(--mut); margin-top: 6px; }
#avisos { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 900px) { #avisos { bottom: 24px; } }
.aviso { padding: 12px 16px; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 15px; }
.aviso.bad { background: var(--bad); } .aviso.warn { background: var(--warn); } .aviso.neu { background: var(--navy-3); }

@media (prefers-reduced-motion: no-preference) { .ventana, .hoja { animation: subir .18s ease-out; } }
@keyframes subir { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
@media print { .lateral, .cabecera, .inferior, .btn, .acciones { display: none !important; } body { background: #fff; } }
.ancho-0{width:0%}
.ancho-5{width:5%}
.ancho-10{width:10%}
.ancho-15{width:15%}
.ancho-20{width:20%}
.ancho-25{width:25%}
.ancho-30{width:30%}
.ancho-35{width:35%}
.ancho-40{width:40%}
.ancho-45{width:45%}
.ancho-50{width:50%}
.ancho-55{width:55%}
.ancho-60{width:60%}
.ancho-65{width:65%}
.ancho-70{width:70%}
.ancho-75{width:75%}
.ancho-80{width:80%}
.ancho-85{width:85%}
.ancho-90{width:90%}
.ancho-95{width:95%}
.ancho-100{width:100%}
/* Tabla de cuotas: reparto fijo del ancho para que el importe se lea entero en celular */
.tabla-cuotas { table-layout: fixed; }
.tabla-cuotas th:first-child { width: 30px; }
.tabla-cuotas th:last-child { width: 46px; }
.tabla-cuotas th:nth-child(2) { width: 52%; }
.tabla-cuotas input { padding: 8px 8px; font-size: 16px; min-width: 0; }

/* Lectura automática del PDF: datos completados para revisar */
.lector-pdf { border: 1px dashed var(--oro); }
.lector-pdf .btn { cursor: pointer; }
.campo.leido input, .campo.leido select, .campo.leido textarea { background: #FFF7E3; border-color: var(--oro); }
.campo.leido > span::after { content: ' · leído del PDF'; color: var(--oro-osc); font-weight: 500; font-size: 12px; }
.leido-seccion { box-shadow: inset 3px 0 0 var(--oro); }
.lista-avisos { margin: 6px 0 0; padding-left: 18px; }
.lista-avisos li { margin: 2px 0; }
.lista-avisos a { color: inherit; font-weight: 600; }
.btn.leyendo { opacity: .6; pointer-events: none; }
