/* Inter font loaded here so every admin page gets it automatically */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* Legacy alias: many admin pages use var(--muted) instead of var(--text-muted) */
:root, [data-theme] { --muted: var(--text-muted); }

/* =============================================
   PREMIUM DESIGN SYSTEM — Admin Panel v2
   ============================================= */

/* Default: applied when NO data-theme is set on <html> */
:root {
  --bg: #0a0b1e;
  --bg-alt: #0e0f2a;
  --bg-card: #12133a;
  --bg-card-hover: #181954;
  --bg-input: #1a1b4b;
  --text: #f1f5f9;
  --text-secondary: #c8cce5;
  --text-muted: #7d80ad;
  --text-dim: #4a4d7a;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.10);
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: rgba(99,102,241,0.12);
  --primary-glow: rgba(99,102,241,0.25);
  --accent: #8b5cf6;
  --accent-light: rgba(139,92,246,0.12);
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.12);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,0.12);
  --sidebar-bg: #07081a;
  --sidebar-alt: #0a0b24;
  --sidebar-text: #6a6d9a;
  --sidebar-hover: #0e0f30;
  --sidebar-active: rgba(99,102,241,0.15);
  --sidebar-active-text: #a5b4fc;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px -4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px -8px rgba(99,102,241,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

/* --- Theme: Dark Premium --- */
[data-theme="dark"] {
  --bg: #0a0b1e;
  --bg-alt: #0e0f2a;
  --bg-card: #12133a;
  --bg-card-hover: #181954;
  --bg-input: #1a1b4b;
  --text: #f1f5f9;
  --text-secondary: #c8cce5;
  --text-muted: #7d80ad;
  --text-dim: #4a4d7a;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.10);
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: rgba(99,102,241,0.12);
  --primary-glow: rgba(99,102,241,0.25);
  --accent: #8b5cf6;
  --accent-light: rgba(139,92,246,0.12);
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.12);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,0.12);
  --sidebar-bg: #07081a;
  --sidebar-alt: #0a0b24;
  --sidebar-text: #6a6d9a;
  --sidebar-hover: #0e0f30;
  --sidebar-active: rgba(99,102,241,0.15);
  --sidebar-active-text: #a5b4fc;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px -4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px -8px rgba(99,102,241,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

/* --- Theme: Midnight Blue --- */
[data-theme="midnight"] {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #273548;
  --bg-input: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-dim: #475569;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.10);
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: rgba(59,130,246,0.12);
  --primary-glow: rgba(59,130,246,0.25);
  --accent: #06b6d4;
  --accent-light: rgba(6,182,212,0.12);
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.12);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,0.12);
  --sidebar-bg: #0c1a32;
  --sidebar-alt: #0f2240;
  --sidebar-text: #5b7aaa;
  --sidebar-hover: #12284a;
  --sidebar-active: rgba(59,130,246,0.15);
  --sidebar-active-text: #93c5fd;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px -4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px -8px rgba(59,130,246,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

