.kpi-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #fbbf24;
}
#map {
  background: #0f172a;
}
.leaflet-popup-content {
  color: #0f172a;
}

/* ---------- Shell: menú lateral colapsable ---------- */
#sidebar {
  width: 240px;
  transition: width 0.2s ease;
}
#sidebar.colapsado {
  width: 56px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  color: #cbd5e1;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.menu-item:hover {
  background: #1e293b;
  color: #fff;
}
.menu-item.activo {
  background: #f59e0b;
  color: #0f172a;
  font-weight: 600;
  border-left-color: #fbbf24;
}
.menu-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.menu-label {
  white-space: nowrap;
  overflow: hidden;
}

/* colapsado: solo iconos */
#sidebar.colapsado .menu-item {
  justify-content: center;
  padding: 12px 0;
}
#sidebar.colapsado .menu-label {
  display: none;
}

/* ---------- Panel central dinámico ---------- */
.vista.hidden {
  display: none;
}

.placeholder-box {
  background: #1e293b;
  border: 1px dashed #475569;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}


/* ---------- Almacén: fila bajo mínimo ---------- */
.row-bajo-minimo { background: rgba(239, 68, 68, 0.14); }
.row-bajo-minimo td:first-child { border-left: 3px solid #ef4444; }
.badge-bajo {
  background: #ef4444; color: #fff; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* ---------- Financiero: cards del comparativo ---------- */
.cmp-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.cmp-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.cmp-value { font-size: 26px; font-weight: 700; color: #fbbf24; }
.cmp-sub { font-size: 12px; color: #94a3b8; }
.cmp-card.cmp-alerta { border-color: #ef4444; background: rgba(239, 68, 68, 0.12); }
.cmp-card.cmp-alerta .cmp-value { color: #ef4444; }
.cmp-card.cmp-sub { border-color: #22c55e; background: rgba(34, 197, 94, 0.10); }
.cmp-card.cmp-sub .cmp-value { color: #22c55e; }


/* ---------- Tabs internos (Atención) ---------- */
.tab-btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; color: #cbd5e1; background: transparent; border: 1px solid #334155; cursor: pointer; }
.tab-btn.tab-activo { background: #f59e0b; color: #0f172a; font-weight: 600; border-color: #f59e0b; }

/* ---------- SLA Ley 1755 ---------- */
.row-sla-vencida { background: rgba(239, 68, 68, 0.14); }
.row-sla-vencida td:first-child { border-left: 3px solid #ef4444; }
.row-sla-riesgo { background: rgba(245, 158, 11, 0.12); }
.row-sla-riesgo td:first-child { border-left: 3px solid #f59e0b; }
.badge-sla-vencida { background: #ef4444; color: #fff; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-sla-riesgo { background: #f59e0b; color: #0f172a; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }


/* ---------- Financiero: gráficos ---------- */
.card-chart { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 14px 16px; }
.chart-title { font-size: 12px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.etr-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 12px 14px; }
.etr-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.etr-value { font-size: 20px; font-weight: 700; color: #fbbf24; margin-top: 3px; }
.etr-sub { font-size: 11px; color: #64748b; margin-top: 2px; }


/* Resaltado de luminaria seleccionada (lista de fallas) */
@keyframes pulsoResaltado {
  0%   { transform: scale(0.5); opacity: 0.7; }
  70%  { transform: scale(2.0); opacity: 0; }
  100% { transform: scale(2.0); opacity: 0; }
}


/* ---------- Responsive móvil (≤768px) ---------- */
@media (max-width: 768px) {
  /* Sidebar como overlay deslizante, oculto por defecto */
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1100;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.55);
  }
  #sidebar.abierto { transform: translateX(0) !important; }
  #sidebar.colapsado { width: 264px; }
  #sidebar.colapsado .menu-label { display: inline; }

  /* Header compacto */
  header h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 52vw;
  }
  #usuarioLabel { display: none; }

  /* KPIs compactos */
  .kpi-card { padding: 10px 12px; }
  .kpi-label { font-size: 10px; }
  .kpi-value { font-size: 18px; }

  /* Búsqueda del mapa más compacta */
  #gisBusqueda { left: 52px; max-width: 62%; }
  #gisBusqueda input { font-size: 12px; }
}

/* ---------- Grupo desplegable del menú (submódulos) ---------- */
.menu-grupo .menu-hijo { display: none; }
.menu-grupo.grupo-abierto .menu-hijo { display: flex; }
.menu-hijo { padding-left: 38px; font-size: 12px; }
.menu-hijo .menu-icon { font-size: 13px; }
.menu-chevron { margin-left: auto; font-size: 10px; color: #64748b; transition: transform 0.18s; }
.menu-grupo:not(.grupo-abierto) .menu-chevron { transform: rotate(-90deg); }
.menu-grupo-header.menu-item.activo { background: rgba(245, 158, 11, 0.15); }
/* colapsado: ocultar hijos y chevron */
#sidebar.colapsado .menu-hijo { display: none !important; }
#sidebar.colapsado .menu-chevron { display: none; }
