:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-hover: #232733;
  --border: #2a2f3d;
  --text: #e8eaef;
  --muted: #8b92a5;
  --accent: #5865f2;
  --accent-soft: rgba(88, 101, 242, 0.15);
  --green: #57f287;
  --red: #ed4245;
  --gold: #fee75c;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1a1f35 0%, var(--bg) 60%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

.login-card .logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-card h1 {
  margin-top: 0.25rem;
  font-size: 1.75rem;
}

.subtitle { color: var(--muted); margin-bottom: 1.5rem; }

.login-card label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}

.login-card input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-card button {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.8rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.login-card button:hover { opacity: 0.9; }

.alert.error {
  background: rgba(237, 66, 69, 0.15);
  color: #ff8a8c;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.footer-note {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.brand .logo { color: var(--accent); }
.brand .sep { color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.live-pill {
  font-size: 0.8rem;
  color: var(--green);
  background: rgba(87, 242, 135, 0.12);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}
.live-pill.offline { color: var(--red); background: rgba(237, 66, 69, 0.12); }

.btn-outline {
  border: 1px solid var(--border);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
}
.btn-outline:hover { background: var(--bg-hover); text-decoration: none; }

.muted { color: var(--muted); font-size: 0.85rem; }

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  margin-top: 0.25rem;
  color: var(--text);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.panel h2 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.panel-header h2 { margin-bottom: 0; }

.muted-panel { opacity: 0.85; }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 0.6rem; }

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.bar-track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.bar-count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

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

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

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

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr:hover { background: var(--bg-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--accent-soft);
  font-size: 0.85rem;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
