:root {
  --bg: #090D16;
  --bg-raised: #0C1220;
  --panel: #0E1524;
  --panel-2: #111A2B;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #F9FAFB;
  --muted: #9CA3AF;
  --faint: #6B7280;
  --emerald: #10B981;
  --crimson: #EF4444;
  --orange: #F97316;
  --amber: #EAB308;
  --slate: #64748B;
  --radius: 6px;
  --glow: 0 0 15px rgba(16, 185, 129, 0.1);
  --glow-red: 0 0 18px rgba(239, 68, 68, 0.18);
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  padding-inline: clamp(16px, 3vw, 40px);
  padding-block: 0 32px;
  background:
    radial-gradient(1200px 400px at 50% -200px, rgba(16, 185, 129, 0.06), transparent 70%),
    var(--bg);
  min-height: 100vh;
}

code, .mono { font-family: var(--font-mono); font-size: 12.5px; }

main { max-width: 1320px; margin: 0 auto; display: grid; gap: 20px; }

/* ---------- top bar ---------- */
.topbar {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-block: 18px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; fill: rgba(16, 185, 129, 0.12); stroke: var(--emerald); stroke-width: 1.6; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.35)); }
.brand-check { fill: none; stroke-linecap: round; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; border: 1px solid var(--border); padding: 1px 8px; border-radius: 999px; }
.live { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate); }
.live.is-live .live-dot { background: var(--emerald); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); animation: ping 2s infinite; }
.live.is-down .live-dot { background: var(--crimson); }
.store-path { color: var(--faint); background: var(--bg-raised); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* ---------- risk pulse ---------- */
.pulse-wrap {
  max-width: 1320px;
  margin: 0 auto 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(14, 21, 36, 0.9), rgba(9, 13, 22, 0.9));
  overflow: hidden;
  position: relative;
}
.pulse-wrap.spiking { border-color: rgba(239, 68, 68, 0.45); box-shadow: var(--glow-red); transition: box-shadow .3s, border-color .3s; }
.pulse-meta { position: absolute; inset: 10px 14px auto 14px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; z-index: 1; flex-wrap: wrap; }
.pulse-caption { color: var(--muted); font-size: 12px; font-family: var(--font-mono); text-align: right; }
#pulse { display: block; width: 100%; height: 92px; }

