/* router-arena — dark theme, no framework */
:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1a1e25;
  --line: #232830;
  --text: #e6e8eb;
  --muted: #8a93a0;
  --accent: #3aa0ff;
  --accent-soft: rgba(58, 160, 255, 0.15);
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #ff6b6b;
  --shadow: 0 1px 0 rgba(255,255,255,0.03), 0 8px 24px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  min-height: 100vh;
}

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

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0f1217 0%, #0b0d10 100%);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.brand .tagline {
  color: var(--muted);
  font-size: 12px;
}
.counters {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
}
.counter {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex; flex-direction: column;
  min-width: 110px;
  box-shadow: var(--shadow);
}
.counter .label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.counter .val { font-size: 16px; font-weight: 600; }

.actions { display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--panel-2); border-color: #2c333d; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: progress; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #0c0f13;
}
.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Panels ---------- */
main { padding: 18px 22px 60px; }
.panel { display: none; }
.panel.active { display: block; }

.panel-controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 12px;
}
.panel-controls .hint { color: var(--muted); font-size: 12px; }

input[type="search"], input[type="text"] {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  min-width: 240px;
}
input[type="search"]:focus { outline: none; border-color: var(--accent); }

.toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted);
  cursor: pointer;
}

.chips { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.chip {
  background: var(--panel);
  border: 0;
  color: var(--muted);
  padding: 6px 11px;
  cursor: pointer;
  font-size: 12px;
  border-right: 1px solid var(--line);
}
.chip:last-child { border-right: 0; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
thead th {
  position: sticky; top: 0;
  background: #161a20;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th.num, td.num { text-align: right; }
tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 0.08s ease;
}
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
td {
  padding: 9px 12px;
  vertical-align: middle;
  font-size: 13px;
}
td.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  font-style: italic;
}
.row-clickable { cursor: pointer; }

/* Status pills / badges */
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
}
.pill.green { color: var(--green); background: rgba(74, 222, 128, 0.12); border-color: rgba(74,222,128,0.3); }
.pill.yellow { color: var(--yellow); background: rgba(251, 191, 36, 0.12); border-color: rgba(251,191,36,0.3); }
.pill.red { color: var(--red); background: rgba(255, 107, 107, 0.13); border-color: rgba(255,107,107,0.3); }
.pill.muted { color: var(--muted); background: rgba(138, 147, 160, 0.1); border-color: rgba(138,147,160,0.25); }

.delta-up { color: var(--red); }
.delta-down { color: var(--green); }

.code {
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: #b6bdc7;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 50px 20px;
  z-index: 50;
  overflow: auto;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(960px, 100%);
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 16px 18px; }

.aggregate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.aggregate-grid .agg {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
}
.aggregate-grid .agg .label { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; }
.aggregate-grid .agg .val { font-size: 14.5px; font-weight: 600; }

.section-title { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; margin: 14px 0 8px; }

.quant-block { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.quant-block .quant-tag { background: var(--panel-2); border: 1px solid var(--line); padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.quant-block .quant-tag b { color: var(--accent); }

.chart-wrap { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 10px; height: 220px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 12px 22px;
  color: var(--muted);
  font-size: 11.5px;
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between;
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(6px);
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr; }
  .counters { justify-content: flex-start; }
  .footer { position: static; }
}
