/* ═══════════════════════════════════════════════════════
   AfterBody Analytics — Design System
   Dark Glassmorphism Theme
═══════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --bg-primary:    #0a0b0f;
  --bg-surface:    #13151c;
  --bg-card:       #1a1d28;
  --bg-elevated:   #21253a;
  --accent-indigo: #6366f1;
  --accent-teal:   #14b8a6;
  --accent-green:  #22c55e;
  --accent-red:    #ef4444;
  --accent-amber:  #f59e0b;
  --accent-purple: #a855f7;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;
  --border:        rgba(255,255,255,0.06);
  --border-hover:  rgba(255,255,255,0.12);
  --glass:         rgba(255,255,255,0.04);
  --glass-hover:   rgba(255,255,255,0.07);
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --radius-xl:     20px;
  --shadow-card:   0 4px 24px rgba(0,0,0,0.4);
  --shadow-elevated: 0 8px 40px rgba(0,0,0,0.5);
  --transition:    0.18s ease;
  --transition-slow: 0.35s ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100%;
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
select, input, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════════════ */

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
  backdrop-filter: blur(20px);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-mark { flex-shrink: 0; }

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* ── Sidebar Nav ─────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  padding: 8px 8px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: all var(--transition);
  border-left: 2px solid transparent;
}

.nav-item:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  border-left-color: rgba(99,102,241,0.4);
}

.nav-item.active {
  background: rgba(99,102,241,0.12);
  color: var(--accent-indigo);
  border-left-color: var(--accent-indigo);
  font-weight: 600;
}

.nav-item--highlight.active {
  background: rgba(20,184,166,0.1);
  color: var(--accent-teal);
  border-left-color: var(--accent-teal);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-label { flex: 1; }

.live-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(239,68,68,0.15);
  color: var(--accent-red);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  letter-spacing: 0.5px;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-red);
  animation: livePulse 1.4s ease infinite;
}

.nav-badge-new {
  font-size: 9px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
  color: white;
  padding: 2px 5px;
  border-radius: 99px;
  letter-spacing: 0.4px;
}

/* ── Sidebar Footer ─────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--mock { background: var(--accent-amber); }
.status-dot--live { background: var(--accent-green); animation: livePulse 1.4s ease infinite; }
.status-dot--error { background: var(--accent-red); }

/* ── Main Wrapper ────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: margin-left var(--transition-slow);
}

/* ── Top Header ──────────────────────────────────────────── */
.top-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 16px;
  backdrop-filter: blur(20px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.breadcrumb-brand { color: var(--text-muted); font-weight: 500; }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-page { color: var(--text-primary); font-weight: 600; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  max-width: 200px;
}

.control-select:hover,
.control-select:focus { border-color: var(--accent-indigo); }

.date-range-calendar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-date {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 8px;
  font-family: inherit;
  color-scheme: dark;
  max-width: 140px;
}

.control-date:hover,
.control-date:focus {
  border-color: var(--accent-indigo);
  outline: none;
}

.date-range-sep {
  color: var(--text-muted);
  font-size: 11px;
}

.date-range-presets {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-left: 4px;
}

.dr-preset {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  transition: all var(--transition);
  border-right: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
}

.dr-preset:last-child { border-right: none; }
.dr-preset:hover { background: var(--glass-hover); color: var(--text-secondary); }
.dr-preset.active {
  background: var(--accent-indigo);
  color: white;
}

.date-range-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.dr-tab {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  transition: all var(--transition);
  border-right: 1px solid var(--border);
}

.dr-tab:last-child { border-right: none; }
.dr-tab:hover { background: var(--glass-hover); color: var(--text-secondary); }
.dr-tab.active {
  background: var(--accent-indigo);
  color: white;
}

.header-connect-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ── View Container ──────────────────────────────────────── */
.view-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px;
  background: var(--bg-primary);
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes dot-float {
  0%, 100% { transform: translate(0,0); }
  33% { transform: translate(3px,-4px); }
  66% { transform: translate(-3px,2px); }
}

.view-enter {
  animation: fadeInUp 0.3s ease forwards;
}

/* ══════════════════════════════════════════════════════════
   COMPONENTS
══════════════════════════════════════════════════════════ */

/* ── Loading ─────────────────────────────────────────────── */
.loading-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-indigo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 25%,
    var(--bg-elevated) 50%,
    var(--bg-card) 75%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

/* ── View Header ─────────────────────────────────────────── */
.view-header {
  margin-bottom: 28px;
}

.view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.view-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 400;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass);
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: inherit;
  pointer-events: none;
}

