/* Pagos → Siigo · estilo "achromatic ledger": la estructura en tinta y grises, el único tono (--dato) en el dato
   principal de cada pantalla y en la marca; colores de estado solo en las píldoras pálidas.
   Rejilla: columna centrada de 1152 px + 24 px a cada lado; un solo espacio (--gap) entre bloques.
   Dos columnas: 2 × 570 + 12 = 1152 · reparto: 760 + 12 + 380 = 1152. */

@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fuentes/geist.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fuentes/geist-mono.woff2") format("woff2"); }

:root {
  --ground: #f2f4f7;      /* gris azulado de libro contable */
  --surface: #ffffff;
  --raised: #f7f8fa;
  --active: #e4e7ec;
  --border: #e2e5e9;
  --rule: #eef0f3;
  --control: #cfd3d9;
  --text: #0a0a0a;
  --muted: #5b6168;
  --primary: #141414;
  --secondary: #e5e5e5;
  --dato: #1d5fbf;        /* el único tono: el dato principal y la marca */
  --dato-claro: #c9d6ea;
  --positive: #2e7d32;
  --negative: #c4242a;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e; --warning-border: #fde68a;
  --pill-neutral-bg: #eceef1;  --pill-neutral-ink: #3d3d3d;
  --radius-card: 8px; --radius-control: 6px; --radius-chip: 4px;
  --gap: 12px; --pad: 24px; --card-pad: 20px;
  --control-height: 36px; --row-height: 44px;
  --font: "Geist", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs-title: 24px; --fs-section: 16px; --fs-kpi: 30px; --fs-body: 14px; --fs-small: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 var(--fs-body)/20px var(--font); font-feature-settings: "tnum" 0;
}
a { color: inherit; }
img, svg { display: block; }
.num, table, .cifra, .kv dd { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; white-space: nowrap; }
.tenue { color: var(--muted); }
.columna { width: 100%; max-width: calc(1152px + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad); }

/* --- barra superior: sobre el mismo fondo, la marca en el borde izquierdo de la columna --- */
.barra { position: relative; border-bottom: 1px solid var(--border); background: var(--ground); }
.barra-in { display: flex; align-items: center; gap: 28px; height: 56px; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.marca svg { width: 22px; height: 22px; }
.marca .nombre { font-weight: 500; font-size: 15px; letter-spacing: -0.01em; }
.marca .alcance { color: var(--muted); font-size: 13px; padding-left: 10px; border-left: 1px solid var(--control); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; padding: 6px 10px; border-radius: var(--radius-control); }
.nav a:hover { color: var(--text); background: var(--active); }
.nav a[aria-current="page"] { color: var(--text); background: var(--active); }
.cuenta { display: flex; align-items: center; gap: 12px; flex: none; }
.cuenta .quien { color: var(--muted); }
.cuenta form { margin: 0; }
.menu-movil { display: none; }
.menu-movil:not([open]) .menu-panel { display: none; }

/* --- título de pantalla --- */
main.columna { padding-top: 32px; padding-bottom: 48px; }
.titulo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.titulo > div:first-child { min-width: 0; }
h1 { font-size: var(--fs-title); line-height: 30px; font-weight: 500; letter-spacing: -0.015em; margin: 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sub { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.sub a { color: var(--text); }
.hallazgo { color: var(--text); margin: 6px 0 0; }
.hallazgo a { font-weight: 500; }
h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 500; margin: 0; }
.acciones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* --- bloques --- */
.bloque { margin-top: 28px; }
.bloque-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.bloque-cab .tenue { font-size: 13px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); }
.panel + .panel { margin-top: var(--gap); }
.panel h2 + p, .panel h2 + .ayuda { margin-top: 6px; }
.ayuda { color: var(--muted); margin: 0; font-size: 13px; line-height: 19px; }
.ayuda strong { color: var(--text); font-weight: 500; }
.fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: stretch; }
.fila2 > .panel + .panel { margin-top: 0; }
.panel-forma { display: flex; flex-direction: column; }
.panel-forma form { margin-top: auto; padding-top: 16px; }

