/* ===========================================================================
   tealdev · KIT DE DASHBOARDS
   Sistema visual compartido por las 6 plantillas.
   Paleta: instancia validada del método dataviz (CVD-safe, light + dark).
   Sin dependencias externas. Fuente: system-ui.
   =========================================================================== */

/* ------------------------------------------------------------- tipografía -
   Autoalojadas (cero peticiones a Google, igual que la web principal). Son las
   mismas de tealdev.es: los paneles tienen que parecer del mismo estudio.
   Con `unicode-range`, en español sólo se bajan los subsets `latin` (~155 KB).  */
@font-face { font-family:'Inter Tight'; font-style:normal; font-weight:400; font-display:swap;
  src:url(fonts/InterTight-400-normal-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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter Tight'; font-style:normal; font-weight:400; font-display:swap;
  src:url(fonts/InterTight-400-normal-latin-ext.woff2) format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'Inter Tight'; font-style:normal; font-weight:500; font-display:swap;
  src:url(fonts/InterTight-500-normal-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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter Tight'; font-style:normal; font-weight:500; font-display:swap;
  src:url(fonts/InterTight-500-normal-latin-ext.woff2) format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'Inter Tight'; font-style:normal; font-weight:600; font-display:swap;
  src:url(fonts/InterTight-600-normal-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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter Tight'; font-style:normal; font-weight:600; font-display:swap;
  src:url(fonts/InterTight-600-normal-latin-ext.woff2) format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family:'Instrument Serif'; font-style:normal; font-weight:400; font-display:swap;
  src:url(fonts/InstrumentSerif-400-normal-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+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Instrument Serif'; font-style:normal; font-weight:400; font-display:swap;
  src:url(fonts/InstrumentSerif-400-normal-latin-ext.woff2) format('woff2');
  unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* --------------------------------------------------------------- tokens --- */
:root {
  color-scheme: light;

  /* superficies e ink */
  --plane:        #f4f4f1;
  --surface-1:    #fcfcfb;
  --surface-2:    #f2f2ee;
  --text-1:       #0b0b0b;
  --text-2:       #52514e;
  --text-3:       #898781;
  --grid:         #e1e0d9;
  --axis:         #c3c2b7;
  --border:       rgba(11, 11, 11, .10);
  --border-strong:rgba(11, 11, 11, .18);
  --ghost:        rgba(11, 11, 11, .045);
  /* sombra multicapa: contacto + difusa + halo. Una sola capa se ve plana. */
  --shadow:       0 1px 1px rgba(11,11,11,.04), 0 3px 6px -3px rgba(11,11,11,.07),
                  0 14px 28px -18px rgba(11,11,11,.20);
  --shadow-lift:  0 1px 1px rgba(11,11,11,.05), 0 8px 16px -8px rgba(11,11,11,.13),
                  0 26px 46px -26px rgba(11,11,11,.28);
  /* filo superior claro: es lo que hace que la tarjeta parezca una lámina */
  --edge:         inset 0 1px 0 rgba(255,255,255,.85);
  --card-top:     #ffffff;   /* arranque del degradado de tarjeta */
  --glow-1:       rgba(42,120,214,.075);  /* tinte del fondo, arriba izq.  */
  --glow-2:       rgba(27,175,122,.055);  /* tinte del fondo, arriba dcha. */

  /* categóricas — orden fijo, nunca ciclado */
  --series-1: #2a78d6; /* azul     */
  --series-2: #eb6834; /* naranja  */
  --series-3: #1baf7a; /* aqua     */
  --series-4: #eda100; /* amarillo */
  --series-5: #e87ba4; /* magenta  */
  --series-6: #008300; /* verde    */
  --series-7: #4a3aa7; /* violeta  */
  --series-8: #e34948; /* rojo     */

  /* secuencial azul (magnitud). En claro: claro = poco */
  --seq-0: #cde2fb; --seq-1: #b7d3f6; --seq-2: #9ec5f4; --seq-3: #6da7ec;
  --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95;
  /* ordinal (suelo de contraste 2:1 -> arranca en el paso 250) */
  --ord-0: #86b6ef; --ord-1: #6da7ec; --ord-2: #5598e7; --ord-3: #3987e5;
  --ord-4: #2a78d6; --ord-5: #256abf; --ord-6: #1c5cab;

  /* divergente: azul ↔ rojo con gris neutro en el centro */
  --div-neg: #2a78d6;
  --div-pos: #e34948;
  --div-mid: #f0efec;

  /* estado — reservado, nunca como "serie 4" */
  --st-good:     #0ca30c;
  --st-warning:  #fab219;
  --st-serious:  #ec835a;
  --st-critical: #d03b3b;
  --st-good-text:#006300;
  --st-bad-text: #b02b2b;

  --radius: 16px;
  --radius-sm: 10px;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Instrument Serif", Georgia, "Times New Roman", serif;
}

/* --- modo oscuro: pasos propios para la superficie oscura, no un "flip" --- */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane:        #0d0d0d;
    --surface-1:    #1a1a19;
    --surface-2:    #222220;
    --text-1:       #ffffff;
    --text-2:       #c3c2b7;
    --text-3:       #898781;
    --grid:         #2c2c2a;
    --axis:         #383835;
    --border:       rgba(255,255,255,.10);
    --border-strong:rgba(255,255,255,.18);
    --ghost:        rgba(255,255,255,.06);
    --shadow:       0 1px 1px rgba(0,0,0,.45), 0 3px 8px -4px rgba(0,0,0,.55),
                    0 16px 32px -20px rgba(0,0,0,.9);
    --shadow-lift:  0 1px 1px rgba(0,0,0,.5), 0 10px 20px -10px rgba(0,0,0,.6),
                    0 30px 54px -28px rgba(0,0,0,1);
    --edge:         inset 0 1px 0 rgba(255,255,255,.06);
    --card-top:     #201f1e;
    --glow-1:       rgba(57,135,229,.13);
    --glow-2:       rgba(25,158,112,.09);

    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;

    /* en oscuro, "poco" es el paso más oscuro */
    --seq-0: #184f95; --seq-1: #1c5cab; --seq-2: #256abf; --seq-3: #2a78d6;
    --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
    --ord-0: #184f95; --ord-1: #1c5cab; --ord-2: #256abf; --ord-3: #2a78d6;
    --ord-4: #3987e5; --ord-5: #5598e7; --ord-6: #86b6ef;

    --div-neg: #3987e5; --div-pos: #e66767; --div-mid: #383835;
    --st-good-text: #0ca30c;
    --st-bad-text:  #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:        #0d0d0d;
  --surface-1:    #1a1a19;
  --surface-2:    #222220;
  --text-1:       #ffffff;
  --text-2:       #c3c2b7;
  --text-3:       #898781;
  --grid:         #2c2c2a;
  --axis:         #383835;
  --border:       rgba(255,255,255,.10);
  --border-strong:rgba(255,255,255,.18);
  --ghost:        rgba(255,255,255,.06);
  --shadow:       0 1px 1px rgba(0,0,0,.45), 0 3px 8px -4px rgba(0,0,0,.55),
                  0 16px 32px -20px rgba(0,0,0,.9);
  --shadow-lift:  0 1px 1px rgba(0,0,0,.5), 0 10px 20px -10px rgba(0,0,0,.6),
                  0 30px 54px -28px rgba(0,0,0,1);
  --edge:         inset 0 1px 0 rgba(255,255,255,.06);
  --card-top:     #201f1e;
  --glow-1:       rgba(57,135,229,.13);
  --glow-2:       rgba(25,158,112,.09);

  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;

  --seq-0: #184f95; --seq-1: #1c5cab; --seq-2: #256abf; --seq-3: #2a78d6;
  --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
  --ord-0: #184f95; --ord-1: #1c5cab; --ord-2: #256abf; --ord-3: #2a78d6;
  --ord-4: #3987e5; --ord-5: #5598e7; --ord-6: #86b6ef;

  --div-neg: #3987e5; --div-pos: #e66767; --div-mid: #383835;
  --st-good-text: #0ca30c;
  --st-bad-text:  #e66767;
}

/* ----------------------------------------------------------------- base --- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  /* el gris plano era lo que más «plantilla de admin» hacía parecer esto.
     Dos tintes muy suaves arriba dan profundidad sin ensuciar los gráficos. */
  background:
    radial-gradient(1100px 620px at 12% -8%, var(--glow-1), transparent 62%),
    radial-gradient(940px 540px at 92% -4%, var(--glow-2), transparent 58%),
    var(--plane);
  background-attachment: fixed;
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.011em; }
/* cifras siempre en tabular: si no, las columnas de KPI bailan al filtrar */
.hero__value, .stat__value, .meter__val, .statusrow__val, .delta { font-variant-numeric: tabular-nums; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: 2px;
  border-radius: 4px;
}
.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 --- */
.shell { max-width: 1440px; margin: 0 auto; padding: 0 clamp(14px, 3vw, 32px) 72px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__in {
  max-width: 1440px; margin: 0 auto;
  padding: 12px clamp(14px, 3vw, 32px);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  text-decoration: none;                    /* es un <a>: salía subrayada */
  border-radius: 10px; padding: 3px; margin: -3px;
  transition: background .15s ease;
}
.brand:hover { background: var(--ghost); }
.brand__mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--series-1) 82%, #fff),
    var(--series-1) 55%,
    color-mix(in srgb, var(--series-1) 78%, #000));
  box-shadow: 0 1px 2px rgba(11,11,11,.25), inset 0 1px 0 rgba(255,255,255,.35);
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 13px; letter-spacing: -.03em;
}
.brand__txt { min-width: 0; }
/* los dos son <span>: sin `block` quedaban en la misma línea y se leía
   «Grupo Levantina de ServiciosDirección financiera», sin separación */
.brand__name { display: block; font-size: 14px; font-weight: 600; line-height: 1.2; }
.brand__sub { display: block; font-size: 12px; color: var(--text-2); line-height: 1.2; }

.topbar__spacer { flex: 1 1 auto; }

.badge-demo {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 999px;
  color: var(--st-bad-text);
  background: color-mix(in srgb, var(--st-critical) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--st-critical) 30%, transparent);
  white-space: nowrap;
}
.badge-demo::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--st-critical);
}

