/* Tandem CFO · estilos. Marca: acento #2a63e8, paneles de vidrio. Sin estilos en línea en HTML (CSP). */
:root {
  color-scheme: light;
  --navy: #0a1f2e;
  --bg-1: #eef2fa; --bg-2: #f8f9fd;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-2: #f2f5fb;
  --line: rgba(17, 32, 66, 0.08); --line-2: rgba(17, 32, 66, 0.16);
  --text-primary: #0f1a33; --text-secondary: #4a556f; --text-muted: #6b7590;
  --accent: #2a63e8; --accent-2: #16b3d9; --accent-soft: #e8efff; --on-accent: #ffffff;
  --good: #137a47; --warning: #9a6200; --critical: #c42d2d;
  --good-bg: #e3f5ec; --warning-bg: #fff2d9; --critical-bg: #fde7e7;
  --ing: #2a78d6; --egr: #eb6834;
  --shadow: 0 10px 30px rgba(30, 50, 100, 0.10), 0 2px 6px rgba(30, 50, 100, 0.06);
  --r: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "Space Grotesk", "Inter", system-ui, sans-serif;
  --cert-color: #0f1a33;
  --como: #f08a00;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-1: #050d15; --bg-2: #0b1624;
    --surface: rgba(20, 30, 50, 0.72); --surface-solid: #111b2e; --surface-2: #16223a;
    --line: rgba(255, 255, 255, 0.08); --line-2: rgba(255, 255, 255, 0.18);
    --text-primary: #e9eef8; --text-secondary: #b6c0d6; --text-muted: #8f9ab3;
    --accent: #6c97ff; --accent-soft: #1a2a52; --on-accent: #0a1020;
    --good: #3ddc97; --warning: #ffb020; --critical: #ff7b8c;
    --good-bg: #0f2e22; --warning-bg: #33260a; --critical-bg: #3a1218;
    --ing: #5aa0f0; --egr: #ff8a5c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --cert-color: #e9eef8;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-1: #050d15; --bg-2: #0b1624;
  --surface: rgba(20, 30, 50, 0.72); --surface-solid: #111b2e; --surface-2: #16223a;
  --line: rgba(255, 255, 255, 0.08); --line-2: rgba(255, 255, 255, 0.18);
  --text-primary: #e9eef8; --text-secondary: #b6c0d6; --text-muted: #8f9ab3;
  --accent: #6c97ff; --accent-soft: #1a2a52; --on-accent: #0a1020;
  --good: #3ddc97; --warning: #ffb020; --critical: #ff7b8c;
  --good-bg: #0f2e22; --warning-bg: #33260a; --critical-bg: #3a1218;
  --ing: #5aa0f0; --egr: #ff8a5c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --cert-color: #e9eef8;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 400 15px/1.5 var(--font); color: var(--text-primary);
  background: radial-gradient(1200px 800px at 70% 20%, var(--surface-solid) 0%, var(--bg-2) 40%, var(--bg-1) 100%) fixed;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 600; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0 0 .6em; }
a { color: var(--accent); }
small, .peq { font-size: .8rem; }
.muted { color: var(--text-secondary); }
.num, td.num, th.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--on-accent); padding: 8px 12px; z-index: 100; }
.saltar:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---- marco */
#barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; position: sticky; top: 0; z-index: 20;
  background: var(--surface); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
