/* ISP ACS admin UI */
/* Colours follow the ISPServiceHub website: white surfaces, near-black type,
   the soft "Smarter Broadband" blue as accent, the logo's yellow as a highlight. */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --text: #16181d;
  --text-2: #3d434d;
  --muted: #6b7280;
  --border: #e6e8ec;
  --border-strong: #d3d7de;
  --accent: #4f74b8;
  --accent-hover: #3f63a6;
  --accent-soft: #edf2fa;
  --accent-ink: #2f4f8a;
  --brand-blue: #7096d4;
  --brand-yellow: #f4e46f;
  --good: #1f8a5b;
  --good-soft: #e9f6ef;
  --warn: #b86e0b;
  --warn-soft: #fdf4e3;
  --bad: #c9372c;
  --bad-soft: #fcecea;
  --code-bg: #f1f3f6;
  --neutral-series: #a3aab6;
  --grid: #eceef2;
  --side-bg: #ffffff;
  --side-text: #3d434d;
  --side-muted: #8a909b;
  --side-active: #edf2fa;
  --side-border: #e6e8ec;
  --ink-bar: #16181d;
  --shadow: 0 1px 2px rgba(22, 24, 29, .04), 0 4px 14px rgba(22, 24, 29, .05);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111316;
  --panel: #1a1d22;
  --text: #eceef1;
  --text-2: #c9cdd4;
  --muted: #959ba6;
  --border: #272b32;
  --border-strong: #363b44;
  --accent: #86a7e2;
  --accent-hover: #a3bdeb;
  --accent-soft: #1f2a3d;
  --accent-ink: #c3d4f3;
  --good: #4cc38a;
  --good-soft: #13281e;
  --warn: #e6a83c;
  --warn-soft: #2b2112;
  --bad: #ef6b60;
  --bad-soft: #2d1614;
  --code-bg: #20242a;
  --neutral-series: #6b7280;
  --grid: #24282f;
  --side-bg: #15171b;
  --side-text: #c9cdd4;
  --side-muted: #7d838e;
  --side-active: #1f2a3d;
  --side-border: #24282f;
  --ink-bar: #2a2f37;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #111316; --panel: #1a1d22; --text: #eceef1; --text-2: #c9cdd4; --muted: #959ba6;
    --border: #272b32; --border-strong: #363b44; --accent: #86a7e2; --accent-hover: #a3bdeb;
    --accent-soft: #1f2a3d; --accent-ink: #c3d4f3; --good: #4cc38a; --good-soft: #13281e;
    --warn: #e6a83c; --warn-soft: #2b2112; --bad: #ef6b60; --bad-soft: #2d1614; --code-bg: #20242a;
    --neutral-series: #6b7280; --grid: #24282f; --side-bg: #15171b; --side-text: #c9cdd4;
    --side-muted: #7d838e; --side-active: #1f2a3d; --side-border: #24282f; --ink-bar: #2a2f37;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, code, pre { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--side-border); display: flex; flex-direction: column; padding: 22px 14px 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: block; padding: 0 8px 26px; color: var(--text); }
