/* SG Créditos — hoja de estilos
   Identidad tomada del logo: marino profundo para la estructura, celeste eléctrico como acento,
   azul para las acciones. Superficies blancas y mucho aire. El rojo se reserva para la mora.
   Una sola familia tipográfica, dos pesos (400 y 600), escala corta. */
:root {
  --marino: #04162e;        /* menú lateral, títulos */
  --marino-2: #0d2c52;      /* hover en el menú */
  --marino-3: #16406f;
  --azul: #1468d6;          /* botones principales, enlaces */
  --azul-hover: #0f56b3;
  --azul-suave: #e8f1fd;
  --celeste: #22bff2;       /* acento: elemento activo, foco */
  --fondo: #f4f7fb;
  --blanco: #ffffff;
  --tinta: #0e1b2c;
  --tinta-2: #5b6b80;
  --tinta-3: #8a98ab;
  --linea: #e2e8f0;
  --linea-2: #eef2f7;
  --mora: #c62828;
  --mora-suave: #fdecec;
  --aviso: #a35c00;
  --aviso-suave: #fff4e2;
  --ok: #1d7f55;
  --ok-suave: #e6f5ee;
  --r: 8px;
  --r-chico: 6px;
  --sombra: 0 1px 2px rgba(4, 22, 46, .05);
  --fuente: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  /* escala: 13 · 15 · 18 · 24 */
  --t-chico: .8667rem;
  --t-base: 1rem;
  --t-medio: 1.2rem;
  --t-grande: 1.6rem;
}
* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--fuente); font-size: var(--t-base); font-weight: 400; color: var(--tinta);
  background: var(--fondo); line-height: 1.5; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--celeste); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-weight: 600; color: var(--marino); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: var(--t-grande); margin: 0 0 .2rem; }
h2 { font-size: var(--t-medio); margin: 2rem 0 .75rem; }
h3 { font-size: var(--t-base); margin: 1.25rem 0 .5rem; }
p { margin: .4rem 0 .8rem; max-width: 75ch; }
b, strong { font-weight: 600; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--tinta-2); }
.small { font-size: var(--t-chico); }
.nowrap { white-space: nowrap; }

