:root {
  /* CisoWeb Premium Palette - Dark Edition */
  --cisodark: #0C263F;    /* Navy Corporativo Profundo */
  --cisoblue: #0085B2;    /* Cian Eléctrico Moderno */
  --cisogold: #EFB335;    /* Dorado de Acción/Alerta */
  --cisogrey: #F3F4F6;    /* Gris de Limpieza */
  
  /* Core Backgrounds (High Fidelity Dark Theme) */
  --bg-main: #061626;     /* Fondo base ultra oscuro */
  --bg-sidebar: #0C263F;  /* Sidebar Navy */
  --bg-card: #112B44;     /* Tarjetas Navy más claras para contraste */
  --bg-banner: #0C263F;
  
  /* Design Tokens - Optimized for Visibility */
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #E5E7EB;    /* Gray-200 (Alta visibilidad) */
  --text-muted: #9CA3AF;   /* Gray-400 */
  --text-dim: #6B7280;     /* Gray-500 */
  --text-on-dark: #FFFFFF;
  
  /* Functional Accents */
  --accent-gold: var(--cisogold); 
  --accent-teal: var(--cisoblue); 
  --accent-amber-gold: var(--cisogold);
  --accent-red-soft: #EF4444; 
  --accent-blue-gray: #475569;
  --accent-burgundy: #B91C1C;
  --accent-white-glow: rgba(255, 255, 255, 0.1);
  
  /* Typography Tokens */
  --font-display: 'Montserrat', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  /* Effects */
  --glass-blur: blur(15px);
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.2);
  --shadow: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 25px rgba(0, 133, 178, 0.2);
  
  --border-radius: 16px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   BASE & TYPOGRAPHY
   ============================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Custom Scrollbar - Optimized for High Fidelity Dark Theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 133, 178, 0.15); /* Subtle Cisoblue */
  border-radius: 10px;
  border: 2px solid var(--bg-main);
  transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 133, 178, 0.4); /* Brighter on hover */
}

/* Firefox Support */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 133, 178, 0.2) var(--bg-main);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #FFFFFF; /* Encabezados siempre blancos en tema oscuro */
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin { 
  to { transform: rotate(360deg); } 
}

/* =============================================
   LAYOUT
   ============================================= */
.container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-main);
}

.content-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.content-wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* =============================================
   SIDEBAR (Navy Premium)
   ============================================= */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: var(--transition);
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  color: var(--text-on-dark);
}

.sidebar.collapsed { width: 85px; }

.sidebar.collapsed .sidebar-header h3,
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-group-header span,
.sidebar.collapsed .sidebar-menu span {
  display: none;
}

.sidebar-header { padding: 30px 25px; }

.sidebar-header .brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.sidebar-header .logo-icon {
  width: 42px !important;
  height: 42px !important;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  flex-shrink: 0 !important;
  overflow: hidden !important;
  position: relative;
}

.sidebar-header .logo-icon img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  margin: 0 !important;
}

.sidebar-header .logo-icon:hover {
  transform: scale(1.1) rotate(3deg);
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
  font-size: 1rem;
  font-weight: 800;
  color: white;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-menu { padding: 10px 15px; flex: 1; }

.sidebar-section-title {
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 25px 15px 10px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  gap: 14px;
  margin: 4px 0;
  border-radius: 12px;
}

.sidebar-menu a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.sidebar-menu a.active {
  background: rgba(0, 133, 178, 0.15);
  color: white;
  border: 1px solid rgba(0, 133, 178, 0.2);
}

.sidebar-menu a.active i { color: var(--cisoblue); }

/* --- Secciones Desplegables Sidebar --- */
.sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: var(--transition);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 8px;
}

.sidebar-group-header:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.sidebar-group-content {
  padding-left: 15px;
  margin-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  display: none;
}

.sidebar-group.open .sidebar-group-content { display: block; }

/* =============================================
   TOPBAR (Premium Dark)
   ============================================= */
.topbar {
  height: 80px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 1100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.topbar-breadcrumbs {
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-breadcrumbs span.active { color: #FFFFFF; }

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

.topbar-action-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.topbar-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cisoblue);
  border-color: var(--cisoblue);
}

.topbar-user {
  display: flex; align-items: center; gap: 12px;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 700;
}

.topbar-user-avatar {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--cisoblue);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  box-shadow: 0 0 15px rgba(0, 133, 178, 0.3);
}