.iconbtn {
  height: 34px; min-width: 34px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-1); cursor: pointer;
  font-size: 13px; color: var(--text-2);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.iconbtn:hover { background: var(--ghost); color: var(--text-1); }
.iconbtn svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------- header --- */
.page-head { padding: 30px 0 4px; }
/* el título en serif es lo que le quita la cara de plantilla genérica.
   Va sólo aquí: los números y las etiquetas siguen en Inter Tight. */
.page-head h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(30px, 4.2vw, 44px); line-height: 1.06; letter-spacing: -.015em;
}
.page-head .lede { color: var(--text-2); margin-top: 9px; max-width: 68ch; font-size: 14.5px; }

/* -------------------------------------------------------------- filtros --- */
.filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 18px 0 6px; padding: 10px 12px;
  background-color: var(--surface-1);
  background-image: linear-gradient(180deg, var(--card-top) 0%, var(--surface-1) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow), var(--edge);
}
.filters__label {
  font-size: 12px; color: var(--text-2); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; margin-right: 2px;
}
.segbar { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.segbar button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 11px; border-radius: 7px; font-size: 13px; color: var(--text-2);
  transition: background .15s ease, color .15s ease;
}
.segbar button:hover { background: var(--ghost); }
.segbar button[aria-pressed="true"] {
  background: var(--surface-1); color: var(--text-1); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.selectwrap { position: relative; display: inline-flex; }
.selectwrap select {
  appearance: none; font: inherit; font-size: 13px;
  padding: 7px 30px 7px 11px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-1);
  cursor: pointer;
}
.selectwrap::after {
  content: ""; position: absolute; right: 11px; top: 50%; pointer-events: none;
  width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3);
  transform: rotate(45deg);
}
.filters__note { font-size: 12px; color: var(--text-2); margin-left: auto; }

