/* ═══════════════════════════════════════════════════════════════════
   OutreachLens Admin Portal — Design System
   Dark-mode, data-dense, premium analytics dashboard
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Inter+Tight:wght@500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─────────────────────────────────────────────────────────────────
   CSS VARIABLES
───────────────────────────────────────────────────────────────── */
:root {
  /* Dark backgrounds */
  --bg-base:       #080818;
  --bg-surface:    #0E0E24;
  --bg-elevated:   #141432;
  --bg-card:       #181840;
  --bg-hover:      #1E1E4A;

  /* Borders */
  --border:        rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --border-accent: rgba(99,102,241,0.35);

  /* Coral — primary brand accent */
  --coral:         #FF6B47;
  --coral-dim:     #E85C38;
  --coral-glow:    rgba(255,107,71,0.18);
  --coral-tint:    rgba(255,107,71,0.08);

  /* Cyan — secondary accent for data */
  --cyan:          #22D3EE;
  --cyan-dim:      #06B6D4;
  --cyan-glow:     rgba(34,211,238,0.18);
  --cyan-tint:     rgba(34,211,238,0.08);

  /* Violet — tertiary */
  --violet:        #8B5CF6;
  --violet-glow:   rgba(139,92,246,0.18);

  /* Semantic colours */
  --green:         #10B981;
  --green-tint:    rgba(16,185,129,0.12);
  --amber:         #F59E0B;
  --amber-tint:    rgba(245,158,11,0.12);
  --red:           #EF4444;
  --red-tint:      rgba(239,68,68,0.12);

  /* Text */
  --text-primary:  #F0F0FF;
  --text-secondary: rgba(240,240,255,0.65);
  --text-muted:    rgba(240,240,255,0.38);
  --text-disabled: rgba(240,240,255,0.22);

  /* Typography */
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;
  --s9: 48px; --s10: 64px;

  /* Radius */
  --r1: 4px; --r2: 6px; --r3: 8px; --r4: 12px; --r5: 16px; --r6: 24px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6);
  --shadow-glow-coral: 0 0 20px rgba(255,107,71,0.25);
  --shadow-glow-cyan:  0 0 20px rgba(34,211,238,0.25);

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h:  60px;
}

/* ─────────────────────────────────────────────────────────────────
   RESET
───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
.hidden { display: none !important; }
::selection { background: var(--coral-glow); color: var(--coral); }
*:focus { outline: none; }
*:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; border-radius: 4px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─────────────────────────────────────────────────────────────────
   TYPOGRAPHY UTILITIES
───────────────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.display { font-family: var(--font-display); letter-spacing: -0.02em; font-weight: 700; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ─────────────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: 8px 16px;
  border-radius: var(--r2);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover { transform: translateY(-0.5px); }
.btn:active { transform: translateY(0); opacity: 0.9; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--coral);
  color: white;
  box-shadow: var(--shadow-glow-coral);
}
.btn-primary:hover { background: var(--coral-dim); }

.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); color: var(--text-primary); border-color: var(--border-strong); }

.btn-danger { background: var(--red-tint); color: var(--red); border-color: rgba(239,68,68,0.25); }
.btn-danger:hover { background: var(--red); color: white; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; }

/* ─────────────────────────────────────────────────────────────────
   FORM ELEMENTS
───────────────────────────────────────────────────────────────── */
.field { margin-bottom: var(--s5); }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--s2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field-error { font-size: 12px; color: var(--red); margin-top: var(--s2); }

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r3);
  background: var(--bg-surface);
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.15s ease;
}
.input:hover { border-color: rgba(255,255,255,0.2); }
.input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-tint); }
.input::placeholder { color: var(--text-disabled); }

.select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r2);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: all 0.15s;
}
.select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-tint); }

/* ─────────────────────────────────────────────────────────────────
   CARDS
───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  padding: var(--s6);
  transition: border-color 0.15s ease;
}
.card:hover.card-hover { border-color: var(--border-strong); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s5);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Glow cards */
.card-coral { border-color: rgba(255,107,71,0.2); box-shadow: inset 0 0 40px rgba(255,107,71,0.04); }
.card-cyan  { border-color: rgba(34,211,238,0.2);  box-shadow: inset 0 0 40px rgba(34,211,238,0.04); }
.card-violet{ border-color: rgba(139,92,246,0.2);  box-shadow: inset 0 0 40px rgba(139,92,246,0.04); }

