/* Contafer AaG — núcleo de estilos. Generado por build.mjs, no editar acá. */

/* ==========================================================================
   Contafer · AC Consultores — Design tokens AaG
   Anclado a contafer/brand-guidelines.md (aprobada por C. Aranda, 2026-07-29)
   Primarios: #111111 negro · #FFFFFF blanco · #6B7280 gris
   Apoyo: #0F4C5C azul petróleo · Acento: #B08D57 dorado (nunca dominante)
   Los neutros llevan un sesgo mínimo hacia el petróleo: elegidos, no heredados.
   ========================================================================== */

:root {
  /* --- superficie e ink (claro) --- */
  --paper:      #FFFFFF;
  --canvas:     #F5F7F7;
  --surface:    #FFFFFF;
  --surface-2:  #F0F3F3;
  --surface-3:  #E7ECED;
  --line:       #DFE5E6;
  --line-soft:  #EDF1F1;
  --ink:        #111111;
  --ink-2:      #3A4245;
  --muted:      #6B7280;
  --muted-2:    #8A9296;

  /* --- marca --- */
  --brand:      #0F4C5C;   /* petróleo: apoyo, no dominante */
  --brand-ink:  #0B3B47;
  --brand-soft: #E6EFF1;
  --accent:     #B08D57;   /* dorado: solo para destacar */
  --accent-soft:#F4EEE3;

  /* --- semánticos (reservados: nunca como "serie 4") --- */
  --ok:        #17795A;  --ok-soft:      #E4F1EB;
  --warn:      #A97514;  --warn-soft:    #F6EEDD;
  --serious:   #B4551F;  --serious-soft: #F8EAE0;
  --crit:      #A32E28;  --crit-soft:    #F7E5E3;
  --neutral-soft: #ECEFF0;

  /* --- series categóricas (validadas: banda L, croma, CVD, contraste) --- */
  --c1: #0080A0; --c2: #C2871B; --c3: #1C8C5B;
  --c4: #8B4C9C; --c5: #BE4436; --c6: #5566C4;
  --grid: #E7ECED;
  --seq-1: #DCE9ED; --seq-2: #A9C9D3; --seq-3: #6BA5B5;
  --seq-4: #2E7F95; --seq-5: #0F4C5C;

  /* --- forma --- */
  --r-sm: 4px; --r: 7px; --r-lg: 11px; --r-pill: 999px;
  --shadow-pop: 0 8px 28px rgba(17, 17, 17, .13), 0 1px 2px rgba(17, 17, 17, .08);
  --shadow-card: 0 1px 0 rgba(17, 17, 17, .03);

  /* --- tipografía: una sola familia sans, tres roles por peso/espaciado --- */
  --font: "Inter", "Manrope", "Segoe UI Variable Text", "Segoe UI",
          "Helvetica Neue", Helvetica, Arial, sans-serif;
  --fs-display: clamp(1.5rem, 1.15rem + 1.1vw, 2rem);
  --fs-h2: 1.14rem; --fs-h3: .97rem;
  --fs-body: .9rem; --fs-sm: .82rem; --fs-xs: .74rem; --fs-label: .68rem;

  /* --- ritmo --- */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --rail: 208px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0E1315;
    --canvas:     #0E1315;
    --surface:    #161C1F;
    --surface-2:  #1C2427;
    --surface-3:  #242D31;
    --line:       #2A3438;
    --line-soft:  #202A2D;
    --ink:        #ECF1F1;
    --ink-2:      #C7D1D3;
    --muted:      #93A1A4;
    --muted-2:    #78878B;

    --brand:      #3E93A8;
    --brand-ink:  #7FBECE;
    --brand-soft: #14313A;
    --accent:     #C7A473;
    --accent-soft:#2C2519;

    --ok:      #3FAE84;  --ok-soft:      #122E26;
    --warn:    #D2A03F;  --warn-soft:    #2E2616;
    --serious: #DE8248;  --serious-soft: #322115;
    --crit:    #E0685E;  --crit-soft:    #341A19;
    --neutral-soft: #222A2D;

    --c1: #2BA3C2; --c2: #BC8B30; --c3: #2C9767;
    --c4: #AE72C0; --c5: #D05C4A; --c6: #7D8DE3;
    --grid: #263034;
    --seq-1: #17323A; --seq-2: #1F4E5C; --seq-3: #2E7C93;
    --seq-4: #49A3B9; --seq-5: #7FC5D5;

    --shadow-pop: 0 10px 34px rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-card: 0 1px 0 rgba(0, 0, 0, .18);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper:      #0E1315;
  --canvas:     #0E1315;
  --surface:    #161C1F;
  --surface-2:  #1C2427;
  --surface-3:  #242D31;
  --line:       #2A3438;
  --line-soft:  #202A2D;
  --ink:        #ECF1F1;
  --ink-2:      #C7D1D3;
  --muted:      #93A1A4;
  --muted-2:    #78878B;

  --brand:      #3E93A8;
  --brand-ink:  #7FBECE;
  --brand-soft: #14313A;
  --accent:     #C7A473;
  --accent-soft:#2C2519;

  --ok:      #3FAE84;  --ok-soft:      #122E26;
  --warn:    #D2A03F;  --warn-soft:    #2E2616;
  --serious: #DE8248;  --serious-soft: #322115;
  --crit:    #E0685E;  --crit-soft:    #341A19;
  --neutral-soft: #222A2D;

  --c1: #2BA3C2; --c2: #BC8B30; --c3: #2C9767;
  --c4: #AE72C0; --c5: #D05C4A; --c6: #7D8DE3;
  --grid: #263034;
  --seq-1: #17323A; --seq-2: #1F4E5C; --seq-3: #2E7C93;
  --seq-4: #49A3B9; --seq-5: #7FC5D5;

  --shadow-pop: 0 10px 34px rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-card: 0 1px 0 rgba(0, 0, 0, .18);
  color-scheme: dark;
}


