:root{ --sidebar-w: 260px; }
body{ background:#f6f7fb; transition: background 0.3s ease; }
.sidebar{
  width: var(--sidebar-w);
  position: fixed; top:0; left:0; bottom:0;
  background:#111827;
  padding: 18px 14px;
  overflow-y:auto;
  z-index: 1000;
}
.sidebar .brand{
  color:#fff; font-weight:700; letter-spacing:.3px;
  font-size: 14px;
  display:flex; align-items:center; gap:10px;
  margin-bottom: 18px;
}
.sidebar .brand .dot{ 
  width:10px; height:10px; border-radius:50%; 
  background:#22c55e; display:inline-block;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.sidebar a{
  color:#cbd5e1; text-decoration:none; display:flex; gap:10px; align-items:center;
  padding:10px 10px; border-radius:10px; font-size: 14px;
  transition: all 0.2s ease;
}
.sidebar a:hover{ background:#1f2937; color:#fff; transform: translateX(4px); }
.sidebar a.active{ background:#2563eb; color:#fff; }
.sidebar .section{ color:#64748b; font-size: 11px; margin:18px 10px 6px; text-transform:uppercase; letter-spacing:.08em;}
.main{ margin-left: var(--sidebar-w); padding: 22px 24px 40px; min-height: 100vh; }
.card{ 
  border:0; border-radius:14px; 
  box-shadow: 0 6px 20px rgba(17,24,39,.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(17,24,39,.12);
}
.table thead th{ 
  font-size: 12px; text-transform: uppercase; 
  letter-spacing: .06em; color:#475569;
  border-bottom: 2px solid #e2e8f0;
}
.table tbody tr {
  transition: background 0.15s ease;
}
.table tbody tr:hover {
  background: #f8fafc;
}
.badge{ border-radius: 999px; font-size: 11px; font-weight: 600; padding: 4px 10px; }
.kpi{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.kpi .label{ font-size: 12px; color:#64748b; }
.kpi .value{ 
  font-size: 24px; font-weight: 800; 
  color:#0f172a; line-height: 1.1;
  counter-reset: value var(--target);
}
.kpi .delta{ font-size: 12px; }
.toolbar{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:space-between; }
.toolbar .left, .toolbar .right{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
small.help{ color:#64748b; }
.codepill{ background:#0b1220; color:#e2e8f0; padding:2px 8px; border-radius:999px; font-size:12px; }
.modal-header{ border-bottom: 1px solid rgba(148,163,184,.35); }
.modal-footer{ border-top: 1px solid rgba(148,163,184,.35); }

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
  min-width: 300px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn 0.3s ease;
  border-left: 4px solid #2563eb;
}
.toast.success { border-left-color: #22c55e; }
.toast.warning { border-left-color: #f59e0b; }
.toast.error { border-left-color: #ef4444; }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.toast-message { font-size: 13px; color: #64748b; }
.toast-close {
  background: none; border: none; color: #94a3b8;
  cursor: pointer; font-size: 18px; padding: 0;
  width: 20px; height: 20px; flex-shrink: 0;
}
@keyframes slideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  to { transform: translateX(400px); opacity: 0; }
}
.toast.removing { animation: slideOut 0.3s ease forwards; }

/* LOADING SKELETONS */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }

/* CHARTS */
.chart-container {
  position: relative;
  height: 280px;
  margin-top: 16px;
}
.chart-container canvas {
  max-height: 280px;
}

/* STATS CARD GRADIENT */
.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -20px); }
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}
.stat-label {
  font-size: 13px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

/* LOADING OVERLAY */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.loading-overlay.active { display: flex; }
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .toast-container { left: 10px; right: 10px; }
  .toast { min-width: auto; }
}

/* DARK MODE SUPPORT */
:root {
  --bg-main: #f6f7fb;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --sidebar-bg: #111827;
  --sidebar-text: #cbd5e1;
  --hover-bg: #f8fafc;
}

[data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --sidebar-bg: #020617;
  --sidebar-text: #e2e8f0;
  --hover-bg: #1e293b;
}

[data-theme="dark"] body {
  background: var(--bg-main);
  color: var(--text-primary);
}

[data-theme="dark"] .card {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .table {
  color: var(--text-primary);
  --bs-table-bg: var(--bg-card);
}

[data-theme="dark"] .table thead th {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .table tbody tr:hover {
  background: var(--hover-bg);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .modal-content {
  background: var(--bg-card);
  color: var(--text-primary);
}

[data-theme="dark"] .toast {
  background: var(--bg-card);
  color: var(--text-primary);
}

[data-theme="dark"] .conversation-body {
  background: var(--hover-bg);
}

[data-theme="dark"] .sidebar {
  background: var(--sidebar-bg);
}

/* DARK MODE TOGGLE */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  left: 280px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
  transition: all 0.3s ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37,99,235,.4);
}

/* NOTIFICATION CENTER */
.notification-bell {
  position: relative;
  cursor: pointer;
  font-size: 20px;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.notification-bell:hover {
  background: var(--hover-bg);
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}

.notification-dropdown {
  position: absolute;
  top: 60px;
  right: 20px;
  width: 380px;
  max-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
  z-index: 9999;
  display: none;
  overflow: hidden;
}

.notification-dropdown.active {
  display: block;
  animation: slideDown 0.3s ease;
}

.notification-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notification-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  gap: 12px;
}

.notification-item:hover {
  background: var(--hover-bg);
}

.notification-item.unread {
  background: #eff6ff;
}

[data-theme="dark"] .notification-item.unread {
  background: rgba(37, 99, 235, 0.1);
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.notification-icon.success { background: #dcfce7; color: #16a34a; }
.notification-icon.warning { background: #fef3c7; color: #f59e0b; }
.notification-icon.error { background: #fee2e2; color: #ef4444; }
.notification-icon.info { background: #dbeafe; color: #2563eb; }

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.notification-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.notification-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* MOBILE MENU */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
    z-index: 1000;
  }
  
  .main {
    margin-left: 0;
    padding-top: 80px;
  }
  
  .theme-toggle {
    left: 20px;
    bottom: 80px;
  }
  
  .notification-dropdown {
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* ENHANCED STATS CARDS */
.stat-card-animated {
  position: relative;
  overflow: hidden;
}

/* Shimmer animation removed - was causing performance issues */
