/* Copia de /srv/design-skills/_muestras/halden/halden.css del 2026-10-21. NO se edita aquí: un cambio de estilo va a la biblioteca, se mide con verificar-contraste.py y se vuelve a copiar (03-DISENO-UI §3). Único ajuste: fuentes/ → fonts/. */
/* ════════════════════════════════════════════════════════════════════════════════════════════════
   Halden · hoja reutilizable del estilo propio (Arkorion, 2026-10-19). Guía: /srv/design-skills/halden.md
   Referencia: el CRM «Halden» de @_code_and_chill_; colores medidos en el video a resolución completa.

   Contrato:
   - Tokens con los nombres de _sistema-base.md §1.2. El oscuro redefine LOS MISMOS nombres, nunca crea otros.
   - Tema por atributo en <html>: data-tema="claro|oscuro" (convención de la casa) o data-theme="light|dark".
   - Compatible con una CSP sin 'unsafe-inline': ninguna pieza necesita style="…". Las barras son <progress> o
     <meter>, las gráficas son SVG con atributos, y lo dinámico se pone desde JS con el.style.prop = valor.
   - Un proyecto la COPIA con fecha (no la enlaza): esta es la fuente de verdad de la biblioteca.
   ════════════════════════════════════════════════════════════════════════════════════════════════ */

/* ── 0. Letra: Manrope variable 200-800 (OFL 1.1, en fuentes/). Al copiar la hoja, ajustar la ruta. ─────────── */
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/Manrope-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/Manrope-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── 1. Tokens: claro (por omisión) ─────────────────────────────────────────────────────────── */
:root, :root[data-tema="claro"], :root[data-theme="light"] {
  color-scheme: light;
  --primary: #0e6d73;  --secondary: #0b5c61;  --accent: #0b6469;
  --bg: #f1f3f3;  --fg: #101716;  --border: #e0e5e4;  --muted-fg: #5a6866;  --destructive: #c53030;
  --surface: #fcfcfa;  --surface-2: #f4f6f5;  --surface-hundida: #eef1f0;  --border-strong: #cdd6d5;  --sep: #e8ecea;
  --border-control: #7f8c8a;   /* orilla de lo que se captura o se elige: ≥ 3:1 (WCAG 1.4.11) */
  --fg-2: #2c3735;  --on-primary: #ffffff;
  --ok: #17663a;   --ok-bg: #e2f5e9;   --ok-border: #9fd9b5;
  --warn: #765705; --warn-bg: #fbf0d3; --warn-border: #ecd28a;
  --bad: #a32b2b;  --bad-bg: #fbe4e4;  --bad-border: #efb1b1;
  --info: #0b6469; --info-bg: #dcefef; --info-border: #9fcfd1;
  --ring: #0b6469;
  --ring-shadow: 0 0 0 3px rgb(14 109 115 / .16);
  --primary-suave: rgb(14 109 115 / .08);  --primary-borde: rgb(14 109 115 / .28);

  /* Datos: escala de la etapa (más avanzada = más intensa) y la serie principal. Todas ≥ 3:1 sobre --surface. */
  --d1: #4a9a9f; --d2: #3f9096; --d3: #2f8187; --d4: #1f7278; --d5: #0f6369;
  --dato: #2f8f95;  --dato-hoy: #0e5d62;  --pista: #e2ebea;  --serie-antes: #7d8a88;

  /* Tarjeta héroe: degradado con cuadrícula */
  --heroe-a: #bfe3e2; --heroe-b: #dff0ef; --heroe-c: #eef6f5; --heroe-reja: rgb(14 109 115 / .08);
  --heroe-fg: #0d1f20; --heroe-muted: #3d5a5c; --heroe-barra: #0e6d73; --heroe-pista: rgb(14 109 115 / .14);
  --resalte-bg: #e3f1f0; --resalte-border: #c6e2e0;

  --velo: rgb(40 52 50 / .38);
  --sh-card: 0 1px 2px rgb(16 23 22 / .04), 0 8px 24px rgb(16 23 22 / .05);
  --sh-panel: 0 24px 60px rgb(16 23 22 / .18);

  /* Tintes para letras y avatares (fondo + texto) */
  --t0f: #f8ecd3; --t0t: #7a5408; --t1f: #e1ebfa; --t1t: #1f4f94; --t2f: #dcefef; --t2t: #0b6469;
  --t3f: #efe5fa; --t3t: #5b2f91; --t4f: #fbe6e0; --t4t: #9a3a22; --t5f: #e0f4e8; --t5t: #1d6a3f;

  --font-ui: "Manrope", system-ui, sans-serif;
  --t-xs: .75rem; --t-sm: .8125rem; --t-base: .875rem; --t-md: 1rem; --t-lg: 1.125rem; --t-xl: 1.75rem; --t-2xl: 2.25rem;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-12: 48px;
  --r-xs: 6px; --r-sm: 8px; --r-md: 11px; --r-lg: 14px; --r-xl: 18px; --r-pill: 999px;
  --dur-rapido: 120ms; --dur-normal: 180ms; --dur-lento: 280ms; --ease: cubic-bezier(.16, 1, .3, 1);
}

