/* ============================================
   AnalyticsPro Dashboard — Complete Rebuild
   Dark theme, Phosphor Icons, GA4-inspired
   ============================================ */

/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&display=swap');

/* === CSS VARIABLES === */
:root {
  --bg-body: #0B0F19;
  --bg-sidebar: #070A12;
  --bg-sidebar-hover: #0D1220;
  --bg-card: #111827;
  --bg-card-hover: #1a2236;
  --bg-input: #1E293B;
  --bg-topbar: rgba(11,15,25,0.85);
  --border: rgba(255,255,255,0.06);
  --border-glow: rgba(16,185,129,0.15);
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-dim: #64748B;
  --primary: #10B981;
  --primary-dim: rgba(16,185,129,0.12);
  --chart-green: #10B981;
  --chart-blue: #3B82F6;
  --chart-yellow: #F59E0B;
  --chart-red: #EF4444;
  --chart-purple: #8B5CF6;
  --chart-pink: #EC4899;
  --sidebar-width: 56px;
  --sidebar-expanded: 220px;
  --topbar-height: 56px;
  --banner-height: 36px;
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px var(--border);
  --shadow-glow: 0 0 20px rgba(16,185,129,0.08), 0 0 0 1px var(--border-glow);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: #34D399; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
table { width: 100%; border-collapse: collapse; }

/* === DEMO BANNER === */
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--banner-height);
  background: linear-gradient(90deg, #10B981, #3B82F6);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 9999;
  letter-spacing: 0.02em;
}
.demo-banner a { color: #fff; text-decoration: underline; font-weight: 700; }

/* === BACKGROUND PATTERN === */
.bg-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 600px at 20% 20%, rgba(16,185,129,0.04), transparent),
    radial-gradient(ellipse 600px 400px at 80% 80%, rgba(59,130,246,0.03), transparent);
}

/* === APP LAYOUT === */
.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--banner-height);
  position: relative;
  z-index: 1;
}

