:root {
  --bg: #0f1318;
  --panel: #171d25;
  --panel-2: #1d2530;
  --raised: #232c39;
  --border: #2b3544;
  --text: #d8dee9;
  --muted: #8a96a8;
  --accent: #3fa7d6;
  --accent-2: #2b7fb0;
  --ok: #4caf7d;
  --bad: #e05d5d;
  --warn: #e8a33d;
  --row-hover: #222c3a;
  --radius: 5px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --shadow: 0 10px 30px #0009;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 13px/1.4 var(--font);
  display: flex; flex-direction: column; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 16px; height: 48px; flex: none;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.brand span { color: var(--accent); }
.brand.big { font-size: 28px; text-align: center; }
.tabs { display: flex; height: 100%; }
.tab {
  white-space: nowrap;
  display: flex; align-items: center; padding: 0 16px; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.status { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user { position: relative; }
.user #userBtn span:first-child { color: var(--ok); font-size: 10px; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 180px; padding: 4px 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-pop a, .menu-pop button {
  display: block; width: 100%; text-align: left; padding: 8px 14px; background: none; border: 0;
  color: var(--text); text-decoration: none; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--row-hover); }

/* ---------- filter bar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; flex: none;
  padding: 8px 16px; background: var(--panel-2); border-bottom: 1px solid var(--border);
}
body[data-view=rules] .toolbar, body[data-view=settings] .toolbar { display: none; }
.filterbar {
  flex: 1 1 480px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px;
}
.chips { display: contents; }
.chip {
  display: inline-flex; align-items: center; max-width: 440px;
  background: #1f3a52; border: 1px solid var(--accent-2); border-radius: 3px;
}
.chip.neg { background: #4a2626; border-color: #9c4040; }
.chip button { background: none; border: 0; cursor: pointer; color: inherit; }
.chip-body { display: inline-flex; gap: 6px; padding: 2px 4px 2px 8px; min-width: 0; }
.chip .k { color: #a9c3d8; white-space: nowrap; }
.chip.neg .k { color: #e3b0b0; }
.chip .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { padding: 0 6px; color: var(--muted) !important; }
.chip-x:hover { color: var(--text) !important; }
#search { flex: 1 1 160px; min-width: 120px; background: none; border: 0; outline: none; padding: 4px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ctl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ctl .date { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
body:not([data-view=live]) .ctl-live { display: none; }
body[data-view=live] .ctl-time { display: none; }

/* ---------- buttons and fields ---------- */
.btn {
  background: var(--panel); border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 10px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; gap: 4px;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.danger:hover { border-color: var(--bad); color: #f3a3a3; }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { border-color: var(--border); }
.btn.add { border-style: dashed; }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn.icon { padding: 2px 8px; }
.btn.link { background: none; border: 0; color: var(--accent); padding: 0; }
.btn.wide { width: 100%; justify-content: center; padding: 8px; }
.segmented { display: inline-flex; }
.segmented .btn { border-radius: 0; margin-left: -1px; }
.segmented .btn:first-child { border-radius: 3px 0 0 3px; margin-left: 0; }
.segmented .btn:last-child { border-radius: 0 3px 3px 0; }
.btn.toggle.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; position: relative; }
.kind-allowed.active { background: #2b6b4a !important; border-color: var(--ok) !important; }
.kind-blocked.active { background: #7a2e2e !important; border-color: var(--bad) !important; }
.kind-threat.active { background: #7a5520 !important; border-color: var(--warn) !important; }
select, input[type=datetime-local], input[type=search], input[type=text], input[type=password], input[type=number], input:not([type]) {
  background: var(--panel); border: 1px solid var(--border); border-radius: 3px; padding: 4px 6px;
}
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.count { color: var(--muted); font-size: 12px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.live-dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }

/* ---------- view layout ---------- */
main { flex: 1; display: flex; min-height: 0; }
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.subbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 16px;
  border-bottom: 1px solid var(--border); background: var(--panel); flex: none;
}
.subtabs { display: flex; gap: 2px; }
.subtab {
  background: none; border: 1px solid transparent; border-radius: 3px; padding: 4px 12px; cursor: pointer;
  color: var(--muted); text-decoration: none;
}
.subtab:hover { color: var(--text); background: var(--row-hover); }
.subtab.active { color: var(--text); background: var(--raised); border-color: var(--border); }
.split { flex: 1; display: flex; min-height: 0; }
.scroll { flex: 1; overflow: auto; }
.logs { flex: 1; overflow: auto; min-width: 0; }

/* ---------- log table ---------- */
.grid { border-collapse: collapse; font-size: 12.5px; }
.grid:not(.fixed) { width: 100%; }
.grid.fixed { table-layout: fixed; min-width: 100%; }
.grid th {
  position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-weight: 600;
  padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  user-select: none;
}
.grid th.filterable { cursor: pointer; }
.grid th.filterable:hover { background: var(--raised); color: #fff; }
.grid th.filterable:hover .th-label::after { content: " ⏷"; color: var(--accent); font-size: 10px; }
.grid th.drop-target { box-shadow: inset 3px 0 0 var(--accent); }
.grid th .resizer { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.grid th .resizer:hover { background: var(--accent-2); }
.grid.fixed th { position: sticky; }
.grid td {
  padding: 4px 8px; border-bottom: 1px solid #1d2530; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid:not(.fixed) td { max-width: 320px; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: var(--row-hover); }
.grid tbody tr.selected { background: #2a3d55; }
.grid tbody tr.disabled { opacity: .5; }
.fresh { animation: fresh 1.2s ease-out; }
@keyframes fresh { from { background: #24442f; } to { background: transparent; } }
.badge {
  display: inline-block; min-width: 54px; text-align: center; padding: 1px 6px; border-radius: 3px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge.ok { background: #1f4630; color: #8fe0b0; }
.badge.bad { background: #4f2323; color: #f3a3a3; }
.badge.warn { background: #4d3814; color: #f5cf8f; }
.badge.other { background: #3a3a3a; color: #ccc; }
.badge.event { background: #2b3544; color: var(--muted); }
.tag { margin-left: 6px; padding: 0 5px; border: 1px solid var(--border); border-radius: 3px; font-size: 10px; color: var(--muted); }

.raw { font-family: var(--mono); font-size: 12px; padding: 8px 12px; }
.raw div { white-space: pre-wrap; word-break: break-all; padding: 1px 0; cursor: pointer; }
.raw div:hover { background: var(--row-hover); }
.raw .t { color: var(--muted); margin-right: 8px; }
.raw .blocked { color: #f3a3a3; }
.raw .accepted { color: #a8e6c0; }
.raw .threat { color: #f5cf8f; }
.more { text-align: center; padding: 10px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.empty.small { padding: 12px; }
.empty.error { color: #f3a3a3; }

/* ---------- details panel ---------- */
.details {
  width: 400px; flex: none; overflow: auto; background: var(--panel);
  border-left: 1px solid var(--border); padding: 12px 16px;
}
.details-head { display: flex; justify-content: space-between; align-items: center; }
.details h3, .details h4 { margin: 8px 0; }
.details dl, dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 8px; margin: 0 0 12px; }
.details dt, dl.kv dt { color: var(--muted); }
.details dd, dl.kv dd { margin: 0; word-break: break-all; }
.details dd.filterable { cursor: pointer; text-decoration: underline dotted var(--muted); }
.details dd.filterable:hover { color: var(--accent); }
.details pre {
  white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 8px; max-height: 50vh; overflow: auto;
  border: 1px solid var(--border); border-radius: 3px; font-family: var(--mono); font-size: 12px;
}

/* ---------- analysis: dashboard ---------- */
.analysis-pane { flex: 1; min-height: 0; }
.analysis-pane.scroll { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent-2); border-radius: var(--radius); padding: 12px; }
.kpi.bad { border-left-color: var(--bad); }
.kpi.ok { border-left-color: var(--ok); }
.kpi.warn { border-left-color: var(--warn); }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.card h3 { margin: 0 0 10px; font-size: 14px; }
.card h3 small { color: var(--muted); font-weight: normal; }
.timeline svg { display: block; max-width: 100%; }
.timeline .gridline { stroke: var(--border); stroke-width: 1; }
.timeline .axis { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; }
.tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.top-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 8px; align-items: center; width: 100%;
  padding: 3px 4px; cursor: pointer; border-radius: 3px; background: none; border: 0; text-align: left;
}
.top-row:hover { background: var(--row-hover); }
.top-row .name { position: relative; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.top-row .bar { position: absolute; inset: 0 auto 0 0; background: #2b7fb040; border-radius: 2px; }
.top-row .label { position: relative; padding-left: 4px; }
.top-row .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- analysis: map ---------- */
.map-pane, .flow-pane { display: flex; flex-direction: column; }
.pane-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 16px; }
.pane-help { margin: 0 16px 6px; }
.map-layout { flex: 1; display: flex; min-height: 0; gap: 0; }
.map-box { flex: 1; position: relative; min-width: 0; overflow: hidden; background: #0b1016; }
#mapCanvas { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.worldmap { width: 100%; height: 100%; cursor: grab; touch-action: none; }
.worldmap:active { cursor: grabbing; }
.worldmap .ocean { fill: #0b1016; }
.worldmap .country { fill: #1f2834; stroke: #2e3a4a; stroke-width: calc(0.5px / var(--zoom, 1)); }
.worldmap .country:hover { stroke: var(--text); }
.worldmap .arcs path { fill: none; stroke-opacity: .55; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.worldmap .arcs.animated path { stroke-dasharray: 6 10; animation: flow 1.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -32; } }
.worldmap .dots circle { fill-opacity: .8; stroke: #0b1016; stroke-width: .6; cursor: pointer; vector-effect: non-scaling-stroke; }
.worldmap .dots circle:hover { fill-opacity: 1; stroke: #fff; }
.worldmap .site circle { fill: var(--accent); }
.worldmap .site .pulse { fill: none; stroke: var(--accent); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pulse 2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.5); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
.map-tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--panel); border: 1px solid var(--border);
  border-radius: 4px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow); max-width: 220px;
}
.map-credit { position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: var(--muted); }
.map-credit a { color: var(--muted); }
.map-side { width: 300px; flex: none; overflow: auto; padding: 12px 14px; background: var(--panel); border-left: 1px solid var(--border); }
.map-side h3 { margin: 4px 0 10px; font-size: 14px; }
.map-side h4 { margin: 12px 0 6px; }
.ip-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 3px 0; }
.ip-row .n { color: var(--muted); }

/* ---------- analysis: flows ---------- */
.flow-columns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flow-col { display: inline-flex; align-items: center; gap: 4px; }
.flow-col .arrow { color: var(--muted); margin: 0 2px; }
.flow-canvas { flex: 1; overflow: auto; padding: 0 8px 16px; background: radial-gradient(ellipse at 20% 0%, #121a24 0%, var(--bg) 60%); }
.flowgraph { display: block; }
.flowgraph .col-head { fill: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.flowgraph .links path { fill: none; stroke-opacity: .5; transition: stroke-opacity .15s; }
.flowgraph.focus .links path { stroke-opacity: .07; }
.flowgraph.focus .links path.hl { stroke-opacity: .95; }
.flowgraph .node rect { fill: #141b24; stroke: #3a4a5e; stroke-width: 1; }
.flowgraph .node.clickable { cursor: pointer; }
.flowgraph .node:hover rect { stroke: var(--accent); fill: #1a2532; }
.flowgraph .node-label { fill: var(--text); font: 12px var(--mono); }
.flowgraph .node-tag { fill: #6fb7ff; font: 600 9px var(--mono); }
.flowgraph .node-count { fill: var(--muted); font: 10px var(--mono); }
.flowgraph .dot.ok { fill: var(--ok); }
.flowgraph .dot.bad { fill: var(--bad); }

/* ---------- rules ---------- */
#rulesView .subbar input[type=search] { min-width: 220px; }
#rulesBody { padding: 12px 16px; }
.table-wrap { overflow: auto; }
.rules-table td { max-width: 260px; }
.zone-group { margin-bottom: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.zone-group summary { padding: 8px 12px; cursor: pointer; }
.matrix { border-collapse: collapse; margin-bottom: 16px; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 6px 10px; text-align: center; white-space: nowrap; }
.matrix th { background: var(--panel); }
.matrix .corner { color: var(--muted); font-weight: normal; font-size: 11px; }
.matrix td { color: var(--muted); min-width: 90px; }
.matrix td.has { cursor: pointer; }
.matrix td.has:hover { background: var(--row-hover); }
.matrix td.selected { background: #2a3d55; }
.pair-btn { background: none; border: 0; cursor: pointer; display: inline-flex; gap: 4px; }
.pair-btn .badge { min-width: 0; }
.pair-detail h3 { font-size: 14px; }

/* ---------- settings ---------- */
.settings { flex: 1; display: flex; min-height: 0; }
.settings-nav { width: 210px; flex: none; padding: 12px 0; background: var(--panel); border-right: 1px solid var(--border); }
.settings-nav a { display: block; padding: 8px 18px; color: var(--muted); text-decoration: none; border-left: 3px solid transparent; }
.settings-nav a:hover { color: var(--text); background: var(--row-hover); }
.settings-nav a.active { color: var(--text); border-left-color: var(--accent); background: var(--raised); }
.settings-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.settings-form { display: flex; flex-direction: column; gap: 12px; }
.settings-form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { color: var(--muted); font-size: 12px; }
.field input, .field select { padding: 6px 8px; }
.test-result { min-height: 1.4em; }
.test-result.ok { color: #8fe0b0; }
.test-result.bad { color: #f3a3a3; }
td.actions { display: flex; gap: 6px; }

/* ---------- floating windows ---------- */
.popover {
  position: fixed; z-index: 20; width: 320px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.popover h4 { margin: 0; }
.popover label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.popover input, .popover select { background: var(--bg); padding: 5px; color: var(--text); }
.popover .hint { margin: 0; color: var(--muted); font-size: 12px; }
.pop-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; align-items: center; }
.pop-actions.left { justify-content: flex-start; }
#columnsPop { width: 290px; }
.col-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; max-height: 50vh; overflow: auto; }
.menu {
  position: fixed; z-index: 30; list-style: none; margin: 0; padding: 4px 0; min-width: 220px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu li { padding: 6px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 440px; }
.menu li:hover { background: var(--row-hover); }
.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 40; max-width: 90vw;
  padding: 8px 16px; border-radius: 4px; border: 1px solid var(--bad); background: #4f2323;
}
.toast.success { border-color: var(--ok); background: #1f4630; }

/* ---------- sign-in ---------- */
.login-page { align-items: center; justify-content: center; background: radial-gradient(ellipse at top, #16212d, var(--bg) 70%); }
.login-card {
  width: min(380px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
}
.login-card .muted { text-align: center; margin: 0; }
.login-error { color: #f3a3a3; margin: 0; }
.login-lang { display: flex; justify-content: center; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .fresh, .worldmap .arcs.animated path, .worldmap .site .pulse { animation: none; }
}
@media (max-width: 900px) {
  .topbar { gap: 8px; padding: 0 8px; }
  .status { display: none; }
  .tab { padding: 0 8px; }
  .details, .map-side { position: fixed; inset: 48px 0 0 auto; width: min(100vw, 400px); z-index: 10; }
  .map-side { position: static; width: 100%; max-height: 40vh; border-left: 0; border-top: 1px solid var(--border); }
  .map-layout { flex-direction: column; }
  .settings { flex-direction: column; }
  .settings-nav { width: 100%; display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .settings-nav a { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .settings-nav a.active { border-bottom-color: var(--accent); }
}

/* ---------- Real time › Throughput ---------- */
.throughput-view { padding: 12px 16px; display: flex; flex-direction: column; gap: 14px; }
.if-group h3 { margin: 4px 0 8px; font-size: 14px; }
.if-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.if-card {
  display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; cursor: pointer; color: var(--text);
}
.if-card:hover { border-color: var(--accent); }
.if-card.down { opacity: .5; border-style: dashed; }
.if-head { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.if-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.if-rates { display: flex; justify-content: space-between; font: 13px var(--mono); margin-top: 2px; }
.if-rates .rx { color: #6fb7ff; }
.if-rates .tx { color: #7fd8a5; }
.spark { width: 100%; height: 60px; display: block; margin-top: 4px; background: var(--bg); border-radius: 3px; }
.spark polyline { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark .rx { stroke: #6fb7ff; }
.spark .tx { stroke: #7fd8a5; }
.spark-wait { height: 60px; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 3px; }
body:not([data-view=live]) .live-only { display: none; }
body[data-logtype=syslog][data-view=live] #columnsBtn,
body[data-logtype=syslog][data-view=live] #viewMode,
body[data-logtype=syslog][data-view=live] #count,
body[data-logtype=syslog][data-view=live] .toolbar,
body[data-logtype=throughput][data-view=live] #columnsBtn,
body[data-logtype=throughput][data-view=live] #viewMode,
body[data-logtype=throughput][data-view=live] #count,
body[data-logtype=throughput][data-view=live] .toolbar { display: none; }

/* ---------- saved filters ---------- */
.popover.wide { width: 420px; max-height: 75vh; overflow: auto; }
.saved-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow: auto; }
.saved-row { display: flex; align-items: center; gap: 6px; }
.saved-apply {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; min-width: 0;
  background: none; border: 1px solid transparent; border-radius: 3px; padding: 4px 6px; cursor: pointer; color: var(--text);
}
.saved-apply:hover { background: var(--row-hover); border-color: var(--border); }
.saved-apply .muted { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-form { display: flex; flex-direction: column; gap: 6px; }

/* ---------- objects ---------- */
.pad { padding: 12px 16px; }
#objectsView .subbar input[type=search] { min-width: 240px; }
.tag.kind-ip { color: #6fb7ff; border-color: #2b5f86; }
.tag.kind-port { color: #f0a04b; border-color: #7a5520; }
.tag.kind-network { color: #7fd8a5; border-color: #2b6b4a; }
.tag.kind-zone { color: #b9a2f5; border-color: #5a4a8a; }
.member-list { margin: 0; padding-left: 18px; max-height: 40vh; overflow: auto; }
.member-list li { padding: 1px 0; }
.member-list .btn.link { margin-left: 8px; font-size: 11px; }
.note { padding: 8px 12px; border-radius: var(--radius); background: #1f3a52; border-left: 3px solid var(--accent); }
.note.warn { background: #4d3814; border-left-color: var(--warn); }

/* ---------- reports ---------- */
.reports { flex: 1; display: flex; min-height: 0; }
.report-list { width: 330px; flex: none; padding: 12px; background: var(--panel); border-right: 1px solid var(--border); }
.report-group h4 { margin: 12px 4px 6px; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .6px; }
.report-card {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; margin-bottom: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent-2);
  border-radius: var(--radius); padding: 8px 10px; color: var(--text);
}
.report-card.compliance { border-left-color: var(--ok); }
.report-card:hover { border-color: var(--accent); }
.report-card.active { background: #1f3a52; border-color: var(--accent); }
.report-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.report-head { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.report-head h2 { margin: 0 0 4px; font-size: 18px; }
.report-frame { flex: 1; width: 100%; border: 0; background: #e9edf2; }

/* ---------- audit / sign-in ---------- */
tr.failed td { color: #f3a3a3; }
.oidc .sep { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 4px 0 10px; }
.oidc .sep::before, .oidc .sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
body[data-view=objects] .toolbar, body[data-view=practices] .toolbar { display: none; }
body[data-view=reports] .ctl-time { display: inline-flex; }

.top-row.static { cursor: default; }
.map-side h3.spaced { margin-top: 18px; }

.popover label.check { flex-direction: row; color: var(--text); }

.pane-bar.flat { padding: 0; gap: 8px; }
.spark-box { margin-top: 4px; }
.spark-box .spark { margin-top: 0; }
.spark-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ---------- Analysis › Bandwidth ---------- */
.bw-chart { width: 100%; height: 190px; display: block; }
.bw-table td { position: relative; }
.bw-table td .bar { position: absolute; inset: 3px auto 3px 0; background: #2b7fb033; border-radius: 2px; }
.bw-table td .cell { position: relative; }
.bw-table tr.static { cursor: default; }
.grid .num { text-align: right; }
input.narrow { width: 90px; }
.if-link { align-self: flex-start; margin-top: 2px; font-size: 11px; }

/* ---------- Real time › Raw syslog ---------- */
.syslog-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.syslog-view #rawFilter { min-width: 260px; }
.raw-list { padding: 0 16px 16px; }
.raw-line { border-bottom: 1px solid var(--border); padding: 6px 0; }
.raw-line.rejected { opacity: .6; }
.raw-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.raw-meta .ellipsis { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.raw-text { margin: 4px 0 0; white-space: pre-wrap; word-break: break-all; font: 12px var(--mono); color: #c9d4e3; }
.test-result .ok { color: #8fe0b0; }
.test-result .bad { color: #f3a3a3; }

/* ---------- clickable legend ---------- */
.legend-item { background: none; border: 1px solid transparent; border-radius: 3px; padding: 2px 6px; color: var(--muted); cursor: pointer; }
.legend-item:hover { border-color: var(--border); color: var(--text); }
.legend-item.off { opacity: .4; text-decoration: line-through; }

/* ---------- Best practices ---------- */
.bp-head { display: flex; gap: 18px; align-items: center; margin-bottom: 8px; }
.bp-score { width: 92px; height: 92px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 6px solid var(--accent); font-size: 28px; font-weight: 700; flex: none; }
.bp-score small { font-size: 11px; color: var(--muted); font-weight: 400; }
.bp-score.ok { border-color: var(--ok); } .bp-score.warn { border-color: var(--warn); } .bp-score.bad { border-color: var(--bad); }
.bp-summary { display: flex; flex-direction: column; gap: 6px; }
.bp-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.bp-count { display: inline-flex; gap: 6px; align-items: center; background: var(--panel); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 8px; cursor: pointer; color: var(--text); }
.bp-count.active { border-color: var(--accent); background: #1f3a52; }
.sev { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.sev-critical { background: #7a1f1f; color: #ffd0d0; } .sev-high { background: #7a3a1f; color: #ffd9c2; }
.sev-medium { background: #6b5518; color: #ffe9b0; } .sev-low { background: #24445f; color: #cfe6ff; }
.sev-info { background: #33404f; color: #c9d4e3; } .sev-ok { background: #1f4630; color: #8fe0b0; }
.bp-titles { white-space: normal !important; max-width: 420px; color: var(--muted); }
.bp-issue { border-left: 3px solid var(--border); padding: 6px 10px; margin: 8px 0; background: var(--bg); border-radius: 0 4px 4px 0; }
.bp-issue p { margin: 6px 0 0; line-height: 1.45; }
.bp-issue-head { display: flex; gap: 8px; align-items: center; }
.sev-border-critical { border-left-color: #d64545; } .sev-border-high { border-left-color: #e0793a; }
.sev-border-medium { border-left-color: var(--warn); } .sev-border-low { border-left-color: var(--accent); }
.sev-border-info { border-left-color: var(--muted); }

/* =================== Light theme =================== */
:root[data-theme=light] {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #eef2f6;
  --raised: #e4eaf1;
  --border: #d2d9e2;
  --text: #1c2733;
  --muted: #5d6b7c;
  --accent: #1f7fb8;
  --accent-2: #2272a8;
  --ok: #23875a;
  --bad: #c93c3c;
  --warn: #b97512;
  --row-hover: #e8eff7;
  --shadow: 0 10px 30px rgba(20, 35, 55, .18);
  color-scheme: light;
}
:root[data-theme=dark] { color-scheme: dark; }
[data-theme=light] .chip { background: #e1eefa; border-color: #8bb8dc; }
[data-theme=light] .chip .k { color: #37617f; }
[data-theme=light] .chip.neg { background: #fbe4e4; border-color: #e0a0a0; }
[data-theme=light] .chip.neg .k { color: #8d3a3a; }
[data-theme=light] .grid td { border-bottom-color: #e6ebf0; }
[data-theme=light] .grid tbody tr.selected,
[data-theme=light] .matrix td.selected,
[data-theme=light] .report-card.active,
[data-theme=light] .bp-count.active { background: #d8e8f6; }
[data-theme=light] .badge.ok { background: #d9f2e4; color: #1d6b45; }
[data-theme=light] .badge.bad { background: #fbe0e0; color: #9e2a2a; }
[data-theme=light] .badge.warn { background: #fdf0d6; color: #8a5a07; }
[data-theme=light] .badge.other { background: #e9edf2; color: #45525f; }
[data-theme=light] .badge.event { background: #e9edf2; color: #5d6b7c; }
[data-theme=light] .raw .blocked, [data-theme=light] .raw-line .bad { color: #b02f2f; }
[data-theme=light] .raw .accepted { color: #1f7a4d; }
[data-theme=light] .raw .threat { color: #9a6200; }
[data-theme=light] .raw-text { color: #2a3644; }
[data-theme=light] .fresh { animation-name: fresh-light; }
@keyframes fresh-light { from { background: #d9f2e4; } to { background: transparent; } }
[data-theme=light] .toast { background: #fbe0e0; color: #7a1f1f; }
[data-theme=light] .toast.success { background: #d9f2e4; color: #1d6b45; }
[data-theme=light] .note { background: #e8f2fb; }
[data-theme=light] .note.warn { background: #fdf3df; }
[data-theme=light] .test-result.ok, [data-theme=light] .test-result .ok { color: #1d6b45; }
[data-theme=light] .test-result.bad, [data-theme=light] .test-result .bad, [data-theme=light] .login-error { color: #b02f2f; }
[data-theme=light] .if-rates .rx, [data-theme=light] .flowgraph .node-tag { color: #1f6fa8; fill: #1f6fa8; }
[data-theme=light] .if-rates .tx { color: #1f7a4d; }
[data-theme=light] .spark .rx { stroke: #1f6fa8; }
[data-theme=light] .spark .tx { stroke: #23875a; }
[data-theme=light] .map-box, [data-theme=light] .worldmap .ocean { background: #b9d3ea; fill: #b9d3ea; }
[data-theme=light] .worldmap .country { fill: #f7f9fb; stroke: #b9c4d0; }
[data-theme=light] .worldmap .dots circle { stroke: #ffffff; }
[data-theme=light] .flow-canvas { background: radial-gradient(ellipse at 20% 0%, #e9f0f7 0%, var(--bg) 60%); }
[data-theme=light] .flowgraph .node rect { fill: #ffffff; stroke: #b9c4d0; }
[data-theme=light] .flowgraph .node:hover rect { fill: #eef5fc; }
[data-theme=light] .sev-low { background: #dcebf8; color: #1f5582; }
[data-theme=light] .sev-info { background: #e9edf2; color: #45525f; }
[data-theme=light] .sev-ok { background: #d9f2e4; color: #1d6b45; }
[data-theme=light] .login-page { background: radial-gradient(ellipse at top, #e3edf7, var(--bg) 70%); }
[data-theme=light] .kind-allowed.active { background: #d9f2e4 !important; color: #1d6b45; }
[data-theme=light] .kind-blocked.active { background: #fbe0e0 !important; color: #9e2a2a; }
[data-theme=light] .kind-threat.active { background: #fdf0d6 !important; color: #8a5a07; }

.theme-toggle { font-size: 16px; line-height: 1; padding: 4px 8px; }

/* ---------- Changes ---------- */
body[data-view=edit] .toolbar { display: none; }
.edit-body { display: flex; flex-direction: column; gap: 14px; }
.section-title { margin: 6px 0 0; font-size: 14px; }
.switch { position: relative; display: inline-block; width: 38px; height: 20px; cursor: pointer; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--raised); border: 1px solid var(--border); border-radius: 20px; transition: background .15s; }
.switch .slider::before { content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .slider { background: var(--ok); border-color: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(18px); background: #fff; }
.switch input:disabled + .slider { opacity: .45; cursor: not-allowed; }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 1px; }
.port-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.port-cell { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.port-cell.up { border-left: 3px solid var(--ok); }
.port-cell.off { opacity: .6; border-style: dashed; }
.port-head { display: flex; gap: 6px; align-items: baseline; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-edit textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 6px; color: var(--text); }
.obj-edit .row { display: flex; gap: 16px; align-items: end; }

/* ---------- Home ---------- */
body[data-view=home] .toolbar { display: none; }
.home { flex: 1; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.home-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.home-top { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.home-map-card h3, .home .card h3 { margin: 0; }
.home-map-box { margin-top: 8px; border-radius: 6px; overflow: hidden; background: #0b1016; aspect-ratio: 1000 / 340; }
.home-map { width: 100%; height: 100%; cursor: default; }
.home-map-box { position: relative; }
.home-map-hint { position: absolute; left: 10px; bottom: 10px; max-width: min(520px, calc(100% - 20px)); padding: 6px 10px;
  border: 1px solid var(--warn); border-radius: 6px; background: color-mix(in srgb, var(--panel) 88%, transparent);
  font-size: 12px; color: var(--text); }
.home-flows .trail { fill: none; stroke-width: 1.4; stroke-linecap: round; opacity: .85; vector-effect: non-scaling-stroke; }
.home-flows .comet { filter: drop-shadow(0 0 3px currentColor); }
.home-flows .ping { fill: none; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ping 1.2s ease-out forwards; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(3.2); opacity: 0; } }
.sep-v { width: 1px; height: 18px; background: var(--border); }
.kind-allowed-l span { color: var(--accent); } .kind-blocked-l span { color: var(--bad); } .kind-threat-l span { color: var(--warn); }
.home-feed { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow: auto; margin-top: 8px; }
.feed-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 4px;
  border-bottom: 1px solid var(--border); animation: feed-in .4s ease-out; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.feed-flag { display: flex; align-items: center; justify-content: center; }
img.flag { display: block; width: 22px; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.flag-none { font: 600 10px var(--mono); color: var(--muted); }
.feed-main { min-width: 0; }
.wan-cards { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.wan-card { flex: 1 1 260px; border: 1px solid var(--border); border-left: 4px solid var(--wan, var(--accent)); border-radius: 6px;
  padding: 10px 14px; background: var(--panel-2); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, opacity .15s, box-shadow .15s; }
.wan-card:hover { box-shadow: 0 0 0 1px var(--wan) inset; }
.wan-card.selected { box-shadow: 0 0 0 2px var(--wan) inset; }
.wan-card.dimmed { opacity: .55; }
.wan-name .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.wan-card.down { opacity: .5; }
.wan-name { display: flex; justify-content: space-between; align-items: center; }
.wan-rates { display: flex; gap: 24px; margin-top: 6px; }
.wan-rates div { display: flex; flex-direction: column; }
.wan-rates strong { font: 600 22px var(--mono); }
.wan-rates .rx strong { color: #3fa7d6; } .wan-rates .tx strong { color: #4caf7d; }
.home-wan-chart svg { display: block; max-width: 100%; }
.home-wan-chart .axis { fill: var(--muted); font-size: 11px; }
.home-wan-chart .gridline { stroke: var(--border); }
.wan-line { fill: none; stroke-width: 1.8; } .wan-line.tx { stroke-dasharray: 5 3; stroke-width: 1.4; }
.wan-area { stroke: none; }
@media (max-width: 1100px) { .home-top { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .feed-row { animation: none; } }

/* ---------- grouped navigation ---------- */
a.brand { color: var(--text); text-decoration: none; }
a.brand:hover span { filter: brightness(1.25); }
.tab-group { position: relative; display: flex; }
button.tab { background: none; border: 0; border-bottom: 2px solid transparent; font: inherit; cursor: pointer; gap: 4px; }
.tab-menu {
  display: none; position: absolute; left: 0; top: 100%; z-index: 40; min-width: 200px; padding: 4px 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow);
}
.tab-group:hover .tab-menu, .tab-group.open .tab-menu { display: block; }
.tab-menu a { display: block; padding: 8px 14px; color: var(--text); text-decoration: none; white-space: nowrap; }
.tab-menu a:hover { background: var(--row-hover); }
.tab-menu a.active { color: var(--accent); font-weight: 600; }

/* ---------- home: latest logs ---------- */
.home-logs td { padding-top: 4px; padding-bottom: 4px; }
.home-logs .c-time { width: 84px; } .home-logs .c-type { width: 90px; } .home-logs .c-action { width: 100px; }
.home-logs .c-src { width: 21%; } .home-logs .c-dst { width: 16%; } .home-logs .c-svc { width: 96px; }
.home-log { animation: feed-in .4s ease-out; }
.home-log.threat td:first-child { box-shadow: 3px 0 0 var(--warn) inset; }
@media (prefers-reduced-motion: reduce) { .home-log { animation: none; } }

/* ---------- pending changes / history ---------- */
.pending-bar { flex: none; padding: 8px 16px; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border-bottom: 1px solid var(--warn); }
.pending-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pending-count { font-weight: 600; color: var(--warn); }
.pending-bar .table-wrap { margin-top: 8px; max-height: 260px; overflow: auto; }
tr.staged td, .port-cell.staged, .obj-edit.staged { box-shadow: inset 3px 0 0 var(--warn); }
.port-cell.staged, .obj-edit.staged { border-color: var(--warn); }
.switch.staged .slider { outline: 2px dashed var(--warn); outline-offset: 2px; }
.staged-tag { color: var(--warn); border-color: var(--warn); }
.diff-add { color: var(--ok); } .diff-del { color: var(--bad); }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); }
tr.error-row td { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.history-batch .pane-bar { gap: 10px; margin-bottom: 6px; }

/* ---------- IP blocking ---------- */
.menu li.menu-sep { height: 1px; padding: 0; margin: 4px 0; background: var(--border); pointer-events: none; }
.menu li.menu-danger { color: var(--bad); }
td.ip-action { cursor: context-menu; text-decoration: underline dotted; text-underline-offset: 3px; }
.tab-badge { margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #111;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

/* ---------- NAT / users ---------- */
body[data-view=nat] .toolbar, body[data-view=clients] .toolbar { display: none; }
#natBody { display: flex; flex-direction: column; gap: 14px; }
.grid.clients tbody tr { cursor: pointer; }
.grid.clients tr.selected td { background: var(--row-hover); }
.grid.clients tr.blocked-client td { color: var(--bad); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.off { background: var(--border); }
#clientDetailsBody dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
#clientDetailsBody dt { color: var(--muted); }
#clientDetailsBody dd { margin: 0; word-break: break-all; }
.btn.danger { border-color: var(--bad); color: var(--bad); }

/* ---------- home: WAN IPs ---------- */
.wan-ips { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 8px 0 0; font-size: 12px; }
.wan-ips dt { color: var(--muted); }
.wan-ips dd { margin: 0; }
.settings-form h4 { margin: 14px 0 4px; }

/* ---------- maps in light mode: light land clearly set off from a blue ocean ---------- */
[data-theme=light] .worldmap .ocean { fill: #b9d3ea; }
[data-theme=light] .worldmap .country { fill: #fbfaf6; stroke: #7f95ab; }
[data-theme=light] .worldmap .country:hover { fill: #eef3f8; stroke: #2a3644; }
[data-theme=light] .worldmap .arcs path { stroke-opacity: .8; }
[data-theme=light] .worldmap .dots circle { stroke: #ffffff; fill-opacity: .9; }
[data-theme=light] .home-map-box { background: #b9d3ea; }
[data-theme=light] .home-flows .trail { opacity: 1; stroke-width: 1.8; }
[data-theme=light] .home-flows .comet { filter: drop-shadow(0 0 2px rgba(0, 0, 0, .45)); }
[data-theme=light] .worldmap .site circle { stroke: #ffffff; stroke-width: 1; }

/* ---------- confirmation dialogs ---------- */
.app-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); color: var(--text);
  padding: 0; max-width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-body { padding: 18px 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.dialog-message { margin: 0; white-space: pre-wrap; line-height: 1.45; max-height: 60vh; overflow: auto; }
.dialog-input { width: 100%; }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ---------- impersonation / recovery / creation ---------- */
.imp-banner { display: flex; align-items: center; justify-content: center; gap: 14px; flex: none; padding: 6px 16px;
  background: color-mix(in srgb, var(--warn) 22%, var(--panel)); border-bottom: 1px solid var(--warn); font-weight: 600; }
.menu-pop .menu-hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
#forgotBtn { margin-top: 6px; }
#passkeyBtn { margin-top: 10px; }
.login-error.ok { color: var(--ok); }
.create-card { border-color: var(--accent); }
.create-card fieldset.endpoint { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; }
.create-card legend { padding: 0 6px; color: var(--muted); }
.create-card select[multiple] { min-width: 180px; }

/* ---------- device images ---------- */
.dev-icon { display: block; object-fit: contain; flex: none; }
.dev-icon-none { display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--muted); font-size: 14px; }
.client-name { display: flex; align-items: center; gap: 8px; }
.client-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.client-head h3 { margin: 0; }

/* ---------- object contents: one box per item ---------- */
.members-editor { display: flex; flex-direction: column; gap: 4px; }
.members { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow: auto; padding-right: 4px; }
.member-line { display: flex; gap: 6px; align-items: center; }
.member-line input { flex: 1; min-width: 0; }
.member-row:last-child .btn.icon { visibility: hidden; }
.member-row.invalid input { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad) inset; }
.member-error { color: var(--bad); min-height: 0; }
.member-row:not(.invalid) .member-error { display: none; }
tr.deleting td { text-decoration: line-through; opacity: .6; }
td.actions { white-space: nowrap; display: flex; gap: 4px; }

.ipfix-points { margin: 6px 0 10px; padding-left: 20px; line-height: 1.5; }

/* ---------- VPN ---------- */
body[data-view=vpn] .toolbar { display: none; }
.vpn-body { display: flex; flex-direction: column; gap: 14px; }
tr.vpn-user td { font-size: 12px; color: var(--muted); border-bottom-style: dashed; }

/* ---------- Settings › Raw syslog ---------- */
.settings-body .syslog-view { flex: none; display: block; }
.settings-body .syslog-view .raw-list { max-height: calc(100vh - 330px); overflow: auto; }
.settings-body .syslog-view input[type=search] { min-width: 260px; }

/* ---------- Analysis › Topology ---------- */
body[data-view=analysis][data-analysis=topology] .toolbar { display: none; }
.topo-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.topo-pane .split { flex: 1; min-height: 0; }
.topo-canvas { flex: 1; overflow: auto; background: #111418; cursor: grab; user-select: none; }
.topo-canvas:active { cursor: grabbing; }
.topo-svg { display: block; }
.topo-link { fill: none; stroke-width: 1.6; }
.topo-link.wifi { stroke-dasharray: 5 4; }
.topo-hub { fill: #4f8cff; stroke: #1b2a44; stroke-width: 2; }
.topo-node { cursor: pointer; }
.topo-node .halo { fill: transparent; }
.topo-node:hover .halo, .topo-node:focus .halo { fill: rgba(79, 140, 255, .12); }
.topo-node.selected .halo { fill: rgba(79, 140, 255, .28); stroke: #4f8cff; stroke-width: 1.5; }
.topo-node.offline { opacity: .45; }
.topo-name { fill: #e6e9ee; font: 600 12px var(--sans, system-ui); }
.topo-sub { fill: #8b95a3; font: 11px var(--sans, system-ui); }
.topo-sub.sig-good { fill: #4caf7d; } .topo-sub.sig-mid { fill: #f0a830; } .topo-sub.sig-bad { fill: #e5677d; }
.dev-body { fill: #f2f4f7; stroke: #c3cad4; stroke-width: 1; }
.dev-port { fill: #9aa5b3; } .dev-led { fill: #4f8cff; } .dev-led-ring { fill: none; stroke: #4f8cff; stroke-width: 2; }
.isp-box { fill: #ff7900; } .isp-glyph { font-size: 22px; }
.client-box { fill: #2b3442; stroke: #6c7a8c; }
[data-theme=light] .topo-canvas { background: #f4f6f9; }
[data-theme=light] .topo-name { fill: #1d2733; } [data-theme=light] .topo-sub { fill: #5d6b7c; }
[data-theme=light] .dev-body { fill: #ffffff; stroke: #9aa5b3; }
.port-device { font-size: 11px; color: var(--accent); }

.settings-nav[hidden] { display: none !important; }

/* ---------- navigation: icons, one open menu at a time, list on small screens ---------- */
.tab-icon { font-size: 15px; line-height: 1; margin-right: 6px; }
.tab .caret { margin-left: 4px; font-size: 11px; transition: transform .15s; }
.nav-burger { display: none; font-size: 18px; padding: 4px 10px; }
@media (max-width: 760px) {
  .nav-burger { display: inline-flex; }
  .tabs {
    display: none; position: fixed; inset: 48px 0 0 0; z-index: 50; flex-direction: column; height: auto;
    overflow-y: auto; padding: 14px 18px 24px; background: var(--panel); border-top: 1px solid var(--border);
  }
  body.nav-open .tabs { display: flex; }
  .tab-group { flex-direction: column; }
  .tab, button.tab { padding: 12px 4px; font-size: 18px; font-weight: 600; color: var(--text); border-bottom: 0; width: 100%; }
  .tab.active { color: var(--accent); border-bottom: 0; }
  .tab-group:hover .tab-menu { display: none; }
  .tab-menu { position: static; box-shadow: none; border: 0; background: none; padding: 0 0 6px 28px; min-width: 0; }
  .tab-group.open .tab-menu { display: block; }
  .tab-group.open > .tab { color: var(--accent); }
  .tab-group.open .caret { transform: rotate(180deg); }
  .tab-menu a { padding: 9px 4px; font-size: 16px; font-weight: 500; }
  .tab-menu a.active { color: var(--accent); }
}

/* ===== agent_backup/style.css ===== */
/* Selective backup: groups to include / restore */
.backup-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; margin: 6px 0 12px; }
.backup-contents:empty { display: none; }
.backup-contents { margin: 8px 0; }

/* ===== agent_flows/style.css ===== */
/* ==========================================================================
   agent_flows — to append at the end of app/static/style.css
   ========================================================================== */

/* ---------- analysis: flows — full paths of the selected node ---------- */
/* fixed-height slot above the graph: selecting never shifts the nodes */
.flow-selection-slot { position: sticky; left: 0; display: flex; align-items: center; min-height: 40px; padding: 4px 0; }
.flow-selection {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 4px 8px 4px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow);
}
.flow-selection .dot-sel { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #3fa7d633; }
.flowgraph .node { transition: opacity .15s; }
.flowgraph.focus .node.dim { opacity: .28; }
.flowgraph.focus .node.on rect { stroke: var(--accent); }
.flowgraph.focus .node.on .node-count { fill: var(--accent); font-weight: 600; }
.flowgraph .node.sel rect { stroke: var(--accent); stroke-width: 2; fill: #1a2a3a; }
.flowgraph .path-labels text {
  font: 600 10px var(--mono); fill: var(--text); pointer-events: none;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round;
}
[data-theme=light] .flowgraph .node.sel rect { fill: #e3f0fb; }

/* ---------- analysis: LAN map ---------- */
.lanmap-pane {
  display: flex; flex-direction: column;
  --lm-lan: var(--accent); --lm-guest: #b48cf0; --lm-vpn: #4fd1a5; --lm-inet: #8fa3bb; --lm-gw: var(--text);
  --lm-bg: #0b1016;
}
.lanmap-layout { flex: 1; display: flex; min-height: 0; }
.lanmap-box {
  flex: 1; position: relative; min-width: 0; overflow: hidden;
  background: radial-gradient(ellipse at 50% 55%, #142030 0%, var(--lm-bg) 70%);
}
.lanmap-canvas { position: absolute; inset: 0; }
.lanmap { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.lanmap-notice {
  position: absolute; left: 12px; right: 12px; bottom: 10px; padding: 6px 10px; border-radius: 6px; font-size: 12px;
  background: var(--panel); border: 1px solid var(--border); color: var(--muted); box-shadow: var(--shadow);
}

/* gateway <-> network wiring */
.lanmap .lm-spokes line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 5; }
/* persistent links (volume over the window) */
.lanmap .lm-link { fill: none; stroke-linecap: round; stroke-opacity: .22; transition: stroke-width .4s; }
.lanmap .k-allowed { stroke: var(--ok); color: var(--ok); }
.lanmap .k-blocked { stroke: var(--bad); color: var(--bad); }
.lanmap .k-threat { stroke: var(--warn); color: var(--warn); }
/* comets: a short stroke travelling along the source -> destination curve */
.lanmap .lm-shot {
  fill: none; stroke-linecap: round; stroke-dasharray: 10 100; stroke-dashoffset: 10; pointer-events: none;
  animation: lm-shot 1.3s cubic-bezier(.35, .1, .3, 1) forwards;
}
@keyframes lm-shot { to { stroke-dashoffset: -100; } }

/* bubbles */
.lanmap .lm-node { cursor: pointer; --lm-c: var(--lm-lan); transition: opacity .2s; outline: none; }
.lanmap .lm-node.kind-guest { --lm-c: var(--lm-guest); }
.lanmap .lm-node.kind-vpn { --lm-c: var(--lm-vpn); }
.lanmap .lm-node.kind-internet { --lm-c: var(--lm-inet); }
.lanmap .lm-node.kind-gateway { --lm-c: var(--lm-gw); }
.lanmap .lm-node.kind-local { --lm-c: var(--muted); }
.lanmap .lm-body { fill: var(--lm-c); fill-opacity: .13; stroke: var(--lm-c); stroke-width: 1.6; transition: fill-opacity .2s; }
.lanmap .lm-node.kind-gateway .lm-body { fill: var(--panel); fill-opacity: 1; stroke-width: 2.4; }
.lanmap .lm-node.kind-local .lm-body { stroke-dasharray: 4 3; }
.lanmap .lm-halo { fill: none; stroke: var(--lm-c); stroke-width: 2; opacity: 0; transition: opacity .2s; }
.lanmap .lm-node:hover .lm-body, .lanmap .lm-node:focus-visible .lm-body { fill-opacity: .26; }
.lanmap .lm-node:focus-visible .lm-halo { opacity: .5; }
.lanmap .lm-node.sel .lm-halo { opacity: .9; }
.lanmap .lm-node.idle .lm-body { fill-opacity: .06; stroke-opacity: .55; }
.lanmap.focus .lm-node:not(.sel) { opacity: .6; }
.lanmap .lm-glyph { fill: none; stroke: var(--lm-c); stroke-width: 1.4; }
.lanmap .lm-node text { text-anchor: middle; pointer-events: none; }
.lanmap .lm-name { fill: var(--text); font: 600 12px var(--font); }
.lanmap .lm-sub { fill: var(--muted); font: 10px var(--mono); }
.lanmap .lm-vlan { fill: var(--lm-c); font: 600 10px var(--mono); letter-spacing: .3px; }
.lanmap .lm-count { font: 600 11px var(--mono); paint-order: stroke; stroke: var(--lm-bg); stroke-width: 3px; stroke-linejoin: round; }
.lanmap .lm-count .ok { fill: var(--ok); }
.lanmap .lm-count .bad { fill: var(--bad); }
.lanmap .lm-ping {
  fill: none; stroke-width: 2; pointer-events: none; transform-box: fill-box; transform-origin: center;
  animation: lm-ping .9s ease-out forwards;
}
@keyframes lm-ping { from { transform: scale(1); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }

/* drag and drop, and hiding */
.lanmap .lm-node { touch-action: none; }
.lanmap .lm-node:active, .lanmap.dragging { cursor: grabbing; }
.lanmap.dragging .lm-node { transition: none; }
.lanmap .lm-hide { cursor: pointer; opacity: 0; transition: opacity .15s; }
.lanmap .lm-hide circle { fill: var(--panel); stroke: var(--border); stroke-width: 1; }
.lanmap .lm-hide path { stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.lanmap .lm-hide:hover circle { stroke: var(--bad); }
.lanmap .lm-hide:hover path { stroke: var(--bad); }
.lanmap .lm-node:hover .lm-hide, .lanmap .lm-node:focus-within .lm-hide, .lanmap .lm-node.sel .lm-hide { opacity: 1; }
.lanmap.dragging .lm-hide { opacity: 0 !important; }
@media (hover: none) { .lanmap .lm-hide { opacity: .85; } }
.lanmap-hidden-wrap { position: relative; display: inline-flex; }
.lanmap-hidden-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; min-width: 220px; max-height: 50vh; overflow: auto;
  padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow);
}
.lanmap-hidden-menu .lm-menu-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; background: none; border: 0; border-radius: 4px; text-align: left; cursor: pointer;
}
.lanmap-hidden-menu .lm-menu-item:hover, .lanmap-hidden-menu .lm-menu-item:focus-visible { background: var(--row-hover); }
.lanmap-hidden-menu .lm-menu-item.all { display: block; border-top: 1px solid var(--border); border-radius: 0 0 4px 4px; color: var(--accent); }
.lanmap-hidden-menu .lm-kind-dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--lm-c, var(--accent)); }
.lanmap-hidden-menu .kind-lan { --lm-c: var(--lm-lan); }
.lanmap-hidden-menu .kind-guest { --lm-c: var(--lm-guest); }
.lanmap-hidden-menu .kind-vpn { --lm-c: var(--lm-vpn); }
.lanmap-hidden-menu .kind-internet { --lm-c: var(--lm-inet); }
.lanmap-hidden-menu .kind-local { --lm-c: var(--muted); }

/* toolbar: real-time status and legend */
.lanmap-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lanmap-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.lanmap-status.on::before { background: var(--ok); box-shadow: 0 0 0 3px #4caf7d33; animation: lm-blink 2s ease-in-out infinite; }
@keyframes lm-blink { 50% { opacity: .35; } }
#lanmapPause.active { border-color: var(--warn); color: var(--warn); }
.lanmap-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); }
.lanmap-legend .lg-line::before {
  content: ""; display: inline-block; width: 16px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle;
  background: currentColor;
}
.lanmap-legend .lg-line.k-allowed::before { background: var(--ok); }
.lanmap-legend .lg-line.k-blocked::before { background: var(--bad); }
.lanmap-legend .lg-line.k-threat::before { background: var(--warn); }
.lanmap-legend .lg-dot::before {
  content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px;
  border: 1.5px solid var(--lm-c); background: transparent;
}
.lanmap-legend .lg-dot.kind-lan { --lm-c: var(--lm-lan); }
.lanmap-legend .lg-dot.kind-guest { --lm-c: var(--lm-guest); }
.lanmap-legend .lg-dot.kind-vpn { --lm-c: var(--lm-vpn); }

/* side panel */
.lanmap-side .lm-row { grid-template-columns: minmax(0, 1fr) auto; }
.lanmap-side .lm-row .bar { background: #3fa7d633; }
.lanmap-side .ok { color: var(--ok); }
.lanmap-side .bad { color: var(--bad); }
.lanmap-side .warn { color: var(--warn); }
.lanmap-side .lm-head { display: flex; justify-content: space-between; padding: 0 4px 2px; }
.lanmap-side .lm-kind {
  display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; vertical-align: 2px;
  color: var(--lm-c, var(--accent)); border: 1px solid var(--lm-c, var(--accent));
}
.lanmap-side .lm-kind.kind-lan { --lm-c: var(--lm-lan); }
.lanmap-side .lm-kind.kind-guest { --lm-c: var(--lm-guest); }
.lanmap-side .lm-kind.kind-vpn { --lm-c: var(--lm-vpn); }
.lanmap-side .lm-kind.kind-internet { --lm-c: var(--lm-inet); }
.lanmap-side .lm-kind.kind-gateway, .lanmap-side .lm-kind.kind-local { --lm-c: var(--muted); }
.lanmap-side .lm-facts { display: grid; gap: 3px; margin-bottom: 10px; overflow-wrap: anywhere; }
.lanmap-side .lm-kpis { display: flex; gap: 8px; }
.lanmap-side .lm-kpis > div {
  flex: 1; display: flex; flex-direction: column; padding: 6px 8px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid currentColor;
}
.lanmap-side .lm-kpis strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.lanmap-side .lm-kpis span { color: var(--muted); font-size: 11px; }

/* light theme */
[data-theme=light] .lanmap-pane { --lm-guest: #7a52c7; --lm-vpn: #1d8a68; --lm-inet: #5d7894; --lm-bg: #eef3f8; }
[data-theme=light] .lanmap-box { background: radial-gradient(ellipse at 50% 55%, #ffffff 0%, var(--lm-bg) 70%); }
[data-theme=light] .lanmap .lm-link { stroke-opacity: .3; }
[data-theme=light] .lanmap .lm-body { fill-opacity: .1; }
[data-theme=light] .lanmap .lm-node.kind-gateway .lm-body { fill: #ffffff; }
[data-theme=light] .lanmap .lm-spokes line { stroke: #b9c4d0; }

@media (prefers-reduced-motion: reduce) {
  .lanmap .lm-shot, .lanmap .lm-ping { display: none; }
  .lanmap-status.on::before { animation: none; }
}
@media (max-width: 900px) {
  .lanmap-layout { flex-direction: column; }
  .lanmap-box { min-height: 420px; }
  .lanmap-side { position: static; width: 100%; max-height: 45vh; border-left: 0; border-top: 1px solid var(--border); }
  .lanmap-legend { order: 10; width: 100%; }
}
@media (max-width: 480px) {
  .lanmap-box { min-height: 540px; }
  .lanmap .lm-sub { display: none; }
}

/* ===== agent_reports/style.css ===== */
/* Settings › Automatic reports (settings_reports.js) */
.sched-channels { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.sched-status { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.sched-status p { margin: 4px 0; }
.sched-last .badge { margin-left: 4px; }

/* ===== main.css ===== */
/* ---------- pages without a filter bar ---------- */
body[data-view=simulator] .toolbar,
body[data-view=analysis][data-analysis=usage] .toolbar,
body[data-view=analysis][data-analysis=anomalies] .toolbar,
body[data-view=analysis][data-analysis=wan] .toolbar { display: none; }

/* ---------- info windows (device card, reputation, temporary block) ---------- */
.panel-dialog { width: min(560px, calc(100vw - 32px)); padding: 0; }
.panel-dialog.wide { width: min(860px, calc(100vw - 32px)); }
.panel-dialog-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.panel-dialog-head h3 { margin: 0; flex: 1; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-dialog-body { padding: 14px 18px 18px; max-height: 75vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.panel-dialog-body h4 { margin: 8px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.device-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.device-count { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.device-spark { height: 90px; }
.rep-score { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border); }
.rep-score span { font-size: 26px; font-weight: 700; }
.rep-score.ok span { color: var(--ok); } .rep-score.warn span { color: var(--warn); } .rep-score.bad span { color: var(--bad, #e5677d); }

/* ---------- Changes: rules ---------- */
.tip-box { border: 1px solid var(--warn, #f0a830); background: color-mix(in srgb, var(--warn, #f0a830) 10%, transparent);
  border-radius: var(--radius); padding: 10px 14px; }
.tip-box ul { margin: 6px 0 0; padding-left: 18px; }
.tip-box li { margin: 3px 0; line-height: 1.4; }
.hl-improve { position: relative; outline: 2px solid var(--warn, #f0a830); outline-offset: 3px; border-radius: 4px; }
.hl-improve::after { content: "💡"; position: absolute; top: -10px; right: -8px; font-size: 13px; }
.zone-filter select { min-width: 130px; }
.order-cell { white-space: nowrap; }
.order-cell .btn.icon { padding: 2px 6px; font-size: 11px; }
.bp-actions { margin: 4px 0 8px; flex-wrap: wrap; }

/* ---------- snapshots ---------- */
.snap-layout { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 14px; align-items: start; }
.snap-list tr.clickable { cursor: pointer; }
.snap-list tr.open td { background: rgba(79, 140, 255, .12); }
.snap-diff { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.snap-item { border-top: 1px solid var(--border); padding: 8px 0; }
.snap-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.snap-kind { width: 20px; height: 20px; display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; font-size: 13px; }
.snap-kind.added { background: rgba(76, 175, 125, .2); color: var(--ok); }
.snap-kind.removed { background: rgba(229, 103, 125, .2); color: #e5677d; }
.snap-kind.changed { background: rgba(240, 168, 48, .2); color: var(--warn, #f0a830); }
.snap-item table { margin-top: 6px; }
.snap-item td { word-break: break-all; }
@media (max-width: 900px) { .snap-layout { grid-template-columns: 1fr; } }

/* ---------- rule usage ---------- */
.kpi-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.kpi-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 130px; padding: 10px 14px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-align: left; }
.kpi-card strong { font-size: 22px; }
.kpi-card span { font-size: 12px; color: var(--muted); }
.kpi-card.warn strong { color: var(--warn, #f0a830); } .kpi-card.bad strong { color: #e5677d; }
.kpi-card.active, .kpi-card:hover { border-color: var(--accent); }

/* ---------- anomalies ---------- */
.anom-list { display: flex; flex-direction: column; gap: 10px; }
.anom { border-left-width: 4px; }
.anom-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.anom p { margin: 6px 0; }

/* ---------- WAN quality ---------- */
.wanq-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.wanq-card { border-top: 4px solid var(--accent); margin: 0; }
.wanq-card.down { border-style: dashed; }
.wanq-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wanq-chart { width: 100%; height: 180px; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; }
.chart-legend i { display: inline-block; width: 12px; height: 3px; margin-right: 6px; vertical-align: middle; }

/* ---------- simulator ---------- */
.sim-form { max-width: 980px; }
.sim-verdict { display: flex; align-items: center; gap: 18px; border-left: 6px solid var(--border); }
.sim-verdict.ok { border-left-color: var(--ok); } .sim-verdict.bad { border-left-color: #e5677d; } .sim-verdict.warn { border-left-color: var(--warn, #f0a830); }
.sim-big { font-size: 26px; font-weight: 700; min-width: 140px; }
.sim-verdict.ok .sim-big { color: var(--ok); } .sim-verdict.bad .sim-big { color: #e5677d; } .sim-verdict.warn .sim-big { color: var(--warn, #f0a830); }
tr.muted-row td { opacity: .55; }

/* ---------- settings ---------- */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 14px; margin: 6px 0 10px; }
.check-grid.wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.prot-switch { margin: 6px 0; }
.block { display: block; }
.totp-setup { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.totp-qr { width: 200px; background: #fff; padding: 6px; border-radius: 6px; }
.totp-qr svg { width: 100%; height: auto; display: block; }
.token-value { display: block; padding: 8px; margin-top: 6px; word-break: break-all; user-select: all; background: var(--bg); border-radius: 4px; }
.code-sample { padding: 8px 10px; background: var(--bg); border-radius: 4px; overflow-x: auto; }

/* ===== objects.css ===== */
/* ---------- Changes › Objects (collapsible list) ---------- */
.obj-list tr.clickable { cursor: pointer; }
.obj-list tr.clickable:hover td { background: var(--hover, rgba(79, 140, 255, .06)); }
.obj-list tr.open td { background: rgba(79, 140, 255, .1); }
.obj-list tr.staged td:first-child { box-shadow: inset 3px 0 0 var(--warn, #f0a830); }
.obj-list .chevron { display: inline-block; transition: transform .15s; color: var(--muted); }
.obj-list tr.open .chevron { transform: rotate(90deg); }
.obj-detail-row > td { padding: 10px 12px 16px; background: var(--panel-2, transparent); }
.obj-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(200px, 1fr); gap: 12px; align-items: start; }
.obj-detail .card { margin: 0; }
.used-list { margin: 0; padding-left: 18px; }
@media (max-width: 760px) { .obj-detail { grid-template-columns: 1fr; } }

/* ---------- LAN map: choice of displayed networks ---------- */
.lanmap-hidden-menu { max-height: 60vh; overflow-y: auto; min-width: 240px; }
.lm-menu-quick { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.lm-menu-item.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* ---------- Changes: rule deletion, clickable ports ---------- */
.btn.icon.trash { color: #e5677d; border-color: transparent; background: transparent; font-size: 15px; }
.btn.icon.trash:hover { background: rgba(229, 103, 125, .15); border-color: #e5677d; }
.port-cell.clickable { cursor: pointer; }
.port-cell.clickable:hover { border-color: var(--accent); }

/* ---------- Unifarr brand ---------- */
:root { --brand: #2f96ff; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand .brand-name { color: inherit; font-style: normal; }
.brand .brand-arr { color: var(--brand); font-style: italic; }
/* Release stage (alpha): shown next to the name in the header and on the sign-in page. */
.brand .stage-badge { align-self: center; padding: 1px 6px; border: 1px solid var(--warn); border-radius: 4px; color: var(--warn);
  font-size: 10px; font-weight: 700; letter-spacing: .08em; line-height: 1.4; font-style: normal; }
.brand.big .stage-badge { font-size: 12px; }
.brand-logo { width: 26px; height: 26px; display: block; }
.brand.big { justify-content: center; gap: 12px; }
.brand.big .brand-logo { width: 52px; height: 52px; }
.brand-tagline { margin: -4px 0 4px; text-align: center; font-size: 13px; letter-spacing: .2px; color: var(--muted); }

/* ---------- sign-in page: compact, centered card ---------- */
.login-page { overflow-y: auto; padding: 32px 16px; }
.login-card {
  flex: none; height: auto; align-self: center; margin: auto; width: min(400px, 100%);
  padding: 32px 32px 26px; border-radius: 14px; gap: 14px;
}
.login-card .brand.big { margin-bottom: 2px; }
.login-lang { margin-top: 2px; }

/* ---------- acknowledged anomalies ---------- */
.anom.acked { opacity: .65; }
.anom-ack { margin: 6px 0; color: var(--ok); }
.anom-ack span { color: var(--muted); }

/* ---------- WAN quality charts: axes and values on hover ---------- */
.chart-box { position: relative; }
.chart-axis { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.chart-cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; z-index: 5; min-width: 150px; padding: 6px 9px; font-size: 12px; pointer-events: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); }
.chart-tip strong { display: block; margin-bottom: 3px; }
.chart-tip i { display: inline-block; width: 10px; height: 3px; margin-right: 6px; vertical-align: middle; }

/* ---------- console selector ---------- */
.console-sel { position: relative; }
.console-pop { min-width: 260px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; right: auto; left: 0; }
.console-item { display: flex; align-items: center; gap: 6px; }
.console-quick { display: flex; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* ---------- submenus on small screens: one row, horizontal scrolling ---------- */
@media (max-width: 900px) {
  .subbar { flex-wrap: wrap; row-gap: 6px; }
  .subtabs { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .subtabs::-webkit-scrollbar { display: none; }
  .subtab { flex: none; white-space: nowrap; scroll-snap-align: start; }
  .subbar input[type=search] { min-width: 0 !important; flex: 1 1 160px; }
}
.wanq-chart { height: auto; max-height: 260px; }
@media (max-width: 760px) {
  #userName { display: inline-block; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  .topbar { gap: 6px; }
}

/* ---------- anomalies: bulk acknowledgement ---------- */
.anom-pick { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--accent); }

/* ---------- scheduled reports: form + list ---------- */
.sched-form { padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.sched-form h4 { margin: 0 0 8px; }
.sched-channels { align-items: center; }
.sched-list-head { margin-top: 18px; padding: 0; gap: 8px; }
.sched-list-head h4 { margin: 0; }
.sched-list td.actions { white-space: nowrap; text-align: right; }
.sched-list tr.disabled td { opacity: .6; }

/* ---------- report logos: upcoming version ---------- */
.branding-card .pane-bar { padding: 0; gap: 10px; }
.branding-card .pane-bar h3 { margin: 0; }
.tag.next-version { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); border: 1px solid var(--accent); }
#settingsNav .tag.next-version { margin-left: 6px; padding: 0 6px; font-size: 10px; vertical-align: middle; }
.brand-preview { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); opacity: .8; }
.brand-slot-preview { width: 110px; height: 110px; flex: none; display: grid; place-items: center; border: 1px dashed var(--border);
  border-radius: 8px; background: #fff; }
.brand-preview ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- blocked IPs: configuration check ---------- */
.block-check { margin: 10px 0; border-left: 4px solid var(--border); }
.block-check.ok { border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
.block-check.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--panel)); }
.block-check.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--panel)); }
.block-check-head { display: flex; align-items: center; gap: 8px; }
.block-check p { margin: 6px 0; }
.block-check-issues { margin: 6px 0; padding-left: 20px; }
.block-check-issues li { margin: 2px 0; }
.block-check-issues .lvl-missing { color: var(--bad); }
.block-check details { margin-top: 6px; }
