/* nasmon — style.css
 *
 * Paleta como variables en :root, redefinida bajo
 *   @media (prefers-color-scheme: dark) :root:not([data-theme="light"])   ← sistema
 *   :root[data-theme="dark"]                                             ← conmutador
 * para que el conmutador manual gane en AMBOS sentidos.
 *
 * El color nunca es el único portador de significado: cada estado lleva
 * además su glifo (✓ ▲ ✕ ? 💤 ○) y su palabra.
 */

/* ══════════════════════════ tema claro (base) ══════════════════════════ */
:root {
  color-scheme: light;

  --bg:          #f2f4f7;
  --bg-grad:     radial-gradient(1200px 600px at 50% -10%, #e8edf4 0%, #f2f4f7 60%);
  --surface:     #ffffff;
  --surface-2:   #f7f8fa;
  --surface-3:   #e7ebf1;

  --fg:          #10151c;
  --fg-2:        #4b5765;
  --fg-3:        #77828f;

  --line:        #dde3ea;
  --line-strong: #c3ccd7;

  --ok:    #0e7c5a;  --ok-bg:    #e4f4ed;  --ok-line:    #9fd8c1;
  --warn:  #a35a00;  --warn-bg:  #fcf0dc;  --warn-line:  #e6c184;
  --crit:  #c02a1e;  --crit-bg:  #fce9e7;  --crit-line:  #efaba4;
  --info:  #1c5cb8;  --info-bg:  #e7effc;  --info-line:  #a9c5ee;
  --idle:  #64707e;  --idle-bg:  #eceff3;  --idle-line:  #cbd3dc;

  --accent: #0e7c5a;
  --focus:  #1c5cb8;

  --shadow:   0 1px 2px rgba(16,21,28,.07), 0 3px 12px rgba(16,21,28,.05);
  --shadow-lg:0 2px 6px rgba(16,21,28,.10), 0 14px 40px rgba(16,21,28,.10);

  --r:   12px;
  --r-s: 8px;
  --gap: 14px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ══════════════════ tema oscuro por preferencia del sistema ════════════ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:          #0b0f14;
    --bg-grad:     radial-gradient(1200px 600px at 50% -10%, #141c26 0%, #0b0f14 60%);
    --surface:     #141a22;
    --surface-2:   #19212b;
    --surface-3:   #232d3a;

    --fg:          #e9eff6;
    --fg-2:        #a4b1c0;
    --fg-3:        #74828f;

    --line:        #232c38;
    --line-strong: #35424f;

    --ok:    #3fc48c;  --ok-bg:    #10251e;  --ok-line:    #1f5b45;
    --warn:  #e8ab4c;  --warn-bg:  #2a2113;  --warn-line:  #6b4f1c;
    --crit:  #ff7264;  --crit-bg:  #2e1614;  --crit-line:  #7a2f28;
    --info:  #74abff;  --info-bg:  #131f31;  --info-line:  #2c4c7a;
    --idle:  #8592a2;  --idle-bg:  #1a212b;  --idle-line:  #333f4d;

    --accent: #3fc48c;
    --focus:  #74abff;

    --shadow:   0 1px 2px rgba(0,0,0,.45), 0 3px 14px rgba(0,0,0,.35);
    --shadow-lg:0 2px 8px rgba(0,0,0,.5),  0 16px 44px rgba(0,0,0,.45);
  }
}

/* ═══════════════ tema oscuro forzado por el conmutador ═════════════════ */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:          #0b0f14;
  --bg-grad:     radial-gradient(1200px 600px at 50% -10%, #141c26 0%, #0b0f14 60%);
  --surface:     #141a22;
  --surface-2:   #19212b;
  --surface-3:   #232d3a;

  --fg:          #e9eff6;
  --fg-2:        #a4b1c0;
  --fg-3:        #74828f;

  --line:        #232c38;
  --line-strong: #35424f;

  --ok:    #3fc48c;  --ok-bg:    #10251e;  --ok-line:    #1f5b45;
  --warn:  #e8ab4c;  --warn-bg:  #2a2113;  --warn-line:  #6b4f1c;
  --crit:  #ff7264;  --crit-bg:  #2e1614;  --crit-line:  #7a2f28;
  --info:  #74abff;  --info-bg:  #131f31;  --info-line:  #2c4c7a;
  --idle:  #8592a2;  --idle-bg:  #1a212b;  --idle-line:  #333f4d;

  --accent: #3fc48c;
  --focus:  #74abff;

  --shadow:   0 1px 2px rgba(0,0,0,.45), 0 3px 14px rgba(0,0,0,.35);
  --shadow-lg:0 2px 8px rgba(0,0,0,.5),  0 16px 44px rgba(0,0,0,.45);
}

/* ════════════════════════════ base ════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

/* El JS oculta con la propiedad `hidden` (banner de error, «Sin lecturas», la
 * pantalla de login, los avisos…). El `display:none` que trae `hidden` viene de
 * la hoja del navegador, así que CUALQUIER `display` de autor lo pisa y el
 * elemento reaparece. Sin esta regla salían un banner de error vacío y un
 * «Sin lecturas» encima de tarjetas llenas de lecturas. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 640; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

.muted { color: var(--fg-2); }
.mono  { font-family: var(--mono); font-size: .86em; }

/* Oculto para la vista, presente para lectores de pantalla y gestores de
 * contraseñas. Lleva !important a propósito: es una utilidad de un solo
 * propósito que NO puede perder una pelea de especificidad. La perdía: el campo
 * de usuario oculto del login recibía `width:100%` de `.login-card input`
 * (0,1,1 contra 0,1,0), medía 1791 px y estiraba la página a 2531, dejando la
 * portada pública con barra de desplazamiento horizontal. */
.sr-only {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; border: 0 !important;
  overflow: hidden; clip-path: inset(50%); clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); color: var(--fg); padding: 10px 16px;
  border: 2px solid var(--focus); border-radius: 0 0 var(--r-s) 0;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ═══════════════════════ estados: color + glifo ═══════════════════════ */
.st-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15em; height: 1.15em; flex: none;
  font-size: .84em; font-weight: 700; line-height: 1;
}
.st-glyph.state-ok      { color: var(--ok); }
.st-glyph.state-warn    { color: var(--warn); }
.st-glyph.state-crit    { color: var(--crit); }
.st-glyph.state-info    { color: var(--info); }
.st-glyph.state-unknown { color: var(--fg-3); }
.st-glyph.state-off     { color: var(--fg-3); }
.st-glyph.state-asleep  { color: var(--info); font-size: .95em; }