/* === SIDEBAR — NARROW 56px, EXPANDS ON HOVER TO 220px === */
.sidebar {
  position: fixed;
  top: var(--banner-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.sidebar:hover {
  width: var(--sidebar-expanded);
  box-shadow: 4px 0 24px rgba(0,0,0,0.4);
}
.sidebar-close { display: none; }

/* Sidebar Header */
.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}
.sidebar-logo svg { width: 28px; height: 28px; flex-shrink: 0; }
.sidebar-logo .logo-text {
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
}
.sidebar:hover .sidebar-logo .logo-text { opacity: 1; }

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 0; }
.sidebar-section {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 16px 18px 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sidebar:hover .sidebar-section { opacity: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}
.sidebar-nav a i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-nav a .nav-label {
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
}
.sidebar:hover .sidebar-nav a .nav-label { opacity: 1; }
.sidebar-nav a:hover {
  color: var(--text);
  background: var(--bg-sidebar-hover);
}
.sidebar-nav a.active {
  color: var(--primary);
  background: var(--primary-dim);
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

/* Sidebar Footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--chart-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-info {
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
  white-space: nowrap;
}
.sidebar:hover .user-info { opacity: 1; }
.user-name { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.user-role { font-size: 0.65rem; color: var(--text-dim); }

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--banner-height));
  transition: margin-left 0.3s ease;
}

/* === TOPBAR === */
.topbar {
  position: sticky;
  top: var(--banner-height);
  height: var(--topbar-height);
  background: var(--bg-topbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Date Range Picker */
.date-range {
  display: flex;
  gap: 2px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.date-range .btn {
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}
.date-range .btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.date-range .btn.active {
  background: var(--primary) !important;
  color: #fff !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { border-color: rgba(255,255,255,0.15); background: var(--bg-card-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #059669; border-color: #059669; }
.btn-danger { background: var(--chart-red); border-color: var(--chart-red); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn-dim { background: rgba(255,255,255,0.03); border-color: var(--border); color: var(--text-secondary); }
.btn-dim:hover { color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-block { width: 100%; }
.btn i { font-size: 1rem; }

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all var(--transition);
  position: relative;
}
.btn-icon:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.btn-icon i { font-size: 1.1rem; }

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--chart-red);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* === CONTENT AREA === */
.content {
  padding: 24px;
  max-width: 1400px;
}

/* === CARDS WITH GLOW === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(16,185,129,0.12), transparent 40%, transparent 60%, rgba(59,130,246,0.08));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.card:hover::before { opacity: 1; }
.card:hover { box-shadow: var(--shadow-glow); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* === KPI CARDS === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.kpi-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(16,185,129,0.15), transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.kpi-card:hover::before { opacity: 1; }
.kpi-card:hover { box-shadow: var(--shadow-glow); transform: translateY(-2px); }

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.kpi-icon.green { background: rgba(16,185,129,0.12); color: var(--chart-green); }
.kpi-icon.blue { background: rgba(59,130,246,0.12); color: var(--chart-blue); }
.kpi-icon.yellow { background: rgba(245,158,11,0.12); color: var(--chart-yellow); }
.kpi-icon.purple { background: rgba(139,92,246,0.12); color: var(--chart-purple); }
.kpi-icon.red { background: rgba(239,68,68,0.12); color: var(--chart-red); }
.kpi-icon i { font-size: 1.1rem; }

.kpi-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}
.kpi-change.up { color: var(--chart-green); }
.kpi-change.down { color: var(--chart-red); }
.kpi-change i { font-size: 0.85rem; }

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.kpi-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}
.kpi-sparkline {
  margin-top: 12px;
  height: 32px;
}
.kpi-sparkline svg { width: 100%; height: 100%; }

/* === PULSE DOT === */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--chart-green);
  border-radius: 50%;
  position: relative;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--chart-green);
  opacity: 0.4;
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* === GRID LAYOUTS === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-20 { margin-bottom: 20px; }
.mb-16 { margin-bottom: 16px; }
.mb-12 { margin-bottom: 12px; }
.gap-8 { gap: 8px; }

/* === CHART CONTAINERS === */
.chart-container { position: relative; width: 100%; height: 280px; }
.chart-container.chart-sm { height: 220px; }
.chart-container.chart-xs { height: 120px; }
.chart-container.chart-mini { height: 48px; }

/* === FUNNEL VISUALIZATION === */
.funnel { padding: 8px 0; }
.funnel-step { margin-bottom: 4px; }
.funnel-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.funnel-bar {
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}
.funnel-bar.emerald { background: linear-gradient(90deg, #10B981, #059669); }
.funnel-bar.blue { background: linear-gradient(90deg, #3B82F6, #2563EB); }
.funnel-bar.yellow { background: linear-gradient(90deg, #F59E0B, #D97706); }
.funnel-bar.red { background: linear-gradient(90deg, #EF4444, #DC2626); }
.funnel-label { font-weight: 700; }
.funnel-value { font-family: var(--font-display); font-weight: 800; }
.funnel-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  position: relative;
}
.funnel-connector::before {
  content: '';
  width: 2px;
  height: 100%;
  background: var(--border);
  position: absolute;
  left: 40px;
}
.funnel-connector i {
  color: var(--text-dim);
  font-size: 0.9rem;
  position: relative;
  left: 34px;
  background: var(--bg-card);
  padding: 2px;
}
.funnel-rate {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-top: 2px;
  padding-left: 8px;
}
.funnel-pct {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* === DATA TABLES === */
.data-table {
  width: 100%;
  font-size: 0.82rem;
}
.data-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--text); }

.country-flag { display: flex; align-items: center; gap: 8px; }
.trend-arrow { font-size: 0.75rem; }
.trend-arrow.up { color: var(--chart-green); }
.trend-arrow.down { color: var(--chart-red); }

/* Percentage Bar */
.pct-bar-cell { display: flex; align-items: center; gap: 8px; }
.pct-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.pct-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
}
.pct-bar-fill.green { background: var(--chart-green); }
.pct-bar-fill.blue { background: var(--chart-blue); }
.pct-bar-fill.purple { background: var(--chart-purple); }
.pct-bar-fill.yellow { background: var(--chart-yellow); }
.pct-bar-fill.pink { background: var(--chart-pink); }
.pct-bar-fill.red { background: var(--chart-red); }
.pct-text { font-size: 0.72rem; color: var(--text-dim); font-weight: 600; min-width: 36px; text-align: right; }

/* === REALTIME ACTIVE NUMBER === */
.active-number-display {
  text-align: center;
  padding: 32px 0;
}
.active-number {
  font-family: var(--font-display);
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  text-shadow: 0 0 40px rgba(16,185,129,0.3), 0 0 80px rgba(16,185,129,0.1);
  animation: glow-pulse 3s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { text-shadow: 0 0 40px rgba(16,185,129,0.3), 0 0 80px rgba(16,185,129,0.1); }
  50% { text-shadow: 0 0 60px rgba(16,185,129,0.5), 0 0 120px rgba(16,185,129,0.2); }
}
.active-number-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 500;
}
.active-number-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Mini KPI Row */
.mini-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.mini-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.mini-kpi-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}
.mini-kpi-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* === LIVE FEED === */
.live-feed {
  max-height: 420px;
  overflow-y: auto;
}
.live-feed::-webkit-scrollbar { width: 4px; }
.live-feed::-webkit-scrollbar-track { background: transparent; }
.live-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.live-feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
}
.live-feed-item:last-child { border-bottom: none; }
.live-dot {
  width: 6px;
  height: 6px;
  background: var(--chart-green);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-ring 2s ease-out infinite;
}
.live-feed-source {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.live-feed-source i { margin-right: 3px; font-size: 0.75rem; }
.live-feed-source.google { background: rgba(59,130,246,0.12); color: var(--chart-blue); }
.live-feed-source.direct { background: rgba(16,185,129,0.12); color: var(--chart-green); }
.live-feed-source.social { background: rgba(139,92,246,0.12); color: var(--chart-purple); }
.live-feed-source.referral { background: rgba(245,158,11,0.12); color: var(--chart-yellow); }
.live-feed-source.email { background: rgba(236,72,153,0.12); color: var(--chart-pink); }
.live-feed-page { flex: 1; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-feed-flag { flex-shrink: 0; }
.live-feed-time { font-size: 0.68rem; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }

/* Active page with live dot */
.active-page-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.active-page-dot {
  width: 6px;
  height: 6px;
  background: var(--chart-green);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(16,185,129,0.5);
}
.active-page-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
}
.active-page-bar-fill {
  height: 100%;
  background: var(--chart-green);
  border-radius: 2px;
  transition: width 0.5s ease;
}
.active-page-users {
  font-weight: 700;
  color: var(--chart-green);
  font-family: var(--font-display);
}

/* === EVENTS TIMELINE === */
.events-timeline { max-height: 350px; overflow-y: auto; }
.events-timeline::-webkit-scrollbar { width: 4px; }
.events-timeline::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
}
.event-item:last-child { border-bottom: none; }
.event-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.event-icon.conversion { background: rgba(16,185,129,0.12); color: var(--chart-green); }
.event-icon.pageview { background: rgba(59,130,246,0.12); color: var(--chart-blue); }
.event-icon.signup { background: rgba(139,92,246,0.12); color: var(--chart-purple); }
.event-icon.error { background: rgba(239,68,68,0.12); color: var(--chart-red); }
.event-icon.click { background: rgba(245,158,11,0.12); color: var(--chart-yellow); }
.event-info { flex: 1; }
.event-title { font-weight: 600; color: var(--text); }
.event-detail { font-size: 0.72rem; color: var(--text-dim); margin-top: 1px; }
.event-time { font-size: 0.68rem; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }

/* === EPS (Events Per Second) === */
.eps-display {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 0;
}
.eps-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--chart-blue);
}
.eps-label { font-size: 0.75rem; color: var(--text-dim); }
.eps-chart { flex: 1; }

/* === REPORT TEMPLATES (Swiper) === */
.templates-section { margin-bottom: 24px; }
.swiper { padding: 4px 4px 24px; overflow: hidden; }
.swiper-wrapper { display: flex; }
.swiper-slide { width: 260px; flex-shrink: 0; }
.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 100%;
}
.template-card:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-2px); }
.template-card.active { border-color: var(--primary); box-shadow: 0 0 20px rgba(16,185,129,0.15); }
.template-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 12px;
}
.template-icon i { font-size: 1.3rem; }
.template-card h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.template-card p {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 12px;
}
.template-preview {
  height: 60px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 0 8px 6px;
  gap: 3px;
}
.template-preview .bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 4px;
}
.template-card .btn { width: 100%; }