/* ----------------------------------------------------------------- hero --- */
.hero {
  position: relative; overflow: hidden;
  margin: 16px 0 0; padding: 24px 26px;
  background-color: var(--surface-1);
  background-image: linear-gradient(180deg, var(--card-top) 0%, var(--surface-1) 40%);
  border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow), var(--edge);
  display: flex; gap: 28px; align-items: center; flex-wrap: wrap;
}
/* filo de color arriba: marca cuál es el dato que manda en el panel */
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--series-1), var(--series-3) 55%, transparent);
}
.hero__main { min-width: 220px; }
.hero__label {
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em;
}
.hero__value {
  font-size: clamp(42px, 6.2vw, 60px); font-weight: 600; line-height: 1.02;
  letter-spacing: -.035em; margin-top: 6px;
}
.hero__meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.hero__spark { flex: 1 1 260px; min-width: 200px; max-width: 460px; }
.hero__spark svg { display: block; width: 100%; height: 74px; }

.delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.delta--up   { color: var(--st-good-text); }
.delta--down { color: var(--st-bad-text); }
.delta--flat { color: var(--text-2); }
.delta__vs { color: var(--text-2); font-weight: 400; }

/* ------------------------------------------------------------ stat grid --- */
.stats {
  display: grid; gap: 12px; margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
}
.stat {
  background-color: var(--surface-1);
  background-image: linear-gradient(180deg, var(--card-top) 0%, var(--surface-1) 52%);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 15px 13px; box-shadow: var(--shadow), var(--edge);
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  transition: box-shadow .22s cubic-bezier(.22,.61,.36,1), border-color .22s ease,
              transform .22s cubic-bezier(.22,.61,.36,1);
}
.stat:hover { box-shadow: var(--shadow-lift), var(--edge); border-color: var(--border-strong); transform: translateY(-2px); }
.stat__label {
  font-size: 11.5px; color: var(--text-2); font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em;
}
.stat__value { font-size: 28px; font-weight: 600; letter-spacing: -.025em; line-height: 1.1; }
.stat__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 4px; }
.stat__spark { width: 78px; height: 26px; flex: none; }
.stat__spark svg { display: block; width: 100%; height: 100%; }

