:root {
  --bg: #0d0d0f;
  --panel: #16161a;
  --panel-2: #1d1d23;
  --border: #26262d;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #06b6d4;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --noise: #64748b;
  --unclassified: #818cf8;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

kbd {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

header.site {
  background: linear-gradient(180deg, #101014 0%, #0d0d0f 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.wordmark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.4px;
  color: var(--accent);
}
.tagline { color: var(--muted); font-size: 13px; }
nav { display: flex; gap: 16px; }
nav a {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 500;
}
nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
nav a.active { color: var(--text); background: var(--panel-2); }

main { padding: 24px 0 80px; min-height: 60vh; }

.loading { color: var(--muted); padding: 60px 0; text-align: center; }

footer.site {
  border-top: 1px solid var(--border);
  background: #0a0a0c;
  color: var(--muted);
  font-size: 12px;
}
footer.site .wrap {
  padding-top: 16px;
  padding-bottom: 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.muted { color: var(--muted); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.filters input[type=search], .filters select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 14px;
  min-width: 160px;
}
.filters input[type=search]:focus, .filters select:focus {
  outline: none;
  border-color: var(--accent);
}
.filters button {
  background: var(--accent);
  color: #042f2e;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
}
.filters button:hover { background: var(--accent-2); color: white; }
.filters .spacer { flex: 1; }
.filters .pill {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0;
}

.cards { display: grid; gap: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 6px 1fr auto;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.card:hover { border-color: var(--accent); background: var(--panel-2); }
.card.focused { border-color: var(--accent); outline: 1px solid var(--accent); }

.card .stripe { background: var(--noise); border-radius: 3px; }
.card.sev-high .stripe { background: var(--danger); }
.card.sev-medium .stripe { background: var(--warning); }
.card.sev-low .stripe { background: var(--success); }
.card.sev-noise .stripe { background: var(--noise); }
.card.sev-unclassified .stripe { background: var(--unclassified); }

.card .body { min-width: 0; }
.card .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.card .lab {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.card .label-pill { color: var(--text); font-weight: 500; font-size: 13px; }
.card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: var(--text);
  font-weight: 600;
}
.card .summary { color: var(--muted); margin-top: 4px; font-size: 14px; }
.card .stat-col {
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.card .stat-col .added { color: var(--success); }
.card .stat-col .removed { color: var(--danger); }
.card .stat-col .when { display: block; margin-top: 6px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 999px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge.high { background: rgba(239,68,68,0.12); color: var(--danger); border-color: rgba(239,68,68,0.4); }
.badge.medium { background: rgba(245,158,11,0.12); color: var(--warning); border-color: rgba(245,158,11,0.4); }
.badge.low { background: rgba(34,197,94,0.12); color: var(--success); border-color: rgba(34,197,94,0.4); }
.badge.noise { background: rgba(100,116,139,0.15); color: var(--noise); border-color: rgba(100,116,139,0.4); }
.badge.unclassified { background: rgba(129,140,248,0.12); color: var(--unclassified); border-color: rgba(129,140,248,0.4); }
.badge.kind { background: var(--panel-2); color: var(--muted); border-color: var(--border); }

.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.lab-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.1s;
}
.lab-card:hover { border-color: var(--accent); }
.lab-card h3 { margin: 0 0 6px; font-size: 18px; }
.lab-card .stat { color: var(--muted); font-size: 13px; }
.lab-card .stat strong { color: var(--text); font-family: var(--mono); }

.sources-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.sources-table th, .sources-table td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.sources-table th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 11px;
}
.sources-table tr:last-child td { border-bottom: none; }
.sources-table td.status-ok { color: var(--success); font-family: var(--mono); }
.sources-table td.status-error { color: var(--danger); font-family: var(--mono); }
.sources-table td.status-na { color: var(--muted); font-family: var(--mono); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.stat-tile .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-tile .value { font-size: 28px; font-family: var(--mono); color: var(--text); margin-top: 6px; }

.bars {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.bars h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 48px; gap: 12px; margin-bottom: 8px; align-items: center; }
.bar-row .name { color: var(--text); font-size: 14px; }
.bar-row .bar { background: var(--panel-2); border-radius: 4px; height: 12px; overflow: hidden; }
.bar-row .bar div { height: 100%; background: var(--accent); }
.bar-row .n { text-align: right; font-family: var(--mono); color: var(--muted); font-size: 13px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }
.modal-back {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}
.modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 1000px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 64px);
  overflow: auto;
  padding: 24px;
  z-index: 1;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
}
.modal-close:hover { background: var(--bg); }

.detail h2 { margin: 0 0 4px; font-size: 22px; }
.detail .crumb { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.detail .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.detail pre.diff {
  background: #0a0a0c;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
  overflow: auto;
  max-height: 520px;
}
.detail pre.diff .add { color: var(--success); display: block; }
.detail pre.diff .rem { color: var(--danger); display: block; }
.detail pre.diff .hdr { color: var(--accent); display: block; }
.detail pre.diff .ctx { color: var(--muted); display: block; }

.empty {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fecaca;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}

@media (max-width: 720px) {
  header.site .wrap { flex-direction: column; align-items: flex-start; }
  nav { width: 100%; overflow-x: auto; }
  .card { grid-template-columns: 6px 1fr; }
  .card .stat-col { grid-column: 2; text-align: left; margin-top: 6px; }
  .filters { flex-direction: column; }
  .filters input[type=search], .filters select { width: 100%; }
  .bar-row { grid-template-columns: 1fr 48px; }
  .bar-row .name { grid-column: 1 / -1; }
}
