:root {
  --fondo: #f4f6fa; --papel: #ffffff; --tinta: #1a1c3a; --suave: #5a607c; --linea: #dde1ec; --linea2: #edf0f6;
  /* Marca Cooperaser: azul oscuro del logo, aguamarina claro para fondos suaves y turquesa solo como adorno */
  --marca: #2e3092; --marca-osc: #232573; --marca-claro: #e2f3f5; --acento: #55c5d0;
  --bien: #0d6b52; --bien-claro: #e3f1ec;
  --ambar: #9a6200; --ambar-claro: #fbf0d8; --rojo: #b3261e; --rojo-claro: #fbe6e4; --naranja: #b0480f; --naranja-claro: #fbe9dc;
  --gris-claro: #eceef3; --radio: 10px;
  --letra: "Geist", "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--letra); font-size: 15px; line-height: 1.45; color: var(--tinta); background: var(--fondo); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
a { color: var(--marca); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.suave { color: var(--suave); }
.chico { font-size: 13px; }
.cargando { padding: 40px; color: var(--suave); }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Botones y campos */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--linea);
  border-radius: 8px; background: var(--papel); cursor: pointer; font-weight: 550; white-space: nowrap; text-decoration: none; color: var(--tinta); }
.btn:hover { border-color: #b4bacb; background: #f8f9fc; }
.btn.principal { background: var(--marca); border-color: var(--marca); color: #fff; }
.btn.principal:hover { background: var(--marca-osc); }
.btn.peligro { color: var(--rojo); }
.btn.mini { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.liso { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }
label.campo { display: block; }
label.campo > span { display: block; font-size: 13px; font-weight: 550; margin-bottom: 4px; }
label.campo > small { display: block; color: var(--suave); font-size: 12px; margin-top: 3px; }
input[type=text], input[type=password], input[type=date], input[type=month], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #c5cada; border-radius: 8px; background: #fff; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marca); outline-offset: 0; border-color: var(--marca); }
.rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.rejilla .todo { grid-column: 1 / -1; }
.opciones { display: grid; gap: 8px; }
.opciones label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--linea); border-radius: 8px; cursor: pointer; background: #fff; }
.opciones label:has(input:checked) { border-color: var(--marca); background: var(--marca-claro); }
.opciones input { margin-top: 3px; accent-color: var(--marca); }
.error { background: var(--rojo-claro); color: #7d1a14; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.error:empty { display: none; }
.error a { color: inherit; font-weight: 600; }
details.avanzado { border-top: 1px solid var(--linea2); padding-top: 10px; }
details.avanzado summary { cursor: pointer; color: var(--suave); font-size: 13px; font-weight: 550; }
details.avanzado[open] summary { margin-bottom: 10px; }

/* Entrada */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.entrada .caja { width: 100%; max-width: 380px; background: var(--papel); border: 1px solid var(--linea); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.marca img { width: 34px; height: 34px; display: block; flex: none; }
input.codigo { font-size: 26px !important; letter-spacing: .32em; text-align: center; font-variant-numeric: tabular-nums; }
.portada { display: grid; justify-items: center; gap: 4px; text-align: center; }
.portada img { width: 104px; height: 104px; }
.portada b { font-size: 19px; color: var(--marca); letter-spacing: -0.01em; }
.portada span { font-size: 11.5px; letter-spacing: .08em; color: var(--suave); text-transform: uppercase; }

/* Marco */
.marco { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.lado { background: var(--papel); border-right: 1px solid var(--linea); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.lado .marca { padding: 4px 8px 16px; }
.lado a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--tinta); text-decoration: none; font-weight: 550; }
.lado a.nav:hover { background: var(--linea2); }
.lado a.nav.aqui { background: var(--marca-claro); color: var(--marca-osc); box-shadow: inset 3px 0 0 var(--acento); }
.lado .pie { margin-top: auto; padding: 10px; border-top: 1px solid var(--linea2); font-size: 13px; display: grid; gap: 6px; }
main { padding: 26px 30px 60px; max-width: 1180px; width: 100%; }
.cabeza { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.cabeza .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.volver { display: inline-flex; align-items: center; gap: 6px; color: var(--suave); text-decoration: none; font-size: 14px; margin-bottom: 8px; }

/* Tarjetas y tablas */
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px; }
.tarjeta + .tarjeta, .bloque + .bloque { margin-top: 14px; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 860px) { .cifras { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.cifra { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 14px 16px; }
.cifra .t { font-size: 13px; color: var(--suave); }
.cifra .v { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin-top: 2px; }
.cifra .d { font-size: 12.5px; color: var(--suave); margin-top: 2px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.dos > .tarjeta { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--suave); padding: 8px 10px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--linea2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th.der, td.der { text-align: right; }
tr.fila { cursor: pointer; }
tr.fila:hover td { background: #f6f8fc; }
tr.anulado td { color: #9aa0b5; text-decoration: line-through; }
tr.anulado td.sin { text-decoration: none; }
tfoot td { font-weight: 650; border-top: 1px solid var(--linea); border-bottom: 0; }
.tabla-caja { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); overflow-x: auto; }
.vacio { padding: 34px 18px; text-align: center; color: var(--suave); }
.vacio .btn { margin-top: 12px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--gris-claro); color: #4a5068; }
.chip.al_dia { background: var(--bien-claro); color: var(--bien); }
.chip.debe { background: var(--ambar-claro); color: var(--ambar); }
.chip.abogado { background: var(--naranja-claro); color: var(--naranja); }
.chip.embargo { background: var(--rojo-claro); color: var(--rojo); }
.chip.ok { background: var(--bien-claro); color: var(--bien); }
.chip.aviso { background: var(--ambar-claro); color: var(--ambar); }
.chip.mal { background: var(--rojo-claro); color: var(--rojo); }
a.tarjeta.enlace { display: block; text-decoration: none; color: var(--tinta); margin-top: 0; }
a.tarjeta.enlace:hover { border-color: #b4bacb; }
.acciones.mes { align-items: center; }
.mes-nombre { min-width: 150px; text-align: center; font-size: 16px; text-transform: capitalize; }
.nota-suave { background: var(--ambar-claro); color: #6d4700; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }
.recibo { display: inline-grid; place-items: center; width: 54px; height: 54px; border: 1px solid var(--linea); border-radius: 6px; overflow: hidden; vertical-align: middle; margin-right: 6px;
  font-size: 12px; font-weight: 650; color: var(--suave); text-decoration: none; background: var(--gris-claro); }
.recibo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Gráficas */
.viz-seccion { margin: 26px 0 10px; }
.viz-seccion:first-of-type { margin-top: 4px; }
.tarjeta.viz h2 + p { margin-top: 2px; }
.viz-caja { margin-top: 14px; min-width: 0; }
.viz-svg { display: block; max-width: 100%; }
.viz-eje { font-size: 11.5px; fill: var(--suave); font-variant-numeric: tabular-nums; }
.viz-rotulo { font-size: 12.5px; font-weight: 650; fill: var(--tinta); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.viz-zona { cursor: default; outline: none; }
.viz-zona:focus-visible { outline: 2px solid var(--marca); outline-offset: -2px; }
.viz-vacio { color: var(--suave); padding: 8px 0; }
.viz-leyenda { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; }
.viz-leyenda li { display: flex; align-items: center; gap: 7px; }
.viz-leyenda b { font-weight: 600; }
.viz-k { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.viz-partida { display: flex; gap: 2px; height: 28px; }
.viz-bloque { min-width: 3px; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 12.5px; font-weight: 650; overflow: visible; white-space: nowrap; }
.viz-bloque:hover, .viz-bloque:focus-visible { filter: brightness(1.08); outline: 2px solid var(--tinta); outline-offset: 1px; }
.viz-barras { display: grid; gap: 9px; }
.viz-fila { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; gap: 10px; align-items: center; font-size: 13.5px; border-radius: 4px; }
.viz-fila:hover, .viz-fila:focus-visible { background: #f1f4f9; outline: none; }
.viz-nombre { overflow-wrap: anywhere; }
.viz-pista { display: flex; align-items: center; gap: 8px; min-width: 0; }
.viz-pista i { display: block; height: 14px; border-radius: 0 4px 4px 0; flex: none; min-width: 2px; }
.viz-valor { font-weight: 600; white-space: nowrap; }
.viz-tabla { margin-top: 12px; border-top: 1px solid var(--linea2); padding-top: 8px; }
.viz-tabla summary { cursor: pointer; font-size: 13px; color: var(--suave); font-weight: 550; }
.viz-tabla table { margin-top: 6px; font-size: 13.5px; }
.viz-tabla td, .viz-tabla th { padding: 6px 8px; }
.viz-tip { position: fixed; z-index: 60; display: none; pointer-events: none; background: #1a1c3a; color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 13px; max-width: 260px;
  box-shadow: 0 6px 20px rgba(20, 22, 60, .25); }
.viz-tip-t { font-size: 12px; color: #c9cee0; margin-bottom: 3px; }
.viz-tip-t::first-letter { text-transform: uppercase; }
.viz-tip-f { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.viz-tip-f b { font-weight: 650; font-variant-numeric: tabular-nums; }
.viz-tip-f span { color: #c9cee0; }
.viz-tip-k { width: 12px; height: 3px; border-radius: 2px; flex: none; }
@media print {
  .lado, .no-imprimir, #aviso { display: none !important; }
  .marco { display: block; } main { padding: 0; max-width: none; } body { background: #fff; font-size: 12px; }
  .tabla-caja, .tarjeta, .cifra { break-inside: avoid; }
  .tabla-caja { overflow: visible; }
}
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filtros input[type=search] { max-width: 320px; }
.pastilla { border: 1px solid var(--linea); background: var(--papel); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 550; cursor: pointer; }
.pastilla.aqui { background: var(--tinta); border-color: var(--tinta); color: #fff; }

/* Ficha */
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; }
.datos div span { display: block; font-size: 12.5px; color: var(--suave); }
.datos div b { font-weight: 550; overflow-wrap: anywhere; }
.credito { border: 1px solid var(--linea); border-radius: var(--radio); background: var(--papel); overflow: hidden; }
.credito + .credito { margin-top: 14px; }
.credito > header { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--linea2); flex-wrap: wrap; }
.credito .cuerpo { padding: 16px 18px; display: grid; gap: 16px; }
.credito .saldo { font-size: 28px; font-weight: 680; letter-spacing: -0.02em; }
.reparto { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; }
.reparto div { padding: 10px 12px; border-right: 1px solid var(--linea2); background: #f9fafd; }
.reparto div:last-child { border-right: 0; }
.reparto span { display: block; font-size: 12.5px; color: var(--suave); }
.reparto b { font-size: 16px; font-weight: 650; }
.reparto small { display: block; font-size: 12px; color: var(--suave); }
.fila-botones { display: flex; gap: 8px; flex-wrap: wrap; }
.vista-previa { background: var(--marca-claro); border-radius: 8px; padding: 12px; font-size: 14px; }
.vista-previa b { font-weight: 650; }
.notas { display: grid; gap: 10px; }
.nota { border-left: 3px solid var(--linea); padding: 2px 0 2px 12px; }
.nota.actuacion { border-color: var(--naranja); }
.nota.sistema { border-color: #c3c8d8; color: var(--suave); }
.nota p { white-space: pre-wrap; overflow-wrap: anywhere; }
.nota small { color: var(--suave); font-size: 12.5px; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.doc { border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; background: #fff; text-decoration: none; color: var(--tinta); display: block; position: relative; }
.doc .mini-foto { height: 96px; background: var(--gris-claro) center / cover no-repeat; display: grid; place-items: center; color: var(--suave); font-weight: 650; }
.doc .mini-foto img { width: 100%; height: 96px; object-fit: cover; display: block; }
.doc .pie-doc { padding: 6px 8px; font-size: 12.5px; }
.doc .pie-doc b { display: block; font-weight: 600; }
.doc button { position: absolute; top: 4px; right: 4px; }

/* Ventana */
dialog#modal { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 24px 70px rgba(20, 22, 60, .28); color: var(--tinta); }
dialog#modal::backdrop { background: rgba(20, 22, 60, .45); }
dialog#modal form { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
dialog#modal header { padding: 18px 22px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
dialog#modal .contenido { padding: 4px 22px 16px; overflow-y: auto; display: grid; gap: 14px; }
dialog#modal footer { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--linea2); flex-wrap: wrap; }
#aviso { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100vw - 30px); }
#aviso.ver { opacity: 1; }

/* Inversores de un crédito: nombre y su porcentaje */
.lista-inversores { display: grid; gap: 8px; }
.lista-inversores .inv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--linea); border-radius: 8px; background: #fff; }
.lista-inversores .inv small { color: var(--suave); font-size: 12.5px; font-weight: 400; }
.con-pct { display: flex; align-items: center; gap: 6px; flex: none; }
.con-pct input { width: 92px; text-align: right; }
.con-pct i { font-style: normal; color: var(--suave); }
.atajos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
label.campo > span, div.campo > span { display: block; font-size: 13px; font-weight: 550; margin-bottom: 4px; }
div.campo > small { display: block; color: var(--suave); font-size: 12px; }

/* Piezas que solo existen en celular (en computador el menú va al lado) */
.barra, .tabs { display: none; }
.menu-lista { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
.menu-lista a { display: flex; align-items: center; gap: 14px; padding: 16px; min-height: 64px; text-decoration: none; color: var(--tinta); border-bottom: 1px solid var(--linea2); }
.menu-lista a:last-child { border-bottom: 0; }
.menu-lista a:active { background: var(--marca-claro); }
.menu-lista a > span { flex: 1; min-width: 0; display: grid; }
.menu-lista small { color: var(--suave); font-size: 13.5px; }
.menu-lista svg.ic:first-child { width: 24px; height: 24px; color: var(--marca); }
.menu-lista svg.ic:last-child { color: var(--suave); }
.btn.redondo { width: 44px; min-height: 44px; padding: 0; border-radius: 999px; }
/* El toque responde de una y sin el destello gris del iPhone */
a, button, .pastilla, tr.fila, .viz-bloque, .viz-fila, summary, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.98); }
tr.fila:active td { background: var(--marca-claro); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.con-ventana, html.con-ventana body { overflow: hidden; }
/* Ventana en celulares viejos que no traen <dialog> */
dialog#modal.sin-dialogo { display: none; position: fixed; inset: 0; z-index: 100; margin: auto; }
dialog#modal.sin-dialogo[open] { display: block; }

/* ───────────── Celular (pensado para iPhone) ───────────── */
@media (max-width: 860px) {
  body { font-size: 16px; }
  h1 { font-size: 23px; line-height: 1.2; }
  h2 { font-size: 18px; }
  .chico { font-size: 13.5px; }
  .ocultar-movil { display: none !important; }

  /* Marco: barra arriba con el logo, contenido, y cinco pestañas abajo */
  .marco { display: block; min-height: 100vh; min-height: 100dvh; }
  .lado { display: none; }
  .barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--linea);
    padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
  .barra .marca { text-decoration: none; color: var(--marca); font-size: 17px; }
  main { padding: 18px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); max-width: none; }
  .tabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); border-top: 1px solid var(--linea);
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); }
  .tabs a { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 54px; border-radius: 12px; text-decoration: none; color: var(--suave); font-size: 11.5px; font-weight: 600; }
  .tabs a svg.ic { width: 24px; height: 24px; }
  .tabs a.aqui { color: var(--marca); }
  .tabs a.aqui svg.ic { stroke-width: 2.2; }
  .tabs a:active { background: var(--marca-claro); }
  #aviso { bottom: calc(78px + env(safe-area-inset-bottom)); font-size: 15px; }

  /* Tamaños para el dedo: nada por debajo de 44 puntos; los campos en 16 para que el iPhone no haga zoom */
  .btn { min-height: 48px; padding: 10px 16px; font-size: 16px; border-radius: 10px; }
  .btn.mini { min-height: 44px; padding: 8px 14px; font-size: 15px; }
  .btn.redondo { width: 44px; padding: 0; }
  .pastilla { min-height: 44px; padding: 8px 16px; font-size: 15px; }
  input[type=text], input[type=password], input[type=date], input[type=month], input[type=number], input[type=search], select, textarea {
    font-size: 16px; min-height: 50px; padding: 11px 13px; border-radius: 10px; -webkit-appearance: none; appearance: none; }
  input[type=date], input[type=month] { display: block; text-align: left; line-height: 26px; }
  input::-webkit-date-and-time-value { text-align: left; }
  select { padding-right: 38px; background-repeat: no-repeat; background-position: right 13px center; background-size: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a607c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
  input[type=file] { font-size: 15px; width: 100%; min-height: 48px; }
  label.campo > span { font-size: 14.5px; margin-bottom: 6px; }
  label.campo > small { font-size: 13px; }
  .opciones label { padding: 14px; min-height: 56px; }
  .opciones input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
  details.avanzado summary, .viz-tabla summary { min-height: 44px; display: flex; align-items: center; font-size: 14.5px; }
  .dos, .rejilla { grid-template-columns: 1fr; }
  .rejilla { gap: 16px; }

  /* Encabezado de cada pantalla: los botones ocupan el ancho */
  .cabeza { margin-bottom: 16px; }
  .cabeza .acciones { width: 100%; }
  .cabeza .acciones .btn { flex: 1 1 0; }
  .cabeza .acciones.mes .btn { flex: 0 0 48px; padding: 0; }
  .cabeza .acciones.mes .mes-nombre { flex: 1; min-width: 0; font-size: 17px; }
  .barra + main .cabeza [data-accion=nuevoCliente] { display: none; }   /* ya está el botón + de la barra de arriba */
  .volver { min-height: 44px; margin-bottom: 0; font-size: 16px; }
  .filtros { gap: 8px; }
  .filtros input[type=search] { max-width: none; }

  /* Cifras del resumen: una lista limpia en vez de cajitas apretadas */
  .cifras { grid-template-columns: 1fr; gap: 0; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
  .cifra { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; border: 0; border-radius: 0; border-bottom: 1px solid var(--linea2); padding: 14px 16px; }
  .cifra:last-child { border-bottom: 0; }
  .cifra .t { font-size: 15px; color: var(--tinta); }
  .cifra .v { font-size: 18px; margin: 0; }
  .cifra .d { grid-column: 1 / -1; font-size: 13px; }
  .tarjeta { padding: 16px; }

  /* Tablas → tarjetas: cada renglón es un bloque de dos columnas, sin moverse de lado */
  .tabla-caja { overflow: visible; }
  table.tarj, table.tarj tbody, table.tarj tfoot { display: block; }
  table.tarj thead { display: none; }
  table.tarj tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 6px; align-items: start; align-content: center; padding: 14px 16px; border-bottom: 1px solid var(--linea2); min-height: 60px; }
  table.tarj tbody tr:last-child, table.tarj tfoot tr { border-bottom: 0; }
  table.tarj tfoot tr { border-top: 1px solid var(--linea); background: #f9fafd; min-height: 0; }
  table.tarj td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  table.tarj td:empty { display: none; }
  table.tarj td.der { text-align: right; }
  /* a = arriba izquierda · b = arriba derecha · c = abajo izquierda · d = abajo derecha */
  .t-proximos td:nth-child(2), .t-clientes td:nth-child(1), .t-creditos td:nth-child(1), .t-cobro td:nth-child(2), .t-pendientes td:nth-child(2),
  .t-grupo td:nth-child(2), .t-envios td:nth-child(2), .t-movs td:nth-child(2), .t-usuarios td:nth-child(1) { grid-area: 1 / 1; }
  .t-proximos td:nth-child(3), .t-clientes td:nth-child(5), .t-creditos td:nth-child(5), .t-cobro td:nth-child(3), .t-pendientes td:nth-child(5),
  .t-grupo td:nth-child(4), .t-envios td:nth-child(3), .t-movs td:nth-child(3), .t-usuarios td:nth-child(4) { grid-area: 1 / 2; text-align: right; font-weight: 650; }
  .t-proximos td:nth-child(1), .t-clientes td:nth-child(6), .t-creditos td:nth-child(9), .t-cobro td:nth-child(5), .t-pendientes td:nth-child(3),
  .t-cuadres td:nth-child(2), .t-grupo td:nth-child(1), .t-envios td:nth-child(1), .t-movs td:nth-child(1), .t-usuarios td:nth-child(2) { grid-area: 2 / 1; }
  .t-creditos td:nth-child(7), .t-cobro td:nth-child(6), .t-pendientes td:nth-child(1), .t-cuadres td:nth-child(5), .t-grupo td:nth-child(3),
  .t-envios td:nth-child(5), .t-movs td:nth-child(5), .t-usuarios td:nth-child(3) { grid-area: 2 / 2; text-align: right; justify-self: end; }
  .t-cuadres td:nth-child(3) { grid-area: 1 / 1 / 2 / 3; }
  .t-inversores td:nth-child(1) { grid-area: 1 / 1; }
  .t-inversores td:nth-child(3) { grid-area: 1 / 2; text-align: right; font-weight: 650; }
  .t-inversores td:nth-child(2) { grid-area: 2 / 1; color: var(--suave); font-size: 14px; text-align: left; }
  .t-inversores td:nth-child(2)::before { content: "Puso "; }
  .con-pct input { width: 96px; }
  .atajos .btn { flex: 1 1 auto; }
  .t-envios td:nth-child(4) { grid-area: 3 / 1 / 4 / 3; }
  .t-cobro td:nth-child(1), .t-cuadres td:nth-child(1) { display: none; }
  /* renglón de abajo en tono suave */
  .t-proximos td:nth-child(1), .t-pendientes td:nth-child(3), .t-pendientes td:nth-child(1), .t-cuadres td:nth-child(2), .t-grupo td:nth-child(1), .t-grupo td:nth-child(3),
  .t-envios td:nth-child(1), .t-movs td:nth-child(1), .t-usuarios td:nth-child(2), .t-creditos td:nth-child(7) { color: var(--suave); font-size: 14px; font-weight: 400; }
  .t-creditos tbody td:nth-child(7)::before { content: "al mes "; }
  .t-grupo tbody td:nth-child(3)::before { content: "de "; }
  .t-creditos tfoot td:nth-child(7) { color: var(--tinta); font-weight: 650; }
  .t-creditos tfoot td:nth-child(7)::before { content: "al mes "; font-weight: 400; color: var(--suave); }
  .t-grupo tfoot td:nth-child(1), .t-creditos tfoot td:nth-child(1) { grid-area: 1 / 1; color: var(--tinta); font-size: 15px; font-weight: 650; }
  .t-movs td.sin .btn, .t-envios td .btn { min-height: 40px; }

  /* Ficha del cliente y tarjeta del crédito */
  .datos { grid-template-columns: 1fr 1fr; gap: 14px 16px; }
  .datos div span { font-size: 13px; }
  .credito > header { padding: 14px 16px; }
  .credito .cuerpo { padding: 16px; gap: 18px; }
  .credito .saldo { font-size: 30px; }
  .reparto { grid-template-columns: 1fr; }
  .reparto div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 10px; border-right: 0; border-bottom: 1px solid var(--linea2); padding: 12px 14px; }
  .reparto div:last-child { border-bottom: 0; }
  .reparto span { font-size: 15px; color: var(--tinta); }
  .reparto b { font-size: 17px; }
  .reparto small { grid-column: 1 / -1; font-size: 13px; }
  .fila-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .fila-botones .btn { white-space: normal; text-align: center; line-height: 1.2; }
  .fila-botones .btn.principal { grid-column: 1 / -1; }
  .docs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .doc button { min-height: 36px; }
  .vista-previa { font-size: 15px; padding: 14px; }
  .nota small { font-size: 13px; }
  .chip { font-size: 13.5px; padding: 3px 11px; }

  /* Entrada */
  .entrada { min-height: 100vh; min-height: 100dvh; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); align-items: start; }
  .entrada .caja { margin-top: 4vh; padding: 24px 20px; border-radius: 16px; gap: 16px; }

  /* Ventanas: a pantalla completa, con el título arriba y los botones abajo */
  dialog#modal { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; border-radius: 0; inset: 0; }
  dialog#modal form { height: 100%; max-height: none; }
  dialog#modal header { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid var(--linea2); align-items: center; }
  dialog#modal header h2 { font-size: 18px; }
  dialog#modal header .btn { width: 44px; padding: 0; }
  dialog#modal .contenido { flex: 1; padding: 16px 16px 24px; gap: 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; align-content: start; }
  dialog#modal footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: nowrap; background: var(--papel); }
  dialog#modal footer .btn { flex: 1 1 0; }
  dialog#modal footer .btn.principal { flex: 2 1 0; }

  /* Gráficas */
  .viz-fila { grid-template-columns: 1fr; gap: 4px; padding: 4px 0; font-size: 15px; }
  .viz-leyenda { font-size: 14.5px; gap: 8px 18px; }
  .viz-eje { font-size: 12px; }
  .viz-tabla table { font-size: 14.5px; }
}
@media (min-width: 861px) { .solo-movil { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