/* ------------------------------------------------------------- secciones -- */
.section { margin-top: 34px; }
.section__head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 13px; flex-wrap: wrap;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
/* la sección se lee como epígrafe, no como otro título más del montón */
.section__head h2 {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .10em;
  color: var(--text-2);
  display: inline-flex; align-items: center; gap: 9px;
}
.section__head h2::before {
  content: ""; width: 14px; height: 2px; border-radius: 2px; flex: none;
  background: var(--series-1);
}
.section__head p { font-size: 13px; color: var(--text-2); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.card {
  grid-column: span var(--span, 6);
  background-color: var(--surface-1);
  background-image: linear-gradient(180deg, var(--card-top) 0%, var(--surface-1) 46%);
  border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow), var(--edge);
  padding: 16px 17px 15px; margin: 0; min-width: 0;
  display: flex; flex-direction: column;
  transition: box-shadow .22s cubic-bezier(.22,.61,.36,1),
              border-color .22s ease, transform .22s cubic-bezier(.22,.61,.36,1);
}
/* el hover levanta la tarjeta; el tooltip cuelga de <body>, así que el
   transform no le afecta la posición */
.card:hover { box-shadow: var(--shadow-lift), var(--edge); border-color: var(--border-strong); transform: translateY(-2px); }
.card__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 2px; }
.card__title { font-size: 14px; font-weight: 600; }
.card__sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.card__tools { margin-left: auto; display: flex; gap: 4px; flex: none; }
.card__tools button {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-size: 12px; color: var(--text-2); padding: 4px 8px; border-radius: 7px;
  transition: background .15s ease, color .15s ease;
}
.card__tools button:hover { background: var(--ghost); color: var(--text-1); }
.card__tools button[aria-pressed="true"] { background: var(--ghost); color: var(--text-1); border-color: var(--border); }
.card__plot { margin-top: 10px; position: relative; }
.card__plot svg { display: block; width: 100%; overflow: visible; }
.card__note { font-size: 12px; color: var(--text-2); margin-top: 9px; }

