:root {
  --paper: #e6ecee;
  --sheet: #f4f7f8;
  --ink: #18262e;
  --ink-2: #4a5b64;
  --ink-3: #7d8d95;
  --rule: #c9d3d7;
  --steel: #2f5f86;
  --steel-ink: #ffffff;
  --critical: #a3241b;
  --high: #b8650a;
  --medium: #8c7a12;
  --low: #3f6f8f;
  --info: #7d8d95;
  --clean: #2f7350;
  --display: "Bahnschrift", "DIN Alternate", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --code: "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, monospace;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--steel); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--steel); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.mono { font-family: var(--code); font-size: 13px; }

button {
  cursor: pointer;
  border: 1px solid var(--rule);
  background: var(--sheet);
  border-radius: var(--radius);
  padding: 6px 12px;
}
button:hover { border-color: var(--ink-3); }
button.primary { background: var(--steel); color: var(--steel-ink); border-color: var(--steel); }
button.primary:hover { filter: brightness(1.08); }
button.quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
button.quiet:hover { color: var(--ink); border-color: var(--rule); }
button:disabled { opacity: .55; cursor: default; }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.login {
  width: min(380px, 100%);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 32px 28px 28px;
}
.login h1 {
  font: 600 34px/1 var(--display);
  font-stretch: condensed;
  letter-spacing: -.01em;
  margin: 0 0 6px;
}
.login p { margin: 0 0 24px; color: var(--ink-2); }
.login label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 4px; }
.login input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
}
.login button { width: 100%; margin-top: 22px; padding: 10px; }
.login .error { color: var(--critical); min-height: 1.5em; margin: 12px 0 0; font-size: 14px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 290px 1fr; height: 100%; }
.side {
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--paper);
}
.brand { padding: 18px 18px 12px; display: flex; align-items: baseline; justify-content: space-between; }
.brand h1 { font: 600 24px/1 var(--display); font-stretch: condensed; margin: 0; }
.side h2 { font: 600 14px/1 var(--body); color: var(--ink-2); margin: 14px 18px 8px; }
.history { list-style: none; margin: 0; padding: 0 8px 16px; overflow: auto; flex: 1; }
.history li button {
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 10px 8px 14px; border-radius: var(--radius); position: relative;
  display: grid; gap: 1px;
}
.history li button::before {
  content: ""; position: absolute; left: 4px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px;
  background: var(--v, var(--rule));
}
.history li button:hover { background: var(--sheet); }
.history li button[aria-current="true"] { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); }
.history .h-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .h-sub { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .empty { padding: 8px 14px; color: var(--ink-3); font-size: 14px; }
.side-foot { border-top: 1px solid var(--rule); padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); }

.main { overflow: auto; min-width: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 22px 28px 60px; }

