:root {
  --accent: #ff3e7f;
  --bg: #0a0a0c;
  --surface: #141418;
  --surface-2: #1c1c22;
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --border: #27272a;
  --good: #10b981;
  --bad: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #ff8fb1);
  color: #fff; font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.title { font-weight: 700; letter-spacing: -0.01em; }

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

select, .btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); }

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
}

.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab:hover { color: var(--text); }

main {
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kpi-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.kpi-sub .up { color: var(--good); }
.kpi-sub .down { color: var(--bad); }

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

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

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

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

td.num { text-align: right; font-variant-numeric: tabular-nums; }

a.creator-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

a.creator-link:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}

.badge.ig { background: #e1306c20; color: #e1306c; }
.badge.tiktok { background: #69c9d020; color: #69c9d0; }
.badge.facebook { background: #1877f220; color: #1877f2; }
.badge.direct { background: #8b5cf620; color: #a78bfa; }

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.chart-wrap { position: relative; height: 320px; }

footer {
  padding: 20px 24px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

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

.event-row {
  display: grid;
  grid-template-columns: 70px 80px 1fr auto;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  align-items: center;
}

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

.event-time { color: var(--muted); font-variant-numeric: tabular-nums; }

.type-pv { color: var(--muted); }
.type-click { color: var(--accent); font-weight: 600; }

.country-flag {
  font-size: 14px;
  margin-right: 4px;
}