/* ==========================================================================
   Contafer AaG — componentes base. Todo se estiliza vía tokens, nunca con
   literales de color, para que ambos temas resuelvan como un set completo.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; letter-spacing: -.012em; }
h1 { font-size: var(--fs-display); letter-spacing: -.022em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p  { margin: 0; }
a  { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-soft); color: var(--ink); }

/* --- rol tipográfico "utilidad": etiquetas, ejes, encabezados de tabla --- */
.label {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 600;
  color: var(--muted);
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono-ish { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--muted); }
.tiny { font-size: var(--fs-xs); }
.sm { font-size: var(--fs-sm); }
.strong { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.grow { flex: 1 1 auto; min-width: 0; }
.wrap { flex-wrap: wrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================ shell de aplicación ======================== */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 10px var(--sp-5);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brandmark { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brandmark .glyph {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--brand); color: var(--paper);
  display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; letter-spacing: -.02em;
}
.brandmark .wordmark { font-weight: 650; letter-spacing: -.02em; font-size: .95rem; }
.topbar > .sub {
  font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); border-left: 1px solid var(--line); padding-left: 10px;
  flex: 0 0 auto; margin-left: -6px;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
a.brandmark { text-decoration: none; color: inherit; }
a.brandmark:hover .wordmark { color: var(--brand); }

/* ---- menú de módulos: índice de enlaces, no un router ---- */
.nav-wrap { position: relative; flex: 0 0 auto; }
.nav-btn { gap: 7px; padding-right: 8px; }
.nav-btn-ico { display: inline-flex; color: var(--brand); }
.nav-btn[aria-expanded="true"] .nav-btn-ico { color: inherit; }
.nav-btn-t { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-chevron { display: inline-flex; color: var(--muted); transition: transform .15s ease; }
.nav-btn[aria-expanded="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.nav-btn[aria-expanded="true"] .nav-chevron { transform: rotate(180deg); }

.nav-pop {
  position: absolute; top: calc(100% + 7px); left: 0; z-index: 50;
  width: min(452px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.nav-pop-head { padding: 10px var(--sp-4) 8px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: baseline; gap: var(--sp-3); }
.nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: var(--sp-2); }
.nav-item {
  display: grid; grid-template-columns: 22px 1fr; gap: 9px; align-items: center;
  padding: 8px 9px; border-radius: var(--r); text-decoration: none; color: inherit;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.aqui { background: var(--brand-soft); cursor: default; }
.nav-item.aqui .nav-t { color: var(--brand-ink); }
.nav-ico { display: inline-flex; justify-content: center; color: var(--muted); }
.nav-item:hover .nav-ico { color: var(--ink-2); }
.nav-item.aqui .nav-ico { color: var(--brand); }
.nav-t { font-size: var(--fs-sm); font-weight: 550; }
.nav-s { font-size: var(--fs-xs); color: var(--muted); }

@media (max-width: 640px) {
  .nav-grid { grid-template-columns: 1fr; }
  .nav-btn-t { display: none; }
  .topbar > .sub { display: none; }
}

/* ---- presentador: la explicación hablada, con transcripción ---- */
.presentador {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-4);
  align-items: center; padding: 13px var(--sp-4);
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--r-lg);
}
.pres-play {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto;
  border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--brand); color: #FFFFFF;
  transition: transform .12s ease, background .12s ease;
}
.pres-play:hover { background: var(--brand-ink); transform: scale(1.04); }
.pres-play svg { display: block; }
.pres-quien { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .09em; color: var(--accent); font-weight: 650; }
.pres-t { font-size: var(--fs-sm); font-weight: 550; }
.pres-s { font-size: var(--fs-xs); color: var(--muted); }
.pres-barra { height: 3px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; margin-top: 7px; }
.pres-barra > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: var(--r-pill); }
.pres-acciones { display: flex; align-items: center; gap: var(--sp-2); }
/* Sin audio disponible: queda la explicación escrita, sin botón muerto. */
.pres-sin-audio .pres-play,
.pres-sin-audio .pres-barra { display: none; }
.pres-sin-audio .presentador { grid-template-columns: 1fr; }
.pres-texto {
  margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft);
  font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-2); max-width: 78ch;
}
.pres-texto p + p { margin-top: 9px; }
@media (max-width: 680px) {
  .presentador { grid-template-columns: auto 1fr; }
  .pres-acciones { grid-column: 1 / -1; justify-content: flex-end; }
}

