:root {
  --bg: #0b0e14;
  --surface: #141925;
  --surface-2: #1c2233;
  --border: #262d3c;
  --text: #e7eaf1;
  --muted: #8a93a6;
  --accent: #6e8bff;
  --accent-hover: #859dff;
  --accent-weak: rgba(110, 139, 255, 0.16);
  --good: #34d399;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.28), 0 8px 24px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html {
  /* background fills the viewport; a soft glow sits behind the centred column */
  background:
    radial-gradient(1100px 520px at 50% -8%, #1a2236 0%, rgba(26, 34, 54, 0) 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  /* the centred content column */
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- header + tabs ---------- */
header { margin-bottom: 1.5rem; }
h1 { margin: 0; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { margin: 0 0 0.25rem; font-size: 1.3rem; font-weight: 650; letter-spacing: -0.01em; }
h3 { margin: 1.75rem 0 0.5rem; font-size: 1.05rem; font-weight: 600; color: #c7cdda; }
.sub { color: var(--muted); margin: 0.4rem 0 0; font-size: 0.85rem; }
.caption { color: var(--muted); font-size: 0.85rem; }

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-top: 1.25rem;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.5rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* ---------- panels + layout ---------- */
.panel { display: none; }
.panel.active { display: block; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* ---------- form controls ---------- */
label { display: block; margin: 0.7rem 0; font-size: 0.9rem; color: #c7cdda; }
label.inline { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1.1rem; color: var(--text); }

input, select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
label.inline input { width: auto; margin-top: 0; }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); width: auto; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  padding: 0;
  background: var(--surface-2);
  border: none;
  border-radius: 999px;
  margin-top: 0.6rem;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--accent-weak);
}
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  border: none; border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 0.7rem 0;
  padding: 0.7rem 0.9rem;
}
legend { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 0.35rem; }

.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin: 0.7rem 0; }
.row label { margin: 0; }

button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
button:hover { border-color: var(--accent); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ---------- metrics ---------- */
.metrics { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.25rem 0; }
.metric {
  flex: 1;
  min-width: 160px;
  background: linear-gradient(180deg, var(--surface), #11151f);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}
.metric .k {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.metric .v {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); }
thead th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- misc ---------- */
pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #c7cdda;
}

details {
  margin: 1rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}
summary { cursor: pointer; color: var(--muted); font-weight: 500; }
summary:hover { color: var(--text); }

.note, .warn {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.88rem;
  border-left: 3px solid;
}
.note { background: rgba(110, 139, 255, 0.08); border-color: var(--accent); color: #c3cdff; }
.warn { background: rgba(245, 166, 35, 0.09); border-color: var(--warn, #f5a623); color: #f3cd8a; }

.hidden { display: none; }
.gaps { font-size: 0.88rem; color: var(--muted); }
.gaps li { margin: 0.35rem 0; }
code {
  background: var(--surface-2);
  padding: 0.12rem 0.38rem;
  border-radius: 5px;
  font-size: 0.85em;
}