/* ---------- drop zone ---------- */
.drop {
  border: 2px dashed var(--ink-3);
  border-radius: 10px;
  background: var(--sheet);
  padding: 40px 24px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop.compact { padding: 14px 18px; display: flex; align-items: center; gap: 14px; text-align: left; border-width: 1px; }
.drop.over { border-color: var(--steel); background: #eef4f9; }
.drop h2 { font: 600 30px/1.1 var(--display); font-stretch: condensed; margin: 0 0 8px; }
.drop.compact h2 { font-size: 18px; margin: 0; flex: 1; }
.drop p { margin: 0 0 18px; color: var(--ink-2); }
.drop.compact p { display: none; }
.drop .progress { margin-top: 14px; height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.drop.compact .progress { margin: 0; width: 160px; }
.drop .progress span { display: block; height: 100%; width: 0; background: var(--steel); transition: width .2s; }
.drop .status { margin-top: 10px; font-size: 14px; color: var(--ink-2); min-height: 1.5em; }
.drop.compact .status { margin: 0; }
.drop .status.err { color: var(--critical); }
.checks { margin: 22px auto 0; max-width: 620px; text-align: left; color: var(--ink-2); font-size: 14px; columns: 2; column-gap: 28px; padding-left: 18px; }
.checks li { break-inside: avoid; margin-bottom: 4px; }

/* ---------- verdict band ---------- */
.verdict {
  --v: var(--clean);
  margin-top: 20px;
  background: var(--v);
  color: #fff;
  border-radius: 10px;
  padding: 22px 26px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 28px;
  align-items: end;
}
.verdict.malicious { --v: var(--critical); }
.verdict.suspicious { --v: var(--high); }
.verdict.caution { --v: var(--medium); }
.verdict-word {
  font: 700 clamp(56px, 9vw, 112px)/.86 var(--display);
  font-stretch: condensed;
  letter-spacing: -.02em;
  margin: 0;
}
.verdict-file { font-size: 16px; opacity: .92; margin: 10px 0 0; overflow-wrap: anywhere; }
.verdict-summary { grid-column: 1 / -1; margin: 6px 0 0; max-width: 72ch; font-size: 15.5px; }
.gauge { text-align: right; min-width: 170px; }
.gauge-num { font: 600 44px/1 var(--display); }
.gauge-num small { font-size: 18px; opacity: .8; }
.gauge-bar { height: 6px; background: rgba(255,255,255,.28); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.gauge-bar span { display: block; height: 100%; background: #fff; }
.gauge-label { font-size: 13px; opacity: .85; margin-top: 4px; }
.counts { grid-column: 1 / -1; display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; margin-top: 8px; }
.counts span b { font-weight: 700; margin-right: 4px; }

/* ---------- report body ---------- */
.actions { display: flex; gap: 8px; justify-content: flex-end; margin: 12px 0 0; }
.facts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0; margin: 18px 0 0; border-top: 1px solid var(--rule);
}
.fact { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.fact dt { font-size: 13px; color: var(--ink-2); }
.fact dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.fact.wide { grid-column: 1 / -1; }
.hash { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.hash code { font: 12.5px var(--code); overflow-wrap: anywhere; }
.copy { padding: 1px 8px; font-size: 12px; }

.obf { margin: 22px 0 0; display: grid; grid-template-columns: 180px 1fr; gap: 6px 20px; align-items: start; }
.obf h3 { margin: 0; font: 600 20px/1.2 var(--display); }
.meter { display: flex; gap: 3px; margin-top: 8px; }
.meter i { flex: 1; height: 10px; background: var(--rule); border-radius: 2px; }
.meter i.on { background: var(--ink); }
.meter.heavy i.on { background: var(--critical); }
.meter.light i.on { background: var(--medium); }
.obf ul { margin: 0; padding-left: 18px; color: var(--ink-2); }

.section-h { font: 600 20px/1.2 var(--display); margin: 26px 0 8px; }
.section-h .muted { font: 400 15px/1 var(--body); }

/* provenance */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 20px; border-top: 1px solid var(--rule); }
.prov { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.prov-label { font-size: 13px; color: var(--ink-2); position: relative; padding-left: 14px; }
.prov-label::before { content: ""; position: absolute; left: 0; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.prov-good .prov-label::before { background: var(--clean); }
.prov-bad .prov-label::before { background: var(--critical); }
.prov-warn .prov-label::before { background: var(--high); }
.prov-unknown .prov-label::before { background: var(--ink-3); }
.prov-off .prov-label::before { background: var(--rule); }
.prov-body { overflow-wrap: anywhere; font-size: 14px; }

/* probability */
.prob-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prob-table td { padding: 5px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prob-table tr.pos td:nth-child(2) { color: var(--critical); font-weight: 600; }
.prob-table tr.neg td:nth-child(2) { color: var(--clean); font-weight: 600; }
.prob-table td:nth-child(2) { white-space: nowrap; text-align: right; width: 64px; }

/* jev */
.jev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 20px; margin-top: 8px; }
.jev-q { display: grid; gap: 3px; }
.jev-bar { display: block; height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.jev-fill { display: block; height: 100%; background: var(--steel); }
.jev-qlabel { font-size: 13px; color: var(--ink-2); }

.tabs { display: flex; gap: 4px; margin: 30px 0 0; border-bottom: 1px solid var(--rule); }
.tabs button {
  border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent;
  padding: 8px 14px; font-weight: 600; color: var(--ink-2);
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .n { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.panel { padding-top: 6px; }

/* findings */
.sev-group h3 { font: 600 18px/1.2 var(--display); margin: 22px 0 6px; display: flex; gap: 8px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }
.finding { border-top: 1px solid var(--rule); padding: 12px 0 12px 16px; position: relative; }
.finding::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 2px; background: var(--c); }
.finding:last-child { border-bottom: 1px solid var(--rule); }
.f-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.f-title { font-weight: 650; font-size: 16px; }
.f-tag { font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 20px; padding: 0 8px; }
.f-desc { margin: 4px 0 0; color: var(--ink-2); max-width: 78ch; }
.finding details { margin-top: 6px; }
.finding summary { cursor: pointer; color: var(--steel); font-size: 14px; }
.evidence { list-style: none; margin: 6px 0 0; padding: 0; }
.evidence li { padding: 5px 0; border-top: 1px dashed var(--rule); font-size: 13.5px; display: grid; gap: 1px; }
.evidence .ev-loc { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.evidence .ev-detail { font: 12.5px var(--code); color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.linkish { border: 0; background: none; padding: 0; color: var(--steel); text-decoration: underline; text-underline-offset: 2px; font: 12.5px var(--code); text-align: left; overflow-wrap: anywhere; }
.pill { font-size: 11.5px; border-radius: 20px; padding: 0 7px; background: var(--paper); color: var(--ink-2); border: 1px solid var(--rule); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--ink-3); }
td { padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
td.k { white-space: nowrap; }
.kind { font-weight: 600; color: var(--c, var(--ink-2)); }

.toolbar { display: flex; gap: 12px; align-items: center; margin: 14px 0 0; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1; min-width: 220px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; }
.toolbar label { font-size: 14px; display: flex; gap: 6px; align-items: center; }
.classes { list-style: none; padding: 0; margin: 10px 0 0; }
.classes li { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--rule); }
.classes .linkish { flex: 1; min-width: 0; }
.more { margin-top: 12px; }
.empty-note { color: var(--ink-2); padding: 18px 0; }

/* ---------- source drawer ---------- */
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(1040px, 100vw);
  background: #fbfcfc; border-left: 1px solid var(--ink-3);
  box-shadow: -18px 0 40px rgba(24, 38, 46, .18);
  display: flex; flex-direction: column; z-index: 20;
  transform: translateX(0); transition: transform .2s ease-out;
}
.drawer.closed { transform: translateX(102%); visibility: hidden; }
.drawer-head { padding: 12px 16px; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.drawer-head h2 { margin: 0; font: 600 18px/1.2 var(--display); flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 5px 11px; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.drawer-note { padding: 6px 16px; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.drawer-body { flex: 1; overflow: auto; }
.code { margin: 0; font: 13px/1.55 var(--code); counter-reset: ln; padding: 10px 0 40px; tab-size: 4; }
.code .ln { display: block; min-height: 1.55em; padding: 0 16px 0 64px; position: relative; white-space: pre; }
.code .ln::before {
  counter-increment: ln; content: counter(ln);
  position: absolute; left: 0; width: 48px; text-align: right; color: var(--ink-3);
}
.code .ln.hit { background: #fbe9d0; box-shadow: inset 3px 0 0 var(--high); }
.code .kw { color: #7b2f86; }
.code .str { color: #1f6b3a; }
.code .com { color: var(--ink-3); font-style: italic; }
.struct { padding: 14px 18px 40px; font-size: 13.5px; }
.struct h3 { font: 600 16px var(--display); margin: 18px 0 4px; }
.struct .m { border-top: 1px solid var(--rule); padding: 8px 0; }
.struct .m.hit { background: #fbe9d0; }
.struct ul { margin: 4px 0 0; padding-left: 18px; font: 12.5px/1.5 var(--code); overflow-wrap: anywhere; }
.scrim { position: fixed; inset: 0; background: rgba(24, 38, 46, .25); z-index: 19; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 8px 16px; border-radius: var(--radius); font-size: 14px; z-index: 30;
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--rule); max-height: 40vh; }
  .wrap { padding: 16px; }
  .verdict { grid-template-columns: 1fr; }
  .gauge { text-align: left; }
  .obf { grid-template-columns: 1fr; }
  .checks { columns: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