.page { flex: 1 1 auto; padding: var(--sp-5); max-width: 1560px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.page-head .lede { color: var(--muted); font-size: var(--fs-sm); max-width: 68ch; }

/* ================================ controles ============================== */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  font: inherit; font-size: var(--fs-sm); font-weight: 550;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn[aria-pressed="true"], .btn.is-active {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink);
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: #FFFFFF; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #FFFFFF; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 3px 8px; font-size: var(--fs-xs); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.field {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 0 9px;
}
.field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field svg { flex: 0 0 auto; color: var(--muted); }
.field input, .field select {
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: var(--fs-sm); padding: 6px 0; width: 100%; min-width: 0;
}
.field input:focus, .field select:focus { outline: none; }
.field input::placeholder { color: var(--muted-2); }
.search-wide { flex: 1 1 340px; max-width: 520px; }

select.plain {
  font: inherit; font-size: var(--fs-sm); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 6px 9px; cursor: pointer;
}

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button {
  font: inherit; font-size: var(--fs-xs); font-weight: 550;
  padding: 4px 10px; border: 0; border-radius: 5px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

/* ============================== superficies ============================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 12px var(--sp-4); border-bottom: 1px solid var(--line-soft);
}
.card-body { padding: var(--sp-4); }
.card-body.tight { padding: var(--sp-3); }

.grid { display: grid; gap: var(--sp-3); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }

/* ---- stat tile: resumen antes que detalle ---- */
.tile {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 13px var(--sp-4) 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.tile::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--stripe, transparent);
}
.tile .tile-k { font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .09em; font-weight: 600; color: var(--muted); }
.tile .tile-v { font-size: 1.65rem; font-weight: 620; letter-spacing: -.028em; font-variant-numeric: tabular-nums; line-height: 1.12; }
.tile .tile-sub { font-size: var(--fs-xs); color: var(--muted); }
.tile .tile-spark { margin-top: 4px; }

