* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e4e4e7;
  --text-muted: #8b8d98;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 8px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.header h1 { font-size: 18px; font-weight: 600; }
.header-controls { display: flex; gap: 12px; align-items: center; }
.header select, .header input[type="date"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
}

/* Layout */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 28px; font-weight: 700; margin-top: 4px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  font-size: 14px;
  transition: color 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Section */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* Chart */
.chart-container { position: relative; height: 300px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tr:hover td { background: rgba(99, 102, 241, 0.05); }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }

/* Panel (for tab content) */
.panel { display: none; }
.panel.active { display: block; }

/* Grid layout for charts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Journey */
.journey-list { list-style: none; }
.journey-item {
  padding: 10px 16px;
  border-left: 2px solid var(--accent);
  margin-left: 8px;
  position: relative;
}
.journey-item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  left: -5px;
  top: 14px;
}
.journey-time { font-size: 11px; color: var(--text-muted); }
.journey-page { font-weight: 500; }
.journey-event { font-size: 12px; color: var(--text-muted); }

/* Realtime pulse */
.realtime-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
  margin-right: 6px;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.badge-conversion { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge-bounce { background: rgba(239, 68, 68, 0.15); color: var(--red); }

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 16px;
}
.back-btn:hover { border-color: var(--accent); }

/* Export button */
.export-btn {
  padding: 4px 12px;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
}
.export-btn:hover { border-color: var(--accent); color: var(--text); }

/* Section header with title + export */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* Comparison change badges */
.change-badge {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
}
.change-up { color: var(--green); }
.change-down { color: var(--red); }
.change-flat { color: var(--text-muted); }
