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

:root {
  --bg: #111113;
  --surface: #1a1a1e;
  --surface2: #222226;
  --border: #2a2a2e;
  --text: #e4e4e7;
  --text-dim: #71717a;
  --emerald: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left { display: flex; align-items: baseline; gap: 12px; }
h1 { font-size: 24px; font-weight: 700; }
.subtitle { color: var(--text-dim); font-size: 14px; font-family: var(--mono); }
.header-right { display: flex; align-items: center; gap: 16px; }

.range-picker {
  display: flex;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.range-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.range-btn:hover { color: var(--text); }
.range-btn.active { background: var(--blue); color: #111; font-weight: 600; }

.last-updated { font-size: 12px; color: var(--text-dim); font-family: var(--mono); }

.config-warning {
  background: #2d1f00;
  border: 1px solid #5c3d00;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.config-warning span { font-size: 20px; }
.config-warning strong { color: var(--amber); }
.config-warning p { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.config-warning code { background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

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

.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 32px; font-weight: 700; font-family: var(--mono); }
.stat-value.accent-blue { color: var(--blue); }
.stat-value.accent-emerald { color: var(--emerald); }

.charts-row { margin-bottom: 16px; }
.charts-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

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

.chart-card.wide { width: 100%; }
.chart-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.chart-card canvas { width: 100% !important; max-height: 280px; }

.badge {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  font-family: var(--mono);
  opacity: 0.7;
}

.table-wrap { max-height: 360px; overflow-y: auto; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; position: sticky; top: 0; background: var(--surface); }
.data-table td { font-family: var(--mono); font-size: 12px; }
.data-table td:first-child { font-family: var(--font); font-size: 13px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--surface2); }

.data-table .bar-cell { position: relative; }
.data-table .bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(96,165,250,0.1); border-radius: 0 4px 4px 0; z-index: 0; }
.data-table .bar-text { position: relative; z-index: 1; }

.empty-state { color: var(--text-dim); font-size: 13px; text-align: center; padding: 32px; }

.note {
  margin-top: 24px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.note code { background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }

/* Scrollbar */
.table-wrap::-webkit-scrollbar { width: 6px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (max-width: 768px) {
  .charts-row.two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr 1fr; }
  header { flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .app { padding: 16px 12px 40px; }
}
