/* ============================================================================
   QBridge Pro - Capa de tema Breeze (self-hosted, CSP-safe)
   ----------------------------------------------------------------------------
   Esta hoja SUSTITUYE al antiguo tema dark propio. Ahora complementa el theme
   Breeze/Bootstrap compilado en /ui/vendor/css/style.css (cargado ANTES).
   Objetivos:
     - Mapear las clases-componente propias que usan las 37 partials
       (panel/view, section-title, chart-card, services-card, kpi, grid*,
        config-summary-grid, live-badge, badges, botones) a la estetica Breeze.
     - Estilar login, banner de sistema y el colapso del drawer.
   Reglas: sin CDN, sin inline; conserva TODOS los ids/data-view/data-action.
   ========================================================================== */

:root {
  /* Paleta corporativa INQTEL S.A.S (logo): azul institucional, celeste y rojo */
  --qb-primary: #1c4e9d;      /* azul INQTEL (TEL) */
  --qb-primary-2: #143a77;    /* azul oscuro para hover/activo */
  --qb-accent: #29abe2;       /* celeste INQTEL (IN) */
  --qb-danger-brand: #e31e24; /* rojo INQTEL (Q) */
  --qb-bg: #eef2f7;           /* fondo gris azulado claro */
  --qb-surface: #ffffff;
  --qb-line: #e2e8f0;
  --qb-text: #1f2937;
  --qb-muted: #64748b;
  --qb-ok: #1bcfb4;
  --qb-warn: #fed713;
  --qb-error: #e31e24;
  --qb-info: #29abe2;
  --qb-radius: 6px;
  --qb-shadow: 0 1px 15px 1px rgba(20, 58, 119, 0.08);
  --qb-sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--qb-bg);
  color: var(--qb-text);
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.875rem;
}

/* ---------- Utilidades comunes ---------- */
.muted, .text-muted { color: var(--qb-muted) !important; }
.note-muted { color: var(--qb-muted); font-size: 0.82rem; }
.mt-8 { margin-top: 0.5rem; }
.ml-8 { margin-left: 0.5rem; }
code {
  background: #eef3f9;
  color: var(--qb-primary-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* ============================================================================
   LOGIN
   ========================================================================== */
.qb-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #29abe2 0, #143a77 100%);
}
.qb-login__card {
  width: 100%;
  max-width: 420px;
  background: var(--qb-surface);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(31, 31, 31, 0.25);
  padding: 2rem;
}
.qb-login__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.qb-login__logo {
  width: 72px; height: 72px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px; overflow: hidden; background: #fff; padding: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.qb-login__logo .qb-logo-img { width: 100%; height: 100%; border-radius: 0; object-fit: contain; }
/* Doc 37 S2: CAPTCHA local (SVG inline del API) y codigos de recuperacion. */
.qb-captcha-img { width: 180px; height: 60px; overflow: hidden; }
.qb-captcha-img svg { width: 100%; height: 100%; display: block; }
.qb-recovery-codes { font-size: 0.95rem; letter-spacing: 0.05em; user-select: all; }
.qb-logo-img { width: 34px; height: 34px; display: block; border-radius: 8px; object-fit: contain; background: #fff; }
.sidebar-brand .qb-logo-img { width: 36px; height: 36px; flex: 0 0 auto; padding: 2px; }
.sidebar-brand-text { white-space: nowrap; }

/* Footer corporativo INQTEL */
.qb-footer {
  margin-top: auto;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--qb-line);
  background: var(--qb-surface);
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem;
  justify-content: space-between; align-items: center;
  font-size: 0.75rem; color: var(--qb-muted);
}
.qb-footer strong { color: var(--qb-primary); }
.qb-login__copy {
  margin: 0.85rem 0 0; text-align: center;
  font-size: 0.7rem; color: var(--qb-muted); line-height: 1.5;
}
.qb-login__brand h1 { margin: 0; font-size: 1.15rem; }
.qb-login__brand p { margin: 0; font-size: 0.78rem; color: var(--qb-muted); }
.qb-login h2 { margin: 0 0 1rem; font-size: 1.05rem; color: var(--qb-text); }
.qb-login .hint {
  margin-top: 1rem; font-size: 0.78rem; color: var(--qb-muted); line-height: 1.5;
}
.btn-block { display: block; width: 100%; }

/* ============================================================================
   SHELL: sidebar + navbar + content (sobre estructura Breeze)
   ========================================================================== */
.container-scroller { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--qb-sidebar-w);
  min-width: var(--qb-sidebar-w);
  background: var(--qb-surface);
  border-right: 1px solid var(--qb-line);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: width 0.25s ease, min-width 0.25s ease, transform 0.25s ease;
}
.sidebar-brand-wrapper {
  height: 64px;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--qb-line);
  position: sticky; top: 0;
  background: var(--qb-surface);
  z-index: 1;
  display: flex;
  align-items: center;
}
.sidebar-brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--qb-primary); font-weight: 800; font-size: 1.05rem;
  text-decoration: none;
}
/* NEUTRALIZACION VENDOR: Breeze estira el logo del brand a 130x48px con
   padding 2.25rem/40px (por eso se veia deforme y descuadrado). */
.sidebar .sidebar-brand-wrapper { height: 64px; width: auto; }
.sidebar .sidebar-brand-wrapper .sidebar-brand {
  padding: 0;
  display: inline-flex; align-items: center; gap: 0.6rem;
}
.sidebar .sidebar-brand-wrapper .sidebar-brand img {
  width: 36px; height: 36px; margin: 0; border-radius: 8px; object-fit: contain; background: #fff; padding: 2px;
}
.sidebar-brand .mdi { font-size: 1.5rem; }
.sidebar .nav { list-style: none; margin: 0; padding: 0.5rem 0 2rem; }
.sidebar .nav-category {
  padding: 1rem 1.5rem 0.35rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--qb-muted);
}
.sidebar .nav-item { margin: 0; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; background: transparent; border-radius: 0; text-align: left;
  padding: 0.7rem 1.5rem;
  color: #37474f; text-decoration: none; font-size: 0.86rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar .nav-link .menu-icon { font-size: 1.15rem; color: var(--qb-muted); }
.sidebar .nav-link:hover { background: #eaf3fb; color: var(--qb-primary-2); }
.sidebar .nav-link:hover .menu-icon { color: var(--qb-primary-2); }
.sidebar .nav-link.active {
  background: #e3eefc;
  color: var(--qb-primary-2);
  border-left-color: var(--qb-accent);
  font-weight: 600;
}
.sidebar .nav-link.active .menu-icon { color: var(--qb-primary); }

/* Page wrapper + main panel */
.page-body-wrapper {
  flex: 1;
  margin-left: var(--qb-sidebar-w);
  min-width: 0;
  padding: 0;
  transition: margin-left 0.25s ease;
}
.main-panel { min-height: 100vh; display: flex; flex-direction: column; }

/* Navbar superior.
   NEUTRALIZACION VENDOR: el style.css de Breeze define su propio navbar
   oscuro (left:260px, wrapper negro 70px con width calc(100% - 260px) y
   oculta el hamburguesa en <=991px). Como el navbar vive DENTRO de
   .main-panel (que ya lleva margin-left del sidebar), esas reglas lo
   descuadraban: franja negra corrida, hueco superior y vacio a la derecha.
   Se anulan aqui con mayor especificidad. */
.main-panel .navbar {
  height: 64px;
  min-height: 64px;
  background: var(--qb-surface);
  border-bottom: 1px solid var(--qb-line);
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  left: 0;                    /* anula left:260px del vendor */
  width: 100%;
  z-index: 1020;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}
.navbar .navbar-menu-wrapper {
  width: 100% !important;      /* anula calc(100% - 260px) del vendor */
  height: 100% !important;     /* anula height:70px del vendor */
  background: transparent !important;  /* anula fondo negro del vendor */
  color: inherit !important;
  padding: 0 !important;
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: nowrap;
  min-width: 0;
}
/* El vendor oculta el hamburguesa en <=991px: SIEMPRE visible (en movil es
   la unica forma de abrir el menu). */
.navbar .navbar-menu-wrapper .navbar-toggler,
.navbar .navbar-menu-wrapper .navbar-toggler:not(.navbar-toggler-right) {
  display: inline-flex !important;
  align-items: center;
  background: transparent; border: 0; color: #37474f;
  font-size: 1.5rem; cursor: pointer; padding: 0.25rem 0.5rem;
  border-radius: var(--qb-radius);
}
.navbar .navbar-menu-wrapper .navbar-toggler i { font-size: 1.5rem; }
.navbar .navbar-menu-wrapper .navbar-toggler i:before {
  width: auto; height: auto; background: transparent; line-height: 1;
}
.navbar-toggler:hover { background: #e3eefc; color: var(--qb-primary-2); }
.navbar-brand-mini { min-width: 0; overflow: hidden; }
.navbar-brand-mini h1 { margin: 0; font-size: 1.05rem; line-height: 1.2; white-space: nowrap; }
.navbar-brand-mini p { margin: 0; font-size: 0.75rem; line-height: 1.2; white-space: nowrap; }
.navbar-nav {
  list-style: none; display: flex; align-items: center; gap: 0.85rem;
  margin: 0; padding: 0;
}
.navbar .navbar-menu-wrapper .navbar-nav .nav-item {
  display: flex; align-items: center;
  border-left: 0;              /* anula separadores oscuros del vendor */
  padding-left: 0; padding-right: 0;
}

.privileges-chip {
  font-size: 0.72rem; font-weight: 600;
  padding: 0.3rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--qb-ok); color: var(--qb-ok);
  background: rgba(27, 207, 180, 0.08);
}

/* Content */
.content-wrapper { padding: 1.5rem; flex: 1; }
.content { min-width: 0; }

/* Drawer colapsado (movil = overlay, desktop = oculto) */
#app-panel.drawer-collapsed .sidebar { transform: translateX(-100%); }
#app-panel.drawer-collapsed .page-body-wrapper { margin-left: 0; }
#app-panel.sidebar-icon-only .sidebar {
  width: 70px;
  min-width: 70px;
}
#app-panel.sidebar-icon-only .page-body-wrapper { margin-left: 70px; }
#app-panel.sidebar-icon-only .sidebar-brand-wrapper {
  justify-content: center;
  padding: 0;
}
#app-panel.sidebar-icon-only .sidebar-brand-text,
#app-panel.sidebar-icon-only .sidebar .nav-category,
#app-panel.sidebar-icon-only .sidebar .menu-title { display: none; }
#app-panel.sidebar-icon-only .sidebar .nav { padding-top: 0.75rem; }
#app-panel.sidebar-icon-only .sidebar .nav-link {
  justify-content: center;
  gap: 0;
  padding: 0.8rem 0;
}
#app-panel.sidebar-icon-only .sidebar .nav-link .menu-icon {
  margin: 0;
  font-size: 1.3rem;
}
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 1029;
}

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .page-body-wrapper { margin-left: 0 !important; }
  /* En movil el sidebar SIEMPRE es offcanvas a ancho completo: la preferencia
     desktop icon-only no debe encoger ni ocultar los textos del menu. */
  #app-panel.sidebar-icon-only .sidebar {
    width: var(--qb-sidebar-w);
    min-width: var(--qb-sidebar-w);
  }
  #app-panel.sidebar-icon-only .sidebar-brand-text,
  #app-panel.sidebar-icon-only .sidebar .nav-category,
  #app-panel.sidebar-icon-only .sidebar .menu-title { display: block; }
  #app-panel.sidebar-icon-only .sidebar .nav-link {
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 1.5rem;
  }
  #app-panel:not(.drawer-collapsed) .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.25);
  }
  .main-panel .navbar { padding: 0 0.75rem; }
  .navbar-nav { gap: 0.5rem; }
  .navbar-brand-mini p { display: none; }
  .content-wrapper { padding: 1rem 0.75rem; }
}