/* franja de cifras: una tarjeta dividida por líneas */
.cifras { margin: 0; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card); }
.cifras > div { padding: 16px var(--card-pad); min-width: 0; }
.cifras > div + div { border-left: 1px solid var(--border); }
.cifras dt { color: var(--muted); font-size: 13px; }
.cifras dd { margin: 6px 0 0; font-size: 24px; line-height: 30px; font-weight: 400; letter-spacing: -0.01em; }
.cifras dd .mono { font-size: 17px; }
.cifras dd small { font-size: 13px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.cifras dd.cero { color: var(--muted); }
.nota-cifra { margin-top: 2px; font-size: 13px; color: var(--muted); }
.nota-cifra a { color: var(--text); }

/* --- el reparto de una propuesta (elemento propio): barra 100 % + leyenda con datos --- */
.reparto { display: grid; grid-template-columns: 2fr 1fr; gap: 0; padding: 0; }
.reparto > section { padding: var(--card-pad) var(--pad); min-width: 0; }
.reparto > section + section { border-left: 1px solid var(--border); }
.respuesta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.respuesta .valor { font-size: var(--fs-kpi); line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }
.respuesta .que { color: var(--muted); }
.barra-reparto { display: flex; gap: 2px; height: 12px; margin: 16px 0 6px; }
.barra-reparto span { display: block; min-width: 3px; border-radius: 2px; }
.t-aplicar { background: var(--dato); }
.t-ya { background: var(--dato-claro); }
.t-revision { background: var(--primary); }
.t-otro { background: var(--control); }
.por-tipo { display: flex; flex-direction: column; }
.por-tipo .kv.total { margin-top: auto; padding-top: 12px; }
.por-tipo .kv.total > div { border-top: 1px solid var(--border); padding-top: 10px; }
.por-tipo .kv.total strong { font-weight: 700; }
.leyenda { width: 100%; margin-top: 10px; }
.leyenda td { border: 0; padding: 7px 0; height: auto; }
.leyenda td + td { padding-left: 16px; }
.leyenda tr + tr td { border-top: 1px solid var(--rule); }
.punto { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 1px; }
.leyenda .fuera td { color: var(--muted); }

/* --- tablas: reglas y alineación, sin bandas --- */
.tabla { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; line-height: 20px; }
th:first-child, td:first-child { padding-left: var(--card-pad); }
th:last-child, td:last-child { padding-right: var(--card-pad); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td .linea2, .linea2 { display: block; color: var(--muted); font-size: 12px; line-height: 18px; margin-top: 1px; }
td.motivo { min-width: 260px; max-width: 420px; }
td.corto { white-space: nowrap; }
td.resultado { max-width: 240px; }
tr.vacia td { color: var(--muted); padding: 18px var(--card-pad); }
a.id { text-decoration: none; border-bottom: 1px solid var(--control); }
a.id:hover { border-color: var(--text); }
.mas { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

/* --- píldoras de estado: pálidas, tinta del mismo tono --- */
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-chip);
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; flex: none; vertical-align: 1px;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); letter-spacing: 0; }
.pill.ok, .pill.CREADO { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.error, .pill.ERROR, .pill.INCIERTO { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.interrumpida, .pill.OMITIDO, .pill.vencida, .pill.simulacion { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
h1 .pill { font-size: 12px; letter-spacing: 0; }

/* --- avisos --- */
.aviso { border-radius: var(--radius-card); padding: 12px 16px; margin: 0 0 16px; border: 1px solid var(--border);
  background: var(--surface); line-height: 20px; }
.aviso.ok { border-color: #b7e4c4; background: #f3fbf5; color: var(--pill-positive-ink); }
.aviso.error { border-color: #f6c6c0; background: #fff7f6; color: var(--pill-negative-ink); }
.aviso.alerta { border-color: var(--warning-border); background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.aviso strong { font-weight: 500; }

/* --- controles --- */
.boton, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-height);
  padding: 0 14px; border-radius: var(--radius-control); border: 1px solid transparent; font: 500 14px/1 var(--font);
  cursor: pointer; text-decoration: none; white-space: nowrap; background: var(--primary); color: #fff;
  transition: background-color .12s ease, border-color .12s ease, transform .06s ease;
}
.boton:hover, button:hover { background: #2f2f2f; }
.boton:active, button:active { transform: translateY(1px); }
.boton.secundario, button.secundario { background: var(--secondary); color: var(--text); }
.boton.secundario:hover, button.secundario:hover { background: #d9d9d9; }
button.texto { background: none; color: var(--muted); height: auto; padding: 4px 6px; font-weight: 500; }
button.texto:hover { color: var(--text); background: var(--active); }
button[disabled] { background: var(--secondary); color: var(--muted); cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--dato); outline-offset: 2px; }

label { display: block; font-weight: 500; margin-bottom: 8px; }
.campo { margin-bottom: 16px; }
.campo:last-of-type { margin-bottom: 0; }
input[type=text], input[type=password], input[type=date], input[type=search], select {
  height: var(--control-height); padding: 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control);
  font: 400 14px var(--font); color: var(--text); background: #fff; width: 100%;
}
input:hover, select:hover { border-color: #b8bdc4; }
input[type=file] { font: 400 14px var(--font); color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { height: 32px; padding: 0 12px; margin-right: 10px; border: 0; border-radius: var(--radius-control);
  background: var(--secondary); color: var(--text); font: 500 14px var(--font); cursor: pointer; }
.forma-linea { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.forma-linea .campo { margin: 0; flex: 1 1 150px; }
.forma-linea .campo label { font-size: 13px; color: var(--muted); font-weight: 400; margin-bottom: 6px; }
.chequeo { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 16px 0; }
.chequeo input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }

/* --- lista clave-valor --- */
.kv { margin: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; border-top: 1px solid var(--rule); }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv .grande { font-size: var(--fs-kpi); line-height: 36px; font-weight: 700; letter-spacing: -0.02em; }

/* --- segmentos (filtros como enlaces) --- */
.herramientas { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--gap); }
.segmentos { display: inline-flex; background: var(--active); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmentos a { text-decoration: none; color: var(--muted); padding: 0 10px; height: 30px; display: inline-flex; align-items: center;
  border-radius: var(--radius-control); font-weight: 500; white-space: nowrap; }
.segmentos a:hover { color: var(--text); }
.segmentos a[aria-current="true"] { background: var(--surface); color: var(--text); }
.segmentos a span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.buscar { display: flex; gap: 8px; }
.buscar input { width: 280px; }

/* --- ajustes en dos columnas (maestro) --- */
.ajuste { display: grid; grid-template-columns: 380px 1fr; gap: 32px; padding: 28px 0; border-top: 1px solid var(--border); }
.ajuste:first-of-type { border-top: 0; padding-top: 8px; }
.ajuste > div:first-child p { color: var(--muted); margin: 6px 0 0; }

/* --- bitácora de una corrida --- */
pre.bitacora { margin: 0; background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px var(--card-pad); font: 400 12.5px/20px var(--mono); color: #1f2328; max-height: 560px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; }

/* --- ingreso --- */
.acceso { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.acceso .marca { margin-bottom: 28px; }
.acceso h1 { margin-bottom: 16px; }
.acceso button { width: 100%; margin-top: 20px; }
.acceso .pie-acceso { color: var(--muted); font-size: 13px; margin-top: 16px; }

.pie-pagina { color: var(--muted); font-size: 12px; padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--border); }
code { font-family: var(--mono); font-size: 12.5px; background: var(--active); padding: 1px 5px; border-radius: 4px; }

/* --- tableta y teléfono --- */
@media (max-width: 1100px) {
  .marca .alcance { display: none; }
  .reparto { grid-template-columns: 1fr; }
  .reparto > section + section { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 900px) {  /* la barra se pliega en un menú en tableta y teléfono */
  .barra-in { height: 52px; gap: 12px; }
  .nav, .cuenta { display: none; }
  .menu-movil { display: block; margin-left: auto; }
  .menu-movil > summary { list-style: none; cursor: pointer; height: 40px; display: flex; align-items: center; gap: 8px;
    padding: 0 12px; border-radius: var(--radius-control); background: var(--secondary); font-weight: 500; }
  .menu-movil > summary::-webkit-details-marker { display: none; }
  .menu-movil[open] > summary { background: var(--primary); color: #fff; }
  .menu-panel { position: absolute; left: 0; right: 0; top: 52px; z-index: 10; background: var(--surface);
    border-bottom: 1px solid var(--border); box-shadow: 0 12px 24px rgba(0,0,0,.08); padding: 8px 16px 16px; }
  .menu-panel a { display: flex; align-items: center; height: 44px; text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--rule); }
  .menu-panel a[aria-current="page"] { color: var(--dato); }
  .menu-panel .pie-menu { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; color: var(--muted); }
  .ajuste { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 760px) {
  :root { --pad: 16px; --card-pad: 16px; }
  main.columna { padding-top: 22px; }
  h1 { font-size: 22px; line-height: 28px; }
  .titulo { align-items: flex-start; }
  .titulo .acciones { width: 100%; }
  .titulo .acciones .boton { flex: 1 1 auto; }
  .fila2 { grid-template-columns: 1fr; }
  .cifras { grid-template-columns: 1fr 1fr; }
  .cifras > div + div { border-left: 0; }
  .cifras > div:nth-child(even) { border-left: 1px solid var(--border); }
  .cifras > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .cifras > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .respuesta .valor { font-size: 26px; }
  .leyenda tr { display: grid; grid-template-columns: 1fr auto; padding: 8px 0; }
  .leyenda tr + tr { border-top: 1px solid var(--rule); }
  .leyenda tr + tr td { border-top: 0; }
  .leyenda td { padding: 0; }
  .leyenda td:first-child { grid-column: 1 / -1; }
  .leyenda td:nth-child(2) { text-align: left; padding: 2px 0 0 16px; color: var(--muted); }
  .leyenda td:nth-child(3) { padding-top: 2px; }
  .leyenda td:nth-child(4) { display: none; }
  .bloque-cab { flex-direction: column; align-items: flex-start; gap: 2px; }
  .buscar { width: 100%; }
  .buscar input { width: auto; flex: 1; }
  .boton, button { height: 44px; }
  button.texto { height: auto; }
  table { font-size: 13.5px; }
  th:first-child, td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
