/* ── Base — global reset, vars, shared components ──────────────────────────── */

:root {
  --bg: #0e1117;
  --surface: #161b22;
  --surface-hover: #1c2333;
  --border: #30363d;
  --text: #c9d1d9;
  --text-dim: #8b949e;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --green: #3fb950;
  --success: #3fb950;
  --red: #f85149;
  --error: #f85149;
  --orange: #d29922;
  --warning: #d29922;
  --purple: #bc8cff;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  --radius: 6px;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* ── Header ──────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header__logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.header__logo:hover { text-decoration: none; }

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.navbar a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  transition: background .15s;
}
.navbar a:hover { background: var(--border); color: var(--text); text-decoration: none; }
.navbar a.active { background: var(--accent); color: #fff; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ── Main ────────────────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 600;
}
.subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.badge-provider { background: rgba(88,166,255,.15); color: var(--accent); }
.badge-success { background: rgba(63,185,80,.15); color: var(--green); }
.badge-error { background: rgba(248,81,73,.15); color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.85; }

/* ── Tables ──────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}
tr:hover { background: var(--surface-hover); }
.empty { color: var(--text-muted); text-align: center; padding: 40px; }

/* ── Forms ───────────────────────────────────────────────────── */
input[type="text"],
input[type="number"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}
.card--wide { grid-column: 1 / -1; }
.card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.card__footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

/* ── Stats (dl grid) ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.stats-grid dt {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.stats-grid dd {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── WS indicator dot ────────────────────────────────────────── */
.ws-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  margin-left: 8px;
  vertical-align: middle;
}
.ws-dot.connected { background: var(--green); }

/* ── Misc ────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