/* --- Theme: Light Clean --- */
[data-theme="light"] {
  --bg: #f0f2f8;
  --bg-alt: #e8ecf6;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9ff;
  --bg-input: #ffffff;
  --text: #0f1128;
  --text-secondary: #1f2240;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --border: #e6e8f0;
  --border-strong: #d0d4e6;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #eef2ff;
  --primary-glow: rgba(79,70,229,0.15);
  --accent: #7c3aed;
  --accent-light: #f5f3ff;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --info: #2563eb;
  --info-bg: #dbeafe;
  --sidebar-bg: #0c0d24;
  --sidebar-alt: #141638;
  --sidebar-text: #8588b8;
  --sidebar-hover: #141638;
  --sidebar-active: rgba(79,70,229,0.15);
  --sidebar-active-text: #818cf8;
  --shadow-sm: 0 1px 3px rgba(15,17,40,0.06);
  --shadow-md: 0 4px 16px -4px rgba(15,17,40,0.10);
  --shadow-lg: 0 12px 40px -8px rgba(79,70,229,0.20);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

/* --- Theme: Glass Frost --- */
[data-theme="glass"] {
  --bg: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  --bg-alt: rgba(255,255,255,0.04);
  --bg-card: rgba(255,255,255,0.06);
  --bg-card-hover: rgba(255,255,255,0.10);
  --bg-input: rgba(255,255,255,0.08);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: rgba(129,140,248,0.15);
  --primary-glow: rgba(129,140,248,0.3);
  --accent: #c084fc;
  --accent-light: rgba(192,132,252,0.15);
  --success: #4ade80;
  --success-bg: rgba(74,222,128,0.12);
  --danger: #f87171;
  --danger-bg: rgba(248,113,113,0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(251,191,36,0.12);
  --info: #60a5fa;
  --info-bg: rgba(96,165,250,0.12);
  --sidebar-bg: rgba(0,0,0,0.3);
  --sidebar-alt: rgba(255,255,255,0.03);
  --sidebar-text: rgba(255,255,255,0.35);
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(129,140,248,0.15);
  --sidebar-active-text: #a5b4fc;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.15);
  --shadow-lg: 0 12px 48px -8px rgba(129,140,248,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

/* --- Theme: Gradient Dark --- */
[data-theme="gradient"] {
  --bg: linear-gradient(135deg, #0c0d24 0%, #1a0a2e 50%, #0c0d24 100%);
  --bg-alt: rgba(255,255,255,0.03);
  --bg-card: rgba(255,255,255,0.05);
  --bg-card-hover: rgba(255,255,255,0.09);
  --bg-input: rgba(255,255,255,0.07);
  --text: #f1f5f9;
  --text-secondary: #d0c8e5;
  --text-muted: #7d72aa;
  --text-dim: #4a407a;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.10);
  --primary: #a78bfa;
  --primary-dark: #8b5cf6;
  --primary-light: rgba(167,139,250,0.12);
  --primary-glow: rgba(167,139,250,0.2);
  --accent: #f472b6;
  --accent-light: rgba(244,114,182,0.12);
  --success: #34d399;
  --success-bg: rgba(52,211,153,0.12);
  --danger: #fb7185;
  --danger-bg: rgba(251,113,133,0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(251,191,36,0.12);
  --info: #60a5fa;
  --info-bg: rgba(96,165,250,0.12);
  --sidebar-bg: rgba(0,0,0,0.25);
  --sidebar-alt: rgba(255,255,255,0.03);
  --sidebar-text: rgba(255,255,255,0.3);
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(167,139,250,0.15);
  --sidebar-active-text: #c4b5fd;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px -4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px -8px rgba(167,139,250,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

/* =============================================
   BASE
   ============================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* =============================================
   LAYOUT
   ============================================= */
.layout { display: flex; min-height: 100vh; }
.main {
  flex: 1; padding: 24px; max-width: 1400px; margin: 0 auto; width: 100%;
  transition: all 0.3s;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  width: 260px; min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
  transition: background 0.3s;
  overflow: hidden;
}
.sidebar::before {
  content: ''; position: absolute; top: -50%; right: -50%;
  width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(99,102,241,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 14px; position: relative;
}
.sidebar .brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
  box-shadow: 0 4px 12px -2px rgba(99,102,241,0.4);
}
.sidebar .brand-text {
  color: #fff; font-size: 17px; font-weight: 800; letter-spacing: -0.3px;
}
.sidebar .brand-version {
  font-size: 9px; color: rgba(255,255,255,0.2); font-weight: 600;
  margin-left: auto; padding: 2px 6px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.06);
}
.sidebar .sidebar-search-wrap {
  padding: 4px 12px 10px; position: relative;
}
.sidebar .sidebar-search {
  width: 100%; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--sidebar-alt);
  color: var(--text-secondary);
  font-size: 12px; outline: none; font-family: inherit;
  transition: all 0.2s;
}
.sidebar .sidebar-search:focus {
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}
.sidebar .sidebar-search::placeholder { color: var(--sidebar-text); }
.sidebar nav {
  flex: 1; overflow-y: auto; padding: 4px 8px; position: relative;
}
.sidebar nav::-webkit-scrollbar { width: 3px; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }
.sidebar .section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--sidebar-text);
  padding: 16px 12px 4px; opacity: 0.5;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all 0.15s; margin-bottom: 1px; position: relative;
}
.sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: var(--text-secondary);
}
.sidebar nav a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.sidebar nav a .nav-icon { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px; position: relative;
}
.sidebar .sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 9px; cursor: default;
  transition: background 0.15s; text-decoration: none;
}
.sidebar .sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar .user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar .user-info { flex: 1; overflow: hidden; }
.sidebar .user-name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user-role { color: var(--sidebar-text); font-size: 11px; text-transform: capitalize; }
.sidebar .user-status { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.sidebar .sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; font-weight: 500; transition: all 0.15s; cursor: default;
}
.sidebar .sidebar-link:hover { background: var(--sidebar-hover); color: var(--text-secondary); }
.sidebar .sidebar-link.danger { color: var(--danger); }
.sidebar .sidebar-link.danger:hover { background: rgba(239,68,68,0.1); }

/* =============================================
   TOPBAR
   ============================================= */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.admin-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px;
}

