:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #18202f;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-2: #38bdf8;
  --safe: #10b981;
  --low: #84cc16;
  --moderate: #f59e0b;
  --high: #f97316;
  --critical: #ef4444;
  --unknown: #64748b;
  --shadow: 0 10px 30px -10px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; backdrop-filter: blur(10px); background: rgba(11,15,23,.85); z-index: 20;
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand .logo {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 10px; background: linear-gradient(135deg, #1e3a8a, #0ea5e9);
  font-size: 22px; box-shadow: var(--shadow);
}
.brand h1 { margin: 0; font-size: 20px; font-weight: 700; }
.brand .tagline { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.links a { margin-left: 18px; color: var(--muted); font-size: 14px; }
.links a:hover { color: var(--text); }

.hero { padding: 28px 32px 8px; }
.stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .value.crit { color: var(--critical); }
.stat .value.high { color: var(--high); }
.note { color: var(--muted); font-size: 13px; margin-top: 14px; max-width: 860px; }

.panel {
  margin: 28px 32px; padding: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 8px; font-size: 13px; outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--accent); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 10px 8px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
tbody td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.empty:hover { background: transparent; cursor: default; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.pill.safe { background: rgba(16,185,129,.15); color: var(--safe); }
.pill.low { background: rgba(132,204,22,.15); color: var(--low); }
.pill.moderate { background: rgba(245,158,11,.18); color: var(--moderate); }
.pill.high { background: rgba(249,115,22,.18); color: var(--high); }
.pill.critical { background: rgba(239,68,68,.2); color: var(--critical); }
.pill.unknown { background: rgba(100,116,139,.2); color: var(--unknown); }
.pill .score { background: rgba(0,0,0,.25); padding: 1px 6px; border-radius: 4px; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 14px; }
.pager button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.submit-form { display: flex; gap: 8px; flex-wrap: wrap; }
.submit-form input {
  flex: 1; min-width: 280px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.submit-form input:focus { outline: none; border-color: var(--accent); }
.submit-form button {
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #0b0f17; font-weight: 700; cursor: pointer;
}
.submit-form button:hover { background: var(--accent-2); border-color: var(--accent-2); }
.submit-status { margin-top: 10px; min-height: 18px; }
.submit-status.ok { color: var(--safe); }
.submit-status.err { color: var(--critical); }

.movers { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mover {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; gap: 6px;
}
.mover:hover { border-color: var(--accent); }
.mover .row { display: flex; justify-content: space-between; align-items: center; }
.mover .name { font-weight: 600; }
.mover .delta.up { color: var(--critical); }
.mover .delta.down { color: var(--safe); }

.modal { position: fixed; inset: 0; background: rgba(2,6,16,.7); display: grid; place-items: center; z-index: 50; padding: 24px; }
.modal.hidden { display: none; }
.modal-card {
  position: relative;
  max-width: 880px; width: 100%; max-height: 84vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px; box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 10px; right: 14px; background: transparent; border: 0;
  color: var(--muted); font-size: 28px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.detail-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head .meta { flex: 1; min-width: 240px; }
.detail-head h3 { margin: 0 0 4px; font-size: 22px; }
.detail-head .repo { color: var(--muted); font-size: 13px; word-break: break-all; }
.detail-head .description { margin-top: 8px; color: var(--text); font-size: 14px; }
.gauge {
  width: 130px; text-align: center; border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.gauge .num { font-size: 32px; font-weight: 800; }
.gauge .cat { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; color: var(--muted); }

.finding {
  border: 1px solid var(--border); border-radius: 8px; margin: 8px 0; padding: 10px 12px;
  background: var(--surface-2);
}
.finding .head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.finding .head .label { font-weight: 600; }
.finding .head .severity { font-size: 12px; color: var(--muted); }
.finding .excerpt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg); padding: 8px 10px; border-radius: 6px; margin-top: 6px; font-size: 12px; white-space: pre-wrap; overflow-x: auto; }
.finding .describe { font-size: 12px; color: var(--muted); margin-top: 6px; }

.cat-section h4 { font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; margin: 16px 0 4px; }

.sparkline { display: block; margin-top: 12px; }

.patterns th, .patterns td { font-size: 13px; }
.patterns td.weight { text-align: right; font-variant-numeric: tabular-nums; color: var(--accent); }

footer { padding: 28px 32px 60px; color: var(--muted); font-size: 12px; text-align: center; border-top: 1px solid var(--border); margin-top: 18px; }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .panel { margin: 18px 14px; padding: 16px; }
  .topbar { padding: 16px; }
  .links { display: none; }
}