/* ── 1b. Tokens: oscuro (mismos nombres) ────────────────────────────────────────────────────── */
:root[data-tema="oscuro"], :root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #0e6f75;  --secondary: #12808a;  --accent: #6fcbd1;
  --bg: #0b100f;  --fg: #eaf2f1;  --border: #1e2628;  --muted-fg: #8e9e9c;  --destructive: #d64545;
  --surface: #12181a;  --surface-2: #171f21;  --surface-hundida: #0e1415;  --border-strong: #2b3638;  --sep: #1a2224;
  --border-control: #5f6f6d;
  --fg-2: #c3cfcd;  --on-primary: #ffffff;
  --ok: #9fe5bd;   --ok-bg: rgb(74 222 128 / .14);  --ok-border: rgb(74 222 128 / .35);
  --warn: #e8d28a; --warn-bg: rgb(234 179 8 / .14);  --warn-border: rgb(234 179 8 / .35);
  --bad: #f2abab;  --bad-bg: rgb(248 113 113 / .15); --bad-border: rgb(248 113 113 / .4);
  --info: #8fd6db; --info-bg: rgb(83 178 184 / .14); --info-border: rgb(111 203 209 / .35);
  --ring: #6fcbd1;
  --ring-shadow: 0 0 0 3px rgb(83 178 184 / .2);
  --primary-suave: rgb(83 178 184 / .13);  --primary-borde: rgb(111 203 209 / .3);
  --d1: #376e71; --d2: #3f8388; --d3: #48979d; --d4: #52abb1; --d5: #6cc5cb;
  --dato: #53b2b8;  --dato-hoy: #c2e4e5;  --pista: #1d3133;  --serie-antes: #8e9e9c;
  --heroe-a: #0f5a61; --heroe-b: #062a2d; --heroe-c: #08191b; --heroe-reja: rgb(140 209 217 / .07);
  --heroe-fg: #eefafa; --heroe-muted: #b3d1d3; --heroe-barra: #8cd1d9; --heroe-pista: rgb(140 209 217 / .18);
  --resalte-bg: #15282a; --resalte-border: #23403f;
  --velo: rgb(4 8 8 / .6);
  --sh-card: 0 10px 30px rgb(0 0 0 / .28);
  --sh-panel: 0 24px 60px rgb(0 0 0 / .45);
  --t0f: rgb(217 164 65 / .18); --t0t: #e8c47e; --t1f: rgb(91 143 216 / .2); --t1t: #a9c6f0;
  --t2f: rgb(79 179 185 / .18); --t2t: #8fd6db; --t3f: rgb(167 120 220 / .2); --t3t: #cdb1ef;
  --t4f: rgb(224 115 90 / .2); --t4t: #f0ad9b; --t5f: rgb(85 190 128 / .18); --t5t: #9fe0b8;
}

