:root {
  --crit: #ff2e63;
  --high: #ff8c42;
  --med:  #ffd23f;
  --low:  #3abff8;
  --info: #8a94a6;

  --bg-0: #070b12;
  --bg-1: #0b1220;
  --bg-2: #111b2e;
  --bg-3: #16233a;
  --line: #223247;
  --text: #e8eef6;
  --muted: #8da3bd;
  --accent: #2ee6c8;
  --accent-2: #4f8cff;

  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 800px at 70% -10%, #13233d 0%, var(--bg-0) 60%);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

button { font-family: inherit; }

/* ===================== Toolbar ===================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  height: 58px;
  background: linear-gradient(180deg, rgba(13,21,36,.96), rgba(10,15,26,.92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 30;
  overflow-x: auto;
}
.toolbar::-webkit-scrollbar { height: 0; }

.brand { display: flex; align-items: center; gap: 9px; font-size: 18px; letter-spacing: .5px; flex: none; }
.brand .logo { font-size: 22px; filter: drop-shadow(0 0 8px rgba(46,230,200,.5)); }
.brand-text b { color: var(--accent); }

.toolbar-group { display: flex; align-items: center; gap: 8px; flex: none; }
.toolbar-group.grow { flex: 1 1 200px; min-width: 160px; }

.btn {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s ease;
}
.btn:hover { border-color: var(--accent); color: #fff; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(180deg, #1f6feb, #1559c9); border-color: #2b7cff; }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(43,124,255,.4); }
.btn.toggle.is-active { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(46,230,200,.3); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; border-color: var(--line); color: var(--muted); }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 7px; }

.seg { background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg-btn {
  background: transparent; color: var(--muted); border: 0; padding: 6px 11px;
  border-radius: 7px; cursor: pointer; font-size: 13px;
}
.seg-btn.is-active { background: var(--bg-3); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(46,230,200,.25); }

.field { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.field select {
  background: var(--bg-3); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font-size: 13px; cursor: pointer;
}

.search {
  width: 100%;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; font-size: 13px;
}
.search:focus { outline: none; border-color: var(--accent); }

.sev-filters { gap: 6px; }
.sev-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer;
  color: var(--muted); user-select: none; transition: .15s;
}
.sev-chip .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.sev-chip .count { font-variant-numeric: tabular-nums; opacity: .85; }
.sev-chip.is-active { color: var(--text); border-color: currentColor; }
.sev-chip.is-off { opacity: .38; filter: grayscale(.6); }

/* ===================== Stage ===================== */
.stage { position: relative; height: calc(100% - 58px); }
.graph { position: absolute; inset: 0; }

.overlay-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); background: rgba(10,15,26,.7);
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px;
  pointer-events: none; z-index: 10;
}

/* ===================== Drop hint ===================== */
.drop-hint {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 20;
  background: radial-gradient(800px 500px at 50% 40%, rgba(20,35,60,.5), transparent);
}
.drop-hint.dragging .drop-card { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(46,230,200,.15), var(--shadow); }
.drop-hint.hidden { display: none; }
.drop-card {
  text-align: center; padding: 40px 48px; max-width: 520px;
  background: rgba(13,21,36,.85); border: 1px dashed var(--line);
  border-radius: 20px; box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.drop-icon { font-size: 56px; }
.drop-card h1 { margin: 10px 0 4px; font-size: 26px; }
.drop-card p { color: var(--muted); margin: 6px 0; }
.drop-card code { color: var(--accent); font-family: var(--mono); }
.drop-actions { display: flex; gap: 12px; justify-content: center; margin: 20px 0 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }

/* ===================== Side panel ===================== */
.side-panel {
  position: absolute; top: 14px; right: 14px; width: 320px; max-height: calc(100% - 28px);
  background: rgba(11,18,32,.9); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(10px);
  z-index: 15; transition: transform .25s ease, opacity .25s; display: flex; flex-direction: column;
}
.side-panel.collapsed { transform: translateX(calc(100% + 20px)); opacity: 0; pointer-events: none; }
.panel-toggle {
  position: absolute; left: -34px; top: 12px; width: 30px; height: 34px;
  background: var(--bg-3); border: 1px solid var(--line); border-right: 0;
  border-radius: 9px 0 0 9px; color: var(--muted); cursor: pointer;
}
.panel-body { overflow-y: auto; padding: 14px 16px 18px; }
.panel-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.panel-section:last-child { border-bottom: 0; }
.panel-section h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted); margin: 0 0 10px; }
.report-meta { font-size: 13px; line-height: 1.6; }
.report-meta b { color: var(--text); }

.sev-stats { display: flex; flex-direction: column; gap: 7px; }
.sev-row { display: grid; grid-template-columns: 70px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; }
.sev-row .name { color: var(--muted); }
.sev-row .bar { height: 8px; border-radius: 4px; background: var(--bg-3); overflow: hidden; }
.sev-row .bar > span { display: block; height: 100%; border-radius: 4px; }
.sev-row .val { text-align: right; font-variant-numeric: tabular-nums; }

