:root {
  /* Enterprise Color System - Charcoal Grey + White + Trust Blue + Controlled Red */
  --charcoal-900: #1a1d24;
  --charcoal-800: #23272f;
  --charcoal-700: #2d323c;
  --charcoal-600: #3a4049;
  
  --white: #ffffff;
  --white-90: rgba(255, 255, 255, 0.9);
  --white-70: rgba(255, 255, 255, 0.7);
  --white-50: rgba(255, 255, 255, 0.5);
  --white-20: rgba(255, 255, 255, 0.2);
  --white-10: rgba(255, 255, 255, 0.1);
  --white-05: rgba(255, 255, 255, 0.05);
  
  --trust-blue: #0066ff;
  --trust-blue-hover: #0052cc;
  --trust-blue-light: #3385ff;
  --trust-blue-pale: rgba(0, 102, 255, 0.15);
  
  --controlled-red: #dc2626;
  --controlled-red-light: #ef4444;
  --controlled-red-pale: rgba(220, 38, 38, 0.15);
  
  --success-green: #16a34a;
  --success-green-pale: rgba(22, 163, 74, 0.15);
  
  --warning-orange: #ea580c;
  --warning-orange-pale: rgba(234, 88, 12, 0.15);
  
  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ================= RESET ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-body);
}

/* ================= LAYOUT ================= */
body {
  background: var(--charcoal-900);
  color: var(--white);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

html { 
  overflow-x: hidden; 
}

.app {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 240px;
  background: var(--charcoal-800);
  padding: 28px 18px;
  border-right: 1px solid var(--white-10);
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.3s ease;
  z-index: 100;
}

.sidebar.collapsed {
  width: 80px;
}

.sidebar-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 40px;
  color: var(--trust-blue-light);
  letter-spacing: -0.02em;
}

.sidebar.collapsed .sidebar-title {
  font-size: 0.7rem;
  line-height: 1.2;
  margin-bottom: 20px;
}

.sidebar-nav ul {
  list-style: none;
  margin-bottom: 24px;
}

.sidebar-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white-50);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 6px 12px 10px;
}

.sidebar.collapsed .sidebar-section-label { 
  display: none; 
}

.sidebar.collapsed .sidebar-badge { 
  display: none; 
}

.sidebar-nav li {
  margin-bottom: 6px;
  border-radius: 10px;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-nav li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--trust-blue);
  transform: scaleY(0);
  transition: transform 0.2s ease;
  border-radius: 0 3px 3px 0;
}

.sidebar-nav li.active::before,
.sidebar-nav li:hover::before {
  transform: scaleY(1);
}

.sidebar-nav li.active {
  background: var(--trust-blue-pale);
}

.sidebar-nav li:hover {
  background: var(--charcoal-700);
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--white-70);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.2s ease;
  position: relative;
}

.sidebar-nav li.active a {
  color: var(--trust-blue-light);
  font-weight: 600;
}

.sidebar-nav li:hover a {
  color: var(--white);
}

.sidebar-nav .nav-icon {
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.sidebar-nav .nav-text {
  flex: 1;
}

.sidebar.collapsed .nav-text {
  display: none;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--white-05);
  color: var(--white-70);
  border: 1px solid var(--white-10);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* Collapsed tooltips */
.sidebar.collapsed .sidebar-nav li a::after {
  content: attr(data-label);
  position: absolute;
  left: 70px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--charcoal-700);
  color: var(--white);
  border: 1px solid var(--white-10);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 1001;
}

.sidebar.collapsed .sidebar-nav li a:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

/* ================= MAIN CONTENT ================= */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px 48px;
  width: calc(100% - 240px);
  background: var(--charcoal-900);
  overflow-x: hidden;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
  margin-left: 80px;
  width: calc(100% - 80px);
}

/* ================= DASHBOARD HEADER ================= */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.02em;
}

.dashboard-subtitle {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--white-50);
  margin-top: 4px;
}

.header-icons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
  background: var(--charcoal-700);
  color: var(--white-70);
  border: 1px solid var(--white-10);
  transition: all 0.2s ease;
  position: relative;
}

.header-icon:hover {
  background: var(--charcoal-600);
  color: var(--white);
  border-color: var(--white-20);
  transform: translateY(-1px);
}

.header-icon.active {
  background: var(--trust-blue);
  color: var(--white);
  border-color: var(--trust-blue);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--controlled-red);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--charcoal-900);
}

/* ================= SEARCH OVERLAY ================= */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 29, 36, 0.95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
}

.search-overlay.active {
  display: flex;
}