/* ---- chips / pills de estado: la forma también codifica el estado ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 560; white-space: nowrap;
  background: var(--neutral-soft); color: var(--ink-2);
  border: 1px solid transparent;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.chip-ok      { background: var(--ok-soft);      color: var(--ok); }
.chip-warn    { background: var(--warn-soft);    color: var(--warn); }
.chip-serious { background: var(--serious-soft); color: var(--serious); }
.chip-crit    { background: var(--crit-soft);    color: var(--crit); }
.chip-brand   { background: var(--brand-soft);   color: var(--brand-ink); }
.chip-accent  { background: var(--accent-soft);  color: var(--accent); }
.chip-outline { background: transparent; border-color: var(--line); color: var(--muted); }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: -.01em;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--line);
}
.avatar-sm { width: 21px; height: 21px; font-size: .62rem; }

/* ================================ tablas ================================= */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th {
  text-align: left; font-size: var(--fs-label); text-transform: uppercase;
  letter-spacing: .09em; font-weight: 600; color: var(--muted);
  padding: 8px var(--sp-3); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
  white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink); }
table.data td { padding: 8px var(--sp-3); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.is-selected { background: var(--brand-soft); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.clickable { cursor: pointer; }

/* =============================== drawer ================================== */

.scrim {
  position: fixed; inset: 0; background: rgba(6, 12, 14, .42);
  opacity: 0; pointer-events: none; transition: opacity .18s ease; z-index: 60;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop); z-index: 61;
  transform: translateX(100%); transition: transform .22s cubic-bezier(.32, .72, 0, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { padding: var(--sp-4); border-bottom: 1px solid var(--line); display: flex; gap: var(--sp-3); align-items: flex-start; }
.drawer-body { padding: var(--sp-4); overflow-y: auto; flex: 1 1 auto; }
.drawer-foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* =============================== varios ================================== */

.kv { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 6px var(--sp-3); align-items: baseline; }
.kv dt { font-size: var(--fs-xs); color: var(--muted); }
.kv dd { margin: 0; font-size: var(--fs-sm); }

.divider { height: 1px; background: var(--line); border: 0; margin: var(--sp-4) 0; }

.meter { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--brand); }

.empty {
  padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--muted);
  font-size: var(--fs-sm); border: 1px dashed var(--line); border-radius: var(--r-lg);
}

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--muted); }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }

.tooltip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: 8px 10px;
  font-size: var(--fs-xs); max-width: 260px; opacity: 0;
  transition: opacity .1s ease;
}
.tooltip.show { opacity: 1; }
.tooltip .t-title { font-weight: 620; margin-bottom: 3px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: var(--sp-4); font-variant-numeric: tabular-nums; }

.toast-host { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: var(--paper);
  padding: 8px 14px; border-radius: var(--r-pill); font-size: var(--fs-sm);
  box-shadow: var(--shadow-pop); animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pegado {
  width: 100%; font: inherit; font-size: var(--fs-xs); line-height: 1.45;
  padding: 10px 11px; border-radius: var(--r); resize: vertical;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  white-space: pre; overflow-x: auto;
}
.pegado:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.demo-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .09em;
  font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--r-pill); padding: 3px 9px;
}

footer.foot {
  padding: var(--sp-5); border-top: 1px solid var(--line);
  color: var(--muted); font-size: var(--fs-xs);
  display: flex; gap: var(--sp-4); flex-wrap: wrap; align-items: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 720px) {
  .page { padding: var(--sp-3); }
  .topbar { padding: 9px var(--sp-3); gap: var(--sp-2); }
}


