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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #232733;
  --border: #2e3347;
  --text: #e2e4ed;
  --text-dim: #8b8fa3;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.15);
  --green: #00d68f;
  --red: #ff6b6b;
  --orange: #ffa94d;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header h1 span {
  color: var(--accent);
}

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.controls button {
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font);
  transition: all 0.15s;
}

.controls button:hover {
  background: var(--border);
  color: var(--text);
}

.controls button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.controls input[type="date"] {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
}

/* Realtime bar */
.realtime-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.realtime-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.realtime-count {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--mono);
}

/* Overview cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
}

.card-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.card-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

/* Chart sections */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

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

/* Grid layout for side by side charts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

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

td:last-child, th:last-child {
  text-align: right;
}

.path-cell {
  font-family: var(--mono);
  font-size: 0.82rem;
}

/* Bar indicator */
.bar-cell {
  position: relative;
}

.bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--accent-glow);
  border-radius: 3px;
  z-index: 0;
}

.bar-cell span {
  position: relative;
  z-index: 1;
}

/* Loading spinner */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-dim);
}

/* Empty state */
.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem 1rem;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 1rem; flex-direction: column; gap: 1rem; }
  .container { padding: 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .controls { flex-wrap: wrap; justify-content: center; }
}

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