:root {
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #19223b;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --clean: #10b981;
  --low: #84cc16;
  --moderate: #f59e0b;
  --high: #f97316;
  --critical: #ef4444;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, "Inter", "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.topbar { background: rgba(11, 15, 23, 0.85); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: baseline; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { color: var(--critical); font-size: 22px; }
.brand-name { font-weight: 700; font-family: var(--mono); }
.brand-tag { color: var(--muted); font-size: 13px; }
.nav { display: flex; gap: 18px; }
.nav a { color: var(--muted); font-size: 14px; }
.nav a.active, .nav a:hover { color: var(--text); }

.view-wrap { padding: 32px 0 80px; }
.view-wrap > * + * { margin-top: 28px; }

.hero { padding: 0 20px; }
.counter-card {
  background: linear-gradient(140deg, #161e36 0%, #0c1224 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  max-width: 1100px;
  margin: 0 auto;
}
.counter-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; }
.counter-value { font-size: 64px; font-weight: 800; line-height: 1.1; margin: 8px 0 16px; color: var(--critical); font-family: var(--mono); }
.counter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.chip b { color: var(--text); font-weight: 700; }
.chip.cat-critical { border-color: var(--critical); }
.chip.cat-critical b { color: var(--critical); }
.chip.cat-high { border-color: var(--high); }
.chip.cat-high b { color: var(--high); }
.chip.cat-moderate { border-color: var(--moderate); }
.chip.cat-moderate b { color: var(--moderate); }
.chip.cat-low { border-color: var(--low); }
.chip.cat-low b { color: var(--low); }
.chip.cat-clean { border-color: var(--clean); }
.chip.cat-clean b { color: var(--clean); }
.counter-meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 18px; }
.counter-banner { margin-top: 14px; padding: 10px 14px; border-radius: 8px; background: rgba(239, 68, 68, 0.1); border: 1px solid var(--critical); color: #fca5a5; }

.scan-card, .result-card, .recent, .page-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 1100px;
  margin: 0 auto;
}
.page-header h1 { margin: 0 0 6px; font-size: 24px; }
.page-header p { margin: 0; }

.scan-card h2 { margin: 0 0 4px; font-size: 20px; }
.scan-card .muted { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
#scan-input { width: 100%; min-height: 240px; resize: vertical; background: #0a0f1c; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
#scan-input:focus { outline: 2px solid var(--accent); }
.scan-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 14px; }
.radio-group { display: flex; gap: 14px; color: var(--muted); font-size: 14px; }
.radio-group input { accent-color: var(--accent); }
.btn-primary { background: var(--accent); color: #0b0f17; border: none; padding: 10px 22px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-ghost:hover { background: var(--surface-2); }
.status { margin-top: 10px; color: var(--muted); font-size: 13px; min-height: 18px; }
.status.error { color: #fca5a5; }

.result-card { padding: 28px; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.score-dial { width: 110px; height: 110px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-direction: column; border: 5px solid var(--border); font-weight: 800; }
.score-dial .num { font-size: 36px; line-height: 1; font-family: var(--mono); }
.score-dial .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.score-dial.cat-clean { border-color: var(--clean); color: var(--clean); }
.score-dial.cat-low { border-color: var(--low); color: var(--low); }
.score-dial.cat-moderate { border-color: var(--moderate); color: var(--moderate); }
.score-dial.cat-high { border-color: var(--high); color: var(--high); }
.score-dial.cat-critical { border-color: var(--critical); color: var(--critical); }

.result-meta { flex: 1; min-width: 220px; font-size: 13px; }
.result-meta .row { display: flex; gap: 10px; margin-bottom: 6px; }
.result-meta .row span:first-child { color: var(--muted); width: 100px; flex-shrink: 0; }
.combo-tag { display: inline-block; background: rgba(239,68,68,0.15); color: #fca5a5; padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.share-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.share-bar input { flex: 1; min-width: 200px; padding: 7px 10px; background: #0a0f1c; border: 1px solid var(--border); color: var(--text); border-radius: 6px; font-family: var(--mono); font-size: 12px; }

.hits-list { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.hit { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.hit-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.hit-key { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.hit-label { font-weight: 600; font-size: 14px; }
.hit-meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.hit-excerpt { margin-top: 8px; padding: 8px 10px; background: #0a0f1c; border-radius: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); border-left: 3px solid var(--accent); overflow-wrap: break-word; }
.hit-cat { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.hit.cat-exfil_render .hit-cat { color: var(--critical); border-color: var(--critical); }
.hit.cat-preauth_link .hit-cat { color: var(--high); border-color: var(--high); }
.hit.cat-silent_send .hit-cat { color: var(--high); border-color: var(--high); }
.hit.cat-subdomain_exfil .hit-cat { color: var(--moderate); border-color: var(--moderate); }
.hit.cat-obfuscation .hit-cat { color: var(--low); border-color: var(--low); }
.hit.cat-data_collection .hit-cat { color: var(--low); border-color: var(--low); }

.recent h3 { margin: 0 0 14px; font-size: 16px; }
.recent-list { display: flex; flex-wrap: wrap; gap: 10px; }
.recent-pill { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--text); }
.recent-pill:hover { text-decoration: none; border-color: var(--accent); }
.recent-pill .score-tag { font-family: var(--mono); font-weight: 700; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; max-width: 1100px; margin: 0 auto; padding: 0 28px; }
.filters input, .filters select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 8px 12px; border-radius: 6px; font-size: 14px; }

.registry-table { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; max-width: 1100px; margin: 0 auto; overflow-x: auto; }
.registry-table table { width: 100%; border-collapse: collapse; }
.registry-table th, .registry-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
.registry-table th { background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 600; }
.registry-table tr:last-child td { border-bottom: none; }
.registry-table tr:hover td { background: rgba(96, 165, 250, 0.04); cursor: pointer; }
.score-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-family: var(--mono); font-weight: 700; font-size: 12px; }
.score-badge.cat-clean { background: rgba(16,185,129,0.2); color: var(--clean); }
.score-badge.cat-low { background: rgba(132,204,22,0.2); color: var(--low); }
.score-badge.cat-moderate { background: rgba(245,158,11,0.2); color: var(--moderate); }
.score-badge.cat-high { background: rgba(249,115,22,0.2); color: var(--high); }
.score-badge.cat-critical { background: rgba(239,68,68,0.2); color: var(--critical); }
.cat-pill { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; margin-right: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.path-cell { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.rules-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.rule-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.rule-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rule-key { font-family: var(--mono); color: var(--accent); font-size: 13px; }
.rule-label { font-weight: 600; }
.rule-weight { margin-left: auto; color: var(--muted); font-size: 12px; }
.rule-cat { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); margin-top: 6px; }
.rule-quote { margin-top: 10px; font-style: italic; color: var(--muted); font-size: 13px; border-left: 2px solid var(--accent); padding-left: 10px; }
.rule-regex { margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--text); background: #0a0f1c; padding: 8px 10px; border-radius: 6px; overflow-wrap: break-word; }

.footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 13px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }

.detail-banner { padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; max-width: 1100px; margin: 0 auto 16px; font-size: 14px; }
.detail-preview { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre-wrap; background: #0a0f1c; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; max-height: 240px; overflow: auto; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .topbar .wrap { flex-direction: column; align-items: flex-start; gap: 10px; }
  .counter-value { font-size: 44px; }
  .nav { font-size: 13px; gap: 14px; flex-wrap: wrap; }
}