/* ════════════════════════════ topbar ══════════════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: baseline; gap: 7px; flex: none; }
.brand-mark { color: var(--accent); font-size: 1.15em; }
.brand-name { font-weight: 700; letter-spacing: -.02em; }

.hostline { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.host-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--idle-line); background: var(--idle-bg); color: var(--fg-2);
  white-space: nowrap;
}
.pill-glyph { font-size: 10px; line-height: 1; }
.pill.state-ok      { border-color: var(--ok-line);   background: var(--ok-bg);   color: var(--ok); }
.pill.state-warn    { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.pill.state-crit    { border-color: var(--crit-line); background: var(--crit-bg); color: var(--crit); font-weight: 600; }
.pill.state-ok .pill-glyph { animation: beat 3s ease-in-out infinite; }
@keyframes beat { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-s); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.iconbtn:hover { background: var(--surface-3); border-color: var(--line-strong); }

/* ═══════════════════════ banda de congelado ═══════════════════════════ */
.freeze {
  position: sticky; top: 55px; z-index: 25;
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 10px 16px;
  background: var(--crit-bg); color: var(--crit);
  border-bottom: 1px solid var(--crit-line);
  font-weight: 600; font-size: 14px;
}
.freeze-glyph { font-size: 15px; }
/* Cuando los datos están congelados, todo el panel se apaga visualmente:
   así nadie confunde una lectura vieja con una actual. */
body.is-frozen .groups { opacity: .55; filter: saturate(.5); }

/* ════════════════════════════ layout ══════════════════════════════════ */
main {
  max-width: 1500px; margin: 0 auto;
  padding: var(--gap) max(14px, env(safe-area-inset-left)) 40px max(14px, env(safe-area-inset-right));
  display: flex; flex-direction: column; gap: var(--gap);
}