.card:hover::before { opacity: 1; }

.card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.7px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* ── 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-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}

.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--kpi-color, var(--accent-indigo));
  opacity: 0.6;
  transition: opacity var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.kpi-card:hover::after { opacity: 1; }

.kpi-card--indigo { --kpi-color: var(--accent-indigo); }
.kpi-card--teal   { --kpi-color: var(--accent-teal); }
.kpi-card--green  { --kpi-color: var(--accent-green); }
.kpi-card--amber  { --kpi-color: var(--accent-amber); }

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
}

.kpi-icon--indigo { background: rgba(99,102,241,0.12); color: var(--accent-indigo); }
.kpi-icon--teal   { background: rgba(20,184,166,0.12); color: var(--accent-teal); }
.kpi-icon--green  { background: rgba(34,197,94,0.12);  color: var(--accent-green); }
.kpi-icon--amber  { background: rgba(245,158,11,0.12); color: var(--accent-amber); }

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 8px;
  animation: countUp 0.4s ease forwards;
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
}

.kpi-trend--up   { color: var(--accent-green); }
.kpi-trend--down { color: var(--accent-red); }

.trend-arrow { font-size: 11px; }

.kpi-compare {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 2px;
}

/* ── Chart Grid ──────────────────────────────────────────── */
.chart-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-grid--2col { grid-template-columns: 1fr 1fr; }
.chart-grid--3col { grid-template-columns: 1fr 1fr 1fr; }
.chart-grid--2-1  { grid-template-columns: 2fr 1fr; }
.chart-grid--1-2  { grid-template-columns: 1fr 2fr; }

.chart-container {
  width: 100%;
  position: relative;
}