body.modo-como #barra { top: 36px; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.iso { width: 34px; height: 36px; display: block; }
.iso-osc { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .iso-osc { display: block; } :root:not([data-theme="light"]) .iso-cla { display: none; } }
:root[data-theme="dark"] .iso-osc { display: block; }
:root[data-theme="dark"] .iso-cla { display: none; }
.marca-txt { display: flex; flex-direction: column; }
.marca-tandem { font: 900 17px/1 "Montserrat", var(--font-num), sans-serif; letter-spacing: .04em; }
.marca-app { font-size: 12px; color: var(--text-secondary); margin-top: 3px; letter-spacing: .12em; font-weight: 600; }
.barra-der { display: flex; align-items: center; gap: 10px; min-width: 0; }
.barra-empresa { font-weight: 600; }
.barra-usuario { color: var(--text-secondary); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
#menu { display: flex; gap: 4px; padding: 8px 16px 0; overflow-x: auto; scrollbar-width: thin; }
.menu-item { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--text-secondary); font-weight: 500; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.menu-item:hover { background: var(--accent-soft); color: var(--text-primary); }
.menu-item[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.insignia { background: var(--critical); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 6px; min-width: 18px; text-align: center; }
#vista { max-width: 1280px; margin: 0 auto; padding: 16px 16px 64px; outline: none; }
body.sin-sesion #vista { max-width: 460px; padding-top: 8vh; }
.barra-como { position: fixed; top: 0; left: 0; right: 0; height: 36px; z-index: 40; background: var(--como); color: #1a1000; display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 600; }
body.modo-como { padding-top: 36px; }
.btn-enlace { background: none; border: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0 4px; }

/* ---- paneles y tarjetas */
.vidrio, .panel { background: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel { padding: 16px; margin-bottom: 16px; min-width: 0; }
.panel > h2 { margin-bottom: 10px; }
.cabecera { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cabecera .sub { color: var(--text-secondary); font-size: .9rem; }
.controles { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.controles .campo { min-width: 130px; flex: 0 1 auto; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; margin-bottom: 16px; }
.tarjeta { padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tarjeta .et { font-size: .8rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tarjeta .cifra { font: 700 1.4rem/1.15 var(--font-num); white-space: nowrap; }
.tarjeta.grande .cifra { font-size: 2.3rem; white-space: normal; overflow-wrap: anywhere; }
.tarjeta.grande { grid-column: span 2; background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.tarjeta.restringida { border-style: dashed; }
.tarjeta .nota { font-size: .82rem; color: var(--text-secondary); }
.tarjeta.mal .cifra { color: var(--critical); }
.tarjeta.bien .cifra { color: var(--good); }
.columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.vacio { color: var(--text-secondary); padding: 18px; text-align: center; }
.cargando { display: flex; align-items: center; gap: 10px; padding: 40px; justify-content: center; color: var(--text-secondary); }
.giro { width: 18px; height: 18px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .giro { animation: none; } }
.error-panel { max-width: 560px; margin: 40px auto; }

/* ---- botones y formularios */
.btn { font: inherit; font-weight: 600; font-size: .9rem; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-solid); color: var(--text-primary); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; min-height: 36px; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primario { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-peligro { background: var(--critical); color: #fff; border-color: var(--critical); }
.btn-fantasma { background: transparent; border-color: transparent; }
.btn-chico { padding: 4px 10px; font-size: .8rem; min-height: 30px; }
.btn-icono { padding: 6px 10px; }
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.campo-et { font-size: .78rem; font-weight: 600; color: var(--text-secondary); }
.ayuda { color: var(--text-muted); font-size: .76rem; }
.eco { color: var(--accent); font-size: .78rem; min-height: 1em; font-family: var(--font-num); }
.eco.mal { color: var(--critical); }
input, select, textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-solid); color: var(--text-primary); min-height: 38px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
textarea { min-height: 70px; resize: vertical; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin-bottom: 12px; }
.fila { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: .9rem; cursor: pointer; }
.toggle { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; font-size: .85rem; background: var(--surface-solid); }
.toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
fieldset { border: 1px solid var(--line-2); border-radius: 12px; margin: 0 0 12px; padding: 10px 12px; min-width: 0; }
legend { font-size: .78rem; font-weight: 600; color: var(--text-secondary); padding: 0 6px; }
.pestanas { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.pestana { font: inherit; font-weight: 600; background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--text-secondary); border-bottom: 3px solid transparent; }
.pestana[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- tablas */
.tabla-scroll { overflow-x: auto; max-width: 100%; border-radius: 12px; }
.tabla { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabla th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); padding: 8px 10px; border-bottom: 2px solid var(--line-2); white-space: nowrap; background: var(--surface); }
.tabla td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla tbody tr:hover { background: var(--accent-soft); }
.tabla tr.pasado td { color: var(--text-secondary); background: var(--surface-2); }
.tabla tr.agregado td { background: var(--surface-2); color: var(--text-secondary); font-style: italic; }
.tabla tr.pendiente-fila td { background: var(--warning-bg); }
.tabla tr.hoy-fila td { border-top: 2px solid var(--accent); }
.tabla .acciones { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.tabla td.cortar { max-width: 260px; overflow-wrap: anywhere; }
.ing { color: var(--ing); font-weight: 600; }
.egr { color: var(--egr); font-weight: 600; }
.etiqueta { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-secondary); white-space: nowrap; }
.etiqueta.mal { color: var(--critical); border-color: var(--critical); background: var(--critical-bg); }
.etiqueta.alerta { color: var(--warning); border-color: var(--warning); background: var(--warning-bg); }
.etiqueta.bien { color: var(--good); border-color: var(--good); background: var(--good-bg); }
.desglose { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.desglose .total { font-weight: 700; }
.desglose .linea { display: flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--text-secondary); }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.lista li:last-child { border-bottom: 0; }
.lista .quien { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }

/* ---- certeza: real = sólido, comprometido = rayado, proyectado = punteado y translúcido (siempre con texto) */
.cert { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; padding: 2px 9px 2px 4px; border-radius: 999px; border: 1px solid var(--cert-color); color: var(--text-primary); white-space: nowrap; background: var(--surface-solid); }
.cert-muestra { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1.5px solid var(--cert-color); flex: none; }
.cert-real .cert-muestra { background: var(--cert-color); }
.cert-comprometido .cert-muestra { background: repeating-linear-gradient(45deg, var(--cert-color) 0 2px, transparent 2px 4px); }
.cert-proyectado { border-style: dashed; opacity: .85; }
.cert-proyectado .cert-muestra { border-style: dotted; background: color-mix(in srgb, var(--cert-color) 25%, transparent); }

/* ---- gráficos SVG */
.grafico-scroll { overflow-x: auto; max-width: 100%; }
.grafico { display: block; max-width: 100%; height: auto; }
.grafico text { font: 11px var(--font-num); fill: var(--text-secondary); }
.grafico .eje { stroke: var(--line-2); stroke-width: 1; }
.grafico .rejilla-y { stroke: var(--line); stroke-width: 1; }
.grafico .cero { stroke: var(--text-muted); stroke-width: 1.2; }
.grafico .hoy { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 3; }
.grafico .hoy-et { fill: var(--accent); font-weight: 700; }
.grafico .pasado-fondo { fill: var(--text-muted); opacity: .08; }
.b-ing { fill: var(--ing); stroke: var(--ing); }
.b-egr { fill: var(--egr); stroke: var(--egr); }
line.pat-ing { stroke: var(--ing); stroke-width: 2.4; }
line.pat-egr { stroke: var(--egr); stroke-width: 2.4; }
.pat-fondo { fill: var(--surface-solid); }
.l-disp { stroke: var(--text-primary); stroke-width: 2.6; fill: none; }
.l-total { stroke: var(--accent); stroke-width: 2; fill: none; }
.l-restr { fill: var(--accent); opacity: .14; stroke: none; }
.l-cons { stroke: var(--text-primary); stroke-width: 2.6; fill: none; }
.l-base { stroke: var(--accent); stroke-width: 2.2; fill: none; }
.l-pond { stroke: var(--egr); stroke-width: 2.2; fill: none; }
.l-min { stroke: var(--critical); stroke-width: 1.5; stroke-dasharray: 2 3; fill: none; }
.leyenda { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 0; font-size: .8rem; color: var(--text-secondary); align-items: center; }
.leyenda .it { display: inline-flex; gap: 6px; align-items: center; }
.leyenda svg { width: 30px; height: 14px; flex: none; }
.leyenda .linea-m { stroke: var(--text-primary); stroke-width: 2.6; }

/* ---- barras de edades y salud */
.edades { display: flex; width: 100%; height: 22px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-2); margin: 8px 0 6px; }
.edades span { display: block; height: 100%; min-width: 2px; flex: 0 0 auto; width: var(--w, 0%); }
.ed-por_vencer { background: var(--good); } .ed-1_30 { background: #d9c400; } .ed-31_60 { background: #eda100; } .ed-61_90 { background: #eb6834; } .ed-mas_90 { background: var(--critical); }
.leyenda-edades { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.leyenda-edades > div { border-left: 6px solid var(--line-2); padding-left: 8px; font-size: .82rem; }
.leyenda-edades .ed-por_vencer { border-color: var(--good); background: none; } .leyenda-edades .ed-1_30 { border-color: #d9c400; background: none; }
.leyenda-edades .ed-31_60 { border-color: #eda100; background: none; } .leyenda-edades .ed-61_90 { border-color: #eb6834; background: none; } .leyenda-edades .ed-mas_90 { border-color: var(--critical); background: none; }
.progreso { height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin: 6px 0; }
.progreso > span { display: block; height: 100%; width: var(--p, 0%); background: var(--good); }
.progreso.medio > span { background: var(--warning); }
.progreso.bajo > span { background: var(--critical); }

/* ---- modal y avisos */
.modal-fondo { position: fixed; inset: 0; z-index: 60; background: rgba(5, 13, 21, .55); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; }
.modal { width: min(var(--ancho, 560px), 100%); padding: 20px; background: var(--surface-solid); }
.modal-titulo { margin-bottom: 12px; font-size: 1.2rem; }
.modal-cuerpo { display: flex; flex-direction: column; gap: 10px; }
.modal-error { background: var(--critical-bg); color: var(--critical); border: 1px solid var(--critical); border-radius: 10px; padding: 8px 12px; margin-top: 10px; font-size: .88rem; }
.modal-pie { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
#avisos { position: fixed; right: 12px; bottom: 12px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 24px)); }
.aviso { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: .9rem; }
.aviso-error { border-color: var(--critical); background: var(--critical-bg); }
.aviso-alerta { border-color: var(--warning); background: var(--warning-bg); }
.aviso-ok { border-color: var(--good); background: var(--good-bg); }
.aviso-x { background: none; border: 0; color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.nota-caja { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--warning); background: var(--warning-bg); margin-bottom: 14px; }
.explica { font-size: .85rem; color: var(--text-secondary); background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.ingreso-caja { padding: 28px; text-align: center; }
.ingreso-caja img { max-width: 260px; width: 100%; height: auto; margin-bottom: 16px; }
:root[data-theme="dark"] .ingreso-caja img { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ingreso-caja img { filter: brightness(0) invert(1); } }
.ingreso-caja .campo { text-align: left; margin: 14px 0; }

/* ---- móvil */
@media (max-width: 720px) {
  .barra-empresa, .barra-usuario { display: none; }
  .tarjeta.grande { grid-column: span 1; }
  .tarjeta.grande .cifra { font-size: 1.9rem; }
  h1 { font-size: 1.25rem; }
  #vista { padding: 12px 12px 56px; }
  .controles .campo { flex: 1 1 140px; }
  .modal { padding: 16px; }
}

/* ---- impresión: conserva patrones de certeza */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; color: #000; }
  #barra, #menu, #avisos, .controles, .no-imprimir, .barra-como, .saltar, .acciones { display: none !important; }
  body.modo-como { padding-top: 0; }
  .vidrio, .panel { background: #fff; box-shadow: none; backdrop-filter: none; border-color: #999; break-inside: avoid; }
  .tabla-scroll, .grafico-scroll { overflow: visible; }
  #vista { max-width: none; padding: 0; }
  .tabla th { background: #eee; color: #000; }
  .tabla tbody tr:hover { background: none; }
}

/* barras del flujo: real = sólido; comprometido = rayado (fill url(#pat-…)); proyectado = punteado y translúcido (fill-opacity en atributo) */
.bs-ing { stroke: var(--ing); stroke-width: 1.2; }
.bs-egr { stroke: var(--egr); stroke-width: 1.2; }
.b-ing, .b-egr { stroke-width: 1.2; }
.leyenda .sw rect { stroke-width: 1.2; }
.leyenda line.hoy { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 3; }
.leyenda .l-disp, .leyenda .l-total { fill: none; }
.nowrap { white-space: nowrap; }
.btn { white-space: nowrap; }

/* F2–F4 */
.cert-mezcla .cert-muestra { background: linear-gradient(90deg, var(--cert-color) 50%, transparent 50%); }
.sev { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; }
.sev-alta { color: var(--critical); border-color: var(--critical); background: var(--critical-bg); }
.sev-media { color: var(--warning); border-color: var(--warning); background: var(--warning-bg); }
.sev-baja { color: var(--text-secondary); }
.banda { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--warning); background: var(--warning-bg); margin-bottom: 12px; font-size: .9rem; }
.banda-mal { border-color: var(--critical); background: var(--critical-bg); color: var(--critical); }
.banda-info { border-color: var(--line-2); background: var(--surface-2); }
.conf { display: inline-block; width: 90px; height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; vertical-align: middle; }
.conf > span { display: block; height: 100%; width: var(--p, 0%); background: var(--good); }
.conf.media > span { background: var(--warning); }
.conf.baja > span { background: var(--critical); }
.falta { outline: 2px solid var(--warning); outline-offset: 1px; border-radius: 8px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.chat-hilos { display: flex; flex-direction: column; gap: 6px; }
.chat-hilos .btn { justify-content: flex-start; text-align: left; white-space: normal; }
.chat-hilos .btn[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mensajes { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; padding: 4px; }
.msg { padding: 10px 14px; border-radius: 14px; max-width: 92%; border: 1px solid var(--line); }
.msg-usuario { align-self: flex-end; background: var(--accent-soft); }
.msg-cfo { align-self: flex-start; background: var(--surface-solid); }
.msg small { display: block; color: var(--text-muted); margin-top: 4px; }
.tabla-edit input, .tabla-edit select { min-width: 110px; padding: 4px 6px; min-height: 32px; font-size: .85rem; }
.tabla-edit td { vertical-align: middle; }
.titulo-contable { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--text-muted); color: var(--text-secondary); background: var(--surface-2); margin-bottom: 10px; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.kpi > div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.kpi .v { font: 700 1.25rem/1.2 var(--font-num); }
.kpi .f { font-size: .76rem; color: var(--text-secondary); margin-top: 4px; }
.tabla td.sub { padding-left: 24px; color: var(--text-secondary); }
.tabla tr.total td { font-weight: 700; border-top: 2px solid var(--line-2); }
.mes-cab td { background: var(--accent-soft); font-weight: 700; }
.json { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; min-height: 280px; }
.informe h2 { margin: 14px 0 6px; }
@media (max-width: 720px) { .chat { grid-template-columns: 1fr; } .msg { max-width: 100%; } }
@media print { .chat-hilos, .mensajes { max-height: none; } .informe { font-size: 11pt; } }
.sr-solo { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ing-error { color: var(--critical); font-weight: 600; }
.chat > * { min-width: 0; }
.chat .btn { white-space: normal; text-align: left; max-width: 100%; }
.chat textarea { width: 100%; box-sizing: border-box; }
