:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel2: #18212d;
  --border: #243041;
  --text: #e8eef7;
  --muted: #8b9bb0;
  --accent: #3d8bfd;
  --good: #3dd68c;
  --warn: #f5a524;
  --bad: #f31260;
  --soft: #a78bfa;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  position: sticky; top: 0; height: 100vh;
}
nav.side .brand { font-weight: 700; letter-spacing: 0.04em; margin-bottom: 0.25rem; }
nav.side .sub { color: var(--muted); font-size: 0.8rem; margin-bottom: 1.5rem; }
nav.side a {
  display: block; padding: 0.45rem 0.6rem; border-radius: 6px;
  color: var(--text); margin-bottom: 0.2rem;
}
nav.side a:hover, nav.side a.active { background: var(--panel2); text-decoration: none; }
main { padding: 1.5rem 1.75rem 3rem; max-width: 1200px; }
h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 0.75rem; color: var(--text); }
.meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.25rem; }
.grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.9rem 1rem;
}
.card .label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.card .value { font-size: 1.35rem; font-weight: 650; font-family: var(--mono); margin-top: 0.2rem; }
.card .hint { color: var(--muted); font-size: 0.8rem; margin-top: 0.35rem; }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  padding: 0.15rem 0.45rem; border-radius: 999px; border: 1px solid var(--border);
}
.badge.good { color: var(--good); border-color: #1f6b45; background: #10261b; }
.badge.warn { color: var(--warn); border-color: #7a5412; background: #2a1f0a; }
.badge.bad { color: var(--bad); border-color: #7a1838; background: #2a0c16; }
.badge.soft { color: var(--soft); border-color: #4c3a7a; background: #1a1430; }
.badge.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: rgba(255,255,255,0.02); }
.suggest {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem; margin-bottom: 0.75rem;
}
.suggest .title { font-weight: 650; margin-bottom: 0.35rem; }
.suggest .why { color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.suggest .cite { font-family: var(--mono); font-size: 0.72rem; color: #6b7c90; margin-top: 0.5rem; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.65rem; }
button, .btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 7px;
  padding: 0.45rem 0.85rem; font-weight: 600; cursor: pointer; font-size: 0.85rem;
}
button.secondary, .btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.alert {
  border-left: 3px solid var(--warn); background: #221a0c;
  padding: 0.75rem 1rem; border-radius: 0 8px 8px 0; margin-bottom: 0.75rem;
}
.alert.bad { border-left-color: var(--bad); background: #220c14; }
.alert.good { border-left-color: var(--good); background: #0c1f16; }
.stale { color: var(--warn); font-weight: 600; }
#gate {
  position: fixed; inset: 0; background: #070a0e; display: flex;
  align-items: center; justify-content: center; z-index: 1000;
}
#gate.hidden { display: none; }
#gate .box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem; width: min(360px, 92vw);
}
#gate input {
  width: 100%; padding: 0.6rem 0.75rem; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  margin: 0.75rem 0;
}
.mono { font-family: var(--mono); }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters button.active { outline: 2px solid var(--accent); }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  nav.side { position: relative; height: auto; }
}