/* ─────────────────────────────────────────────────────────────────
   BADGES
───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r1);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-green  { background: var(--green-tint); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.badge-amber  { background: var(--amber-tint); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.badge-red    { background: var(--red-tint);   color: var(--red);   border: 1px solid rgba(239,68,68,0.2); }
.badge-cyan   { background: var(--cyan-tint);  color: var(--cyan);  border: 1px solid rgba(34,211,238,0.2); }
.badge-violet { background: var(--violet-glow);color: var(--violet);border: 1px solid rgba(139,92,246,0.2); }
.badge-neutral{ background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid var(--border); }

/* ─────────────────────────────────────────────────────────────────
   APP SHELL
───────────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ─────────────────────────────────────────────────────────────────
   SIDEBAR
───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 20px 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r2);
  background: linear-gradient(135deg, var(--coral) 0%, #FF8C47 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  letter-spacing: -0.03em;
  font-family: var(--font-display);
}
.sidebar-brand-text { flex: 1; min-width: 0; }
.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.sidebar-brand-name span { color: var(--coral); }
.sidebar-brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 1px;
}

.sidebar-section { padding: 4px 12px; margin-bottom: 4px; }
.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 8px 8px 6px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r3);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.12s ease;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.nav-item svg { width: 16px; height: 16px; opacity: 0.6; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  color: var(--text-muted);
}

.nav-item.active {
  background: var(--coral-tint);
  color: var(--text-primary);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; color: var(--coral); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--coral);
  border-radius: 0 3px 3px 0;
  box-shadow: var(--shadow-glow-coral);
}
.nav-item.active .nav-badge { background: var(--coral); color: white; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r3);
  cursor: pointer;
  transition: 0.12s;
}
.sidebar-user:hover { background: rgba(255,255,255,0.04); }
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--violet));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: var(--coral);
  font-family: var(--font-mono);
}

/* ─────────────────────────────────────────────────────────────────
   MAIN CONTENT
───────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--s7);
  display: flex;
  align-items: center;
  gap: var(--s5);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.topbar-spacer { flex: 1; }

.topbar-window {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  font-size: 12px;
  color: var(--text-secondary);
}
.topbar-window select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  padding: 0;
  appearance: none;
}
.topbar-refresh {
  padding: 6px;
  border-radius: var(--r2);
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  transition: all 0.15s;
  cursor: pointer;
}
.topbar-refresh:hover { color: var(--cyan); border-color: var(--cyan); background: var(--cyan-tint); }
.topbar-refresh.spinning svg { animation: spin 1s linear infinite; }

.topbar-divider { width: 1px; height: 20px; background: var(--border); }

/* ─────────────────────────────────────────────────────────────────
   PAGE CONTENT
───────────────────────────────────────────────────────────────── */
.page {
  padding: var(--s7);
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}
.page-header {
  margin-bottom: var(--s7);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s5);
}
.page-header-left { flex: 1; }
.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--coral);
  margin-bottom: var(--s2);
}
.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: var(--s2);
  line-height: 1.1;
}
.page-subtitle { font-size: 14px; color: var(--text-secondary); }
.page-actions { display: flex; gap: var(--s3); flex-shrink: 0; align-items: center; }

.section { margin-bottom: var(--s8); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s5);
}
.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────────────────────────
   KPI METRIC CARDS
───────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s7);
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  padding: var(--s5);
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  cursor: default;
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
}
.kpi.kpi-coral::before { background: linear-gradient(90deg, var(--coral), transparent); }
.kpi.kpi-cyan::before  { background: linear-gradient(90deg, var(--cyan),  transparent); }
.kpi.kpi-green::before { background: linear-gradient(90deg, var(--green), transparent); }
.kpi.kpi-amber::before { background: linear-gradient(90deg, var(--amber), transparent); }
.kpi.kpi-red::before   { background: linear-gradient(90deg, var(--red),   transparent); }
.kpi.kpi-violet::before{ background: linear-gradient(90deg, var(--violet),transparent); }

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s3);
  font-size: 16px;
}
.kpi.kpi-coral .kpi-icon { background: var(--coral-tint); color: var(--coral); }
.kpi.kpi-cyan  .kpi-icon { background: var(--cyan-tint);  color: var(--cyan); }
.kpi.kpi-green .kpi-icon { background: var(--green-tint); color: var(--green); }
.kpi.kpi-amber .kpi-icon { background: var(--amber-tint); color: var(--amber); }
.kpi.kpi-red   .kpi-icon { background: var(--red-tint);   color: var(--red); }
.kpi.kpi-violet .kpi-icon{ background: var(--violet-glow);color: var(--violet); }

.kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--s2);
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-value.kpi-value-sm { font-size: 26px; }
.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  margin-top: var(--s2);
}
.kpi-delta.up   { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.neutral { color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────────
   TABLES
───────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--border);
}
.table-search {
  flex: 1;
  max-width: 280px;
  display: flex;
  align-items: center;
  gap: var(--s2);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 6px 10px;
  color: var(--text-secondary);
}
.table-search input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}
.table-search input::placeholder { color: var(--text-muted); }

table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
  background: var(--bg-elevated);
  padding: 10px 16px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.12s;
}
thead th:hover { color: var(--text-primary); }
thead th.sorted { color: var(--cyan); }