.chart-h200 { height: 200px; }
.chart-h240 { height: 240px; }
.chart-h280 { height: 280px; }
.chart-h320 { height: 320px; }
.chart-h360 { height: 360px; }
.chart-h400 { height: 400px; }
.chart-h460 { height: 460px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover td {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.td-primary {
  color: var(--text-primary);
  font-weight: 500;
}

.td-mono {
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge--green  { background: rgba(34,197,94,0.12);  color: var(--accent-green); }
.badge--red    { background: rgba(239,68,68,0.12);  color: var(--accent-red); }
.badge--amber  { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.badge--indigo { background: rgba(99,102,241,0.12); color: var(--accent-indigo); }
.badge--teal   { background: rgba(20,184,166,0.12); color: var(--accent-teal); }
.badge--muted  { background: var(--bg-elevated);    color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.btn--primary {
  background: var(--accent-indigo);
  color: white;
  border-color: var(--accent-indigo);
}

.btn--primary:hover {
  background: #5254cc;
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
}

.btn--teal {
  background: var(--accent-teal);
  color: white;
  border-color: var(--accent-teal);
}

.btn--teal:hover {
  background: #10a192;
  box-shadow: 0 4px 14px rgba(20,184,166,0.4);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn--ghost:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn--danger {
  background: rgba(239,68,68,0.12);
  color: var(--accent-red);
  border-color: rgba(239,68,68,0.2);
}

.btn--danger:hover {
  background: var(--accent-red);
  color: white;
}

.btn--sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn--xs {
  padding: 3px 8px;
  font-size: 11px;
}

/* ── Form Elements ───────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus { border-color: var(--accent-indigo); }
.form-input::placeholder { color: var(--text-muted); }

/* ── Connect Button ──────────────────────────────────────── */
.connect-btn {
  width: 100%;
  justify-content: center;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  width: 460px;
  max-width: 90vw;
  animation: fadeInUp 0.25s ease;
  box-shadow: var(--shadow-elevated);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  pointer-events: all;
  animation: slideInRight 0.25s ease;
  box-shadow: var(--shadow-elevated);
  max-width: 340px;
}

.toast--success { border-left: 3px solid var(--accent-green); }
.toast--error   { border-left: 3px solid var(--accent-red); }
.toast--info    { border-left: 3px solid var(--accent-indigo); }

.toast-icon { font-size: 16px; flex-shrink: 0; }

.toast-fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* ── Progress Bars ───────────────────────────────────────── */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Country Bar ─────────────────────────────────────────── */
.country-list { display: flex; flex-direction: column; gap: 12px; }

.country-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.country-flag { font-size: 18px; flex-shrink: 0; line-height: 1; }
.country-name { font-size: 13px; color: var(--text-secondary); width: 90px; flex-shrink: 0; }

.country-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.country-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-indigo), var(--accent-teal));
}

.country-pct {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Section Title ───────────────────────────────────────── */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-indigo);
}

/* ── Funnel ──────────────────────────────────────────────── */
.funnel-chart { display: flex; flex-direction: column; gap: 6px; }

.funnel-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.funnel-step-bar-wrap {
  flex: 1;
  height: 36px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.funnel-step-bar {
  height: 100%;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  padding-left: 12px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
}

.funnel-step-label {
  width: 120px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  text-align: right;
}

.funnel-step-pct {
  width: 44px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  flex-shrink: 0;
}

/* ── Heatmap list (Clarity-style) ────────────────────────── */
.heatmap-list-card {
  padding: 0;
  overflow: hidden;
}

.heatmap-list-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.heatmap-list-kicker {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.heatmap-list-heading {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.heatmap-search {
  width: min(280px, 100%);
  font-size: 13px;
}

.heatmap-pages-table {
  width: 100%;
  border-collapse: collapse;
}

.heatmap-pages-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.heatmap-pages-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.heatmap-pages-table tbody tr:hover td {
  background: rgba(99, 102, 241, 0.06);
}

.heatmap-page-title {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap-page-url {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

.heatmap-flame-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.heatmap-flame-btn:hover {
  transform: scale(1.08);
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.12);
}

.heatmap-flame-btn--hot {
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.15);
}

/* ── Heatmap viewer overlay ──────────────────────────────── */
.heatmap-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 20px;
}

.heatmap-viewer {
  width: min(1280px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.heatmap-viewer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.heatmap-viewer__kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.heatmap-viewer__title {
  margin: 4px 0 2px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.heatmap-viewer__url {
  font-size: 12px;
  color: var(--text-muted);
}

.heatmap-viewer__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.heatmap-live-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.heatmap-live-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex: 1;
  min-width: 220px;
}

.heatmap-live-field .form-input {
  flex: 1;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.heatmap-opacity-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.heatmap-opacity-field input[type="range"] {
  width: 100px;
}

.heatmap-check-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.heatmap-embed-hint {
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  background: rgba(249, 115, 22, 0.08);
  border-bottom: 1px solid rgba(249, 115, 22, 0.25);
}

.heatmap-embed-hint--ok {
  background: rgba(20, 184, 166, 0.08);
  border-bottom-color: rgba(20, 184, 166, 0.25);
}

.heatmap-page-frame {
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
  pointer-events: auto;
}

.heatmap-viewer__meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.heatmap-viewer__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  padding: 16px 20px 20px;
  min-height: 0;
}

.heatmap-viewer__main {
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.heatmap-viewer__side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.heatmap-browser-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.heatmap-browser-dots {
  display: flex;
  gap: 5px;
}

.heatmap-browser-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-hover);
}

.heatmap-browser-dots span:nth-child(1) { background: #f87171; }
.heatmap-browser-dots span:nth-child(2) { background: #fbbf24; }
.heatmap-browser-dots span:nth-child(3) { background: #34d399; }

.heatmap-browser-url {
  flex: 1;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap-stage {
  overflow: auto;
  max-height: min(72vh, 900px);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.02), rgba(15, 23, 42, 0.08)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 23px,
      rgba(148, 163, 184, 0.06) 23px,
      rgba(148, 163, 184, 0.06) 24px
    );
}

.heatmap-page-surface {
  position: relative;
  min-height: 2200px;
  background: #fff;
}

.heatmap-page-placeholder {
  padding: 28px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0.55;
}

.heatmap-page-placeholder__bar {
  height: 12px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.18);
}

.heatmap-page-placeholder__block {
  height: 160px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(20, 184, 166, 0.1));
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.heatmap-page-placeholder__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.heatmap-page-placeholder__grid > div {
  height: 88px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.12);
}

.heatmap-session-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}

.heatmap-session-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.heatmap-session-item:hover {
  border-color: var(--border-hover);
}

.heatmap-session-item.active {
  border-color: rgba(249, 115, 22, 0.55);
  background: rgba(249, 115, 22, 0.1);
}

.heatmap-session-item__id {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.heatmap-session-item__meta {
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 960px) {
  .heatmap-viewer__body {
    grid-template-columns: 1fr;
  }
}

/* ── Heatmap Page ────────────────────────────────────────── */
.heatmap-page {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.heatmap-panel {
  flex: 1;
  position: relative;
  min-height: 700px;
}

.heatmap-sidebar-panel {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.heatmap-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.type-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.type-tab {
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  border-right: 1px solid var(--border);
}

.type-tab:last-child { border-right: none; }
.type-tab:hover { color: var(--text-secondary); background: var(--glass); }
.type-tab.active { background: var(--accent-indigo); color: white; }

.heatmap-wireframe {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 700px;
}

.heatmap-canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.wf-section {
  position: relative;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.wf-section:last-child { border-bottom: none; }

.wf-section-tag {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
}

.wf-hero {
  background: linear-gradient(135deg, rgba(99,102,241,0.07), rgba(20,184,166,0.04));
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.wf-hero-headline {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

.wf-hero-sub {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 320px;
}

.wf-hero-ctas { display: flex; gap: 10px; }

.wf-cta-primary {
  padding: 10px 20px;
  background: var(--accent-indigo);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.wf-cta-secondary {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.wf-section-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.wf-ingredient-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.wf-ingredient-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

.wf-ingredient-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.wf-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.wf-step {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.wf-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-indigo);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  margin: 0 auto 6px;
}

.wf-faq-list { display: flex; flex-direction: column; gap: 6px; }

.wf-faq-item {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background var(--transition);
}

.wf-faq-item:hover { background: var(--border-hover); }

.wf-review-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.wf-review-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.wf-review-stars { color: var(--accent-amber); font-size: 12px; margin-bottom: 4px; }

.wf-clinical-bars { display: flex; flex-direction: column; gap: 8px; }

.wf-clinical-bar { display: flex; align-items: center; gap: 8px; font-size: 11px; }

.wf-clinical-label { width: 120px; color: var(--text-secondary); }

.wf-clinical-track {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 99px;
}

.wf-clinical-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-teal), var(--accent-green));
}

/* ── Scroll Map ──────────────────────────────────────────── */
.scroll-indicator {
  position: absolute;
  right: -90px;
  top: 0;
  height: 100%;
  width: 80px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.scroll-seg {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* ── Heatmap Legend ──────────────────────────────────────── */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-gradient {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, #0000ff, #00ff00, #ffff00, #ff0000);
}

/* ── Live View ───────────────────────────────────────────── */
.live-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.live-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(34,197,94,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.live-count {
  font-size: 72px;
  font-weight: 800;
  color: var(--accent-green);
  line-height: 1;
  letter-spacing: -3px;
  text-shadow: 0 0 40px rgba(34,197,94,0.3);
}

.live-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 8px;
}

.live-pulse-rings {
  position: absolute;
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.live-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(34,197,94,0.3);
  animation: ringPulse 2s ease infinite;
}

.live-pulse-ring:nth-child(2) { animation-delay: 0.5s; }
.live-pulse-ring:nth-child(3) { animation-delay: 1s; }

@keyframes ringPulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ── Page Cards ──────────────────────────────────────────── */
.page-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.page-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition);
}

.page-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.page-card-path {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  margin-bottom: 8px;
  word-break: break-all;
}

.page-card-count {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-green);
  line-height: 1;
  margin-bottom: 4px;
}

.page-card-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.page-mini-map {
  height: 60px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.mini-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
  animation: dot-float 2s ease infinite;
}

/* ── Session Feed ────────────────────────────────────────── */
.session-feed {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.feed-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  animation: slideInRight 0.3s ease;
  transition: background var(--transition);
}

.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--glass); }

.feed-item-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  margin-top: 1px;
}

.feed-item-icon--session { background: rgba(99,102,241,0.15); }
.feed-item-icon--scroll  { background: rgba(20,184,166,0.15); }
.feed-item-icon--cart    { background: rgba(34,197,94,0.15); }
.feed-item-icon--click   { background: rgba(245,158,11,0.15); }

.feed-item-content { flex: 1; min-width: 0; }

.feed-item-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.feed-item-text strong { color: var(--text-primary); }

.feed-item-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Sessions Page ───────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-select {
  padding: 7px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
  transition: border-color var(--transition);
  cursor: pointer;
}

.filter-select:hover, .filter-select:focus {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
}

/* ── Session Detail Panel ────────────────────────────────── */
.session-detail-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 480px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-hover);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease;
  box-shadow: -10px 0 40px rgba(0,0,0,0.4);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: var(--bg-card);
}

.session-panel-close {
  position: relative;
  z-index: 3;
  pointer-events: auto;
  cursor: pointer;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.meta-item-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.meta-item-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ── Event Timeline ──────────────────────────────────────── */
.event-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.event-timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.timeline-event {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  position: relative;
  z-index: 1;
}

.timeline-dot--pageview { background: var(--accent-indigo); }
.timeline-dot--click    { background: var(--accent-amber); }
.timeline-dot--scroll   { background: var(--accent-teal); }
.timeline-dot--cart     { background: var(--accent-green); }

.timeline-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  width: 46px;
  flex-shrink: 0;
  margin-top: 3px;
}

.timeline-content {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  padding-top: 2px;
}

.timeline-content strong { color: var(--text-primary); }

/* ── Mini Replay ─────────────────────────────────────────── */
.mini-replay {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 20px;
}

.mini-replay-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.mini-replay-screen {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 160px;
  position: relative;
  overflow: hidden;
}

.replay-section-bar {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.replay-click-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(245,158,11,0.7);
  border: 2px solid var(--accent-amber);
  transform: translate(-50%, -50%);
  animation: clickDotPop 0.4s ease forwards;
}

@keyframes clickDotPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition);
  cursor: pointer;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.page-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: white;
}