/* íconos */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- estructura */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.lateral { background: var(--marino); color: #c9d6e6; padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column; }
.marca { display: flex; align-items: center; gap: .75rem; color: #fff; padding: .1rem .3rem 1.25rem; text-decoration: none; }
.marca:hover { text-decoration: none; }
.marca img { flex: none; border-radius: 50%; }
.marca b { display: block; font-size: var(--t-medio); font-weight: 600; letter-spacing: .01em; }
.marca small { display: block; color: var(--celeste); font-size: var(--t-chico); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .7rem; color: #c9d6e6; padding: .55rem .65rem; border-radius: var(--r-chico);
  position: relative; text-decoration: none; }
.nav a .ico { color: #7f97b5; }
.nav a:hover { background: var(--marino-2); color: #fff; }
.nav a:hover .ico { color: #fff; }
.nav a.activo { background: var(--marino-2); color: #fff; font-weight: 600; }
.nav a.activo::before { content: ""; position: absolute; left: -.8rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--celeste); }
.nav a.activo .ico { color: var(--celeste); }
.nav .grupo { margin-top: 1.1rem; padding: 0 .65rem .3rem; font-size: var(--t-chico); color: #6f87a6; }
.nav .cant { margin-left: auto; background: var(--mora); color: #fff; border-radius: 10px; font-size: .75rem; padding: 0 .45rem;
  font-weight: 600; line-height: 1.5; }
.usuario { margin-top: auto; padding: 1rem .45rem 0; border-top: 1px solid var(--marino-2); font-size: var(--t-chico); }
.usuario .quien { display: flex; gap: .6rem; align-items: center; color: #fff; }
.usuario .quien small { display: block; color: #8aa1bf; }
.usuario-acciones { display: flex; gap: 1rem; margin-top: .6rem; }
.usuario-acciones a, .usuario-acciones button { display: inline-flex; gap: .35rem; align-items: center; color: #c9d6e6; background: none;
  border: 0; padding: 0; font: inherit; cursor: pointer; }
.usuario-acciones a:hover, .usuario-acciones button:hover { color: #fff; text-decoration: none; }
.usuario-acciones form { display: inline; }
.principal { min-width: 0; }
.barra { display: none; }
.contenido { padding: 1.75rem 2.25rem 4rem; max-width: 1280px; }
.encabezado { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; justify-content: space-between; margin-bottom: 1.25rem; }
.encabezado .sub, .sub { color: var(--tinta-2); margin: .1rem 0 0; }
.acciones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--linea);
  background: var(--blanco); color: var(--tinta); padding: .5rem .95rem; border-radius: var(--r-chico); font: inherit;
  font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; box-shadow: var(--sombra); }
.btn:hover { border-color: #c5d0de; background: #fafcfe; text-decoration: none; }
.btn .ico { color: var(--tinta-2); }
.btn.primario { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.primario .ico { color: #fff; }
.btn.primario:hover { background: var(--azul-hover); border-color: var(--azul-hover); }
.btn.peligro { color: var(--mora); border-color: #f1c4c4; }
.btn.peligro .ico { color: var(--mora); }
.btn.peligro:hover { background: var(--mora-suave); }
.btn.chico { padding: .25rem .65rem; min-height: 32px; font-size: var(--t-chico); }
.btn.chico .ico { width: 16px; height: 16px; }
.btn.ancho { width: 100%; }
.btn[disabled], .btn.cargando { opacity: .6; pointer-events: none; }
form.inline { display: inline; }
label { display: block; font-size: var(--t-chico); font-weight: 600; color: var(--tinta); margin-bottom: .3rem; }
.campo { margin-bottom: .95rem; }
.campo .ayuda { font-size: var(--t-chico); color: var(--tinta-2); margin-top: .25rem; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=email], input[type=password],
input[type=month], input[type=tel], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--tinta); background: var(--blanco); border: 1px solid #ccd6e2;
  border-radius: var(--r-chico); padding: .5rem .65rem; min-height: 42px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--azul); outline: 3px solid rgba(34, 191, 242, .25); outline-offset: 0; }
.check { display: flex; gap: .55rem; align-items: center; font-weight: 400; font-size: var(--t-base); }
.check input { width: 18px; height: 18px; accent-color: var(--azul); }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1rem; }
.rejilla .ancho { grid-column: 1 / -1; }
fieldset { min-width: 0; border: 1px solid var(--linea); border-radius: var(--r); padding: .9rem 1.1rem .3rem; margin: 0 0 1rem;
  background: var(--blanco); box-shadow: var(--sombra); }
legend { font-weight: 600; color: var(--marino); padding: 0 .35rem; }
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1.1rem; }
.filtros .campo { margin: 0; min-width: 150px; }
.filtros .crece { flex: 1 1 240px; }
details summary { cursor: pointer; color: var(--tinta-2); font-weight: 600; }

/* ---------- mensajes */
.flash { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--r); margin-bottom: 1rem;
  border: 1px solid; background: var(--blanco); }
.flash .ico { margin-top: 1px; }
.flash.ok { border-color: #bfe3d1; background: var(--ok-suave); color: #0f5136; }
.flash.error { border-color: #f1c4c4; background: var(--mora-suave); color: #8e1c1c; }
.flash.aviso { border-color: #f3d9a8; background: var(--aviso-suave); color: #6e3e00; }
.nota { border-left: 3px solid var(--celeste); background: var(--azul-suave); padding: .65rem .95rem; border-radius: 0 var(--r-chico) var(--r-chico) 0;
  margin: .75rem 0; max-width: 80ch; color: var(--marino); }
.nota.legal { border-color: var(--aviso); background: var(--aviso-suave); color: #5c3600; }

/* ---------- tablas */
.tabla-wrap { overflow-x: auto; background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; border-bottom: 1px solid var(--linea-2); text-align: left; vertical-align: top; }
th { font-size: var(--t-chico); font-weight: 600; color: var(--tinta-2); background: #f8fafc; white-space: nowrap; }
th a { color: inherit; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbff; }
tr.anulado td { color: var(--tinta-3); text-decoration: line-through; }
tfoot td { font-weight: 600; background: #f8fafc; border-top: 1px solid var(--linea); border-bottom: 0; }
.vacio { padding: 2.25rem 1rem; text-align: center; color: var(--tinta-2); }
.paginas { display: flex; gap: .5rem; align-items: center; margin: .85rem 0; flex-wrap: wrap; }

/* ---------- estados */
.est { display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .55rem; border-radius: 999px; font-size: var(--t-chico);
  font-weight: 600; background: #eef2f7; color: var(--tinta-2); white-space: nowrap; }
.est.ok, .est.pagada, .est.cancelado, .est.vigente, .est.activo-cli { background: var(--ok-suave); color: var(--ok); }
.est.mora, .est.vencida, .est.anulado, .est.anulada, .est.incobrable, .est.restringido, .est.mora_grave { background: var(--mora-suave); color: var(--mora); }
.est.parcial, .est.judicial, .est.aviso, .est.mora_leve, .est.refinanciado, .est.refinanciada { background: var(--aviso-suave); color: var(--aviso); }
.est.activo, .est.pendiente { background: var(--azul-suave); color: var(--azul); }
.dias { font-variant-numeric: tabular-nums; font-weight: 600; }
.dias.d1 { color: var(--aviso); } .dias.d2 { color: #b8430f; } .dias.d3 { color: var(--mora); }

/* ---------- inicio */
.hoja-dia { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.5rem; }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.cifra { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r); padding: .9rem 1rem; box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.cifra .etq { font-size: var(--t-chico); color: var(--tinta-2); display: flex; align-items: center; gap: .45rem; }
.cifra .etq .ico { color: var(--azul); width: 17px; height: 17px; }
.cifra .valor { font-size: var(--t-grande); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--marino); }
.cifra .det { font-size: var(--t-chico); color: var(--tinta-2); }
.cifra.alerta { border-color: #f4cfcf; }
.cifra.alerta .valor, .cifra.alerta .etq .ico { color: var(--mora); }
.cifra a { color: inherit; display: contents; }
.cifra:has(a):hover { border-color: #c5d0de; }
.hoy-titulo { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.hoy-titulo .fecha-grande { font-size: 2rem; font-weight: 600; letter-spacing: -.02em; color: var(--marino); }
.lista-dia { list-style: none; margin: 0; padding: 0; background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r); box-shadow: var(--sombra); }
.lista-dia li { display: flex; gap: .75rem; align-items: center; padding: .7rem .9rem; border-bottom: 1px solid var(--linea-2); }
.lista-dia li:last-child { border-bottom: 0; }
.lista-dia .quien { flex: 1; min-width: 0; }
.lista-dia .quien a { font-weight: 600; color: var(--tinta); }
.lista-dia .quien small { display: block; color: var(--tinta-2); font-size: var(--t-chico); }
.grafico { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r); padding: .9rem; box-shadow: var(--sombra); }
.grafico svg { width: 100%; height: auto; display: block; }
.grafico .ley { display: flex; gap: 1rem; font-size: var(--t-chico); color: var(--tinta-2); margin-top: .4rem; flex-wrap: wrap; }
.ley i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.tramos { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; }
.tramos a { padding: .75rem .9rem; color: var(--tinta); background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r);
  display: block; box-shadow: var(--sombra); }
.tramos a:hover { border-color: #c5d0de; text-decoration: none; }
.tramos a.activo { border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul) inset; }
.tramos b { display: block; font-variant-numeric: tabular-nums; font-size: var(--t-medio); color: var(--marino); }
.tramos span { font-size: var(--t-chico); color: var(--tinta-2); }

/* ---------- ficha */
.ficha-cab { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .65rem 1.5rem; margin: 1rem 0; }
.datos div { min-width: 0; }
.datos dt { font-size: var(--t-chico); color: var(--tinta-2); }
.datos dd { margin: 0; overflow-wrap: anywhere; }
.pestanas { display: flex; gap: .25rem; border-bottom: 1px solid var(--linea); margin: 1.5rem 0 1rem; overflow-x: auto; }
.pestanas a { padding: .6rem .95rem; color: var(--tinta-2); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.pestanas a:hover { color: var(--marino); text-decoration: none; }
.pestanas a.activo { color: var(--marino); border-color: var(--celeste); font-weight: 600; }

/* simulación */
.simulacion { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--r); padding: 1.1rem; position: sticky; top: 1rem;
  box-shadow: var(--sombra); }
.simulacion .total { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--linea); }
.simulacion .total b { font-variant-numeric: tabular-nums; }
.simulacion .total.fuerte { font-size: var(--t-medio); border-bottom: 2px solid var(--celeste); color: var(--marino); }
.dos-col > * { min-width: 0; }
.dos-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 1.5rem; align-items: start; }

/* comprobante */
.comprobante { background: var(--blanco); border: 1px solid var(--linea); max-width: 660px; padding: 1.5rem; border-radius: var(--r); box-shadow: var(--sombra); }
.comprobante h1 { font-size: var(--t-medio); }
.importe-grande { font-size: 2.1rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--marino); letter-spacing: -.02em; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem;
  background: radial-gradient(120% 90% at 50% 0%, #0d2c52 0%, var(--marino) 60%); }
.login-caja { background: var(--blanco); padding: 2rem 1.75rem 1.75rem; border-radius: 14px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.login-caja .campo, .login-caja .flash { text-align: left; }
.login-logo { display: block; margin: -4.5rem auto .75rem; border-radius: 50%; box-shadow: 0 0 0 6px var(--blanco), 0 0 0 7px rgba(34, 191, 242, .5); background: var(--marino); }
.login h1 { margin-top: .25rem; }

/* ---------- celular */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  body.menu-abierto .lateral { transform: none; box-shadow: 0 0 0 100vmax rgba(4, 22, 46, .45); }
  .barra { display: flex; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 20; background: var(--marino); color: #fff; padding: .5rem .8rem; }
  .barra img { border-radius: 50%; }
  .barra button { background: none; border: 0; color: #fff; min-height: 40px; min-width: 40px; display: grid; place-items: center; }
  .barra button .ico { width: 22px; height: 22px; }
  .barra b { font-size: var(--t-base); font-weight: 600; }
  .barra .barra-cobrar { margin-left: auto; display: inline-flex; gap: .4rem; align-items: center; color: #fff; background: var(--azul);
    padding: .45rem .8rem; border-radius: var(--r-chico); font-weight: 600; }
  .barra .barra-cobrar:hover { text-decoration: none; }
  .contenido { padding: 1.1rem .9rem 5rem; }
  .hoja-dia, .dos-col { grid-template-columns: 1fr; }
  .cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .cifra { padding: .75rem .8rem; }
  .cifra .valor { font-size: var(--t-medio); }
  .simulacion { position: static; }
  table.apilable thead { display: none; }
  table.apilable, table.apilable tbody, table.apilable tr, table.apilable td { display: block; width: 100%; }
  table.apilable tr { border-bottom: 1px solid var(--linea); padding: .5rem .2rem; }
  table.apilable td { border: 0; padding: .15rem .7rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.apilable td::before { content: attr(data-l); color: var(--tinta-2); font-size: var(--t-chico); text-align: left; }
  table.apilable td.principal-celda { font-weight: 600; text-align: left; justify-content: flex-start; }
  table.apilable td.principal-celda::before { display: none; }
  table.apilable tfoot { display: block; }
  table.apilable tfoot tr { display: flex; justify-content: space-between; }
  h1 { font-size: 1.35rem; }
  .hoy-titulo .fecha-grande { font-size: 1.6rem; }
}
@media (max-width: 380px) { .cifras { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .lateral, .barra, .acciones, .no-imprimir, .flash { display: none !important; }
  .app { display: block; } .contenido { padding: 0; }
  body { background: #fff; }
  .tabla-wrap, .cifra, .comprobante { box-shadow: none; }
}

h2 .ico { color: var(--celeste); width: 20px; height: 20px; margin-right: .2rem; vertical-align: -3px; }
.tabla-wrap td a .ico { width: 15px; height: 15px; }