/* Swiper pagination */
.swiper-pagination { text-align: center; margin-top: 8px; }
.swiper-pagination-bullet {
  width: 8px; height: 8px;
  background: var(--text-dim);
  opacity: 0.4;
  border-radius: 50%;
  display: inline-block;
  margin: 0 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.swiper-pagination-bullet-active { background: var(--primary); opacity: 1; width: 20px; border-radius: 4px; }

/* === CHART TYPE SELECTOR === */
.chart-type-selector {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.chart-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 600;
  transition: all var(--transition);
}
.chart-type-btn i { font-size: 1.3rem; }
.chart-type-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.12); }
.chart-type-btn.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-dim);
}

/* === METRIC SELECTOR === */
.metric-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.dimension-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

/* === FORMS === */
.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--primary); }
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}
.form-check:hover { background: rgba(255,255,255,0.03); }
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* === EXPORT BUTTONS === */
.export-group { display: flex; gap: 6px; flex-wrap: wrap; }
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.export-btn i { font-size: 0.9rem; }
.export-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.export-btn.pdf:hover { color: var(--chart-red); border-color: rgba(239,68,68,0.3); }
.export-btn.csv:hover { color: var(--chart-green); border-color: rgba(16,185,129,0.3); }
.export-btn.png:hover { color: var(--chart-blue); border-color: rgba(59,130,246,0.3); }