/* leyenda: siempre presente con 2+ series */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.legend__item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2);
  background: none; border: 0; padding: 2px 0; cursor: default;
}
.legend__key { flex: none; border-radius: 2px; }
.legend__key--rect { width: 11px; height: 11px; border-radius: 3px; }
.legend__key--line { width: 14px; height: 2.5px; border-radius: 2px; }

/* tabla espejo (WCAG-clean) */
.tableview { margin-top: 12px; overflow-x: auto; }
.tableview table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.tableview caption { text-align: left; color: var(--text-2); font-size: 12px; padding-bottom: 7px; }
.tableview th, .tableview td {
  padding: 6px 10px; border-bottom: 1px solid var(--grid); text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tableview th:first-child, .tableview td:first-child { text-align: left; font-variant-numeric: normal; }
.tableview thead th { color: var(--text-2); font-weight: 600; border-bottom: 1px solid var(--axis); }
.tableview tbody tr:hover { background: var(--ghost); }

/* medidores */
.meters { display: flex; flex-direction: column; gap: 15px; margin-top: 12px; }
.meter__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; }
.meter__name { color: var(--text-2); }
.meter__val { font-weight: 600; font-variant-numeric: tabular-nums; }
.meter__track {
  height: 9px; border-radius: 999px; margin-top: 6px; overflow: hidden;
  background: color-mix(in srgb, var(--series-1) 16%, var(--surface-2));
}
.meter__fill { height: 100%; border-radius: 999px; background: var(--series-1); }
.meter__scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* estado / semáforo */
.statuslist { display: flex; flex-direction: column; gap: 1px; margin-top: 8px; }
.statusrow {
  display: grid; grid-template-columns: 22px 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid var(--grid); font-size: 13px;
}
.statusrow:last-child { border-bottom: 0; }
.statusrow__ico { display: grid; place-items: center; }
.statusrow__ico svg { width: 17px; height: 17px; }
.statusrow__name { min-width: 0; }
.statusrow__name b { font-weight: 600; }
.statusrow__name span { display: block; color: var(--text-2); font-size: 12px; }
.statusrow__val { font-variant-numeric: tabular-nums; font-weight: 600; }
.statusrow__tag {
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-2); background: var(--surface-2);
}
.st-good     { color: var(--st-good); }
.st-warning  { color: var(--st-warning); }
.st-serious  { color: var(--st-serious); }
.st-critical { color: var(--st-critical); }
.statusrow__tag.is-good     { color: var(--st-good-text); border-color: color-mix(in srgb, var(--st-good) 40%, transparent); background: color-mix(in srgb, var(--st-good) 10%, transparent); }
.statusrow__tag.is-warning  { color: var(--text-1);       border-color: color-mix(in srgb, var(--st-warning) 55%, transparent); background: color-mix(in srgb, var(--st-warning) 16%, transparent); }
.statusrow__tag.is-serious  { color: var(--text-1);       border-color: color-mix(in srgb, var(--st-serious) 50%, transparent); background: color-mix(in srgb, var(--st-serious) 15%, transparent); }
.statusrow__tag.is-critical { color: var(--st-bad-text);  border-color: color-mix(in srgb, var(--st-critical) 45%, transparent); background: color-mix(in srgb, var(--st-critical) 11%, transparent); }