/* ── 2. Base ───────────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
/* Sin rebote de la página con mouse; en el celular se deja el normal (R37). */
@media (pointer: fine) { html { overscroll-behavior: none; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 500 var(--t-base)/1.45 var(--font-ui); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
/* Sin una palabra sola en el último renglón (R21). */
h1, h2, h3 { text-wrap: balance; }
p, dd, li { text-wrap: pretty; }
ul.lista-limpia, ol.lista-limpia { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Con el dedo: sin la espera del doble toque (R34), y el toque se marca con el acento de la casa en vez del recuadro
   gris del navegador (R35). */
a, button, summary, label, select {
  touch-action: manipulation; -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 22%, transparent);
}
svg.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd { display: inline-block; min-width: 22px; padding: 3px 6px; text-align: center; font: 700 .78rem/1.1 var(--font-ui);
  border: 1px solid var(--border-strong); border-radius: var(--r-xs); background: var(--surface-hundida); color: var(--fg-2); }
.vh, .sr-solo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tenue { color: var(--muted-fg); }
[hidden] { display: none !important; }

/* ── 3. Barra de arriba ────────────────────────────────────────────────────────────────────── */
.barra {
  position: sticky; top: 0; z-index: 20; display: grid; align-items: center; gap: 10px 14px;
  grid-template-columns: auto 1fr auto; grid-template-areas: "marca buscar iconos" "menu menu menu";
  padding: 10px 18px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.barra .marca { grid-area: marca; display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: var(--t-md); letter-spacing: -.01em; }
.marca-logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); border: 1.8px solid var(--accent); color: var(--accent); }
.marca-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.franja-marca { height: 4px; background: var(--marca, transparent); }   /* la marca activa se identifica, no pinta la app */
.menu { grid-area: menu; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
.menu::-webkit-scrollbar { display: none; }
/* Cuando las pestañas no caben (celular), la orilla que sigue se desvanece: pista de que se desliza. La clase la
   pone el JS de la barra según dónde va el desplazamiento; sin JS, la barra de siempre. */
.menu.sigue-der { mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.menu.sigue-izq { mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
.menu.sigue-der.sigue-izq { mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
.pestana {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--r-md); color: var(--muted-fg); font-weight: 600;
  transition: color var(--dur-normal), background-color var(--dur-normal), border-color var(--dur-normal);
}
.pestana:hover { color: var(--fg); background: var(--surface); }
.pestana[aria-current="page"] { color: var(--fg); background: var(--surface-2); border-color: var(--border-control); }
.contador { min-width: 22px; padding: 2px 6px; border-radius: var(--r-xs); background: var(--primary); color: var(--on-primary);
  font-size: var(--t-xs); font-weight: 700; line-height: 1.3; text-align: center; }
.buscador {
  grid-area: buscar; justify-self: end; display: flex; align-items: center; gap: 8px; width: min(100%, 300px); height: 40px;
  padding: 0 8px 0 11px; border: 1px solid var(--border-control); border-radius: var(--r-md); background: var(--surface-hundida); color: var(--muted-fg);
}
.buscador:focus-within { border-color: var(--ring); box-shadow: var(--ring-shadow); }
.buscador input { flex: 1; min-width: 0; border: 0; background: none; color: var(--fg); outline: none; }
.buscador input::placeholder { color: var(--muted-fg); }
.barra-iconos { grid-area: iconos; display: flex; align-items: center; gap: 2px; }
.icono {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: var(--r-md); background: none; color: var(--muted-fg); cursor: pointer;
  transition: color var(--dur-normal), background-color var(--dur-normal);
}
.icono:hover { color: var(--fg); background: var(--surface-2); }
.icono-borde { border: 1px solid var(--border-strong); }
.avatar { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--fg-2); font-size: var(--t-xs); font-weight: 700; }
@media (min-width: 1100px) {
  .barra { grid-template-columns: auto auto 1fr auto; grid-template-areas: "marca menu buscar iconos"; padding: 9px 20px; }
  .menu { margin: 0 0 0 14px; }
}
@media (max-width: 699px) {
  .barra { grid-template-columns: 1fr auto; grid-template-areas: "marca iconos" "buscar buscar" "menu menu"; padding: 10px 16px; }
  .buscador { width: 100%; justify-self: stretch; }
  .buscador kbd { display: none; }
}

/* ── 4. Página y encabezado ─────────────────────────────────────────────────────────────────── */
.pagina { max-width: 1480px; margin: 0 auto; padding: 22px 16px 40px; }
@media (min-width: 700px) { .pagina { padding: 26px 20px 48px; } }
.encabezado { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 18px; }
.ceja { margin-bottom: 4px; color: var(--accent); font-size: var(--t-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.encabezado h1 { font-size: clamp(1.5rem, 2.4vw, var(--t-xl)); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.sub { margin-top: 4px; color: var(--muted-fg); }   /* sin tope de ancho: el texto usa el de su caja (Joe, 2026-10-20) */
.acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.migas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; color: var(--muted-fg); font-size: var(--t-sm); font-weight: 600; }
.migas a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* ── 5. Botones (reposo, hover, activo, foco, deshabilitado, cargando) ──────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r-md); font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-normal), border-color var(--dur-normal), color var(--dur-normal), transform var(--dur-rapido);
}
.btn:active { transform: translateY(1px); }
.btn-pri { background: var(--primary); color: var(--on-primary); }
.btn-pri:hover { background: var(--secondary); }
.btn-sec { background: var(--surface); color: var(--fg); border-color: var(--border-strong); }
.btn-sec:hover { background: var(--surface-2); }
.btn-fantasma { background: none; color: var(--fg-2); }
.btn-fantasma:hover { background: var(--surface-2); color: var(--fg); }
.btn-peligro { background: var(--destructive); color: #fff; }
.btn-peligro:hover { filter: brightness(1.08); }
.btn-chico { min-height: 34px; padding: 0 11px; border-radius: var(--r-sm); font-size: var(--t-sm); }
.btn-ancho { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-primary) transparent var(--on-primary) transparent; animation: girar .8s linear infinite; }
.btn-sec[aria-busy="true"]::after { border-color: var(--fg) transparent var(--fg) transparent; }
@keyframes girar { to { transform: rotate(360deg); } }
.enlace { color: var(--accent); font-size: var(--t-sm); font-weight: 700; }
.enlace:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── 6. Chips y sellos de estado ───────────────────────────────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-size: var(--t-xs); font-weight: 700; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-aviso { background: var(--warn-bg); color: var(--warn); }
.chip-mal { background: var(--bad-bg); color: var(--bad); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-borde { border: 1px solid var(--border-strong); color: var(--fg-2); }
.chip-neutro { background: var(--surface-2); color: var(--fg-2); }

/* ── 7. Rejilla y tarjetas ─────────────────────────────────────────────────────────────────── */
.rejilla { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .rejilla { grid-template-columns: repeat(6, 1fr); }
  .s-3, .s-4 { grid-column: span 3; } .s-5, .s-6, .s-7, .s-8, .s-12, .t-completa { grid-column: span 6; }
}
@media (min-width: 1100px) {
  .rejilla { grid-template-columns: repeat(12, 1fr); }
  .s-3 { grid-column: span 3; } .s-4, .t-completa.s-4 { grid-column: span 4; } .s-5 { grid-column: span 5; } .s-6 { grid-column: span 6; }
  .s-7 { grid-column: span 7; } .s-8 { grid-column: span 8; } .s-12 { grid-column: span 12; }
}
.tarjeta {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-card);
}
.tarjeta-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tarjeta h2 { display: flex; align-items: center; gap: 9px; font-size: .9rem; font-weight: 700; }
.lectura { min-height: 1.45em; margin-top: 2px; color: var(--muted-fg); font-size: var(--t-sm); }
.resalte { background: var(--resalte-bg); border-color: var(--resalte-border); }
.cifra-grande { font-size: clamp(1.75rem, 3vw, var(--t-2xl)); font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.cifra-nota { font-size: var(--t-sm); font-weight: 600; letter-spacing: 0; color: var(--muted-fg); }
.kpi { gap: 6px; }
.kpi .nombre { color: var(--muted-fg); font-size: var(--t-sm); font-weight: 600; }
.kpi .valor { font-size: clamp(1.5rem, 2.4vw, 1.875rem); font-weight: 800; letter-spacing: -.02em; }
.kpi .cambio { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted-fg); font-size: var(--t-xs); }
.heroe {
  flex-direction: row; gap: 0; padding: 0; overflow: hidden; color: var(--heroe-fg); border-color: var(--primary-borde);
  background:
    linear-gradient(var(--heroe-reja) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(90deg, var(--heroe-reja) 1px, transparent 1px) 0 0 / 26px 26px,
    radial-gradient(120% 140% at 85% 0%, var(--heroe-a) 0%, var(--heroe-b) 45%, var(--heroe-c) 100%);
}
.heroe h2 { color: var(--heroe-fg); }
.heroe-principal { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 18px; }
.cifra-heroe { margin-top: 4px; font-size: clamp(2.25rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.heroe .delta { display: flex; align-items: center; gap: 8px; color: var(--heroe-muted); font-size: var(--t-sm); }
.heroe-pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--heroe-muted); font-size: var(--t-sm); }
.heroe-pie strong { color: var(--heroe-fg); }
.heroe-lado { display: flex; flex-direction: column; justify-content: center; gap: 12px; min-width: 128px; padding: 16px 20px;
  border-left: 1px solid color-mix(in srgb, var(--heroe-fg) 14%, transparent); }
.heroe-lado dt { color: var(--heroe-muted); font-size: var(--t-sm); }
.heroe-lado dd { font-size: 1.2rem; font-weight: 800; }
@media (max-width: 520px) {
  .heroe { flex-direction: column; }
  .heroe-lado { flex-direction: row; flex-wrap: wrap; gap: 10px 22px; border-left: 0; border-top: 1px solid color-mix(in srgb, var(--heroe-fg) 14%, transparent); }
}

/* ── 8. Barras y gráficas sin estilos en línea ─────────────────────────────────────────────── */
progress.barra-dato, progress.barra-meta {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; border: 0; border-radius: var(--r-pill);
  background: var(--pista); color: var(--dato); overflow: hidden;
}
progress.barra-meta { height: 8px; margin-top: auto; background: var(--heroe-pista); color: var(--heroe-barra); }
progress.barra-dato::-webkit-progress-bar, progress.barra-meta::-webkit-progress-bar { background: transparent; }
progress.barra-dato::-webkit-progress-value { background: var(--dato); border-radius: var(--r-pill); }
progress.barra-meta::-webkit-progress-value { background: var(--heroe-barra); border-radius: var(--r-pill); }
progress.barra-dato::-moz-progress-bar { background: var(--dato); border-radius: var(--r-pill); }
progress.barra-meta::-moz-progress-bar { background: var(--heroe-barra); border-radius: var(--r-pill); }
progress.grueso { height: 14px; border-radius: 5px; }
progress.grueso::-webkit-progress-value { border-radius: 5px; }
progress.fina { height: 4px; }
.grafica { display: block; width: 100%; height: auto; overflow: visible; }
.grafica text { fill: var(--muted-fg); stroke: none; font: 600 11px var(--font-ui); }
.grafica .rejilla-linea { stroke: var(--sep); stroke-width: 1; }
.grafica .serie { fill: none; stroke: var(--dato); stroke-width: 2.6; }
.grafica .serie-antes { fill: none; stroke: var(--serie-antes); stroke-width: 1.8; stroke-dasharray: 5 5; }
.grafica .barra { fill: var(--dato); }
.grafica .barra.hoy { fill: var(--dato-hoy); }
.grafica .barra.pronostico { fill: url(#rayas); stroke: var(--dato); stroke-width: 1; }
.grafica .seg-1 { fill: var(--d1); } .grafica .seg-2 { fill: var(--d2); } .grafica .seg-3 { fill: var(--d3); }
.grafica .seg-4 { fill: var(--d4); } .grafica .seg-5 { fill: var(--d5); }
.grafica .barra:hover, .grafica .barra:focus-visible { filter: brightness(1.12); outline: none; }
.grafica .cruz { stroke: var(--border-strong); stroke-width: 1.5; }
.leyenda-mini { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; padding: 0; list-style: none; color: var(--muted-fg); font-size: var(--t-xs); }
.leyenda-mini li { display: flex; align-items: center; gap: 6px; }
.muestra { width: 10px; height: 10px; border-radius: 3px; background: var(--dato); }
.muestra.rayada { background: repeating-linear-gradient(135deg, var(--dato) 0 1.5px, transparent 1.5px 4px); box-shadow: inset 0 0 0 1px var(--dato); }
.muestra.linea { width: 16px; height: 0; border-top: 2.5px solid var(--dato); border-radius: 0; background: none; }
.muestra.punteada { width: 16px; height: 0; border-top: 2px dashed var(--serie-antes); border-radius: 0; background: none; }
.muestra.d1 { background: var(--d1); } .muestra.d2 { background: var(--d2); } .muestra.d3 { background: var(--d3); }
.muestra.d4 { background: var(--d4); } .muestra.d5 { background: var(--d5); }

/* ── 9. Control segmentado, pestañas y filtros ─────────────────────────────────────────────── */
.segmentado { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-hundida); }
.segmentado > a, .segmentado > button { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--muted-fg); font-size: var(--t-sm); font-weight: 700; cursor: pointer; }
.segmentado > a:hover, .segmentado > button:hover { color: var(--fg); }
.segmentado > [aria-current="page"], .segmentado > [aria-pressed="true"] { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--border-control); }
.filtros-fila { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
/* La raya va por dentro (sombra) y la de la activa cabe en la caja: con `border-bottom` y la raya activa 1 px abajo,
   la caja se desbordaba a lo alto y Windows le pintaba una barra con flechitas (Joe, 2026-10-20). */
.pestanas { display: flex; gap: 4px; margin-bottom: 16px; box-shadow: inset 0 -1px 0 var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.pestanas::-webkit-scrollbar { display: none; }
.pestanas a { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 12px; color: var(--muted-fg); font-weight: 700; white-space: nowrap; }
.pestanas a:hover { color: var(--fg); }
.pestanas a:focus-visible { outline-offset: -2px; }   /* la tira no se desborda (overflow): el anillo, por dentro */
.pestanas a[aria-current="page"] { color: var(--fg); }
.pestanas a[aria-current="page"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.pestanas .punto { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }

/* ── 10. Tabla de datos (solo lectura: nada se edita dentro de una tabla) ─────────────────── */
.tabla-caja { gap: 0; padding: 4px 0; overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; }
.desliza { max-width: 100%; overflow-x: auto; }   /* una tabla dentro de una tarjeta, en pantalla chica */
.tabla th { padding: 12px 18px; border-bottom: 1px solid var(--border); text-align: left; color: var(--muted-fg);
  font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.tabla td { padding: 11px 18px; border-bottom: 1px solid var(--sep); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla .num { text-align: right; }
.tabla tr.abre { cursor: pointer; transition: background-color var(--dur-rapido); }
.tabla tr.abre:hover, .tabla tr.abre:focus-within { background: var(--surface-2); }
.tabla a.fila-enlace { font-weight: 700; }
.tabla a.fila-enlace:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 860px) { .tabla .col-opcional { display: none; } }
@media (max-width: 520px) { .tabla .col-opcional-chica { display: none; } .tabla td, .tabla th { padding-left: 14px; padding-right: 14px; } }
.persona { display: flex; align-items: center; gap: 11px; min-width: 0; }
.persona > div > strong, .persona > div > a { display: block; font-weight: 700; }
.persona > div > span { display: block; color: var(--muted-fg); font-size: var(--t-xs); }
.letra { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; font-size: var(--t-sm); font-weight: 800; }
.letra.chica { width: 22px; height: 22px; border-radius: var(--r-xs); font-size: .66rem; }

/* ── 11. Formularios (reposo, hover, foco, deshabilitado, error) ───────────────────────────── */
.formulario { display: flex; flex-direction: column; gap: 14px; }
.formulario label, .campo-caja { display: flex; flex-direction: column; gap: 6px; font-size: var(--t-sm); font-weight: 700; }
.doble { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .doble { grid-template-columns: 1fr; } }
.campo { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--border-control); border-radius: var(--r-md);
  background: var(--surface-hundida); color: var(--fg); font-weight: 500; transition: border-color var(--dur-rapido), box-shadow var(--dur-rapido); }
.campo:hover { border-color: color-mix(in srgb, var(--border-control) 70%, var(--fg)); }
.campo:focus { outline: none; border-color: var(--ring); box-shadow: var(--ring-shadow); }
.campo:disabled { opacity: .6; cursor: not-allowed; }
.campo[aria-invalid="true"] { border-color: var(--bad); }
.campo::placeholder { color: var(--muted-fg); opacity: 1; }   /* el gris del navegador da ~4:1 sobre --surface-hundida (medido en ltcotiza, 2026-10-19) */
textarea.campo { min-height: 90px; resize: vertical; }
.error { color: var(--bad); font-size: var(--t-xs); font-weight: 700; }
.dato-campo { color: var(--muted-fg); font-size: var(--t-xs); font-weight: 600; }   /* debajo de un campo solo van datos */

/* ── 12. Tablero de columnas (arrastre) ────────────────────────────────────────────────────── */
.tablero { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; padding-bottom: 8px; overflow-x: auto; scroll-snap-type: x proximity; }
.columna { display: flex; flex-direction: column; gap: 10px; min-height: 360px; padding: 12px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); transition: border-color var(--dur-normal), background-color var(--dur-normal), opacity var(--dur-normal); }
.columna.encima { border-color: var(--ring); background: color-mix(in srgb, var(--surface) 88%, var(--ring)); }
.columna.apagada { opacity: .45; }
.col-cab { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 2px 8px; padding: 2px 2px 8px; border-bottom: 2px solid var(--sep); }
.col-cab .cuadro { width: 8px; height: 8px; border-radius: 2px; }
.col-cab .cuadro.d1 { background: var(--d1); } .col-cab .cuadro.d2 { background: var(--d2); } .col-cab .cuadro.d3 { background: var(--d3); }
.col-cab .cuadro.d4 { background: var(--d4); } .col-cab .cuadro.d5 { background: var(--d5); } .col-cab .cuadro.mal { background: var(--destructive); }
.col-cab strong { font-size: .84rem; }
.col-cab .cuenta { padding: 1px 7px; border-radius: var(--r-xs); background: var(--surface-hundida); color: var(--muted-fg); font-size: var(--t-xs); font-weight: 700; }
.col-cab .suma { grid-column: 2 / 4; color: var(--muted-fg); font-size: var(--t-xs); }
.soltar { display: grid; place-items: center; min-height: 64px; margin-top: auto; border: 1.5px dashed var(--border-strong); border-radius: var(--r-sm); color: var(--muted-fg); font-size: var(--t-sm); }
.ficha { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 11px 12px; cursor: grab; touch-action: pan-y; user-select: none;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color var(--dur-normal), opacity var(--dur-normal); }
.ficha:hover { border-color: var(--border-strong); }
.ficha.arrastrando { opacity: .35; }
.ficha.fantasma { position: fixed; z-index: 60; pointer-events: none; cursor: grabbing; transform: rotate(-2deg); border-color: var(--ring); box-shadow: var(--sh-panel); }
.ficha.recien { animation: aterriza .5s var(--ease); }
@keyframes aterriza { from { box-shadow: 0 0 0 3px var(--ring); } }
.ficha-cab { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 0 9px; }
.ficha-cab .letra { width: 26px; height: 26px; border-radius: 7px; font-size: .72rem; }
.ficha-arriba { overflow: hidden; color: var(--muted-fg); font-size: var(--t-xs); text-overflow: ellipsis; white-space: nowrap; }
.ficha-titulo { font-weight: 700; line-height: 1.3; }
.ficha-monto { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ficha-monto strong { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; }
.ficha-monto span { color: var(--muted-fg); font-size: var(--t-xs); }
.ficha-pie { display: flex; align-items: center; gap: 8px; color: var(--muted-fg); font-size: var(--t-xs); }
.ficha-pie > span:not(.chip):not(.avatar) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficha-pie .avatar { width: 24px; height: 24px; margin-left: auto; font-size: .62rem; }
.menu-flotante { position: fixed; z-index: 70; min-width: 210px; padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--sh-panel); }
.menu-flotante p { padding: 6px 10px 4px; color: var(--muted-fg); font-size: var(--t-xs); font-weight: 700; }
.menu-flotante button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: none; text-align: left; font-weight: 600; cursor: pointer; }
.menu-flotante button:hover, .menu-flotante button:focus-visible { background: var(--surface-2); outline-offset: -2px; }
.menu-flotante button:disabled { color: var(--muted-fg); cursor: default; }

/* ── 13. Ventanas: modal al centro (ancho) y panel lateral, con velo y anti-cierre ──────────── */
.velo { position: fixed; inset: 0; z-index: 40; background: var(--velo); animation: aparece var(--dur-normal) ease both; }
.modal, .panel-lateral { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--sh-panel); }
.modal { position: fixed; z-index: 41; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(60rem, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  border-radius: var(--r-xl); animation: aparece var(--dur-normal) ease both; }
.modal.confirmar { width: min(40rem, calc(100vw - 32px)); }
.panel-lateral { position: fixed; z-index: 41; top: 10px; right: 10px; bottom: 10px; width: min(30rem, calc(100vw - 20px)); border-radius: var(--r-xl);
  animation: entra var(--dur-lento) var(--ease) both; }
.panel-lateral.ancho { width: min(44rem, calc(100vw - 20px)); }
.empujon { animation: empujon .32s cubic-bezier(.36, .07, .19, .97); }
@keyframes entra { from { transform: translateX(24px); opacity: 0; } }
@keyframes aparece { from { opacity: 0; } }
@keyframes empujon { 30% { transform: translateX(-7px); } 60% { transform: translateX(4px); } }
.modal.empujon { animation: empujon-centro .32s cubic-bezier(.36, .07, .19, .97); }
@keyframes empujon-centro { 30% { transform: translate(calc(-50% - 7px), -50%); } 60% { transform: translate(calc(-50% + 4px), -50%); } }
/* Con <dialog> nativo (showModal): el navegador ya lo pone en la capa de arriba, atrapa el foco, cierra con Escape y
   NO cierra con un clic en el fondo. El velo es ::backdrop. El empujón al dar clic afuera lo pone el JS de la casa. */
dialog.modal, dialog.panel-lateral { padding: 0; color: var(--fg); }
dialog.modal:not([open]), dialog.panel-lateral:not([open]) { display: none; }   /* si no, la hoja le gana al navegador y la ventana cerrada se dibuja */
dialog.modal { margin: auto; inset: 0; transform: none; }
dialog.modal.empujon { animation: empujon .32s cubic-bezier(.36, .07, .19, .97); }
dialog.panel-lateral { margin: 0 0 0 auto; inset: 10px 10px 10px auto; height: auto; max-width: none; max-height: none; }   /* el navegador lo topa a 100% − 2em: en celular dejaba 38 px de velo a la izquierda */
dialog.modal::backdrop, dialog.panel-lateral::backdrop { background: var(--velo); }
@media (max-width: 520px) { dialog.panel-lateral, .panel-lateral, .panel-lateral.ancho { inset: 0; top: 0; right: 0; bottom: 0; width: 100vw; border-radius: 0; } }
.ventana-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--sep); }
.ventana-cab h2 { font-size: var(--t-md); font-weight: 800; }
.ventana-cab .botones { display: flex; align-items: center; gap: 6px; }
.ventana-cuerpo { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
.ventana-pie { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--sep); background: var(--surface); }
.ventana-aviso { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 20px; background: var(--warn-bg); color: var(--warn); font-size: var(--t-sm); font-weight: 700; }
.ventana-aviso span { flex: 1 1 100%; }
.mosaico { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mosaico > div { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.mosaico dt { color: var(--muted-fg); font-size: var(--t-xs); }
.mosaico dd { margin-top: 2px; font-size: .95rem; font-weight: 800; }
.mosaico dd.cifra-nota, .heroe-lado dd.cifra-nota { margin-top: 1px; font-size: var(--t-xs); font-weight: 600; letter-spacing: 0; }
.heroe-lado dd.cifra-nota, .heroe .cifra-nota { color: var(--heroe-muted); }   /* también el «de N» dentro de un dd: con
   --muted-fg sobre el fondo de la héroe daba 3.9:1 en oscuro (revisión de ltcotiza, 2026-10-20) */
.linea-tiempo { padding: 0; list-style: none; }
.linea-tiempo li { position: relative; padding: 0 0 16px 24px; }
.linea-tiempo li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 8px; height: 8px; border: 2px solid var(--accent); border-radius: 50%; background: var(--surface); }
.linea-tiempo li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 2px; width: 2px; background: var(--sep); }
.linea-tiempo li:last-child::after { display: none; }
.linea-tiempo strong { display: block; font-weight: 700; }
.linea-tiempo span { color: var(--muted-fg); font-size: var(--t-xs); }
.ayuda-botones { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 8px 18px; }
.ayuda-botones dt { font-weight: 800; }
.ayuda-botones dd { color: var(--fg-2); }
@media (max-width: 600px) { .ayuda-botones { grid-template-columns: 1fr; } .ayuda-botones dd { margin-bottom: 8px; } }

/* ── 14. Avisos, vacíos y carga ────────────────────────────────────────────────────────────── */
.avisos { position: fixed; z-index: 90; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px); }
.aviso { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: var(--r-md); background: var(--fg); color: var(--bg);
  font-weight: 700; box-shadow: var(--sh-panel); animation: sube .3s var(--ease); }
