:root {
  /* ==========================================================================
     PALETA CORPORATIVA NETBEAM COMUNICACIONES & GRAPE
     Inspirada en https://netbeam.com.co (Telecomunicaciones, Fibra Óptica y Radio)
     ========================================================================== */
  --nb-navy-dark: #07172b;
  --nb-navy: #0a2240;
  --nb-navy-light: #13335b;
  --nb-blue: #0072ce;
  --nb-cyan: #00b4d8;
  --nb-cyan-soft: #e0f2fe;
  --nb-orange: #ff6b00;
  --nb-orange-hover: #e55a00;
  --nb-orange-soft: #fff4ec;

  /* Superficies y Neutros */
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-muted: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  /* Compatibilidad con Selectores Históricos Grape */
  --accent: #0072ce;
  --accent-hover: #005bb5;
  --accent-soft: #eaf3fb;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --l2: #0284c7;

  /* Sombras y Elevaciones */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  /* Transiciones y Radios */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --trans: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   CABECERA PRINCIPAL UNIFICADA (NAVBAR CORPORATIVO NETBEAM · 54px)
   ========================================================================== */
header,
header.grape-topbar {
  background: linear-gradient(135deg, #07172b 0%, #0a2240 100%);
  color: #fff;
  padding: 0 20px;
  min-height: 54px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(7, 23, 43, 0.35);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--nb-cyan);
}

header .logo-container {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 0;
  text-decoration: none;
  color: inherit;
}

header .logo-container svg {
  height: 26px;
  width: auto;
  flex: none;
}

header .logo-badge {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

header .logo-badge .brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

header .logo-badge .brand-title .tag {
  background: linear-gradient(135deg, var(--nb-orange) 0%, #ff8c33 100%);
  color: #fff;
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

header .logo-badge .brand-subtitle {
  font-size: 10.5px;
  color: var(--nb-cyan);
  font-weight: 500;
  letter-spacing: 0.3px;
  opacity: 0.92;
}

header nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

header nav a.nav-direct-link,
.nav-dropdown-btn {
  color: #e2e8f0;
  opacity: 0.88;
  text-decoration: none;
  padding: 12px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: var(--trans);
  position: relative;
  border-radius: var(--radius-sm);
}

header nav a.nav-direct-link:hover,
.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn,
.nav-dropdown.open .nav-dropdown-btn {
  opacity: 1;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

header nav a.nav-direct-link.activo,
.nav-dropdown.activo .nav-dropdown-btn {
  opacity: 1;
  color: #ffffff;
  font-weight: 600;
  background: rgba(0, 180, 216, 0.12);
  box-shadow: inset 0 -3px 0 var(--nb-cyan);
}

.nav-dropdown-btn .chevron,
.user-pill-btn .chevron {
  width: 13px;
  height: 13px;
  opacity: 0.7;
  transition: transform 0.2s ease;
  flex: none;
}

.nav-dropdown:hover .nav-dropdown-btn .chevron,
.nav-dropdown.open .nav-dropdown-btn .chevron,
.user-dropdown.open .user-pill-btn .chevron {
  transform: rotate(180deg);
  opacity: 1;
}

/* Menú Desplegable Flotante */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 265px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 36px -4px rgba(7, 23, 43, 0.28), 0 4px 10px -2px rgba(7, 23, 43, 0.12);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 3px;
  z-index: 1000;
  animation: navDropdownFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-dropdown-menu.right {
  left: auto;
  right: 0;
  min-width: 240px;
}

@keyframes navDropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 10px 4px;
}

.nav-dropdown-item {
  color: var(--text) !important;
  text-decoration: none !important;
  padding: 8px 10px !important;
  border-radius: var(--radius-sm);
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  background: transparent !important;
  box-shadow: none !important;
  transition: var(--trans);
}

.nav-dropdown-item:hover {
  background: #f0f9ff !important;
  color: var(--nb-blue) !important;
}

.nav-dropdown-item.activo {
  background: #e0f2fe !important;
  color: var(--nb-blue) !important;
  font-weight: 600 !important;
}

.nav-dropdown-item .item-icon {
  font-size: 17px;
  line-height: 1;
  width: 24px;
  text-align: center;
  flex: none;
}

.nav-dropdown-item .item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.nav-dropdown-item .item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--nb-navy-dark);
}

.nav-dropdown-item:hover .item-title {
  color: var(--nb-blue);
}

.nav-dropdown-item .item-desc {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 5px 4px;
}

/* Conmutador rápido Mapa 2D / Vista 3D en barra superior */
.topbar-map-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  padding: 3px;
  background: rgba(4, 12, 24, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}

.map-switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.16s ease;
}

.map-switch-pill:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.map-switch-pill.activo {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.32), rgba(0, 114, 206, 0.45));
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
}

