/* Base copiada de appEbitda/css/ebitda.css (estilo ac-* de las apps DSS) para el prototipo de calidad del aire.
 * Colores de series validados con el validador de paletas (daltonismo y contraste) sobre #ffffff y #171b1f.
 */
:root {
  color-scheme: light;
  --bg: #f2f5f6;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --surface-3: #eef2f4;
  --ink-1: #14191c;
  --ink-2: #4d5a60;
  --ink-3: #87939a;
  --line: #e3e8ea;
  --line-2: #cfd7da;
  --brand: #08697e;
  --brand-2: #0b7f95;
  --brand-ink: #075a6c;
  --brand-soft: #e3f2f5;
  --top-1: #08697e;
  --top-2: #0b7f95;
  --sombra: 0 1px 2px rgba(16, 40, 48, .06), 0 4px 16px rgba(16, 40, 48, .05);
  --sombra-2: 0 10px 40px rgba(16, 40, 48, .18);

  /* Series */
  --s-ganada: #00809c;
  --s-cotizado: #5fb0c2;
  --s-abierta: #4a3aa7;
  --s-perdida: #eb6834;
  --s-nocot: #a7acae;
  --s-anterior: #a3adb2;
  /* Categóricas (gerencias), orden fijo */
  --g-1: #00809c; --g-2: #eb6834; --g-3: #2a78d6; --g-4: #eda100; --g-5: #e87ba4; --g-6: #4a3aa7; --g-0: #a7acae;
  /* Secuencial teal */
  --seq-1: #dff1f4; --seq-2: #bfe3ea; --seq-3: #95d0dc; --seq-4: #63b6c8; --seq-5: #3499b0; --seq-6: #147d95; --seq-7: #0a5f73;
  --seq-txt-intenso: #ffffff;
  /* Estado (con ícono y texto, nunca solo color) */
  --ok: #0ca30c; --ok-txt: #006300; --ok-bg: #e7f6e7;
  --warn: #fab219; --warn-txt: #8a5a00; --warn-bg: #fff5dc;
  --serious: #ec835a; --serious-txt: #a3441c; --serious-bg: #fdeee7;
  --crit: #d03b3b; --crit-txt: #b02a2a; --crit-bg: #fbe9e9;
  --radio: 14px;
  font-size: 14px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1315; --surface: #171b1f; --surface-2: #1d2327; --surface-3: #232a2f;
  --ink-1: #f2f5f6; --ink-2: #b9c3c7; --ink-3: #7f8b90;
  --line: #283035; --line-2: #3a454b;
  --brand: #22a3bb; --brand-2: #159ab0; --brand-ink: #7fd0df; --brand-soft: #16343b;
  --top-1: #0a4f5e; --top-2: #0c6273;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4); --sombra-2: 0 10px 40px rgba(0, 0, 0, .6);
  --s-ganada: #159ab0; --s-cotizado: #2f6f7e; --s-abierta: #7d6fe3; --s-perdida: #d95926; --s-nocot: #5d6468; --s-anterior: #66727a;
  --g-1: #159ab0; --g-2: #d95926; --g-3: #3987e5; --g-4: #c98500; --g-5: #d55181; --g-6: #9085e9; --g-0: #5d6468;
  --seq-1: #173a42; --seq-2: #1b4d58; --seq-3: #1d6270; --seq-4: #1c7889; --seq-5: #1f90a3; --seq-6: #3aaabd; --seq-7: #6cc6d6;
  --seq-txt-intenso: #0b1a1e;
  --ok-txt: #4cd24c; --ok-bg: #12301a; --warn-txt: #f5c04a; --warn-bg: #362a0e;
  --serious-txt: #f29b77; --serious-bg: #3a2016; --crit-txt: #f07b7b; --crit-bg: #3a1a1a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1315; --surface: #171b1f; --surface-2: #1d2327; --surface-3: #232a2f;
    --ink-1: #f2f5f6; --ink-2: #b9c3c7; --ink-3: #7f8b90;
    --line: #283035; --line-2: #3a454b;
    --brand: #22a3bb; --brand-2: #159ab0; --brand-ink: #7fd0df; --brand-soft: #16343b;
    --top-1: #0a4f5e; --top-2: #0c6273;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4); --sombra-2: 0 10px 40px rgba(0, 0, 0, .6);
    --s-ganada: #159ab0; --s-cotizado: #2f6f7e; --s-abierta: #7d6fe3; --s-perdida: #d95926; --s-nocot: #5d6468; --s-anterior: #66727a;
    --g-1: #159ab0; --g-2: #d95926; --g-3: #3987e5; --g-4: #c98500; --g-5: #d55181; --g-6: #9085e9; --g-0: #5d6468;
    --seq-1: #173a42; --seq-2: #1b4d58; --seq-3: #1d6270; --seq-4: #1c7889; --seq-5: #1f90a3; --seq-6: #3aaabd; --seq-7: #6cc6d6;
    --seq-txt-intenso: #0b1a1e;
    --ok-txt: #4cd24c; --ok-bg: #12301a; --warn-txt: #f5c04a; --warn-bg: #362a0e;
    --serious-txt: #f29b77; --serious-bg: #3a2016; --crit-txt: #f07b7b; --crit-bg: #3a1a1a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  background: var(--bg); color: var(--ink-1); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand-ink); }
.num, .ac-tabla td.num { font-variant-numeric: tabular-nums; }

/* ───────────── Barra superior ───────────── */
.ac-top {
  background: linear-gradient(120deg, var(--top-1), var(--top-2));
  color: #fff; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.6rem;
}
.ac-marca { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.ac-logo {
  font-weight: 900; letter-spacing: .04em; font-size: 1.05rem; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28); border-radius: 10px; padding: .25rem .55rem;
}
.ac-titulo { font-size: 1.2rem; font-weight: 800; margin: 0; line-height: 1.15; }
.ac-subtitulo { font-size: .78rem; opacity: .85; }
.ac-top-acciones { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ac-top a, .ac-top-btn {
  color: #fff; text-decoration: none; font-size: .82rem; opacity: .9;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 999px;
  padding: .3rem .75rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
}
.ac-top a:hover, .ac-top-btn:hover { opacity: 1; background: rgba(255,255,255,.18); }
.ac-segmento { display: inline-flex; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 2px; }
.ac-segmento button { border: 0; background: transparent; color: #fff; font-size: .78rem; font-weight: 700; padding: .22rem .7rem; border-radius: 999px; cursor: pointer; opacity: .8; }
.ac-segmento button.activo { background: #fff; color: var(--top-1); opacity: 1; }

/* ───────────── Filtros ───────────── */
.ac-filtros {
  position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
  padding: .6rem 1.6rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end;
}
.ac-filtro { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ac-filtro label { font-size: .68rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.ac-filtro select, .ac-filtro input {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: .38rem .55rem;
  font-size: .85rem; min-width: 0; max-width: 220px;
}
.ac-filtro select:focus, .ac-filtro input:focus, .ac-buscar input:focus { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.ac-filtro.periodo select { font-weight: 700; color: var(--brand-ink); }
.ac-filtro.fechas { flex-direction: row; gap: .3rem; align-items: flex-end; }
.ac-filtro.fechas > div { display: flex; flex-direction: column; gap: 2px; }
.ac-filtro .cliente { width: 210px; }
.ac-limpiar { border: 0; background: none; color: var(--brand-ink); font-weight: 700; font-size: .82rem; cursor: pointer; padding: .4rem .3rem; }
.ac-limpiar:hover { text-decoration: underline; }
.ac-rango { margin-left: auto; font-size: .78rem; color: var(--ink-2); text-align: right; align-self: center; }
.ac-rango strong { color: var(--ink-1); }

/* ───────────── Pestañas ───────────── */
.ac-tabs { display: flex; gap: .15rem; padding: .7rem 1.6rem 0; overflow-x: auto; scrollbar-width: none; }
.ac-tabs::-webkit-scrollbar { display: none; }
.ac-tab {
  border: 0; background: none; padding: .55rem .9rem; border-radius: 10px 10px 0 0; cursor: pointer; font-weight: 700;
  color: var(--ink-2); font-size: .88rem; white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center;
  border-bottom: 2px solid transparent;
}
.ac-tab:hover { color: var(--ink-1); background: var(--surface-3); }
.ac-tab.activo { color: var(--brand-ink); border-bottom-color: var(--brand); background: var(--surface); }
.ac-tab .ac-insignia { background: var(--crit-bg); color: var(--crit-txt); border-radius: 999px; font-size: .68rem; padding: 0 .45rem; }

main { padding: 1rem 1.6rem 3rem; }
.ac-vista { display: grid; gap: 1rem; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.ac-vista > * { grid-column: span 12; min-width: 0; }
.ac-c6 { grid-column: span 6 !important; }
.ac-c4 { grid-column: span 4 !important; }
.ac-c8 { grid-column: span 8 !important; }
.ac-c5 { grid-column: span 5 !important; }
.ac-c7 { grid-column: span 7 !important; }
@media (max-width: 1100px) { .ac-c4, .ac-c5, .ac-c6, .ac-c7, .ac-c8 { grid-column: span 12 !important; } }

/* ───────────── Tarjetas ───────────── */
.ac-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1rem 1.1rem; min-width: 0; }
.ac-card-cab { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .6rem; }
.ac-card-cab h2 { font-size: .98rem; margin: 0; font-weight: 800; }
.ac-card-cab p { margin: .1rem 0 0; font-size: .78rem; color: var(--ink-2); }
.ac-card-cab .ac-card-acc { margin-left: auto; display: flex; gap: .35rem; flex-shrink: 0; }
.ac-btn {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: .3rem .6rem; font-size: .78rem;
  font-weight: 700; cursor: pointer; display: inline-flex; gap: .3rem; align-items: center; color: var(--ink-2);
}
.ac-btn:hover { background: var(--surface-3); color: var(--ink-1); }
.ac-btn:disabled { opacity: .45; cursor: default; }
.ac-btn-pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.ac-btn-pri:hover { background: var(--brand-2); color: #fff; }
.ac-btn.activo { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-2); }
.ac-nota { font-size: .75rem; color: var(--ink-3); margin-top: .5rem; }
.ac-vacio { color: var(--ink-3); font-size: .85rem; padding: 1.2rem; text-align: center; }

/* ───────────── Indicadores ───────────── */
.ac-kpis { display: grid; gap: 1rem; grid-template-columns: minmax(280px, 1.3fr) repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .ac-kpis { grid-template-columns: 1fr 1fr; } .ac-kpi.heroe { grid-column: span 2; grid-row: auto; } }
.ac-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); box-shadow: var(--sombra); padding: .95rem 1.05rem; display: flex; flex-direction: column; gap: .25rem; position: relative; min-width: 0; }
.ac-kpi-etq { font-size: .78rem; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.ac-kpi-valor { font-size: 1.75rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.ac-kpi-valor small { font-size: .9rem; font-weight: 700; color: var(--ink-2); margin-left: .25rem; }
.ac-kpi-sub { font-size: .76rem; color: var(--ink-2); }
.ac-kpi-pie { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; }
.ac-kpi.heroe { background: linear-gradient(150deg, var(--surface) 55%, var(--brand-soft)); grid-row: span 2; justify-content: space-between; }
.ac-kpi.heroe .ac-kpi-valor { font-size: 3.1rem; color: var(--brand-ink); }
.ac-kpi.heroe .ac-kpi-etq { font-size: .9rem; }
.ac-ayuda { color: var(--ink-3); cursor: help; font-size: .8rem; border: 0; background: none; padding: 0; line-height: 1; }
.ac-ayuda:hover, .ac-ayuda:focus { color: var(--brand-ink); }
.ac-delta { display: inline-flex; align-items: center; gap: .2rem; font-size: .76rem; font-weight: 700; border-radius: 999px; padding: .05rem .5rem; white-space: nowrap; }
.ac-delta.bien { color: var(--ok-txt); background: var(--ok-bg); }
.ac-delta.mal { color: var(--crit-txt); background: var(--crit-bg); }
.ac-delta.neutro { color: var(--ink-2); background: var(--surface-3); }
.ac-delta-ctx { font-size: .72rem; color: var(--ink-3); margin-left: .3rem; }
.ac-medidor { height: 8px; border-radius: 999px; background: var(--seq-2); overflow: hidden; margin: .4rem 0 .15rem; }
.ac-medidor-barra { height: 100%; border-radius: 999px; background: var(--s-ganada); }
.ac-medidor.cumplida .ac-medidor-barra { background: var(--ok); }
.ac-meta-linea { display: flex; justify-content: space-between; font-size: .76rem; color: var(--ink-2); gap: .5rem; }
.ac-meta-linea strong { color: var(--ink-1); }

/* ───────────── Hallazgos ───────────── */
.ac-hallazgos { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.ac-hallazgo { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .85rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; }
.ac-hallazgo i { font-size: 1.15rem; color: var(--brand-ink); line-height: 1.2; }
.ac-hallazgo.alerta i { color: var(--serious-txt); }
.ac-hallazgo.bien i { color: var(--ok-txt); }
.ac-hallazgo b { font-weight: 800; }
.ac-hallazgo > div { min-width: 0; }
.ac-hallazgo a { font-weight: 700; cursor: pointer; }

/* ───────────── Gráficos ───────────── */
.ac-grafico { width: 100%; min-height: 60px; position: relative; }
.ac-svg { display: block; overflow: visible; }
.ac-svg text { font-family: inherit; }
.ac-eje { font-size: 11px; fill: var(--ink-3); }
.ac-grilla { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.ac-base { stroke: var(--line-2); stroke-width: 1; shape-rendering: crispEdges; }
.ac-marca { transition: opacity .15s; }
.ac-grupo.activo .ac-marca { opacity: .82; }
.ac-meta { stroke: var(--ink-2); stroke-width: 2; stroke-dasharray: 4 3; }
.ac-hit { fill: transparent; outline: none; }
.ac-hit.clic { cursor: pointer; }
.ac-hit:focus-visible { stroke: var(--brand-2); stroke-width: 2; }
.ac-linea { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ac-linea.discontinua { stroke-dasharray: 5 4; }
.ac-linea.enfasis { stroke-width: 2.5; }
.ac-area { opacity: .1; }
.ac-punto { stroke: var(--surface); stroke-width: 2; }
.ac-cruz { stroke: var(--ink-3); stroke-width: 1; }
.ac-etiqueta-fin { font-size: 12px; font-weight: 700; fill: var(--ink-1); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.ac-spark-linea { fill: none; stroke-width: 1.5; }
.ac-leyenda { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .76rem; color: var(--ink-2); margin-bottom: .5rem; }
.ac-leyenda-item { display: inline-flex; align-items: center; gap: .35rem; }
.ac-leyenda-clave { display: inline-block; flex-shrink: 0; }
.ac-leyenda-clave.barra { width: 10px; height: 10px; border-radius: 3px; background: var(--k); }
.ac-leyenda-clave.linea { width: 16px; height: 0; border-top: 2px solid var(--k); }
.ac-leyenda-clave.discontinua { width: 16px; height: 0; border-top: 2px dashed var(--k); }
.ac-leyenda-clave.punto { width: 9px; height: 9px; border-radius: 50%; background: var(--k); }

.ac-tip {
  position: fixed; z-index: 1000; display: none; pointer-events: none; min-width: 150px; max-width: 320px;
  background: var(--surface); color: var(--ink-1); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--sombra-2); padding: .55rem .7rem; font-size: .8rem;
}
.ac-tip-titulo { font-weight: 800; margin-bottom: .3rem; font-size: .78rem; color: var(--ink-2); }
.ac-tip-fila { display: grid; grid-template-columns: 16px auto 1fr; gap: .45rem; align-items: center; padding: .08rem 0; }
.ac-tip-clave { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--k); }
.ac-tip-clave.discontinua { border-top-style: dashed; }
.ac-tip-clave.barra { width: 10px; height: 10px; border: 0; border-radius: 3px; background: var(--k); }
.ac-tip-valor { font-weight: 800; font-variant-numeric: tabular-nums; }
.ac-tip-etq { color: var(--ink-2); }
.ac-tip-fila:not(:has(.ac-tip-clave)) { grid-template-columns: auto 1fr; }
.ac-tip-nota { margin-top: .35rem; color: var(--ink-3); font-size: .74rem; }

.ac-hbar { display: flex; flex-direction: column; gap: .3rem; }
.ac-hbar-fila, .ac-s100-fila { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr) auto; gap: .65rem; align-items: center; padding: .2rem .3rem; border-radius: 8px; }
.ac-hbar-fila.clic, .ac-s100-fila.clic { cursor: pointer; }
.ac-hbar-fila:hover, .ac-s100-fila:hover, .ac-hbar-fila:focus-visible { background: var(--surface-3); outline: none; }
.ac-hbar-et { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-hbar-pista { position: relative; height: 18px; margin-right: 6px; }
.ac-hbar-barra { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.ac-hbar-meta { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--ink-2); }
.ac-hbar-val { font-size: .82rem; font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ac-hbar-sub { font-weight: 500; color: var(--ink-3); margin-left: .4rem; font-size: .74rem; }
.ac-s100 { display: flex; flex-direction: column; gap: .35rem; }
.ac-s100-pista { display: flex; height: 22px; gap: 2px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.ac-s100-seg { min-width: 2px; display: flex; align-items: center; justify-content: center; outline: none; }
.ac-s100-seg:hover, .ac-s100-seg:focus-visible { filter: brightness(1.08); }
.ac-s100-txt { font-size: 11px; font-weight: 700; color: #fff; }
.ac-s100-txt.oscuro { color: #14191c; }
:root[data-theme="dark"] .ac-s100-txt.oscuro { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ac-s100-txt.oscuro { color: #fff; } }

.ac-calor { display: grid; gap: 3px; font-size: .74rem; }
.ac-calor-cab { color: var(--ink-3); text-align: center; font-weight: 600; padding-bottom: 2px; }
.ac-calor-fila { color: var(--ink-2); font-weight: 700; padding-right: .5rem; display: flex; align-items: center; }
.ac-calor-celda { border-radius: 5px; min-height: 30px; display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--ink-1); font-variant-numeric: tabular-nums; outline: none; }
.ac-calor-celda.claro { color: var(--seq-txt-intenso); }
.ac-calor-celda.cero { background: var(--surface-2); }
.ac-calor-celda:hover, .ac-calor-celda:focus-visible { box-shadow: 0 0 0 2px var(--ink-1); }
.ac-calor-total { font-weight: 800; padding-left: .5rem; display: flex; align-items: center; font-variant-numeric: tabular-nums; }
.ac-calor-escala { display: flex; align-items: center; gap: 3px; font-size: .72rem; color: var(--ink-3); margin-top: .6rem; }
.ac-calor-escala span:first-child { margin-right: .3rem; }
.ac-calor-escala span:last-child { margin-left: .3rem; }
.ac-calor-paso { width: 22px; height: 10px; border-radius: 3px; }

.ac-embudo { display: flex; flex-direction: column; }
.ac-embudo-fila { padding: .35rem .4rem; border-radius: 10px; outline: none; }
.ac-embudo-fila:hover, .ac-embudo-fila:focus-visible { background: var(--surface-3); }
.ac-embudo-cab { display: flex; justify-content: space-between; font-size: .84rem; margin-bottom: .25rem; gap: .5rem; }
.ac-embudo-nombre { font-weight: 700; }
.ac-embudo-uf { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ac-embudo-pista { display: flex; align-items: center; gap: .5rem; height: 26px; }
.ac-embudo-barra { height: 100%; border-radius: 0 5px 5px 0; }
.ac-embudo-n { font-weight: 800; font-size: .9rem; white-space: nowrap; }
.ac-embudo-nota { font-size: .74rem; color: var(--ink-3); margin-top: .2rem; }
.ac-embudo-conv { font-size: .74rem; color: var(--ink-2); padding: .1rem .4rem; display: flex; align-items: center; gap: .2rem; }

/* ───────────── Tablas ───────────── */
.ac-tabla-barra { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.ac-buscar { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 .55rem; background: var(--surface); flex: 1 1 220px; max-width: 360px; }
.ac-buscar i { color: var(--ink-3); }
.ac-buscar input { border: 0; background: transparent; padding: .38rem 0; width: 100%; outline: none; }
.ac-tabla-conteo { font-size: .78rem; color: var(--ink-3); margin-right: auto; }
.ac-tabla-env { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.ac-tabla { width: 100%; border-collapse: collapse; font-size: .82rem; }
.ac-tabla th { position: sticky; top: 0; background: var(--surface-2); text-align: left; border-bottom: 1px solid var(--line-2); padding: 0; white-space: nowrap; z-index: 1; }
.ac-tabla th.num { text-align: right; }
.ac-th { width: 100%; border: 0; background: none; padding: .5rem .6rem; font-size: .72rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; cursor: pointer; text-align: inherit; display: block; }
.ac-th:disabled { cursor: default; }
.ac-th.asc::after { content: ' ▲'; font-size: .6rem; }
.ac-th.desc::after { content: ' ▼'; font-size: .6rem; }
.ac-tabla td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ac-tabla td.num { text-align: right; white-space: nowrap; }
.ac-tabla tr:last-child td { border-bottom: 0; }
.ac-tabla tr.clic { cursor: pointer; }
.ac-tabla tr.clic:hover td, .ac-tabla tr.clic:focus-visible td { background: var(--surface-3); outline: none; }
.ac-tabla tr.grupo td { background: var(--surface-2); font-weight: 800; }
.ac-tabla tr.sub td:first-child { padding-left: 1.5rem; }
.ac-tabla-pie { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; font-size: .78rem; color: var(--ink-2); gap: .5rem; flex-wrap: wrap; }
.ac-paginas { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.ac-celda-prop { max-width: 380px; }
.ac-celda-prop b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-celda-prop span { font-size: .72rem; color: var(--ink-3); }
.ac-mini { font-size: .72rem; color: var(--ink-3); }
.ac-barra-celda { display: flex; align-items: center; gap: .4rem; justify-content: flex-end; }
.ac-barra-celda span.b { display: inline-block; height: 6px; border-radius: 3px; background: var(--s-ganada); }

.ac-estado { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.ac-estado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--k); }
.ac-estado.A { --k: var(--s-ganada); background: color-mix(in srgb, var(--s-ganada) 13%, transparent); }
.ac-estado.R { --k: var(--s-perdida); background: color-mix(in srgb, var(--s-perdida) 13%, transparent); }
.ac-estado.E { --k: var(--s-abierta); background: color-mix(in srgb, var(--s-abierta) 13%, transparent); }
.ac-estado.S { --k: var(--s-cotizado); background: color-mix(in srgb, var(--s-cotizado) 16%, transparent); }
.ac-estado.N { --k: var(--s-nocot); background: var(--surface-3); }
.ac-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; padding: .05rem .5rem; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.ac-chip.alerta { background: var(--serious-bg); color: var(--serious-txt); font-weight: 700; }
.ac-chip.crit { background: var(--crit-bg); color: var(--crit-txt); font-weight: 700; }
.ac-chip.bien { background: var(--ok-bg); color: var(--ok-txt); font-weight: 700; }
.ac-chip.marca { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }

.ac-chips-filtro { display: flex; gap: .35rem; flex-wrap: wrap; }
.ac-chips-filtro button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: .25rem .7rem; font-size: .78rem; font-weight: 700; cursor: pointer; color: var(--ink-2); display: inline-flex; gap: .35rem; align-items: center; }
.ac-chips-filtro button.activo { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand-ink); }
.ac-chips-filtro .n { font-weight: 500; opacity: .8; }

/* ───────────── Seguimiento ───────────── */
.ac-alertas { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.ac-alerta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); box-shadow: var(--sombra); padding: .9rem 1rem; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: .2rem; }
.ac-alerta:hover { border-color: var(--brand-2); }
.ac-alerta.activo { outline: 2px solid var(--brand-2); }
.ac-alerta .ico { font-size: 1.1rem; }
.ac-alerta.crit .ico { color: var(--crit-txt); }
.ac-alerta.warn .ico { color: var(--warn-txt); }
.ac-alerta.info .ico { color: var(--brand-ink); }
.ac-alerta .v { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.ac-alerta .t { font-size: .82rem; font-weight: 700; }
.ac-alerta .s { font-size: .74rem; color: var(--ink-2); }

/* ───────────── Calidad de datos ───────────── */
.ac-calidad { display: flex; flex-direction: column; gap: .5rem; }
.ac-control { display: grid; grid-template-columns: 34px 1fr auto; gap: .75rem; align-items: center; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.ac-control .ico { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.ac-control.crit .ico { background: var(--crit-bg); color: var(--crit-txt); }
.ac-control.warn .ico { background: var(--warn-bg); color: var(--warn-txt); }
.ac-control.ok .ico { background: var(--ok-bg); color: var(--ok-txt); }
.ac-control.info .ico { background: var(--brand-soft); color: var(--brand-ink); }
.ac-control h3 { margin: 0; font-size: .88rem; }
.ac-control p { margin: .1rem 0 0; font-size: .78rem; color: var(--ink-2); }
.ac-control .cnt { font-weight: 800; font-size: 1.1rem; text-align: right; }
.ac-control .cnt small { display: block; font-size: .7rem; color: var(--ink-3); font-weight: 600; }
.ac-control .ac-btn { margin-top: .3rem; }

/* ───────────── Panel lateral ───────────── */
.ac-velo { position: fixed; inset: 0; background: rgba(8, 20, 24, .38); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.ac-velo.abierto { opacity: 1; pointer-events: auto; }
.ac-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 60;
  box-shadow: var(--sombra-2); transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.ac-panel.abierto { transform: none; }
.ac-panel-cab { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; gap: .75rem; align-items: flex-start; }
.ac-panel-cab h2 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.ac-panel-cab .ac-mini { margin-top: .2rem; }
.ac-panel-cerrar { margin-left: auto; border: 0; background: var(--surface-3); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; flex-shrink: 0; }
.ac-panel-cuerpo { padding: 1rem 1.2rem 2rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.ac-panel-bloque { display: flex; flex-direction: column; gap: 1rem; align-items: stretch; }
.ac-panel-bloque > a.ac-btn { align-self: flex-start; }
a.ac-btn { text-decoration: none; }
.ac-datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
.ac-dato { min-width: 0; }
.ac-dato .k { font-size: .7rem; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.ac-dato .v { font-size: .88rem; overflow-wrap: anywhere; }
.ac-seccion h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 0 0 .4rem; }
.ac-notas { white-space: pre-wrap; font-size: .82rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; max-height: 280px; overflow-y: auto; }
.ac-linea-tiempo { display: flex; flex-direction: column; gap: 0; border-left: 2px solid var(--line-2); margin-left: .4rem; }
.ac-hito { position: relative; padding: .15rem 0 .55rem 1rem; font-size: .82rem; }
.ac-hito::before { content: ''; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--k, var(--line-2)); border: 2px solid var(--surface); }
.ac-hito .f { font-size: .72rem; color: var(--ink-3); }
.ac-form { display: grid; gap: .5rem; }
.ac-form label { font-size: .72rem; font-weight: 700; color: var(--ink-2); display: flex; flex-direction: column; gap: 3px; }
.ac-form select, .ac-form input, .ac-form textarea { border: 1px solid var(--line-2); border-radius: 9px; padding: .4rem .55rem; background: var(--surface); font-size: .85rem; font-weight: 400; }
.ac-form textarea { min-height: 64px; resize: vertical; }
.ac-form .fila { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ac-mensaje { font-size: .8rem; padding: .45rem .6rem; border-radius: 8px; }
.ac-mensaje.ok { background: var(--ok-bg); color: var(--ok-txt); }
.ac-mensaje.error { background: var(--crit-bg); color: var(--crit-txt); }

/* ───────────── Carga ───────────── */
.ac-cargando { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; padding: 5rem 1rem; color: var(--ink-2); }
.ac-giro { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: ac-giro 0.9s linear infinite; }
@keyframes ac-giro { to { transform: rotate(360deg); } }
.ac-error { background: var(--crit-bg); color: var(--crit-txt); border-radius: 12px; padding: 1rem 1.2rem; }

@media (max-width: 760px) {
  .ac-top, .ac-filtros, main { padding-left: 16px; padding-right: 16px; }
  .ac-tabs { padding-left: 12px; padding-right: 12px; }
  .ac-kpis { grid-template-columns: 1fr 1fr; }
  .ac-kpi.heroe { grid-column: span 2; grid-row: auto; }
  .ac-kpi.heroe .ac-kpi-valor { font-size: 2.4rem; }
  .ac-rango { margin-left: 0; text-align: left; width: 100%; }
  .ac-filtro select, .ac-filtro input { max-width: 44vw; }
  .ac-filtro .cliente { width: 44vw; }
  .ac-hbar-fila, .ac-s100-fila { grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) auto; }
  .ac-datos { grid-template-columns: 1fr; }
  .ac-top-acciones { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .ac-filtros, .ac-tabs, .ac-top-acciones, .ac-card-acc, .ac-tabla-barra, .ac-paginas { display: none !important; }
  body { background: #fff; }
  .ac-card, .ac-kpi { box-shadow: none; break-inside: avoid; }
}


/* ───────────── Piezas de appRentabilidad que se reutilizan ───────────── */
:root { --s-costo: #eb6834; --s-facturado: #00809c; --s-programado: #5fb0c2; --s-hh: #2a78d6; --s-caja: #eda100; --s-adm: #4a3aa7; --s-admg: #e87ba4; }
:root[data-theme="dark"] { --s-costo: #d95926; --s-facturado: #159ab0; --s-programado: #2f6f7e; --s-hh: #3987e5; --s-caja: #c98500; --s-adm: #7d6fe3; --s-admg: #d55181; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s-costo: #d95926; --s-facturado: #159ab0; --s-programado: #2f6f7e; --s-hh: #3987e5; --s-caja: #c98500; --s-adm: #7d6fe3; --s-admg: #d55181; } }
.rt-neg { color: var(--crit-txt); }
.rt-pos { color: var(--ok-txt); }
.rt-mes { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; padding: .08rem .5rem; border-radius: 999px; white-space: nowrap; }
.rt-mes i { font-size: .7rem; }
.rt-mes.cerrado { background: var(--ok-bg); color: var(--ok-txt); }
.rt-mes.provisional { background: var(--warn-bg); color: var(--warn-txt); }
.rt-mes.estimado { background: var(--serious-bg); color: var(--serious-txt); }
.rt-mes.futuro { background: var(--brand-soft); color: var(--brand-ink); }
.rt-mes.sin_fecha { background: var(--surface-3); color: var(--ink-2); }
.rt-meses { display: flex; flex-wrap: wrap; gap: .3rem; }
.rt-senal { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem .95rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sombra); font-size: .84rem; }
.rt-senal i { font-size: 1.25rem; line-height: 1.1; }
.rt-senal.ok i { color: var(--ok-txt); }
.rt-senal.warn i { color: var(--warn-txt); }
.rt-senal.crit i { color: var(--crit-txt); }
.rt-senal b { font-weight: 800; }
.rt-senal .rt-meses { margin-top: .35rem; }
.rt-volver { border: 0; background: none; color: var(--brand-ink); font-weight: 700; cursor: pointer; padding: 0; display: inline-flex; gap: .35rem; align-items: center; font-size: .85rem; }
.rt-cab-proy { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.rt-cab-proy h2 { margin: .15rem 0 .1rem; font-size: 1.25rem; font-weight: 800; }
.rt-cab-proy .rt-nombre { color: var(--ink-2); font-size: .88rem; max-width: 760px; }
.rt-cab-proy .rt-chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .45rem; }
.rt-cab-proy .rt-acc { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.rt-segmento { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; background: var(--surface); }
.rt-segmento button { border: 0; background: transparent; font-size: .78rem; font-weight: 700; padding: .25rem .75rem; border-radius: 999px; cursor: pointer; color: var(--ink-2); }
.rt-segmento button.activo { background: var(--brand); color: #fff; }
.rt-segmento button:disabled { opacity: .45; cursor: default; }
.rt-codigo { min-width: 220px; max-width: 360px; }
.rt-codigo > b { display: block; font-weight: 700; white-space: nowrap; }
.rt-codigo > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: .74rem; color: var(--ink-2); line-height: 1.3; margin-top: .1rem; }
.rt-codigo > .rt-meses { margin-top: .3rem; }
.rt-meses.compacta { flex-wrap: nowrap; }
.rt-meses.compacta .rt-mes { padding: .05rem .35rem; }
.ac-tabla tr.rt-futuro td { color: var(--ink-2); background: var(--surface-2); }
.ac-tabla tr.rt-total td { font-weight: 800; background: var(--surface-2); }
.rt-ayuda-lista { margin: .2rem 0 0; padding-left: 1.1rem; font-size: .84rem; color: var(--ink-1); }
.rt-ayuda-lista li { margin: .25rem 0; }
.rt-metodo h3 { font-size: .95rem; margin: 1rem 0 .3rem; }
.rt-metodo p, .rt-metodo li { font-size: .86rem; }
.rt-formula { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; font-size: .86rem; }
.rt-filtro-check { display: flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); padding-bottom: .4rem; cursor: pointer; }
.rt-filtro-check input { accent-color: var(--brand); }
.rt-prueba-ok { color: var(--ok-txt); font-weight: 800; }
.rt-prueba-mal { color: var(--crit-txt); font-weight: 800; }

/* Buscador de proyectos en la ficha */
.rt-buscador { position: relative; max-width: 560px; }
.rt-buscador .ac-buscar { max-width: none; }
.rt-resultados { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: var(--sombra-2); max-height: 380px; overflow-y: auto; padding: .25rem; }
.rt-res { display: flex; width: 100%; gap: .6rem; align-items: center; justify-content: space-between; text-align: left; border: 0; background: none;
  padding: .45rem .6rem; border-radius: 8px; cursor: pointer; }
.rt-res b { display: block; font-weight: 700; font-size: .86rem; }
.rt-res span { display: block; font-size: .74rem; color: var(--ink-2); }
.rt-res:hover, .rt-res.activo { background: var(--surface-3); }
.rt-res.actual b::after { content: ' (abierto)'; font-weight: 500; color: var(--ink-3); }
.rt-res .rt-meses { flex-shrink: 0; }
.rt-res-vacio { padding: .6rem; font-size: .82rem; color: var(--ink-3); }

/* Franja de resultado en el gráfico acumulado */
.rt-banda { stroke: none; pointer-events: none; }
.rt-banda.pos { fill: var(--ok); opacity: .13; }
.rt-banda.neg { fill: var(--crit); opacity: .16; }
.rt-graf-pie { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.rt-graf-res { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: 999px; font-size: .8rem; }
.rt-graf-res.pos { background: var(--ok-bg); color: var(--ok-txt); }
.rt-graf-res.neg { background: var(--crit-bg); color: var(--crit-txt); }

/* Cómo se calcula: índice y tablas */
.rt-indice { columns: 2; column-gap: 2rem; margin: .4rem 0 1rem; padding-left: 1.3rem; font-size: .86rem; }
.rt-indice a { color: var(--brand-ink, var(--brand)); text-decoration: none; cursor: pointer; }
.rt-indice a:hover { text-decoration: underline; }
.rt-metodo h3 { scroll-margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.rt-metodo .rt-formula { margin: .4rem 0; }
.rt-tabla-metodo { overflow-x: auto; margin: .5rem 0 .8rem; }
.rt-tabla-metodo table { border-collapse: collapse; width: 100%; font-size: .82rem; }
.rt-tabla-metodo th { text-align: left; background: var(--surface-2); color: var(--ink-2); font-weight: 600; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
.rt-tabla-metodo td { padding: .4rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-1); }
@media (max-width: 700px) { .rt-indice { columns: 1; } }

/* Revisión del mes (perfil 1) */
.ac-panel.ancho { width: min(1060px, 100vw); }
.rt-rev-cab { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.rt-rev-cab > .ac-btn { margin-left: auto; }
.rt-rev-sello { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 600; padding: .25rem .65rem; border-radius: 999px; }
.rt-rev-sello.ok { background: var(--ok-bg); color: var(--ok-txt); }
.rt-rev-sello.mal { background: var(--crit-bg); color: var(--crit-txt); }
.rt-ok { color: var(--ok); }
.rt-mal { color: var(--crit); }
.rt-rev-nota { display: flex; gap: .45rem; align-items: flex-start; font-size: .84rem; color: var(--ink-2); }
.rt-rev-estado { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; font-size: .86rem; }
.rt-rev-sec { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rt-rev-sec > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1rem 10rem 11rem 1fr 1.3rem; align-items: center; gap: .6rem; padding: .7rem .9rem; font-size: .88rem; }
.rt-rev-sec > summary::-webkit-details-marker { display: none; }
.rt-rev-sec > summary:hover { background: var(--surface-2); border-radius: 12px; }
.rt-rev-flecha { transition: transform .15s; color: var(--ink-3); }
.rt-rev-sec[open] > summary .rt-rev-flecha { transform: rotate(90deg); }
.rt-rev-tit { font-weight: 700; }
.rt-rev-monto { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-rev-res { color: var(--ink-2); font-size: .82rem; }
.rt-rev-chk { text-align: right; }
.rt-rev-cuerpo { padding: .1rem .9rem .9rem; display: flex; flex-direction: column; gap: .55rem; }
.rt-rev-cuerpo h4 { font-size: .84rem; margin: .5rem 0 0; }
.rt-rev-cuerpo .rt-formula { font-size: .82rem; }
.rt-rev-bolsa { font-size: .84rem; display: flex; flex-direction: column; gap: .15rem; }
.rt-rev-tabla { margin: 0; max-height: 520px; overflow: auto; }
.rt-rev-tabla th { position: sticky; top: 0; z-index: 1; }
.rt-rev-tabla td.num, .rt-rev-tabla th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rt-rev-tabla tr.rt-total td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line-2); }
.rt-rev-cel > b { display: block; font-weight: 600; }
.rt-rev-cel > span { display: block; font-size: .74rem; color: var(--ink-3); max-width: 420px; }
.rt-rev-mas { align-self: flex-start; }
.rt-rev-total { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem .9rem; border: 1px dashed var(--line-2); border-radius: 12px; font-size: .86rem; }
.rt-rev-total b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-rev-ctl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; font-size: .84rem; }
.rt-rev-ctl li { display: flex; gap: .5rem; align-items: flex-start; }
.rt-rev-ctl li small { display: block; color: var(--ink-3); font-size: .76rem; }
.rt-rev-ctl li.mal span { color: var(--crit-txt); font-weight: 600; }
@media (max-width: 760px) {
  .rt-rev-sec > summary { grid-template-columns: 1rem 1fr auto 1.3rem; }
  .rt-rev-res { grid-column: 2 / -1; }
}
.rt-rev-tabla td.nw, .rt-rev-tabla td.nw .rt-rev-cel > b { white-space: nowrap; }
.rt-kpi-nota { font-size: .74rem; color: var(--ink-3); margin-top: .2rem; line-height: 1.35; }

/* ───────────── Propio de EBITDA ─────────────
 * Puente y desvíos: par divergente azul (sube / sobre el plan) ↔ rojo (baja / bajo el plan), validado con el validador de
 * paletas en ambos modos (CVD ΔE 21,6 claro / 19,2 oscuro). Totales del puente en tinta neutra (7,1:1 y 9,6:1).
 */
:root { --div-pos: #2a78d6; --div-neg: #e34948; --eb-total: #4d5a60; }
:root[data-theme="dark"] { --div-pos: #3987e5; --div-neg: #e66767; --eb-total: #b9c3c7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --div-pos: #3987e5; --div-neg: #e66767; --eb-total: #b9c3c7; } }

/* Estado de cada mes (con ícono y texto) */
.eb-mes { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 700; padding: .08rem .5rem; border-radius: 999px; white-space: nowrap; }
.eb-mes i { font-size: .7rem; }
.eb-mes.cerrado { background: var(--ok-bg); color: var(--ok-txt); }
.eb-mes.en_cierre { background: var(--warn-bg); color: var(--warn-txt); }
.eb-mes.en_curso { background: var(--serious-bg); color: var(--serious-txt); }
.eb-mes.futuro { background: var(--surface-3); color: var(--ink-3); }

.eb-kpi-delta { display: flex; align-items: center; gap: .1rem; flex-wrap: wrap; }
.ac-kpi .rt-neg { color: var(--crit-txt); }
.ac-grupo.ac-atenuada .ac-marca { opacity: .42; }
.eb-conector { stroke: var(--ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.eb-cascada-valor { font-size: 11px; font-weight: 700; fill: var(--ink-1); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.ac-hbar-pista { position: relative; }
.eb-hbar-cero { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1px solid var(--line-2); }
.ac-hbar-barra { top: 0; }
.ac-hbar-barra.neg { border-radius: 4px 0 0 4px; }
.eb-celda-area { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ac-tabla tr.eb-conc td { color: var(--ink-2); background: var(--surface-2); }
.ac-tabla tr.eb-conc.fuerte td { font-weight: 800; color: var(--ink-1); border-top: 2px solid var(--line-2); }
.ac-tabla tr.rt-total td { border-top: 2px solid var(--line-2); }
.eb-segmento-linea { margin-bottom: .1rem; }
.eb-subtitulo { font-size: .82rem; margin: .9rem 0 .4rem; color: var(--ink-2); }
.eb-sumas { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* Matriz mes a mes */
.eb-matriz-env { margin-top: .7rem; }
.eb-matriz th, .eb-matriz td { padding: .35rem .45rem; }
.eb-matriz th { padding: .45rem .45rem; font-size: .7rem; color: var(--ink-2); }
.eb-matriz th:first-child { min-width: 190px; }
.eb-matriz td.eb-celda.clic { cursor: pointer; }
.eb-matriz td.eb-celda.clic:hover, .eb-matriz td.eb-celda.clic:focus-visible { box-shadow: inset 0 0 0 2px var(--ink-1); outline: none; }
.eb-matriz td.eb-fuera-periodo { opacity: .5; }
.eb-matriz td.eb-total-periodo { font-weight: 800; background: var(--surface-2); }
.eb-matriz tr.grupo td { background: var(--surface-2); font-weight: 800; }
.eb-matriz tr.sub td:first-child { padding-left: 1.6rem; }
.eb-d-pos1 { background: color-mix(in srgb, var(--div-pos) 14%, transparent); }
.eb-d-pos2 { background: color-mix(in srgb, var(--div-pos) 28%, transparent); }
.eb-d-pos3 { background: color-mix(in srgb, var(--div-pos) 44%, transparent); }
.eb-d-neg1 { background: color-mix(in srgb, var(--div-neg) 14%, transparent); }
.eb-d-neg2 { background: color-mix(in srgb, var(--div-neg) 28%, transparent); }
.eb-d-neg3 { background: color-mix(in srgb, var(--div-neg) 44%, transparent); }
.eb-leyenda-div { display: flex; align-items: center; gap: 3px; font-size: .72rem; color: var(--ink-3); margin-top: .6rem; }
.eb-leyenda-div span:first-child { margin-right: .3rem; }
.eb-leyenda-div span:last-child { margin-left: .3rem; }
.eb-paso { width: 22px; height: 10px; border-radius: 3px; display: inline-block; }
.eb-cero { background: var(--surface-3); }
.eb-expandir { border: 0; background: none; font-weight: 800; cursor: pointer; padding: 0; color: inherit; display: inline-flex; align-items: center; gap: .3rem; text-align: left; }
.eb-expandir:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* Revisión */
.eb-rev-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.eb-rev-dato { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; display: flex; flex-direction: column; gap: .1rem; background: var(--surface); }
.eb-rev-dato span { font-size: .72rem; color: var(--ink-3); font-weight: 600; }
.eb-rev-dato b { font-size: .95rem; font-variant-numeric: tabular-nums; }

/* Informe */
.eb-inf-barra { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.eb-informe { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); padding: 1.2rem 1.4rem; box-shadow: var(--sombra); }
.eb-inf-cab { display: flex; gap: 1rem; align-items: center; border-bottom: 3px solid var(--brand); padding-bottom: .6rem; margin-bottom: .6rem; }
.eb-inf-logo { font-weight: 900; font-size: 1.25rem; color: #fff; background: var(--brand); border-radius: 8px; padding: .3rem .6rem; letter-spacing: .04em; }
.eb-inf-cab h1 { margin: 0; font-size: 1.3rem; }
.eb-inf-sub { font-size: .8rem; color: var(--ink-2); }
.eb-inf-titulo { font-size: .95rem; margin: 1.2rem 0 .5rem; color: var(--brand-ink); text-transform: uppercase; letter-spacing: .03em; }
.eb-inf-env { overflow-x: auto; }
.eb-inf-tabla { width: 100%; border-collapse: collapse; font-size: .76rem; }
.eb-inf-tabla th { background: var(--brand); color: #fff; padding: .4rem .5rem; text-align: left; font-weight: 700; white-space: nowrap; }
.eb-inf-tabla th.num, .eb-inf-tabla td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.eb-inf-tabla td { padding: .28rem .5rem; border-bottom: 1px solid var(--line); }
.eb-inf-tabla td.eb-inf-grupo { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); }
.eb-inf-tabla tr.eb-inf-bloque td { font-weight: 800; background: var(--surface-3); padding-top: .45rem; }
.eb-inf-tabla tr.eb-inf-subtotal td { font-weight: 700; border-top: 1px solid var(--line-2); }
.eb-inf-tabla tr.eb-inf-total td { font-weight: 800; background: var(--brand-soft); color: var(--brand-ink); }
.eb-inf-bien { color: var(--ok-txt); font-weight: 700; }
.eb-inf-mal { color: var(--crit-txt); font-weight: 700; }
.eb-inf-nota { font-size: .72rem; color: var(--ink-3); margin-top: 1rem; }

@media (max-width: 760px) {
  .eb-matriz th:first-child { min-width: 140px; }
  .eb-informe { padding: .8rem; }
}
@media print {
  @page { size: A4 landscape; margin: 9mm; }
  :root, :root[data-theme="dark"] {
    color-scheme: light; --bg: #ffffff; --surface: #ffffff; --surface-2: #f6f8f9; --surface-3: #eef2f4; --ink-1: #14191c; --ink-2: #4d5a60; --ink-3: #87939a;
    --line: #e3e8ea; --line-2: #cfd7da; --brand: #08697e; --brand-ink: #075a6c; --brand-soft: #e3f2f5; --ok-txt: #006300; --crit-txt: #b02a2a;
  }
  .ac-top, .ac-filtros, .ac-tabs, .eb-inf-barra, .ac-panel, .ac-velo { display: none !important; }
  main { padding: 0; }
  body { font-size: 11px; }
  .eb-informe { border: 0; padding: 0; box-shadow: none; }
  .eb-inf-tabla { font-size: 8.4px; }
  .eb-inf-tabla th, .eb-inf-tabla td.eb-inf-grupo, .eb-inf-tabla tr.eb-inf-bloque td, .eb-inf-tabla tr.eb-inf-total td, .eb-inf-logo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .eb-inf-tabla tr { break-inside: avoid; }
  .eb-inf-seccion + .eb-inf-seccion { break-before: page; }
  .eb-informe-vista > :not(.eb-informe) { display: none !important; }
}
@media (max-width: 520px) {
  .ac-kpi-valor { font-size: 1.45rem; }
  .ac-kpi.heroe .ac-kpi-valor { font-size: 2.2rem; }
}