/* =============================================
   TABS
   ============================================= */
.tab-group {
  display: flex; gap: 2px; background: var(--bg-alt);
  padding: 3px; border-radius: 10px; width: fit-content;
}
.tab-group .tab {
  padding: 5px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s; border: none;
  background: transparent; font-family: inherit;
}
.tab-group .tab:hover { color: var(--text-secondary); }
.tab-group .tab.active {
  background: var(--bg-card); color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* =============================================
   STAT CARDS
   ============================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.25s;
  position: relative; overflow: hidden;
}
.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.stat-card .icon-wrap {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 14px;
}
.stat-card .stat-label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px;
}
.stat-card .stat-value {
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.5px; line-height: 1.2;
}
.stat-card .stat-delta {
  font-size: 12px; font-weight: 600; margin-top: 6px;
}
.stat-card .stat-delta.up { color: var(--success); }
.stat-card .stat-delta.down { color: var(--danger); }
.stat-card .stat-sub {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}

/* Premium gradient cards */
.stat-card.card-gradient {
  background: linear-gradient(135deg, var(--bg-card), rgba(99,102,241,0.08));
  border-color: rgba(99,102,241,0.15);
}
.stat-card.card-gradient .icon-wrap { background: rgba(99,102,241,0.2); }
.stat-card.card-accent {
  border-left: 3px solid var(--primary);
}

/* KPI Row */
.kpi-row {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.kpi-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex: 1; min-width: 140px;
  transition: all 0.2s;
}
.kpi-item:hover { background: var(--bg-card-hover); }
.kpi-item .kpi-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.kpi-item .kpi-info { flex: 1; overflow: hidden; }
.kpi-item .kpi-value { font-size: 18px; font-weight: 800; line-height: 1.2; }
.kpi-item .kpi-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.2s;
}
.card:hover { border-color: var(--border-strong); }
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.card .card-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.card .card-header h3 { margin-bottom: 0; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(99,102,241,0.4);
}
.btn-primary:hover { box-shadow: 0 6px 20px -4px rgba(99,102,241,0.5); }
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text-secondary); transform: none; }
.btn-success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(34,197,94,0.4);
}
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(239,68,68,0.4);
}
.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #fff;
}
.btn-sm { padding: 5px 12px; font-size: 11px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: 12px; }

/* =============================================
   BADGES
   ============================================= */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; gap: 4px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-paused { background: var(--warning-bg); color: var(--warning); }

/* =============================================
   TABLE
   ============================================= */