/* tabla de datos como tarjeta */
.datatable { margin-top: 10px; overflow-x: auto; }
.datatable table { border-collapse: collapse; width: 100%; font-size: 13px; }
.datatable th, .datatable td {
  padding: 8px 10px; border-bottom: 1px solid var(--grid); text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.datatable th:first-child, .datatable td:first-child { text-align: left; font-variant-numeric: normal; white-space: normal; }
.datatable thead th { color: var(--text-2); font-weight: 600; border-bottom: 1px solid var(--axis); font-size: 12px; }
.datatable tbody tr:hover { background: var(--ghost); }
.cell-bar { position: relative; }
.cell-bar__fill {
  position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 3px;
  background: color-mix(in srgb, var(--series-1) 18%, transparent);
}
.cell-bar span { position: relative; }

/* ------------------------------------------------------------- tooltip --- */
.viz-tip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 11px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.35);
  font-size: 12.5px; min-width: 128px; max-width: 260px;
  opacity: 0; transform: translateY(3px); transition: opacity .1s ease, transform .1s ease;
}
.viz-tip[data-show="1"] { opacity: 1; transform: translateY(0); }
.viz-tip__head { font-weight: 600; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.viz-tip__row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.viz-tip__key { width: 13px; height: 2.5px; border-radius: 2px; flex: none; }
.viz-tip__name { color: var(--text-2); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-tip__val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-1); }

/* --------------------------------------------------------------- footer --- */
.foot {
  margin-top: 46px; padding-top: 18px; border-top: 1px solid var(--border);
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  font-size: 12.5px; color: var(--text-2);
}
.foot a { color: var(--text-2); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.foot a:hover { color: var(--text-1); }

/* --------------------------------------------------------- responsividad -- */
@media (max-width: 1080px) {
  .card { grid-column: span min(12, calc(var(--span, 6) * 2)); }
}
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  .card { grid-column: span 12; }
  .hero { padding: 18px; gap: 16px; }
  .hero__spark { max-width: none; }
  .filters { gap: 8px; }
  .filters__note { margin-left: 0; width: 100%; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
  .stat__value { font-size: 22px; }
  /* en dos columnas estrechas, 78px de sparkline + el delta no caben en el pie
     de la tarjeta y se salían por la derecha */
  .stat { padding: 13px 13px 11px; }
  .stat__spark { width: 56px; }
}

/* ------------------------------------------------------ entrada animada --- */
/* Sólo en el primer pintado y sólo al entrar en pantalla. Al filtrar NO se
   reanima: repetirlo en cada cambio de rango se veía como un parpadeo.
   `BDV.settle()` (lo llama el audit) lo apaga y deja todo en su sitio final. */
@keyframes bdvIn {
  from { opacity: 0; transform: translateY(10px) scale(.994); }
  to   { opacity: 1; transform: none; }
}
/* el `opacity:0` sólo existe si el JS ha llegado a armar el observador; si
   fallara, la página se ve entera en vez de quedarse en blanco */
:root.bdv-anim-on .bdv-reveal { opacity: 0; }
.bdv-reveal.is-in {
  animation: bdvIn .5s cubic-bezier(.22,.61,.36,1) both;
  animation-delay: var(--d, 0ms);
}
:root.bdv-no-anim .bdv-reveal,
:root.bdv-no-anim .bdv-reveal.is-in {
  opacity: 1 !important; animation: none !important; transform: none !important;
}

/* -------------------------------------------------------------- opciones -- */
.is-refetching .grid, .is-refetching .stats, .is-refetching .hero { opacity: .55; }
.grid, .stats, .hero { transition: opacity .18s ease; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  :root.bdv-anim-on .bdv-reveal { opacity: 1 !important; }
  .card:hover, .stat:hover { transform: none; }
}

@media print {
  .topbar, .filters, .card__tools, .foot { display: none !important; }
  body { background: #fff; }
  :root.bdv-anim-on .bdv-reveal { opacity: 1 !important; animation: none !important; }
  .card, .stat, .hero { break-inside: avoid; box-shadow: none; }
}