/* === FREQUENCY/STATUS BADGES === */
.frequency-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(59,130,246,0.12);
  color: var(--chart-blue);
}
.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-badge.success { background: rgba(16,185,129,0.12); color: var(--chart-green); }
.status-badge.warning { background: rgba(245,158,11,0.12); color: var(--chart-yellow); }
.status-badge.danger { background: rgba(239,68,68,0.12); color: var(--chart-red); }
.status-badge.info { background: rgba(59,130,246,0.12); color: var(--chart-blue); }
.status-badge.neutral { background: rgba(100,116,139,0.12); color: var(--text-dim); }
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: var(--chart-green); }
.status-dot.warning { background: var(--chart-yellow); }
.status-dot.error { background: var(--chart-red); }
.status-dot.offline { background: var(--text-dim); }

/* === TOGGLE SWITCH === */
.toggle {
  width: 40px;
  height: 22px;
  background: var(--bg-input);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle.on { background: var(--primary); border-color: var(--primary); }
.toggle.on::after { left: 20px; background: #fff; }

/* === PILL TABS === */
.pill-tabs { display: flex; gap: 2px; background: var(--bg-input); border-radius: var(--radius-sm); padding: 2px; }
.pill {
  padding: 5px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
}
.pill:hover { color: var(--text); }
.pill.active { background: var(--primary); color: #fff; }

/* === SETTINGS SECTIONS === */
.settings-section {
  margin-bottom: 32px;
}
.settings-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.settings-section-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* === SETTINGS TABS === */
.settings-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.settings-tabs::-webkit-scrollbar { height: 0; }
.settings-tab {
  padding: 8px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.settings-tab i { font-size: 1rem; }
.settings-tab:hover { color: var(--text); }
.settings-tab.active { background: var(--primary); color: #fff; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* === SOURCE CARDS === */
.source-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.3s ease;
}
.source-card:hover { border-color: rgba(255,255,255,0.1); }
.source-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.source-icon i { font-size: 1.3rem; }
.source-info { flex: 1; }
.source-name { font-weight: 700; font-size: 0.9rem; }
.source-detail { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.source-status { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* === WIDGET LIST (settings) === */
.widget-list { display: flex; flex-direction: column; gap: 4px; }
.widget-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.widget-item:hover { border-color: rgba(255,255,255,0.1); }
.drag-handle {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: grab;
  padding: 4px;
  color: var(--text-dim);
  font-size: 1rem;
}
.drag-handle i { font-size: 1.1rem; }
.widget-item-name { flex: 1; font-size: 0.85rem; font-weight: 500; }

/* === THRESHOLD ROW === */
.threshold-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.threshold-label {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
}
.threshold-label span {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 2px;
}
.threshold-input {
  width: 70px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
  outline: none;
}
.threshold-input:focus { border-color: var(--primary); }

/* === TEAM MEMBERS === */
.member-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.role-select {
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
}
.role-select:focus { border-color: var(--primary); }

/* === API KEY === */
.api-key-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.key-text {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* === BEHAVIOR CARDS === */
.behavior-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}
.behavior-card:hover { box-shadow: var(--shadow-glow); }
.behavior-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
}
.behavior-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.behavior-change {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.behavior-change.up { color: var(--chart-green); }
.behavior-change.down { color: var(--chart-red); }
.behavior-change i { font-size: 0.8rem; }

/* === DONUT LEGEND === */
.chart-legend {
  display: flex;
  gap: 16px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* === DEVICE DISPLAY (with Phosphor icons) === */
.device-display {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}
.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.device-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.device-icon i { font-size: 1.1rem; }
.device-info { flex: 1; }
.device-name { font-size: 0.82rem; font-weight: 600; }
.device-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}
.device-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}
.device-pct {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  min-width: 36px;
  text-align: right;
}

/* Browser stacked bar */
.stacked-bar {
  height: 28px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  margin: 12px 0;
}
.stacked-bar-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  transition: flex 0.8s ease;
}

/* OS Breakdown */
.os-list { display: flex; flex-direction: column; gap: 10px; }
.os-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}
.os-name { flex: 1; color: var(--text-secondary); }
.os-pct { font-weight: 700; color: var(--text); min-width: 40px; text-align: right; }

/* === SEGMENT RETENTION === */
.segment-retention {
  display: flex;
  align-items: center;
  gap: 8px;
}
.retention-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.retention-fill {
  height: 100%;
  background: var(--chart-green);
  border-radius: 3px;
  transition: width 1s ease;
}

/* === CONVERSION ITEMS === */
.conversion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.conversion-item:last-child { border-bottom: none; }
.conversion-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.conversion-info { flex: 1; }
.conversion-user { font-weight: 600; font-size: 0.82rem; }
.conversion-product { font-size: 0.72rem; color: var(--text-dim); }
.conversion-amount { font-family: var(--font-display); font-weight: 800; color: var(--chart-green); font-size: 0.9rem; }
.conversion-time { font-size: 0.68rem; color: var(--text-dim); }

/* === INSIGHTS CARDS === */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.3s ease;
}
.insight-card:hover { border-color: rgba(255,255,255,0.1); }
.insight-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.insight-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.5;
}
.insight-text strong { color: var(--text); }

/* === SUCCESS MESSAGE === */
.smsg {
  padding: 10px 16px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-sm);
  color: var(--chart-green);
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 12px;
  display: none;
}
.smsg.show { display: block; }