.top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.top-list li {
  display: flex; align-items: center; gap: 9px; font-size: 12.5px; cursor: pointer;
  padding: 7px 9px; border-radius: 8px; background: var(--bg-2); border: 1px solid transparent;
}
.top-list li:hover { border-color: var(--accent); }
.top-list .pill { width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }
.top-list .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list .meta { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; }
.legend li { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.legend .node-glyph { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); }
.legend .node-glyph.host { border-color: var(--accent); }
.legend .glyph { width: 14px; text-align: center; color: var(--text); font-size: 13px; line-height: 1; }

/* ===================== Modal ===================== */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,7,12,.72); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: min(880px, 94vw); max-height: 88vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-title { flex: 1; min-width: 0; }
.modal-title h3 { margin: 0 0 6px; font-size: 18px; line-height: 1.3; word-break: break-word; }
.modal-title .sub { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.modal-close {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: none;
}
.modal-close:hover { color: #fff; border-color: var(--crit); }
.modal-body { padding: 18px 20px 24px; overflow-y: auto; }

/* Modal content blocks */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #0b0f17; }
.badge.outline { background: transparent; border: 1px solid currentColor; color: var(--text); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.kv {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.kv .k { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.kv .v { font-size: 14px; margin-top: 3px; word-break: break-word; }
.kv .v.mono { font-family: var(--mono); }

.block { margin: 16px 0; }
.block h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); }
.block .prose { white-space: pre-wrap; line-height: 1.55; font-size: 13.5px; color: #d4def0; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: 320px; overflow: auto; }

.cvss-meter { display: flex; align-items: center; gap: 10px; }
.cvss-meter .track { flex: 1; height: 9px; border-radius: 5px; background: var(--bg-3); overflow: hidden; }
.cvss-meter .track > span { display: block; height: 100%; }
.cvss-meter .num { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 34px; text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; color: var(--text); cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--accent); }
.chip.cve { color: #ffd9e2; border-color: rgba(255,46,99,.4); }
.chip.host .pill { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }

/* Findings table */
.table-tools { display: flex; gap: 10px; align-items: center; margin: 6px 0 10px; }
.table-tools input { flex: 1; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.find-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.find-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-1); }
.find-table td { padding: 9px 10px; border-bottom: 1px solid rgba(34,50,71,.6); }
.find-table tbody tr { cursor: pointer; }
.find-table tbody tr:hover { background: rgba(46,230,200,.06); }
.find-table .sev-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; color: #0b0f17; }
.find-table .port { font-family: var(--mono); color: var(--muted); }

.accordion { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.accordion > summary { cursor: pointer; padding: 10px 12px; background: var(--bg-2); font-size: 13px; font-family: var(--mono); color: var(--accent); list-style: none; }
.accordion > summary::-webkit-details-marker { display: none; }
.accordion[open] > summary { border-bottom: 1px solid var(--line); }
.accordion pre { margin: 0; padding: 12px 14px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto; }

a.ext { color: var(--accent-2); text-decoration: none; word-break: break-all; }
a.ext:hover { text-decoration: underline; }

/* ===================== Context menu ===================== */
.context-menu {
  position: fixed; z-index: 200; min-width: 190px; list-style: none; margin: 0; padding: 6px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.context-menu.hidden { display: none; }
.context-menu .ctx-title { padding: 6px 10px 8px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.context-menu li.item { padding: 8px 10px; border-radius: 7px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 9px; }
.context-menu li.item:hover { background: var(--bg-3); color: var(--accent); }

/* ===================== Toast ===================== */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 300;
  opacity: 0; transition: .25s; font-size: 13px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.hidden { display: none; }
.toast.error { border-color: var(--crit); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #25344a; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #34496a; background-clip: padding-box; }

@media (max-width: 720px) {
  .side-panel { width: calc(100% - 28px); }
  .brand-text { display: none; }
}

/* ===================== Export modal ===================== */
.export-block { margin-bottom: 18px; }
.export-block h4 {
  margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.export-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 11px; margin-bottom: 7px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
}
.export-info { flex: 1; min-width: 0; }
.export-title { font-size: 13.5px; font-weight: 600; }
.export-sub { font-size: 11.5px; }
.export-count {
  font-variant-numeric: tabular-nums; font-size: 12px; color: var(--accent);
  background: rgba(46,230,200,.1); border: 1px solid rgba(46,230,200,.25);
  border-radius: 999px; padding: 2px 9px; min-width: 34px; text-align: center;
}
.export-actions { display: flex; gap: 6px; }

.svc-type-list { display: flex; flex-direction: column; gap: 6px; }
.svc-type-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 9px;
}
.svc-type-row .export-actions { margin-left: auto; }
.svc-badge {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: #07101a;
  background: var(--accent); border-radius: 6px; padding: 3px 9px; min-width: 64px;
  justify-content: center;
}