/* Botón de Perfil en Dropdown */
.user-pill-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  transition: var(--trans);
}

.user-pill-btn:hover,
.user-dropdown.open .user-pill-btn {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--nb-cyan);
}

.user-info-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.15;
}

.user-info-text .user-name {
  font-weight: 600;
  color: #ffffff;
  font-size: 12px;
}

.user-info-text .user-role {
  font-size: 10px;
  color: var(--nb-cyan);
  font-weight: 600;
}

header .cuenta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.topbar-map-tools {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.top-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.top-action-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.top-action-btn.on {
  color: #e0f2fe;
  background: rgba(0, 114, 206, 0.28);
  border-color: rgba(0, 180, 216, 0.45);
}

header .cuenta .user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  color: #ffffff;
  text-decoration: none;
  transition: var(--trans);
}

header .cuenta .user-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--nb-cyan);
}

header .cuenta .user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--nb-cyan);
  color: var(--nb-navy-dark);
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

header .cuenta .user-role {
  color: var(--nb-cyan);
  font-size: 10px;
  font-weight: 600;
}

header .cuenta .logout-link {
  color: #e2e8f0;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--trans);
  display: flex;
  align-items: center;
  gap: 4px;
}

header .cuenta .logout-link:hover {
  color: #ffffff;
  background: rgba(220, 38, 38, 0.25);
}

/* ==========================================================================
   ESTRUCTURA Y CONTENIDO PRINCIPAL
   ========================================================================== */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--nb-navy-dark);
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

h2 {
  font-size: 17px;
  font-weight: 650;
  color: var(--nb-navy);
  margin: 28px 0 12px;
}

.sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 22px;
}

a {
  color: var(--nb-blue);
  text-decoration: none;
  transition: var(--trans);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.barra {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Paneles y Tarjetas */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
}

.tarjetas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.tarjeta {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--trans);
}

.tarjeta .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tarjeta .v {
  font-size: 22px;
  font-weight: 700;
  color: var(--nb-navy-dark);
  margin-top: 6px;
}

a.tarjeta.enlace {
  color: inherit;
  text-decoration: none;
  display: block;
}

a.tarjeta.enlace:hover {
  border-color: var(--nb-cyan);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.neg { color: var(--err); }
.pos { color: var(--ok); }

/* ==========================================================================
   TABLAS CORPORATIVAS
   ========================================================================== */
.tabla {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 13.5px;
}

.tabla table { border: 0; }

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
  background: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbfc; }

td.num, th.num {
  text-align: right;
  white-space: nowrap;
}