/* ── GLP1 Page ───────────────────────────────────────────── */
.section-engagement-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.engagement-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.engagement-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.engagement-name {
  width: 130px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.engagement-bar-wrap {
  flex: 1;
  height: 7px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}

.engagement-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
}

.engagement-fill--green  { background: linear-gradient(90deg, #22c55e, #4ade80); }
.engagement-fill--amber  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.engagement-fill--red    { background: linear-gradient(90deg, #ef4444, #f87171); }

.engagement-pct {
  width: 40px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.engagement-dwell {
  width: 52px;
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── CTA Cards ───────────────────────────────────────────── */
.cta-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.cta-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
}

.cta-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.cta-card--featured {
  border-color: rgba(245,158,11,0.3);
  background: linear-gradient(135deg, var(--bg-card), rgba(245,158,11,0.03));
}

.cta-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.cta-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.cta-cvr {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

.cta-cvr--indigo { color: var(--accent-indigo); }
.cta-cvr--amber  { color: var(--accent-amber); }
.cta-cvr--teal   { color: var(--accent-teal); }

.cta-clicks {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.cta-opportunity {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--accent-amber);
  font-weight: 500;
}

/* ── Insight Callout ─────────────────────────────────────── */
.insight-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(99,102,241,0.07);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 16px;
}

.insight-callout-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.insight-callout-content { flex: 1; }

.insight-callout-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-indigo);
  margin-bottom: 4px;
}

.insight-callout-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Device Chip ─────────────────────────────────────────── */
.device-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px;
  font-weight: 500;
}

.device-chip--mobile  { background: rgba(99,102,241,0.12);  color: var(--accent-indigo); }
.device-chip--desktop { background: rgba(20,184,166,0.12);  color: var(--accent-teal); }
.device-chip--tablet  { background: rgba(245,158,11,0.12);  color: var(--accent-amber); }

/* ── Stat Row ────────────────────────────────────────────── */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.stat-row:last-child { border-bottom: none; }

.stat-row-label { font-size: 13px; color: var(--text-secondary); }
.stat-row-value { font-size: 14px; font-weight: 700; color: var(--text-primary); }

/* ── Returning Visitor Panel ─────────────────────────────── */
.returning-panel {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
}

.returning-pct {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent-teal);
  letter-spacing: -2px;
  line-height: 1;
}

.returning-info { flex: 1; }
.returning-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.returning-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }

