/* ---------- fonts (embedded, no external CDN: the UI is used on an internal network) ---------- */
@font-face { font-family: "Golos Text"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/fonts/golos-text-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/fonts/golos-text-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("/static/fonts/golos-text-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("/static/fonts/golos-text-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic-600-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- tokens ----------
   Status colors are validated (scripts/validate_palette.js): lightness band, chroma floor,
   CVD separation and contrast pass in both themes. Ghost also carries a hatch texture,
   so state is never color-only. */
:root {
  --page: #ECEFEC;
  --panel: #FFFFFF;
  --ink: #141B1F;
  --muted: #5B686F;
  --rule: #D3D9D5;
  --soft: #F4F6F4;
  --focus: #1B5FC4;

  --up: #00908A;
  --down: #D8452F;
  --ghost: #7A5AC8;
  --paused: #8A959C;

  --up-tint: color-mix(in srgb, var(--up) 16%, var(--panel));
  --ghost-tint: color-mix(in srgb, var(--ghost) 12%, var(--panel));
  --miss-tint: color-mix(in srgb, var(--down) 12%, var(--panel));
  --paused-tint: color-mix(in srgb, var(--paused) 18%, var(--panel));

  --sans: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0C1216; --panel: #151D22; --ink: #DCE4E8; --muted: #8C9AA1;
    --rule: #27333A; --soft: #1A242A; --focus: #6AA2F2;
    --up: #14A096; --down: #E2503B; --ghost: #8B73E0; --paused: #6F7C84;
  }
}
:root[data-theme="dark"] {
  --page: #0C1216; --panel: #151D22; --ink: #DCE4E8; --muted: #8C9AA1;
  --rule: #27333A; --soft: #1A242A; --focus: #6AA2F2;
  --up: #14A096; --down: #E2503B; --ghost: #8B73E0; --paused: #6F7C84;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* the scrollbar appearing/disappearing must not shift the page sideways */
html { scrollbar-gutter: stable; }
/* .row and other display rules must not override the hidden attribute */
[hidden] { display: none !important; }
body {
  background: var(--page); color: var(--ink);
  font: 15px/1.5 var(--sans); min-height: 100vh; overflow-x: hidden;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; line-height: 1.2; }
h2 { font-size: 1.05rem; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.02em; }
.inline { display: inline; margin: 0; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- chrome ---------- */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 10px var(--gutter); background: var(--panel); border-bottom: 1px solid var(--rule);
}
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.logo img { display: block; flex: none; }
.logo:hover { text-decoration: none; }
.net { font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.fresh { font-size: .85rem; color: var(--muted); cursor: pointer; }
.tabs {
  display: flex; gap: 22px; padding: 0 var(--gutter); background: var(--panel);
  border-bottom: 1px solid var(--rule); overflow-x: auto;
}
.tabs a { padding: 10px 0 9px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.view { padding: var(--gutter); max-width: 1160px; margin: 0 auto; display: grid; gap: var(--gutter); }
.stage { display: contents; }
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; padding: 18px; min-width: 0; }
.panel > h2 { margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }

/* ---------- controls ----------
   Shape of the map cell: square corners (3px), 1px rule, a 2px ink ring on hover
   and focus. Colors stay neutral: the status tint is for status only. */
.btn {
  appearance: none; font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 3px; padding: 6px 12px; cursor: pointer; line-height: 1.3;
}
.btn:hover, .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); font-weight: 600; }
.btn.danger { background: var(--panel); border-color: var(--down); color: var(--ink); box-shadow: inset 0 0 0 1px var(--down); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); border-color: var(--rule); outline: none; }
.btn.sm { padding: 3px 8px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:disabled:hover { outline: none; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 3px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { width: 100%; min-height: 4.5rem; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: .88rem; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
.seg button {
  font: inherit; background: var(--panel); color: var(--muted); border: 0; padding: 5px 12px; cursor: pointer;
  border-right: 1px solid var(--rule);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.chip {
  font: inherit; font-size: .88rem; background: var(--panel); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 3px; padding: 4px 12px; cursor: pointer;
}
.chip:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.chip .n { margin-left: 6px; opacity: .65; font-family: var(--mono); font-size: .82em; }

/* ---------- status marks ---------- */
.st { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: .9rem; }
.st i { width: 10px; height: 10px; border-radius: 2px; background: var(--paused); flex: none; }
.st-up i { background: var(--up); }
.st-down i { background: var(--down); }
.st-miss i { background: var(--miss-tint); box-shadow: inset 0 0 0 2px var(--down); }
.st-ghost i { background: repeating-linear-gradient(135deg, var(--ghost) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--ghost); }
.st-paused i { background: var(--paused); }
.st-new i { background: transparent; box-shadow: inset 0 0 0 2px var(--up); }
.tag { font-size: .78rem; color: var(--muted); border: 1px solid var(--rule); border-radius: 3px; padding: 0 6px; white-space: nowrap; }

/* ---------- overview: subnet map ---------- */
.overview { display: grid; gap: var(--gutter); grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); }
.map-panel > h2 { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.map-panel > h2 .mono { font-weight: 400; color: var(--muted); font-size: .85rem; }
.subnet { display: grid; grid-template-columns: 34px repeat(16, minmax(0, 1fr)); gap: 3px; position: relative; }
.subnet .tick { font-family: var(--mono); font-size: .66rem; color: var(--muted); align-self: center; text-align: right; padding-right: 6px; }
.cell {
  aspect-ratio: 1; border-radius: 3px; display: grid; place-items: center;
  font-family: var(--mono); font-size: clamp(.5rem, 1.5vw, .7rem); letter-spacing: -.04em; line-height: 1;
  border: 1px solid var(--rule); background: transparent; color: var(--muted); position: relative; min-width: 0;
}
.cell.void { border: 0; }
.cell.free { border-style: dashed; opacity: .75; }
.cell.up { background: var(--up-tint); border-color: var(--up); color: var(--ink); }
.cell.down { background: var(--down); border-color: var(--down); color: #fff; font-weight: 600; }
.cell.miss { background: var(--miss-tint); border: 2px solid var(--down); color: var(--ink); }
.cell.ghost {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ghost) 38%, var(--panel)) 0 2px, var(--ghost-tint) 2px 5px);
  border-color: var(--ghost); color: var(--ink);
}
.cell.paused { background: var(--paused-tint); border-color: var(--paused); color: var(--muted); }
.cell.new { background: transparent; border: 2px solid var(--up); color: var(--ink); }
.cell.self::after { content: ""; position: absolute; right: 2px; top: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
/* group: a dot in the top-left corner (the server's own dot is top-right), ringed with the panel colour */
.cell.grp::before {
  content: ""; position: absolute; left: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--gc); box-shadow: 0 0 0 1px var(--panel);
}
.subnet.grouped .cell:not(.ing):not(.void) { opacity: .28; }
.subnet.grouped .cell.ing { box-shadow: 0 0 0 1px var(--ink); }
.map-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; font-size: .85rem; }
.mg {
  font: inherit; display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; cursor: pointer;
  background: transparent; border: 1px solid var(--rule); border-radius: 3px; color: var(--ink);
}
.mg .n { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.mg:hover, .mg[aria-pressed="true"] { border-color: var(--ink); }
.mg[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--ink); }
.tip-g { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tip .gtag { color: inherit; }
a.cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; text-decoration: none; z-index: 1; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--panel);
  border-radius: 3px; padding: 8px 10px; font-size: .82rem; line-height: 1.35; width: max-content; max-width: 290px; display: none;
}
.tip .mono { font-size: .85rem; }
.tip .dim { opacity: .75; }
.tip > div + div { margin-top: 3px; }
.tip-h { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-weight: 600; }
.tip-h .st { font-size: .8rem; font-weight: 400; gap: 5px; }
.tip-h .st i { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--panel) 35%, transparent); }
.tip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-f { padding-left: 8px; border-left: 2px solid color-mix(in srgb, var(--panel) 45%, transparent); }
.tip-f.bad { border-left-color: var(--down); }
.tip-n { font-family: var(--mono); font-size: .74rem; opacity: .8; letter-spacing: -.03em; }

