:root {
  color-scheme: light dark;
  --bg: #f4f4f2; --panel: #fcfcfb; --fg: #1b1b1a; --muted: #62625e; --line: #d9d9d4;
  --accent: #1f62b5; --none: #8a8f98;
  --k-component: #2a78d6; --k-code: #8a5cd6;
  --sev-low: #0ca30c; --sev-medium: #fab219; --sev-high: #ec835a; --sev-critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110; --panel: #1a1a19; --fg: #ececea; --muted: #a3a39e; --line: #33332f;
    --accent: #6ea8ef;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 system-ui, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 18px; margin: 0 0 8px; }
h2 { font-size: 13px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.error { color: var(--sev-critical); }

header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; }
nav { display: flex; gap: 12px; }
.stats { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 12px; }
.stats b { color: var(--fg); }
.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.run { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.run:empty { display: none; }
.run progress { width: 160px; }

button, input, select, textarea { font: inherit; color: inherit; background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
textarea { width: 100%; min-height: 64px; resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

main { padding: 12px 16px; max-width: 1400px; margin: 0 auto; outline: none; }
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 12px; align-items: start; }
.cols > * { display: grid; gap: 12px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; min-width: 0; }
.panel + .panel, h1 + .panel { margin-top: 0; }
main > .panel { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.empty { text-align: center; padding: 40px 12px; }
.empty .row { justify-content: center; margin-top: 12px; }

.badge { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 12px; white-space: nowrap; }
.badge[data-sev]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; background: var(--none); }
.badge[data-sev="low"]::before { background: var(--sev-low); }
.badge[data-sev="medium"]::before { background: var(--sev-medium); }
.badge[data-sev="high"]::before { background: var(--sev-high); }
.badge[data-sev="critical"]::before { background: var(--sev-critical); }

pre.text { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
pre.desc { max-height: 320px; overflow: auto; font: 12px/1.45 ui-monospace, monospace; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0 0 8px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { padding: 5px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
ul.list li:first-child { border-top: 0; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 4px 8px 4px 0; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; border-top: 0; white-space: nowrap; }
td.num { white-space: nowrap; }

.graph { position: relative; }
.cy { height: min(72vh, 760px); min-height: 420px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tab { padding: 4px 10px; border: 1px solid var(--line, #8884); border-radius: 999px; text-decoration: none; font-size: 13px; }
.tab[aria-current="page"] { background: var(--fg); color: var(--panel); border-color: var(--fg); }
.graph .tools { position: absolute; top: 8px; right: 8px; z-index: 5; display: flex; gap: 4px; }
.graph .hint { min-height: 1.45em; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 12px; height: 12px; background: var(--none); }
.legend .component { background: var(--k-component); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.legend .cluster { border-radius: 50%; }
.legend .issue { border-radius: 3px; height: 9px; }
.legend .code { background: var(--k-code); transform: rotate(45deg) scale(.8); }
.legend .dot { border-radius: 50%; width: 9px; height: 9px; }
.legend .low { background: var(--sev-low); }
.legend .medium { background: var(--sev-medium); }
.legend .high { background: var(--sev-high); }
.legend .critical { background: var(--sev-critical); }
.legend .ln { width: 22px; height: 0; background: none; border-top: 2px solid var(--muted); }
.legend .ln.dashed { border-top-style: dashed; }

iframe.code { width: 100%; height: calc(100vh - 150px); min-height: 400px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; }

@media (max-width: 800px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .cy { height: 360px; }
  .actions { margin-left: 0; }
  .wide { display: none; }
}