/* ── Sparkline ───────────────────────────────────────────── */
.sparkline-inline {
  display: inline-block;
  vertical-align: middle;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 10px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 40px; }
.empty-state-text { font-size: 13px; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .cta-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid--2-1 { grid-template-columns: 1fr; }
  .chart-grid--1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    z-index: 300;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  .chart-grid--2col { grid-template-columns: 1fr; }
  .chart-grid--3col { grid-template-columns: 1fr; }

  .heatmap-page { flex-direction: column; }
  .heatmap-sidebar-panel { width: 100%; }
  .session-detail-panel { width: 100%; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .view-container { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .cta-cards-grid { grid-template-columns: 1fr; }
  .header-controls { gap: 8px; }
  .control-label { display: none; }
  .top-header { padding: 0 14px; }
}

/* ═══════════════════════════════════════════════════════
   Settings View Styles
═══════════════════════════════════════════════════════ */

/* ── Settings Page Layout ─────────────────────────── */
.settings-page {
  max-width: 800px;
  margin: 0 auto;
}

.settings-header {
  margin-bottom: 32px;
}

.settings-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.settings-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.settings-section {
  margin-bottom: 24px;
}

/* ── Settings Cards ───────────────────────────────── */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s ease;
  animation: fadeInUp 0.4s ease both;
}

.settings-card:hover {
  border-color: var(--border-hover);
}

.settings-card--danger {
  border-color: rgba(239, 68, 68, 0.2);
}

.settings-card--danger:hover {
  border-color: rgba(239, 68, 68, 0.35);
}

.settings-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
}

