@font-face { font-family: "Lato"; font-weight: 300; font-display: swap; src: url("./fonts/lato-300.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 400; font-display: swap; src: url("./fonts/lato-400.woff2") format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 700; font-display: swap; src: url("./fonts/lato-700.woff2") format("woff2"); }

:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --tint1: #f7f8fa;    /* first (lighter) grey tint  — detail panel */
  --tint2: #f1f4f6;    /* second (darker) grey tint  — top bar */
  --border: #e6e9ec;
  --border-strong: #d6dade;
  --ink: #1f2933;
  --muted: #7b8794;
  --faint: #aeb6bf;
  --accent: #006fff;
  --accent-soft: #eaf2ff;
  --link: #0559c9;
  --green: #12b76a;
  --amber: #f79009;
  --red: #f04438;
  --grey: #b7bec6;
  --topbar: 50px;
  --rail: 50px;    /* == --topbar so the square corner logo fits exactly */
  --sidepanel: 232px;
  --detail: 356px;
  --font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 13px/1.35 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; color: inherit; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
svg { display: block; }

/* buttons */
.btn { border: 1px solid var(--border-strong); background: #fff; border-radius: 5px; padding: 6px 12px; font-weight: 600; }
.btn:hover { background: #f2f4f6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0063e6; }
.btn.block { width: 100%; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }

/* login */
.login-wrap { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 24px rgba(20,30,45,.07); padding: 26px; width: 312px; }
.login-logo { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); margin-bottom: 14px; position: relative; }
.login-logo::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #fff; }
.login-card h1 { margin: 0 0 2px; font-size: 19px; }
.login-card .sub { margin: 0 0 20px; color: var(--muted); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .sp-search input { width: 100%; padding: 8px 10px; font: inherit; border: 1px solid var(--border-strong); border-radius: 5px; background: #fff; }
.field input:focus, .sp-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.err { color: var(--red); font-size: 12px; margin: 9px 0 0; min-height: 15px; }

/* shell grid: rail (full height) | topbar over the rest, then sidepanel|content.
   The detail panel is NOT a grid column — it overlays the content (see #detail). */
#shell { display: grid; height: 100vh;
  grid-template-columns: var(--rail) var(--sidepanel) 1fr;
  grid-template-rows: var(--topbar) 1fr; }
#rail { grid-row: 1 / 3; grid-column: 1; }
#topbar { grid-row: 1; grid-column: 2 / 4; }
#sidepanel { grid-row: 2; grid-column: 2; }
#content { grid-row: 2; grid-column: 3; }

/* Collapsed devices panel: the column goes to zero so the table gets the room.
   The toggle lives in the topbar, so it stays reachable in both states. */
#shell.sp-collapsed { grid-template-columns: var(--rail) 0 1fr; }
#shell.sp-collapsed #sidepanel { display: none; }

/* Phone: tighten the table so more columns fit on screen. Widths come from
   COL_NARROW in app.js; this trims the padding to match. Keep in sync with
   NARROW_W (820px) there. */
@media (max-width: 820px) {
  .tbl thead th { padding: 7px 7px; }
  .tbl tbody td { padding: 6px 7px; }
  .tbl tbody td.td-cfglink { padding-left: 4px; padding-right: 4px; }
  .td-cfglink .cfg-open { padding: 3px; }
}

/* rail */
#rail { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 0 0 8px; gap: 6px; z-index: 3; }
/* Square brand logo, flush in the top-left corner — fills the rail width and the
   top-bar height, so its bottom edge lines up with the top bar. */
.rail-logo { width: 100%; height: var(--topbar); background: url("./logo.svg") center/cover no-repeat; border-bottom: 1px solid var(--border); margin-bottom: 4px; flex: 0 0 auto; }
.rail-avatar { width: 31px; height: 31px; border-radius: 50%; border: 1px solid var(--border-strong); background: #fff; font-weight: 700; font-size: 12px; margin-bottom: 3px; }
.rail-avatar:hover { border-color: var(--accent); color: var(--accent); }
#site-btn { position: relative; }
#site-btn.has-pending::after { content: ""; position: absolute; top: -1px; right: -1px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid #fff; }
.rail-nav { display: flex; flex-direction: column; gap: 3px; }
.rail-icon { width: 32px; height: 32px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.rail-icon svg { width: 19px; height: 19px; }
.rail-icon:hover { background: #f0f2f4; color: var(--ink); }
.rail-icon.active { background: var(--accent-soft); color: var(--accent); }

/* topbar */
#topbar { background: var(--tint2); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 12px; z-index: 2; }
.tb-title { font-size: 14px; font-weight: 700; padding: 2px 6px; margin-left: -6px;
  border: 1px solid transparent; border-radius: 5px; cursor: text; }
.tb-title:hover { background: rgba(127, 127, 127, .12); }
.tb-title.editing { background: var(--panel); border-color: var(--border); outline: none;
  min-width: 60px; }
.tb-sp-toggle { border: 0; background: transparent; color: var(--muted); padding: 3px;
  margin-left: -4px; border-radius: 5px; display: grid; place-items: center; cursor: pointer; }
.tb-sp-toggle:hover { background: rgba(127, 127, 127, .12); color: var(--accent); }
.tb-sp-toggle svg { width: 17px; height: 17px; display: block; }
.tb-spacer { flex: 1; }
.tb-user { position: relative; }
#user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px; border-radius: 6px; }
#user-btn:hover { background: #f2f4f6; }
.tb-avatar { width: 28px; height: 28px; border-radius: 50%; background: transparent; color: var(--accent); display: grid; place-items: center; }
.tb-avatar svg { width: 18px; height: 18px; }
#user-btn:hover .tb-avatar { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.tb-menu { position: absolute; right: 0; top: 40px; width: 190px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px rgba(20,30,45,.12); overflow: hidden; z-index: 20; }
.tb-menu-head { padding: 11px 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.tb-menu-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 14px; font-weight: 600; }
.tb-menu-item:hover { background: #f2f4f6; }
.tb-menu-ver { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }

/* Changelog modal */
.changelog-panel { position: relative; z-index: 1; width: min(680px, 94vw); margin: 8vh auto 0; max-height: 82vh;
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.22); overflow: hidden; }
.changelog-body { padding: 6px 20px 20px; overflow-y: auto; font-size: 13px; line-height: 1.55; color: var(--ink); }
.changelog-body h3 { font-size: 15px; margin: 20px 0 4px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.changelog-body h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 4px; }
.changelog-body ul { margin: 0 0 6px; padding-left: 18px; }
.changelog-body li { margin: 3px 0; }
.changelog-body code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.changelog-body a { color: var(--accent); }

/* Help center */
.tb-help { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: #fff; color: var(--muted); font-weight: 700; font-size: 13px; line-height: 1;
  display: grid; place-items: center; margin-right: 4px; }
.tb-help:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.help-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border-strong); background: #fff; color: var(--muted);
  font-size: 10px; font-weight: 700; line-height: 1; vertical-align: middle; cursor: pointer; }
.help-dot:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
h3 .help-dot, h4 .help-dot { margin-left: 6px; }
.help-panel { position: relative; z-index: 1; width: min(860px, 95vw); margin: 7vh auto 0; height: min(78vh, 720px);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.22); overflow: hidden; }
.help-main { flex: 1; display: flex; min-height: 0; }
.help-nav { flex: 0 0 220px; overflow-y: auto; border-right: 1px solid var(--border); background: var(--tint1); padding: 8px 0 14px; }
.help-grp { padding: 12px 16px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--faint); }
.help-navitem { display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 7px 16px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.help-navitem:hover { background: #eef0f2; }
.help-navitem.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.help-body { flex: 1; overflow-y: auto; padding: 4px 26px 26px; font-size: 13px; line-height: 1.6; color: var(--ink); }
.help-body h3 { font-size: 17px; margin: 20px 0 8px; }
.help-body p { margin: 0 0 10px; }
.help-body ul { margin: 0 0 10px; padding-left: 20px; }
.help-body li { margin: 4px 0; }
.help-body code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.help-body strong { font-weight: 700; }
@media (max-width: 620px) { .help-nav { flex-basis: 150px; } }

/* sidepanel */
#sidepanel { background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto; }
.sp-head { padding: 11px 15px 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#col-reset { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; padding: 0; white-space: nowrap; }
#col-reset:hover { color: var(--accent); text-decoration: underline; }
.sp-head h1 { margin: 0; font-size: 16px; font-weight: 700; }
.sp-head .muted { font-size: 12px; }
.sp-search { padding: 2px 12px 8px; }
.sp-filters { padding: 2px 5px 10px; }
.filter-group { padding: 5px 10px; }
.filter-group h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 5px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); cursor: pointer; user-select: none; }
.fg-caret { display: inline-flex; color: var(--muted); }
.fg-caret svg { width: 13px; height: 13px; transition: transform .15s ease; }
.filter-group.collapsed .fg-caret svg { transform: rotate(180deg); }
.filter-group.collapsed .fg-rows { display: none; }
.filter-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 5px; cursor: pointer; }
.filter-row:hover { background: #f2f4f6; }
.filter-row.on { background: var(--accent-soft); }
.filter-row .lbl { flex: 1; }
.filter-row .cnt { color: var(--muted); font-variant-numeric: tabular-nums; }
.filter-row .dot { width: 7px; height: 7px; border-radius: 50%; }

/* content + table */
#content { overflow: auto; background: var(--panel); }
.tbl { table-layout: fixed; border-collapse: collapse; }
.tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 8px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; user-select: none; }
.tbl thead th.sorted { color: var(--accent); }
.tbl thead th .arrow { font-size: 8px; }
.col-rz { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; }
.col-rz:hover { background: linear-gradient(to right, transparent, var(--accent)); }
body.col-resizing { cursor: col-resize; user-select: none; }
.tbl tbody td { padding: 6px 13px; border-bottom: 1px solid var(--border); background: var(--panel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: #fafbfc; }
.tbl tbody tr.sel td { background: var(--accent-soft); }
.tbl .name { font-weight: 600; }
.tbl .name-wrap { display: flex; align-items: center; gap: 8px; }
.tbl .name .dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; }
.tbl .name-txt { line-height: 1.25; }
.tbl .sub { color: var(--muted); font-size: 11px; font-weight: 400; }
.type-ic { width: 20px; height: 20px; color: var(--muted); }
.type-ph { width: 36px; height: 26px; object-fit: contain; display: block; }
.dt-head .type-ph { width: 44px; height: 34px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--border); vertical-align: middle; margin-left: 5px; }
.live-dot.on { background: var(--green); animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* RouterOS update: badge + progress bar in the version column */
.ver-cell .ver { display: inline; }
.upd-badge { margin-left: 6px; padding: 1px 8px; font-size: 11px; font-weight: 600; line-height: 18px;
  color: #fff; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; vertical-align: middle; }
.upd-badge:hover { filter: brightness(1.08); }
.upd-bar { margin-top: 4px; height: 5px; width: 100%; max-width: 150px; background: var(--border); border-radius: 3px; overflow: hidden; }
.upd-fill { height: 100%; background: var(--accent); border-radius: 3px; width: 0; transition: width .8s ease; }
.upd-phase { margin-top: 2px; font-size: 10px; color: var(--muted); text-transform: capitalize; }

/* Floating action button — Add device */
#fab { position: fixed; right: 22px; bottom: 22px; width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-size: 30px; font-weight: 300; line-height: 1;
  box-shadow: 0 6px 20px rgba(0, 111, 255, .35); cursor: pointer; z-index: 30; transition: background .12s, transform .12s, opacity .15s; }
#fab:hover { background: #0063e6; transform: translateY(-1px); }
#fab::after { content: attr(data-tip); position: absolute; right: 62px; top: 50%; transform: translateY(-50%);
  background: #0f172a; color: #fff; font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
#fab:hover::after { opacity: 1; }
/* The detail panel overlays the bottom-right; get the FAB out of its way. */
#shell.detail-open #fab { opacity: 0; pointer-events: none; }

/* FAB pop-up menu (add-device options) */
.fab-menu { position: fixed; right: 22px; bottom: 84px; z-index: 31; display: flex; flex-direction: column;
  gap: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px;
  box-shadow: 0 12px 34px rgba(0,0,0,.18); width: 264px; }
.fab-menu button { display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0;
  border-radius: 7px; padding: 8px 10px; cursor: pointer; }
.fab-menu button:hover { background: var(--accent-soft); }
.fab-menu button b { font-size: 13px; }
.fab-menu button span { font-size: 11px; color: var(--muted); }

/* Approval inbox (self-enrolled devices waiting for an operator) */
.pend-bar { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 12px; }
.pend-head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.pend-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.pend-row { display: flex; align-items: center; gap: 11px; padding: 7px 0; border-top: 1px solid rgba(0,111,255,.16); }
.pend-thumb { width: 34px; display: flex; justify-content: center; }
.pend-thumb img, .pend-thumb .type-ic { max-width: 30px; max-height: 26px; }
.pend-id { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.pend-id b { font-size: 13px; } .pend-id span { font-size: 11px; color: var(--muted); }

/* Credential reveal rows */
.cred-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.cred-lbl { width: 74px; font-size: 12px; color: var(--muted); }
.cred-val { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--accent-soft);
  padding: 5px 8px; border-radius: 6px; overflow: auto; white-space: nowrap; }

/* Bootstrap script block */
.boot-load { font-size: 12px; color: var(--muted); padding: 20px 0; text-align: center; }
.boot-rsc { background: #0f172a; color: #d7e2f0; font-size: 11px; line-height: 1.5; padding: 12px;
  border-radius: 8px; overflow: auto; max-height: 320px; white-space: pre; margin-top: 4px; }

/* Adopt-device modal */
.adopt-panel { position: relative; z-index: 1; width: min(440px, 94vw); margin: 12vh auto 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.22); overflow: hidden; }
.adopt-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; border-bottom: 1px solid var(--border); font-weight: 600; }
.adopt-body { padding: 15px; }
.af { display: flex; flex-direction: column; gap: 4px; margin-bottom: 11px; font-size: 12px; color: var(--muted); }
.af span { font-weight: 600; }
.af input, .af select { padding: 8px 10px; font: inherit; color: var(--ink); border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; }
.af input:focus, .af select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.af-row { display: flex; gap: 10px; }
.af-row .af { flex: 1; }
.adopt-log { margin-top: 12px; max-height: 200px; overflow-y: auto; background: #0f172a; color: #cbd5e1; border-radius: 8px; padding: 9px 11px; font-family: var(--mono); font-size: 11px; line-height: 1.5; }
.adopt-line.err { color: #fca5a5; }
.adopt-line.ok { color: #86efac; }

/* Generic confirm dialog */
.overlay:has(.confirm-panel) .ss-backdrop { background: rgba(15, 23, 42, .18); }
.confirm-panel { position: relative; z-index: 1; max-width: 380px; margin: 18vh auto 0; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.22); padding: 18px; }
.confirm-msg { font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.empty { padding: 48px; text-align: center; color: var(--muted); }

/* Speedtest dialog */
.spd-panel { max-width: 420px; }
.spd-head { font-size: 15px; margin-bottom: 12px; }
.spd-body { margin-bottom: 14px; min-height: 40px; }
.spd-note { font-size: 12px; color: var(--muted); line-height: 1.45; margin-bottom: 12px; }
.spd-note.spd-err { color: #dc2626; }
.spd-dur { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.spd-running { font-size: 14px; color: var(--muted); text-align: center; padding: 12px 0; }
.spd-result { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; padding: 4px 0; }
.spd-metric { display: flex; flex-direction: column; gap: 2px; }
.spd-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.spd-val { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.spd-metric.spd-small .spd-val { font-size: 15px; font-weight: 500; }

/* Live speedtest — two side-by-side gauges (download amber, upload green) */
.spd-gauges { display: flex; gap: 8px; justify-content: center; }
.spd-gwrap { flex: 1 1 0; min-width: 0; max-width: 190px; text-align: center; opacity: .5; transition: opacity .3s; }
.spd-gwrap.active { opacity: 1; }
.spd-glabel { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.spd-gauge { display: block; width: 100%; height: auto; }
.spd-g-track { fill: none; stroke: rgba(127, 127, 127, .16); stroke-width: 9; stroke-linecap: round; }
.spd-g-prog { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .35s ease-out; }
.spd-gauge.spd-dl .spd-g-prog { stroke: #e0b400; }
.spd-gauge.spd-ul .spd-g-prog { stroke: #56a64b; }
.spd-g-needle { transition: transform .35s ease-out; }
.spd-g-needle polygon { fill: currentColor; }
.spd-g-hub { fill: currentColor; }
.spd-g-val { text-anchor: middle; font-size: 22px; font-weight: 700; fill: currentColor; font-variant-numeric: tabular-nums; }
.spd-g-unit { text-anchor: middle; font-size: 9px; fill: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.spd-g-tick { fill: var(--muted); font-size: 8px; text-anchor: middle; }
.spd-ping { display: flex; justify-content: center; gap: 22px; font-size: 13px;
  color: var(--muted); margin-bottom: 10px; }
.spd-ping-lbl { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; margin-right: 6px; }
.spd-ping-val { font-weight: 600; font-variant-numeric: tabular-nums; }
/* CPU peak meter — classic LED bar, lights bottom-up and holds its peak */
.spd-cpumeter { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; padding-bottom: 26px; }
.spd-cpu-lbl { font-size: 10px; letter-spacing: .08em; color: var(--muted); margin-bottom: 5px; }
.spd-leds { display: flex; flex-direction: column; gap: 2px; padding: 4px;
  background: rgba(127, 127, 127, .10); border-radius: 4px; }
.spd-led { width: 13px; height: 5px; border-radius: 1.5px; background: rgba(127, 127, 127, .22);
  transition: background .12s linear; }
.spd-led.on.cool { background: #56a64b; }
.spd-led.on.warm { background: #e0b400; }
.spd-led.on.hot  { background: #e02f44; }
/* held peak: lit outline only, so it reads as a marker rather than level */
.spd-led.peak.cool { background: rgba(86, 166, 75, .40); box-shadow: inset 0 0 0 1px #56a64b; }
.spd-led.peak.warm { background: rgba(224, 180, 0, .40); box-shadow: inset 0 0 0 1px #e0b400; }
.spd-led.peak.hot  { background: rgba(224, 47, 68, .40); box-shadow: inset 0 0 0 1px #e02f44; }
.spd-cpu-num { font-size: 11px; color: var(--muted); margin-top: 5px; font-variant-numeric: tabular-nums; }

.spd-cpu { text-align: center; margin: 10px 0 0; font-size: 11px; }
.spd-warn { text-align: center; margin: 10px 0 0; font-size: 12px; line-height: 1.45;
  color: #b45309; background: rgba(245, 158, 11, .10); border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 6px; padding: 7px 10px; }

/* status colours */
.c-green { color: var(--green); } .bg-green { background: var(--green); }
.c-amber { color: var(--amber); } .bg-amber { background: var(--amber); }
.c-red { color: var(--red); } .bg-red { background: var(--red); }
.c-grey { color: var(--grey); } .bg-grey { background: var(--grey); }
.c-blue { color: var(--accent); } .bg-blue { background: var(--accent); }
.status-txt { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status-txt .dot { width: 7px; height: 7px; border-radius: 50%; }
/* Sync sits under the connection state in the same cell — lighter, so the
   connection state stays the line the eye lands on. */
.sync-line { display: flex; font-size: 11px; font-weight: 400; margin-top: 2px; }
.sync-line .dot { width: 6px; height: 6px; }

/* detail panel */
#detail { position: fixed; top: var(--topbar); right: 0; bottom: 0; width: var(--detail);
  background: var(--tint1); border-left: 1px solid var(--border); overflow-y: auto; z-index: 20;
  box-shadow: -14px 0 34px rgba(20, 30, 45, .16); }
.dt-head { display: flex; align-items: center; gap: 9px; padding: 12px 15px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--tint1); z-index: 2; }
.dt-head h2 { margin: 0; font-size: 14px; flex: 1; }
.dt-close { border: 0; background: transparent; color: var(--muted); width: 26px; height: 26px; border-radius: 5px; display: grid; place-items: center; }
.dt-close:hover { background: #f0f2f4; color: var(--ink); }
.dt-tabs { display: flex; gap: 3px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.dt-tab { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 6px; border-radius: 6px; display: grid; place-items: center; }
.dt-tab svg { width: 17px; height: 17px; }
.dt-tab.active { background: var(--accent-soft); color: var(--accent); }
.dt-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.dt-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
/* Each section is a white card on the tinted panel */
.dt-section { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px; }
.dt-section h3 { margin: 0 0 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.dt-actions { margin: 0; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.dt-rev { font-size: 11px; color: var(--muted); cursor: help; white-space: nowrap; }
.chart-range { display: flex; gap: 4px; margin-bottom: 10px; }
.chart-range button { flex: 1; padding: 5px 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.chart-range button:hover { border-color: var(--border-strong); }
.chart-range button.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.chart-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.chart-cur { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.chart-plot { display: flex; align-items: stretch; height: 46px; }
.chart-yaxis { width: 42px; flex: 0 0 auto; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding-right: 6px; font-family: var(--mono); font-size: 9px; color: var(--muted); }
.spark { flex: 1; height: 46px; display: block; min-width: 0; }
.spark-empty { flex: 1; height: 46px; }
.spark .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-xaxis { display: flex; justify-content: space-between; padding-left: 42px; margin-top: 3px; font-family: var(--mono); font-size: 9px; color: var(--muted); }
.chart-empty { padding: 20px 14px; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.5; }
.dt-input { width: 100%; padding: 8px 10px; font: inherit; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--panel); }
.dt-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.dt-hint { margin-top: 6px; font-size: 11px; color: var(--muted); line-height: 1.4; }

/* Settings action list (clickable text rows) */
.dt-acts { padding: 5px 0; }
.dt-acts h3 { padding: 0 12px; }
.dt-act-grp { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 12px 12px 3px; }
.dt-act-grp:first-child { padding-top: 4px; }
.dt-act { display: block; width: 100%; text-align: left; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink); padding: 9px 12px; cursor: pointer; }
.dt-act:hover { background: #f2f4f6; }
.dt-act.danger { color: var(--red); }
.dt-act.danger:hover { background: #fdeceb; }

/* config history (Deel II §16) */
.cfg-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 6px; }
.cfg-head h3 { margin: 0; }
.cfg-list { padding: 2px 0 5px; }
.cfg-msg { padding: 9px 12px; font-size: 12px; color: var(--muted); }
.cfg-msg.err { color: var(--red); }
/* Fixed layout: the row lives in the 356px detail panel, where the natural
   width of these cells (~408px) pushed the action icons out of view. Pinning
   every column but the label keeps the icons visible; the label wraps. */
.cfg-tbl { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.cfg-tbl td { padding: 7px 5px; border-top: 1px solid var(--border); vertical-align: middle; }
.cfg-tbl tr:first-child td { border-top: 0; }
.cfg-seq { font-family: ui-monospace, Menlo, monospace; color: var(--muted); width: 28px; }
.cfg-when { white-space: nowrap; width: 104px; }
.cfg-lbl { white-space: normal; overflow-wrap: anywhere; }
.cfg-ts { display: block; font-size: 11px; color: var(--muted); }
.cfg-src { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.cfg-sz { color: var(--muted); text-align: right; white-space: nowrap; width: 48px; }
.cfg-act { text-align: right; white-space: nowrap; width: 100px; }
.cfg-ib { border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 3px; margin-left: 1px; border-radius: 6px; line-height: 0; vertical-align: middle; }
.cfg-ib:hover { background: #f2f4f6; color: var(--ink); }
.cfg-ib.danger:hover { background: #fdeceb; color: var(--red); }
.cfg-ib svg { width: 15px; height: 15px; display: block; }
.cfg-pre { font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: pre; overflow: auto; max-height: 60vh; margin: 0; }

/* managed drift (§23): snapshot badges, drift banner, diff view */
.snap-badge { display: inline-block; margin: 2px 4px 0 0; padding: 1px 7px; border-radius: 9px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.snap-badge.cur { background: #e7f6ee; color: #0e8a50; }
.snap-badge.base { background: var(--accent-soft); color: var(--accent); }
.drift-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 6px 10px; padding: 8px 11px; border: 1px solid #f5d9a8; background: #fdf6e7;
  color: #8a5b00; border-radius: 7px; font-size: 12px; font-weight: 600; }
.drift-note { font-size: 12px; margin: 10px 0 4px; }
.drift-menu h4 { font-family: ui-monospace, Menlo, monospace; font-size: 12px; margin: 16px 0 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.drift-hunk { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; padding: 6px 8px 6px 10px;
  margin: 4px 0; border-left: 3px solid var(--grey); background: var(--tint1); border-radius: 0 6px 6px 0;
  font-size: 12px; }
.drift-hunk.added { border-left-color: var(--green); }
.drift-hunk.removed { border-left-color: var(--red); }
.drift-hunk.changed { border-left-color: var(--amber); }
.drift-kind { flex: 0 0 auto; padding: 0 6px; border-radius: 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; background: #eef0f2; color: var(--muted); }
.drift-hunk.added .drift-kind { background: #e7f6ee; color: #0e8a50; }
.drift-hunk.removed .drift-kind { background: #fdeceb; color: var(--red); }
.drift-hunk.changed .drift-kind { background: #fdf6e7; color: #8a5b00; }
.drift-target { font-family: ui-monospace, Menlo, monospace; font-weight: 600; }
.drift-acts { margin-left: auto; white-space: nowrap; display: inline-flex; gap: 4px; }
.drift-acts .btn { padding: 2px 8px; font-size: 11px; }
.drift-all { display: flex; gap: 6px; justify-content: flex-end; margin: 4px 0 2px; }
.cfg-head-acts { display: inline-flex; gap: 6px; align-items: center; }
.cm-enforce { padding: 0 4px 8px; }
.enf-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 8px 6px; }
.enf-chip { border: 1px solid var(--border-strong); background: #fff; color: var(--muted);
  border-radius: 12px; padding: 3px 10px; font-size: 11px; font-family: ui-monospace, Menlo, monospace; }
.enf-chip:hover { border-color: var(--accent); color: var(--accent); }
.enf-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.enf-tag { margin-left: 8px; padding: 1px 7px; border-radius: 9px; background: var(--accent-soft);
  color: var(--accent); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; font-family: var(--font); }
.drift-sum { font-family: ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.drift-field { flex-basis: 100%; display: flex; gap: 7px; align-items: baseline;
  font-family: ui-monospace, Menlo, monospace; padding-left: 2px; }
.df-name { color: var(--muted); min-width: 110px; }
.df-old { color: var(--red); text-decoration: line-through; overflow-wrap: anywhere; }
.df-arr { color: var(--faint); }
.df-new { color: #0e8a50; font-weight: 600; overflow-wrap: anywhere; }

/* config browser (Spoor B) */
.cfg-path { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: var(--faint); font-weight: 400; }
.dt-act .cfg-path { float: right; margin-top: 2px; }
.changelog-panel.cfg-panel { width: min(1020px, 94vw); }
.cfg-browse { max-height: 65vh; overflow: auto; }
.cfg-tblwrap { overflow-x: auto; }
.cfg-vtbl { width: 100%; border-collapse: collapse; font: 11px/1.45 ui-monospace, Menlo, monospace; }
.cfg-vtbl th { text-align: left; padding: 5px 12px 6px; border-bottom: 1px solid var(--border);
  font: 600 10px/1 -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
.cfg-vtbl td { padding: 5px 12px; border-bottom: 1px solid var(--border); color: var(--ink);
  white-space: nowrap; vertical-align: top; }
.cfg-vtbl tr:last-child td { border-bottom: 0; }
.cfg-vtbl.kv td:first-child, .cfg-vtbl td.cfg-k { color: var(--muted); width: 1%; padding-right: 20px; }
.cfg-none { color: var(--faint); }
.cfg-keycol { font-weight: 600; }
th.cfg-keycol { color: var(--accent); }
td.cfg-keycol { background: var(--accent-soft); }
.cfg-actcol { text-align: right; white-space: nowrap; }
.cfg-actcol .cfg-ib { vertical-align: middle; margin-left: 4px; }
.cfg-idx { color: var(--faint); font: 10px/1 ui-monospace, Menlo, monospace; width: 1%; text-align: right; padding-right: 12px; }
.cfg-idcol { color: var(--muted); font-size: 11px; width: 1%; white-space: nowrap; }
th.cfg-idcol { color: var(--faint); }
.cfg-row-edit { cursor: pointer; }
.cfg-row-edit:hover td { background: var(--tint2); }
.cfg-row-edit:hover td.cfg-idx { background: var(--tint2); }
.cfg-ibx { display: inline-block; width: 20px; }
.cfg-actcol .cfg-ib { font-size: 11px; line-height: 1; padding: 3px 4px; }
.cfg-actcol .cfg-toggle { vertical-align: middle; margin-left: 4px; }
.cfg-addbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.cfg-addmodal { width: min(440px, 94vw); }
.cfg-addform { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 16px; }
.cfg-addrow { display: flex; flex-direction: column; gap: 4px; }
.cfg-addrow span { font-size: 12px; color: var(--muted); }
.cfg-addrow em { color: var(--accent); font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; }
.cfg-addrow input { font: inherit; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--ink); }
.cfg-addrow input:focus { outline: none; border-color: var(--accent); }
.cfg-addactions { display: flex; justify-content: flex-end; gap: 8px; }
.cfg-toggle { font: 600 10px/1 -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase;
  letter-spacing: .03em; border-radius: 10px; padding: 3px 10px; cursor: pointer; border: 1px solid transparent; }
.cfg-toggle.on { background: rgba(24,160,88,.12); color: #12945a; border-color: rgba(24,160,88,.35); }
.cfg-toggle.off { background: var(--tint2); color: var(--muted); border-color: var(--border); }
.cfg-toggle:hover { filter: brightness(.96); }
.cfg-row-off td:not(.cfg-actcol) { opacity: .5; }
.cfg-row-locked td { background: var(--tint2); color: var(--muted); }
.cfg-lock { color: var(--faint); }
.cfg-lock svg { width: 13px; height: 13px; vertical-align: middle; }
.cfg-editable { cursor: pointer; position: relative; }
.cfg-editable:hover { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.cfg-edit-hint { font: 600 9px/1 -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px;
  padding: 2px 5px; margin-left: 6px; vertical-align: middle; }
.cfg-edit { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.cfg-in { flex: 1 1 auto; min-width: 140px; font: inherit; padding: 3px 7px;
  border: 1px solid var(--accent); border-radius: 5px; outline: none; background: var(--panel); color: var(--ink); }

/* ---------------- Config Manager ---------------- */
#configmgr { grid-row: 2; grid-column: 2 / 4; overflow: hidden; background: var(--panel); }
#configmgr:not([hidden]) { display: flex; flex-direction: column; }
#cm-selbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--tint2); flex-shrink: 0; }
.cm-sel-lbl { font: 600 11px/1 -apple-system, "Segoe UI", Roboto, sans-serif;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
#cm-devsel { font: inherit; padding: 5px 9px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel); color: var(--ink); min-width: 240px; }
.cm-dev-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cm-dev-meta .mono { font-family: ui-monospace, Menlo, monospace; }
#cm-safe-toggle.on { background: #b5730b; border-color: #b5730b; color: #fff; }
#cm-safe-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; flex-shrink: 0;
  padding: 8px 16px; background: #fff5e6; border-bottom: 1px solid #f0c987; color: #7a4f06; font-size: 13px; }
:root[data-theme="dark"] #cm-safe-bar { background: #3a2c12; border-bottom-color: #6b4e1a; color: #f0c987; }
@media (prefers-color-scheme: dark) { #cm-safe-bar { background: #3a2c12; border-bottom-color: #6b4e1a; color: #f0c987; } }
.cm-safe-lbl { font-weight: 700; }
.cm-safe-info b { font-variant-numeric: tabular-nums; }
.cm-safe-list { color: inherit; opacity: .8; font: 11px/1.4 ui-monospace, Menlo, monospace; }
.cm-safe-acts { margin-left: auto; display: flex; gap: 8px; }
#cm-main { flex: 1; display: flex; min-height: 0; }
#cm-tree { width: 224px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto; padding: 4px 0 12px; }
#cm-content { flex: 1; min-width: 0; overflow: auto; padding: 14px 20px; }
#cm-snaps { width: 340px; flex-shrink: 0; border-left: 1px solid var(--border);
  overflow-y: auto; padding: 12px 14px; background: var(--tint2); }

/* Accordion: one collapsible group per RouterOS domain */
.cm-sec + .cm-sec { border-top: 1px solid var(--border); }
.cm-sec-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none;
  border: 0; cursor: pointer; padding: 9px 14px; color: var(--muted);
  font: 600 11px/1 -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase; letter-spacing: .04em; }
.cm-sec-head:hover { color: var(--ink); }
.cm-chev { display: inline-flex; color: var(--faint); transform: rotate(90deg); transition: transform .15s ease; }
.cm-sec.open .cm-chev { transform: rotate(180deg); }
.cm-chev svg { width: 12px; height: 12px; }
.cm-sec-name { flex: 1; text-align: left; }
.cm-sec-cnt { font: 10px/1 ui-monospace, Menlo, monospace; color: var(--faint);
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 2px 7px; }
.cm-sec-items { display: none; padding-bottom: 5px; }
.cm-sec.open .cm-sec-items { display: block; }
.cm-tree-item { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left;
  background: none; border: 0; border-left: 2px solid transparent; padding: 6px 14px 6px 32px;
  cursor: pointer; color: var(--ink); font: inherit; font-size: 13px; }
.cm-tree-item:hover { background: var(--panel); }
.cm-tree-item.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent); }
.cm-item-lbl { flex: 1; }
.cm-edit-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.cm-menu-head { display: flex; align-items: center; margin: 0 0 10px; }
.cm-menu-head h3 { font-size: 14px; margin: 0; display: flex; align-items: center; gap: 8px; }
.cm-empty { padding: 26px 14px; color: var(--muted); }

/* ---------------- Profiles ---------------- */
#profilesmgr { grid-row: 2; grid-column: 2 / 4; overflow: hidden; background: var(--panel); }
#profilesmgr:not([hidden]) { display: flex; flex-direction: column; }
#pm-selbar { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--tint2); flex-shrink: 0; }
#pm-main { flex: 1; display: flex; min-height: 0; }
#pm-list { width: 240px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto; padding: 6px 0; }
#pm-content { flex: 1; min-width: 0; overflow: auto; padding: 16px 22px; }
#pm-side { width: 360px; flex-shrink: 0; border-left: 1px solid var(--border);
  overflow-y: auto; padding: 14px 16px; background: var(--tint2); }
#pm-side .pm-section-h:first-child { margin-top: 0; }
#pm-side .pm-devs { flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.pm-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  text-align: left; background: none; border: 0; border-left: 2px solid transparent; padding: 8px 16px;
  cursor: pointer; color: var(--ink); font: inherit; }
.pm-item:hover { background: var(--tint2); }
.pm-item.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent); }
.pm-item-nm { font-weight: 600; }
.pm-sub { font-size: 11px; color: var(--faint); }
.pm-item.active .pm-sub { color: var(--accent); }
.pm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pm-head h2 { font-size: 17px; margin: 0; }
.pm-head-acts { display: flex; gap: 8px; }
.pm-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }
.pm-name { cursor: pointer; border-radius: 4px; padding: 0 2px; }
.pm-name:hover { background: var(--accent-soft); }
.pm-desc.pm-editable { cursor: pointer; border-radius: 4px; padding: 2px 4px; margin-left: -4px; }
.pm-desc.pm-editable:hover { background: var(--tint2); }
.pm-placeholder { color: var(--faint); font-style: italic; }
.pm-section-h { font: 600 11px/1 -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.pm-menu { margin-bottom: 12px; }
.pm-menu-h { font: 11px/1 ui-monospace, Menlo, monospace; color: var(--accent); margin-bottom: 4px; }
.pm-val { cursor: pointer; }
.pm-val:hover { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.pm-devs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.pm-dev { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.pm-cap-menus { display: flex; flex-direction: column; gap: 6px; }
.pm-roll-acts { display: flex; gap: 8px; margin-bottom: 12px; }
.pm-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.pm-card table { margin-top: 6px; }
.pm-ok { color: #12945a; font-weight: 600; }
.pm-err { color: var(--red); }
.pm-warn { color: #b5730b; font-weight: 600; }
.pm-model { font: 600 10px/1 -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase;
  letter-spacing: .04em; color: var(--accent); border: 1px solid var(--accent); border-radius: 5px;
  padding: 2px 7px; vertical-align: middle; margin-left: 8px; }
.pm-kind-h { font: 600 10px/1 -apple-system, "Segoe UI", Roboto, sans-serif; text-transform: uppercase;
  letter-spacing: .05em; color: var(--faint); margin: 14px 0 6px; }
.pm-cnt { font: 10px/1 ui-monospace, Menlo, monospace; color: var(--faint);
  background: var(--tint2); border-radius: 8px; padding: 1px 7px; margin-left: 4px; }
.pm-cmt { color: var(--muted); }
.pm-section-h { display: flex; align-items: center; justify-content: space-between; }
.pm-assign-acts { display: flex; gap: 8px; }
.pm-item-row { cursor: pointer; }
.pm-item-row:hover td:not(.cfg-actcol) { background: var(--tint2); }
.pm-add-link { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12px;
  cursor: pointer; padding: 5px 2px; }
.pm-add-link:hover { text-decoration: underline; }
.pm-add-menu { display: inline-block; margin-top: 10px; font-weight: 600; }
.pm-addfield { display: flex; gap: 8px; margin: 4px 0 14px; }
.pm-addfield input { flex: 1; font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; }
.pm-if-row span { display: flex; align-items: center; justify-content: space-between; }
.pm-fld-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.pm-fld-del:hover { color: var(--red); }

/* Settings: gear at the foot of the rail, section nav in the side panel, panel
   in the content area — same shape as the PepNetCon controller. */
.rail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; }
.sp-settings { padding: 2px 5px 10px; }
.sp-nav-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px;
  cursor: pointer; color: var(--ink); }
.sp-nav-row:hover { background: #f0f2f4; }
.sp-nav-row.on { background: var(--accent-soft); color: var(--accent); }
.sp-nav-ic svg { width: 17px; height: 17px; display: block; }
.sp-nav-row .lbl { font-size: 13px; }
#settings-host { overflow: auto; height: 100%; }
.pg-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--border); }
.pg-head h2 { margin: 0; font-size: 17px; }
.pg-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pg-head .btn { margin-left: auto; }
.pg-body { padding: 18px 20px 26px; max-width: 900px; }
.gs-form { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.af { display: block; }
.af > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.af input, .af textarea { width: 100%; padding: 8px 10px; font: inherit; border: 1px solid var(--border-strong);
  border-radius: 5px; background: #fff; resize: vertical; }
.af input:focus, .af textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.gs-meta { font-size: 12px; color: var(--muted); }
.gs-meta code { font-family: var(--mono); }
.ak-tbl { width: 100%; table-layout: auto; }
.ak-tbl thead th { text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); padding: 6px 5px; border-bottom: 1px solid var(--border); }
.ak-tbl .ak-act { text-align: right; width: 40px; }
.ak-revoked td { opacity: .55; }
.ak-docs { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 14px; }
.ak-docs h3 { margin: 0 0 6px; font-size: 13px; }
.ak-docs h3 + p { margin-top: 0; }
.ak-ep { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; font-size: 12px; flex-wrap: wrap; }
.ak-ep code { font-family: var(--mono); background: var(--tint2); padding: 2px 6px; border-radius: 4px; }
.ak-ep span { color: var(--muted); flex: 1 1 260px; }
.ak-pre { font-family: var(--mono); font-size: 12px; background: var(--tint2);
  padding: 9px 11px; border-radius: 6px; overflow-x: auto; margin: 0 0 10px; }
.ak-keybox { display: flex; align-items: center; gap: 8px; margin-top: 10px;
  background: var(--tint2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.ak-keybox code { font-family: var(--mono); font-size: 12px; word-break: break-all; flex: 1; }

/* Signal values: right-aligned tabular figures so -95 / -100 line up, coloured
   by quality (same thresholds and classes as the PepNetCon tool). */
.td-sig { text-align: right; font-variant-numeric: tabular-nums; }
.sig { font-weight: 600; }
.sig-u { color: var(--muted); font-size: 10px; margin-left: 2px; }
.sig-na { color: var(--border-strong); }
/* Numbers in the body font, but with even digit widths — an IP reads fine this
   way; only the 15-digit IMSI keeps the monospace face for column alignment. */
.td-num { font-variant-numeric: tabular-nums; }

/* Action column: three icon buttons need the room, so trim the cell padding
   rather than clipping the last icon. */
.tbl tbody td.td-cfglink { padding-left: 6px; padding-right: 6px; }
.td-cfglink { text-align: center; }
.cfg-open { background: none; border: 0; cursor: pointer; color: var(--muted);
  padding: 4px; border-radius: 6px; display: inline-flex; }
.cfg-open:hover { background: var(--accent-soft); color: var(--accent); }
.cfg-open svg { width: 16px; height: 16px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #d92d20; }

/* Move-to-site modal */
.move-list { margin: 12px 0 16px; display: flex; flex-direction: column; gap: 2px; }
.move-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.move-row:hover { background: #f2f4f6; }

/* SSH terminal */
.term-panel { position: relative; z-index: 1; width: min(820px, 94vw); height: min(600px, 84vh); margin: 6vh auto 0;
  display: flex; flex-direction: column; background: #0b1020; color: #cbd5e1;
  border: 1px solid #1e293b; border-radius: 10px; box-shadow: 0 22px 60px rgba(0,0,0,.5); overflow: hidden;
  font-family: var(--mono); resize: both; min-width: 460px; min-height: 300px; max-width: 96vw; max-height: 92vh; }
/* make the native resize grip visible on the dark panel */
.term-panel::after { content: ""; position: absolute; right: 2px; bottom: 2px; width: 12px; height: 12px; pointer-events: none;
  background: linear-gradient(135deg, transparent 0 50%, #334155 50% 60%, transparent 60% 72%, #334155 72% 82%, transparent 82%); }
.term-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 13px;
  background: #111827; border-bottom: 1px solid #1e293b; }
.term-title { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #e2e8f0; }
.term-title svg { width: 15px; height: 15px; color: #38bdf8; }
.term-title b { font-weight: 600; }
.term-sub { color: #64748b; font-size: 11px; font-weight: 400; }
.term-head .dt-close { color: #64748b; }
.term-head .dt-close:hover { background: #1e293b; color: #fff; }
.term-xterm { flex: 1; min-height: 0; padding: 8px 4px 8px 10px; background: #0b1020; }
.term-xterm .xterm { height: 100%; }
.td-cfglink .cfg-open + .cfg-open { margin-left: 2px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #f1f3f5; color: var(--muted); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.green { color: var(--green); background: #e7f8ef; }
.badge.amber { color: var(--amber); background: #fef3e7; }
.badge.red { color: var(--red); background: #fdeceb; }
.badge.grey { color: var(--grey); background: #f1f3f5; }

/* site selector overlay */
.overlay { position: fixed; inset: 0; z-index: 50; }
.ss-backdrop { position: absolute; inset: 0; }
.ss-panel { position: absolute; left: var(--rail); top: var(--topbar); bottom: 0; width: 296px; background: var(--panel); border-right: 1px solid var(--border); box-shadow: 4px 0 24px rgba(20,30,45,.1); display: flex; flex-direction: column; }
.ss-head { padding: 12px 16px 6px; font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ns-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ns-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ns-field input { padding: 8px 10px; font: inherit; border: 1px solid var(--border-strong); border-radius: 5px; background: #fff; color: var(--ink); }
.ns-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.ns-hint { font-size: 11px; margin: 2px 0 0; }
.ss-search { padding: 0 12px 8px; }
.ss-colhead { display: flex; justify-content: space-between; padding: 5px 16px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 700; }
.ss-list { overflow-y: auto; padding-bottom: 10px; }
.ss-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 16px; cursor: pointer; }
.ss-row:hover { background: #f2f4f6; }
.ss-row.on { background: var(--accent-soft); }
.ss-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-row .crit { color: var(--muted); font-variant-numeric: tabular-nums; }
.ss-row .crit.attn { color: var(--amber); font-weight: 700; }
.ss-pend { margin-left: 7px; font-size: 10px; font-weight: 700; color: #fff; background: var(--accent);
  padding: 1px 6px; border-radius: 9px; vertical-align: 1px; }

/* toast */
#toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2933; color: #fff; padding: 9px 16px; border-radius: 7px; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,.2); opacity: 0; transform: translateY(6px); transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red); }
/* Stale-page notice: stays put where the others fade — it asks for an action
   rather than reporting one. */
.toast.stale { display: flex; align-items: center; gap: 10px; padding-right: 6px; font-weight: 400; }
.toast.stale .btn { flex: 0 0 auto; }
.toast-x { border: 0; background: transparent; color: inherit; opacity: .6; font-size: 16px;
  line-height: 1; padding: 2px 7px; border-radius: 4px; }
.toast-x:hover { opacity: 1; background: rgba(255, 255, 255, .18); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