/* =============================================
   COMPONENTS: CARDS, HERO, TABLES
   ============================================= */
.hero-cyber {
  background: var(--cisodark);
  background: linear-gradient(135deg, var(--cisodark) 0%, #1a3b5c 100%);
  padding: 40px;
  border-radius: var(--border-radius);
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
  color: white;
  box-shadow: 0 20px 40px rgba(12, 38, 63, 0.2);
}

.hero-cyber h2 { color: white; margin-bottom: 10px; }
.hero-cyber p { color: rgba(255, 255, 255, 0.7); }

.stat-card-cyber {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 30px;
  border-radius: var(--border-radius);
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.stat-card-cyber:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: var(--cisoblue);
}

.stat-card-cyber .label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 15px;
  display: block;
}

.stat-card-cyber .value {
  font-size: 2.6rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 5px;
  display: block;
  text-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.stat-card-cyber .illustration {
  position: absolute;
  right: 20px;
  bottom: 20px;
  opacity: 0.15;
  font-size: 3.5rem;
  color: var(--cisoblue);
  transition: var(--transition);
}

.stat-card-cyber:hover .illustration {
  opacity: 0.3;
  transform: scale(1.1) rotate(-5deg);
}

.glass-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 35px;
  box-shadow: var(--shadow-sm);
}

/* =============================================
   FORMS & INPUTS
   ============================================= */
.form-group { margin-bottom: 25px; }

.form-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-control {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--cisoblue);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(0, 133, 178, 0.15);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn-cyber {
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  border: none;
}

.btn-cyber-primary {
  background: var(--cisoblue);
  color: white;
  box-shadow: 0 8px 20px rgba(0, 133, 178, 0.25);
}

.btn-cyber-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 12px 25px rgba(0, 133, 178, 0.35);
}

/* =============================================
   TABLES (Cyber Edition)
   ============================================= */
.table-responsive {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

table { 
  width: 100%; 
  border-collapse: separate; 
  border-spacing: 0; 
}

th { 
  text-align: left; 
  padding: 15px 20px; 
  color: var(--cisoblue); 
  font-weight: 800; 
  font-size: 11px; 
  text-transform: uppercase; 
  letter-spacing: 0.15em;
  background: rgba(0, 133, 178, 0.05);
  border-bottom: 2px solid var(--border-color);
}

th:first-child { border-top-left-radius: 12px; }
th:last-child { border-top-right-radius: 12px; }

td { 
  padding: 16px 20px; 
  border-bottom: 1px solid var(--border-color); 
  color: var(--text-main); 
  font-weight: 500; 
  font-size: 13px;
  transition: var(--transition);
}

tr:last-child td { border-bottom: none; }

tr:hover td { 
  background: rgba(255, 255, 255, 0.02); 
  color: #FFFFFF;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge-active { background: rgba(0, 133, 178, 0.15); color: var(--cisoblue); border: 1px solid rgba(0, 133, 178, 0.2); }
.status-badge-pending { background: rgba(239, 179, 53, 0.15); color: var(--cisogold); border: 1px solid rgba(239, 179, 53, 0.2); }
.status-badge-success { background: rgba(16, 185, 129, 0.15); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge-danger { background: rgba(239, 68, 68, 0.15); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.status-badge-warning { background: rgba(239, 179, 53, 0.15); color: var(--cisogold); border: 1px solid rgba(239, 179, 53, 0.2); }


/* =============================================
   DASHBOARD & GRID UTILITIES
   ============================================= */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 25px;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(100px, auto);
  gap: 20px;
}

.bento-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 25px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.bento-item:hover {
  border-color: var(--cisoblue);
  box-shadow: var(--shadow-glow);
}

.health-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  box-shadow: 0 0 10px currentColor;
}

.pulse-animation {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 1024px) {
  .bento-grid { grid-template-columns: repeat(1, 1fr); }
  .bento-item { grid-column: span 1 !important; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); position: fixed; }
  .content-body { padding: 20px; }
}