.settings-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-card__icon--info {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-indigo);
}

.settings-card__icon--danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}

.settings-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px 0;
}

.settings-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.settings-card__body {
  padding: 24px;
}

/* ── Info Grid ────────────────────────────────────── */
.settings-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.settings-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-info-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings-info-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-info-value--mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.settings-plan-badge {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--accent-green);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.settings-status-indicator--active {
  color: var(--accent-green);
}

.settings-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ── Danger Zone ──────────────────────────────────── */
.settings-danger-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.settings-danger-item__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.settings-danger-item__desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
  line-height: 1.55;
}

.settings-danger-item__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-danger-item__list li {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-left: 18px;
  position: relative;
}

.settings-danger-item__list li::before {
  content: '•';
  position: absolute;
  left: 4px;
  color: var(--accent-red);
  font-weight: 700;
}

.settings-danger-item__action {
  flex-shrink: 0;
  padding-top: 4px;
}

/* ── Danger Button ────────────────────────────────── */
.btn--danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn--danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

.btn--danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Uninstall Modal ──────────────────────────────── */
.settings-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.settings-modal-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.settings-modal {
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 460px;
  width: 90%;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.settings-modal-overlay--visible .settings-modal {
  transform: scale(1);
}

.settings-modal__icon {
  margin-bottom: 16px;
}

.settings-modal__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px 0;
}

.settings-modal__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 20px 0;
}

.settings-modal__confirm-group {
  text-align: left;
  margin-bottom: 24px;
}

.settings-modal__confirm-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.settings-modal__confirm-input {
  width: 100%;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.settings-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.settings-modal__actions .btn {
  min-width: 130px;
}

/* ── Loading spinner small variant ────────────────── */
.loading-spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/* ── Settings Responsive ──────────────────────────── */
@media (max-width: 640px) {
  .settings-info-grid {
    grid-template-columns: 1fr;
  }
  .settings-danger-item {
    flex-direction: column;
  }
  .settings-danger-item__action {
    width: 100%;
  }
  .settings-danger-item__action .btn--danger {
    width: 100%;
    justify-content: center;
  }
  .settings-modal__actions {
    flex-direction: column;
  }
}