.brand:hover { text-decoration: none; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; }
.wm-text { display: grid; line-height: 1; gap: 4px; }
.wm-acs { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.wm-by { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.side-label { font-size: 12px; color: var(--side-muted); padding: 6px 12px 6px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--side-text); font-weight: 500; }
.side-nav a svg.icon { color: var(--side-muted); }
.side-nav a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.side-nav a.active { background: var(--side-active); color: var(--accent-ink); font-weight: 600; }
.side-nav a.active svg.icon { color: var(--accent); }
.side-foot { margin-top: auto; border-top: 1px solid var(--side-border); padding: 14px 8px 0; display: grid; gap: 10px; }
.tenant-name { color: var(--text); font-weight: 600; }
.tenant-sub { color: var(--side-muted); font-size: 12px; font-family: var(--mono); }
.side-foot button { background: transparent; color: var(--side-text); border-color: var(--border-strong); }
.side-foot button:hover { background: var(--bg); }
.theme-seg { width: 100%; }
.theme-seg button { flex: 1; }
.content { min-width: 0; padding: 28px 36px 48px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0; font-weight: 700; letter-spacing: -.025em; }
.page-head .sub { color: var(--muted); }

/* ---------- controls ---------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--bg); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); }
button.danger { color: var(--bad); }
button.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
button.link { border: none; background: none; height: auto; padding: 0; color: var(--accent); font-weight: 550; }
button.link:hover { text-decoration: underline; background: none; }
input, select, textarea { height: 34px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; }
textarea { height: auto; padding: 9px 11px; font-family: var(--mono); font-size: 12.5px; width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.search { width: 340px; max-width: 100%; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.edit-row { display: flex; gap: 6px; align-items: center; }
.edit-row input { flex: 1; min-width: 140px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; }
.seg button { border: none; border-radius: 0; height: 32px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

/* ---------- surfaces ---------- */
.panel, .card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 14px; margin: 0; font-weight: 650; }
.panel-body { padding: 16px 18px; }
.card { padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 15px; font-weight: 650; color: var(--text); letter-spacing: -.01em; }
.card.table-card { padding: 18px 0 6px; }
.card.table-card .card-head { padding: 0 18px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: stretch; }
.stack { display: grid; gap: 16px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.card th:first-child, .card td:first-child, .panel th:first-child, .panel td:first-child { padding-left: 18px; }
.card th:last-child, .card td:last-child, .panel th:last-child, .panel td:last-child { padding-right: 18px; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
td.value { word-break: break-all; max-width: 420px; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button + button { margin-left: 6px; }

/* ---------- badges, pills, dots ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--code-bg); color: var(--text-2); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-series); flex: none; }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.live { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: var(--code-bg); color: var(--muted); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.live { background: var(--accent-soft); color: var(--accent); }

/* ---------- KPI tiles ---------- */
.tiles { --cols: 5; --gap: 14px; display: flex; flex-wrap: wrap; gap: var(--gap); margin-bottom: 18px; }
.tiles > .tile { flex: 1 1 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 6px; min-width: 0; align-content: start; }
.tile .t-label { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.tile .t-value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tile .t-value.mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; font-family: var(--mono); font-weight: 600; letter-spacing: 0; }
.tile .t-sub { color: var(--muted); font-size: 12.5px; }
.tile .meter-track { margin-top: 4px; }

/* ---------- key/value rows ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); align-items: center; }
.kv:first-of-type { border-top: none; }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font-weight: 550; overflow-wrap: anywhere; }
.kv .v .mono, .kv .v.mono { font-weight: 400; }
.meter { display: grid; gap: 5px; width: 100%; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.meter-head strong { color: var(--text); }
.meter-track { height: 8px; border-radius: 99px; background: var(--code-bg); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: var(--good); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.bad { background: var(--bad); }
.val-link { all: unset; cursor: pointer; border-radius: 4px; }
.val-link:hover { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.val-link:focus-visible { outline: 2px solid var(--accent); }
.kv .val-link, .tile .val-link { display: block; }
.signal { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 4px; border-radius: 1px; background: var(--grid); }
.bars i:nth-child(1) { height: 25%; } .bars i:nth-child(2) { height: 50%; } .bars i:nth-child(3) { height: 75%; } .bars i:nth-child(4) { height: 100%; }
.bars.l4 i, .bars.l3 i:nth-child(-n+3) { background: var(--good); }
.bars.l2 i:nth-child(-n+2) { background: var(--warn); }
.bars.l1 i:nth-child(1) { background: var(--bad); }

/* ---------- device page ---------- */
.device-page { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.dev-side { position: sticky; top: 24px; display: grid; gap: 14px; }
.dev-card { padding: 20px; display: grid; gap: 14px; }
.dev-ident { display: flex; gap: 14px; align-items: center; }
.dev-avatar { width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.dev-avatar svg.icon { width: 26px; height: 26px; }
.dev-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; overflow-wrap: anywhere; }
.dev-sub { color: var(--muted); font-size: 12.5px; }
.mini-facts .kv { grid-template-columns: 92px 1fr; padding: 6px 0; font-size: 13px; }
.dev-buttons { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 24px; }
.side-tabs { padding: 8px; display: grid; gap: 2px; }
.side-tabs button { justify-content: flex-start; border: none; background: none; height: 40px; gap: 12px; color: var(--text-2); font-weight: 550; border-radius: 9px; }
.side-tabs button:hover { background: var(--bg); color: var(--text); }
.side-tabs button.on { background: var(--accent-soft); color: var(--accent-ink); }
.side-tabs button.on svg { color: var(--accent); }
.side-tabs .sep { height: 1px; background: var(--border); margin: 6px 8px; }
.tab-title { display: flex; align-items: center; gap: 12px; margin: 2px 0 18px; }
.tab-title h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.view-foot { margin-top: 14px; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 40px; z-index: 20; min-width: 230px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 11px; box-shadow: 0 12px 32px rgba(15, 23, 42, .16); display: grid; }
.menu[hidden] { display: none; }
.menu-item { border: none; background: none; justify-content: flex-start; height: 36px; font-weight: 500; }
.menu-item:hover { background: var(--bg); }
.menu-item.danger { color: var(--bad); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* parameter browser */
.browser-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.path { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.path .sep { color: var(--muted); }
.path .cur { font-weight: 650; }
.path button.link { font-family: var(--mono); font-size: 13px; }
tr.folder td.name { font-weight: 600; font-family: inherit; font-size: 14px; }
.folder-icon { display: inline-block; width: 18px; color: var(--muted); }
table.params td.name { width: 38%; }
.rw { margin-left: 6px; color: var(--accent); }
tr.hl td { background: var(--warn-soft); }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text, .chart .lbl { font-size: 11px; fill: var(--muted); font-family: inherit; }
.chart .lbl-strong { font-size: 11.5px; fill: var(--text); font-weight: 600; font-family: inherit; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.tooltip { position: absolute; pointer-events: none; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 10px 28px rgba(15, 23, 42, .18); padding: 9px 11px; font-size: 12.5px; min-width: 160px; z-index: 5; transform: translate(-50%, calc(-100% - 12px)); }
.tooltip[hidden] { display: none; }
.tooltip .tt-title { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); }
.tooltip .tt-row b { color: var(--text); font-weight: 600; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.band-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; padding: 4px 18px 14px; }
.band-title { font-weight: 650; font-size: 13px; margin-bottom: 4px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hb-track { height: 12px; }
.hbar .hb-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 3px; }
.hbar .hb-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.stackbar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; }
.stackbar div { height: 100%; }
.ping-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.ping-controls .field input { width: 220px; }
.ping-controls .field input.narrow { width: 90px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.activity .row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.activity .row:first-child { border-top: none; padding-top: 0; }

/* ---------- login, modal, toast ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login .panel { width: 420px; max-width: 100%; }
.login .brand { color: var(--text); padding: 0 0 18px; }
.login form { display: grid; gap: 12px; }
.error { color: var(--bad); font-size: 13px; }
.backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal { width: 540px; max-width: 100%; }
.modal .panel-body { display: grid; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 40; }
.toast { min-width: 260px; max-width: 440px; padding: 11px 15px; border-radius: 10px; background: var(--text); color: var(--panel); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 13px; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
pre.json { margin: 0; padding: 12px; background: var(--code-bg); border-radius: 9px; overflow: auto; max-height: 440px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

@media (max-width: 1100px) {
  .device-page { grid-template-columns: 1fr; }
  .dev-side { position: static; }
  .side-tabs { display: flex; overflow-x: auto; }
  .side-tabs .sep { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--side-border); position: static; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 10px 12px; overflow-x: auto; }
  .brand { padding: 0 8px 0 0; }
  .theme-seg, .wm-by { display: none; }
  .side-label, .side-foot .tenant-name, .side-foot .tenant-sub { display: none; }
  .side-nav { display: flex; }
  .side-nav a span.lbl { display: none; }
  .side-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .content { padding: 18px 16px 40px; }
  .search { width: 100%; }
  .band-panels { grid-template-columns: 1fr; }
}
.legend-top { margin-top: 12px; }
.net { stroke-width: 1.5; transition: opacity .12s; cursor: pointer; outline: none; }
.net-own { fill: var(--accent); fill-opacity: .16; stroke: var(--accent); stroke-width: 2.25; }
.net-other { fill: var(--neutral-series); fill-opacity: .10; stroke: var(--neutral-series); }
svg.focus .net { opacity: .25; }
svg.focus .net.hot { opacity: 1; stroke-width: 3; fill-opacity: .28; }
.ping-band { fill: var(--accent); fill-opacity: .14; }
.ping-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.ping-pt { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.ping-loss { fill: var(--bad); }
.kv .val-link, .tile .val-link { width: 100%; }

/* dashboard rows: equal-height cards, no ragged columns */
.dash-row { display: grid; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dash-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.big-stat { display: flex; align-items: baseline; gap: 8px; margin: -2px 0 12px; }
.big-stat .num { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mini-list { display: grid; }
.mini-row { display: grid; grid-template-columns: 10px auto minmax(0, 1fr) auto 64px; gap: 12px; align-items: center; padding: 9px 6px; margin: 0 -6px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; border-radius: 6px; }
.mini-row:first-child { border-top-color: transparent; }
.mini-row:hover { background: var(--bg); text-decoration: none; }
.mini-row.act { grid-template-columns: auto minmax(0, 1fr) 64px; }
.mini-row > :last-child { text-align: right; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dev-main, .content { min-width: 0; }
@media (max-width: 1100px) {
  .dash-row.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row.three > :first-child { grid-column: 1 / -1; }
  .dash-row.two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .dash-row.three { grid-template-columns: 1fr; }
  .mini-row { grid-template-columns: 10px auto minmax(0, 1fr) 64px; }
  .mini-row:not(.act) > :nth-child(4) { display: none; }
}
@media (max-width: 1100px) {
  .dev-buttons { display: flex; flex-wrap: wrap; }
  .dev-card .mini-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .dev-card .mini-facts .kv:nth-child(2) { border-top: none; }
}

/* ---- templates ---- */
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 16px 18px; margin-bottom: 16px; }
.how-step { display: flex; gap: 12px; align-items: flex-start; }
.how-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.tpl-panel .toolbar { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tpl-panel select { max-width: 170px; }
.seg-n { margin-left: 6px; background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.seg.mini button { height: 28px; padding: 0 10px; font-size: 12.5px; }
.tpl-table td { padding: 8px 10px; }
.tpl-table th { padding: 10px; }
.tpl-param { min-width: 260px; max-width: 420px; }
.tpl-param > div:first-child { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tpl-path { font-size: 12.5px; color: var(--text); word-break: break-all; }
.tpl-path .ph { color: var(--accent); opacity: .75; }
.tpl-name { width: 100%; min-width: 150px; height: 30px; }
.tpl-sec { width: 150px; height: 30px; }
.loc-cell, .mon-cell { display: flex; gap: 6px; align-items: center; }
.loc-cell select { height: 30px; padding: 0 6px; }
.tpl-table tr.off .tpl-name, .tpl-table tr.off .loc-cell, .tpl-table tr.off .seg { opacity: .5; }
.tpl-table tr.dirty td { background: var(--accent-soft); }
.tpl-table tr.gone .tpl-path { text-decoration: line-through; color: var(--muted); }
td.center, th.center { text-align: center; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; cursor: pointer; vertical-align: middle; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .knob { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(16px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch.off { opacity: .45; cursor: default; }
.chip-btn { height: 28px; padding: 0 9px; font-size: 12px; gap: 5px; color: var(--muted); border-style: dashed; }
.chip-btn .icon { width: 14px; height: 14px; }
.chip-btn.on { border-style: solid; font-family: var(--mono); }
.chip-btn.on.warning { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.chip-btn.on.critical { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.more-row { padding: 12px; text-align: center; }
.more-row:empty { display: none; }
.savebar { position: sticky; bottom: 16px; margin-top: 16px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--ink-bar); color: #fff; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(15, 23, 42, .25); z-index: 10; }
.savebar[hidden] { display: none; }
.savebar button:not(.primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.tree-modal { display: grid; gap: 10px; }
.tree-wrap { max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: 9px; }
.tree-wrap td { padding: 6px 10px; word-break: break-all; }
.modal:has(.tree-modal) { width: 920px; }
.alert-form { display: grid; grid-template-columns: 1fr; gap: 14px; }
.alert-form p { margin: 0; }
.alert-rule { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alert-rule input { width: 120px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check input { height: auto; margin-top: 3px; }

/* ---- monitoring ---- */
.mon-bar { margin-bottom: 14px; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.mon-card { padding: 14px 16px 10px; display: grid; gap: 8px; align-content: start; }
.mon-card.firing { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad) inset; }
.mon-card.firing.warning { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn) inset; }
.mon-head { display: flex; align-items: flex-start; gap: 10px; }
.mon-title { flex: 1; min-width: 0; }
.mon-title .t-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.mon-value { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.mon-foot { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font: 600 11.5px var(--mono); background: var(--code-bg); color: var(--muted); white-space: nowrap; }
.chip .icon { width: 12px; height: 12px; }
.chip.critical { background: var(--bad-soft); color: var(--bad); }
.chip.warning { background: var(--warn-soft); color: var(--warn); }
.mon-chart .mon-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mon-chart .mon-area { fill: var(--accent); fill-opacity: .09; }
.mon-chart .mon-pt { fill: var(--accent); stroke: var(--panel); stroke-width: 1.5; }
.mon-chart .mon-pt.bad { fill: var(--bad); }
.mon-chart .mon-pt.hot { stroke-width: 2.5; }
.mon-chart .thr { stroke: var(--bad); stroke-width: 1.25; stroke-dasharray: 5 4; }
.mon-chart .st-up { fill: var(--good); fill-opacity: .75; }
.mon-chart .st-down { fill: var(--bad); }
.alerts-card { padding: 14px 18px; margin-bottom: 16px; }
.alerts-card.firing { border-color: var(--bad); }
.alert-row.mini-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill .icon { width: 14px; height: 14px; }
a.pill:hover { text-decoration: none; filter: brightness(.97); }
.edit-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.edit-wrap > :first-child { min-width: 0; }
.icon-btn { height: 26px; width: 26px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); flex: none; }
.icon-btn .icon { width: 15px; height: 15px; }
.kv:hover .icon-btn { border-color: var(--border-strong); color: var(--accent); }
.k-mon { display: inline-flex; gap: 6px; align-items: center; }
.k-mon a { color: var(--accent); display: inline-flex; }
.k-mon .icon { width: 14px; height: 14px; }
@media (max-width: 1100px) {
  .how { grid-template-columns: 1fr; }
}