/* ═════════════════════ franja de estado (semáforo) ════════════════════ */
.band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--idle);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.band.state-ok   { border-left-color: var(--ok); }
.band.state-warn { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-bg) 0%, var(--surface) 22%); }
.band.state-crit { border-left-color: var(--crit); background: linear-gradient(90deg, var(--crit-bg) 0%, var(--surface) 22%); }

.band-main { display: flex; align-items: center; gap: 16px; }
.semaforo {
  width: 54px; height: 54px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--idle-line); background: var(--idle-bg); color: var(--idle);
}
.semaforo-glyph { font-size: 26px; font-weight: 700; line-height: 1; }
.band.state-ok   .semaforo { border-color: var(--ok-line);   background: var(--ok-bg);   color: var(--ok); }
.band.state-warn .semaforo { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.band.state-crit .semaforo {
  border-color: var(--crit-line); background: var(--crit-bg); color: var(--crit);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--crit) 40%, transparent); }
  50%     { box-shadow: 0 0 0 9px color-mix(in srgb, var(--crit) 0%, transparent); }
}
.band-text h1 { font-size: clamp(20px, 4.4vw, 27px); line-height: 1.15; }
.band.state-ok   .band-text h1 { color: var(--ok); }
.band.state-warn .band-text h1 { color: var(--warn); }
.band.state-crit .band-text h1 { color: var(--crit); }
.band-text p { font-size: 13.5px; }

.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 11px; border-radius: var(--r-s);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13.5px;
}
.alert .st-glyph { margin-top: 2px; }
.alert-level {
  flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 4px; margin-top: 1px;
  background: var(--idle-bg); color: var(--fg-2); border: 1px solid var(--idle-line);
}
.alert.state-crit { background: var(--crit-bg); border-color: var(--crit-line); }
.alert.state-crit .alert-level { background: var(--crit); color: var(--surface); border-color: var(--crit); }
.alert.state-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.alert.state-warn .alert-level { background: var(--warn); color: var(--surface); border-color: var(--warn); }
.alert-text { color: var(--fg); }

.issue-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-3); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-2);
  white-space: nowrap;
}
.chip--issue { cursor: pointer; }
.chip--issue:hover { border-color: var(--line-strong); }
.chip--issue.state-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip--issue.state-crit { background: var(--crit-bg); border-color: var(--crit-line); color: var(--crit); font-weight: 600; }
.chip--role { text-transform: uppercase; font-size: 10px; letter-spacing: .05em; font-weight: 700; }

/* ══════════════════════════ rejilla de grupos ═════════════════════════ */
.groups {
  display: grid; gap: var(--gap);
  grid-template-columns: 1fr;
  transition: opacity .3s, filter .3s;
}
@media (min-width: 700px)  { .groups { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); } }
@media (min-width: 1060px) {
  .group--wide { grid-column: 1 / -1; }
  /* Los grupos anchos (discos, volúmenes, tablas) ocupan la fila entera, así que
   * obligan a saltar de fila y dejaban columnas muertas: en un monitor de 1500px
   * la mitad derecha quedaba en blanco. `dense` deja que las tarjetas estrechas
   * que vienen después rellenen esos huecos. */
  .groups { grid-auto-flow: row dense; }
}

.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px 15px 15px;
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
  scroll-margin-top: 74px;
}
.group:focus { outline: none; }
.group.state-warn { border-color: var(--warn-line); }
.group.state-crit { border-color: var(--crit-line); box-shadow: var(--shadow), 0 0 0 1px var(--crit-line); }
.group.is-flash { animation: flash 1.4s ease-out; }
@keyframes flash {
  0%   { box-shadow: 0 0 0 3px var(--focus); }
  100% { box-shadow: var(--shadow); }
}

.g-head { display: flex; align-items: center; gap: 9px; }
.g-icon { font-size: 16px; color: var(--fg-3); flex: none; }
.g-title { font-size: 14.5px; letter-spacing: .01em; flex: 1 1 auto; min-width: 0; }
.g-badge {
  flex: none; font-size: 11px; font-weight: 700; color: var(--fg-3);
  background: var(--surface-3); border-radius: 999px; padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
.g-note { font-size: 12.5px; color: var(--fg-2); }
.g-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
/* Grupo sin lecturas: lo dice, y el `note` de al lado explica por qué.
   Un hueco mudo parecería un fallo del panel. */
.g-empty {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--fg-3);
  padding: 10px 12px; border-radius: var(--r-s);
  background: var(--surface-2); border: 1px dashed var(--line-strong);
}