.codigo {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 600;
  color: var(--nb-navy-light);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   CHIPS Y BADGES
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.chip.l2 {
  background: #e0f2fe;
  color: var(--l2);
}

.chip.l3 {
  background: #f1f5f9;
  color: #475467;
}

.chip.backup {
  background: var(--warn-soft);
  color: var(--warn);
}

a.chip.backup { text-decoration: none; }
.chip.fin {
  background: #f1f5f9;
  color: #94a3b8;
  text-decoration: line-through;
}

/* ==========================================================================
   BOTONES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--nb-blue) 0%, var(--accent-hover) 100%);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: var(--trans);
}

.btn:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #004b99 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.brand-orange {
  background: linear-gradient(135deg, var(--nb-orange) 0%, var(--nb-orange-hover) 100%);
}

.btn.brand-orange:hover {
  background: linear-gradient(135deg, var(--nb-orange-hover) 0%, #c44d00 100%);
}

.btn.sec {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}

.btn.sec:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--nb-navy-dark);
}

.btn.peligro {
  background: #ffffff;
  color: var(--err);
  border: 1px solid #fca5a5;
}

.btn.peligro:hover {
  background: var(--err-soft);
  border-color: var(--err);
}

.btn.peq {
  padding: 4px 10px;
  font-size: 12px;
}

form.inline { display: inline; }

/* ==========================================================================
   FORMULARIOS Y CAMPOS DE ENTRADA
   ========================================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
}

label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13.5px;
  background: #ffffff;
  color: var(--text);
  transition: var(--trans);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--nb-blue);
  box-shadow: 0 0 0 3px rgba(0, 114, 206, 0.18);
}

textarea { min-height: 70px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin: 0 0 18px;
  background: #ffffff;
}

legend {
  font-weight: 650;
  padding: 0 8px;
  color: var(--nb-navy);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ayuda {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* ==========================================================================
   ALERTAS Y MENSAJES FLASH
   ========================================================================== */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-xs);
  border-left: 4px solid;
}

.flash.ok {
  background: var(--ok-soft);
  color: #065f46;
  border-left-color: var(--ok);
}

.flash.error {
  background: var(--err-soft);
  color: #991b1b;
  border-left-color: var(--err);
}

.aviso {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  background: var(--warn-soft);
  color: #92400e;
  border-left: 4px solid var(--warn);
}

dl.datos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 24px;
  margin: 0;
}