/* Movil chico: que nada desborde en pantallas de celular */
@media (max-width: 576px) {
  .navbar-brand-mini h1 { font-size: 0.95rem; }
  #session-state { display: none; }        /* gana espacio para el boton salir */
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
  .chart-row { grid-template-columns: 1fr; }
  .config-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-wrapper { padding: 0.75rem 0.5rem; }
  .panel { padding: 1rem; }
  .qb-footer { justify-content: center; text-align: center; }
}

/* ============================================================================
   VISTAS: panel/view -> card Breeze
   ========================================================================== */
.view { }
.view[hidden] { display: none !important; }
.panel {
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius);
  box-shadow: var(--qb-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.panel.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }

/* Encabezado de seccion */
.section-title {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--qb-line);
}
.section-title h2 { margin: 0 0 0.25rem; font-size: 1.25rem; }
.section-title h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.section-title p { margin: 0; }
.section-title__actions, .title-actions {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.section-actions { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }

/* Patron operativo compartido para las vistas del panel */
.view-intro { max-width: 760px; color: var(--qb-muted); line-height: 1.55; }
.status-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem; margin-bottom: 1rem;
}
.status-card {
  min-width: 0; padding: 0.9rem 1rem; border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius); background: #faf8fc;
}
.status-card__label { display: block; margin-bottom: 0.3rem; color: var(--qb-muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.035em; text-transform: uppercase; }
.status-card__value { display: flex; align-items: center; gap: 0.45rem; color: var(--qb-text); font-size: 0.95rem; font-weight: 700; overflow-wrap: anywhere; }
.status-indicator { width: 10px; height: 10px; flex: none; border-radius: 50%; background: #aab2bd; box-shadow: 0 0 0 3px rgba(170, 178, 189, 0.18); }
.status-indicator--on { background: var(--qb-ok); box-shadow: 0 0 0 3px rgba(27, 207, 180, 0.2); }
.status-indicator--warn { background: var(--qb-warn); box-shadow: 0 0 0 3px rgba(254, 215, 19, 0.22); }
.status-indicator--error { background: var(--qb-error); box-shadow: 0 0 0 3px rgba(254, 124, 150, 0.2); }
.action-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  flex-wrap: wrap; margin-top: 1rem; padding: 0.85rem 1rem;
  border: 1px solid var(--qb-line); border-radius: var(--qb-radius); background: #faf8fc;
}
.action-bar__help { flex: 1 1 280px; margin: 0; color: var(--qb-muted); font-size: 0.8rem; line-height: 1.45; }
.action-bar__buttons { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.form-section { margin-bottom: 1.25rem; border: 1px solid var(--qb-line); border-radius: var(--qb-radius); background: #fff; overflow: hidden; }
.form-section__head { padding: 0.9rem 1rem; border-bottom: 1px solid var(--qb-line); background: #faf8fc; }
.form-section__head h3 { margin: 0 0 0.2rem; color: var(--qb-text); font-size: 0.98rem; }
.form-section__head p { margin: 0; color: var(--qb-muted); font-size: 0.78rem; line-height: 1.45; }
.form-section__body { padding: 1rem; }
.validation-box { padding: 0.8rem 1rem; border-left: 4px solid #aab2bd; border-radius: var(--qb-radius); background: #f7f8fa; color: #4b5763; line-height: 1.5; }
.validation-box--ok { border-left-color: var(--qb-ok); background: #effcf9; color: #087d6b; }
.validation-box--warn { border-left-color: var(--qb-warn); background: #fffbea; color: #725f00; }
.validation-box--error { border-left-color: var(--qb-error); background: #fff2f5; color: #a82343; }
.wizard-flow { display: grid; gap: 0.85rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.wizard-step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--qb-line); border-radius: var(--qb-radius); background: #fff; }
.wizard-step__number { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #e3eefc; color: var(--qb-primary-2); font-weight: 800; }
.wizard-step__body h3 { margin: 0 0 0.25rem; color: var(--qb-text); font-size: 0.95rem; }
.wizard-step__body p { margin: 0 0 0.35rem; color: #4e5964; font-size: 0.8rem; line-height: 1.45; }
.wizard-step__result { color: #087d6b; font-size: 0.73rem; font-weight: 600; }
.wizard-step__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.wizard-step--final { border-left: 5px solid var(--qb-ok); background: #f3fffc; }

/* ============================================================================
   TARJETAS: card / chart-card / services-card
   ========================================================================== */
.card, article.card {
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius);
  box-shadow: var(--qb-shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card h3 { margin: 0 0 0.85rem; font-size: 1rem; }

.chart-card {
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius);
  box-shadow: var(--qb-shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.chart-card__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.chart-card__head h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.chart-card__head p { margin: 0; }
.chart-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; margin-bottom: 0.85rem;
}
/* Contenedor de canvas: alto fijo para que charts.js no se recorte */
.chart-card canvas, .chart-wrap canvas { max-width: 100%; }
.chart-wrap { position: relative; min-height: 240px; }

.services-card {
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius);
  box-shadow: var(--qb-shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.services-card__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.services-card__header h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.services-card__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.services-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.services-updated { margin-top: 0.85rem; font-size: 0.8rem; }
.dashboard-operational-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.dashboard-operational-grid .chart-card { margin-bottom: 0; }
.operational-card { min-width: 0; }
.operational-card .config-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.services-item {
  display: flex; flex-direction: column; min-width: 0; min-height: 210px;
  padding: 1rem; border: 1px solid var(--qb-line); border-left: 5px solid #aab2bd;
  border-radius: var(--qb-radius); background: #fff; box-shadow: 0 2px 8px rgba(31, 31, 31, 0.06);
}
.services-item--active { border-left-color: var(--qb-ok); background: #f3fffc; }
.services-item--inactive { border-left-color: #aab2bd; background: #f7f8fa; }
.services-item--error, .services-item--missing { border-left-color: var(--qb-error); background: #fff5f7; }
.services-item__header { display: grid; gap: 0.65rem; }
.services-item__header h4 { margin: 0 0 0.15rem; color: var(--qb-text); font-size: 0.95rem; line-height: 1.3; }
.services-item__unit { margin: 0; font-size: 0.75rem; overflow-wrap: anywhere; }
.services-item__status { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.services-dot { width: 10px; height: 10px; border-radius: 50%; background: #aab2bd; box-shadow: 0 0 0 3px rgba(170, 178, 189, 0.18); }
.services-item--active .services-dot { background: var(--qb-ok); box-shadow: 0 0 0 3px rgba(27, 207, 180, 0.18); }
.services-item--error .services-dot, .services-item--missing .services-dot { background: var(--qb-error); }
.services-item__state { color: var(--qb-text); font-size: 0.8rem; font-weight: 700; }
.services-badge { padding: 0.15rem 0.45rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; }
.services-badge--ok { color: #087d6b; background: rgba(27, 207, 180, 0.16); }
.services-badge--warn { color: #806800; background: rgba(254, 215, 19, 0.2); }
.services-item__desc { flex: 1 1 auto; margin: 0.8rem 0; color: #4e5964; font-size: 0.8rem; line-height: 1.5; }
.services-item__error { color: #b72d4b; font-size: 0.75rem; overflow-wrap: anywhere; }
.services-item__actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding-top: 0.75rem; border-top: 1px solid var(--qb-line); }
.service-power {
  min-width: 112px; font-weight: 700; border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.service-power--on:not(:disabled) { background: #07866f; border-color: #07866f; color: #fff; }
.service-power--off:not(:disabled) { background: #d93656; border-color: #d93656; color: #fff; }
.service-power:not(:disabled):hover { filter: brightness(0.92); transform: translateY(-1px); }
.service-power:disabled {
  background: #e3e7ec !important; border-color: #c9d0d8 !important;
  color: #68737f !important; opacity: 1 !important; box-shadow: none; cursor: not-allowed;
}
.service-power__icon { margin-right: 0.3rem; }
.service-restart { margin-left: auto; }
.service-locked { padding: 0.45rem 0.65rem; border-radius: var(--qb-radius); background: #edf0f4; color: #59636e; font-size: 0.75rem; font-weight: 700; }
.datapath-actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; margin-top: 0.85rem; padding-top: 0.85rem; border-top: 1px solid var(--qb-line); }

/* ============================================================================
   REJILLAS
   ========================================================================== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.grid-auto-320 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.grid-auto-200 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.85rem; }
.grid-auto-180 { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.85rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; align-items: start; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.config-summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.85rem;
}
.config-summary-grid > div {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.75rem; background: #faf8fc; border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius);
}
.config-summary-grid strong { font-size: 1.05rem; }

/* ============================================================================
   KPIs (dashboard / dpi-live)
   ========================================================================== */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem;
  margin-bottom: 1.25rem;
}
.kpi {
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-radius: var(--qb-radius);
  box-shadow: var(--qb-shadow);
  padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.35rem;
  border-top: 3px solid var(--qb-primary);
}
.kpi--rx { border-top-color: var(--qb-info); }
.kpi--tx { border-top-color: var(--qb-primary); }
.kpi--drops { border-top-color: var(--qb-error); }
.kpi--latency { border-top-color: var(--qb-warn); }
.kpi header { display: flex; align-items: baseline; justify-content: space-between; }
.kpi__label { font-size: 0.8rem; color: var(--qb-muted); font-weight: 600; }
.kpi__unit { font-size: 0.72rem; color: var(--qb-muted); }
.kpi__value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.kpi__spark { width: 100%; height: 44px; display: block; }
.kpi__foot { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--qb-muted); }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.85rem; }
.card.metric { display: flex; flex-direction: column; gap: 0.35rem; }

/* Tiles KPI genericos (renderKpis): cache, IA, DNS bloqueo, etc. */
#cache-runtime, #cache-divert-kpis, #ai-runtime {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.85rem; margin: 0 0 1rem;
}
.metric {
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-left: 3px solid var(--qb-primary);
  border-radius: var(--qb-radius);
  padding: 0.75rem 0.95rem;
  display: flex; flex-direction: column; gap: 0.2rem; min-width: 0;
}
.metric > span { font-size: 0.74rem; color: var(--qb-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.metric > strong, .metric > b { font-size: 1.35rem; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric > small { font-size: 0.7rem; color: var(--qb-muted); }
.metric--ok { border-left-color: var(--qb-info); }
.metric--warn { border-left-color: var(--qb-warn); }
.metric--bad { border-left-color: var(--qb-error); }
.metric-label { font-size: 0.8rem; color: var(--qb-muted); font-weight: 600; }
.metric-value { font-size: 1.5rem; font-weight: 700; }

/* KPI internals (dashboard): posicionamiento, gauge y colores de subtitulo */
.kpi { position: relative; overflow: hidden; }
.kpi__gauge { display: block; width: 100%; height: 72px; }
/* FIX movil (dpr>1): un canvas SIN altura CSS entra en bucle de crecimiento:
   prepareCanvas fija height=rect*dpr, el layout crece a ese valor, el
   siguiente tick vuelve a multiplicar... y la tarjeta "CPU del sistema"
   empujaba todo el dashboard con blanco infinito. Altura fija = sin bucle. */
#sysres-cpu-gauge, #sysres-mem-gauge { display: block; width: 100%; height: 90px; }
.kpi__foot > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kpi__foot [data-sub] { color: #12a893; }
.kpi--drops .kpi__foot [data-sub] { color: #e34d6c; }
.kpi--latency .kpi__foot [data-sub] { color: #b7960a; }

/* Filas de graficas grandes */
.chart-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.15rem; margin: 0 0 1.5rem;
}
.chart-card__head h3 { color: var(--qb-primary-2); }
/* IMPORTANTE: alto fijo del canvas. Sin esto prepareCanvas() ve height~0,
   devuelve null y las graficas dejan de repintarse tras el primer frame.
   240px da espacio real a 5 etiquetas del eje Y + eje X sin solaparse. */
.chart-canvas {
  display: block; width: 100%; height: 240px;
  border-radius: 8px; background: #faf8fc;
}
#chart-dpi.chart-canvas, #chart-qos.chart-canvas { height: 240px; }

.chart-legend { display: inline-flex; gap: 0.9rem; font-size: 0.8rem; color: var(--qb-muted); flex-wrap: wrap; }
.chart-legend__item { display: inline-flex; gap: 0.35rem; align-items: center; }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.chart-legend .dot.rx  { background: #198ae3; }
.chart-legend .dot.tx  { background: #1bcfb4; }
.chart-legend .dot.lat { background: #fed713; }
.chart-legend .dot.jit { background: #29abe2; }

.chart-badge--ok   { background: rgba(27, 207, 180, 0.15); color: #12a893; }
.chart-badge--warn { background: rgba(254, 215, 19, 0.18); color: #b7960a; }
.chart-badge--bad  { background: rgba(254, 124, 150, 0.15); color: #e34d6c; }
.chart-badge--good { background: rgba(27, 207, 180, 0.15); color: #12a893; }

/* Tiles de resumen de configuracion */
.summary-tile {
  border: 1px solid var(--qb-line); border-radius: var(--qb-radius);
  padding: 0.7rem 0.85rem; background: #faf8fc; display: grid; gap: 0.3rem;
}
.summary-tile h4 { margin: 0; font-size: 0.78rem; color: var(--qb-muted); font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; }
.summary-tile__pill { justify-self: start; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.summary-tile__pill--on  { background: rgba(27, 207, 180, 0.18); color: #12a893; }
.summary-tile__pill--off { background: rgba(254, 124, 150, 0.15); color: #e34d6c; }
.summary-tile__pill--warn{ background: rgba(254, 215, 19, 0.18); color: #b7960a; }
.summary-tile__value { font-size: 1.05rem; color: var(--qb-text); font-variant-numeric: tabular-nums; }
.summary-tile__hint  { color: var(--qb-muted); font-size: 0.78rem; }

/* Tiles genericos (panel de optimizacion) */
.tile { border: 1px solid var(--qb-line); border-radius: var(--qb-radius); padding: 0.7rem 0.85rem; background: #faf8fc; }
.tile > .muted { font-size: 0.75rem; }

/* Item de evento / hints IA */
.event-item { background: #faf8fc; border-radius: var(--qb-radius); margin-bottom: 0.5rem; }
.link-button { background: transparent; color: var(--qb-primary-2); padding: 0; font-weight: 600; text-decoration: underline; }
.link-button:hover { background: transparent; color: var(--qb-primary); }

/* Live badge poll */
.live-badge--poll { background: rgba(254, 215, 19, 0.18); color: #b7960a; }
.live-badge--poll .live-dot { background: var(--qb-warn); }

/* Helpers usados por partials */
.mt-10 { margin-top: 0.625rem; }
.inline-check { display: inline-flex; align-items: center; gap: 0.4rem; }
.inline-check input { width: auto; }
.w-110 { width: 110px; }
.chart-title { color: var(--qb-text); }

/* ============================================================================
   BADGES / estado
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.28rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; line-height: 1;
}
.badge-neutral { background: #eceff1; color: #546e7a; }
.badge-good, .text-bg-success { background: rgba(27, 207, 180, 0.15); color: #12a893; }
.badge-warn, .text-bg-warning { background: rgba(254, 215, 19, 0.18); color: #b7960a; }
.badge-danger, .text-bg-danger { background: rgba(254, 124, 150, 0.15); color: #e34d6c; }
.badge-hot { background: rgba(254, 124, 150, 0.15); color: #e34d6c; padding: 0.15rem 0.45rem; border-radius: 4px; font-size: 0.68rem; font-weight: 700; }
.badge-outline-success { border: 1px solid var(--qb-ok); color: var(--qb-ok); background: transparent; }
.chart-badge {
  background: #e3eefc; color: var(--qb-primary-2);
  padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600;
}

/* Funciones del Motor: chips de estado por modulo (dashboard) */
.module-strip { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.module-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.65rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  background: #eceff1; color: #546e7a;
  border: 1px solid transparent;
}
.module-chip__dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa7b1; flex: none; }
.module-chip--success { background: rgba(27, 207, 180, 0.15); color: #12a893; border-color: rgba(27, 207, 180, 0.35); }
.module-chip--success .module-chip__dot { background: var(--qb-ok); }
.module-chip--warning { background: rgba(254, 215, 19, 0.18); color: #b7960a; border-color: rgba(254, 215, 19, 0.4); }
.module-chip--warning .module-chip__dot { background: #d9b40c; }
.module-chip--danger { background: rgba(254, 124, 150, 0.15); color: #e34d6c; border-color: rgba(254, 124, 150, 0.35); }
.module-chip--danger .module-chip__dot { background: #e34d6c; }
.module-chip--secondary { background: #eceff1; color: #78838f; border-color: #dde3e8; }

/* Live badge */
.live-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.65rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  background: #eceff1; color: #546e7a;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa7b1; }
.live-badge--on { background: rgba(27, 207, 180, 0.15); color: #12a893; }
.live-badge--on .live-dot { background: var(--qb-ok); box-shadow: 0 0 0 3px rgba(27, 207, 180, 0.25); }
.live-badge--off { background: #eceff1; color: #78838f; }

/* ============================================================================
   FORMULARIOS
   ========================================================================== */
.form-group { margin-bottom: 1rem; display: block; }
label { display: block; margin-bottom: 0.35rem; color: #34404c; font-size: 0.84rem; font-weight: 600; line-height: 1.4; }
input, select, textarea, .form-control {
  width: 100%;
  border: 1px solid #ced4da;
  border-radius: var(--qb-radius);
  padding: 0.6rem 0.75rem;
  background: #fff;
  color: var(--qb-text);
  font: inherit;
}
input:focus, select:focus, textarea:focus, .form-control:focus {
  outline: none; border-color: var(--qb-primary);
  box-shadow: 0 0 0 3px rgba(182, 109, 255, 0.15);
}
input[readonly] { background: #f5f5f5; color: var(--qb-muted); }
textarea { min-height: 9rem; resize: vertical; }
fieldset { border: 1px solid var(--qb-line); border-radius: var(--qb-radius); padding: 1rem; margin: 0 0 1.25rem; }
legend { color: var(--qb-primary-2); font-weight: 700; padding: 0 0.5rem; font-size: 0.9rem; }
.hint, small.hint { display: block; margin-top: 0.35rem; color: #66727e; font-size: 0.72rem; font-weight: 400; line-height: 1.45; overflow-wrap: anywhere; }
.config-form { display: grid; gap: 0; }
.config-form fieldset { min-width: 0; }
.config-form fieldset { padding: 1.15rem; background: #fff; box-shadow: 0 1px 4px rgba(31, 31, 31, 0.04); }
.config-form legend { max-width: calc(100% - 1rem); line-height: 1.35; }
.config-form .notice { line-height: 1.5; }
#bridge-form > fieldset:nth-of-type(3), #bridge-form > fieldset:nth-of-type(4) { border-top: 4px solid var(--qb-primary); }
#bridge-form > fieldset:nth-of-type(6) { border-top: 4px solid var(--qb-warn); }
.bridge-save-bar { position: sticky; bottom: 0.75rem; z-index: 5; box-shadow: 0 6px 22px rgba(31, 31, 31, 0.12); }
.log-tail { max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

.actions, .toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ============================================================================
   BOTONES: sistema compacto unico (barrido scripts/ui_button_sweep.py).
   Metricas en variables para ajuste centralizado; todo boton es
   `.btn.btn-sm` + una variante Bootstrap. Los botones sin clase (legacy o
   generados por JS) heredan el mismo look por la regla base.
   ========================================================================== */
:root {
  --qb-btn-h: 30px;
  --qb-btn-px: 0.7rem;
  --qb-btn-fs: 0.78rem;
  --qb-btn-gap: 0.4rem;
  --qb-btn-radius: 4px;
}
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: var(--qb-btn-h);
  padding: 0 var(--qb-btn-px);
  border: 1px solid transparent;
  border-radius: var(--qb-btn-radius);
  color: #fff;
  background: var(--qb-primary);
  font: inherit;
  font-size: var(--qb-btn-fs);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
button:hover, .btn:hover { background: var(--qb-primary-2); color: #fff; }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25); }

.btn-sm, .btn-group-sm > .btn { min-height: var(--qb-btn-h); padding: 0 var(--qb-btn-px); font-size: var(--qb-btn-fs); line-height: 1.2; }
.btn-xs { min-height: 24px; padding: 0 0.45rem; font-size: 0.72rem; }
.btn-block { display: flex; width: 100%; }

.btn-primary { background: var(--qb-primary); border-color: var(--qb-primary); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--qb-primary-2); border-color: var(--qb-primary-2); color: #fff; }
.btn-success { background: var(--qb-ok); border-color: var(--qb-ok); color: #fff; }
.btn-success:hover { background: #12a893; border-color: #12a893; color: #fff; }
.btn-danger { background: #dc3545; border-color: #dc3545; color: #fff; }
.btn-danger:hover { background: #bb2d3b; border-color: #bb2d3b; color: #fff; }
.btn-warning { background: var(--qb-warn); border-color: var(--qb-warn); color: #5a4a00; }
.btn-warning:hover { background: #e6c00c; border-color: #e6c00c; color: #5a4a00; }

button.secondary, .btn-secondary, .btn-outline-secondary {
  background: #fff; color: #4b5763; border-color: #ced4da;
}
button.secondary:hover, .btn-secondary:hover, .btn-outline-secondary:hover {
  background: #eef4fc; color: var(--qb-primary-2); border-color: var(--qb-primary);
}
.btn-outline-primary { background: #fff; color: var(--qb-primary); border-color: var(--qb-primary); }
.btn-outline-primary:hover { background: var(--qb-primary); color: #fff; }
.btn-outline-danger, button.danger { background: #fff; color: #c0392b; border-color: #e4a39c; }
.btn-outline-danger:hover, button.danger:hover { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-outline-success { background: #fff; color: #128a78; border-color: #9ad8cd; }
.btn-outline-success:hover { background: var(--qb-ok); color: #fff; border-color: var(--qb-ok); }
.btn-outline-warning { background: #fff; color: #8a6d00; border-color: #e9d27a; }
.btn-outline-warning:hover { background: var(--qb-warn); color: #5a4a00; border-color: var(--qb-warn); }
.btn-link { background: transparent; border-color: transparent; color: var(--qb-primary); min-height: auto; padding: 0; }
.btn-link:hover { background: transparent; color: var(--qb-primary-2); text-decoration: underline; }

button.btn-good { background: var(--qb-ok); color: #fff; }
button.btn-good:hover { background: #12a893; }
button.btn-warn { background: var(--qb-warn); color: #5a4a00; }
button.btn-warn:hover { background: #e6c00c; }
button.active, .btn.active { background: var(--qb-primary-2); border-color: var(--qb-primary-2); color: #fff; }
button:disabled, .btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Grupos de acciones: separacion uniforme sin margenes ad hoc */
.title-actions, .row-actions, .modal-actions, .form-actions, .admin-form__actions,
.services-item__actions, .d-flex.flex-wrap > .btn {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--qb-btn-gap);
}
.row-actions .btn + .btn { margin-left: 0; }
td.row-actions { display: table-cell; }
td.row-actions .btn { margin-right: var(--qb-btn-gap); }
td.row-actions .btn:last-child { margin-right: 0; }
.form-row > .btn, .form-row > button { align-self: flex-end; }

/* Controles que son <button> pero NO botones de accion: neutralizar la base */
button.nav-link, button.modal-close, button.message-close, button.chip__remove,
button.mode-toggle-button, button.navbar-toggler, button.link-button,
button.linux-help, button.system-banner__toggle {
  justify-content: flex-start; min-height: 0; white-space: normal;
  border-color: transparent; font-weight: inherit; letter-spacing: normal;
}
button.nav-link { display: flex; font-size: 0.86rem; }
button.modal-close, button.message-close, button.chip__remove, button.navbar-toggler, button.linux-help {
  justify-content: center;
}

/* Vista API: catalogo de endpoints (api_docs.js) */
.api-table td { vertical-align: top; padding: 0.45rem 0.6rem; }
.api-col-method { width: 5.5rem; }
.api-col-sec { width: 30%; }
.api-col-act { width: 7rem; }
.api-method {
  display: inline-block; min-width: 4.4rem; text-align: center;
  padding: 0.15rem 0.4rem; border-radius: 3px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; color: #fff;
  background: #6c757d;
}
.api-method--get { background: #198754; }
.api-method--post { background: #0d6efd; }
.api-method--put { background: #d97706; }
.api-method--patch { background: #6f42c1; }
.api-method--delete { background: #dc3545; }
.api-result td { background: #f8f9fb; }
.api-result__body { font-size: 0.8rem; max-height: 320px; overflow: auto; }

@media (max-width: 900px) {
  .services-card__header { display: grid; }
  .services-card__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .services-card__actions > button { width: 100%; }
  .services-grid { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; }
  .dashboard-operational-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .services-card__actions { grid-template-columns: 1fr; }
  .services-item__actions, .datapath-actions { align-items: stretch; flex-direction: column; }
  .services-item__actions > *, .datapath-actions > button { width: 100%; margin-left: 0; }
  .operational-card .config-summary-grid { grid-template-columns: 1fr; }
  .wizard-step { grid-template-columns: auto minmax(0, 1fr); }
  .wizard-step > button, .wizard-step__actions { grid-column: 1 / -1; width: 100%; }
  .wizard-step__actions > button { flex: 1 1 100%; }
}

/* ============================================================================
   TABLAS
   ========================================================================== */
.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
  background: var(--qb-surface);
}
th, td {
  padding: 0.7rem 0.85rem; text-align: left;
  border-bottom: 1px solid var(--qb-line);
  vertical-align: middle;
}
thead th {
  background: #faf8fc; color: #4b5763; font-weight: 600;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em;
}
tbody tr:hover { background: #f9f6fc; }

/* Chips input (cache) */
.chip-input {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  min-height: 42px; padding: 0.35rem;
  border: 1px solid #ced4da; border-radius: var(--qb-radius); background: #fff;
}
.admin-form { display: grid; gap: 0.85rem; }

/* ============================================================================
   BANNER DE SISTEMA
   ========================================================================== */
.system-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2000;
  background: #fff4e5; border-bottom: 1px solid #ffcc80;
  padding: 0.85rem 1.25rem; box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.system-banner__body { display: flex; align-items: center; gap: 0.85rem; }
.system-banner__icon {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #ff9800; color: #fff; border-radius: 50%; font-weight: 800;
}
.system-banner__title { display: block; color: #a15c00; }
.system-banner__message { color: #7a4a00; font-size: 0.85rem; }
.system-banner__toggle { margin-left: auto; }
.system-banner__diagnostic { margin-top: 0.85rem; font-size: 0.85rem; color: #6b4a10; }
.system-banner__steps { margin: 0.5rem 0 0.85rem 1.25rem; }
.system-banner__steps li { margin-bottom: 0.5rem; }
.system-banner__actions { display: flex; gap: 0.5rem; align-items: center; }

/* ============================================================================
   MODALES PROPIOS (detalle / CRUD / gated / dnsblock)
   ----------------------------------------------------------------------------
   crud_modal.js y las partials usan .modal-backdrop > .modal. El vendor
   Bootstrap define .modal { display:none } y .modal-backdrop { background:#000 },
   lo que dejaba solo un fondo negro sin formulario. Estas reglas restauran el
   modal propio adaptado al tema Breeze claro y priman sobre el vendor.
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2100;
  width: auto; height: auto;
  background: rgba(0, 0, 0, 0.45);
  opacity: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none !important; }
/* Modales standalone (class="modal" sin wrapper .modal-backdrop) */
.modal[hidden] { display: none !important; }
.modal:not([hidden]) {
  position: fixed; inset: 0; z-index: 2100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 1rem;
}
.modal:not([hidden]) > .modal-content {
  position: static;
  display: flex; flex-direction: column;
  width: min(780px, 95vw); height: auto; max-height: 88vh;
  overflow-y: auto;
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 1.5rem;
}
.modal > .modal-content .modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.modal > .modal-content .modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal > .modal-content .modal-body { flex: 1; overflow-y: auto; }
.modal-backdrop .modal {
  position: static;
  display: flex; flex-direction: column;
  width: min(720px, 95vw); height: auto; max-height: 85vh;
  overflow: hidden;
  background: var(--qb-surface);
  border: 1px solid var(--qb-line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--qb-line);
  background: #faf8fb;
}
.modal-head h3 { margin: 0; color: var(--qb-primary-2); font-size: 1.05rem; }
.modal-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--qb-muted); font-size: 1.5rem;
  padding: 0.15rem 0.55rem; border-radius: 6px; line-height: 1;
}
.modal-close:hover { background: #f1ecf4; color: var(--qb-text); }
.modal-backdrop .modal-body {
  padding: 1rem 1.1rem; overflow: auto; min-height: 6rem;
}
.modal-backdrop .modal-body pre { max-height: 55vh; overflow: auto; margin: 0; }
.modal-actions {
  display: flex; gap: 0.6rem; justify-content: flex-end;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--qb-line);
  background: #faf8fb;
}
.modal-actions button {
  padding: 0.45rem 1rem; border-radius: var(--qb-radius);
  border: 1px solid transparent; cursor: pointer; font: inherit;
  background: var(--qb-primary); color: #fff;
}
.modal-actions button.secondary {
  background: #fff; color: var(--qb-text); border-color: #ced4da;
}
.modal-actions button:hover { filter: brightness(0.95); }

/* Formulario del modal CRUD (Nueva/Editar) */
.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin: 0.25rem 0 0.8rem;
}
.modal-form-grid label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.modal-form-grid input,
.modal-form-grid select,
.modal-form-grid textarea {
  padding: 0.45rem 0.55rem;
  border-radius: var(--qb-radius);
  border: 1px solid #ced4da;
  background: #fff;
  color: var(--qb-text);
  font: inherit;
}
.modal-form-grid input:focus,
.modal-form-grid select:focus,
.modal-form-grid textarea:focus { border-color: var(--qb-primary); outline: none; }
.modal-form-grid .field-help { color: var(--qb-muted); font-size: 0.75rem; line-height: 1.3; }
.crud-empty { text-align: center; color: var(--qb-muted); font-style: italic; padding: 1.2rem; }

/* ============================================================================
   MENSAJES
   ========================================================================== */
.message {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 1500;
  max-width: 380px; padding: 0.85rem 1.1rem;
  border-radius: var(--qb-radius); box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  background: #fff; border-left: 4px solid var(--qb-primary);
}
.message.ok { border-left-color: var(--qb-ok); }
.message.warn { border-left-color: var(--qb-warn); }
.message.error { border-left-color: var(--qb-error); }
.message { display: flex; align-items: flex-start; gap: 0.6rem; }
.message .message-text { flex: 1 1 auto; word-break: break-word; }
.message .message-close {
  flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: var(--qb-muted); padding: 0 0.15rem;
}
.message .message-close:hover { color: var(--qb-error); }

/* ============================================================================
   CENTRO DE MANDO — Marcador de Impacto (hero) y Radiografia Social
   ========================================================================== */
.impact-hero {
  background: linear-gradient(135deg, var(--qb-primary-2) 0%, var(--qb-primary) 55%, #1a67c9 100%);
  color: #fff;
  border-radius: 10px;
  box-shadow: var(--qb-shadow);
  padding: 1.1rem 1.3rem 0.9rem;
}
.impact-hero__top {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.6rem; margin-bottom: 0.9rem;
}
.impact-hero__engine {
  font-weight: 800; letter-spacing: 0.06em; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.impact-bolt { color: #ffd54a; filter: drop-shadow(0 0 6px rgba(255, 213, 74, 0.7)); }
.impact-hero__live {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 0.25rem 0.7rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}
.impact-hero__live .live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #35e08d; animation: impact-pulse 1.6s infinite;
}
.impact-hero__live--off .live-dot { background: #f2b84b; animation: none; }
@keyframes impact-pulse {
  0% { box-shadow: 0 0 0 0 rgba(53, 224, 141, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(53, 224, 141, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 224, 141, 0); }
}
.impact-semaforo { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; }
.impact-semaforo .sem {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
.impact-semaforo .sem i {
  width: 9px; height: 9px; border-radius: 50%; background: #94a3b8;
}
.impact-semaforo .sem--verde i { background: #35e08d; box-shadow: 0 0 6px rgba(53, 224, 141, 0.8); }
.impact-semaforo .sem--ambar i { background: #f2b84b; box-shadow: 0 0 6px rgba(242, 184, 75, 0.8); }
.impact-semaforo .sem--rojo i  { background: #ff667a; box-shadow: 0 0 6px rgba(255, 102, 122, 0.8); }
.impact-hero__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}
.impact-metric { display: flex; flex-direction: column; min-width: 0; }
.impact-metric__value {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.impact-metric__unit { font-size: 0.85rem; opacity: 0.85; font-weight: 700; }
.impact-metric__label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  opacity: 0.8; margin-top: 0.15rem;
}
.impact-metric__trend { font-size: 0.78rem; margin-top: 0.2rem; color: #b7f5d5; }
.impact-hero__story {
  margin: 0.9rem 0 0; font-size: 0.9rem; font-style: italic;
  opacity: 0.92; border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 0.6rem;
}
.impact-hero__story--in { animation: impact-story-in 0.5s ease; }
@keyframes impact-story-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 0.92; transform: none; }
}

/* Top Momentos */
.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
}
.record {
  display: flex; flex-direction: column; align-items: flex-start;
  border: 1px solid var(--qb-line); border-radius: 8px;
  padding: 0.8rem 0.9rem; background: #f8fafc;
}
.record__icon { font-size: 1.4rem; margin-bottom: 0.3rem; }
.record strong { font-size: 1.25rem; color: var(--qb-primary-2); font-variant-numeric: tabular-nums; }
.record__label { font-size: 0.75rem; color: var(--qb-muted); margin-top: 0.15rem; }
.record__when { font-size: 0.7rem; color: var(--qb-muted); margin-top: 0.25rem; }

/* Timeline operativa */
.impact-timeline { max-height: 260px; overflow-y: auto; }
.timeline-item {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--qb-line);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item__dot {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  margin-top: 0.4rem; background: var(--qb-info);
}
.timeline-item--warn .timeline-item__dot { background: var(--qb-warn); }
.timeline-item--error .timeline-item__dot { background: var(--qb-error); }
.timeline-item strong { display: block; font-size: 0.85rem; font-weight: 600; }
.timeline-item__when { font-size: 0.72rem; color: var(--qb-muted); }

/* Selector de ventana en la grafica principal */
.history-windows { margin-left: 0.75rem; }
.history-windows .btn.active {
  background: var(--qb-primary); color: #fff; border-color: var(--qb-primary);
}

/* Radiografia Social */
.social-legend {
  display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem;
  margin-top: 0.6rem; justify-content: center;
}
.social-legend__item {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.76rem; color: var(--qb-text);
}
.social-legend__item i {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
}
.social-apps { display: flex; flex-direction: column; gap: 0.55rem; }
.social-app__head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.82rem; margin-bottom: 0.2rem;
}
.social-app__head span { color: var(--qb-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.social-app__bar {
  height: 8px; border-radius: 999px; background: rgba(61, 79, 97, 0.12);
  overflow: hidden;
}
.social-app__bar i {
  display: block; height: 100%; border-radius: 999px;
  transition: width 0.6s ease;
}
.social-sites { list-style: none; margin: 0; padding: 0; counter-reset: social-site; }
.social-sites li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem; padding: 0.38rem 0.2rem;
  border-bottom: 1px solid var(--qb-line); font-size: 0.82rem;
  counter-increment: social-site;
}
.social-sites li:last-child { border-bottom: none; }
.social-sites li::before {
  content: counter(social-site); flex: 0 0 auto;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(28, 78, 157, 0.1); color: var(--qb-primary-2);
  font-size: 0.7rem; font-weight: 700;
}
.social-site__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-site__hits { color: var(--qb-muted); font-variant-numeric: tabular-nums; font-size: 0.76rem; }

/* ============ Radiografia Social: highlights (titulares) ============ */
.social-highlights {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.55rem; margin-bottom: 0.75rem;
}
.social-highlight {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.65rem; border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--hl-color, #29abe2) 12%, transparent), rgba(0, 0, 0, 0.03));
  border: 1px solid color-mix(in srgb, var(--hl-color, #29abe2) 30%, transparent);
  animation: hl-pop 0.5s ease both;
}
.social-highlight__icon { font-size: 1.25rem; flex: 0 0 auto; }
.social-highlight__text { display: flex; flex-direction: column; min-width: 0; }
.social-highlight__text strong { font-size: 0.82rem; line-height: 1.2; }
.social-highlight__text span { font-size: 0.72rem; color: var(--qb-muted); }
@keyframes hl-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ============ Volumen real por dominio (DPI) ============ */
.domains-volume { display: flex; flex-direction: column; gap: 0.5rem; }
.domain-row {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.35rem 0.25rem; border-radius: 8px;
  transition: background 0.15s ease;
}
.domain-row:hover { background: rgba(28, 78, 157, 0.05); }
.domain-row__rank {
  flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(28, 78, 157, 0.1); color: var(--qb-primary-2);
  font-size: 0.72rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.domain-row__main { flex: 1 1 auto; min-width: 0; }
.domain-row__head {
  display: flex; align-items: baseline; gap: 0.5rem;
  font-size: 0.8rem; margin-bottom: 0.2rem; min-width: 0;
}
.domain-row__head strong {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 40%;
}
.domain-row__app {
  flex: 0 0 auto; font-size: 0.66rem; font-weight: 700;
  padding: 0.05rem 0.45rem; border-radius: 999px; letter-spacing: 0.03em;
}
.domain-row__stats { font-size: 0.7rem; color: var(--qb-muted); margin-left: auto; white-space: nowrap; }
.domain-row__bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(0, 0, 0, 0.07);
}
.domain-row__bar i {
  display: block; height: 100%; border-radius: inherit;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.domain-row__vol {
  flex: 0 0 auto; text-align: right; min-width: 5.2rem;
  display: flex; flex-direction: column; line-height: 1.15;
}
.domain-row__vol strong { font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.domain-row__vol span { font-size: 0.68rem; color: var(--qb-muted); font-variant-numeric: tabular-nums; }

/* ============ Speedtest de Dominios ============ */
.speedtest-header-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chart-badge--down { background: rgba(254, 124, 150, 0.15); color: #e34d6c; }

.speedtest-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem; margin-bottom: 0.85rem;
}
.speedtest-cat {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.6rem; border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06); background: rgba(0, 0, 0, 0.02);
}
.speedtest-cat__icon { font-size: 1.2rem; }
.speedtest-cat__text { display: flex; flex-direction: column; line-height: 1.2; }
.speedtest-cat__text strong { font-size: 0.76rem; }
.speedtest-cat__text span { font-size: 0.72rem; color: var(--qb-muted); font-variant-numeric: tabular-nums; }
.speedtest-cat.st--ok   { border-color: rgba(27, 207, 180, 0.4);  background: rgba(27, 207, 180, 0.07); }
.speedtest-cat.st--good { border-color: rgba(27, 207, 180, 0.25); background: rgba(27, 207, 180, 0.04); }
.speedtest-cat.st--warn { border-color: rgba(254, 215, 19, 0.45); background: rgba(254, 215, 19, 0.08); }
.speedtest-cat.st--down { border-color: rgba(254, 124, 150, 0.5); background: rgba(254, 124, 150, 0.08); }

.speedtest-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 0.7rem;
}
.speedtest-card {
  position: relative; border-radius: 12px; overflow: hidden;
  padding: 0.7rem 0.8rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--st-color, #38bdf8) 25%, transparent);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--st-color, #38bdf8) 8%, transparent), transparent 55%),
    var(--qb-card-bg, #ffffff);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.speedtest-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--st-color, #38bdf8) 18%, transparent);
}
.speedtest-card__head {
  display: flex; justify-content: space-between; align-items: center; gap: 0.4rem;
}
.speedtest-card__head strong { font-size: 0.84rem; }
.speedtest-card__status {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em;
  padding: 0.12rem 0.45rem; border-radius: 999px; white-space: nowrap;
}
.speedtest-card.st--ok   .speedtest-card__status { background: rgba(27, 207, 180, 0.16); color: #0f9d87; }
.speedtest-card.st--good .speedtest-card__status { background: rgba(27, 207, 180, 0.12); color: #12a893; }
.speedtest-card.st--warn .speedtest-card__status { background: rgba(254, 215, 19, 0.2);  color: #a3860a; }
.speedtest-card.st--down .speedtest-card__status { background: rgba(254, 124, 150, 0.18); color: #e34d6c; }
.speedtest-card.st--idle .speedtest-card__status { background: rgba(100, 116, 139, 0.14); color: #64748b; }
.speedtest-card__main {
  font-size: 1.45rem; font-weight: 800; margin: 0.3rem 0 0.25rem;
  font-variant-numeric: tabular-nums;
}
.speedtest-card.st--down .speedtest-card__main { color: #e34d6c; }
.speedtest-card__gauge {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: rgba(0, 0, 0, 0.08); margin-bottom: 0.4rem;
}
.speedtest-card__gauge i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--st-color, #38bdf8), color-mix(in srgb, var(--st-color, #38bdf8) 55%, #ffffff));
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.speedtest-card__detail {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem;
  font-size: 0.68rem; color: var(--qb-muted); font-variant-numeric: tabular-nums;
}
.speedtest-card__foot {
  margin-top: 0.35rem; font-size: 0.64rem; color: var(--qb-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.speedtest-card.st--down { animation: st-alert 1.6s ease-in-out infinite; }
@keyframes st-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(254, 124, 150, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(254, 124, 150, 0.14); }
}

@media (max-width: 576px) {
  .speedtest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .domain-row__stats { display: none; }
  .domain-row__head strong { max-width: 60%; }
}

/* Responsivo movil: hero en 2 columnas y semaforo compacto */
@media (max-width: 576px) {
  .impact-hero { padding: 0.9rem 0.9rem 0.7rem; }
  .impact-hero__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .impact-semaforo .sem { font-size: 0.6rem; padding: 0.15rem 0.45rem; }
  .history-windows { margin-left: 0; margin-top: 0.4rem; }
}

/* ================= Efecto WOW (W1..W10) ================= */

/* W1. Pulso de la Red: ECG dentro del hero */
.impact-pulse {
  position: relative; margin: 0.4rem 0 0.2rem;
  border-radius: 8px; overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}
.impact-pulse__canvas { display: block; width: 100%; height: 56px; }
.impact-pulse__bpm {
  position: absolute; right: 0.6rem; top: 0.35rem;
  font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75); font-variant-numeric: tabular-nums;
}

/* Utilidad: bloque oculto (usado por notas de Impacto y Dashboard) */
.hidden-block { display: none !important; }

/* W4. Baseline medido (ventanas de medicion reales) */
.ghost-note {
  margin-top: 0.5rem; padding: 0.45rem 0.7rem; border-radius: 8px;
  background: rgba(71, 85, 105, 0.1); font-size: 0.82rem;
}
.ghost-note__tag {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem;
  border-radius: 999px; background: rgba(148, 163, 184, 0.25);
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b; cursor: help;
}

/* W10. Prediccion del Cerebro QBridge */
.predict-note {
  margin-top: 0.4rem; padding: 0.45rem 0.7rem; border-radius: 8px;
  background: rgba(155, 89, 182, 0.1); color: #7d3c98; font-size: 0.82rem;
}

/* W2. Sala de Cine: modo presentacion */
body.present-mode .sidebar,
body.present-mode .navbar,
body.present-mode .section-title__actions button:not([data-action="impact-present"]) {
  display: none !important;
}
body.present-mode .main-panel { width: 100% !important; margin: 0 !important; }
body.present-mode { background: #0c1524; }
body.present-mode .present-scene-active {
  outline: 3px solid rgba(35, 200, 219, 0.6);
  outline-offset: 4px;
  transform: scale(1.02);
  transition: transform 0.6s ease;
  font-size: 1.15em;
}
body.present-mode .impact-metric__value { font-size: 2.6rem; }

/* Impresion del informe (W9 usa ventana propia; esto cubre Ctrl+P directo) */
@media print {
  .sidebar, .navbar, .section-title__actions, .history-windows, button { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; }
}


/* S5: items del menu bloqueados por licencia vencida (doc 3.4) */
#sidebar [data-view].license-locked {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(1);
}

/* ================================================================
   Suscriptores: grid estable + fuentes compactas (peticion operador)
   - table-layout fixed evita que celdas largas desproporcionen columnas
   - chips de subida/bajada con color para lectura rapida
   - celda IPv6 truncada con title (tooltip) para no romper el layout
   ================================================================ */
#subs-grid-table {
  table-layout: fixed;
  width: 100%;
  font-size: 0.78rem;
}
#subs-grid-table th,
#subs-grid-table td {
  padding: 0.3rem 0.45rem;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#subs-grid-table th { font-size: 0.68rem; letter-spacing: 0.03em; }
/* Anchos estables por columna (12 columnas, FIX 2026-08-09: faltaba la 12
   de Acciones y los botones por fila quedaban recortados por overflow):
   MAC / IP / IPv6 / subscriber_id / Plan / Sub / Baj / Contrato / Puertos / Clasif / Estado / Acciones */
#subs-grid-table th:nth-child(1)  { width: 9%;  }
#subs-grid-table th:nth-child(2)  { width: 9%;  }
#subs-grid-table th:nth-child(3)  { width: 9%;  }
#subs-grid-table th:nth-child(4)  { width: 8%;  }
#subs-grid-table th:nth-child(5)  { width: 7%;  }
#subs-grid-table th:nth-child(6)  { width: 7%;  }
#subs-grid-table th:nth-child(7)  { width: 7%;  }
#subs-grid-table th:nth-child(8)  { width: 8%;  }
#subs-grid-table th:nth-child(9)  { width: 9%;  }
#subs-grid-table th:nth-child(10) { width: 7%;  }
#subs-grid-table th:nth-child(11) { width: 10%; }
#subs-grid-table th:nth-child(12) { width: 10%; min-width: 128px; }
/* La celda de Acciones NUNCA recorta sus botones (los iconos por fila
   Trafico/Seguridad/Plan/Captura deben verse siempre). */
#subs-grid-table td:last-child {
  overflow: visible;
  text-overflow: clip;
}
#subs-grid-table code { font-size: 0.74rem; }
#subs-grid-table .badge { font-size: 0.62rem; padding: 0.16rem 0.4rem; }
#subs-grid-table .btn-group .btn { font-size: 0.66rem; }

.cell-ipv6 {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  font-family: var(--qb-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.72rem;
  color: #7c3aed;
}

.rate-chip {
  display: inline-block;
  min-width: 4.6rem;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  text-align: right;
}
.rate-chip.rate-up   { background: rgba(56, 189, 248, 0.14); color: #0284c7; }
.rate-chip.rate-down { background: rgba(27, 207, 180, 0.16); color: #0f9d87; }
tr.text-muted .rate-chip { opacity: 0.55; }

/* Modal de accesos: tabla unica (dominios + IPs + puertos) */
#subs-access-table {
  table-layout: fixed;
  width: 100%;
  font-size: 0.78rem;
}
#subs-access-table th:nth-child(1) { width: 27%; }
#subs-access-table th:nth-child(2) { width: 19%; }
#subs-access-table th:nth-child(3) { width: 14%; }
#subs-access-table th:nth-child(4) { width: 10%; }
#subs-access-table th:nth-child(5) { width: 10%; }
#subs-access-table th:nth-child(6) { width: 10%; }
#subs-access-table th:nth-child(7) { width: 10%; }
#subs-access-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.3rem 0.45rem;
}
#subs-access-table code { font-size: 0.74rem; }
#subs-access-table .badge { font-size: 0.62rem; }

/* Informe unificado en Clientes online (2026-08-08).
   Ambar = consumo excesivo (>110% contrato); naranja = grave (tope absurdo
   >=150% o IP sin plan robando >=20 Mbps). Sustituye el rosa/rojo antiguo. */
#subs-grid-table tr.row-report-warn > td  { background: rgba(255, 193, 7, 0.14); }
#subs-grid-table tr.row-report-alert > td { background: rgba(255, 122, 0, 0.20); }
#subs-grid-table tr.row-report-alert      { font-weight: 600; }
.badge.bg-orange { background: rgba(255, 122, 0, 0.18); color: #b35400; }
.text-report-alert { color: #d96a00; font-weight: 600; }

/* Acciones por fila compactas (2026-08-09): botones solo-icono con tooltip
   nativo (title) al pasar el mouse. Estilo GLOBAL para toda la aplicacion:
   cualquier grid puede usar .btn-icon-xs para un look profesional y denso. */
.btn.btn-icon-xs {
  padding: 0 0.3rem;
  font-size: 0.78rem;
  line-height: 1.35;
  min-width: 1.55rem;
}
.row-actions .btn + .btn { margin-left: 1px; }
#subs-grid-table td { vertical-align: middle; }

/* ================================================================
   Iconos SVG globales (2026-08-09). CSP-safe: inline, sin CDNs.
   .icon-svg hereda el color del boton (currentColor) y escala con la
   fuente; .btn-with-icon alinea icono + texto en cualquier boton.
   Estilo GLOBAL: reutilizable en toda la aplicacion.
   ================================================================ */
.icon-svg {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  pointer-events: none;      /* clics pasan al boton, no al svg */
  flex-shrink: 0;
}
.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn.btn-icon-xs .icon-svg { width: 0.95rem; height: 0.95rem; }
.btn.btn-icon-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.55rem;
}

/* ================================================================
   Contenedor de tabla con scroll (GLOBAL, 2026-08-09).
   Antes .table-responsive no estaba definido: las tablas anchas
   desbordaban la pagina en resoluciones pequenas. Ahora garantiza
   scroll horizontal suave sin romper el layout de la card.
   ================================================================ */
.table-responsive {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.table-responsive > table { margin-bottom: 0; }

/* Modal ancho responsivo (rastreo de trafico y similares): ocupa lo
   necesario en pantallas grandes y se adapta en pequenas. */
.modal:not([hidden]) > .modal-content.modal-wide {
  width: min(1100px, 96vw);
}

/* ================================================================
   Multipantalla segun resolucion (GLOBAL, 2026-08-09).
   La grid de suscriptores usa table-layout fixed con anchos %; en
   resoluciones bajas se garantiza un ancho minimo + scroll para que
   ninguna columna quede ilegible, y en pantallas grandes ocupa el
   100% del ancho disponible.
   ================================================================ */
@media (max-width: 1400px) {
  #subs-grid-table { min-width: 1150px; }   /* activa scroll del contenedor */
}
@media (min-width: 1920px) {
  #subs-grid-table { font-size: 0.84rem; }
  #subs-grid-table code { font-size: 0.8rem; }
  #subs-access-table { font-size: 0.84rem; }
}
@media (max-width: 991px) {
  .modal:not([hidden]) > .modal-content.modal-wide {
    width: 96vw;
    padding: 1rem;
    max-height: 92vh;
  }
  #subs-access-table { min-width: 640px; }  /* scroll en el modal */
}
@media (max-width: 576px) {
  .modal:not([hidden]) > .modal-content.modal-wide { padding: 0.75rem; }
  .btn-with-icon { font-size: 0.72rem; }
}

/* ================================================================
   Capa de compatibilidad Bootstrap 5 -> vendor Bootstrap 4.4.1
   (2026-08-16). Los partials usan utilidades BS5 (g-*, gap-*, text-end,
   fw-*, fs-*, ms-*/me-*, form-select, row-cols-*) que el vendor NO define:
   por eso las rejillas se veian separadas, sin gutter y desalineadas.
   Se implementan aqui con la misma escala de espaciado de Bootstrap.
   ================================================================ */
.row.g-0 { margin-right: 0; margin-left: 0; }
.row.g-0 > * { padding-right: 0; padding-left: 0; }
.row.g-1 { margin-top: -0.25rem; margin-right: -0.125rem; margin-left: -0.125rem; }
.row.g-1 > * { margin-top: 0.25rem; padding-right: 0.125rem; padding-left: 0.125rem; }
.row.g-2 { margin-top: -0.5rem; margin-right: -0.25rem; margin-left: -0.25rem; }
.row.g-2 > * { margin-top: 0.5rem; padding-right: 0.25rem; padding-left: 0.25rem; }
.row.g-3 { margin-top: -1rem; margin-right: -0.5rem; margin-left: -0.5rem; }
.row.g-3 > * { margin-top: 1rem; padding-right: 0.5rem; padding-left: 0.5rem; }
.row.g-4 { margin-top: -1.5rem; margin-right: -0.75rem; margin-left: -0.75rem; }
.row.g-4 > * { margin-top: 1.5rem; padding-right: 0.75rem; padding-left: 0.75rem; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.row-cols-1 > * { flex: 0 0 100%; max-width: 100%; }
.row-cols-2 > * { flex: 0 0 50%; max-width: 50%; }
.row-cols-3 > * { flex: 0 0 33.3333%; max-width: 33.3333%; }
.row-cols-4 > * { flex: 0 0 25%; max-width: 25%; }
.row-cols-6 > * { flex: 0 0 16.6667%; max-width: 16.6667%; }
@media (min-width: 576px) {
  .row-cols-sm-2 > * { flex: 0 0 50%; max-width: 50%; }
  .row-cols-sm-3 > * { flex: 0 0 33.3333%; max-width: 33.3333%; }
}
@media (min-width: 768px) {
  .row-cols-md-2 > * { flex: 0 0 50%; max-width: 50%; }
  .row-cols-md-3 > * { flex: 0 0 33.3333%; max-width: 33.3333%; }
  .row-cols-md-4 > * { flex: 0 0 25%; max-width: 25%; }
  .row-cols-md-6 > * { flex: 0 0 16.6667%; max-width: 16.6667%; }
}
@media (min-width: 992px) {
  .row-cols-lg-3 > * { flex: 0 0 33.3333%; max-width: 33.3333%; }
  .row-cols-lg-4 > * { flex: 0 0 25%; max-width: 25%; }
  .row-cols-lg-5 > * { flex: 0 0 20%; max-width: 20%; }
  .row-cols-lg-6 > * { flex: 0 0 16.6667%; max-width: 16.6667%; }
}
@media (min-width: 1200px) {
  .row-cols-xl-4 > * { flex: 0 0 25%; max-width: 25%; }
  .row-cols-xl-5 > * { flex: 0 0 20%; max-width: 20%; }
  .row-cols-xl-6 > * { flex: 0 0 16.6667%; max-width: 16.6667%; }
}
.text-end { text-align: right !important; }
.text-start { text-align: left !important; }
.ms-0 { margin-left: 0 !important; } .me-0 { margin-right: 0 !important; }
.ms-1 { margin-left: 0.25rem !important; } .me-1 { margin-right: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; } .me-2 { margin-right: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; } .me-3 { margin-right: 1rem !important; }
.ms-auto { margin-left: auto !important; } .me-auto { margin-right: auto !important; }
.ps-0 { padding-left: 0 !important; } .pe-0 { padding-right: 0 !important; }
.ps-1 { padding-left: 0.25rem !important; } .pe-1 { padding-right: 0.25rem !important; }
.ps-2 { padding-left: 0.5rem !important; } .pe-2 { padding-right: 0.5rem !important; }
.ps-3 { padding-left: 1rem !important; } .pe-3 { padding-right: 1rem !important; }
.ps-5 { padding-left: 3rem !important; }
.mt-6 { margin-top: 4rem !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-normal { font-weight: 400 !important; }
.fw-light { font-weight: 300 !important; }
.fs-3 { font-size: 1.5rem !important; }
.fs-4 { font-size: 1.25rem !important; }
.fs-5 { font-size: 1.1rem !important; }
.fs-6 { font-size: 0.95rem !important; }
.text-break { word-wrap: break-word !important; word-break: break-word !important; }
.lh-1 { line-height: 1 !important; }
.lh-sm { line-height: 1.25 !important; }
.form-label { display: inline-block; margin-bottom: 0.35rem; font-size: 0.8rem; color: #4b5563; font-weight: 500; }
.form-select {
  display: block; width: 100%; height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 1.75rem 0.375rem 0.75rem; font-size: 0.9rem; line-height: 1.5;
  color: #495057; background-color: #fff; border: 1px solid #ced4da; border-radius: 0.25rem;
  vertical-align: middle; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 14px 10px;
}
.form-select:focus { border-color: #80bdff; outline: 0; box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); }
.form-select-sm { height: calc(1.5em + 0.5rem + 2px); padding-top: 0.25rem; padding-bottom: 0.25rem; padding-left: 0.5rem; font-size: 0.82rem; }
.form-control-sm { font-size: 0.82rem; }
.form-switch { padding-left: 2.5em; }
.form-switch .form-check-input { margin-left: -2.5em; width: 2em; }
.bg-secondary.badge, .badge.bg-secondary { background-color: #6c757d; color: #fff; }
.badge.bg-success { background-color: #28a745; color: #fff; }
.badge.bg-danger { background-color: #dc3545; color: #fff; }
.badge.bg-warning { background-color: #ffc107; color: #212529; }
.badge.bg-info { background-color: #17a2b8; color: #fff; }
.badge.bg-dark { background-color: #343a40; color: #fff; }
.badge.bg-light { background-color: #f8f9fa; color: #212529; }
.badge.bg-primary { background-color: #0d6efd; color: #fff; }

/* Rejillas de configuracion: fieldsets y legends consistentes (misma
   tipografia, mismo borde, mismo relleno) en TODAS las vistas. */
.config-form fieldset.border, .panel fieldset.border {
  border: 1px solid #e3e6ea !important; border-radius: 0.5rem; background: #fff;
  padding: 0.75rem 1rem 1rem !important; margin: 0; min-width: 0;
}
.config-form fieldset.border > legend, .panel fieldset.border > legend {
  float: none; width: auto; padding: 0 0.4rem; margin: 0 0 0.25rem 0;
  font-size: 0.88rem; font-weight: 600; color: #1f2937; line-height: 1.2;
}
.config-form fieldset .row.g-2 > * { min-width: 0; }
.config-form .form-text { font-size: 0.74rem; line-height: 1.3; margin-top: 0.2rem; color: #6c757d; }
.config-form .form-label.small { font-size: 0.76rem; margin-bottom: 0.2rem; white-space: normal; }
.config-form .chip-input { min-height: calc(1.5em + 0.5rem + 2px); }
/* Un fieldset con h-100 dentro de una columna estira a la altura del hermano
   (sin huecos blancos irregulares al lado). */
.config-form .row > [class*="col-"] > fieldset.h-100 { display: flex; flex-direction: column; }
.config-form .row > [class*="col-"] > fieldset.h-100 > .row { flex: 1 1 auto; align-content: flex-start; }

/* Tarjetas de KPI del dashboard: numeros grandes que NO desbordan la
   columna (ej. "Bloqueadas RPZ 24h" con 9 digitos) y etiquetas alineadas. */
.card-body .row > [class*="col-"] > .text-muted.small { display: block; min-height: 2.2em; line-height: 1.1; }
.card-body .row > [class*="col-"] > strong.h4 {
  font-size: clamp(1rem, 1.6vw, 1.5rem); line-height: 1.15; margin: 0.15rem 0 0;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-body > .small.text-muted.d-flex.flex-wrap { row-gap: 0.25rem; margin-top: 0.5rem; }
.card-body > .small.text-muted.d-flex.flex-wrap > span { white-space: nowrap; }

/* Tablas de las vistas: cabecera compacta, celdas alineadas al centro. */
.panel .table-sm th, .panel .table-sm td { padding: 0.35rem 0.5rem; vertical-align: middle; }
.panel .table thead.table-light th { background: #f3f5f7; color: #374151; font-size: 0.78rem; font-weight: 600; text-transform: none; border-bottom: 1px solid #e3e6ea; }
.panel .table td .badge + .badge { margin-left: 0.15rem; }
.panel .table td > .text-muted[style*="font-size"] { margin-top: 0.2rem; }

/* Cabecera de tarjeta: titulo y acciones en una linea, respiran igual. */
.panel .card > .card-header.bg-white { background: #fff !important; border-bottom: 1px solid #e9ecef; padding: 0.6rem 1rem; }
.panel .card > .card-header .fw-semibold { font-size: 0.95rem; color: #1f2937; }
.panel .card > .card-header .input-group-sm > .input-group-text { font-size: 0.78rem; }
.panel .card > .card-header .btn-sm { white-space: nowrap; }

/* ============================================================================
   ESTADOS SEMANTICOS DE ALTO CONTRASTE (WCAG AA sobre fondo blanco)
   El tema Breeze pinta success en cian (#00cccd), danger en rosa (#ff3ca6)
   y warning en naranja claro (#ffab2d): ilegibles sobre tarjetas blancas.
   Aqui se redefinen una sola vez para TODAS las vistas (texto, badges,
   bordes y alertas) con colores oscuros y legibles; el color nunca es el
   unico canal: los badges llevan texto y las filas marcadas, borde lateral.
   ========================================================================== */
:root {
  --qb-ok-fg: #15803d;    --qb-ok-bg: #dcfce7;    --qb-ok-line: #16a34a;
  --qb-warn-fg: #92400e;  --qb-warn-bg: #fef3c7;  --qb-warn-line: #d97706;
  --qb-err-fg: #b91c1c;   --qb-err-bg: #fee2e2;   --qb-err-line: #dc2626;
  --qb-info-fg: #1e40af;  --qb-info-bg: #dbeafe;  --qb-info-line: #2563eb;
  --qb-neutral-fg: #374151; --qb-neutral-bg: #e5e7eb;
}
.text-success { color: var(--qb-ok-fg) !important; }
.text-warning { color: var(--qb-warn-fg) !important; }
.text-danger  { color: var(--qb-err-fg) !important; }
.text-info    { color: var(--qb-info-fg) !important; }
.border-success { border-color: var(--qb-ok-line) !important; }
.border-warning { border-color: var(--qb-warn-line) !important; }
.border-danger  { border-color: var(--qb-err-line) !important; }
.border-info    { border-color: var(--qb-info-line) !important; }

.badge { font-size: 0.74rem; letter-spacing: 0.01em; }
.badge.badge-success, .badge.bg-success, .badge-good, .text-bg-success {
  background-color: var(--qb-ok-bg) !important; color: var(--qb-ok-fg) !important; border: 1px solid var(--qb-ok-line);
}
.badge.badge-warning, .badge.bg-warning, .badge-warn, .text-bg-warning {
  background-color: var(--qb-warn-bg) !important; color: var(--qb-warn-fg) !important; border: 1px solid var(--qb-warn-line);
}
.badge.badge-danger, .badge.bg-danger, .badge-danger, .badge-hot, .text-bg-danger {
  background-color: var(--qb-err-bg) !important; color: var(--qb-err-fg) !important; border: 1px solid var(--qb-err-line);
}
.badge.badge-info, .badge.bg-info {
  background-color: var(--qb-info-bg) !important; color: var(--qb-info-fg) !important; border: 1px solid var(--qb-info-line);
}
.badge.badge-secondary, .badge.bg-secondary, .badge-neutral {
  background-color: var(--qb-neutral-bg) !important; color: var(--qb-neutral-fg) !important; border: 1px solid #cbd5e1;
}
.badge.bg-light { background-color: #f8fafc !important; color: var(--qb-neutral-fg) !important; border: 1px solid #cbd5e1; }
.badge.bg-dark  { background-color: #1f2937 !important; color: #fff !important; }
.badge.text-dark { color: inherit !important; }

.alert-success { background: var(--qb-ok-bg); border-color: var(--qb-ok-line); color: var(--qb-ok-fg); }
.alert-warning { background: var(--qb-warn-bg); border-color: var(--qb-warn-line); color: var(--qb-warn-fg); }
.alert-danger  { background: var(--qb-err-bg); border-color: var(--qb-err-line); color: var(--qb-err-fg); }
.alert-info    { background: var(--qb-info-bg); border-color: var(--qb-info-line); color: var(--qb-info-fg); }
.alert code { color: inherit; background: rgba(255,255,255,0.6); }

.btn-outline-success { color: var(--qb-ok-fg); border-color: var(--qb-ok-line); }
.btn-outline-success:hover { background: var(--qb-ok-line); border-color: var(--qb-ok-line); color: #fff; }
.btn-outline-danger { color: var(--qb-err-fg); border-color: var(--qb-err-line); }
.btn-outline-danger:hover { background: var(--qb-err-line); border-color: var(--qb-err-line); color: #fff; }
.btn-outline-warning { color: var(--qb-warn-fg); border-color: var(--qb-warn-line); }
.btn-outline-warning:hover { background: var(--qb-warn-line); border-color: var(--qb-warn-line); color: #fff; }

/* Filas de tablas con nivel de riesgo: borde lateral + fondo tenue, el
   texto conserva el color normal (legible) y el estado va en el badge. */
.panel .table tbody tr.row-level-danger  { box-shadow: inset 4px 0 0 var(--qb-err-line);  background: #fff7f7; }
.panel .table tbody tr.row-level-warning { box-shadow: inset 4px 0 0 var(--qb-warn-line); background: #fffdf5; }
.panel .table tbody tr.row-level-success { box-shadow: inset 4px 0 0 var(--qb-ok-line); }
.panel .table tbody tr.row-level-muted td { color: var(--qb-muted); }
.panel .table-hover tbody tr:hover { background-color: #f1f5f9; }
.panel .table td code, .panel .table td .mono { font-size: 0.8rem; color: #0f172a; background: #f1f5f9; }
.panel .table td .text-muted[style*="font-size"] { color: #475569 !important; }

/* Tarjetas de metrica (detector/blocklist): valor grande oscuro, el tono
   solo marca el borde superior para no sacrificar legibilidad. */
.panel .metric-tile { border: 1px solid var(--qb-line); border-top-width: 3px; border-radius: 0.5rem; background: #fff; padding: 0.6rem 0.75rem; height: 100%; }
.panel .metric-tile.tone-success { border-top-color: var(--qb-ok-line); }
.panel .metric-tile.tone-warning { border-top-color: var(--qb-warn-line); }
.panel .metric-tile.tone-danger  { border-top-color: var(--qb-err-line); }
.panel .metric-tile.tone-info    { border-top-color: var(--qb-info-line); }
.panel .metric-tile .metric-title { font-size: 0.74rem; color: var(--qb-muted); line-height: 1.2; min-height: 1.8em; }
.panel .metric-tile .metric-value { font-size: 1.15rem; font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 0.15rem 0; word-break: break-word; }
.panel .metric-tile .metric-hint { font-size: 0.72rem; color: #475569; line-height: 1.2; }

/* KPIs de la ACL IP (grid propio) con el mismo lenguaje visual. */
.metric-card { border: 1px solid var(--qb-line); border-top: 3px solid var(--qb-primary); border-radius: 0.5rem; background: #fff; padding: 0.6rem 0.75rem; min-width: 0; }
.metric-card .metric-title { font-size: 0.74rem; color: var(--qb-muted); line-height: 1.2; }
.metric-card .metric-value { font-size: 1.15rem; font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; margin: 0.15rem 0; word-break: break-word; }
.metric-card .metric-hint { font-size: 0.72rem; color: #475569; }

/* Banners de estado (detector, ACL, HA, congestion): hasta ahora sin
   estilo, se leian como texto suelto. Fondo tenue, borde lateral, texto
   oscuro; vacios no ocupan espacio. */
.notice { display: block; padding: 0.6rem 0.9rem; margin-bottom: 0.9rem; border-radius: 0.5rem; border: 1px solid var(--qb-line); border-left-width: 4px; background: #f8fafc; color: var(--qb-text); font-size: 0.86rem; line-height: 1.45; }
.notice:empty { display: none; }
.notice-ok    { background: var(--qb-ok-bg);   border-color: var(--qb-ok-line);   color: var(--qb-ok-fg); }
.notice-warn  { background: var(--qb-warn-bg); border-color: var(--qb-warn-line); color: var(--qb-warn-fg); }
.notice-error { background: var(--qb-err-bg);  border-color: var(--qb-err-line);  color: var(--qb-err-fg); }
.notice-info  { background: var(--qb-info-bg); border-color: var(--qb-info-line); color: var(--qb-info-fg); }
.notice code { color: inherit; background: rgba(255,255,255,0.6); }