/* ════════════════════════ medidores radiales ══════════════════════════ */
.gauge { display: block; overflow: visible; }
.g-track { fill: none; stroke: var(--surface-3); stroke-linecap: round; }
.g-zone  { fill: none; stroke-linecap: butt; opacity: .5; stroke-width: 3.2; }
.g-zone.state-ok   { stroke: var(--ok); }
.g-zone.state-warn { stroke: var(--warn); }
.g-zone.state-crit { stroke: var(--crit); }
.g-arc {
  fill: none; stroke: var(--idle); stroke-linecap: round;
  transition: stroke .35s ease;
}
.gauge.state-ok      .g-arc { stroke: var(--ok); }
.gauge.state-warn    .g-arc { stroke: var(--warn); }
.gauge.state-crit    .g-arc { stroke: var(--crit); }
.gauge.state-asleep  .g-arc { stroke: var(--info); opacity: .35; }
.gauge.state-unknown .g-arc,
.gauge.state-off     .g-arc { stroke: var(--fg-3); opacity: .4; }
.gauge.is-nodata     .g-arc { opacity: .18; }

.g-needle { stroke: var(--fg); stroke-width: 1.7; stroke-linecap: round; opacity: .8; }
.g-hub    { fill: var(--fg); opacity: .8; }
.g-val    { fill: var(--fg); font-family: var(--font); font-weight: 660; font-variant-numeric: tabular-nums; }
.g-unit   { fill: var(--fg-3); font-family: var(--font); font-size: 9.5px; font-weight: 600; }
.g-sub    { font-family: var(--font); font-size: 10px; font-weight: 700; }
.gauge.state-ok      .g-sub { fill: var(--ok); }
.gauge.state-warn    .g-sub { fill: var(--warn); }
.gauge.state-crit    .g-sub { fill: var(--crit); }
.gauge.state-asleep  .g-sub { fill: var(--info); }
.gauge.state-unknown .g-sub,
.gauge.state-off     .g-sub { fill: var(--fg-3); }

.gauge--large  .g-val { font-size: 19px; }
.gauge--medium .g-val { font-size: 20px; }
.gauge--mini   .g-val { font-size: 25px; }
.gauge--mini   .g-track { stroke: var(--surface-3); }

/* Lectura AÑEJA: hay número, pero es viejo. Se apaga —arco y número en gris,
   pista de fondo a trazos— para que no se lea como una medida viva. NO cambia
   el estado: un disco puede estar en verde con la temperatura en gris, y eso
   es correcto, no una contradicción.
   Ojo: NO se toca stroke-dasharray/offset del ARCO, que los escribe el tween
   con el valor; sólo se apaga el color. */
.gauge.is-stale .g-arc { stroke: var(--fg-3) !important; opacity: .55; }
.gauge.is-stale .g-track { stroke-dasharray: 1.5 2.5; }
.gauge.is-stale .g-zones { opacity: .22; }
.gauge.is-stale .g-val  { fill: var(--fg-3); }
.gauge.is-stale .g-unit { fill: var(--fg-3); opacity: .8; }
.gauge.is-stale .g-sub  { fill: var(--fg-3) !important; }
.gauge.is-stale .g-needle { stroke: var(--fg-3); opacity: .45; }
.gauge.is-stale .g-hub    { fill: var(--fg-3); opacity: .45; }

