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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --text-dim: #8b8fa3;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --green: #00b894;
  --red: #e17055;
  --orange: #fdcb6e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-light);
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.health-badge {
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--border);
}

.health-badge.ok { background: rgba(0,184,148,0.2); color: var(--green); }
.health-badge.error { background: rgba(225,112,85,0.2); color: var(--red); }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}

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

th {
  background: rgba(108,92,231,0.1);
  color: var(--accent-light);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  font-size: 0.9rem;
  color: var(--text);
}

tr:hover td { background: rgba(255,255,255,0.02); }

.explorer-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

select, input[type="number"], input[type="text"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

select { min-width: 200px; }
input[type="number"] { width: 100px; }

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

button:hover { background: var(--accent-light); }

#chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  height: 250px;
  position: relative;
}

#chart-canvas {
  width: 100%;
  height: 100%;
}

#data-table-container {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 8px;
}

.ingest-section form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ingest-section input[type="text"] { min-width: 180px; }
.ingest-section input[type="number"] { width: 150px; }

#ingest-result {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--green);
}

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  main { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .header-content { flex-wrap: wrap; }
}