.tally { display: grid; gap: 0; align-content: start; }
.tally a, .tally div.t {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--rule);
}
.tally > :last-child { border-bottom: 0; }
.tally .t { border-bottom: 0; }
.tally a:hover { text-decoration: none; background: var(--soft); }
.tally .n { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; }
.tally .n.alert { color: var(--down); }
.tally .hint { display: block; color: var(--muted); font-size: .8rem; }

/* ---------- attention ---------- */
.attn { display: grid; gap: 0; }
.attn-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.attn-item:last-child { border-bottom: 0; }
.attn-item .when { color: var(--muted); font-size: .88rem; text-align: right; }
.attn-item .desc { min-width: 0; overflow-wrap: anywhere; }
.attn-item .desc .muted { margin-left: 8px; font-size: .88rem; }
.all-ok { display: flex; align-items: center; gap: 10px; color: var(--ink); padding: 4px 0; }
.all-ok i { width: 10px; height: 10px; border-radius: 2px; background: var(--up); }

/* ---------- trend ---------- */
.trend svg { width: 100%; height: 110px; display: block; }
.trend .axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: 4px; }
.strip { display: grid; gap: 1px; }
.strip span { height: 14px; background: var(--soft); }
.strip span.u { background: var(--up); opacity: .55; }
.strip span.d { background: var(--down); }
.problem-row { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 0; }
.problem-row .lbl { min-width: 0; line-height: 1.25; }
.problem-row .lbl .d { display: block; font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- hosts table ---------- */
.controls { display: grid; gap: 10px; }
.controls .search { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.hosts-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.hosts-table th, .hosts-table td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.hosts-table th { color: var(--muted); font-weight: 400; font-size: .82rem; white-space: nowrap; }
.hosts-table td.num, .hosts-table th.num { text-align: right; white-space: nowrap; padding-right: 0; padding-left: 12px; }
.hosts-table tbody tr:hover { background: var(--soft); }
.hosts-table tr.is-down td:first-child { box-shadow: inset 3px 0 0 var(--down); padding-left: 10px; }
.hosts-table td.cmt { color: var(--muted); max-width: 300px; overflow-wrap: anywhere; }
.hosts-table td.dsc { min-width: 150px; overflow-wrap: anywhere; }

/* ---------- host page ---------- */
.head-panel { display: grid; gap: 14px; }
.head-panel .title { display: grid; gap: 4px; }
.head-panel .ip { font-family: var(--mono); font-size: 1.5rem; letter-spacing: -.03em; font-weight: 600; word-break: break-all; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; }
.kv > div > span { display: block; color: var(--muted); font-size: .8rem; }
.kv .big { font-family: var(--mono); font-size: 1.25rem; font-weight: 600; }
.edit-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.edit-grid .wide { grid-column: 1 / -1; }
.check-out { font-size: .92rem; display: grid; gap: 2px; margin-bottom: 10px; }
.check-out:empty { display: none; }
.lat-head h2 { margin: 0; }
.check-out .ok { color: var(--up); font-weight: 600; }
.check-out .bad { color: var(--down); font-weight: 600; }
.err { color: var(--down); }
.ok-msg { color: var(--up); font-weight: 600; }
.timeline { position: relative; height: 18px; background: var(--soft); border-radius: 3px; overflow: hidden; }
.timeline i { position: absolute; top: 0; bottom: 0; background: var(--down); }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: 4px; }

/* ---------- events ---------- */
.ev { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 2px 14px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.ev:last-child { border-bottom: 0; }
.ev .when { color: var(--muted); font-size: .88rem; font-family: var(--mono); }
.ev .note { color: var(--muted); font-size: .85rem; grid-column: 2; font-family: var(--mono); overflow-wrap: anywhere; line-height: 1.6; }
.ev .tag { white-space: normal; }
.mac { white-space: nowrap; }
.empty { color: var(--muted); padding: 10px 0; }

@media (max-width: 860px) {
  .overview { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  :root { --gutter: 10px; }
  .panel { padding: 14px; }
  .map-panel { padding: 12px 8px; }
  .map-panel > h2 { padding: 0 4px; }
  .subnet { grid-template-columns: 24px repeat(16, minmax(0, 1fr)); gap: 2px; }
  .subnet .tick { font-size: .56rem; padding-right: 3px; }
  .cell { font-size: .5625rem; border-radius: 2px; }
  .cell.grp::before { width: 4px; height: 4px; left: 1px; top: 1px; }
  .tip { max-width: min(250px, calc(100vw - 40px)); }
  .attn-item { grid-template-columns: auto minmax(0, 1fr); }
  .attn-item .when { grid-column: 2; text-align: left; }
  .problem-row { grid-template-columns: minmax(0, 1fr); }
  .ev { grid-template-columns: minmax(0, 1fr); }
  .ev .note { grid-column: 1; }
  .tbl-wrap { margin: 0 -14px; padding: 0 14px; }

  /* hosts list: one card per host instead of a seven-column table */
  .hosts-table.cards, .hosts-table.cards tbody { display: block; }
  .hosts-table.cards thead { display: none; }
  .hosts-table.cards tr {
    display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px;
    padding: 10px 0; border-bottom: 1px solid var(--rule);
  }
  /* the address is always read whole; a long status wraps into the second column */
  .hosts-table.cards .c-ip { min-width: max-content; }
  .hosts-table.cards tbody tr:last-child { border-bottom: 0; }
  .hosts-table.cards td, .hosts-table.cards td.num { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  .hosts-table.cards td:empty { display: none; }
  .hosts-table.cards tr.is-down { box-shadow: inset 3px 0 0 var(--down); padding-left: 10px; }
  .hosts-table.cards tr.is-down td:first-child { box-shadow: none; padding-left: 0; }
  .hosts-table.cards .c-st { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 6px; }
  .hosts-table.cards .c-st > * { min-width: 0; }
  .hosts-table.cards .dsc, .hosts-table.cards .cmt, .hosts-table.cards .c-grp { grid-column: 1 / -1; }
  .hosts-table.cards .cmt, .hosts-table.cards .c-grp { font-size: .86rem; color: var(--muted); }
  .hosts-table.cards .c-up::before, .hosts-table.cards .c-ping::before { content: attr(data-l) " "; color: var(--muted); font-family: var(--sans); }
  .hosts-table.cards .c-al { text-align: right; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- IP text by host state ---------- */
/* text tones mix the status color with ink: readable (≥4.5:1) on panel in both themes */
:root {
  --up-text: color-mix(in srgb, var(--up) 70%, var(--ink));
  --down-text: color-mix(in srgb, var(--down) 80%, var(--ink));
  --ghost-text: color-mix(in srgb, var(--ghost) 75%, var(--ink));
}
.ip-st.ip-up { color: var(--up-text); }
.ip-st.ip-down { color: var(--down-text); font-weight: 600; }
.ip-st.ip-miss { color: var(--down-text); }
.ip-st.ip-ghost { color: var(--ghost-text); }
.ip-st.ip-paused { color: var(--muted); }
.ip-st.ip-new { color: var(--ink); }

/* Filtered lists (hosts, events) keep at least a screen of height: a short
   result must not shrink the page under the filters and snap the scroll. */
#list, #ev { min-height: 100vh; }

/* ---------- hourly misses chart ---------- */
.trend-about { font-size: .88rem; margin: 0 0 12px; max-width: 72ch; }
.trend-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-bottom: 2px; }
.trend-legend { gap: 6px 16px; margin-top: 8px; }
.trend-legend .lg-ok { background: var(--up); opacity: .35; }
.trend-legend .lg-bad { background: var(--down); }
.trend-legend .lg-none { background: var(--rule); }
.trend-sub { font-size: .9rem; font-weight: 600; margin: 16px 0 8px; }

/* ---------- theme switch: cross-fade instead of a one-frame flip ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; animation-timing-function: ease; }
.theme-fade, .theme-fade *, .theme-fade *::before, .theme-fade *::after {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease, box-shadow .35s ease !important;
}
html { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ---------- copy IP, toast ---------- */
.ip-copy {
  font: inherit; color: inherit; background: none; border: 0; padding: 0 4px; margin: 0 -4px;
  cursor: copy; border-radius: 3px; text-align: left; display: inline-flex; align-items: center; gap: 8px;
}
.ip-copy:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.ip-copy .hint { font-family: var(--sans); font-size: .78rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 12px); z-index: 50;
  background: var(--ink); color: var(--panel); border-radius: 3px; padding: 8px 14px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--down); color: #fff; }

/* ---------- group colors: any #rrggbb via --gc; the name is always written ---------- */
.gtag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.gtag i { width: 10px; height: 10px; border-radius: 2px; flex: none; display: none; }
.gtag.has i { display: block; background: var(--gc); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent); }

/* compact picker: one button, 24-colour popover */
.cpick { position: relative; display: inline-block; }
.cpick-btn {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: 3px;
  padding: 4px 9px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; line-height: 1.3; font-size: .88rem;
}
.cpick-btn:hover, .cpick-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cpick-btn i { width: 14px; height: 14px; border-radius: 2px; flex: none; background: transparent; box-shadow: inset 0 0 0 1px var(--muted); }
.cpick-btn i[style] { background: var(--gc); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent); }
.cpick-l:empty { display: none; }
.cpick-n { color: var(--muted); }
.cpick-btn:disabled { opacity: .5; cursor: default; }
.cpick-pop {
  position: absolute; z-index: 20; left: 0; top: calc(100% + 4px); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 3px; padding: 8px; display: grid; gap: 8px;
  box-shadow: 0 6px 18px rgb(0 0 0 / .2); width: max-content; max-width: calc(100vw - 24px);
}
.cpick-grid { display: grid; grid-template-columns: repeat(8, 26px); gap: 4px; }
.cpick-c {
  width: 26px; height: 26px; border-radius: 3px; border: 0; padding: 0; cursor: pointer; background: var(--gc);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent);
}
.cpick-c:hover, .cpick-c:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.cpick-c[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.cpick-c[aria-pressed="true"]::after { content: "✓"; color: #fff; font-size: .8rem; text-shadow: 0 0 2px rgb(0 0 0 / .6); }
.cpick-free { display: flex; gap: 6px; align-items: center; }
.cpick-native { width: 34px; height: 28px; padding: 1px; border-radius: 3px; cursor: pointer; flex: none; }
.cpick-hex { width: 84px; padding: 4px 6px; }
.cpick-hex.bad { border-color: var(--down); }
@media (max-width: 400px) { .cpick-grid { grid-template-columns: repeat(8, 1fr); } .cpick-c { width: auto; aspect-ratio: 1; height: auto; } }

/* accordions: host description, groups */
.acc > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; border-radius: 3px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::before { content: "▸"; color: var(--muted); width: 1em; flex: none; }
.acc[open] > summary::before { content: "▾"; }
.acc > summary h2 { margin: 0; }
.acc-hint { font-size: .85rem; }
.acc[open] > summary { margin-bottom: 14px; }
.acc > summary:hover h2 { text-decoration: underline; text-underline-offset: 3px; }

/* group manager */
/* one grid for all rows (subgrid): pickers, names, counts and buttons line up */
.gm-list { display: grid; grid-template-columns: auto minmax(140px, 280px) auto auto 1fr; gap: 6px 10px; align-items: center; }
.gm-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; }
.gm-row .cpick { justify-self: start; }
.gm-acts { display: inline-flex; gap: 4px; align-items: center; }
.btn.quiet.gm-del:hover { color: var(--down-text); border-color: var(--down); }
.gm-confirm { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: .88rem;
  padding: 6px 8px; border-left: 2px solid var(--down); background: var(--soft); }
.gm-new { padding-top: 8px; border-top: 1px dashed var(--rule); margin-top: 4px; }
.gm-msg { min-height: 1.3em; font-size: .88rem; margin: 8px 0 4px; }
.gm-msg:empty { display: none; }
@media (max-width: 560px) {
  .gm-list { grid-template-columns: auto minmax(0, 1fr); }
  .gm-row { grid-template-columns: subgrid; row-gap: 4px; }
  .gm-row .cpick-n { display: none; }
  .gm-n { display: none; }
  .gm-acts { grid-column: 2; justify-content: flex-start; }
  .gm-row:not(:first-child) { padding-top: 6px; border-top: 1px solid var(--rule); }
}
.grp-field .row { align-items: center; }
.grp-note { font-size: .8rem; color: var(--muted); }
.grp-note:empty { display: none; }

/* MAC on the host card */
.mac-copy {
  font-size: .85rem; color: var(--ink); background: none; border: 0; padding: 0 3px; margin: 0 -3px; cursor: copy;
  border-radius: 3px; text-align: left; letter-spacing: -.03em;
}
.mac-copy:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.kv > .mac-multi { grid-column: 1 / -1; display: grid; gap: 4px; justify-items: start; }
.kv > .mac-multi > span { display: block; color: var(--muted); font-size: .8rem; }
.mac-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.mac-list li { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: .88rem; }
.tag.now { color: var(--down-text); border-color: var(--down); }
.mac-more > summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.mac-more[open] > summary { margin-bottom: 4px; }
/* ---------- open ports: quick actions ---------- */
.port-acts { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.port-acts details { position: relative; }
.port-acts summary { list-style: none; }
.port-acts summary::-webkit-details-marker { display: none; }
.port-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 6; min-width: 240px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 3px; padding: 4px;
  box-shadow: 0 6px 18px rgb(0 0 0 / .18); display: grid;
}
.port-menu a, .port-menu button {
  font: inherit; font-size: .88rem; text-align: left; color: var(--ink); background: none; border: 0;
  padding: 6px 8px; border-radius: 3px; cursor: pointer; display: grid; gap: 0;
}
.port-menu a:hover, .port-menu button:hover, .port-menu a:focus-visible, .port-menu button:focus-visible { background: var(--soft); text-decoration: none; }
.port-menu .cmd { font-family: var(--mono); font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.ports-table td { vertical-align: middle; }
.ports-table .c-act { padding-left: 16px; }
@media (max-width: 560px) {
  .ports-table .c-rtt { display: none; }
  .ports-table .c-act { padding-left: 8px; }
  .port-acts { flex-wrap: nowrap; }
}

/* ---------- ping latency ---------- */
.lat-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lat-verdict { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.lat-verdict i { width: 10px; height: 10px; border-radius: 2px; background: var(--up); flex: none; }
.lat-verdict.bad i { background: var(--down); }
.lat-verdict.none i { background: var(--rule); }
.lat-chart { position: relative; margin-top: 12px; }
.lat-chart svg { width: 100%; height: 140px; display: block; overflow: visible; }
.lat-chart .ytick { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.lat-legend { gap: 6px 16px; margin-top: 8px; font-size: .85rem; }
.lat-legend .lg-med { background: var(--focus); height: 2px; width: 14px; }
.lat-legend .lg-band { background: color-mix(in srgb, var(--focus) 18%, transparent); }
.lat-legend .lg-base { background: none; border-top: 2px dashed var(--muted); height: 0; width: 14px; }
.lat-legend .lg-loss { background: var(--down); }
.lat-tip {
  position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--panel);
  border-radius: 3px; padding: 6px 9px; font-size: .8rem; line-height: 1.35; white-space: nowrap; display: none;
}
.c-ping { white-space: nowrap; }
.deg-tag { color: var(--down-text); border-color: var(--down); }

/* ---------- subnet calculator (in "Адреса и маски") ---------- */
.netcalc { display: grid; gap: 8px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--rule); }
.netcalc-h { font-size: .95rem; }
.netcalc input { width: 100%; }
.nc-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.nc-quick .chip { font-family: var(--mono); font-size: .78rem; padding: 2px 7px; }
.nc-err:empty { display: none; }
.nc-err { font-size: .85rem; }
.nc-out { margin: 0; display: grid; gap: 2px; font-size: .86rem; }
.nc-out div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.nc-out dt { color: var(--muted); }
.nc-out dd { margin: 0; overflow-wrap: anywhere; }
.nc-in-map { font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.nc-in-map .st { font-size: .85rem; gap: 5px; font-family: var(--mono); }
.subnet.ranged .cell:not(.inr):not(.void) { opacity: .28; }
.subnet.ranged .cell.inr { box-shadow: 0 0 0 1px var(--ink); }

/* ---------- misses chart hover ---------- */
.trend-bars { cursor: crosshair; touch-action: pan-y; }
.trend-tip { max-width: 300px; }
.trend-tip .tip-f { font-family: var(--mono); font-size: .76rem; letter-spacing: -.02em; }
.trend-tip .tip-f .dim, .trend-tip .tip-f .mono { font-size: .76rem; }
.trend-tip .tip-f .dim { font-family: var(--sans); }
.strip span { cursor: default; }

/* ---------- header clock ---------- */
.clock { font-family: var(--mono); font-size: .85rem; color: var(--ink); white-space: nowrap; letter-spacing: -.02em; }
.clock .d { color: var(--muted); margin-right: 6px; }
@media (max-width: 560px) { .clock .wd, .clock .yr { display: none; } }

/* theme switch: one monochrome glyph (☀︎ / ☾︎), square like a map cell */
.btn.quiet.theme-btn {
  font-family: "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols", "Apple Symbols", var(--sans);
  font-size: 1.2rem; line-height: 1; width: 34px; height: 32px; padding: 0;
  display: inline-grid; place-items: center; color: var(--ink);
  font-variant-emoji: text;
}

/* ---------- host quick edit (in the head of the card) ---------- */
.ip-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
#head-view { display: grid; gap: 4px; }
#head-view.editable h1 { cursor: text; }
.head-note { white-space: pre-line; }
.edit-inline { display: grid; gap: 8px; max-width: 900px; }
.edit-inline .ed-title { font: inherit; font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; padding: 4px 8px; }
.edit-inline .ed-note { min-height: 2.6rem; font-size: .92rem; }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ed-row .grp-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ed-mon { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; cursor: pointer; }
.ed-keys { font-size: .8rem; }
#forget-row { gap: 8px; font-size: .88rem; }
#forget-row b { font-weight: 600; }
#forget-msg:empty { display: none; }
.btn.danger-q { color: var(--down-text); }
.btn.danger-q:hover { box-shadow: inset 0 0 0 1px var(--down); }
@media (max-width: 640px) { .ed-keys { display: none; } }

/* ---------- filter bar (Hosts, Events) ---------- */
.fpanel { gap: 10px; }
.fbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.fbar .search { flex: 1 1 260px; width: auto; }
.fsel { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.fsel select { color: var(--ink); }
.fchips .chip.zero { opacity: .55; }
.fmeta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; min-height: 28px; font-size: .88rem; }
.clear-row { gap: 6px 8px; font-size: .88rem; }
.clear-msg:empty { display: none; }
.clear-msg { font-size: .85rem; }
@media (max-width: 560px) {
  .fbar .search { flex-basis: 100%; }
  .fsel { flex: 1 1 140px; }
  .fsel select { flex: 1; min-width: 0; }
  /* one swipeable line of chips instead of three wrapped rows */
  .fchips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 2px 14px 4px; scrollbar-width: none; }
  .fchips::-webkit-scrollbar { display: none; }
  .fchips .chip { flex: none; }
  .clear-row { flex-basis: 100%; }
}

/* ---------- MAC page ---------- */
.mac-sum { font-size: .86rem; margin-bottom: 10px; max-width: 90ch; }
.mrow { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.mrow:last-child { border-bottom: 0; }
.mrow.is-shared { box-shadow: inset 3px 0 0 var(--ghost); padding-left: 10px; }
.mrow.is-conf { box-shadow: inset 3px 0 0 var(--down); padding-left: 10px; }
.mrow-mac { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.mrow-ips { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; min-width: 0; }
.mrow-n, .mrow-t { font-size: .85rem; margin-right: 4px; }
.mrow-t { margin-left: 6px; }
.mac-verdict { grid-column: 2; font-size: .86rem; margin: 2px 0 0; }
.mac-verdict .bad { color: var(--down-text); font-weight: 600; }
.ipchip {
  font-size: .82rem; padding: 1px 6px; border: 1px solid var(--rule); border-radius: 3px; background: var(--panel);
  letter-spacing: -.02em;
}
.ipchip:hover { outline: 2px solid var(--ink); outline-offset: 1px; text-decoration: none; }
.ipchip.old { border-style: dashed; opacity: .6; }
.ipchip.conf { border-color: var(--down); box-shadow: inset 0 0 0 1px var(--down); }
.vtag { font-size: .72rem; }
.tag-link { color: var(--ink); }
.tag-link:hover { outline: 2px solid var(--ink); outline-offset: 1px; text-decoration: none; }
.mac-one .mac-line { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.mac-others { font-size: .82rem; color: var(--muted); }
.mac-others:hover { color: var(--ink); }
@media (max-width: 560px) {
  .mrow { grid-template-columns: minmax(0, 1fr); }
  .mac-verdict { grid-column: 1; }
}

/* ---------- auto refresh ---------- */
.fresh.stale { color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; }
.btn.quiet.auto-btn { font-size: .8rem; padding: 2px 7px; border: 1px solid var(--rule); color: var(--muted); }
.btn.quiet.auto-btn[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.btn.quiet.auto-btn[aria-pressed="true"]::before { content: "● "; color: var(--up); font-size: .7em; vertical-align: .15em; }

/* ---------- running scan badge in the header ---------- */
.scan-badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; white-space: nowrap;
  padding: 3px 9px; border: 1px solid var(--ink); border-radius: 3px; color: var(--ink); background: var(--panel);
  font-variant-numeric: tabular-nums;
}
.scan-badge:hover { outline: 2px solid var(--ink); outline-offset: 1px; text-decoration: none; }
.scan-badge.run i { width: 8px; height: 8px; border-radius: 50%; background: var(--up); flex: none; animation: scanpulse 1.2s ease-in-out infinite; }
.scan-badge.done { border-color: var(--rule); color: var(--muted); }
@keyframes scanpulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .scan-badge.run i { animation: none; } }
.panel.flash { animation: panelflash 1.6s ease; }
@keyframes panelflash { 0%, 40% { box-shadow: 0 0 0 3px var(--focus); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- event status (alert lifecycle) ---------- */
.evs { display: inline-block; font-size: .76rem; padding: 0 6px; border-radius: 3px; border: 1px solid var(--rule); white-space: nowrap; line-height: 1.5; }
.evs-active { color: var(--down-text); border-color: var(--down); font-weight: 600; }
.evs-resolved { color: var(--up-text); border-color: var(--up); }
.ev-st { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: .85rem; margin-top: 2px; }
.ev-act { display: inline-flex; gap: 6px; }
.ev-hint { font-size: .8rem; }
.ev-resolve { gap: 6px; }
.ev-resolve input { width: min(320px, 60vw); padding: 4px 8px; font-size: .88rem; }
.ev.ev-active { box-shadow: inset 3px 0 0 var(--down); padding-left: 10px; }
@media (max-width: 560px) { .ev-st { grid-column: 1; } }

/* self-diagnosis of an outage */
.ev-diag { grid-column: 2; display: grid; gap: 2px; font-size: .85rem; margin-top: 4px; padding: 6px 10px; background: var(--soft); border-left: 2px solid var(--rule); max-width: 90ch; }
.ev.ev-active .ev-diag { border-left-color: var(--down); }
.ev-diag-h { font-size: .74rem; color: var(--muted); text-transform: lowercase; }
.attn-diag { display: block; font-size: .82rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 560px) { .ev-diag { grid-column: 1; } }

/* Hosts: view switch "по адресам | по MAC" */
.vswitch { flex: none; }
.vswitch button { white-space: nowrap; }
@media (max-width: 640px) { .vswitch { flex-basis: 100%; } .vswitch button { flex: 1; } }
/* MAC history badge: conflicts / MAC changes in the journal */
.mac-hist { margin-left: 6px; }
.mac-hist.is-active { border-color: var(--down-text); color: var(--down-text); }
/* MAC in event notes: link to the MAC view */
a.mac { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }
a.mac:hover { text-decoration-style: solid; }

/* host card: back link and neighbours by address */
.host-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.hn-pair { display: inline-flex; gap: 6px; }
.hn { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border: 1px solid var(--rule); border-radius: 3px; color: var(--ink); font-size: .9rem; text-decoration: none; }
a.hn:hover { border-color: var(--ink); text-decoration: none; }
.hn.off { color: var(--muted); opacity: .45; }

/* ---------- switches ---------- */
/* summary strip on the overview */
.sw-plaque { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 18px; color: var(--ink); }
.sw-plaque:hover { text-decoration: none; background: var(--soft); }
.sw-plaque-h { font-weight: 600; }
.sw-plaque .n { font-family: var(--mono); font-size: 1.15rem; font-weight: 600; }
.sw-plaque .n.alert, .sw-plaque .alert { color: var(--down-text); }
.sw-plaque .alert { font-weight: 600; }
.sw-plaque-t { flex: 1; min-width: 0; font-size: .9rem; }
/* list */
.sw-round { margin-left: auto; font-size: .82rem; }
.sw-table td.cmt { max-width: 260px; }
.sw-table .c-st .tag { margin-left: 2px; }
/* card: edit form */
.sw-edit label.field { max-width: 900px; }
.sw-edit input[type="text"] { width: 100%; }
.sw-hint { font-size: .8rem; margin: 0; }
/* journal: folded mass events of switches */
.ev-more > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; border-radius: 3px; }
.ev-more > summary::-webkit-details-marker { display: none; }
.ev-more > summary::before { content: "▸"; color: var(--muted); width: 1em; flex: none; }
.ev-more[open] > summary::before { content: "▾"; }
.ev-more[open] .ev-more-h { display: none; }
.ev-more-h { font-size: .85rem; }
.ev-members { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; font-size: .9rem; }
.ev-members li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .sw-round { margin-left: 0; flex-basis: 100%; } .sw-plaque { padding: 12px 14px; } }

/* ---------- channels and tree (stage 3.2) ---------- */
.sw-plaques { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }
.sw-plaques > .sw-plaque { min-width: 0; }
@media (max-width: 560px) { .sw-plaques { grid-template-columns: minmax(0, 1fr); } }
.attn-more > summary { cursor: pointer; }
.attn-list { list-style: none; margin: 8px 0 2px; padding: 0 0 0 14px; display: grid; gap: 4px; font-size: .9rem; }
.attn-list li { overflow-wrap: anywhere; }
.ev-why { font-size: .85rem; }

/* card: path from the root */
.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: .92rem; }
.crumbs .sep { color: var(--muted); }
.crumbs b { font-weight: 600; }
.lk-ports { letter-spacing: -.02em; overflow-wrap: anywhere; }
.lk-slow { color: var(--down-text); font-weight: 600; }
.lk-exp { font-size: .78rem; font-family: var(--sans); }
.lk-why, .lk-loc, .lk-src { font-size: .8rem; white-space: normal; }
.lk-table td.c-st { min-width: 130px; }
.lk-table td.lk-wide { min-width: 200px; }
.sw-table .c-lk { white-space: nowrap; }

/* tree: opened levels only */
.tr-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
  padding: 6px 0 6px calc(min(var(--d, 0), 6) * 18px); border-bottom: 1px solid var(--rule);
}
.tr-row.is-down { box-shadow: inset 3px 0 0 var(--down); padding-left: calc(min(var(--d, 0), 6) * 18px + 8px); }
.tr-tg {
  font: inherit; width: 24px; height: 24px; padding: 0; flex: none; text-align: center; line-height: 22px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 3px; cursor: pointer; align-self: center;
}
.tr-tg:hover, .tr-tg:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.tr-tg.off { border-color: transparent; background: none; cursor: default; }
.tr-main { min-width: 0; flex: 1 1 220px; overflow-wrap: anywhere; }
.tr-loc { color: var(--muted); font-size: .9rem; }
.tr-st { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: .9rem; }
.tr-bad { color: var(--down-text); font-size: .85rem; font-weight: 600; }
.tr-below { font-size: .85rem; }
.tr-unk { margin-top: 14px; }
.tr-unk > summary { cursor: pointer; color: var(--muted); }
.tr-unk-body { margin-top: 8px; }

@media (max-width: 560px) {
  /* channels table: a card per channel; numbers sit in one line */
  .lk-table.cards tr { display: flex; flex-wrap: wrap; gap: 3px 12px; }
  .lk-table.cards .c-ip { flex: 1 1 40%; }
  .lk-table.cards td.c-st { display: block; min-width: 0; flex: 1 1 40%; text-align: right; }
  .lk-table.cards .lk-wide { flex-basis: 100%; min-width: 0; }
  .lk-table.cards td.num { flex: none; }
  .lk-table.cards td[data-l]::before { content: attr(data-l) " "; color: var(--muted); font-family: var(--sans); }
  .tr-row { gap: 2px 8px; }
  .tr-main { flex-basis: calc(100% - 40px); }
}
.tr-dev { margin-bottom: 10px; font-size: .9rem; }

/* ---------- who is signed in ---------- */
.whoami { font-family: var(--mono); font-size: .85rem; color: var(--ink); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- board: big text, one block per segment ---------- */
.board { display: grid; gap: var(--gutter); }
.bd-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 6px; }
.bd-head h2 { font-size: 1.3rem; }
.bd-vlan { color: var(--muted); font-size: .95rem; }
.bd-count { margin-left: auto; font-size: 1.05rem; font-weight: 600; }
.bd-count i { width: 12px; height: 12px; }
.bd-sub { font-size: .95rem; margin: 18px 0 4px; }
.bd-sub .muted { font-weight: 400; margin-left: 6px; }
.bd-list { list-style: none; margin: 0; padding: 0; }
.bd-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: baseline;
  padding: 12px 0 12px 12px; border-bottom: 1px solid var(--rule); box-shadow: inset 3px 0 0 var(--down);
}
.bd-list > .bd-item:last-child { border-bottom: 0; }
.bd-item.ok { box-shadow: inset 3px 0 0 var(--up); }
.bd-name { min-width: 0; font-size: 1.1rem; line-height: 1.35; overflow-wrap: anywhere; }
.bd-ip { font-size: 1.15rem; font-weight: 600; }
.bd-title { margin-left: 6px; }
.bd-time { text-align: right; font-size: .95rem; white-space: nowrap; font-family: var(--mono); }
.bd-why { grid-column: 1 / -1; font-size: .95rem; overflow-wrap: anywhere; }
.bd-ok { font-size: 1.15rem; padding: 10px 0 4px; }
.bd-ok i { width: 12px; height: 12px; }
.bd-more { margin-top: 4px; }
.bd-more > summary { cursor: pointer; padding: 8px 0; color: var(--muted); border-radius: 3px; }
.bd-more > summary:hover { color: var(--ink); }
@media (max-width: 560px) {
  .bd-count { margin-left: 0; flex-basis: 100%; }
  .bd-item { grid-template-columns: minmax(0, 1fr); padding-left: 10px; }
  .bd-time { text-align: left; white-space: normal; }
  .whoami { max-width: 10ch; }
}

/* ---------- users (admin) ---------- */
.u-list { display: grid; }
.u-row {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 6px 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.u-row:last-child { border-bottom: 0; }
.u-row.off .u-login { color: var(--muted); }
.u-login { font-weight: 600; font-size: 1.02rem; margin-right: 6px; }
.u-id, .u-info { min-width: 0; overflow-wrap: anywhere; }
.u-id .tag { vertical-align: middle; }
.u-off { color: var(--down-text); border-color: var(--down); }
.u-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.u-slot { grid-column: 1 / -1; }
.u-slot:empty { display: none; }
.u-panel { background: var(--soft); border-left: 2px solid var(--rule); padding: 12px; margin-top: 4px; }
.u-form { display: grid; gap: 12px; }
.u-form .row { gap: 8px; }
.u-segpick { border: 1px solid var(--rule); border-radius: 3px; padding: 6px 12px 8px; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.u-segpick legend { font-size: .85rem; color: var(--muted); padding: 0 4px; }
.u-chk { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.u-chk input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.u-adm-note { font-size: .88rem; padding: 4px 0; }
.u-hint { font-size: .85rem; }
.u-msg:empty, .u-err:empty { display: none; }
.u-msg { font-size: .9rem; margin-top: 8px; }
.u-del { margin-top: 4px; }
@media (max-width: 720px) {
  .u-row { grid-template-columns: minmax(0, 1fr); }
  .u-acts { justify-content: flex-start; }
  .u-acts .btn { padding: 7px 12px; }
}

.au-row { display: grid; grid-template-columns: 110px minmax(0, 1.3fr) minmax(0, 1fr); gap: 2px 14px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: .92rem; }
.au-row.bad .au-what strong { color: var(--down-text); }
.au-when { color: var(--muted); font-family: var(--mono); font-size: .88rem; }
.au-detail { color: var(--muted); overflow-wrap: anywhere; }
.au-who { overflow-wrap: anywhere; }
#au .row { margin-top: 10px; }
@media (max-width: 720px) {
  .au-row { grid-template-columns: minmax(0, 1fr); }
}
