:root, [data-theme="mikrotik"] {
  --bg: #121820;
  --bg-elev: #1b2330;
  --surface: #1c2636;
  --surface-2: #232e41;
  --sidebar: #161d28;
  --text: #e8edf4;
  --muted: #8b97a8;
  --border: #2a3548;
  --accent: #d21920;
  --accent-2: #ff4a4a;
  --ok: #3dba7a;
  --warn: #e6b325;
  --danger: #ef5350;
  --info: #5aa7e6;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
  --radius: 8px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

[data-theme="mikrotik-light"] {
  --bg: #eef1f5;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --sidebar: #1b2330;
  --text: #1a2230;
  --muted: #5c6b7e;
  --border: #d5dde8;
  --accent: #c41218;
  --accent-2: #e02424;
  --ok: #1f8a54;
  --warn: #b8860b;
  --danger: #c62828;
  --info: #1565c0;
  --shadow: 0 8px 24px rgba(20,28,40,.08);
}

[data-theme="midnight"] {
  --bg: #07090d;
  --bg-elev: #0e1218;
  --surface: #121821;
  --surface-2: #181f2a;
  --sidebar: #0a0d12;
  --text: #f2f5f8;
  --muted: #7d8b9c;
  --border: #243044;
  --accent: #2fd3e0;
  --accent-2: #7aeff7;
  --ok: #3dba7a;
  --warn: #e6b325;
  --danger: #ff6b6b;
  --info: #2fd3e0;
}

[data-theme="high-contrast"] {
  --bg: #000;
  --bg-elev: #111;
  --surface: #111;
  --surface-2: #1a1a1a;
  --sidebar: #000;
  --text: #fff;
  --muted: #c8c8c8;
  --border: #fff;
  --accent: #ff2020;
  --accent-2: #ff6a6a;
  --ok: #2dff8a;
  --warn: #ffe14a;
  --danger: #ff4d4d;
  --info: #7ecbff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); }
a { color: inherit; }
a:hover { color: var(--accent-2); }
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--sidebar); color: #e8edf4;
  display: flex; flex-direction: column; border-right: 1px solid #0006;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; background: var(--accent);
  clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%);
  box-shadow: 0 0 0 2px #0002;
}
.brand-text { font-weight: 700; letter-spacing: .02em; font-size: 15px; }
.brand-text span { color: var(--accent-2); font-weight: 600; }
.sidebar nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.sidebar nav a {
  text-decoration: none; padding: 8px 10px; border-radius: 6px; color: #c5cedb;
}
.sidebar nav a.active {
  background: #ffffff10; color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar nav a:hover { background: #ffffff0c; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: #7d8a9c; padding: 14px 10px 4px; }
.theme-dock { padding: 12px 14px 18px; border-top: 1px solid #ffffff12; }
.theme-dock label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: #7d8a9c; margin-bottom: 6px; }
.theme-dock select, select, input:not([type="checkbox"]):not([type="radio"]), textarea, button {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
}
input[type="checkbox"], input[type="radio"] {
  appearance: auto;
  width: 14px; height: 14px; min-width: 14px; min-height: 14px;
  margin: 0; padding: 0; flex-shrink: 0;
  background: none; border: none; border-radius: 0;
  accent-color: var(--accent);
}
.theme-dock select { width: 100%; padding: 6px 8px; color: #e8edf4; background: #0f141c; }
.app-ver { padding: 0 14px 16px; font-size: 11px; color: #7d8a9c; font-family: var(--mono); }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--bg-elev);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { margin: 0; font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); }
.content { padding: 20px 22px 40px; }
.flash { background: #d2192020; border: 1px solid #d2192066; padding: 10px 12px; border-radius: var(--radius); margin-bottom: 16px; white-space: pre-wrap; }
.flash.bad { background: #ef535018; border-color: #ef535066; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-n { font-size: 26px; font-weight: 650; letter-spacing: -.03em; }
.kpi-l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.ok .kpi-n { color: var(--ok); }
.kpi.warn .kpi-n { color: var(--warn); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush table { margin: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-h.tight { margin: 18px 0 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.panel-h h2 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.narrow { max-width: 560px; }
.lede, .empty, .muted { color: var(--muted); }
.empty { padding: 18px; }

table { width: 100%; border-collapse: collapse; }
.dense th, .dense td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dense th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
.dense th.sortable { white-space: nowrap; }
.dense th.sortable a { color: inherit; text-decoration: none; }
.dense th.sortable a:hover { color: var(--text); }
.dense th.is-sorted, .dense th.is-sorted a { color: var(--text); }
.dense th .sort-ind { font-size: 10px; letter-spacing: 0; }
.dense tr:hover td { background: #ffffff06; }
.mono { font-family: var(--mono); font-size: 12px; }
.chip {
  display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
}
.chip.managed, .chip.done, .chip.ok, .chip.up { color: var(--ok); border-color: #3dba7a55; }
.chip.ignored, .chip.disabled, .chip.applying { color: var(--muted); }
.chip.outdated, .chip.cve { color: var(--danger); border-color: #ef535055; }
.kpis a { color: inherit; text-decoration: none; }
.kpis a:hover { color: var(--accent); }
.chip.bad_credentials, .chip.failed, .chip.critical, .chip.high, .chip.danger, .chip.error { color: var(--danger); border-color: #ef535055; }
.chip.api_down, .chip.warn, .chip.medium, .chip.pending, .chip.running, .chip.waiting, .chip.canceled { color: var(--warn); border-color: #e6b32555; }
.chip.unreachable, .chip.no_ip, .chip.stale, .chip.low { color: var(--info); border-color: #5aa7e655; }
.chip.ai { color: var(--info); border-color: #5aa7e655; letter-spacing: .06em; }
.chip.builtin { color: var(--muted); }
.chip.health { color: var(--ok); border-color: #3dba7a55; }
.chip.inspect { color: var(--info); border-color: #5aa7e655; }
.chip.scheduled { color: var(--warn); border-color: #e6b32555; }
.tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px;
  border-radius: 999px; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 11px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.danger { color: var(--danger); border-color: #ef535055; }
.toolbar, .toolbar-inline, .page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-inline .toolbar-inline { margin: 0; }
.toolbar-inline select { padding: 6px 8px; min-width: 160px; }
.toolbar {
  flex-direction: column; align-items: stretch; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; border-radius: var(--radius);
}
.toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .search { flex: 1 1 240px; min-width: 200px; }
.toolbar input[type="text"],
.toolbar input[type="search"],
.toolbar input.search,
.toolbar input:not([type]),
.toolbar select { padding: 6px 8px; min-width: 140px; }
.ver-filter {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.ver-filter input { width: 110px; min-width: 110px; font-family: var(--mono); }
.agent-token { word-break: break-all; background: var(--surface-2); padding: 10px 12px; border-radius: 6px; }
.stable-note { font-size: 12px; white-space: nowrap; }
.filter-groups { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.filter-group { display: flex; gap: 14px; align-items: center; }
.filter-label {
  flex: 0 0 52px;
  font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.status-filters { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; width: 100%; }
.status-filters .check { font-size: 13px; margin: 0; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.device-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.device-name a { font-weight: 600; }
.stack-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ros-cell, .ros-line, .chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.nowrap { white-space: nowrap; }
a.chip { text-decoration: none; }
a.chip:hover { color: var(--accent-2); }
.check-col { width: 36px; text-align: center; }
.check-col .check { justify-content: center; }
.dense th.check-col, .dense td.check-col { padding-left: 10px; padding-right: 6px; }
.spacer { flex: 1; }
.form label { display: block; margin-bottom: 10px; color: var(--muted); }
.form label.check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text); }
.form input:not([type="checkbox"]):not([type="radio"]), .form select, .form textarea { width: 100%; padding: 7px 9px; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: 14px; margin: 0; }
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px 10px;
  margin: 12px 0 16px;
  min-width: 0;
}
legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.device-picks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(480px, 55vh);
  overflow: auto;
}
.device-picks .check {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 8px 8px;
  border-radius: 6px;
  gap: 10px;
}
.device-picks .check:hover { background: var(--surface-2); }
.device-picks .pick-name { color: var(--text); font-weight: 600; min-width: 8em; }
.device-picks .pick-meta { text-align: left; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.facts dd { margin: 2px 0 0; }
.status-banner { border: 1px solid var(--border); border-left: 4px solid var(--info); background: var(--surface); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.status-banner.managed { border-left-color: var(--ok); }
.status-banner.bad_credentials, .status-banner.api_down { border-left-color: var(--danger); }
.status-banner p { margin: 8px 0 0; }
.row-actions { white-space: nowrap; }
.log, .cmd { background: #0c1016; color: #d7e0ea; padding: 10px; border-radius: 6px; overflow: auto; font-family: var(--mono); font-size: 12px; border: 1px solid var(--border); white-space: pre-wrap; margin: 0; }
td .log { max-height: 240px; max-width: min(520px, 48vw); }
[data-theme="mikrotik-light"] .log, [data-theme="mikrotik-light"] .cmd { background: #f3f6fa; color: #1a2230; }
.findings { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.finding { border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 6px; padding: 10px 12px; background: var(--surface-2); }
.finding.critical, .finding.high { border-left-color: var(--danger); }
.finding.medium { border-left-color: var(--warn); }
.finding.low, .finding.info { border-left-color: var(--info); }
.finding.ai { background: color-mix(in srgb, var(--info) 9%, var(--surface-2)); }
.finding-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.finding p { margin: 8px 0; }

.login-body { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(1200px 500px at 10% -10%, #d2192033, transparent),
  radial-gradient(800px 400px at 100% 100%, #2a4a7a33, transparent), var(--bg); }
.login-card { width: min(360px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px 24px; box-shadow: var(--shadow); }
.login-card .brand { padding: 0 0 8px; }
.login-card label { display: block; margin: 12px 0; color: var(--muted); }
.login-card input { width: 100%; padding: 8px 10px; margin-top: 4px; }
.login-card .btn { width: 100%; margin-top: 8px; padding: 9px; }

.lockout {
  background: #e6b32518; border: 1px solid #e6b32566; color: var(--text);
  padding: 8px 10px; border-radius: 6px; margin: 8px 0;
}
.fix-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 8px; }
.fix-form label { margin: 0; }
.fix-form input[name="address"] { min-width: 160px; }
.working {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
}
.working > summary {
  display: flex; gap: 14px; align-items: flex-start; cursor: pointer; list-style: none;
}
.working > summary::-webkit-details-marker { display: none; }
.working > summary strong { display: inline; }
.working p { margin: 8px 0 0 36px; color: var(--muted); }
.working .activity-live { margin: 10px 0 0 36px; padding: 0; list-style: none; }
.working .activity-live li { padding: 4px 0; }
.working .toolbar-inline { margin: 12px 0 0 36px; }
.spinner {
  width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.job-status-wrap {
  position: relative;
  display: none;
  align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 6px 3px 8px; color: var(--muted); font-size: 12px;
}
.job-status-wrap.is-on { display: inline-flex; }
.job-status-wrap[hidden] { display: none !important; }
.job-status-wrap:has(details[open]) { border-color: var(--accent); }
.job-status { display: inline; }
.job-status-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: min(360px, 42vw); cursor: pointer; list-style: none;
}
.job-status-toggle::-webkit-details-marker { display: none; }
.job-status-toggle:hover { color: var(--text); }
#job-status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-status-caret { font-size: 10px; opacity: .7; }
details[open] > summary .job-status-caret { transform: rotate(180deg); display: inline-block; }
.job-status-x {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px;
}
.job-status-x:hover { color: var(--text); }
.job-status-panel {
  position: fixed; z-index: 40;
  width: min(380px, 88vw);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 8px;
  text-align: left; color: var(--text);
}
.job-status-panel-h {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 4px 8px 6px;
}
.job-status-panel ul { list-style: none; margin: 0; padding: 0; }
.job-status-panel li { border-top: 1px solid var(--border); }
.job-status-panel li:first-child { border-top: 0; }
.job-status-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  padding: 8px; border-radius: 6px; color: var(--text); text-decoration: none;
}
.job-status-item:hover { background: var(--surface-2); }
.job-status-item .label { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.job-status-item .label strong { font-weight: 600; }
.job-status-item .step { color: var(--muted); font-size: 12px; }
.job-status-item .state { flex-shrink: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.job-status-item .btn { flex-shrink: 0; }
.job-status-empty { color: var(--muted); padding: 8px; }
.spinner.small { width: 12px; height: 12px; margin: 0; }
#llm-status.ok { color: var(--ok); }
#llm-status.bad { color: var(--danger); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; flex-shrink: 0;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 4px;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.allowed-ips { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.allowed-summary { color: var(--muted); font-variant-numeric: tabular-nums; }
.sheet-dialog, .llm-prompt-dialog {
  width: min(520px, 94vw); max-height: 80vh; padding: 0;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow);
}
.llm-prompt-dialog { width: min(720px, 94vw); }
.sheet-dialog::backdrop, .llm-prompt-dialog::backdrop { background: #0008; }
.sheet-dialog header, .llm-prompt-dialog header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.sheet-dialog header strong, .llm-prompt-dialog header strong { flex: 0 0 auto; }
.sheet-dialog header .muted, .llm-prompt-dialog header .muted { flex: 1; }
.llm-prompt-dialog pre {
  margin: 0; max-height: calc(80vh - 52px); border: 0; border-radius: 0;
}
.allowed-list {
  margin: 0; padding: 10px 16px 14px; max-height: calc(80vh - 52px); overflow: auto;
  list-style: none;
}
.allowed-list li { padding: 2px 0; line-height: 1.45; }

.shortcut-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.device-mini { margin: 8px 0 0; padding-left: 18px; }
.device-mini li { margin: 2px 0; }
.facts.tight { margin: 8px 0; }
details.health-tip { position: relative; display: inline-block; }
details.health-tip > summary {
  list-style: none; cursor: pointer;
}
details.health-tip > summary::-webkit-details-marker { display: none; }
details.health-tip .health-tip-body {
  position: absolute; z-index: 40; min-width: 240px; max-width: 360px;
  left: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 10px 28px #00000066;
}
details.health-tip .health-tip-body p { margin: 0 0 8px; }
.status-banner details.health-tip { margin-left: 8px; }

.content:has(.map-page) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 16px;
}
.map-page { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 8px; }
.map-tabs { display: flex; gap: 6px; }
.map-tabs a {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  text-decoration: none; color: var(--muted); background: var(--surface);
}
.map-tabs a.active { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.map-toolbar { margin-bottom: 4px; }
.map-wrap {
  flex: 1;
  min-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.map-svg { width: 100%; height: 100%; display: block; cursor: grab; }
.map-svg.dragging { cursor: grabbing; }
.map-node circle, .map-node polygon {
  fill: var(--surface-2);
  stroke: var(--info);
  stroke-width: 2;
}
.map-node.seed circle { fill: color-mix(in srgb, var(--accent) 80%, #000); stroke: var(--accent-2); }
.map-node.internet .map-cloud {
  fill: color-mix(in srgb, var(--info) 22%, var(--surface));
  stroke: var(--muted);
  stroke-width: 2;
}
.map-node.unknown circle { stroke-dasharray: 3 3; stroke: var(--warn); }
.map-node-label { font: 12px var(--font); fill: var(--text); pointer-events: none; }
.map-node-ip { font: 10px var(--mono); fill: var(--muted); pointer-events: none; }
.map-edge { fill: none; stroke: var(--info); stroke-width: 2; }
.map-edge.directed { color: var(--info); }
.map-edge.active.rank0 { stroke: var(--ok); stroke-width: 2.5; stroke-dasharray: none; }
.map-edge.inactive, .map-edge.rank1 { stroke: var(--info); stroke-width: 1.7; stroke-dasharray: 7 5; opacity: .78; }
.map-edge.rank2 { stroke: var(--muted); stroke-width: 1.35; stroke-dasharray: 3 5; opacity: .55; }
.map-edge.rank3, .map-edge.rank4 { stroke: var(--muted); stroke-width: 1.1; stroke-dasharray: 2 6; opacity: .38; }
.map-legend {
  display: flex; flex-wrap: wrap; gap: 12px 18px;
  font-size: 12px; color: var(--muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-swatch {
  width: 22px; height: 0; border-top: 2px solid var(--info); display: inline-block;
}
.map-swatch.solid.preferred { border-color: var(--ok); border-top-width: 3px; }
.map-swatch.dashed { border-top-style: dashed; }
.map-swatch.dotted { border-top-style: dotted; opacity: .6; }
.map-swatch.node {
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--info);
  background: var(--surface-2); border-top: 2px solid var(--info);
}
.map-swatch.node.seed { background: var(--accent); border-color: var(--accent-2); }
.map-swatch.node.inet { border-radius: 6px 6px 4px 4px; background: color-mix(in srgb, var(--info) 30%, var(--surface)); border-color: var(--muted); }
.map-swatch.node.unknown { border-style: dashed; border-color: var(--warn); }

@media (max-width: 960px) {
  .kpis, .grid-2, .facts, .row2 { grid-template-columns: 1fr; }
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .map-wrap { min-height: 380px; }
}