/* === API USAGE === */
.api-usage {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
}
.api-usage-bar {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.api-usage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--chart-green), var(--chart-blue));
  border-radius: 4px;
  transition: width 1s ease;
}
.api-usage-text {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* === SECTION HEADERS === */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}
.section-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* === FOOTER === */
.app-footer {
  text-align: center;
  padding: 32px 0 24px;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 24px;
}
.app-footer a { color: var(--primary); }

/* === UTILITY CLASSES === */
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-primary { color: var(--text) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-success { color: var(--chart-green) !important; }
.text-danger { color: var(--chart-red) !important; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }

/* === SCROLL ANIMATIONS === */
.anim {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.anim.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === SIDEBAR TOGGLE (MOBILE) === */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(var(--banner-height) + 10px);
  left: 10px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* === rt-updating animation === */
.rt-updating {
  animation: rt-blink 2s ease-in-out infinite;
}
@keyframes rt-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === SESSION DURATION HISTOGRAM === */
.histogram {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 12px 0 28px;
  position: relative;
}
.histogram-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: height 0.8s ease;
  min-width: 0;
}
.histogram-bar:hover { opacity: 0.8; }
.histogram-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* === NEW VS RETURNING COMPARISON === */
.nvr-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 16px 0;
}
.nvr-card {
  text-align: center;
  padding: 16px;
}
.nvr-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}
.nvr-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.nvr-count {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.nvr-divider {
  width: 1px;
  height: 80px;
  background: var(--border);
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .chart-type-selector { grid-template-columns: repeat(3, 1fr); }
  .mini-kpi-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar {
    width: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease, width 0.3s ease;
  }
  .sidebar:hover {
    width: 0;
    box-shadow: none;
  }
  .sidebar.open {
    width: var(--sidebar-expanded);
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open .nav-label,
  .sidebar.open .user-info,
  .sidebar.open .sidebar-logo .logo-text,
  .sidebar.open .sidebar-section { opacity: 1; }
  .sidebar-close {
    display: flex;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .sidebar-overlay.show { display: block; }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px 0 56px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .date-range { display: none; }
  .active-number { font-size: 3rem; }
  .metric-selector, .dimension-selector { grid-template-columns: 1fr; }
  .settings-tabs { overflow-x: auto; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-title { font-size: 0.95rem; }
  .export-group { flex-direction: column; }
  .source-card { flex-direction: column; align-items: flex-start; }
  .source-status { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .threshold-row { flex-wrap: wrap; }
  .eps-display { flex-direction: column; text-align: center; }
  .nvr-comparison { display: flex; flex-direction: column; }
  .behavior-value { font-size: 1.4rem; }
  .topbar-actions { gap: 4px; }
  .btn-icon { width: 32px; height: 32px; }
  .btn-icon i { font-size: 1rem; }
}

/* ============================================
   ENHANCED VISUAL EFFECTS
   Glow borders, animations, hover states
   ============================================ */

/* === CARD GLOW VARIANTS === */
.card.card-glow-green::before {
  background: linear-gradient(135deg, rgba(16,185,129,0.2), transparent 50%);
  opacity: 1;
}
.card.card-glow-blue::before {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), transparent 50%);
  opacity: 1;
}
.card.card-glow-purple::before {
  background: linear-gradient(135deg, rgba(139,92,246,0.2), transparent 50%);
  opacity: 1;
}

/* === KPI CARD GLOW COLORS (per card) === */
.kpi-card:nth-child(1):hover {
  box-shadow: 0 0 24px rgba(16,185,129,0.12), 0 0 0 1px rgba(16,185,129,0.2);
}
.kpi-card:nth-child(2):hover {
  box-shadow: 0 0 24px rgba(59,130,246,0.12), 0 0 0 1px rgba(59,130,246,0.2);
}
.kpi-card:nth-child(3):hover {
  box-shadow: 0 0 24px rgba(245,158,11,0.12), 0 0 0 1px rgba(245,158,11,0.2);
}
.kpi-card:nth-child(4):hover {
  box-shadow: 0 0 24px rgba(139,92,246,0.12), 0 0 0 1px rgba(139,92,246,0.2);
}

.kpi-card:nth-child(1)::before {
  background: linear-gradient(135deg, rgba(16,185,129,0.2), transparent 50%);
}
.kpi-card:nth-child(2)::before {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), transparent 50%);
}
.kpi-card:nth-child(3)::before {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), transparent 50%);
}
.kpi-card:nth-child(4)::before {
  background: linear-gradient(135deg, rgba(139,92,246,0.2), transparent 50%);
}