/* ══════════════════════════ sparklines ════════════════════════════════ */
.spark { display: block; width: 100%; }
.sp-line { fill: none; stroke: var(--idle); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.sp-area { fill: var(--idle); opacity: .10; stroke: none; }
.sp-dot  { fill: var(--idle); stroke: var(--surface); stroke-width: .8; }
.sp-base { stroke: var(--line); stroke-width: 1; }
.sp-empty { fill: var(--fg-3); font-family: var(--font); font-size: 7px; }
.spark.state-ok   .sp-line, .spark.state-ok   .sp-dot { stroke: var(--ok); }
.spark.state-ok   .sp-dot { fill: var(--ok); }
.spark.state-ok   .sp-area { fill: var(--ok); }
.spark.state-warn .sp-line { stroke: var(--warn); }
.spark.state-warn .sp-dot  { fill: var(--warn); stroke: var(--surface); }
.spark.state-warn .sp-area { fill: var(--warn); }
.spark.state-crit .sp-line { stroke: var(--crit); }
.spark.state-crit .sp-dot  { fill: var(--crit); stroke: var(--surface); }
.spark.state-crit .sp-area { fill: var(--crit); }
.m-spark { min-width: 0; }

/* ═══════════════════════════ métricas ═════════════════════════════════ */
.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row--primary { justify-content: flex-start; }

.metric { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.metric--large  { width: 158px; }
.metric--medium { width: 122px; }
.m-head { display: flex; align-items: center; gap: 5px; max-width: 100%; }
.m-label {
  font-size: 12px; color: var(--fg-2); font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.m-hint { font-size: 11px; color: var(--fg-3); text-align: center; line-height: 1.3; }
.metric .m-spark { width: 100%; }

/* tarjeta KPI (kind text/state, o kinds sin escala) */
.metric--stat {
  align-items: stretch; width: 100%; min-width: 130px; flex: 1 1 150px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 9px 11px; gap: 3px;
}
.metric--stat.state-warn { border-color: var(--warn-line); background: var(--warn-bg); }
.metric--stat.state-crit { border-color: var(--crit-line); background: var(--crit-bg); }
.stat-value { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.stat-num {
  font-size: 22px; font-weight: 680; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.stat-unit { font-size: 12px; color: var(--fg-3); font-weight: 600; }
.stat-trend { font-size: 11px; color: var(--fg-3); margin-left: auto; font-variant-numeric: tabular-nums; }
.tiles { display: flex; flex-wrap: wrap; gap: 9px; }

/* tira compacta: N mini-medidores del mismo tipo (p. ej. los núcleos) */
.strips { display: flex; flex-direction: column; gap: 10px; }
.strip {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 9px 10px 10px;
}
.strip.state-warn { border-color: var(--warn-line); }
.strip.state-crit { border-color: var(--crit-line); }
.strip-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.strip-title { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-3); }
.strip-summary { font-size: 11.5px; color: var(--fg-2); margin-left: auto; font-variant-numeric: tabular-nums; }
.strip-lane { display: flex; flex-wrap: wrap; gap: 7px; }
.mini { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 58px; }
.mini-label {
  font-size: 10.5px; color: var(--fg-3); font-weight: 650;
  font-variant-numeric: tabular-nums; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini.state-warn .mini-label { color: var(--warn); }
.mini.state-crit .mini-label { color: var(--crit); }

/* ═════════════════════════════ barras ═════════════════════════════════ */
.rows { display: flex; flex-direction: column; gap: 11px; }
.brow { display: flex; flex-direction: column; gap: 5px; }
.brow-head { display: flex; align-items: baseline; gap: 7px; font-size: 13px; }
.brow-label { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow-val { margin-left: auto; font-weight: 640; font-variant-numeric: tabular-nums; flex: none; }
.brow.state-warn .brow-val { color: var(--warn); }
.brow.state-crit .brow-val { color: var(--crit); }

.bar { width: 100%; }
.bar-track {
  position: relative; height: 12px; border-radius: 7px;
  background: var(--surface-3); overflow: hidden;
  border: 1px solid transparent;
}
.bar--thin .bar-track { height: 7px; border-radius: 4px; }
.bar-fill {
  position: absolute; inset: 0; z-index: 1;
  transform-origin: left center; transform: scaleX(0);
  background: var(--idle); border-radius: 7px;
  transition: background .35s ease;
}
.bar.state-ok   .bar-fill { background: var(--ok); }
.bar.state-warn .bar-fill { background: var(--warn); }
.bar.state-crit .bar-fill { background: var(--crit); }
.bar.state-unknown .bar-fill { background: var(--fg-3); opacity: .4; }
.bar-ticks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.bar-tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.bar-tick.tick-warn { background: var(--warn); opacity: .85; }
.bar-tick.tick-crit { background: var(--crit); opacity: .85; }
/* Sin montar: rayado. El relleno a 0 no debe leerse como «0 % usado». */
.bar.is-disabled .bar-track {
  background: repeating-linear-gradient(45deg,
    var(--crit-bg) 0 7px, var(--surface-3) 7px 14px);
  border-color: var(--crit-line);
}

/* ════════════════════════════ discos ══════════════════════════════════ */
.disks { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 11px; }
.disk {
  display: flex; flex-direction: column; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 10px 11px 11px; min-width: 0;
}
.disk.state-warn { border-color: var(--warn-line); }
.disk.state-crit { border-color: var(--crit-line); background: var(--crit-bg); }
.disk.is-asleep  { background: var(--surface); }
.disk-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.disk-label { font-weight: 640; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disk-head .chip--role { margin-left: auto; }
.disk-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.disk-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 11.5px; color: var(--fg-2); }
.disk-model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-3); }
.disk-cap { font-weight: 640; color: var(--fg); font-size: 13px; font-variant-numeric: tabular-nums; }
.disk-src { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--fg-3); }
/* Frescura de la lectura: se nota, pero no grita.
   ● lleno = en vivo (drivetemp/nvme) · ◌ hueco = indirecta · ◌ punteado = añeja */
.freshdot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--fg-3); }
.freshdot.is-fresh { background: var(--ok); }
.freshdot.is-indirect { background: transparent; border: 1.5px solid var(--fg-3); width: 8px; height: 8px; }
.freshdot.is-stale { background: transparent; border: 1.5px dotted var(--fg-2); width: 8px; height: 8px; }
/* Añeja: gris, no ámbar. No es un aviso — es un dato viejo y punto. */
.disk-src.is-stale { color: var(--fg-2); font-style: italic; }
.disk-note {
  font-size: 11px; line-height: 1.35; color: var(--fg-2);
  padding: 6px 8px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line);
}
.disk.is-asleep .disk-note, .disk.state-crit .disk-note { background: var(--surface-2); }