/* ==========================================================================
   Contafer AaG — anatomía de gráficos
   Marcas delgadas, extremos redondeados 4px, 2px de aire entre rellenos,
   grilla recesiva. Los textos usan tinta, nunca el color de la serie.
   ========================================================================== */

.chart { position: relative; }
.chart-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.chart-head h3 { font-size: var(--fs-h3); }
.chart-head .note { font-size: var(--fs-xs); color: var(--muted); }
.chart-head .spacer { flex: 1 1 auto; }

/* ---- barras horizontales ---- */
.bar-row {
  display: grid;
  grid-template-columns: minmax(88px, 148px) 1fr minmax(52px, auto);
  align-items: center; gap: var(--sp-3);
  font-size: var(--fs-sm); cursor: default;
}
.bar-label { color: var(--ink-2); }
.bar-track { background: var(--surface-2); border-radius: var(--r-sm); overflow: hidden; }
.bar-fill {
  border-radius: 0 4px 4px 0;   /* extremo de dato redondeado, base anclada */
  min-width: 3px;
  transition: width .3s cubic-bezier(.32, .72, 0, 1);
}
.bar-value { text-align: right; color: var(--ink); font-weight: 560; }

/* ---- apiladas verticales ---- */
.stack-chart { display: flex; align-items: flex-end; gap: var(--sp-3); width: 100%; }
.stack-col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.stack-total { color: var(--muted); text-align: center; }
.stack-bar { display: flex; flex-direction: column-reverse; gap: 2px; min-height: 2px; }
.stack-seg { border-radius: 2px; min-height: 3px; cursor: default; }
.stack-seg:last-child { border-radius: 4px 4px 2px 2px; }
.stack-cat { color: var(--muted); text-align: center; }

/* ---- embudo del ciclo: una secuencia real, por eso va numerada ---- */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-step {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center;
  gap: var(--sp-3); padding: 5px 0; cursor: pointer;
  border: 0; background: transparent; font: inherit; text-align: left; color: inherit;
  border-radius: var(--r);
}
.funnel-step:hover { background: var(--surface-2); }
.funnel-step .step-n {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .62rem; font-weight: 650;
  background: var(--surface-3); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.funnel-step[aria-pressed="true"] .step-n { background: var(--brand); color: #FFFFFF; }
.funnel-step .step-body { min-width: 0; }
.funnel-step .step-label { font-size: var(--fs-sm); }
.funnel-step .step-bar { height: 5px; border-radius: var(--r-pill); background: var(--surface-2); margin-top: 4px; overflow: hidden; }
.funnel-step .step-bar > span { display: block; height: 100%; border-radius: var(--r-pill); }
.funnel-step .step-n-val { font-variant-numeric: tabular-nums; font-weight: 620; font-size: var(--fs-sm); }

/* ---- mini calendario / heat ---- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font-size: var(--fs-label); color: var(--muted); text-align: center; letter-spacing: .06em; text-transform: uppercase; }
.cal .day {
  aspect-ratio: 1 / 1; border-radius: var(--r-sm); border: 1px solid var(--line-soft);
  background: var(--surface); padding: 4px 5px; display: flex; flex-direction: column;
  gap: 2px; font-size: var(--fs-xs); cursor: default; position: relative; overflow: hidden;
}
.cal .day.out { opacity: .35; }
.cal .day.hoy { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal .day .d { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.cal .day .marks { display: flex; flex-wrap: wrap; gap: 2px; }
.cal .day .mark { width: 6px; height: 6px; border-radius: 2px; }
.cal .day.deadline { background: var(--warn-soft); }
.cal .day.deadline.crit { background: var(--crit-soft); }

/* ---- barra de progreso etiquetada ---- */
.progress-row { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); align-items: center; }
.progress-row .meter { grid-column: 1 / -1; }