/* === ANIMATED COUNTER === */
@keyframes counter-glow {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}

/* === SCROLL REVEAL STAGGER === */
.kpi-grid .kpi-card:nth-child(1) { transition-delay: 0s; }
.kpi-grid .kpi-card:nth-child(2) { transition-delay: 0.08s; }
.kpi-grid .kpi-card:nth-child(3) { transition-delay: 0.16s; }
.kpi-grid .kpi-card:nth-child(4) { transition-delay: 0.24s; }

.insights-grid .insight-card:nth-child(1) { transition-delay: 0s; }
.insights-grid .insight-card:nth-child(2) { transition-delay: 0.1s; }
.insights-grid .insight-card:nth-child(3) { transition-delay: 0.2s; }

/* === FUNNEL ANIMATION === */
@keyframes funnel-fill {
  from { width: 0; }
}
.funnel-bar {
  animation: funnel-fill 1.2s cubic-bezier(0.4,0,0.2,1) forwards;
}

/* === LIVE FEED ANIMATION === */
@keyframes feed-slide-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.live-feed-item {
  animation: feed-slide-in 0.4s ease forwards;
}
.live-feed-item:nth-child(1) { animation-delay: 0s; }
.live-feed-item:nth-child(2) { animation-delay: 0.05s; }
.live-feed-item:nth-child(3) { animation-delay: 0.1s; }
.live-feed-item:nth-child(4) { animation-delay: 0.15s; }
.live-feed-item:nth-child(5) { animation-delay: 0.2s; }
.live-feed-item:nth-child(6) { animation-delay: 0.25s; }
.live-feed-item:nth-child(7) { animation-delay: 0.3s; }
.live-feed-item:nth-child(8) { animation-delay: 0.35s; }
.live-feed-item:nth-child(9) { animation-delay: 0.4s; }
.live-feed-item:nth-child(10) { animation-delay: 0.45s; }

