:root{
  --bg:#eef1f5; --panel:#fff; --ink:#1b2430; --muted:#667385; --line:#d5dbe3;
  --brand:#0b5cab; --brand-d:#084a8a; --ok:#1f9d55; --warn:#d98a00; --bad:#d23b3b;
  --term-bg:#0c0f14; --term-ink:#d7dde6; --term-sys:#e6c15a;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#12171e; --panel:#1b222c; --ink:#e4e9f0; --muted:#93a0b2; --line:#2e3846; --brand:#4a9be8; --brand-d:#3a86d0; }
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font:14px/1.45 "Segoe UI",system-ui,-apple-system,Roboto,sans-serif;background:var(--bg);color:var(--ink);display:flex;flex-direction:column;min-height:100vh}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;background:#0a2a4a;color:#fff;flex-wrap:wrap}
.brand{font-weight:600;font-size:16px}
.brand .logo{color:#6cb6ff;margin-right:4px}
.brand .sub{font-weight:400;opacity:.7;font-size:13px;margin-left:8px}
.actions{display:flex;gap:8px;flex-wrap:wrap}
.btn{font:inherit;border:1px solid transparent;border-radius:6px;padding:7px 14px;cursor:pointer;font-weight:600}
.btn.primary{background:#1f9d55;color:#fff}
.btn.primary:hover{background:#188246}
.btn.ghost{background:transparent;color:#fff;border-color:rgba(255,255,255,.4)}
.btn.ghost:hover{background:rgba(255,255,255,.12)}
.btn:focus-visible,.tab:focus-visible{outline:2px solid #6cb6ff;outline-offset:2px}
.layout{flex:1;display:grid;grid-template-columns:var(--left-w,470px) 6px minmax(0,1fr) 285px;gap:12px;padding:12px;height:calc(100vh - 58px);min-height:560px}
.col-left,.col-mid,.col-right{min-height:0;min-width:0;overflow-y:auto}
.col-mid{display:flex;flex-direction:column}
.left{display:flex;flex-direction:column;gap:12px;min-width:0;min-height:0}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:8px}
.panel-title{padding:8px 12px;border-bottom:1px solid var(--line);font-weight:600;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:6px}
.legend{font-weight:400;color:var(--muted);font-size:12px}
.dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin:0 4px 0 10px;vertical-align:middle}
.dot.g{background:var(--ok)}.dot.a{background:var(--warn)}.dot.r{background:var(--bad)}
.topo-panel{flex:0 0 auto}
.topo-wrap{padding:4px}
#topo{width:100%;height:auto;display:block}
.work-panel{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.addr-panel{padding:4px 10px 10px;overflow-x:auto}
.addr-panel .addr h2{margin-top:6px}
.tabs{display:flex;gap:2px;padding:6px 8px 0;border-bottom:1px solid var(--line);flex-wrap:wrap}
.tab{font:inherit;background:transparent;border:1px solid transparent;border-bottom:none;border-radius:6px 6px 0 0;padding:6px 14px;cursor:pointer;color:var(--muted)}
.tab:hover{color:var(--ink)}
.tab.active{background:var(--term-bg);color:#fff;border-color:var(--term-bg)}
.tab.active.light{background:var(--brand);border-color:var(--brand)}
.pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.term{overflow-y:auto}
.pane[hidden]{display:none}
.term{flex:1;background:var(--term-bg);color:var(--term-ink);font:13px/1.35 Consolas,"Cascadia Mono","Courier New",monospace;padding:8px 10px;overflow-y:auto;cursor:text;min-height:0}
.term-out,.term-out div{white-space:pre-wrap;word-break:break-word}
.term-out .sys{color:var(--term-sys)}
.term-line{display:flex;align-items:center}
.term-prompt{white-space:pre}
.term-in{flex:1;background:transparent;border:0;outline:0;color:inherit;font:inherit;padding:0;margin:0;min-width:40px;caret-color:#fff}
.host-grid{display:grid;grid-template-columns:260px 1fr;flex:1;min-height:300px}
.host-form{padding:12px 14px;border-right:1px solid var(--line);display:flex;flex-direction:column;gap:10px}
.host-form h3{margin:0 0 2px;font-size:15px}
.host-form label{display:flex;flex-direction:column;gap:3px;font-size:12px;color:var(--muted)}
.host-form input{font:14px Consolas,monospace;padding:6px 8px;border:1px solid var(--line);border-radius:5px;background:var(--panel);color:var(--ink)}
.host-form input:focus{outline:2px solid var(--brand);outline-offset:0}
.host-cmd{background:var(--term-bg);color:var(--term-ink);font:13px/1.35 Consolas,"Cascadia Mono",monospace;padding:8px 10px;overflow-y:auto;cursor:text}
.sw-note{padding:18px;color:var(--muted)}
.muted{color:var(--muted)}.small{font-size:12px;margin:2px 0 0}
.tasks{padding:12px 14px;overflow-y:auto}
.tasks h2{font-size:15px;margin:0 0 8px}
.task{border:1px solid var(--line);border-left:4px solid var(--brand);border-radius:6px;padding:8px 12px 6px;margin-bottom:10px}
.task.ok{border-left-color:var(--ok)}.task.bad{border-left-color:var(--bad)}
.task h3{font-size:14px;margin:0 0 4px;display:flex;justify-content:space-between;gap:8px}
.task .badge{font-size:12px;font-weight:700}
.task.ok .badge{color:var(--ok)}.task.bad .badge{color:var(--bad)}
.task p{margin:2px 0 2px;color:var(--muted)}
.task ul{margin:4px 0 6px;padding-left:20px}
.task li{margin:3px 0}
.last-result{width:100%;margin-top:4px;background:transparent;border:1px dashed var(--line);border-radius:6px;padding:7px;color:var(--ink);cursor:pointer;font:inherit}
/* topology */
.dev{cursor:pointer}
.dev:focus-visible .ring{stroke:var(--brand);stroke-width:3}
.dev .ring{fill:transparent;stroke:transparent;stroke-width:3}
.dev.sel .ring{stroke:var(--brand)}
.dev.flag .ring{stroke:var(--bad);stroke-dasharray:6 3}
.dev text{fill:var(--ink);font:600 30px "Segoe UI",sans-serif;text-anchor:middle}
.dev text.model{font-weight:400;font-size:21px;fill:var(--muted)}
.ico{fill:#3f86c4;stroke:#1d4f80;stroke-width:2}
.ico-line{fill:none;stroke:#fff;stroke-width:2.5;stroke-linecap:round}
.ifl{font:600 24px "Segoe UI",sans-serif;fill:var(--ink)}
.badge-t{font:700 22px "Segoe UI",sans-serif;fill:var(--muted)}
.lk{fill:none;stroke-width:3.2}
.lk.straight{stroke:var(--ink)}.lk.cross{stroke:var(--ink);stroke-dasharray:9 6}.lk.serial{stroke:#d23b3b}
/* modal */
.modal{position:fixed;inset:0;background:rgba(10,20,35,.55);display:flex;align-items:center;justify-content:center;padding:16px;z-index:20;overflow:auto}
.modal[hidden]{display:none}
.modal-card{background:var(--panel);color:var(--ink);border-radius:10px;max-width:760px;width:100%;max-height:92vh;overflow:auto;padding:20px 24px;position:relative;box-shadow:0 10px 40px rgba(0,0,0,.4)}
.modal-card.small{max-width:420px}
.x{position:absolute;right:10px;top:6px;border:0;background:transparent;font-size:26px;cursor:pointer;color:var(--muted)}
.row-end{display:flex;justify-content:flex-end;gap:8px}
.modal .btn.ghost{color:var(--ink);border-color:var(--line)}
.modal .btn.ghost:hover{background:var(--bg)}
.res h2{margin:0 0 10px;font-size:20px}
.res .score{font-size:34px;font-weight:700;margin:6px 0}
.res .score.good{color:var(--ok)}.res .score.mid{color:var(--warn)}.res .score.low{color:var(--bad)}
.res ul.cats{list-style:none;margin:6px 0 12px;padding:0}
.res ul.cats li{padding:3px 0;display:flex;gap:8px}
.mk{font-weight:700;width:1.2em}.mk.ok{color:var(--ok)}.mk.no{color:var(--bad)}
.res .counts{display:flex;gap:16px;flex-wrap:wrap;margin:8px 0 12px}
.res .counts div{padding:6px 12px;border:1px solid var(--line);border-radius:6px}
.res .issue{border-left:4px solid var(--bad);background:rgba(210,59,59,.07);padding:6px 10px;margin:6px 0;border-radius:0 6px 6px 0}
.res .issue.inc{border-left-color:var(--warn);background:rgba(217,138,0,.08)}
.res .issue b{display:block}
.res table{border-collapse:collapse;margin:6px 0 12px}
.res td{padding:3px 14px 3px 0}
.res h4{margin:14px 0 4px}
@media (max-width:1250px){
  .layout{grid-template-columns:1fr;height:auto}
  .col-left,.col-mid,.col-right{overflow:visible}
  .col-mid{min-height:520px}
  .host-grid{grid-template-columns:1fr}
  .host-form{border-right:0;border-bottom:1px solid var(--line)}
}

.addr{margin-top:4px}
.addr h2{font-size:15px;margin:10px 0 6px}
.addr table{width:100%;border-collapse:collapse;font-size:11px}
.addr th{text-align:left;color:var(--muted);font-weight:600;padding:3px 4px;border-bottom:2px solid var(--line)}
.addr td{padding:3px 4px;border-bottom:1px solid var(--line);font-family:Consolas,"Cascadia Mono",monospace;white-space:nowrap}
.addr tr.first td{border-top:2px solid var(--line)}
.addr td:first-child{font-family:inherit;font-weight:600}

.splitter{cursor:col-resize;background:var(--line);border-radius:3px;margin:0 -3px;position:relative;touch-action:none}
.splitter::after{content:"";position:absolute;inset:0 -6px}
.splitter:hover,.splitter.drag,.splitter:focus-visible{background:var(--brand);outline:none}
body.resizing{cursor:col-resize;user-select:none}
@media (max-width:1250px){.splitter{display:none}}

.task li strong{font-weight:700;color:var(--ink)}

.res .fixall{margin:4px 0 6px;font-size:12px;padding:4px 10px}
.res details.fix{margin-top:6px}
.res details.fix summary{cursor:pointer;color:var(--brand);font-weight:600;font-size:13px}
.res .fixbody{margin-top:4px}
.res .fixbody pre{background:var(--term-bg);color:var(--term-ink);padding:8px 10px;border-radius:6px;margin:4px 0;font:12.5px/1.4 Consolas,"Cascadia Mono",monospace;white-space:pre-wrap}
.res .fixbody b{display:inline}