/* 💤 disco dormido: normal y frecuente, no un fallo */
.disk-sleep {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  font-size: 12px; padding: 5px 8px; border-radius: 6px;
  background: var(--info-bg); border: 1px solid var(--info-line);
}
.disk-sleep .zzz { font-size: 12px; }
.sleep-word { font-weight: 640; color: var(--info); }
.sleep-last { color: var(--fg-3); font-variant-numeric: tabular-nums; }

.smart { display: flex; flex-direction: column; gap: 1px; margin: 0; }
.smart-row { display: flex; align-items: baseline; gap: 8px; font-size: 11.5px; }
.smart dt { color: var(--fg-3); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart dd {
  margin: 0; flex: none; color: var(--fg-2); font-variant-numeric: tabular-nums;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.smart-val.is-nonzero { color: var(--warn); font-weight: 700; }
.smart-val.is-good { color: var(--ok); font-weight: 640; }
.smart-val.is-bad  { color: var(--crit); font-weight: 700; }

/* ═══════════════════════════ volúmenes ════════════════════════════════ */
.vols { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 12px; }
.vol {
  display: flex; flex-direction: column; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 11px 12px 12px; min-width: 0;
}
.vol.state-warn { border-color: var(--warn-line); }
.vol.state-crit { border-color: var(--crit-line); }
/* `primary: true` — el volumen que importa (aquí, el pool). */
.vol.is-primary { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.vol.is-primary .vol-label { font-size: 15px; }
/* Un montaje caído es el fallo más peligroso de esta máquina: rojo grande. */
.vol.is-unmounted {
  border: 2px solid var(--crit); background: var(--crit-bg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 14%, transparent);
}
.vol-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; min-width: 0; }
.vol-label { font-weight: 640; font-size: 14px; }
.vol-path { color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vol-alarm {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 9px 11px; border-radius: var(--r-s);
  background: var(--crit); color: #fff;
}
.alarm-glyph { font-size: 17px; font-weight: 800; }
.alarm-title { font-size: 15px; font-weight: 800; letter-spacing: .08em; }
.alarm-txt { font-size: 11.5px; opacity: .93; flex: 1 1 100%; }
.vol-foot { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.vol-pct { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.vol.state-warn .vol-pct { color: var(--warn); }
.vol.state-crit .vol-pct { color: var(--crit); }
.vol-pct.is-void { color: var(--fg-3); text-decoration: line-through; text-decoration-thickness: 2px; }
.vol-nums { font-size: 12px; color: var(--fg-2); font-variant-numeric: tabular-nums; }

.vol-branches { font-size: 12px; }
.vol-branches summary { cursor: pointer; color: var(--fg-3); padding: 2px 0; }
.vol-branches summary.has-down { color: var(--crit); font-weight: 640; }
.branches { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 2px; }
.branch { display: flex; flex-direction: column; gap: 3px; }
.br-head { display: flex; align-items: baseline; gap: 8px; font-size: 11.5px; }
.br-path { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-nums { margin-left: auto; color: var(--fg-3); flex: none; font-variant-numeric: tabular-nums; }
.branch.is-unmounted .br-nums { color: var(--crit); font-weight: 700; }

/* ════════════════════════════ tablas ══════════════════════════════════ */
.tablewrap { overflow-x: auto; }
.gtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.gtable th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-3); font-weight: 700; padding: 5px 10px 5px 0; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.gtable td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); color: var(--fg-2); white-space: nowrap; }
.gtable tr:last-child td { border-bottom: 0; }
.gtable tr.state-warn td { background: var(--warn-bg); }
.gtable tr.state-crit td { background: var(--crit-bg); color: var(--crit); }
.ta-right { text-align: right; }
.ta-center { text-align: center; }
.empty { color: var(--fg-3); font-size: 13px; font-style: italic; }

/* ═══════════════════ lecturas no disponibles (degraded) ═══════════════ */
.degraded {
  background: var(--surface); border: 1px dashed var(--line-strong);
  border-radius: var(--r); padding: 13px 15px 15px;
  display: flex; flex-direction: column; gap: 9px;
}
.degraded h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-3); }
.degraded ul { display: flex; flex-direction: column; gap: 8px; }
.dg { display: flex; gap: 10px; align-items: flex-start; }
.dg-glyph { color: var(--fg-3); font-size: 15px; line-height: 1.3; flex: none; }
.dg-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dg-label { font-size: 13px; color: var(--fg-2); font-weight: 640; }
.dg-reason { font-size: 12.5px; color: var(--fg-3); }
.dg-fix { font-size: 12px; color: var(--info); }

/* ═══════════════════════════════ pie ══════════════════════════════════ */
.foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--fg-3); padding: 0 2px;
}
.tiers { display: flex; gap: 6px; flex-wrap: wrap; }
.tier {
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.tier.is-late { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
#agent-ver { margin-left: auto; }

/* ════════════════════════════ login ═══════════════════════════════════ */
.login { min-height: 82vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(360px, 100%);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 26px 24px 24px;
  display: flex; flex-direction: column; gap: 9px;
}
.login-brand { display: flex; align-items: baseline; gap: 8px; font-size: 21px; }
.login-lead { color: var(--fg-2); font-size: 13.5px; margin-bottom: 8px; }
.login-card label { font-size: 12.5px; font-weight: 640; color: var(--fg-2); }
.login-card input {
  font: inherit; padding: 10px 12px; border-radius: var(--r-s);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--fg);
  width: 100%;
}
.login-card input:focus-visible { border-color: var(--focus); }
.btn {
  margin-top: 6px; padding: 10px 14px; border-radius: var(--r-s);
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-weight: 640; cursor: pointer; transition: filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: progress; }
.login-msg { font-size: 12.5px; color: var(--fg-2); min-height: 1em; }
.login-msg.is-error { color: var(--crit); font-weight: 600; }

.noscript { max-width: 600px; margin: 60px auto; padding: 16px; color: var(--fg-2); }

/* ═════════════════════ movimiento reducido ════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════ móvil (columna única) ═══════════════════════ */
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .brand-name { display: none; }
  .pill { font-size: 11.5px; padding: 3px 8px; }
  main { padding: 10px 10px 32px; gap: 11px; }
  .band { padding: 13px 14px; border-radius: 10px; }
  .semaforo { width: 44px; height: 44px; }
  .semaforo-glyph { font-size: 21px; }
  .group { padding: 12px 12px 13px; }
  .row { gap: 10px; justify-content: space-around; }
  .metric--large { width: 138px; }
  .metric--medium { width: 106px; }
  .disks { grid-template-columns: 1fr; }
  .vols { grid-template-columns: 1fr; }
  .freeze { top: 51px; padding: 8px 12px; font-size: 13px; }
}