/* === EVENT TIMELINE ANIMATION === */
.event-item {
  animation: feed-slide-in 0.4s ease forwards;
}
.event-item:nth-child(1) { animation-delay: 0s; }
.event-item:nth-child(2) { animation-delay: 0.06s; }
.event-item:nth-child(3) { animation-delay: 0.12s; }
.event-item:nth-child(4) { animation-delay: 0.18s; }
.event-item:nth-child(5) { animation-delay: 0.24s; }
.event-item:nth-child(6) { animation-delay: 0.3s; }
.event-item:nth-child(7) { animation-delay: 0.36s; }
.event-item:nth-child(8) { animation-delay: 0.42s; }
.event-item:nth-child(9) { animation-delay: 0.48s; }
.event-item:nth-child(10) { animation-delay: 0.54s; }

/* === ACTIVE PAGE DOT ANIMATION === */
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 8px rgba(16,185,129,0.8); }
}
.active-page-dot {
  animation: dot-pulse 2s ease-in-out infinite;
}

/* === TEMPLATE CARD HOVER EFFECTS === */
.template-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, background 0.3s ease;
}
.template-card { position: relative; overflow: hidden; }
.template-card:hover::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(16,185,129,0.15), transparent 50%, rgba(59,130,246,0.1));
}
.template-card.active::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(16,185,129,0.25), transparent 50%);
}

/* === MINI KPI HOVER === */
.mini-kpi {
  transition: all 0.3s ease;
}
.mini-kpi:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* === SOURCE CARD CONNECTED STATE === */
.source-card.connected-state {
  border-color: rgba(16,185,129,0.15);
}

/* === WIDGET ITEM DRAG STATES === */
.widget-item:active {
  background: var(--bg-card-hover);
  cursor: grabbing;
}
.widget-item .drag-handle:hover {
  color: var(--text-secondary);
}

/* === TABLE ROW HOVER === */
.data-table tbody tr {
  transition: background 0.15s ease;
}
.data-table tbody tr:hover .active-page-users {
  text-shadow: 0 0 8px rgba(16,185,129,0.4);
}

/* === BUTTON RIPPLE EFFECT === */
.btn-primary:active {
  transform: scale(0.97);
}
.btn:active {
  transform: scale(0.98);
}

/* === SIDEBAR ICON TOOLTIP (narrow mode) === */
.sidebar-nav a {
  position: relative;
}