dl.datos dt {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

dl.datos dd {
  margin: 0;
  font-weight: 600;
  color: var(--nb-navy-dark);
}

.oculto { display: none !important; }

/* ==========================================================================
   TOPOLOGÍA, RED Y MONITOREO PRTG
   ========================================================================== */
#red {
  height: 80vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.leyenda {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0;
  align-items: center;
}

.leyenda span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sim { overflow-x: auto; }
.vacio { color: var(--muted); padding: 24px; text-align: center; }

label.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 12px 4px 0;
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

label.check input { width: auto; }

tr.total th {
  background: #f8fafc;
  color: var(--nb-navy-dark);
  font-size: 14px;
  font-weight: 700;
  border-top: 2px solid var(--nb-blue);
}

.filtros-red {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.filtros-red input, .filtros-red select {
  width: auto;
  flex: 0 1 260px;
  margin: 0;
}

.filtros-red #filtro-res { margin-left: auto; }

@media (max-width: 700px) {
  .filtros-red input, .filtros-red select { flex: 1 1 100%; }
}

.buscar-opcion {
  margin-bottom: 4px;
  font-size: 12.5px;
  padding: 6px 10px;
}

/* Monitoreo PRTG */
.estado-prtg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: #f1f5f9;
  color: #475467;
}

.estado-prtg::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.estado-prtg.arriba {
  background: var(--ok-soft);
  color: #047857;
}

.estado-prtg.advertencia {
  background: var(--warn-soft);
  color: #b45309;
}

.estado-prtg.caido {
  background: var(--err-soft);
  color: var(--err);
}

.conexion-prtg {
  border-left: 4px solid #10b981;
  padding: 14px 18px;
}

.conexion-prtg.mal {
  border-left-color: var(--err);
}

/* Medidores de Capacidad y Reparto */
.reparto {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.reparto:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.medidor {
  height: 12px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.medidor .lleno {
  height: 100%;
  background: var(--nb-blue);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.medidor.excedido .lleno {
  background: var(--err);
}

.ocupacion {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.medidor.vacio-medidor { background: var(--line); }

.mini-medidor {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.mini-medidor .medidor {
  height: 7px;
  width: 65px;
  flex: none;
}

.medidor.real {
  background: #e0f2fe;
  position: relative;
}

.medidor.real .lleno {
  background: var(--nb-cyan);
}

.medidor.real.saturado .lleno {
  background: var(--err);
}

.ocup-mini {
  display: grid;
  grid-template-columns: auto 64px auto;
  gap: 1px 6px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.ocup-mini .medidor { height: 4px; width: 64px; }
.ocup-mini .sep { grid-column: 1 / -1; height: 3px; }

.medidor .pico {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--nb-navy-dark);
  opacity: 0.65;
}

.medidor .pico.alto {
  background: var(--err);
  opacity: 1;
}

a.alerta-nodo {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--err-soft);
  color: var(--err);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

a.alerta-nodo:hover {
  background: var(--err);
  color: #fff;
}

fieldset.sin-borde {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

/* ==========================================================================
   PORTAL DE AUTENTICACIÓN / LOGIN NETBEAM CORPORATIVO
   ========================================================================== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  background: radial-gradient(circle at 10% 20%, #0d294d 0%, #061527 90%);
  position: relative;
  overflow: hidden;
}

/* Red de Nodos en Fondo (Constelación Decorativa) */
.auth-wrapper::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    radial-gradient(rgba(0, 180, 216, 0.15) 1px, transparent 1px),
    radial-gradient(rgba(255, 107, 0, 0.1) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  opacity: 0.8;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 36px 32px 32px;
  position: relative;
  z-index: 1;
}

.auth-header {
  text-align: center;
  margin-bottom: 26px;
}

.auth-logo-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--nb-navy) 0%, var(--nb-navy-dark) 100%);
  border-radius: 14px;
  box-shadow: 0 8px 16px rgba(0, 114, 206, 0.25);
  margin-bottom: 14px;
  border: 1px solid rgba(0, 180, 216, 0.35);
}

.auth-logo-symbol svg {
  width: 32px;
  height: 32px;
}

.auth-brand-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--nb-navy-dark);
  letter-spacing: -0.5px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-brand-name span.orange {
  color: var(--nb-orange);
}

.auth-app-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--nb-navy);
  margin: 0;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrapper .input-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-input-wrapper input {
  padding-left: 38px;
  padding-right: 12px;
  height: 44px;
  font-size: 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  transition: var(--trans);
}

.auth-input-wrapper input:focus {
  border-color: var(--nb-blue);
  box-shadow: 0 0 0 3.5px rgba(0, 114, 206, 0.15);
}

.auth-btn-submit {
  width: 100%;
  height: 46px;
  background: linear-gradient(135deg, var(--nb-navy) 0%, var(--nb-navy-dark) 100%);
  color: #ffffff;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(10, 34, 64, 0.3);
  transition: var(--trans);
  margin-top: 6px;
}

.auth-btn-submit:hover {
  background: linear-gradient(135deg, var(--nb-navy-light) 0%, var(--nb-navy) 100%);
  box-shadow: 0 6px 18px rgba(10, 34, 64, 0.45);
  transform: translateY(-1px);
}

.auth-btn-submit:active {
  transform: translateY(0);
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-footer a {
  color: var(--nb-blue);
  font-weight: 500;
}

.auth-meta-bottom {
  margin-top: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11.5px;
  letter-spacing: 0.3px;
  z-index: 1;
}

.auth-meta-bottom strong {
  color: #ffffff;
}

/* ==========================================================================
   GESTIÓN DE USUARIOS, PERFILES Y PERMISOS RBAC
   ========================================================================== */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.perm-table-group {
  background: #f1f5f9;
  font-weight: 700;
  font-size: 12px;
  color: var(--nb-navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
}

.perm-selector {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  gap: 2px;
}

.perm-option {
  cursor: pointer;
  margin: 0 !important;
  display: inline-flex;
}

.perm-option input[type="radio"] {
  display: none !important;
}

.perm-option span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
  border-radius: 4px;
  transition: var(--trans);
  user-select: none;
}

.perm-option:hover span {
  color: var(--nb-navy-dark);
}

.perm-option input[type="radio"]:checked + span.lvl-0 {
  background: #ffffff;
  color: #64748b;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.perm-option input[type="radio"]:checked + span.lvl-1 {
  background: var(--nb-blue);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 114, 206, 0.35);
}

.perm-option input[type="radio"]:checked + span.lvl-2 {
  background: #059669;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.35);
}

.perm-preview-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
  transition: var(--trans);
}

.perm-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px 14px;
  margin-top: 10px;
}

.perm-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.badge-lvl-0 {
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.badge-lvl-1 {
  background: #e0f2fe;
  color: #0284c7;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.badge-lvl-2 {
  background: #ecfdf5;
  color: #059669;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