/* ---------- common ---------- */
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 10.5px; color: var(--muted); font-weight: 600; }
h2 { margin: 2px 0 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-note { margin: 0; color: var(--muted); font-size: 12.5px; max-width: 460px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.empty { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty strong { color: var(--text); display: block; margin-bottom: 4px; font-weight: 600; }
.empty code { color: var(--emerald); }

/* ---------- metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.metric { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 14px; align-items: center; min-width: 0; }
.metric.good { box-shadow: var(--glow); }
.metric.alert { border-color: rgba(239, 68, 68, 0.35); box-shadow: var(--glow-red); }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.metric-sub { color: var(--faint); font-size: 11.5px; }
.metric.alert .metric-value { color: var(--crimson); }
.ring { width: 54px; height: 54px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: rgba(148, 163, 184, 0.12); }
.ring .bar { stroke-linecap: round; transition: stroke-dashoffset .8s ease, stroke .4s; }

/* ---------- fingerprint DNA ---------- */
.dna-panel { border-color: rgba(16, 185, 129, 0.2); box-shadow: var(--glow); }
.cluster { border: 1px solid var(--border); border-radius: var(--radius); background: radial-gradient(600px 220px at 50% 40%, rgba(239, 68, 68, 0.07), transparent 70%), var(--bg-raised); padding: 16px; }
.cluster + .cluster { margin-top: 14px; }
.cluster-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; align-items: baseline; }
.cluster-title { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
.cluster-title .count { color: var(--crimson); }
.cluster-sub { color: var(--muted); margin: 4px 0 0; }
.cluster-radius { display: flex; gap: 10px; align-items: flex-start; background: rgba(239, 68, 68, 0.06); border: 1px solid rgba(239, 68, 68, 0.25); border-radius: var(--radius); padding: 10px 12px; max-width: 520px; }
.cluster-radius .tier { font-family: var(--font-mono); font-size: 11px; color: var(--crimson); border: 1px solid rgba(239, 68, 68, 0.4); border-radius: 4px; padding: 0 6px; white-space: nowrap; }
.cluster-radius strong { display: block; }
.cluster-radius span.desc { color: var(--muted); font-size: 12.5px; }
.dna-svg-wrap { overflow-x: auto; margin: 6px -6px 0; }
.dna-svg { display: block; width: 100%; min-width: 560px; height: auto; }
.dna-strand { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.dna-strand.a { stroke: var(--crimson); stroke-dasharray: 10 8; animation: flow 1.6s linear infinite; }
.dna-strand.b { stroke: #FB7185; opacity: .75; stroke-dasharray: 10 8; animation: flow 1.6s linear infinite reverse; }
.dna-rung { stroke: rgba(248, 113, 113, 0.45); stroke-width: 1.5; }
.dna-drop { fill: none; stroke: rgba(148, 163, 184, 0.35); stroke-width: 1.2; stroke-dasharray: 3 5; animation: flow 3s linear infinite; }
.dna-glow { animation: breathe 2.4s ease-in-out infinite; }
.dna-fp rect { fill: #150D12; stroke: var(--crimson); stroke-width: 1.4; }
.dna-fp text { font-family: var(--font-mono); fill: var(--text); }
.dna-node circle.halo { fill: rgba(239, 68, 68, 0.1); }
.dna-node circle.core { fill: #0B111D; stroke-width: 2.4; }
.dna-node text { fill: var(--text); font-family: var(--font-ui); }
.dna-node text.meta { fill: var(--muted); font-size: 12px; }
.dna-node text.loc { fill: var(--faint); font-family: var(--font-mono); font-size: 11px; }
.dna-node.status-EXPOSED circle.core { stroke: var(--crimson); }
.dna-node.status-BLOCKED circle.core, .dna-node.status-RESOLVED circle.core { stroke: var(--emerald); }
.dna-node.status-BLOCKED circle.halo, .dna-node.status-RESOLVED circle.halo { fill: rgba(16, 185, 129, 0.1); }
.dna-node.status-WARNED circle.core, .dna-node.status-DETECTED circle.core { stroke: var(--amber); }
.dna-node.is-new { animation: pop .7s cubic-bezier(.2, 1.4, .4, 1) both; transform-box: fill-box; transform-origin: center; }
.dna-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12px; margin-top: 4px; }
.dna-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
@keyframes flow { to { stroke-dashoffset: -36; } }
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- findings log ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { font: inherit; font-size: 12px; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 10px; cursor: pointer; }
.filters button:hover { color: var(--text); border-color: var(--border-strong); }
.filters button[aria-selected="true"] { color: var(--text); border-color: rgba(16, 185, 129, 0.5); background: rgba(16, 185, 129, 0.08); }
.filters button span { color: var(--faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #070B13; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log th { text-align: left; font-weight: 500; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 9px 12px; border-bottom: 1px solid var(--border); background: #0A0F1A; white-space: nowrap; }
table.log td { padding: 10px 12px; border-bottom: 1px solid rgba(148, 163, 184, 0.07); vertical-align: top; }
table.log tr:last-child td { border-bottom: 0; }
table.log tbody tr:hover { background: rgba(148, 163, 184, 0.04); }
table.log tr.is-resolved { opacity: .55; }
table.log tr.is-new { animation: flash 2.2s ease-out; }
@keyframes flash { 0% { background: rgba(239, 68, 68, 0.28); } 100% { background: transparent; } }
.sub { color: var(--faint); font-size: 11.5px; margin-top: 2px; }
.type { font-weight: 500; }
.blast { max-width: 320px; }
.blast .tier { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; margin-right: 6px; }
.loc { color: #93C5FD; overflow-wrap: anywhere; }
.fp { color: var(--text); white-space: nowrap; }
.chip-dna { font: inherit; font-family: var(--font-mono); font-size: 10.5px; margin-left: 6px; color: var(--crimson); background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.35); border-radius: 4px; padding: 0 5px; cursor: pointer; }
.badge { display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; border-radius: 4px; border: 1px solid; white-space: nowrap; }
.badge.CRITICAL { color: #FECACA; background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.55); }
.badge.HIGH { color: #FED7AA; background: rgba(249, 115, 22, 0.14); border-color: rgba(249, 115, 22, 0.5); }
.badge.MEDIUM { color: #FEF08A; background: rgba(234, 179, 8, 0.12); border-color: rgba(234, 179, 8, 0.45); }
.badge.LOW { color: #CBD5E1; background: rgba(100, 116, 139, 0.15); border-color: rgba(100, 116, 139, 0.45); }
.status { font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.status.BLOCKED, .status.RESOLVED { color: var(--emerald); }
.status.EXPOSED { color: var(--crimson); }
.status.WARNED, .status.DETECTED { color: var(--amber); }

/* ---------- types + repos ---------- */
.type-row, .repo-row { display: grid; grid-template-columns: minmax(0, 190px) 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.07); }
.type-row:last-child, .repo-row:last-child { border-bottom: 0; }
.type-name, .repo-name { min-width: 0; overflow-wrap: anywhere; }
.stack { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: rgba(148, 163, 184, 0.08); }
.stack span { display: block; height: 100%; transition: width .6s ease; }
.stack .CRITICAL, .legend .CRITICAL { background: var(--crimson); }
.stack .HIGH, .legend .HIGH { background: var(--orange); }
.stack .MEDIUM, .legend .MEDIUM { background: var(--amber); }
.stack .LOW, .legend .LOW { background: var(--slate); }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.legend { display: flex; gap: 12px; color: var(--faint); font-size: 11.5px; margin-top: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.score-bar { height: 6px; border-radius: 3px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.score-bar span { display: block; height: 100%; border-radius: 3px; transition: width .6s ease; }

.footer { max-width: 1320px; margin: 24px auto 0; color: var(--faint); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; }

/* ---------- small screens: table rows become stacked cards ---------- */
@media (max-width: 760px) {
  table.log thead { display: none; }
  table.log, table.log tbody, table.log tr, table.log td { display: block; width: 100%; }
  table.log tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  table.log td { border: 0; padding: 3px 0; }
  table.log td[data-label]::before { content: attr(data-label); display: block; color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }
  .type-row, .repo-row { grid-template-columns: 1fr auto; }
  .type-row .stack, .repo-row .score-bar { grid-column: 1 / -1; order: 3; }
  .metric-value { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