/* === INSIGHTS ICON HOVER === */
.insight-icon {
  transition: transform 0.3s ease;
}
.insight-card:hover .insight-icon {
  transform: scale(1.1);
}

/* === CHART CONTAINER LOADING SHIMMER === */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.chart-loading {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 37%, var(--bg-card) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

/* === SCROLLBAR STYLING === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* === SELECTION COLOR === */
::selection {
  background: rgba(16,185,129,0.3);
  color: #fff;
}
::-moz-selection {
  background: rgba(16,185,129,0.3);
  color: #fff;
}

/* === FOCUS STYLES === */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

/* === PRINT STYLES === */
@media print {
  .demo-banner,
  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay,
  .topbar,
  .bg-pattern { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .app-layout { padding-top: 0 !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; box-shadow: none; }
  .card::before { display: none; }
}

/* === PHOSPHOR ICON SIZING HELPERS === */
.ph-lg { font-size: 1.5rem; }
.ph-xl { font-size: 2rem; }
.ph-2x { font-size: 2.5rem; }
.ph-3x { font-size: 3rem; }

/* === BADGE VARIANTS === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 20px;
}
.badge-green { background: rgba(16,185,129,0.12); color: var(--chart-green); }
.badge-blue { background: rgba(59,130,246,0.12); color: var(--chart-blue); }
.badge-yellow { background: rgba(245,158,11,0.12); color: var(--chart-yellow); }
.badge-red { background: rgba(239,68,68,0.12); color: var(--chart-red); }
.badge-purple { background: rgba(139,92,246,0.12); color: var(--chart-purple); }
.badge-pink { background: rgba(236,72,153,0.12); color: var(--chart-pink); }

/* === TOOLTIP (generic) === */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: #111827;
  color: #F1F5F9;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}
[data-tooltip]:hover::after {
  opacity: 1;
}

/* === SKELETON LOADER === */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-hover) 50%, var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}
.skeleton-text.short { width: 40%; }
.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* === DROPDOWN MENU (for future use) === */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
}
.dropdown-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
.dropdown-item i { font-size: 1rem; width: 20px; text-align: center; }
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* === MODAL (for confirmations) === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 90%;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}
.modal-overlay.show .modal {
  transform: scale(1);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.modal-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* === NOTIFICATION PANEL === */
.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}
.notif-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.notif-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-panel-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  display: flex;
  gap: 10px;
  transition: background 0.15s ease;
  cursor: pointer;
}
.notif-item:hover { background: rgba(255,255,255,0.02); }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.notif-content { flex: 1; }
.notif-content-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.notif-content-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 1px;
}
.notif-time {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}
.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-state-desc {
  font-size: 0.82rem;
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.6;
}

/* === RANGE INPUT STYLING === */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  outline: none;
  border: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-body);
  box-shadow: 0 0 6px rgba(16,185,129,0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-body);
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}

/* === PROGRESS RING (SVG) === */
.progress-ring {
  transform: rotate(-90deg);
}
.progress-ring circle {
  transition: stroke-dashoffset 1s ease;
}

/* === LOADING SPINNER === */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* === GRADIENT TEXT === */
.gradient-text {
  background: linear-gradient(135deg, var(--chart-green), var(--chart-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === DIVIDER === */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* === TAG/CHIP === */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.chip i { font-size: 0.8rem; }
.chip-close {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.chip-close:hover {
  background: rgba(255,255,255,0.1);
}

/* === AVATAR GROUP === */
.avatar-group {
  display: flex;
}
.avatar-group .member-avatar {
  margin-left: -8px;
  border: 2px solid var(--bg-card);
}
.avatar-group .member-avatar:first-child {
  margin-left: 0;
}

/* === SPARKLINE BAR (alternative) === */
.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
}
.spark-bars .bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  transition: height 0.5s ease;
  min-width: 3px;
}

/* === SWIPER NAVIGATION ARROWS === */
.swiper-button-next,
.swiper-button-prev {
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
}
.swiper-button-next::after,
.swiper-button-prev::after {
  font-size: 14px;
  font-weight: 700;
}