tbody td {
  padding: 13px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; cursor: default; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr.clickable { cursor: pointer; }

.td-primary { font-weight: 600; color: var(--text-primary); }
.td-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.td-light { color: var(--text-muted); font-size: 12px; }

/* Progress bar inside tables */
.td-bar {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--cyan);
  transition: width 0.5s ease;
}
.bar-fill.over  { background: var(--red); }
.bar-fill.near  { background: var(--amber); }
.bar-fill.ok    { background: var(--green); }
.bar-pct { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); min-width: 40px; text-align: right; }

/* ─────────────────────────────────────────────────────────────────
   CHART CONTAINERS
───────────────────────────────────────────────────────────────── */
.chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r4); padding: var(--s6); }
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--s5);
}
.chart-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text-primary); }
.chart-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.chart-wrap { position: relative; }
.chart-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-surface);
  border-radius: var(--r2);
  border: 1px solid var(--border);
}
.chart-tab {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.chart-tab.active { background: var(--coral); color: white; }
.chart-tab:not(.active):hover { color: var(--text-primary); }

/* ─────────────────────────────────────────────────────────────────
   TWO/THREE COLUMN GRIDS
───────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s5); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s5); }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--s5); }
@media (max-width: 1200px) {
  .grid-2, .grid-3, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────────
   EMPTY STATES
───────────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: var(--s10) var(--s6);
  color: var(--text-muted);
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--s4);
  background: var(--bg-elevated);
  border-radius: var(--r4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.empty-title { font-weight: 600; color: var(--text-secondary); margin-bottom: var(--s2); }
.empty-sub { font-size: 13px; }

/* ─────────────────────────────────────────────────────────────────
   MODALS
───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s6);
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r5);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.modal-lg { max-width: 900px; }
.modal-header {
  padding: var(--s6) var(--s6) var(--s4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.modal-close {
  padding: 6px;
  border-radius: var(--r2);
  color: var(--text-muted);
  transition: all 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.modal-body { padding: var(--s6); }
.modal-footer {
  padding: var(--s4) var(--s6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--s3);
}

/* ─────────────────────────────────────────────────────────────────
   LOADING
───────────────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r2);
}
.skeleton-row { height: 48px; margin-bottom: 1px; border-radius: 0; }

/* ─────────────────────────────────────────────────────────────────
   TOASTS
───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--s6);
  right: var(--s6);
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--s2);
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--r3);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.success { border-color: rgba(16,185,129,0.3); }
.toast.success .toast-icon { color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
.toast.error   .toast-icon { color: var(--red); }

/* ─────────────────────────────────────────────────────────────────
   LOGIN PAGE
───────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}
.login-screen::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(255,107,71,0.08) 0%, transparent 65%);
  pointer-events: none;
}
.login-screen::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(34,211,238,0.06) 0%, transparent 65%);
  pointer-events: none;
}
.login-box {
  width: 440px;
  position: relative;
  z-index: 1;
}
.login-header {
  text-align: center;
  margin-bottom: var(--s7);
}
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--r4);
  background: linear-gradient(135deg, var(--coral) 0%, #FF8C47 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: white;
  margin: 0 auto var(--s4);
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  box-shadow: var(--shadow-glow-coral);
}
.login-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.login-subtitle { font-size: 14px; color: var(--text-secondary); }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r5);
  padding: var(--s7);
  box-shadow: var(--shadow-lg);
}
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--coral-tint);
  border: 1px solid rgba(255,107,71,0.2);
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--coral);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--s5);
}
.login-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--coral);
  animation: pulse 2s infinite;
}

/* ─────────────────────────────────────────────────────────────────
   DRILLDOWN / DETAIL STATS
───────────────────────────────────────────────────────────────── */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 13px; color: var(--text-secondary); }
.stat-value { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* Funnel chart */
.funnel { display: flex; flex-direction: column; gap: var(--s3); }
.funnel-step { display: flex; align-items: center; gap: var(--s4); }
.funnel-label { font-size: 12px; color: var(--text-secondary); width: 140px; flex-shrink: 0; }
.funnel-track { flex: 1; height: 28px; background: rgba(255,255,255,0.04); border-radius: var(--r2); overflow: hidden; position: relative; }
.funnel-fill {
  height: 100%;
  border-radius: var(--r2);
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: white;
  transition: width 0.6s ease;
}
.funnel-count { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text-primary); width: 60px; text-align: right; flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────────
   ACTIVITY TIMELINE
───────────────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  display: flex;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  margin-top: 5px;
  flex-shrink: 0;
}
.timeline-body { flex: 1; }
.timeline-action { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.timeline-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-family: var(--font-mono); }

/* ─────────────────────────────────────────────────────────────────
   ANIMATIONS
───────────────────────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes pulse     { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes shimmer   { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes countUp   { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.page-content { animation: fadeIn 0.25s ease; }
