/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e7eaef;
  --border: #e1e4ea;
  --border-strong: #cdd2da;
  --text: #171a1f;
  --text-2: #525a67;
  --text-3: #858c99;
  --accent: #1f6feb;
  --accent-text: #1a5fcc;
  --accent-soft: rgba(31, 111, 235, .09);
  --ok: #1a7f37; --ok-soft: rgba(26, 127, 55, .12);
  --bad: #cf222e; --bad-soft: rgba(207, 34, 46, .11);
  --warn: #9a6700; --warn-soft: rgba(212, 167, 44, .18);
  --chip: #eef1f5; --chip-border: #dde2e9;
  --x-tag: #8250df; --x-name: #0a6ebd; --x-val: #116329; --x-attr: #953800;
  --shadow: 0 10px 30px rgba(20, 25, 35, .12), 0 2px 6px rgba(20, 25, 35, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --top: 52px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1116; --surface: #151a21; --surface-2: #1b212a; --surface-3: #232a35;
    --border: #262d38; --border-strong: #353e4b;
    --text: #e4e7ec; --text-2: #a3abb8; --text-3: #6d7584;
    --accent: #4c8dff; --accent-text: #7eaeff; --accent-soft: rgba(76, 141, 255, .14);
    --ok: #4ac26b; --ok-soft: rgba(74, 194, 107, .14);
    --bad: #ff6b6b; --bad-soft: rgba(255, 107, 107, .14);
    --warn: #e3b341; --warn-soft: rgba(227, 179, 65, .15);
    --chip: #1f2631; --chip-border: #2c3542;
    --x-tag: #c297ff; --x-name: #79c0ff; --x-val: #7ee2a8; --x-attr: #ffa657;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116; --surface: #151a21; --surface-2: #1b212a; --surface-3: #232a35;
  --border: #262d38; --border-strong: #353e4b;
  --text: #e4e7ec; --text-2: #a3abb8; --text-3: #6d7584;
  --accent: #4c8dff; --accent-text: #7eaeff; --accent-soft: rgba(76, 141, 255, .14);
  --ok: #4ac26b; --ok-soft: rgba(74, 194, 107, .14);
  --bad: #ff6b6b; --bad-soft: rgba(255, 107, 107, .14);
  --warn: #e3b341; --warn-soft: rgba(227, 179, 65, .15);
  --chip: #1f2631; --chip-border: #2c3542;
  --x-tag: #c297ff; --x-name: #79c0ff; --x-val: #7ee2a8; --x-attr: #ffa657;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  display: grid; grid-template-rows: var(--top) 1fr; overflow: hidden;
}
[hidden] { display: none !important; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.small { font-size: 11.5px; }
button, input, select { font: inherit; color: inherit; }
svg { flex: none; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); font-weight: 500; }
.btn-ghost:hover { background: var(--surface-2); filter: none; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 6px;
  border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 16px; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
input[type=search], input[type=text], select {
  height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); padding: 0 10px; outline: none;
}
input[type=search]:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 0 14px; min-width: 0;
  background: var(--surface); border-bottom: 1px solid var(--border); z-index: 35; position: relative;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 14px; white-space: nowrap; }