.table-wrap {
  width: 100%; overflow-x: auto;
}
table {
  width: 100%; border-collapse: collapse;
}
table th, table td {
  padding: 12px 14px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
table th {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--bg-alt);
}
table td { color: var(--text-secondary); }
table tr:hover td { background: var(--bg-alt); }
table .user-cell { display: flex; align-items: center; gap: 8px; }
table .user-cell .ua {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* =============================================
   FORMS
   ============================================= */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px; font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--bg-input);
  outline: none; transition: all 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.form-actions .btn + .btn { margin-left: 0; }
.form-cancel {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  padding: 9px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  transition: all 0.2s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.form-cancel:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

/* Allow smaller btn-sm buttons to avoid large padding */
.btn-sm { padding: 5px 12px; font-size: 11px; border-radius: 6px; }

/* Inline edit row highlight */
.edit-row { background: var(--primary-light) !important; }
.edit-row td { color: var(--text) !important; }

/* Action bar above tables */
.action-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.action-bar h3 { margin-bottom: 0; }

/* Quick inline form */
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.inline-form input, .inline-form select {
  padding: 3px 8px; font-size: 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text);
  outline: none; width: auto; font-family: inherit;
}
.inline-form input:focus { border-color: var(--primary); }

/* Toggle */
.form-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-radius: 10px; border: 1px solid var(--border);
}
.form-toggle label { flex: 1; font-size: 13px; font-weight: 600; cursor: pointer; margin: 0; }
.toggle-track {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--primary); position: relative; cursor: pointer; flex-shrink: 0;
}
.toggle-track::after {
  content: ''; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; position: absolute; top: 2px; right: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: all 0.2s;
}
.toggle-track.off { background: var(--border-strong); }
.toggle-track.off::after { right: auto; left: 2px; }

/* =============================================
   ALERTS
   ============================================= */
.alert {
  padding: 14px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.15); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.15); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59,130,246,0.15); }

/* =============================================
   PROGRESS
   ============================================= */
.progress-bar { height: 6px; background: var(--bg-alt); border-radius: 3px; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); margin-bottom: 4px;
}

/* =============================================
   CHART
   ============================================= */
.chart-bars {
  display: flex; align-items: flex-end; gap: 8px; height: 180px;
}
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; }
.chart-bar {
  width: 100%; border-radius: 6px 6px 0 0;
  background: linear-gradient(to top, var(--primary), var(--accent));
  transition: all 0.3s; cursor: default; min-height: 12px;
}
.chart-bar:hover { opacity: 0.7; }
.chart-bar-label { text-align: center; font-size: 11px; color: var(--text-muted); margin-top: 8px; }

/* =============================================
   THEME SELECTOR (in sidebar)
   ============================================= */
.theme-selector {
  padding: 8px 10px;
}
.theme-selector-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--sidebar-text);
  padding: 8px 2px 8px; opacity: 0.5;
}
.theme-options {
  display: flex; flex-direction: column; gap: 3px;
}
.theme-option {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  background: transparent; border: none;
  color: var(--sidebar-text);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  width: 100%; text-align: left; font-family: inherit;
}
.theme-option:hover { background: var(--sidebar-hover); color: var(--text-secondary); }
.theme-option.active { background: var(--sidebar-active); color: var(--sidebar-active-text); }
.theme-swatch {
  width: 18px; height: 18px; border-radius: 6px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.06);
}

/* =============================================
   UTILITY
   ============================================= */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============================================
   RESPONSIVE
   ============================================= */
/* Table action buttons */
table .actions { display: flex; gap: 4px; flex-wrap: nowrap; }
table .actions form { display: inline; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 13px; }

/* Modal overlay for edit forms */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 28px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 60px -12px rgba(0,0,0,0.5);
}
.modal-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-card .close-btn {
  float: right; background: none; border: none;
  color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px;
}
.modal-card .close-btn:hover { color: var(--text); }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #0a0b1e; padding: 24px;
}
.login-card {
  background: #12133a; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px; padding: 32px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  width: 100%;
}
.login-card h2 { color: #fff; font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.login-card p { color: #7d80ad; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .kpi-row { flex-direction: column; }
}
