:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #151d33;
  --text: #e9eefc;
  --muted: #9db0dc;
  --accent: #5ca4ff;
  --good: #3ddc97;
  --warn: #ffb020;
  --bad: #ff5d73;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #121a30, var(--bg));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #253052;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(54, 215, 255, 0.35);
}

h1 { margin: 0; }
.topbar p { margin: 0.35rem 0 0; color: var(--muted); }

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.author-credit {
  font-size: 0.8rem;
  color: #9cb4e8;
}


.author-link {
  font-size: 0.8rem;
  color: #72ccff;
  text-decoration: none;
}

.author-link:hover {
  text-decoration: underline;
}


.layout {
  display: grid;
  grid-template-columns: 300px 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
}

.panel {
  background: linear-gradient(180deg, #1a2442, var(--panel));
  border: 1px solid #273761;
  border-radius: 12px;
  padding: 1rem;
  min-height: 70vh;
}

label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.8rem; }
input, select, button {
  width: 100%;
  margin-top: 0.35rem;
  background: #0f1730;
  color: var(--text);
  border: 1px solid #2b3f73;
  border-radius: 8px;
  padding: 0.6rem;
}
button { cursor: pointer; background: #184ea7; border-color: #2f68c4; }
button:hover { background: #1c5dc7; }
.secondary {
  background: #172546;
  border-color: #334b86;
}
.secondary:hover { background: #203460; }


.demo-note {
  font-size: 0.85rem;
  color: #b7c9f3;
  background: #122041;
  border: 1px solid #2f4f91;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  margin: 0.35rem 0 0.85rem;
}

.summary {
  margin-top: 1rem;
  padding: 0.8rem;
  border: 1px dashed #39568f;
  border-radius: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.history-block {
  margin-top: 1rem;
}

.stats-block {
  margin-top: 1rem;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.history-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

#refreshHistoryBtn,
#refreshStatsBtn {
  width: auto;
  margin-top: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0.65rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.history-item {
  border: 1px solid #334b86;
  background: #0f1833;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--accent);
}

.history-item.active {
  border-color: #74b0ff;
  box-shadow: 0 0 0 1px #23468e;
}

.history-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.scan-stats {
  margin-top: 0.65rem;
  border: 1px solid #334b86;
  border-radius: 8px;
  background: #0f1833;
  padding: 0.6rem;
  color: #cad7f8;
  font-size: 0.78rem;
  line-height: 1.45;
}

.scan-stats p {
  margin: 0 0 0.3rem;
}

.scan-stats p:last-child {
  margin-bottom: 0;
}

.findings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}


.finding-filters {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.finding-filters input,
.finding-filters select {
  margin-top: 0;
}

.finding-filters input {
  width: 220px;
}

.finding-filters select {
  width: 150px;
}

.finding-list { list-style: none; padding: 0; margin: 0.8rem 0 0; display: grid; gap: 0.6rem; }
.finding-item {
  border: 1px solid #334b86;
  border-radius: 8px;
  padding: 0.6rem;
  cursor: pointer;
  background: #111a34;
}
.finding-item:hover { border-color: var(--accent); }
.finding-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px #1f3f88; }

.finding-title { font-weight: 600; margin-bottom: 0.25rem; }
.finding-meta { font-size: 0.82rem; color: var(--muted); }

.sev-critical { color: #ff7287; }
.sev-high { color: #ff9f65; }
.sev-medium { color: #ffd166; }
.sev-low { color: #7dd3fc; }

.issue-empty { color: var(--muted); }
.meta { color: var(--muted); }

.exploit-sketch {
  color: #c9d8ff;
  background: #111a37;
  border: 1px solid #2f467f;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.patch {
  overflow-x: auto;
  background: #0e1430;
  border: 1px solid #2b3f73;
  border-radius: 8px;
  padding: 0.75rem;
}
.verification { padding-left: 1.1rem; }
.verification li.pass { color: var(--good); }
.verification li.warn { color: var(--warn); }
.verification li.fail { color: var(--bad); }

.attack-graph {
  border: 1px solid #2b3f73;
  border-radius: 10px;
  padding: 0.5rem;
  background: #0d1430;
  margin-bottom: 0.8rem;
}
.attack-graph svg {
  width: 100%;
  height: 140px;
}
.node {
  fill: #1d2d57;
  stroke: #4b6eb8;
  stroke-width: 1;
}
.node-label {
  fill: #dde7ff;
  font-size: 11px;
  font-family: Inter, system-ui, sans-serif;
}
.edge {
  stroke: #6f8ed1;
  stroke-width: 1.5;
  marker-end: url(#arrowhead);
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .panel { min-height: auto; }
  .topbar-right { align-items: flex-start; }

  .finding-filters { width: 100%; flex-direction: column; align-items: stretch; }
  .finding-filters input, .finding-filters select { width: 100%; }
}