.brand svg { width: 24px; height: 24px; }
.spacer { flex: 1; }
.file-info { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 12px; border-left: 1px solid var(--border); }
.fi-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-text); }
.fi-type.pano { background: rgba(130, 80, 223, .13); color: var(--x-tag); }
.fi-type.forti { background: rgba(218, 41, 28, .12); color: #c4261a; }
:root[data-theme="dark"] .fi-type.forti { color: #ff7b72; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fi-type.forti { color: #ff7b72; } }
.fi-host { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.fi-ver { color: var(--text-3); white-space: nowrap; }
.ctx { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12px; }
.ctx select { max-width: 260px; font-weight: 550; color: var(--text); }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg, .filter svg { position: absolute; left: 9px; width: 15px; height: 15px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.search-wrap input { width: 280px; padding-left: 30px; }
.search-results {
  position: absolute; top: 36px; right: 0; width: min(560px, 92vw); max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; z-index: 40;
}
.search-results a { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 5px; color: var(--text); }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.gs-what { color: var(--text-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.gs-scope { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.gs-empty { padding: 12px; color: var(--text-3); }
body:not(.loaded) .when-loaded { display: none !important; }
.only-mobile { display: none; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 228px 1fr; min-height: 0; }
body:not(.loaded) .layout { grid-template-columns: 1fr; }
body:not(.loaded) #sidebar { display: none; }
#sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
#nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.nav-group { margin-bottom: 12px; }
.nav-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 6px 10px 4px; }
.nav-i { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 6px; color: var(--text-2); }
.nav-i:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-i.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-i.nav-empty { opacity: .55; }
.nav-n { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-i.active .nav-n { color: var(--accent-text); }
.nav-foot { border-top: 1px solid var(--border); padding: 10px 14px; }

#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; padding: 16px 20px 0; }
.sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head h2 { font-size: 19px; font-weight: 650; }
.count { color: var(--text-3); font-variant-numeric: tabular-nums; }
.scope-pill { margin-left: auto; font-size: 11.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.sec-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.filter { position: relative; display: flex; align-items: center; }
.filter input { width: 260px; padding-left: 30px; }
.iplookup { display: flex; align-items: center; gap: 6px; }
.iplookup input[type=search] { width: 170px; font-family: var(--mono); font-size: 12px; }
.chk-inline { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.toggles { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--text-2); font-size: 12px; user-select: none; white-space: nowrap; }
.switch input { appearance: none; width: 28px; height: 16px; border-radius: 999px; background: var(--border-strong); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(12px); }
.note { margin: -4px 0 10px; color: var(--text-3); font-size: 12px; }
.sec-body { flex: 1; overflow: auto; padding-bottom: 24px; min-height: 0; }
.empty { padding: 40px; text-align: center; color: var(--text-3); }

/* ---------- tables ---------- */
.table-wrap { flex: 1; min-height: 0; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px 8px 0 0; border-bottom: 0; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.grid th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-2);
  text-align: left; font-weight: 600; font-size: 11.5px; padding: 7px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
}
.grid th:hover { color: var(--text); }
.grid th.sorted { color: var(--accent-text); }
.grid td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; max-width: 340px; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--accent-soft); }
.grid tbody tr.sel td { background: var(--accent-soft); box-shadow: inset 0 0 0 0 var(--accent); }
.grid tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.grid tr.grp td { background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; padding: 5px 10px; position: sticky; top: 31px; z-index: 1; cursor: default; }
.grid tr.row-disabled td { color: var(--text-3); }
.grid tr.row-disabled td > * { opacity: .55; }
.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-3); width: 1%; }
.grid td.nowrap { white-space: nowrap; }
.grid td.small { font-size: 11.5px; color: var(--text-2); }
.grid td.wrap { white-space: normal; word-break: break-word; }
.grid td.desc { color: var(--text-2); max-width: 300px; }
.grid td.name { min-width: 160px; }
.grid.rules td.name { min-width: 190px; }
.oname { font-weight: 600; }
.oname.sub { font-weight: 500; padding-left: 14px; color: var(--text-2); }
.rname { font-weight: 600; word-break: break-word; }
.rmeta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.rdesc { color: var(--text-3); font-size: 11.5px; margin-top: 2px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more { padding: 12px; text-align: center; }
.kv { white-space: nowrap; }
.err { color: var(--bad); }

/* chips & badges */
.cell-list { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 260px; padding: 0 7px; line-height: 19px;
  border-radius: 4px; background: var(--chip); border: 1px solid var(--chip-border); color: var(--text);
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
a.chip:hover, .chip[data-kind]:hover { border-color: var(--accent); color: var(--accent-text); text-decoration: none; }
.chip-group { box-shadow: inset 3px 0 0 var(--accent); padding-left: 9px; }
.chip-any { background: transparent; border-style: dashed; color: var(--text-3); font-style: italic; cursor: default; }
.chip-predef { background: transparent; border-style: dashed; }
.chip-literal { font-family: var(--mono); font-size: 11.5px; }
.chip-plain { font-family: var(--mono); font-size: 11.5px; cursor: default; }
.chip-prof { cursor: default; font-size: 11.5px; }
.chip-prof b { color: var(--text-3); font-weight: 650; font-size: 10.5px; }
.chip-tag { background: color-mix(in srgb, var(--tag) 20%, var(--surface)); border-color: color-mix(in srgb, var(--tag) 60%, var(--surface)); }
.chip-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tag); flex: none; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--tag); vertical-align: -1px; margin-right: 4px; border: 1px solid rgba(0,0,0,.15); }
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 650; line-height: 16px; padding: 0 6px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; letter-spacing: .01em;
}
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-dis { background: var(--surface-3); color: var(--text-3); text-transform: uppercase; font-size: 9.5px; }
.b-neg { background: var(--bad); color: #fff; font-size: 9.5px; }
.b-pos { background: rgba(130, 80, 223, .14); color: var(--x-tag); text-transform: uppercase; font-size: 9.5px; }
.b-loc { background: var(--surface-3); color: var(--text-2); font-weight: 550; }
.b-loc-own { background: var(--accent-soft); color: var(--accent-text); font-weight: 550; }
.b-soft { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); font-weight: 550; }

/* ---------- overview ---------- */
.ov-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.card h3 { font-size: 13.5px; margin-bottom: 12px; font-weight: 650; }
.ov-kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.ov-kv:last-child { border-bottom: 0; }
.ov-kv span { color: var(--text-3); }
.ov-kv b { font-weight: 550; word-break: break-word; }
.ov-group { margin-bottom: 14px; }
.ov-group h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin-bottom: 8px; }
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ov-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; text-align: left; }
.ov-tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.ov-n { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ov-l { font-size: 11.5px; color: var(--text-2); }
.checks { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chk { padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); border-left-width: 3px; background: var(--surface-2); }
.chk-bad { border-left-color: var(--bad); }
.chk-warn { border-left-color: var(--warn); }
.chk-info { border-left-color: var(--accent); }
.chk b { font-weight: 600; }
.chk-n { display: inline-block; min-width: 20px; text-align: center; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--surface-3); margin-left: 4px; }
.chk-d { margin-top: 4px; color: var(--text-2); font-size: 12px; line-height: 1.6; }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: var(--top); right: 0; bottom: 0; width: min(580px, 100vw); z-index: 30;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: slide .16s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.dr-head { display: flex; align-items: flex-start; gap: 8px; padding: 14px 14px 10px 18px; }
.dr-titles { flex: 1; min-width: 0; }
.dr-kind { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.dr-title { font-size: 17px; font-weight: 650; word-break: break-word; }
.dr-sub { color: var(--text-3); font-size: 12px; }
.dr-tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.dr-tabs:empty { display: none; }
.tab { border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.dr-body { flex: 1; overflow: auto; padding: 14px 18px 28px; }
.dr-body h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 18px 0 8px; }
.fgrid { display: grid; grid-template-columns: 120px 1fr; gap: 0; }
.f { display: contents; }
.fl { color: var(--text-3); padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.fv { padding: 5px 0 5px 8px; border-bottom: 1px solid var(--border); min-width: 0; word-break: break-word; }
.fv .cell-list { flex-direction: row; flex-wrap: wrap; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 16px; border-left: 1px dashed var(--border-strong); margin-left: 6px; }
.tree li { padding: 2px 0; }
.tree .tv { color: var(--text-2); margin-left: 4px; }
.kvt { width: 100%; border-collapse: collapse; font-size: 12px; }
.kvt td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; word-break: break-word; }
.kvt td:first-child { color: var(--text-2); width: 45%; }
.wu { list-style: none; padding: 0; margin: 0; }
.wu li { display: flex; flex-direction: column; padding: 5px 0; border-bottom: 1px solid var(--border); }
.wu a { color: var(--text); }
.wu a:hover { color: var(--accent-text); }
.xpath { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.xpath code { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; word-break: break-all; font-size: 11.5px; }
.code-tools { display: flex; justify-content: flex-end; margin-bottom: 6px; }
pre.code { margin: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font: 12px/1.55 var(--mono); overflow: auto; white-space: pre; }
.xml .xt { color: var(--x-tag); }
.xml .xa, .xtree .xa { color: var(--x-attr); }
.xml .xv, .xtree .xv { color: var(--x-name); }
.xs { color: var(--text-3); }

/* ---------- XML explorer ---------- */
.raw { display: flex; flex-direction: column; overflow: hidden; }
.raw-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.raw-tools .filter input { width: 340px; }
.raw-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
.raw-split:has(.raw-results:not([hidden])) { grid-template-columns: 1fr minmax(260px, 380px); }
.xtree, .raw-results { overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 6px; font: 12.5px/1.6 var(--mono); }
.xkids { padding-left: 16px; border-left: 1px solid var(--border); margin-left: 7px; }
.xrow { display: flex; align-items: baseline; gap: 5px; padding: 0 6px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.xrow:hover { background: var(--accent-soft); }
.xrow.hl { background: var(--warn-soft); box-shadow: inset 2px 0 0 var(--warn); }
.tw { width: 12px; color: var(--text-3); flex: none; }
.xtree .xt { color: var(--x-tag); }
.xname { color: var(--x-name); font-weight: 600; }
.xval { color: var(--x-val); overflow: hidden; text-overflow: ellipsis; }
.xcount { font-size: 10.5px; color: var(--text-3); background: var(--surface-2); border-radius: 999px; padding: 0 6px; }
.xinfo { margin-left: 6px; border: 0; background: none; color: var(--text-3); cursor: pointer; opacity: 0; padding: 0 4px; }
.xrow:hover .xinfo { opacity: 1; }
.xinfo:hover { color: var(--accent-text); }
.xmore { margin: 4px 0 4px 18px; height: 24px; font-size: 12px; }
.raw-results { font-family: var(--font); padding: 4px; }
.raw-results a { display: flex; flex-direction: column; padding: 5px 8px; border-radius: 5px; color: var(--text); }
.raw-results a:hover { background: var(--accent-soft); text-decoration: none; }
.rp { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rn { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- landing ---------- */
.landing { overflow: auto; padding: 5vh 8px 40px; }
.hero { max-width: 720px; margin: 0 auto; text-align: center; }
.hero h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; }
.lead { color: var(--text-2); font-size: 15px; margin: 0 auto 26px; max-width: 600px; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 38px 20px; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: 14px; background: var(--surface); transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 44px; height: 44px; fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.drop b { font-size: 15px; }
.samples { margin-top: 16px; color: var(--text-3); display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.features { max-width: 980px; margin: 44px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.features > div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.features h3 { font-size: 13.5px; margin-bottom: 6px; }
.features p { margin: 0; color: var(--text-2); font-size: 12.5px; }
.how { text-align: center; margin-top: 26px; }

/* ---------- overlays ---------- */
.drop-overlay { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
.drop-overlay div { padding: 24px 34px; border-radius: 12px; background: var(--surface); border: 2px dashed var(--accent); font-size: 16px; font-weight: 600; box-shadow: var(--shadow); }
body.dragging .drop-overlay { display: grid; }
.busy { position: fixed; inset: 0; z-index: 70; display: grid; place-content: center; justify-items: center; gap: 12px; background: color-mix(in srgb, var(--bg) 70%, transparent); font-weight: 550; color: var(--text-2); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; max-width: min(640px, 92vw); padding: 12px 16px; border-radius: 8px; background: var(--bad); color: #fff; box-shadow: var(--shadow); font-weight: 550; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .search-wrap input { width: 200px; }
  .fi-ver { display: none; }
  .ov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .only-mobile { display: inline-grid; }
  .brand span, .file-info, .ctx > span { display: none; }
  .topbar { gap: 8px; padding: 0 10px; }
  .ctx select { max-width: 130px; }
  .search-wrap input { width: 130px; }
  #openBtn { padding: 0 10px; }
  .layout { grid-template-columns: 1fr; }
  #sidebar { position: fixed; top: var(--top); bottom: 0; left: 0; width: 250px; z-index: 25; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow); }
  body.nav-open #sidebar { transform: none; }
  #main { padding: 12px 12px 0; }
  .filter, .filter input, .raw-tools .filter input { width: 100%; }
  .sec-tools > * { flex: 1 1 auto; }
  .toggles { margin-left: 0; flex-wrap: wrap; }
  .iplookup { flex-wrap: wrap; }
  .raw-split:has(.raw-results:not([hidden])) { grid-template-columns: 1fr; grid-template-rows: 1fr 40%; }
  .hero h1 { font-size: 24px; }
}
@media (max-width: 480px) {
  .search-wrap { display: none; }
  .fgrid { grid-template-columns: 96px 1fr; }
}

/* ---------- tools: FortiGate wizard ---------- */
.wiz { max-width: 1400px; display: flex; flex-direction: column; gap: 16px; }
.wiz-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.wiz-steps li { flex: 1 1 160px; }
.wiz-steps button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 550; color: var(--text-2); text-align: left; }
.wiz-steps .active button { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.wiz-steps .done button { color: var(--text); }
.wiz-n { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); flex: none; }
.wiz-steps .active .wiz-n { background: var(--accent); color: #fff; }
.wiz-steps .done .wiz-n { background: var(--ok-soft); color: var(--ok); }
.wiz-body { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.wiz-nav { display: flex; justify-content: space-between; }
.lead-s { margin: 0; color: var(--text-2); max-width: 900px; }
.wiz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.wiz-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wiz-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wiz-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wiz-field > span:first-child { font-size: 12px; font-weight: 600; color: var(--text-2); }
.wiz-field.inline { flex-direction: row; align-items: center; gap: 8px; }
.wiz-field input[type=text], .wiz-field input[type=number] { height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); padding: 0 10px; outline: none; }
.wiz-field input[type=number] { width: 90px; }
.wiz-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wiz-h { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 6px 0 0; }
.wiz-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.wiz-stat { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.wiz-stat b { font-size: 19px; font-variant-numeric: tabular-nums; }
.wiz-stat span { font-size: 11.5px; color: var(--text-2); }
.wiz-table { max-height: 56vh; border-radius: 8px; border-bottom: 1px solid var(--border); }
.wiz-table input { width: 150px; height: 26px; font-family: var(--mono); font-size: 12px; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); padding: 0 8px; }
.wiz-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.wiz fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wiz legend { font-weight: 650; font-size: 12.5px; padding: 0 6px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.wiz-radio { display: flex; gap: 9px; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.wiz-radio.on { border-color: var(--accent); background: var(--accent-soft); }
.wiz-radio input { margin-top: 3px; accent-color: var(--accent); }
.wiz-radio > span { display: flex; flex-direction: column; gap: 2px; }
.wiz-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 14px; }
.wiz input[type=checkbox] { accent-color: var(--accent); }
.wiz-sum { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wiz-sum .spacer { flex: 1; }
.sev { display: inline-flex; gap: 6px; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12px; color: var(--text-2); }
.sev.on { border-color: var(--text-2); background: var(--surface-2); color: var(--text); }
.sev-error b { color: var(--bad); } .sev-warn b { color: var(--warn); } .sev-info b { color: var(--accent-text); }
.sevdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.sevdot.sev-error { background: var(--bad); } .sevdot.sev-warn { background: var(--warn); } .sevdot.sev-info { background: var(--accent); }
.wiz-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; min-height: 0; }
.wiz-warn { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.wiz-warn table td { max-width: none; }
.wiz-code { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wiz-code pre { max-height: 62vh; }
.hl-k { color: var(--x-tag); font-weight: 600; } .hl-a { color: var(--x-name); } .hl-c { color: var(--text-3); font-style: italic; } .hl-x { background: var(--bad-soft); color: var(--bad); }

/* ---------- tools: network plan ---------- */
.np-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.np-tools .spacer { flex: 1; }
.np-canvas { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: auto; padding: 4px; }
.np-canvas svg { display: block; width: 100%; height: auto; min-width: 900px; }
.np-h { font-size: 14px; margin: 22px 0 10px; }
.np-table { border-radius: 8px; border-bottom: 1px solid var(--border); flex: none; max-height: none; }
.np-table td { max-width: none; }

@media (max-width: 1100px) { .wiz-split { grid-template-columns: 1fr; } .wiz-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .wiz-grid, .wiz-grid.three { grid-template-columns: 1fr; } }

@media print {
  body { display: block; overflow: visible; height: auto; background: #fff; }
  .topbar, #sidebar, .sec-head, .np-tools, .drawer, .toast { display: none !important; }
  .layout { display: block; }
  #main, .sec-body { overflow: visible; padding: 0; height: auto; }
  .np-canvas { border: 0; padding: 0; }
  .np-canvas svg { min-width: 0; }
  .np-table { overflow: visible; }
  .np-h { break-after: avoid; }
  .np-tables { break-before: page; }
}

/* ---------- network plan: flow highlighting ---------- */
.np-canvas { position: relative; }
.np-canvas svg .flow, .np-canvas svg .fnode { cursor: pointer; }
.np-canvas svg .flow { transition: opacity .12s; }
.np-canvas svg.focus .flow:not(.on) { opacity: .06; }
.np-canvas svg .flow.on .fl { stroke-opacity: 1; }
.np-canvas svg .fnode.on rect:first-child { stroke: var(--accent); stroke-width: 2; }
.np-canvas svg .fnode:hover rect:first-child { stroke: var(--accent); }
.np-tip {
  position: absolute; z-index: 5; width: min(420px, 90%); max-height: 360px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 12.5px;
}
.np-tip-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 650; font-size: 13.5px; }
.np-tip-h .icon-btn { width: 26px; height: 26px; font-size: 13px; }
.np-tip-meta { margin: 4px 0 8px; color: var(--text-2); font-size: 12px; }
.np-tip-dl { display: grid; grid-template-columns: 92px 1fr; gap: 3px 8px; margin: 0 0 10px; }
.np-tip-dl dt { color: var(--text-3); }
.np-tip-dl dd { margin: 0; word-break: break-word; }
.np-tip-rules { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.np-tip-rule { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.np-tip-rule a { flex: 1; min-width: 0; font-weight: 550; word-break: break-word; }
.np-tip-rule.deny a { color: var(--bad); }
.np-tip-rule .btn { height: 22px; padding: 0 8px; font-size: 11px; }
.np-tables tr:has([data-flow-row]) { cursor: pointer; }
@media print { .np-tip { display: none !important; } }
.np-tip:not(.pinned) { pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.14); }
.np-tip:not(.pinned) .icon-btn, .np-tip:not(.pinned) .np-tip-rule .btn { visibility: hidden; }
.np-tip.pinned { border-color: var(--accent); }
.np-tip-hint { float: right; font-size: 11px; color: var(--text-3); }
.np-tip.pinned .np-tip-hint { display: none; }
.fi-select { max-width: 280px; font-weight: 600; }
.fi-close { width: 26px; height: 26px; font-size: 12px; }
@media (max-width: 820px) { #addBtn { display: none; } }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 12px; cursor: pointer; font-weight: 550; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--accent-soft); color: var(--accent-text); }
.np-sites { display: flex; gap: 12px; flex-wrap: wrap; }
.np-hint { margin: -4px 0 8px; }
.np-canvas svg [data-asset] { cursor: pointer; }
.np-canvas svg g[data-asset]:hover > rect:first-child { stroke: var(--accent); stroke-width: 1.5; }
.np-canvas svg .np-a:hover { text-decoration: underline; fill: var(--accent-text); }
.np-canvas svg .slink { cursor: pointer; transition: opacity .12s; }
.np-canvas svg.focus-l .slink:not(.on) { opacity: .1; }
.np-canvas svg .slink.on .fl { stroke-width: 4; }
.np-tables tr[data-asset], .np-tables tr:has([data-link-row]) { cursor: pointer; }
.dr-file { font-weight: 600; color: var(--accent-text); }
.np-deny { color: var(--bad) !important; }

/* ---------- table filters ---------- */
.tt-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; flex-wrap: wrap; }
.tt-bar .filter input { width: 240px; height: 28px; }
.tt-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tt-clear { height: 26px; font-size: 12px; padding: 0 10px; }
.grid thead tr:first-child th { height: 31px; }
.grid thead tr.tt-cols th { top: 31px; padding: 3px 6px 5px; cursor: default; background: var(--surface-2); }
.grid thead tr.tt-cols input { width: 100%; min-width: 60px; height: 24px; font-size: 11.5px; padding: 0 6px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); font-weight: 400; color: var(--text); }
.grid thead tr.tt-cols input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.grid tr.grp td { top: 62px; }
.grid tr.tt-none td { text-align: center; color: var(--text-3); padding: 24px; cursor: default; }
.grid th.tt-sortable { cursor: pointer; }
.grid th.tt-sortable.sorted { color: var(--accent-text); }
.np-more summary { cursor: pointer; color: var(--accent-text); font-size: 11.5px; margin-top: 2px; }
.kvt-wrap { margin-bottom: 4px; }
.wiz-warn { max-height: none; overflow: visible; border: 0; }
.wiz-rep { max-height: 56vh; border-radius: 8px; border-bottom: 1px solid var(--border); }
.wiz-warn .wiz-h { margin-top: 0; }

/* ---------- tools: IP list ---------- */
.ipr-app { max-width: 1400px; }
.ipr-site { margin-bottom: 36px; }
.ipr-h2 { font-size: 18px; margin: 8px 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--text); }
.ipr-h3 { font-size: 14px; margin: 22px 0 8px; }
.ipr-h4 { font-size: 13px; margin: 14px 0 6px; cursor: pointer; }
.ipr-sub { font-weight: 400; color: var(--text-3); font-size: 12px; }
.ipr-facts { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ipr-facts div { display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); min-width: 110px; }
.ipr-facts b { font-size: 18px; } .ipr-facts span { font-size: 11.5px; color: var(--text-2); }
.ipr-net { margin-top: 18px; padding-left: 12px; border-left: 4px solid var(--zc, var(--border-strong)); }
.ipr-neth { margin-top: 0; }
.ipr-zone { display: inline-block; background: var(--zc, #8b949e); color: #fff; border-radius: 5px; padding: 1px 8px; font-size: 11.5px; vertical-align: 1px; }
.ipr-kv { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0 0 10px; font-size: 12.5px; }
.ipr-kv div { display: flex; gap: 6px; align-items: center; } .ipr-kv dt { color: var(--text-3); } .ipr-kv dd { margin: 0; font-weight: 600; }
.ipr-bar { display: inline-block; width: 70px; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-left: 4px; }
.ipr-bar i { display: block; height: 100%; background: var(--zc, var(--accent)); }
.ipr-tw { border-radius: 8px; border-bottom: 1px solid var(--border); flex: none; max-height: none; margin-bottom: 4px; }
.ipr-t td { max-width: none; }
.ipr-t tbody tr[data-asset] { cursor: pointer; }
.ipr-ip { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.ipr-mono { font-family: var(--mono); font-size: 13px; }
.ipr-ipw { font-family: var(--mono); font-size: 12px; }
.ipr-name { font-weight: 600; min-width: 150px; } .ipr-notes { color: var(--text-2); } .ipr-small { font-size: 11.5px; } .ipr-nowrap { white-space: nowrap; }
.ipr-kind { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; line-height: 18px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.ipr-kind.k-gw { background: var(--text); color: var(--surface); } .ipr-kind.k-net { background: var(--accent-soft); color: var(--accent-text); }
.ipr-kind.k-dhcp { background: var(--ok-soft); color: var(--ok); } .ipr-kind.k-range { background: var(--warn-soft); color: var(--warn); } .ipr-kind.k-route { background: rgba(130, 80, 223, .14); color: var(--x-tag); }
.ipr-flag { display: inline-block; font-size: 10px; font-weight: 700; color: var(--bad); border: 1px solid var(--bad); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.ipr-flag.ipr-muted { color: var(--text-3); border-color: var(--border-strong); font-weight: 600; }
.ipr-tag, .ipr-grp { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); margin: 0 3px 3px 0; }
.ipr-grp { background: var(--surface-2); }
.ipr-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--zc); margin-right: 6px; vertical-align: -1px; }
.ipr-routed { border-left-color: var(--border-strong); }

.ipr-fixed { table-layout: fixed; } .ipr-fixed .ipr-name { min-width: 0; } .ipr-fixed td { overflow-wrap: anywhere; } .ipr-fixed td.ipr-ip { white-space: normal; }
.ipr-site-c b { display: block; font-weight: 600; font-size: 12px; } .ipr-loc { display: block; font-size: 11px; color: var(--text-3); }