.search-box {
  width: 600px;
  max-width: 90%;
  background: var(--charcoal-800);
  border: 1px solid var(--white-20);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.search-input {
  width: 100%;
  padding: 16px;
  background: var(--charcoal-700);
  border: 1px solid var(--white-10);
  border-radius: 8px;
  color: var(--white);
  font-size: 1rem;
  font-weight: 400;
}

.search-input:focus {
  outline: none;
  border-color: var(--trust-blue);
  box-shadow: 0 0 0 3px var(--trust-blue-pale);
}

.search-close {
  position: absolute;
  top: 40px;
  right: 40px;
  width: 44px;
  height: 44px;
  background: var(--charcoal-700);
  border: 1px solid var(--white-10);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--white-70);
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.search-close:hover {
  background: var(--charcoal-600);
  color: var(--white);
}

/* ================= NOTIFICATION PANEL ================= */
.notification-panel {
  position: fixed;
  top: 80px;
  right: 48px;
  width: 380px;
  max-height: 500px;
  background: var(--charcoal-800);
  border: 1px solid var(--white-20);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  flex-direction: column;
}

.notification-panel.active {
  display: flex;
}

.notification-header {
  padding: 20px;
  border-bottom: 1px solid var(--white-10);
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
}

.notification-list {
  overflow-y: auto;
  max-height: 400px;
}

.notification-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--white-05);
  cursor: pointer;
  transition: background 0.15s;
}

.notification-item:hover {
  background: var(--charcoal-700);
}

.notification-item.unread {
  background: var(--white-05);
}

.notification-title {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--white-90);
  margin-bottom: 4px;
}

.notification-text {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--white-50);
  line-height: 1.4;
}

.notification-time {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--white-50);
  margin-top: 6px;
}

.notification-severity {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 8px;
}

.notification-severity.critical {
  background: var(--controlled-red-pale);
  color: var(--controlled-red-light);
}

.notification-severity.warning {
  background: var(--warning-orange-pale);
  color: var(--warning-orange);
}

/* ================= PROFILE PANEL ================= */
.profile-panel {
  position: fixed;
  top: 80px;
  right: 48px;
  width: 360px;
  background: var(--charcoal-800);
  border: 1px solid var(--white-20);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  flex-direction: column;
  max-height: 600px;
  overflow-y: auto;
}

.profile-panel.active {
  display: flex;
}

.profile-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--white-10);
}

.profile-panel-email {
  font-size: 0.95rem;
  color: var(--white-90);
  font-weight: 500;
}

.profile-panel-close {
  background: none;
  border: none;
  color: var(--white-70);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.profile-panel-close:hover {
  color: var(--white);
}

.profile-card {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--white-10);
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--trust-blue), var(--trust-blue-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--white);
  margin: 0 auto 16px;
}

.profile-greeting {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 16px;
}

.profile-manage-btn {
  padding: 12px 20px;
  background: transparent;
  border: 1px solid var(--trust-blue-pale);
  border-radius: 8px;
  color: var(--trust-blue-light);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
}

.profile-manage-btn:hover {
  background: var(--trust-blue-pale);
}

.profile-actions {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--white-10);
}

.profile-action-btn {
  flex: 1;
  padding: 12px 16px;
  background: var(--white-05);
  border: 1px solid var(--white-10);
  border-radius: 8px;
  color: var(--white-70);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
}

.profile-action-btn:hover {
  background: var(--white-10);
  color: var(--white);
}

.profile-section-title {
  padding: 16px 20px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white-50);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-menu-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  color: var(--white-70);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.95rem;
}

.profile-menu-item:hover {
  background: var(--white-05);
  color: var(--white);
}

.profile-menu-item i {
  margin-right: 12px;
  font-size: 1rem;
  width: 20px;
}

.profile-menu-label {
  flex: 1;
}

/* ================= TOAST NOTIFICATIONS ================= */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-notification {
  background: var(--trust-blue);
  color: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
  font-family: var(--font-body);
  font-size: 14px;
}

.toast-notification.success {
  background: var(--success-green);
}

.toast-notification.error {
  background: var(--controlled-red);
}

.toast-notification.warning {
  background: var(--warning-orange);
}

/* ================= LOADING STATES ================= */
.metric-value.loading {
  opacity: 0.5;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

/* ================= CONNECTION STATUS ================= */
.connection-status {
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 8px 16px;
  background: var(--charcoal-700);
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.connection-status.visible {
  opacity: 1;
}

.connection-status.online {
  color: var(--success-green);
}

.connection-status.offline {
  color: var(--controlled-red);
}

.connection-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* ================= REAL-TIME UPDATES ================= */
@keyframes flashUpdate {
  0% { background-color: rgba(0, 102, 255, 0.3); }
  100% { background-color: transparent; }
}

.metric-card.updated {
  animation: flashUpdate 1s ease;
}

.activity-item.new {
  animation: flashUpdate 1s ease;
}