.aviso.error { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-border); }
.aviso button { min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: color-mix(in srgb, currentColor 14%, transparent); font-weight: 800; cursor: pointer; }
@keyframes sube { from { transform: translateY(12px); opacity: 0; } }
.alerta { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid; border-radius: var(--r-md); font-weight: 600; }
.alerta.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.alerta.aviso-fijo { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.alerta.mal { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); }
.vacio { padding: 28px 18px; color: var(--muted-fg); text-align: center; }
.vacio-grande { align-items: center; gap: 8px; padding: 48px 18px; text-align: center; }
.icono-cuadro { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--primary-suave); color: var(--accent); }
.icono-cuadro.grande { width: 48px; height: 48px; border-radius: var(--r-lg); }
.esqueleto { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2), var(--sep), var(--surface-2)) 0 0 / 200% 100%; animation: brillo 1.4s ease infinite; }
@keyframes brillo { to { background-position: -200% 0; } }

/* ── 15. Tintes ────────────────────────────────────────────────────────────────────────────── */
.tinte-0 { background: var(--t0f); color: var(--t0t); } .tinte-1 { background: var(--t1f); color: var(--t1t); }
.tinte-2 { background: var(--t2f); color: var(--t2t); } .tinte-3 { background: var(--t3f); color: var(--t3t); }
.tinte-4 { background: var(--t4f); color: var(--t4t); } .tinte-5 { background: var(--t5f); color: var(--t5t); }
.avatar[class*="tinte-"] { border-color: transparent; }

/* ── 15b. Pantalla táctil: lo que se toca mide al menos 44 px (regla de la casa; el mouse se queda en 40) ── */
@media (pointer: coarse) {
  .btn, .btn-chico, .pestana, .pestanas a, .segmentado > a, .segmentado > button, .menu-flotante button, .campo { min-height: 44px; }
  .buscador { height: 44px; }
  .campo, .buscador input { font-size: 16px; }   /* con menos, Safari en iPhone hace zoom al tocar el campo (revisión de ltcotiza, 2026-10-19) */
  .icono { width: 44px; height: 44px; }
}

/* ── 16. Movimiento: todo se apaga con «reducir movimiento» ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
