/* NMS — base stylesheet (no external dependencies) */
/* fonts are served from /assets/fonts (SIL OFL, see the LICENSE files there): no third-party requests */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2"); }
:root {
  --side-w: 252px;   /* left menu: 5 % wider than 240 px (v1.9.90) */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --up: #059669;
  --up-50: #ecfdf5;
  --down: #dc2626;
  --down-50: #fef2f2;
  --warn: #b45309;
  --warn-50: #fffbeb;
  --unknown: #64748b;
  --side: #0b1220;
  --side-2: #131c2e;
  --side-text: #a8b3c7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
code { font-family: var(--mono); font-size: 12.5px; background: #eef2f7; padding: 1px 6px; border-radius: 5px; word-break: break-all; }
.icon { flex-shrink: 0; vertical-align: middle; }
.mono { font-family: var(--mono); font-size: 12.5px; }
dd.mono { word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.warn { color: var(--warn); }
.mt { margin-top: 20px; }
.pad { padding: 16px 20px; margin: 0; }
[hidden] { display: none !important; }

/* ---------- Sidebar layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; z-index: 30; transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand strong { display: block; font-size: 14px; }
.brand span { display: block; font-size: 11.5px; color: var(--side-text); letter-spacing: .02em; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #5d6a82; padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); font-weight: 500; }
.nav-link:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav-link.active { background: #1e3a8a; color: #fff; }
.nav-link.disabled { opacity: .45; cursor: default; }
.nav-link.disabled:hover { background: none; color: var(--side-text); }
.sidebar-foot { padding: 12px 20px; font-size: 11px; color: #5d6a82; }

.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 18px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-right form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; color: var(--text); }
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 700; }
.user-meta strong { display: block; font-size: 13px; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: 11.5px; text-transform: capitalize; }
.icon-btn { border: 0; background: none; color: var(--text-2); width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-toggle { display: none; }
.content { padding: 24px; width: 100%; min-width: 0; }
.backdrop { display: none; }

/* ---------- Cards & grids ---------- */
.card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 720px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.grid-2col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; align-items: start; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--text); display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.stat:hover { text-decoration: none; border-color: #cbd5e1; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--border); }
.stat-up::before { background: var(--up); }
.stat-down::before { background: var(--down); }
.stat-down .stat-value { color: var(--down); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table .sn { width: 1%; padding-right: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 0; }
.row-down { background: #fff7f7; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; color: var(--text-2); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-up { background: var(--up-50); color: var(--up); }
.badge-down { background: var(--down-50); color: var(--down); }
.badge-unknown { background: #f1f5f9; color: var(--unknown); }
.badge-muted { background: #f1f5f9; color: var(--muted); }
.sev-critical { background: var(--down-50); color: var(--down); }
.sev-warning { background: var(--warn-50); color: var(--warn); }
.sev-info { background: var(--primary-50); color: var(--primary); }
.role-admin { background: #f5f3ff; color: #6d28d9; }
.role-operator { background: var(--primary-50); color: var(--primary); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: #cbd5e1; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger-ghost { color: var(--down); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }

/* ---------- Forms ---------- */
.form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > span { font-weight: 500; font-size: 13px; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid #cfd8e3; border-radius: 8px; background: #fff; color: var(--text); font: 14px var(--font);
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input.mono { font-family: var(--mono); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
input:disabled { background: var(--surface-2); color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check.small { margin-top: -8px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 0; }
.inline-form { display: inline-flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.inline-form .field { margin-bottom: 0; }
.subsection { border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 14px; }
.code-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: .3em; text-align: center; height: 48px !important; }

/* ---------- Toolbar & filters ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar p { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.filters select { width: auto; min-width: 130px; }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 10px; color: var(--muted); }
.search input { padding-left: 32px; width: 240px; }
.title-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; font-size: 13.5px; }
.alert-success { background: var(--up-50); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--down-50); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--warn-50); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--primary-50); border-color: #bfdbfe; color: #1e40af; }

/* ---------- Definition lists ---------- */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 9px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; }

/* ---------- Dashboard bits ---------- */
.type-list, .mini-list { list-style: none; margin: 0; padding: 0; }
.type-list li { margin-bottom: 12px; }
.type-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bar { height: 6px; border-radius: 99px; background: var(--down-50); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--up); border-radius: 99px; transition: width .4s; }
.mini-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.mini-list li:last-child { border-bottom: 0; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--up); margin: 0; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state h2 { color: var(--text); margin: 12px 0 6px; font-size: 20px; }

/* ---------- Device test ---------- */
.test-results { list-style: none; margin: 0; padding: 0; }
.test-results li { display: grid; grid-template-columns: 26px 170px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.test-results li:last-child { border-bottom: 0; }
.test-results .t-ok { color: var(--up); }
.test-results .t-fail { color: var(--down); }
.test-results .t-name { font-weight: 600; }
.test-results pre { margin: 6px 0 0; font: 12px var(--mono); white-space: pre-wrap; color: var(--text-2); background: var(--surface-2); padding: 8px; border-radius: 6px; }
.danger-zone { border-color: #fecaca; }

/* ---------- Auth pages ---------- */
.auth-body { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #dbeafe 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e0e7ff 0, transparent 55%), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand strong { display: block; font-size: 17px; }
.auth-brand span { color: var(--muted); font-size: 12.5px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card.wide { max-width: 640px; }
.auth-card h2 { font-size: 20px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.auth-card > p.muted { margin-top: 0; margin-bottom: 18px; }
.auth-wrap > .alert { width: 100%; max-width: 400px; }
.error-card { text-align: center; }
.error-code { font-size: 48px; font-weight: 800; color: #cbd5e1; }
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 18px 0 22px; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-bottom: 10px; border-bottom: 3px solid var(--border); }
.stepper li span { width: 22px; height: 22px; border-radius: 50%; background: var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-2); }
.stepper li.current { color: var(--text); font-weight: 600; border-color: var(--primary); }
.stepper li.current span { background: var(--primary); color: #fff; }
.stepper li.done { border-color: var(--up); }
.stepper li.done span { background: var(--up); color: #fff; }
.checklist { list-style: none; padding: 0; margin: 0 0 18px; }
.checklist li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.checklist .ok { color: var(--up); }
.checklist .fail { color: var(--down); font-weight: 600; }

/* ---------- 2FA ---------- */
.qr-box { display: flex; gap: 20px; align-items: center; margin: 12px 0 18px; flex-wrap: wrap; }
#qr img { display: block; border: 1px solid var(--border); border-radius: 8px; image-rendering: pixelated; }
.secret-key { font-size: 15px; letter-spacing: .06em; margin-top: 4px; word-break: break-all; }
.steps-list { padding-left: 18px; color: var(--text-2); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; list-style: none; padding: 14px; margin: 0 0 18px; background: var(--surface-2); border: 1px dashed #cbd5e1; border-radius: 8px; font-size: 15px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-main, .grid-2col { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 25; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .user-meta { display: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .filters, .search { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .test-results li { grid-template-columns: 26px 1fr; }
  .test-results li > div { grid-column: 2; }
}

/* ---------- Step 2: monitoring ---------- */
.stats-5 { grid-template-columns: repeat(5, 1fr); }
.stat-value.small-value { font-size: 24px; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.lvl-ok { color: var(--up); }
.lvl-warn { color: var(--warn); }
.lvl-bad { color: var(--down); }
.lvl-crit { color: var(--down); }
.pad-head { padding: 16px 20px 0; }
.check.inline { margin: 0; white-space: nowrap; font-size: 13px; color: var(--text-2); }
.btn-primary-ghost { color: var(--primary); border-color: #bfdbfe; }
.btn-primary-ghost:hover { background: var(--primary-50); }

.range-picker { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.range-picker button { border: 0; background: var(--surface); padding: 6px 11px; font: 500 12.5px var(--font); color: var(--text-2); cursor: pointer; border-right: 1px solid var(--border); }
.range-picker button:last-child { border-right: 0; }
.range-picker button:hover { background: var(--surface-2); }
.range-picker button.active { background: var(--primary); color: #fff; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.chart-box h3 { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.chart { min-height: 300px; width: 100%; position: relative; }
.chart.chart-tall, .chart-grid.cols-1 .chart { min-height: 400px; }
.chart-empty { display: grid; place-items: center; min-height: 280px; color: var(--muted); font-size: 13px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; text-align: center; padding: 16px; }
.chart-empty.error { color: var(--down); }
.uplot { font-family: var(--font); }
.uplot .u-legend { font-size: 12px; text-align: left; margin-top: 4px; }
.uplot .u-legend .u-marker { border-radius: 3px; }
.stats-table { margin-top: 12px; }
.stats-table td, .stats-table th { padding: 7px 12px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }

/* Interface table */
#if-table:not(.show-all) tr.row-unmonitored { display: none; }
#if-table tr.filtered-out { display: none !important; }
tr.row-unmonitored td { color: var(--muted); }
.util { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.util .bar { flex: 1; background: #eef2f7; }
.bar.lvl-ok span { background: var(--up); }
.bar.lvl-warn span { background: #f59e0b; }
.bar.lvl-crit span { background: var(--down); }

@media (max-width: 1100px) {
  .stats-5 { grid-template-columns: repeat(3, 1fr); }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .stats-5 { grid-template-columns: repeat(2, 1fr); }
  .range-picker button { padding: 6px 8px; }
}
pre.cmd { background: #0b1220; color: #e2e8f0; padding: 14px 16px; border-radius: 8px; font: 13px/1.7 var(--mono); overflow-x: auto; white-space: pre; }

/* ---------- Step 3: MikroTik ---------- */
.stats-6 { grid-template-columns: repeat(6, 1fr); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.search-card .field { margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
.search.grow { flex: 1; }
.search.grow input { width: 100%; }
.log-table td { padding-top: 6px; padding-bottom: 6px; }
@media (max-width: 1100px) { .stats-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) { .stats-6 { grid-template-columns: repeat(2, 1fr); } .search-row { flex-direction: column; } }
.filters.toolbar { margin-bottom: 16px; }
.test-results .t-skip { color: var(--muted); }
.cli-block { border-top: 1px solid var(--border); padding: 8px 0; }
.cli-block summary { cursor: pointer; font-weight: 500; padding: 4px 0; }
.cli-block pre.cmd { margin: 8px 0 4px; max-height: 420px; overflow: auto; white-space: pre; }
.t-ok { color: var(--up); } .t-fail { color: var(--down); }
.job-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); display: none; animation: spin .8s linear infinite; }
.running .spinner, #collect-result:has(#collect-cancel:not([hidden])) .spinner { display: inline-block; }
.job-cancel { display: none; }
.running .job-cancel { display: inline-flex; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- v0.5: alerts ---------- */
.range-picker a { display: inline-block; padding: 6px 11px; font: 500 12.5px var(--font); color: var(--text-2); border-right: 1px solid var(--border); }
.range-picker a:last-child { border-right: 0; }
.range-picker a:hover { background: var(--surface-2); text-decoration: none; }
.range-picker a.active { background: var(--primary); color: #fff; }
.field-label { display: block; font-weight: 500; font-size: 13px; color: var(--text-2); margin: 4px 0 6px; }
.btn-on { background: var(--up-50); color: var(--up); border-color: #a7f3d0; }
.nav-badge { margin-left: auto; background: var(--down); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.alert-strip { display: flex; flex-direction: column; gap: 6px; }
.alert-strip a { color: inherit; }
.section-head { margin: 4px 0 10px; }
.alert-card { border-color: #fecaca; }
pre.diff { margin: 0; max-height: 70vh; overflow: auto; font: 12.5px/1.55 var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre; }
pre.diff .d-add { background: #dcfce7; color: #14532d; display: inline-block; min-width: 100%; }
pre.diff .d-del { background: #fee2e2; color: #7f1d1d; display: inline-block; min-width: 100%; }
pre.diff .d-hunk { color: var(--primary); }
.maint-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.maint-form .field { margin: 0; min-width: 220px; }

/* ---- v0.7 flow analysis ---- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .grid-4 { grid-template-columns: 1fr; } }
ol.steps { margin: 0 0 8px; padding-left: 20px; line-height: 1.9; }
.share-col { width: 130px; }
.share-col .bar { background: #eef2f7; margin-bottom: 3px; }
.share-col .bar span { background: var(--primary); }
details.adv { margin: 4px 0 8px; }
details.adv summary { cursor: pointer; color: var(--text-2); font-size: 13px; margin-bottom: 6px; }
.form-actions .job-bar { margin-right: auto; }
.ip-sub { display: block; font-size: 12px; color: var(--text-2); }
.ip-sub .tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 99px; background: #eef2f7; margin-left: 4px; }
.ip-sub .tag.local { background: #dcfce7; color: #166534; }
#fx-table td { vertical-align: top; }
.flow-snippet { max-height: 360px; }
.row-total td { background: var(--surface-2); border-top: 2px solid var(--border); }
.big-num { display: flex; align-items: baseline; gap: 8px; margin: 4px 0; }
.big-num .mono { font-size: 22px; font-weight: 600; }
.big-num small { color: var(--text-2); }
.small-util { min-width: 150px; }
.small-util .bar { width: 60px; flex: none; }
.report-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.report-row input[type=time] { width: auto; }

/* ---- v0.9 network map ---- */
.map-card { position: relative; overflow: hidden; }
.netmap { display: block; width: 100%; height: 68vh; min-height: 420px; background: #f8fafc; cursor: grab; touch-action: none; user-select: none; }
.netmap:active { cursor: grabbing; }
.netmap .node-box { fill: #fff; stroke-width: 2; }
.netmap .node.movable { cursor: move; }
.netmap .node.sel .node-box { stroke-width: 3.5; filter: drop-shadow(0 2px 6px rgba(37, 99, 235, .35)); }
.netmap .node-icon { font: 700 18px var(--font); fill: #475569; }
.netmap .node-name { font: 600 13px var(--font); fill: #0f172a; }
.netmap .node-sub { font: 11px var(--mono); fill: #64748b; }
.netmap .node-alert { fill: #ef4444; }
.netmap .node-alert-n { font: 700 11px var(--font); fill: #fff; }
.netmap .link { cursor: pointer; }
.netmap .link.sel line:not(.hit) { filter: drop-shadow(0 0 4px rgba(37, 99, 235, .6)); }
.netmap .port-label { font: 10.5px var(--mono); fill: #334155; paint-order: stroke; stroke: #f8fafc; stroke-width: 4px; }
.netmap .port-label.bad { fill: #dc2626; font-weight: 700; }
.netmap .mid-bg { fill: #fff; stroke: #e2e8f0; }
.netmap .mid-bg.hot { stroke: #f59e0b; }
.netmap .mid-bg.bad { fill: #fee2e2; stroke: #fca5a5; }
.netmap .mid-label { font: 10.5px var(--mono); fill: #334155; }
.netmap .mid-label.bad { fill: #b91c1c; font-weight: 700; }
.map-info { position: absolute; top: 12px; right: 12px; width: 300px; max-height: calc(100% - 24px); overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.map-info h3 { margin: 0 24px 6px 0; font-size: 15px; }
.map-info p { margin: 6px 0; }
.map-info-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--text-2); }
.st-up { color: #059669; } .st-down, .st-devdown { color: #dc2626; font-weight: 600; } .st-unknown { color: #64748b; } .st-disabled { color: #94a3b8; }
.map-legend { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.map-legend .lg { display: inline-block; width: 18px; height: 4px; border-radius: 2px; margin-left: 6px; }
.lg-up { background: #10b981; } .lg-down { background: #ef4444; } .lg-unknown { background: #94a3b8; } .lg-disabled { background: #cbd5e1; }
.link-ends { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.link-end { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px 4px; margin: 0; }
.link-end legend { font-weight: 600; padding: 0 6px; }
@media (max-width: 760px) { .link-ends { grid-template-columns: 1fr; } .map-info { position: static; width: auto; } }
.netmap .link-labels { cursor: pointer; }

/* ---- v1.0 OLT / ONU ---- */
.onu-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.onu-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 28px; padding: 0 6px; border-radius: 6px;
  font: 600 12px var(--mono); background: #e2e8f0; color: #334155; }
.onu-chip:hover { text-decoration: none; filter: brightness(.95); }
.onu-chip.on { background: #d1fae5; color: #065f46; }
.onu-chip.weak { background: #fef3c7; color: #92400e; }
.onu-chip.off { background: #fee2e2; color: #991b1b; }
.onu-chip.me { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ---- chart tooltip ---- */
.chart .u-over { overflow: visible; }
.chart-tip { position: absolute; z-index: 20; pointer-events: none; background: rgba(15, 23, 42, .94); color: #f1f5f9; border-radius: 8px;
  padding: 7px 10px; font: 12px var(--font); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); min-width: 160px; max-width: 320px; }
.chart-tip .tip-time { color: #94a3b8; font-size: 11px; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 7px; line-height: 1.55; white-space: nowrap; }
.chart-tip .tip-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.chart-tip .tip-row b { font: 600 12px var(--mono); }
.chart-tip .tip-row i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.chart-tip .tip-more { color: #94a3b8; font-size: 11px; }
.chart.many-series .u-legend { font-size: 11.5px; line-height: 1.4; }
.chart.many-series .u-legend .u-series { padding: 1px 6px; }
.chart.many-series .u-legend .u-value { display: none; }
.chart.many-series .u-legend tr { display: inline-flex; }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.onu-note { color: #475569; font-style: italic; }
.ev-online { color: var(--up); font-weight: 600; }
.ev-offline { color: var(--down); font-weight: 600; }
.note-form { display: flex; gap: 8px; align-items: center; }
.note-form input[type=text] { flex: 1; }
ul.plain { list-style: none; margin: 0 0 12px; padding: 0; }
ul.plain li { padding: 3px 0; border-bottom: 1px solid #f1f5f9; }
.scroll-y { max-height: 420px; overflow-y: auto; }
.sub-head { margin: 16px 0 6px; }
.btn-icon { width: 30px; padding: 0; justify-content: center; font-size: 15px; line-height: 1; }
.btn-icon.spinning { animation: nms-spin 1s linear infinite; }
@keyframes nms-spin { to { transform: rotate(360deg); } }
.row-flash { animation: nms-flash 1.6s ease-out; }
@keyframes nms-flash { from { background: #dbeafe; } to { background: transparent; } }

/* ---- v1.1.2 network map ---- */
.map-toolbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.map-row { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: space-between; align-items: center; }
.map-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.map-toolbar .filters { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.map-toolbar .search input, .map-toolbar select { height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.map-toolbar .search input { width: 220px; }
.map-toolbar .check.inline { font-size: 13px; gap: 5px; }
.map-toolbar .btn-sm { height: 30px; padding: 0 10px; gap: 5px; }
.map-stats { display: flex; flex-wrap: wrap; gap: 4px; }
.map-chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 3px 8px; border-radius: 999px; background: var(--surface); border: 1px solid #e2e8f0; font-size: 12.5px; color: var(--text-2); }
.map-chip b { font-size: 13px; color: #0f172a; }
.map-chip.ok b { color: #059669; }
.map-chip.bad { background: #fef2f2; border-color: #fecaca; }
.map-chip.bad b { color: #dc2626; }
.map-chip.warm b { color: #d97706; }
.map-card:fullscreen { background: #f1f5f9; border-radius: 0; }
.map-card:fullscreen .netmap { height: 100vh; }
.netmap { background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%); height: calc(100vh - 205px); height: calc(100dvh - 205px); }
.netmap .grid-dot { fill: #cbd5e1; }
.netmap .map-bg { pointer-events: none; }
.netmap .node-box { fill: #fff; stroke: #e2e8f0; stroke-width: 1.5; filter: drop-shadow(0 4px 10px rgba(15, 23, 42, .10)); }
.netmap .node.s-down .node-box { fill: #fff5f5; stroke: #f87171; stroke-width: 2; }
.netmap .node.s-disabled { opacity: .55; }
.netmap .node.maint .node-box { stroke: #f59e0b; stroke-dasharray: 6 4; stroke-width: 2; }
.netmap .node.sel .node-box { stroke: #2563eb; stroke-width: 2.5; filter: drop-shadow(0 6px 16px rgba(37, 99, 235, .28)); }
.netmap .node.found .node-box { stroke: #2563eb; stroke-width: 2.5; }
.netmap .node:hover .node-box { filter: drop-shadow(0 8px 18px rgba(15, 23, 42, .16)); }
.netmap .node-glyph path { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.netmap .node-dot { stroke: #fff; stroke-width: 2.5; }
.netmap .dot-up { fill: #10b981; }
.netmap .dot-down { fill: #ef4444; }
.netmap .dot-unknown { fill: #94a3b8; }
.netmap .dot-disabled { fill: #cbd5e1; }
.netmap .pulse { fill: #ef4444; transform-box: fill-box; transform-origin: center; animation: map-pulse 1.4s ease-out infinite; }
@keyframes map-pulse { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(2.8); } }
.netmap .node-name { font: 650 13.5px var(--font); fill: #0f172a; }
.netmap .node-brand { font: 600 10.5px var(--font); fill: #64748b; letter-spacing: .02em; }
.netmap .node-sub { font: 11px var(--mono); fill: #475569; }
.netmap .node-cpu { font: 600 10.5px var(--mono); fill: #059669; }
.netmap .node-cpu.warm { fill: #d97706; }
.netmap .node-cpu.bad { fill: #dc2626; }
.netmap .dim { opacity: .18; }
.netmap .casing { stroke: #fff; stroke-linecap: round; opacity: .9; }
.netmap .wire { stroke-linecap: round; }
.netmap .l-up .wire { stroke: #10b981; }
.netmap .l-warm .wire { stroke: #f59e0b; }
.netmap .l-hot .wire { stroke: #ef4444; }
.netmap .l-down .wire { stroke: #ef4444; animation: map-blink 1.2s ease-in-out infinite; }
.netmap .l-unknown .wire { stroke: #94a3b8; }
@keyframes map-blink { 50% { opacity: .35; } }
.netmap .flow { stroke: rgba(255, 255, 255, .85); stroke-dasharray: 2 14; stroke-linecap: round; pointer-events: none; animation: map-flow 1.6s linear infinite; }
.netmap .flow-1 { animation-duration: 2.6s; }
.netmap .flow-3 { animation-duration: .8s; }
@keyframes map-flow { to { stroke-dashoffset: -32; } }
.netmap .link.sel .wire { filter: drop-shadow(0 0 5px rgba(37, 99, 235, .7)); }
.netmap .mid-bg { fill: #fff; stroke: #d1fae5; filter: drop-shadow(0 2px 4px rgba(15, 23, 42, .08)); }
.netmap .mb-warm { stroke: #fcd34d; }
.netmap .mb-hot { stroke: #fca5a5; fill: #fff7ed; }
.netmap .mb-down { fill: #fee2e2; stroke: #fca5a5; }
.netmap .mb-unknown { stroke: #e2e8f0; }
.netmap .mid-label { font: 600 10.5px var(--mono); fill: #065f46; }
.netmap .ml-warm { fill: #92400e; }
.netmap .ml-hot, .netmap .ml-down { fill: #b91c1c; }
.netmap .ml-unknown { fill: #475569; }
.netmap.hide-ports .port-label, .netmap.hide-traffic .mid-bg, .netmap.hide-traffic .mid-label { display: none; }
@media (prefers-reduced-motion: reduce) { .netmap .flow, .netmap .pulse, .netmap .l-down .wire { animation: none; } }
.map-ctrl { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 10px rgba(15, 23, 42, .08); }
.map-ctrl button { width: 34px; height: 34px; border: 0; border-bottom: 1px solid #f1f5f9; background: none; font-size: 17px; cursor: pointer; color: #334155; }
.map-ctrl button:last-child { border-bottom: 0; }
.map-ctrl button:hover { background: #f1f5f9; }
.map-legend-box { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; max-width: calc(100% - 24px);
  padding: 6px 12px; background: rgba(255, 255, 255, .92); border: 1px solid #e2e8f0; border-radius: 10px; font-size: 11.5px; color: var(--text-2); }
.map-legend-box span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend-box .lg { display: inline-block; width: 16px; height: 4px; border-radius: 2px; }
.lg-warm { background: #f59e0b; }
.lg-hot { background: #ef4444; }
.map-legend-box .lg-sep { width: 1px; height: 14px; background: #e2e8f0; }
.map-legend-box .lt { display: inline-block; width: 12px; height: 12px; border-radius: 4px; }
.lt.t-router { background: #2563eb; } .lt.t-switch { background: #0d9488; } .lt.t-olt { background: #9333ea; } .lt.t-server { background: #475569; }
.kv-tight { grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 12.5px; margin: 6px 0; }
@media (max-width: 760px) { .map-legend-box { position: static; margin: 8px; } .map-ctrl { top: 8px; left: 8px; } }

/* ---- alert filters ---- */
.filter-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.filter-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-grid .grow { flex: 1 1 240px; }
.filter-grid select, .filter-grid input[type=date] { height: 34px; }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.type-chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid #e2e8f0; font-size: 12px; color: var(--text-2); background: #f8fafc; }
.type-chip b { color: #0f172a; }
.type-chip:hover { text-decoration: none; border-color: #93c5fd; }
.type-chip.on { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.filter-grid select, .filter-grid input[type=date] { width: auto; min-width: 0; flex: 0 1 auto; max-width: 240px; }
.filter-grid .search { flex: 1 1 260px; width: auto; }

/* ---- v1.2 history pop-up, LAN state ---- */
.nms-dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 20px 50px rgba(15, 23, 42, .3); }
.nms-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.nms-dialog .dialog-body { padding: 20px 22px; overflow: auto; max-height: calc(100vh - 48px); }
.nms-dialog .dialog-close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--text-2); }
.hist-head h2 { margin: 0 30px 4px 0; font-size: 17px; }
.hist-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.onu-actions { display: flex; gap: 4px; }
.lan-st { display: inline-block; margin-top: 3px; padding: 0 6px; border-radius: 4px; font-size: 11px; }
.lan-up { background: #ecfdf5; color: #047857; }
.lan-down { background: #fef2f2; color: #b91c1c; font-weight: 600; }
.lan-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.lan-box { padding: 10px 14px; border-radius: 10px; min-width: 160px; }
.lan-box.lan-up { background: #ecfdf5; color: #065f46; }
.lan-box.lan-down { background: #fef2f2; color: #991b1b; }
.table.compact td, .table.compact th { padding: 6px 10px; }

/* ---- v1.3 NTTN ---- */
.nttn-fields { margin: 12px 0; }
.nttn-tag { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 999px; background: #f5f3ff; color: #6d28d9; font-size: 11.5px; }
.netmap .pop-cloud { fill: #fdf2f8; stroke: #db2777; stroke-width: 2; filter: drop-shadow(0 4px 10px rgba(15, 23, 42, .10)); }
.netmap .pop-node.pop-bad .pop-cloud { fill: #fef2f2; stroke: #ef4444 !important; stroke-width: 2.5; }
.netmap .pop-node.sel .pop-cloud { stroke-width: 3; filter: drop-shadow(0 6px 16px rgba(219, 39, 119, .35)); }
.netmap .pop-provider { font: 700 12px var(--font); fill: #9d174d; }
.netmap .pop-name { font: 11px var(--font); fill: #475569; }
.netmap .via-nttn .wire { stroke-dasharray: 14 6; }
.netmap .mb-nttn { fill: #fdf2f8; stroke: #f9a8d4; }
.netmap .ml-nttn { fill: #9d174d; }
.lt.t-pop { background: #db2777; }
.complaint-text { width: 100%; font: 13px var(--mono); padding: 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }

/* Sortable table headers */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable::after { content: "↕"; opacity: .35; margin-left: .3em; font-size: .85em; }
th.sorted-asc::after { content: "↑"; opacity: .9; }
th.sorted-desc::after { content: "↓"; opacity: .9; }
th.sortable:hover, th.sortable:focus-visible { color: var(--text, inherit); text-decoration: underline; outline: none; }

/* Management IP that opens the device's web interface */
.ip-link { white-space: nowrap; }
.ip-link .icon { vertical-align: -1px; opacity: .6; }

/* OLT / ONU tables: one line per row (the table scrolls sideways instead of wrapping) */
.table.no-wrap th, .table.no-wrap td { white-space: nowrap; }
.table.no-wrap td .small, .table.no-wrap td .muted { white-space: nowrap; }

/* ONU table: the status cell stays narrow (long OLT status texts are cut, full text on hover) */
.table.no-wrap td.st-cell { white-space: normal; min-width: 96px; max-width: 150px; }
.table.no-wrap td.st-cell .cut, .table.no-wrap td.cut-cell .cut { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table.no-wrap td.cut-cell { max-width: 280px; }

/* Custom period for graphs */
.range-custom { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin: 8px 0 4px; font-size: 13px; color: var(--muted); }
.range-custom[hidden] { display: none; }
.range-custom label { display: flex; flex-direction: column; gap: 3px; }
.range-custom input { height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; }
.range-picker button[data-range-custom].active { background: var(--primary, #2563eb); color: #fff; }
.card-head .range-custom { flex-basis: 100%; justify-content: flex-end; }

/* Graphs page */
.graph-filters .check-row { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.graph-range { position: sticky; top: 0; z-index: 5; padding-top: 12px; padding-bottom: 12px; }
.graph-range .card-head { margin-bottom: 0; flex-wrap: wrap; }
.graph-device .card-head h2 a { color: inherit; }
.chart-box h3 a { color: inherit; }
#onu-table th, #onu-table td { padding-left: 10px; padding-right: 10px; }
#onu-table .onu-actions .btn { padding: 0 9px; }
.graph-filters .search-row { flex-wrap: wrap; }
.graph-filters .search-row .search { min-width: 240px; }
.graph-filters .search-row select { flex: 1 1 160px; min-width: 150px; }

/* In-page change confirmations */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 24px rgba(15, 23, 42, .25); transition: opacity .5s, transform .5s; }
.toast-bad { background: #b91c1c; }
.toast.gone { opacity: 0; transform: translateY(6px); }
.btn-link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; font: inherit; }
.manual-flag { display: block; margin-top: 2px; }
.manual-flag[hidden] { display: none; }

/* Legend table under every graph */
.chart-legend { margin-top: 6px; }
.chart-legend .table th, .chart-legend .table td { padding: 4px 8px; font-size: 12px; }
.chart-legend .table tfoot td { border-bottom: 0; padding-top: 6px; }
.chart-legend .swatch, .stats-table .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Search bars with several filters: the text box always keeps room to type */
.search-card .search-row { flex-wrap: wrap; }
.search-card .search-row .search.grow { flex: 1 1 340px; min-width: 260px; }
.search-card .search-row .search input { width: 100%; min-width: 0; }
.search-card .search-row > select { flex: 0 1 180px; min-width: 140px; }
.btn-group { display: inline-flex; } .btn-group .btn { border-radius: 0; margin-left: -1px; } .btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; } .btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

/* ---------- Graph trees ---------- */
.tree-pick { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.graph-range .tree-pick { margin-top: 10px; }
.tree-pick select { min-width: 180px; }
.chart-box h3 .tree-add, .chart-box h3 .chart-remove { margin-left: 8px; font-weight: 500; }
.chart-box h3 .chart-remove { float: right; }

.stats-table tr[data-k] { cursor: pointer; }
.stats-table tr.series-off td { opacity: .45; text-decoration: line-through; }
.chart-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.chart-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .chart-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cols-pick { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cols-pick button { border: 0; background: var(--surface); padding: 5px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.cols-pick button + button { border-left: 1px solid var(--border); }
.cols-pick button.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.tree-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.tree-nav { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding: 14px 12px; }
.tree-nav-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding: 0 4px; }
.tree-nav ul { list-style: none; margin: 0; padding: 0; }
.tree-nav ul ul { padding-left: 14px; border-left: 1px solid var(--border); margin-left: 9px; }
.tree-nav summary { cursor: pointer; padding: 2px 0; list-style-position: inside; display: list-item; }
.tree-nav summary .tree-link { vertical-align: middle; }
.tree-nav summary::marker { color: var(--muted); }
.tree-link { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; color: var(--text); font-size: 13px; max-width: 100%; }
.tree-link:hover { background: var(--surface-2); text-decoration: none; }
.tree-link.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.tree-link.leaf { font-size: 12.5px; color: var(--text-2); }
.tree-root > li > details > summary .tree-link { font-weight: 600; }
.dot-status { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex: none; }
.dot-status.st-up { background: var(--up); } .dot-status.st-down { background: var(--down); }
.tree-settings { margin-top: 10px; display: block; }
.tree-settings[open] { display: block; }
.tree-settings[open] > summary { margin-bottom: 10px; }
.tree-settings[open] > form + form { margin-top: 10px; }
.tree-settings summary { cursor: pointer; color: var(--muted); }
.chart-box h3 { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.chart-tools { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; }
.chart-tools .inline-form { display: inline; }
.drag-handle { cursor: grab; }
.drag-handle .grip { color: #94a3b8; letter-spacing: -2px; user-select: none; }
.chart-box.dragging { opacity: .45; }
.chart-box.drop-target { outline: 2px dashed var(--primary); outline-offset: 2px; }
@media (max-width: 1000px) { .tree-layout { grid-template-columns: minmax(0, 1fr); } .tree-nav { position: static; max-height: none; } }

.chart-legend .table th, .chart-legend .table td { white-space: nowrap; }
.chart-legend .table td .muted { font-size: 11px; margin-left: 2px; }
.chart-legend .table tfoot td { white-space: normal; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 16px; margin: 8px 0; }
.check-grid.disabled { opacity: .55; }
.tree-settings-form { display: grid; gap: 10px; width: 100%; max-width: 900px; }
.tree-settings-form > .btn { justify-self: start; }
.tree-settings-form .table-wrap { max-height: 320px; overflow: auto; }
a[data-noaccess] { color: inherit; cursor: default; text-decoration: none; }
.syslog-msg { white-space: pre-wrap; word-break: break-word; min-width: 320px; }
.nowrap { white-space: nowrap; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 12px; }
.text-down { color: var(--down); }
.alert-note { margin-top: 4px; color: var(--text-2); background: var(--surface-2); border-left: 3px solid var(--primary); padding: 3px 8px; border-radius: 4px; }
.note-edit summary { cursor: pointer; color: var(--muted); display: inline-block; margin-top: 3px; }
.note-edit input { min-width: 260px; }
.ack-form input { width: 150px; }

/* ---------- Dark theme (topbar toggle; remembered in the browser) ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120; --surface: #111a2e; --surface-2: #16213a; --border: #24314d;
  --text: #e2e8f0; --text-2: #b6c2d6; --muted: #8796ae;
  --primary: #60a5fa; --primary-600: #3b82f6; --primary-50: #13254a;
  --up: #34d399; --up-50: #0d2b22; --down: #f87171; --down-50: #3a1418; --warn: #fbbf24; --warn-50: #33270c;
  --unknown: #94a3b8; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
html[data-theme="dark"] code, html[data-theme="dark"] .util .bar, html[data-theme="dark"] .share-col .bar, html[data-theme="dark"] .ip-sub .tag { background: #1e2a44; }
html[data-theme="dark"] .table tbody tr:hover { background: #18233c; }
html[data-theme="dark"] .row-down { background: #2a1217; }
html[data-theme="dark"] .badge, html[data-theme="dark"] .badge-unknown, html[data-theme="dark"] .badge-muted { background: #1e2a44; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #0e1729; border-color: #2b3a59; color: var(--text); }
html[data-theme="dark"] .stat:hover, html[data-theme="dark"] .btn:hover { border-color: #3b4d72; }
html[data-theme="dark"] .alert-success { border-color: #14532d; color: #86efac; }
html[data-theme="dark"] .alert-error { border-color: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .alert-warning { border-color: #78350f; color: #fcd34d; }
html[data-theme="dark"] .alert-info { border-color: #1e3a8a; color: #93c5fd; }
html[data-theme="dark"] .netmap, html[data-theme="dark"] .map-card:fullscreen, html[data-theme="dark"] .complaint-text { background: #0e1729; }
html[data-theme="dark"] .map-legend-box { background: rgba(17, 26, 46, .92); border-color: #24314d; }
html[data-theme="dark"] .map-chip b, html[data-theme="dark"] .type-chip b { color: var(--text); }
html[data-theme="dark"] .map-chip.bad, html[data-theme="dark"] .lan-down, html[data-theme="dark"] .lan-box.lan-down, html[data-theme="dark"] .onu-chip.off { background: #3a1418; color: #fca5a5; }
html[data-theme="dark"] .lan-up, html[data-theme="dark"] .lan-box.lan-up, html[data-theme="dark"] .onu-chip.on { background: #0d2b22; color: #6ee7b7; }
html[data-theme="dark"] .onu-chip.weak { background: #33270c; color: #fcd34d; }
html[data-theme="dark"] .onu-chip { background: #1e2a44; color: #cbd5e1; }
html[data-theme="dark"] .type-chip, html[data-theme="dark"] .map-ctrl { border-color: #2b3a59; }
html[data-theme="dark"] .type-chip.on { background: #13254a; color: #93c5fd; }
html[data-theme="dark"] .map-ctrl button:hover { background: #1e2a44; }
html[data-theme="dark"] pre.diff .d-add { background: #0d2b22; color: #86efac; }
html[data-theme="dark"] pre.diff .d-del { background: #3a1418; color: #fca5a5; }
html[data-theme="dark"] .nttn-tag, html[data-theme="dark"] .role-admin { background: #241a44; color: #c4b5fd; }
html[data-theme="dark"] .ip-sub .tag.local { background: #0d2b22; color: #86efac; }
.theme-toggle { font-size: 16px; line-height: 1; }

/* ---------- Wallboard (NOC TV) ---------- */
.wall { padding: 18px 22px; min-height: 100vh; }
.wall-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.wall-head h1 { font-size: 22px; }
.wall-clock { font: 600 22px var(--mono); color: var(--text-2); }
.wall-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.wall-list { list-style: none; margin: 0; padding: 0; }
.wall-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: 15px; }
.wall-list li:last-child { border-bottom: 0; }
.wall .card h2 { font-size: 17px; margin-bottom: 10px; }
.wall-ok { color: var(--up); font-size: 18px; font-weight: 600; padding: 10px 0; }
html[data-theme="dark"] .topbar { background: rgba(17, 26, 46, .92); }
html[data-theme="dark"] .avatar { background: #13254a; color: #93c5fd; }
.sub-site.depth-1 { padding-left: 34px !important; } .sub-site.depth-2 { padding-left: 56px !important; } .sub-site.depth-3, .sub-site.depth-4 { padding-left: 78px !important; }

/* ---------- Pop-ups ---------- */
.popover { position: absolute; z-index: 60; min-width: 240px; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18); padding: 10px 12px; font-size: 13px; }
.popover-title { font-weight: 600; margin-bottom: 6px; }
.popover .table th, .popover .table td { padding: 3px 8px; font-size: 12.5px; }
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); width: min(640px, 100%); max-height: 90vh; overflow: auto; padding: 14px 18px 18px; }
.modal.modal-wide { width: min(1000px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.modal-head strong { font-size: 15px; }
.modal pre { max-height: 50vh; overflow: auto; }
.core-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; margin: 6px 0 12px; }
.core { display: grid; grid-template-columns: 42px 1fr 40px; align-items: center; gap: 6px; }
.core .bar { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.core .bar span { display: block; height: 100%; background: var(--up); }
.dialog-body h4 { margin: 14px 0 6px; font-size: 13px; }
.pppoe-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.pppoe-tools .btn { padding: 1px 8px; font-size: 11.5px; }
.ping-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ping-bar input { width: 90px; height: 30px; }
.ping-out { background: #0b1220; color: #d1fae5; font: 12.5px/1.5 var(--mono); padding: 10px; border-radius: 8px; height: 340px; overflow: auto; margin: 0; white-space: pre; }
.ping-stats { margin-top: 8px; font-family: var(--mono); }
.live-now { display: flex; gap: 22px; align-items: baseline; margin-bottom: 8px; }
.live-now b { font-size: 20px; }
.live-chart { min-height: 300px; }

/* ---- Flow analysis charts ---- */
.flow-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.flow-chart h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-2); }
.flow-chart-wide { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.donut { display: flex; align-items: center; gap: 14px; }
.donut-svg { width: 150px; height: 150px; flex: none; }
.donut-track { stroke: var(--surface-2); }
.donut-seg { transition: opacity .15s, stroke-width .15s; cursor: pointer; }
.donut-seg.dim { opacity: .25; }
.donut-c1 { font-size: 15px; font-weight: 700; fill: var(--text); }
.donut-c2 { font-size: 10px; fill: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; font-size: 12px; }
.donut-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 46px; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 6px; cursor: default; }
.donut-legend li.active { background: var(--primary-50); }
.donut-legend .lg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .lg-val, .donut-legend .lg-pct { text-align: right; color: var(--text-2); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.hbar-key { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.hbar-key .swatch + span { margin-right: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 170px; gap: 10px; align-items: center; padding: 3px 0; font-size: 12px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: flex; height: 12px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-seg { width: 0; transition: width .5s ease; }
.hbar-down { background: #10b981; } .hbar-up { background: #2563eb; }
.hbar-val { text-align: right; color: var(--text-2); }
html[data-theme="dark"] .donut-track, html[data-theme="dark"] .hbar-track { stroke: #1e2a44; background: #1e2a44; }
html[data-theme="dark"] .donut-legend li.active { background: #18233c; }
@media (max-width: 640px) {
  .donut { flex-direction: column; align-items: stretch; } .donut-svg { margin: 0 auto; }
  .hbar-row { grid-template-columns: 1fr; gap: 2px; } .hbar-val { text-align: left; }
}
.diag-dirs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 14px; }
.diag-dir { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 640px) { .diag-dirs { grid-template-columns: repeat(2, 1fr); } }

/* ---- Web terminal ---- */
.modal.modal-term { width: min(1120px, 100%); max-height: 94vh; display: flex; flex-direction: column; }
.term-wrap { display: flex; flex-direction: column; min-height: 0; position: relative; }
.term-scroll { background: #0b1220; color: #d7dee9; border-radius: 8px; padding: 8px 10px; height: min(66vh, 560px); overflow: auto; cursor: text; }
.term-screen { font-family: var(--mono); font-size: 13px; line-height: 1.3; white-space: pre; }
.term-line { min-height: 1.3em; }
.term-cursor { background: #d7dee9; color: #0b1220; }
.term-input { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.term-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.t-bold { font-weight: 700; } .t-rev { background: #d7dee9; color: #0b1220; }
.tf0 { color: #64748b; } .tf1 { color: #f87171; } .tf2 { color: #4ade80; } .tf3 { color: #facc15; } .tf4 { color: #60a5fa; } .tf5 { color: #e879f9; } .tf6 { color: #22d3ee; } .tf7 { color: #e2e8f0; }
.tf8 { color: #94a3b8; } .tf9 { color: #fca5a5; } .tf10 { color: #86efac; } .tf11 { color: #fde68a; } .tf12 { color: #93c5fd; } .tf13 { color: #f0abfc; } .tf14 { color: #67e8f9; } .tf15 { color: #fff; }
.tb0 { background: #1e293b; } .tb1 { background: #7f1d1d; } .tb2 { background: #14532d; } .tb3 { background: #713f12; } .tb4 { background: #1e3a8a; } .tb5 { background: #701a75; } .tb6 { background: #164e63; } .tb7 { background: #cbd5e1; color: #0b1220; }
.term-dock { position: fixed; right: 16px; bottom: 16px; z-index: 65; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.term-chip { background: #0b1220; color: #d7dee9; border: 1px solid #334155; border-radius: 99px; padding: 6px 14px; font-size: 13px; cursor: pointer; box-shadow: var(--shadow); }
.term-chip:hover { border-color: var(--primary); }
@media (max-width: 640px) { .term-screen { font-size: 11px; } }

/* ---- Network map on phones ---- */
.map-ctrl { z-index: 3; }
.map-card:fullscreen .map-info { max-height: 45%; }
.map-card.map-pseudo-full { position: fixed; inset: 0; z-index: 90; border-radius: 0; margin: 0; }
.map-card.map-pseudo-full .netmap { height: 100vh; height: 100dvh; min-height: 0; }
body.no-scroll { overflow: hidden; }
@media (max-width: 760px) {
  .netmap { height: 62vh; min-height: 320px; }
  .map-ctrl button { width: 42px; height: 42px; font-size: 20px; }
  .map-toolbar .filters { width: 100%; }
  .map-toolbar .search { flex: 1 1 100%; }
  .map-card .map-info { position: absolute; left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-height: 45%; z-index: 4; box-shadow: 0 -6px 24px rgba(15, 23, 42, .18); }
  .map-card.map-pseudo-full .map-legend-box, .map-card:fullscreen .map-legend-box { display: none; }
}
.live-svg { display: block; width: 100%; height: auto; }
.live-grid { stroke: var(--border); stroke-width: 1; }
.live-base { stroke: var(--muted); stroke-width: 1; }
.live-axis { font: 11px var(--mono); fill: var(--muted); }
.live-bar-down { fill: #10b981; } .live-bar-up { fill: #2563eb; }
.live-slot:hover rect { opacity: .75; }
.sw-down { background: #10b981; } .sw-up { background: #2563eb; }
.live-now .swatch { margin-right: 6px; }
.pop-result { display: flex; gap: 10px; align-items: center; font-size: 14px; margin: 6px 0 2px; }
.pop-result .spinner { display: inline-block; }
.pop-result.ok { color: var(--up); } .pop-result.bad { color: var(--down); }
.loading-dim { opacity: .45; transition: opacity .15s; pointer-events: none; }
.badge-uplink { background: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; font-weight: 600; text-decoration: none; }
.badge-uplink:hover { background: #ede9fe; }
html[data-theme="dark"] .badge-uplink { background: #2e1a47; color: #d8b4fe; border-color: #4c1d95; }
.th-sub { display: block; font-size: 10.5px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.live-move { will-change: transform; }
button.map-chip { cursor: pointer; font: inherit; font-size: 12px; }
button.map-chip:hover { border-color: var(--primary); }
button.map-chip.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-50); background: var(--primary-50); }
.map-stat-list { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0 0 8px; }
.map-help { margin-top: 6px; font-size: 11.5px; }
.map-stat-list .btn-link { padding: 0; }
html[data-theme="dark"] button.map-chip.active { background: #18233c; }
/* ---- OLT: what the NMS could read ---- */
details.olt-data > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
details.olt-data > summary::-webkit-details-marker { display: none; }
details.olt-data > summary h2::before { content: '▸ '; color: var(--muted); }
details.olt-data[open] > summary h2::before { content: '▾ '; }
.olt-data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 10px 0; }
.olt-data-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.olt-data-item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.olt-data-icon { font-weight: 700; width: 18px; text-align: center; }
.olt-data-item.st-ok .olt-data-icon { color: var(--up); }
.olt-data-item.st-part .olt-data-icon { color: var(--warn); }
.olt-data-item.st-miss { border-color: #fecaca; background: var(--down-50); }
.olt-data-item.st-miss .olt-data-icon { color: var(--down); }
.olt-data-item.st-na { opacity: .6; }
html[data-theme="dark"] .olt-data-item.st-miss { border-color: #7f1d1d; }
.live-chart { position: relative; }
.live-tip { position: absolute; top: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font: 12px var(--mono); box-shadow: var(--shadow); pointer-events: none; min-width: 120px; }
.live-cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.live-avg-down { stroke: #059669; stroke-width: 1.2; stroke-dasharray: 6 4; }
.live-avg-up { stroke: #1d4ed8; stroke-width: 1.2; stroke-dasharray: 6 4; }
.live-now .live-pause { margin-left: auto; }
.live-msg { color: var(--down); }
.audit-filters .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.audit-filters .filters select { max-width: 200px; }
.audit-filters p { margin: 8px 0 0; }
.audit-details { max-width: 520px; white-space: pre-line; word-break: break-word; }
.btn-live { margin-left: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); border-radius: 99px; font-size: 11px; padding: 0 8px; line-height: 18px; cursor: pointer; vertical-align: 1px; }
.btn-live::before { content: '● '; color: var(--up); }
.btn-live:hover { border-color: var(--primary); }
.live-wait { position: absolute; left: 0; right: 0; top: 110px; text-align: center; display: flex; justify-content: center; gap: 8px; align-items: center; }
.live-wait .spinner { display: inline-block; }
.pop-result { white-space: pre-wrap; }
.pop-result.pop-mono { font-family: var(--mono); font-size: 12.5px; display: block; overflow-x: auto; }
.snmp-agent { border-top: 1px solid var(--border); padding-top: 10px; margin: 10px 0; }
.snmp-agent .actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.confirm-text { white-space: pre-line; margin: 4px 0 16px; font-size: 14px; }
.confirm-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg .btn.active { background: var(--primary, #2563eb); color: #fff; border-color: transparent; }
.pad-x { padding: 0 18px; }
.outage-line { margin: 0 0 12px; }
.snmp-why { max-width: 260px; white-space: normal; }
/* Latency graphs (Smokeping-like) */
.smoke { position: relative; width: 100%; }
.smoke-mini { width: 220px; min-height: 40px; }
.smoke-cell { width: 230px; }
.smoke-svg { display: block; width: 100%; height: auto; }
.smoke-mini .smoke-svg { width: 220px; }
.sm-grid { stroke: var(--border); stroke-width: 1; }
.sm-axis { fill: var(--muted); font-size: 11px; }
.sm-band { fill: #cbd5e1; }
.sm-iqr { fill: #94a3b8; }
.sm-med.sm-l0 { fill: #16a34a; } .sm-med.sm-l1 { fill: #2563eb; } .sm-med.sm-l2 { fill: #f59e0b; } .sm-med.sm-l3 { fill: #dc2626; }
.sm-dead { fill: #7f1d1d; }
.sm-lossbar { fill: rgba(220, 38, 38, .55); }
.sm-jitter { fill: none; stroke: #2563eb; stroke-width: 1.5; }
.sm-cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.smoke-tip { position: absolute; left: 50px; top: 4px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.5; white-space: pre-line; pointer-events: none; box-shadow: 0 6px 18px rgba(15, 23, 42, .14); max-width: 260px; }
.smoke-legend .sw { display: inline-block; width: 12px; height: 10px; border-radius: 2px; vertical-align: middle; margin: 0 2px 0 8px; }
.sw-band { background: #cbd5e1; } .sw-iqr { background: #94a3b8; } .sw-med { background: #16a34a; }
.sw-l0 { background: #16a34a; } .sw-l1 { background: #2563eb; } .sw-l2 { background: #f59e0b; } .sw-l3 { background: #dc2626; }
:root[data-theme="dark"] .sm-band { fill: #334155; } :root[data-theme="dark"] .sm-iqr { fill: #64748b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sm-band { fill: #334155; } :root:not([data-theme="light"]) .sm-iqr { fill: #64748b; } }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.cfg-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cfg-box h3 { margin: 0; font-size: 14px; }
.cfg-box .field { width: 100%; }
.cfg-row { display: grid; grid-template-columns: 70px 1fr 90px; gap: 8px; width: 100%; }

/* ---------- Phones: compact boxes (same content, less padding and smaller type) ---------- */
@media (max-width: 640px) {
  .content { padding: 12px 10px; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .page-title { font-size: 16px; }
  .card { padding: 12px; margin-bottom: 12px; border-radius: 10px; }
  .card.flush { padding: 0; }
  .pad-head { padding: 12px 12px 0; }
  .pad { padding: 12px; }
  .card-head { margin-bottom: 10px; gap: 8px; }
  .card-head h2 { font-size: 15px; }
  .stats, .stats-5, .stats-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .stat { padding: 10px 12px; border-radius: 10px; }
  .stat-label { font-size: 10.5px; letter-spacing: .04em; }
  .stat-value { font-size: 22px; }
  .stat-value.small-value { font-size: 17px; }
  .stat-value small { font-size: 12px; }
  .stat-sub { font-size: 11.5px; }
  .grid-2, .grid-3, .grid-4, .grid-2col, .grid-main { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .btn { height: 34px; padding: 0 11px; font-size: 13px; }
  .btn-sm { height: 30px; padding: 0 9px; }
  .btn-row { gap: 6px; }
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .filters { gap: 6px; }
  .filters select, .filters input, .filters .search { flex: 1 1 140px; min-width: 0; width: auto; }
  .filters .search { flex-basis: 100%; }
  .alert { padding: 9px 11px; font-size: 13px; margin-bottom: 10px; }
  .table { font-size: 13px; }
  .table th { padding: 8px 8px; font-size: 10.5px; }
  .table td { padding: 8px 8px; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); gap: 7px 10px; }
  .kv dt { font-size: 12px; }
  .chart { min-height: 220px; }
  .field input, .field select, .field textarea { font-size: 16px; }   /* no zoom-in on iPhone when typing */
  .modal { padding: 12px 14px 14px; }
  .cfg-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .smoke-mini, .smoke-mini .smoke-svg { width: 160px; }
  .smoke-cell { width: 170px; }
}
@media (max-width: 640px) {
  .card-head .btn { white-space: normal; height: auto; min-height: 30px; padding: 5px 10px; text-align: left; max-width: 100%; }
}
/* Long lists: the table scrolls inside its box and its header row stays in view */
/* The scroll box fits under the top bar, so its header row is never hidden behind it */
.count-line { font-weight: 500; }

/* ---------- Phones / tablets: search and filter bars (OLT, ONU pages) ---------- */
@media (max-width: 860px) {
  .search-card .search-row { flex-direction: row; flex-wrap: wrap; }
  .search-card .search-row .search.grow { flex: 1 1 100%; min-width: 0; }
  .search-card .search-row > select { flex: 1 1 calc(50% - 4px); min-width: 0; max-width: none; width: auto; }
  .search-card .search-row > .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
  .card-head > .filters { flex: 1 1 100%; }
  .card-head > .filters select { flex: 1 1 calc(50% - 4px); min-width: 0; width: auto; }
  .card-head > .filters .search { flex: 1 1 100%; }
  .card-head > .btn-group { flex-wrap: wrap; }
  .card-head h2 { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .filters select, .filters input, .search-row select, .search-row input { font-size: 16px; }   /* no zoom-in on iPhone */
}
/* ◀ Previous / Next ▶ under the range buttons */
.range-shift { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-shift .range-label { font-size: 12px; color: var(--muted); min-width: 70px; text-align: center; }
.range-shift .btn[disabled] { opacity: .45; cursor: default; }
.sw-jit { background: #2563eb; }
.smoke-help { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.smoke-help summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.smoke-help ul { margin: 6px 0; padding-left: 18px; } .smoke-help li { margin: 4px 0; }
/* ONU LAN ports: one small box per port */
.lan-chips { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.lan-chips .lan-st { margin-top: 0; min-width: 18px; text-align: center; font-weight: 600; }
.lan-chips.lan-old { opacity: .45; }
.lan-cell .muted { font-size: 11px; margin-top: 2px; }
.smoke-legend .inline-check { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-weight: 600; color: var(--text-2); }
/* One-click copy for commands: the icon sits beside the block (never over the text) */
.copy-wrap { display: flex; align-items: flex-start; gap: 6px; }
.copy-wrap > pre { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.copy-btn { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 6px; width: 28px; height: 28px; padding: 0; font: 600 14px var(--font); line-height: 26px; text-align: center; cursor: pointer; }
.copy-btn:hover { background: var(--primary-50); color: var(--primary); }
.copy-btn.copied { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.copy-btn.copy-inline { width: 22px; height: 20px; line-height: 18px; font-size: 12px; margin-left: 4px; vertical-align: baseline; }
.copy-ta { position: fixed; left: -9999px; top: 0; }
.cfg-row { grid-template-columns: 70px minmax(130px, 1fr) 90px; } .cfg-row select, .cfg-row input { width: 100%; min-width: 0; }
/* Values read from the OLT on the ONU page: spinner while reading, green when read, red when it failed */
.read-state { margin: 4px 0 8px; padding: 6px 10px; border-radius: 8px; font-size: 13px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.read-state.rs-busy::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 7px; vertical-align: -1px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rs-spin .8s linear infinite; }
@keyframes rs-spin { to { transform: rotate(360deg); } }
.read-state.rs-busy { color: var(--primary); background: var(--primary-50); border-color: transparent; }
.read-state.rs-ok { color: #047857; background: #ecfdf5; border-color: #a7f3d0; font-weight: 600; }
.read-state.rs-down, .read-state.rs-bad { color: #b91c1c; background: #fef2f2; border-color: #fecaca; font-weight: 600; }
html[data-theme="dark"] .read-state.rs-ok { background: #0d2b22; color: #6ee7b7; border-color: #14532d; }
html[data-theme="dark"] .read-state.rs-down, html[data-theme="dark"] .read-state.rs-bad { background: #3a1418; color: #fca5a5; border-color: #7f1d1d; }
.pppoe-tools .btn-icon { width: 30px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ONU page: "LAN ports now" overview (v1.9.26) */
.ports-now { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.ports-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ports-head h3 { margin: 0; }
.ports-table td.ok { color: #047857; font-weight: 600; }
.ports-table td.bad { color: #b91c1c; font-weight: 600; }
html[data-theme="dark"] .ports-table td.ok { color: #6ee7b7; }
html[data-theme="dark"] .ports-table td.bad { color: #fca5a5; }
.ports-raw pre { max-height: 260px; overflow: auto; white-space: pre-wrap; }

/* Live traffic window (v1.9.26) */
.live { display: flex; flex-direction: column; gap: 10px; }
.live-top { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: stretch; }
.live-tile { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.live-tile.down { border-top: 3px solid #10b981; }
.live-tile.up { border-top: 3px solid #2563eb; }
.live-tile-name { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.live-tile b { font-size: 24px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-tile-sub { display: flex; gap: 12px; flex-wrap: wrap; }
.live-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; justify-content: space-between; }
.live-side .live-pause { margin-left: 0; }
.live-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.live-state i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.live-state.ls-live { color: #047857; background: #ecfdf5; }
.live-state.ls-live i { animation: live-pulse 1.4s ease-in-out infinite; }
.live-state.ls-wait { color: #b45309; background: #fffbeb; }
.live-state.ls-pause { color: var(--muted); background: var(--bg); }
.live-state.ls-bad { color: #b91c1c; background: #fef2f2; }
html[data-theme="dark"] .live-state.ls-live { background: #0d2b22; color: #6ee7b7; }
html[data-theme="dark"] .live-state.ls-wait { background: #33260b; color: #fcd34d; }
html[data-theme="dark"] .live-state.ls-bad { background: #3a1418; color: #fca5a5; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.live-info { display: flex; gap: 6px 14px; flex-wrap: wrap; min-height: 1em; }
.live-info:empty { display: none; }
.live .live-chart { min-height: 0; border: 1px solid var(--border); border-radius: 12px; padding: 6px 4px 0; background: var(--surface); }
.live .live-wait { top: 45%; }
.live-foot { margin: 0; }
@media (max-width: 600px) {
  .live-top { grid-template-columns: 1fr 1fr; }
  .live-side { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .live-tile { padding: 8px 10px; }
  .live-tile b { font-size: 18px; }
  .live-tip { font-size: 11px; }
}

/* Ping window: as tall as the screen allows (v1.9.27) */
.modal pre.ping-out { max-height: none; height: max(300px, calc(88vh - 190px)); line-height: 1.35; }
/* Network map: read-only until "Edit map" (v1.9.27) */
.map-edit-bar { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.map-edit-bar[hidden] { display: none; }
.map-card:has(.netmap.editing) { outline: 2px dashed var(--primary); outline-offset: -2px; }

/* ONU page top: ONU + PPPoE user side by side on the left, Rx power graph on the right, one height (v1.9.28) */
.onu-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; margin-bottom: 20px; }
.onu-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.onu-top .card { margin-bottom: 0; }
.onu-box { padding: 16px; overflow-wrap: anywhere; }
.onu-box .card-head { margin-bottom: 8px; }
.kv.kv-stack { grid-template-columns: minmax(0, 1fr); gap: 1px; font-size: 13px; }
.kv.kv-stack dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; margin-top: 6px; }
.kv.kv-stack dt:first-child { margin-top: 0; }
.kv.kv-stack dd { margin-bottom: 0; }
.onu-top > .range-scope { display: flex; flex-direction: column; }
.onu-top > .range-scope .chart { flex: 1 1 auto; }
@media (max-width: 1100px) { .onu-top { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .onu-pair { grid-template-columns: minmax(0, 1fr); } }
.onu-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.onu-nav form { margin: 0; }
.onu-nav select { max-width: 200px; padding: 4px 8px; font-size: 13px; }
@media (max-width: 600px) { .onu-nav { width: 100%; } .onu-nav form { flex: 1 1 45%; } .onu-nav select { max-width: none; width: 100%; } }

/* Device page: physical ports drawn like the front panel (v1.9.28) */
.fp-sum { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fp-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }
.fp-key.fp-up { background: #10b981; } .fp-key.fp-down { background: #ef4444; } .fp-key.fp-off { background: #94a3b8; }
.fp-chassis { --fp-bg: #1f2937; --fp-edge: #111827; --fp-text: #e5e7eb; --fp-port: #0b0f17;
  background: linear-gradient(180deg, color-mix(in srgb, var(--fp-bg) 92%, #fff) 0%, var(--fp-bg) 100%);
  border: 1px solid var(--fp-edge); border-radius: 10px; padding: 14px 16px 10px; display: flex; gap: 18px; align-items: stretch;
  overflow-x: auto; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 6px rgba(0,0,0,.12); }
.fp-light { --fp-bg: #eef0f3; --fp-edge: #c9ced6; --fp-text: #374151; --fp-port: #1f2937; }
.fp-blue { --fp-bg: #233a8b; --fp-edge: #172a69; --fp-text: #e0e7ff; --fp-port: #0b1024; }
.fp-grey { --fp-bg: #9aa1aa; --fp-edge: #6b7280; --fp-text: #111827; --fp-port: #111827; }
.fp-green { --fp-bg: #374151; --fp-edge: #1f2937; --fp-text: #d1fae5; --fp-port: #0b0f17; border-bottom: 4px solid #6ee7b7; }
.fp-dark { --fp-bg: #1f2937; }
.fp-brand { display: flex; flex-direction: column; justify-content: center; min-width: 90px; color: var(--fp-text); font-size: 12px; line-height: 1.3; }
.fp-brand strong { font-size: 13px; letter-spacing: .02em; }
.fp-brand span { opacity: .8; font-family: var(--mono); font-size: 11px; }
.fp-groups { display: flex; gap: 14px; flex-wrap: nowrap; align-items: flex-end; }
.fp-group { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px 4px; border-radius: 6px; background: rgba(0,0,0,.08); }
.fp-light .fp-group, .fp-grey .fp-group { background: rgba(0,0,0,.05); }
.fp-gname { color: var(--fp-text); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; opacity: .75; text-align: center; }
.fp-ports { display: grid; grid-auto-flow: column; grid-template-rows: auto; gap: 8px 10px; }   /* a standard gap between ports (v1.9.89) */
.fp-ports.fp-two { grid-template-rows: auto auto; }
.fp-port { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none; color: var(--fp-text); }
/* ports by their own kind: RJ45 = a metal-framed square socket with the latch notch and gold pins; SFP / QSFP = a
   flat metal cage with a dark slot; PON = an SFP with a blue dust plug. The LED above shows the state. */
.fp-port { position: relative; }
.fp-port:hover .fp-jack { outline: 2px solid #60a5fa; outline-offset: 2px; }
.fp-led { width: 6px; height: 6px; border-radius: 50%; background: #4b5563; margin-bottom: 2px; }
.fp-up .fp-led { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.fp-down .fp-led { background: #ef4444; box-shadow: 0 0 5px #ef4444; }
.fp-unknown .fp-led { background: #f59e0b; }
.fp-off .fp-jack { opacity: .5; }
.fp-jack { display: block; position: relative; box-sizing: border-box; }
.fp-k-rj45 .fp-jack, .fp-k-mgmt .fp-jack { width: 28px; height: 25px; border-radius: 2px; background: linear-gradient(#c7cbd1, #9aa0a8); padding: 2px; }
.fp-k-rj45 .fp-jack::before, .fp-k-mgmt .fp-jack::before { content: ""; position: absolute; inset: 2px; background:
    repeating-linear-gradient(90deg, #d4a017 0 1.5px, transparent 1.5px 3px) 4px 2px / 16px 4px no-repeat, var(--fp-port);
  clip-path: polygon(0 0, 100% 0, 100% 74%, 68% 74%, 68% 100%, 32% 100%, 32% 74%, 0 74%); }
.fp-k-sfp .fp-jack, .fp-k-pon .fp-jack { width: 30px; height: 16px; border-radius: 2px; background: linear-gradient(#d5d8dd, #a3a9b1); padding: 2px; }
.fp-k-qsfp .fp-jack { width: 40px; height: 16px; border-radius: 2px; background: linear-gradient(#d5d8dd, #a3a9b1); padding: 2px; }
.fp-k-sfp .fp-jack::before, .fp-k-qsfp .fp-jack::before, .fp-k-pon .fp-jack::before { content: ""; position: absolute; inset: 2px; border-radius: 1px;
  background: linear-gradient(var(--fp-port) 0 45%, #2b2f36 45% 55%, var(--fp-port) 55%); }
.fp-k-pon .fp-jack::before { background: linear-gradient(90deg, var(--fp-port) 0 62%, #2563eb 62%); }
.fp-up .fp-jack { box-shadow: 0 0 0 2px #22c55e; }
.fp-down .fp-jack { box-shadow: 0 0 0 2px #ef4444; }
.fp-num { font: 600 10px/1 var(--mono); }
.fp-speed { font: 9px/1 var(--mono); opacity: .8; min-height: 9px; }
@media (max-width: 700px) { .fp-brand { display: none; } .fp-chassis { padding: 10px; } }

/* rows hidden by a data-table-filter search box (any table) */
tr.filtered-out { display: none !important; }
.nttn-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.nttn-filters select { max-width: 220px; }
@media (max-width: 600px) { .nttn-filters .search, .nttn-filters select { flex: 1 1 100%; max-width: none; } }

/* ONU list: a header row between two PON ports (v1.9.29) */
tr.pon-sep > td { background: var(--bg); border-top: 14px solid var(--surface); padding: 8px 12px; position: sticky; left: 0; }
tr.pon-sep:first-child > td { border-top-width: 0; }
.pon-sep-name { font-weight: 700; margin-right: 12px; color: var(--primary); }
.pon-sep-info { font-size: 12.5px; color: var(--muted); }
tr.pon-sep[hidden] { display: none; }
.outage-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
@media (max-width: 600px) { .outage-filters .search, .outage-filters select { flex: 1 1 100%; } }
/* POP / device selects on a device or OLT page (v1.9.30) */
.dev-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dev-nav form { margin: 0; }
.dev-nav select { max-width: 220px; padding: 5px 8px; font-size: 13px; }
@media (max-width: 600px) { .dev-nav { width: 100%; } .dev-nav form { flex: 1 1 45%; } .dev-nav select { max-width: none; width: 100%; } }

/* Sidebar: pages grouped by subject, one section open at a time (v1.9.31) */
.nav-group { margin-top: 2px; }
.nav-group-head { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-text); font-weight: 600; font-size: 14px; user-select: none; }
.nav-group-head::-webkit-details-marker { display: none; }
.nav-group-head svg { flex: none; opacity: .9; }
.nav-group-name { flex: 1; }
.nav-group-head::after { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; opacity: .6; margin-left: 6px; }
.nav-group[open] > .nav-group-head::after { transform: rotate(45deg); }
.nav-group-head:hover { background: var(--side-2); color: #fff; }
.nav-group[open] > .nav-group-head { color: #fff; }
.nav-group-sum { margin-left: 0; }
.nav-group[open] .nav-group-sum { display: none; }
.nav-group-body { margin: 2px 0 6px 18px; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, .08); }
.nav-group-body .nav-link { padding: 7px 10px; font-size: 13.5px; }
.nav-group-body .nav-link svg { width: 16px; height: 16px; }
/* front panel: more chassis colours, a space between two blocks of one kind, combo ports (v1.9.31) */
.fp-black { --fp-bg: #1c1f24; --fp-edge: #0b0d10; --fp-text: #d1d5db; --fp-port: #050608; }
.fp-cream { --fp-bg: #ece6d6; --fp-edge: #cfc6ad; --fp-text: #3f3a2c; --fp-port: #1f2022; }
.fp-slate { --fp-bg: #4b5563; --fp-edge: #374151; --fp-text: #e5e7eb; --fp-port: #111827; }
.fp-group.fp-gap { margin-left: 14px; }
.fp-group.fp-combo { outline: 1px dashed currentColor; outline-offset: -1px; }
.fp-group.fp-combo .fp-gname::after { content: " ⇄"; }
/* ONU page: small refresh buttons (status at the top, laser under the Rx graph) (v1.9.32) */
.onu-mini-refresh { width: 28px; height: 28px; }
.onu-rx-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.onu-rx-foot .icon-btn { width: 30px; height: 30px; }

/* v1.9.32: second management IP */
.ip2-line { display: inline-flex; gap: 6px; flex-wrap: wrap; font-size: 11.5px; margin-left: 4px; vertical-align: middle; }
td .ip2-line { display: flex; margin: 2px 0 0; }
.ip-pair { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 9px; border: 1px solid var(--border, #e2e8f0); white-space: nowrap; }
.ip-pair b { font-size: 10px; }
.ip-st-up b { color: #059669; } .ip-st-down { border-color: #fca5a5; background: rgba(239,68,68,.08); } .ip-st-down b { color: #dc2626; } .ip-st-unk b { color: #94a3b8; }
/* v1.9.32: Proxmox card */
.pve-storage { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border, #e2e8f0); }
.pve-st { border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 8px 10px; display: grid; gap: 5px; }
.pve-st-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.pve-off { opacity: .55; }
/* v1.9.32: dashboard overview */
.dash-hero { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 2.2fr); gap: 20px; margin-bottom: 20px; align-items: stretch; }
.dash-health { display: flex; align-items: center; gap: 20px; margin: 0; background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%); }
.dash-health h2 { margin: 0 0 4px; font-size: 19px; }
.dash-health-text p { margin: 0 0 10px; }
.ring { flex: none; }
.ring circle { fill: none; stroke-width: 12; stroke-linecap: butt; }
.ring-bg { stroke: var(--border); }
.ring-up { stroke: var(--up); } .ring-down { stroke: var(--down); } .ring-unk { stroke: #94a3b8; }
.ring-num { font: 700 22px var(--font); fill: var(--text); text-anchor: middle; }
.ring-sub { font: 500 10.5px var(--font); fill: var(--muted); text-anchor: middle; text-transform: uppercase; letter-spacing: .06em; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.legend-row a { color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-up { background: var(--up); } .lg-down { background: var(--down); } .lg-unk { background: #94a3b8; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px 14px 16px; box-shadow: var(--shadow); color: var(--text);
  display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; transition: transform .12s, box-shadow .12s, border-color .12s; }
.kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15, 23, 42, .08); border-color: #cbd5e1; }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--border); }
.kpi-ok::after { background: var(--up); } .kpi-warn::after { background: #f59e0b; } .kpi-crit::after { background: var(--down); }
.kpi-crit .kpi-val { color: var(--down); }
.kpi-ico { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.kpi-ok .kpi-ico { background: var(--up-50); color: var(--up); } .kpi-warn .kpi-ico { background: var(--warn-50); color: var(--warn); } .kpi-crit .kpi-ico { background: var(--down-50); color: var(--down); }
.kpi-val { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.kpi-val small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi-val-sm { font-size: 22px; }
.dash-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; }
.dash-row > .card { margin: 0; }
.pop-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pop-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 12.5px; max-width: 100%; }
.pop-chip:hover { text-decoration: none; border-color: #94a3b8; }
.pop-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); flex: none; }
.pop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.pop-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.pop-bad { border-color: #fca5a5; background: var(--down-50); }
.pop-bad .pop-dot { background: var(--down); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.pop-bad .pop-n { color: var(--down); font-weight: 600; }
@media (max-width: 1000px) { .dash-hero { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .dash-health { flex-direction: column; text-align: center; } .legend-row { justify-content: center; } }

/* v1.9.39: bandwidth & capacity */
.cap-kpis { margin-bottom: 18px; }
.btn-xs { padding: 2px 7px; font-size: 11.5px; border-radius: 6px; }
.w-sm { width: 120px; } .w-md { max-width: 260px; }
.sub-row td { background: var(--surface-2); }
.cap-kind { background: var(--primary-50); color: var(--primary); border: 0; }
.cap-ggc, .cap-fna, .cap-cdn { background: #fef3c7; color: #92400e; }
.cap-bdix { background: #ede9fe; color: #6d28d9; }
.cap-nttn { background: #e0f2fe; color: #0369a1; }
.cap-st-draft { background: var(--surface-2); color: var(--text-2); }
.cap-st-sent { background: var(--primary-50); color: var(--primary); }
.cap-st-confirmed { background: #fef3c7; color: #92400e; }
.cap-st-applied { background: var(--up-50); color: var(--up); }
.cap-st-cancelled { background: var(--down-50); color: var(--down); }
.cap-steps { display: flex; gap: 0; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: s; }
.cap-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-weight: 600; font-size: 13px; }
.cap-steps li:first-child { border-radius: 10px 0 0 10px; } .cap-steps li:last-child { border-radius: 0 10px 10px 0; }
.cap-steps li + li { border-left: 0; }
.cap-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; }
.cap-steps li.done { color: var(--up); } .cap-steps li.done span { background: var(--up); color: #fff; }
.cap-steps li.now { color: var(--primary); background: var(--primary-50); } .cap-steps li.now span { background: var(--primary); color: #fff; }
@media (max-width: 640px) { .cap-steps { flex-direction: column; } .cap-steps li { border-radius: 0 !important; border-left: 1px solid var(--border) !important; } }

/* v1.9.39: suggestions as you type */
.suggest-wrap { position: relative; }
.suggest-box { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 28px rgba(15,23,42,.14); overflow: hidden; max-height: 360px; overflow-y: auto; }
.suggest-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; }
.suggest-item b { font-weight: 600; } .suggest-item .muted { margin-left: auto; }
.suggest-item:hover, .suggest-item.on { background: var(--primary-50); }
.suggest-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; } .suggest-dot.on { background: var(--up); } .suggest-dot.off { background: #94a3b8; }

/* v1.9.39: IP address manager */
.ip-kpis { margin-bottom: 18px; }
.ip-search { padding: 14px 16px; }
.ip-search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ip-search-row input[type=search] { flex: 1 1 320px; font-size: 15px; padding: 10px 14px; }
.ip-search-row select { width: auto; }
.ip-crumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.ip-chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13px; }
.ip-chip:hover { text-decoration: none; border-color: var(--primary); }
.ip-tree td:first-child { white-space: nowrap; }
.ip-indent { display: none; }
.ip-tree tr[class*="ip-depth-"]:not(.ip-depth-0) td:nth-child(2) a::before { content: "└ "; color: var(--muted); font-weight: 400; }
.ip-depth-1 td:nth-child(2) { padding-left: 30px !important; } .ip-depth-2 td:nth-child(2) { padding-left: 48px !important; } .ip-depth-3 td:nth-child(2) { padding-left: 66px !important; }
.ip-depth-4 td:nth-child(2) { padding-left: 84px !important; } .ip-depth-5 td:nth-child(2) { padding-left: 102px !important; }
.ip-use-cell { min-width: 170px; }
.badge.ip-p-allocation { background: #ede9fe; color: #6d28d9; } .badge.ip-p-pppoe { background: var(--up-50); color: var(--up); }
.badge.ip-p-infra { background: var(--primary-50); color: var(--primary); } .badge.ip-p-ptp { background: #e0f2fe; color: #0369a1; }
.badge.ip-p-customer { background: #fef3c7; color: #92400e; } .badge.ip-p-loopback { background: #fce7f3; color: #be185d; }
.badge.ip-p-reserved { background: var(--down-50); color: var(--down); }
.badge.ip-st-used { background: var(--primary-50); color: var(--primary); } .badge.ip-st-reserved { background: #fef3c7; color: #92400e; } .badge.ip-st-dhcp { background: #e0f2fe; color: #0369a1; }
.ip-map { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 3px; margin-bottom: 14px; }
.ip-map-small { grid-template-columns: repeat(16, minmax(0, 1fr)); }
.ip-map-24 { grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 4px; }
.ip-map-head { margin: 6px 0 4px; }
.ip-cell { aspect-ratio: 1; border-radius: 4px; display: grid; place-items: center; font-size: 9px; color: rgba(255,255,255,.85); text-decoration: none; transition: transform .08s; }
.ip-cell:hover { transform: scale(1.35); z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.25); text-decoration: none; }
.c-free { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.c-pppoe { background: #10b981; } .c-dev { background: #2563eb; } .c-used { background: #6366f1; } .c-reserved { background: #f59e0b; } .c-dhcp { background: #0ea5e9; }
.c-net { background: #94a3b8; }
.heat-0 { background: var(--surface-2); border: 1px solid var(--border); } .heat-1 { background: #bfdbfe; } .heat-2 { background: #93c5fd; } .heat-3 { background: #60a5fa; } .heat-4 { background: #2563eb; } .heat-5 { background: #1e3a8a; }
.ip-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.ip-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 700px) { .ip-map { grid-template-columns: repeat(16, minmax(0, 1fr)); } }

.kpi .stat-label { padding-right: 40px; }
input[type=date], input[type=time] { font: inherit; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; }
.cap-actions { display: flex; gap: 6px; }

/* IPAM: filters, category chips */
.ip-filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ip-filter-row select { width: auto; min-width: 150px; }
.ip-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ip-cat { display: inline-flex; flex-direction: column; gap: 1px; padding: 7px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 12.5px; line-height: 1.3; }
.ip-cat span { color: var(--muted); font-size: 11.5px; }
.ip-cat:hover { text-decoration: none; border-color: var(--primary); }
.ip-cat.active { border-color: var(--primary); box-shadow: var(--ring); }
.ip-cat.ip-p-public b { color: #6d28d9; } .ip-cat.ip-p-pppoe b { color: var(--up); } .ip-cat.ip-p-mgmt b { color: #c2410c; }
.badge.ip-p-public { background: #ede9fe; color: #6d28d9; }
.badge.ip-p-mgmt { background: #ffedd5; color: #c2410c; }
.badge.ip-p-cgnat { background: #ecfccb; color: #4d7c0f; }
.badge.ip-p-dhcp { background: #e0f2fe; color: #0369a1; }
.badge.ip-p-other { background: var(--surface-2); color: var(--text-2); }
html[data-theme="dark"] .badge.ip-p-public, html[data-theme="dark"] .badge.ip-p-allocation { background: #2a1f4d; color: #c4b5fd; }
html[data-theme="dark"] .badge.ip-p-mgmt { background: #3a2312; color: #fdba74; }
html[data-theme="dark"] .badge.ip-p-cgnat { background: #233012; color: #bef264; }
html[data-theme="dark"] .badge.ip-p-customer, html[data-theme="dark"] .badge.ip-st-reserved { background: #33270c; color: #fcd34d; }
html[data-theme="dark"] .badge.ip-p-ptp, html[data-theme="dark"] .badge.ip-p-dhcp, html[data-theme="dark"] .badge.ip-st-dhcp { background: #0f2a3d; color: #7dd3fc; }
html[data-theme="dark"] .badge.ip-p-loopback { background: #3a1430; color: #f9a8d4; }
.ip-kids { font-weight: 600; white-space: nowrap; }
.ip-defaults summary { cursor: pointer; }
.ip-defaults ul { margin-top: 10px; }

/* capacity: VLAN / NTTN relations and types */
.cap-vlan { background: #f1f5f9; color: #334155; font-family: var(--mono); font-size: 11px; padding: 1px 7px; margin-left: 4px; }
.cap-baishan { background: #fee2e2; color: #b91c1c; }
.cap-links .badge { margin-right: 2px; }
.cap-link-note { margin: 12px 0 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
html[data-theme="dark"] .cap-vlan { background: #1e2a44; color: #cbd5e1; }
html[data-theme="dark"] .cap-ggc, html[data-theme="dark"] .cap-fna, html[data-theme="dark"] .cap-cdn { background: #33270c; color: #fcd34d; }
html[data-theme="dark"] .cap-bdix { background: #2a1f4d; color: #c4b5fd; }
html[data-theme="dark"] .cap-nttn { background: #0f2a3d; color: #7dd3fc; }
html[data-theme="dark"] .cap-baishan { background: #3a1418; color: #fca5a5; }

@media (max-width: 860px) {
  .main { margin-left: 0; }
  .content { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
}
.kind-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.kind-form input[type=text] { flex: 1 1 240px; max-width: 360px; }
.kind-form input[type=number] { width: 84px; flex: none; }
.svc-cell { min-width: 200px; }

/* ONU list: last PPPoE user of an offline ONU / session */
.onu-last-user { color: #8a94a6; font-weight: 600; text-decoration: line-through; text-decoration-color: rgba(138, 148, 166, .35); }
.onu-last-user:hover { color: var(--text-2); text-decoration: none; }
.onu-last-user-sub { color: #9aa4b5; font-style: italic; }
html[data-theme="dark"] .onu-last-user { color: #6b7a93; }

/* ==========================================================================
   v1.9.42
   ========================================================================== */
/* graph time pager: a fixed-width box, the arrows never move */
.range-shift { flex-wrap: nowrap; gap: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.range-shift .rs-btn { border: 0; background: transparent; width: 32px; align-self: stretch; font: 600 18px/1 var(--font); color: var(--text-2); cursor: pointer; }
.range-shift .rs-btn:hover:not([disabled]) { background: var(--primary-50); color: var(--primary); }
.range-shift .rs-btn[disabled] { opacity: .35; cursor: default; }
.range-shift .range-label { width: 150px; min-width: 150px; padding: 3px 6px; font-size: 11.5px; line-height: 1.3; white-space: pre-line; text-align: center;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border); color: var(--muted); }
.range-shift .range-label-win { color: var(--primary); font-weight: 600; background: var(--primary-50); }

/* ONU page: the refresh panel floats (the page does not jump) */
.test-panel-float { position: fixed; right: 20px; bottom: 20px; width: min(440px, calc(100vw - 32px)); max-height: 62vh; overflow: auto; z-index: 60;
  box-shadow: 0 24px 48px -16px rgba(2, 6, 23, .35); margin: 0; }

/* PPPoE search: the box fills the row again */
.suggest-wrap { flex: 1 1 auto; min-width: 0; display: block; }
.search.grow .suggest-wrap, .search.grow .suggest-wrap input { width: 100%; }
.search.grow input[type=search] { font-size: 15px; padding-top: 10px; padding-bottom: 10px; }

/* PON heading row: counters as chips */
.pon-sep-info { display: inline-flex; flex-wrap: wrap; gap: 5px; margin-left: 10px; vertical-align: middle; }
.pon-chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.pon-chip-registered { background: var(--primary-50); color: var(--primary); border-color: transparent; }
.pon-chip-online { background: var(--up-50); color: var(--up); border-color: transparent; }
.pon-chip-offline { background: var(--down-50); color: var(--down); border-color: transparent; }
.pon-chip-weak { background: var(--warn-50); color: var(--warn); border-color: transparent; }
.pon-chip-zero { opacity: .55; }
.port-select { max-width: 360px; }

/* OLT: flooding ONUs, saved log */
.flood-box { border: 1px solid color-mix(in srgb, var(--down) 30%, var(--border)); background: color-mix(in srgb, var(--down-50) 60%, var(--surface)); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.flood-box h3 { margin: 0 0 6px; display: flex; align-items: center; gap: 6px; }
.saved-log { max-height: 75vh; overflow: auto; margin: 0; border-radius: 0 0 var(--radius) var(--radius); font-size: 12px; }
.saved-log span { display: block; }
.saved-log .log-mark { color: #fca5a5; font-weight: 700; background: rgba(239, 68, 68, .12); }
.saved-log .log-read { color: #64748b; }
.saved-log .log-gasp { color: #fcd34d; }

/* syslog */
.syslog-top { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.syslog-top-item { display: inline-flex; flex-direction: column; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12.5px; box-shadow: var(--shadow); }
.syslog-top-item span { color: var(--muted); font-size: 11.5px; } .syslog-top-item em { color: var(--down); font-style: normal; font-weight: 600; }
.syslog-top-item:hover { text-decoration: none; border-color: var(--primary); }
.syslog-from { min-width: 190px; }
.syslog-table tr.sev-row-bad td:first-child { box-shadow: inset 3px 0 0 var(--down); }
.badge.tp { font-size: 11px; }
.tp-crit { background: var(--down-50); color: var(--down); } .tp-warn { background: var(--warn-50); color: var(--warn); }
.tp-ok { background: var(--up-50); color: var(--up); } .tp-info { background: var(--primary-50); color: var(--primary); } .tp-muted { background: var(--surface-2); color: var(--muted); }

/* network map: device types, POP zones, compact tiles */
.map-types { display: flex; flex-wrap: wrap; gap: 4px; }
.map-type { gap: 5px; }
.map-type { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 5px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; cursor: pointer; user-select: none; }
.map-type input { margin: 0; }
.map-type i { width: 10px; height: 10px; border-radius: 3px; background: #94a3b8; }
.map-type.t-router i { background: #3b82f6; } .map-type.t-switch i { background: #14b8a6; } .map-type.t-olt i { background: #a855f7; }
.map-type.t-server i { background: #64748b; } .map-type.t-other i { background: #f59e0b; } .map-type.t-pop i { background: #f472b6; }
.map-type:has(input:not(:checked)) { opacity: .5; }
.netmap .site-zone { fill: rgba(99, 102, 241, .05); stroke: rgba(99, 102, 241, .28); stroke-width: 1.5; stroke-dasharray: 6 5; }
.netmap .site-zone-name { font: 700 13px var(--font); fill: #6366f1; opacity: .85; letter-spacing: .02em; }
.netmap .site-zone.dim, .netmap .site-zone-name.dim { opacity: .25; }
html[data-theme="dark"] .netmap .site-zone { fill: rgba(129, 140, 248, .06); stroke: rgba(129, 140, 248, .3); }
html[data-theme="dark"] .netmap .site-zone-name { fill: #a5b4fc; }
.netmap .node-compact .node-tile { filter: drop-shadow(0 4px 8px rgba(15, 23, 42, .25)); }
.netmap .node-name-c { font: 600 12.5px var(--font); }
.netmap.compact .link .casing { stroke-width: 3; }

/* IPAM: review */
.ip-discovered { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.review-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.review-form select { width: auto; min-width: 170px; }
.review-bar { display: flex; align-items: center; border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: color-mix(in srgb, var(--warn-50) 60%, var(--surface)); }
.ip-free-subs { display: flex; flex-wrap: wrap; gap: 6px; }
.ip-free-subs a { font-weight: 700; margin-left: 2px; }
.row-current td { background: color-mix(in srgb, var(--up-50) 60%, transparent); }

/* v1.9.43: IPAM hierarchy, pools, pop-up forms */
.ip-toolbar .btn-row { flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }
.ip-toolbar { align-items: flex-start; }
.ip-toolbar .title-line { flex: 1 1 320px; min-width: 0; }
a.kpi-link { color: inherit; text-decoration: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
a.kpi-link:hover, a.kpi-link:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 6px 18px rgba(0,0,0,.12)); border-color: var(--accent, #3b82f6); }
.ip-tabs { margin: 4px 0 18px; }
.badge.ip-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; }
.badge.ip-kind-network { background: #e0e7ff; color: #4338ca; } .badge.ip-kind-subnet { background: var(--surface-2); color: var(--text-2); }
.badge.ip-vrf { background: #fef9c3; color: #854d0e; font-size: 11px; }
.badge.ip-v6 { background: #e0f2fe; color: #0369a1; font-size: 10.5px; }
.badge.ip-pool-p { background: var(--up-50); color: var(--up); font-size: 11px; }
html[data-theme="dark"] .badge.ip-kind-network { background: #23265a; color: #a5b4fc; }
html[data-theme="dark"] .badge.ip-vrf { background: #33270c; color: #fcd34d; }
html[data-theme="dark"] .badge.ip-v6 { background: #0f2a3d; color: #7dd3fc; }
.form-dialog { width: min(720px, calc(100vw - 32px)); }
.form-dialog .dialog-body { padding: 18px 22px 20px; }
.form-dialog .card-head { margin-bottom: 8px; }
.form-dialog .dialog-close { position: static; font-size: 26px; line-height: 1; }
.form-dialog[open] { animation: nms-pop .18s ease both; }
@keyframes nms-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.ip-calc-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.ip-calc-form input[name=cidr] { flex: 1 1 280px; font-size: 15px; }
.ip-calc-out { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.ip-calc-out dt { color: var(--muted); font-size: 12.5px; } .ip-calc-out dd { margin: 0; }
.btn-link { border: 0; background: none; color: var(--primary); font-weight: 700; cursor: pointer; padding: 0 2px; }
.card-head form.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .card-head form.inline-form select { width: auto; min-width: 150px; }
.ip-map-24 { grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 3px; } @media (max-width: 700px) { .ip-map-24 { grid-template-columns: repeat(16, minmax(0, 1fr)); } }

.badge.cap-upstream { background: color-mix(in srgb, #0ea5e9 16%, transparent); color: #0369a1; }
@media (prefers-color-scheme: dark) { .badge.cap-upstream { color: #7dd3fc; } }
:root[data-theme="dark"] .badge.cap-upstream { color: #7dd3fc; }
.merge-row .inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.maestro-line { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 3px; color: var(--muted, #64748b); }
.maestro-line .badge { font-size: 11px; }
.badge.maestro-exp-ok { background: color-mix(in srgb, #16a34a 16%, transparent); color: #15803d; }
.badge.maestro-exp-warn { background: color-mix(in srgb, #f59e0b 20%, transparent); color: #b45309; }
.badge.maestro-exp-bad { background: color-mix(in srgb, #dc2626 16%, transparent); color: #b91c1c; }
.maestro-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.maestro-card dt { color: var(--muted, #64748b); }

/* ---- v1.9.46 Bandwidth & NTTN page ---- */
a.kpi-link.kpi-on { border-color: var(--accent, #3b82f6); box-shadow: 0 0 0 2px rgba(59, 130, 246, .25); }
.tab-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px; background: var(--border); font-size: 11px; line-height: 18px; text-align: center; color: var(--muted); }
.page-tabs a.active .tab-count { background: var(--accent, #3b82f6); color: #fff; }
.cap-bar-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.cap-bar-head .filters { flex: 1 1 520px; margin: 0; }
.cap-bar-head > .btn-row { margin-left: auto; display: flex; gap: 8px; }
.cap-bars { display: grid; gap: 8px; padding: 4px 0 2px; }
.cap-bar-row { display: grid; grid-template-columns: minmax(110px, 180px) minmax(160px, 1fr) minmax(120px, 220px); gap: 12px; align-items: center; color: inherit; text-decoration: none; padding: 4px 6px; border-radius: 8px; }
.cap-bar-row:hover { background: var(--surface-2, rgba(148, 163, 184, .12)); text-decoration: none; }
.cap-bar-name { font-weight: 600; }
.cap-pop { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.cap-pop .inline-form { display: inline; }
.bill-dialog { width: min(860px, 96vw); }
.invoice-head { display: flex; justify-content: space-between; gap: 16px; margin: 4px 0 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
.invoice-lines tfoot th { border-top: 2px solid var(--border); }
.invoice-total { font-size: 1.05em; color: var(--accent, #2563eb); }
@media (max-width: 640px) { .cap-bar-row { grid-template-columns: 1fr; gap: 2px; } .cap-bar-head > .btn-row { margin-left: 0; } }
@media print {
  body.printing-dialog * { visibility: hidden; }
  body.printing-dialog dialog.print-me, body.printing-dialog dialog.print-me * { visibility: visible; }
  body.printing-dialog dialog.print-me { position: absolute; left: 0; top: 0; margin: 0; display: block; border: 0; box-shadow: none; width: 100%; max-width: none; }
  body.printing-dialog dialog.print-me .form-actions, body.printing-dialog dialog.print-me .dialog-close { display: none; }
}
.cap-actions { display: grid; grid-template-columns: auto auto; gap: 4px; justify-content: start; }
.cap-actions > :first-child { grid-column: 1 / -1; }
.cap-actions .btn { justify-content: center; }
.card-head-right { margin-left: auto; display: flex; gap: 8px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }
.form-dialog.dialog-wide { width: min(980px, calc(100vw - 32px)); }
a.dialog-close { text-decoration: none; color: inherit; }
.tree-nav-head { gap: 6px; flex-wrap: wrap; }
/* alert messages laid out: main line, details below (v1.9.47) */
.alert-msg-main { font-weight: 500; }
.alert-msg-parts { display: flex; flex-wrap: wrap; gap: 2px 0; margin-top: 2px; font-size: .86em; color: var(--muted); }
.alert-msg-part + .alert-msg-part::before { content: "·"; margin: 0 6px; opacity: .6; }
.alert-hot { color: var(--down); font-weight: 600; }
/* alert templates (v1.9.50) */
.tpl-vars { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.tpl-var code { font-size: 12px; }
.tpl-card { padding: 12px 16px; margin-bottom: 10px; }
.tpl-card > summary { cursor: pointer; list-style: revert; }
.tpl-card[open] > summary { margin-bottom: 10px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg, var(--surface)); padding: 10px 0; }

/* =====================================================================================================
   v1.9.52 design system — one layer over the base rules above. Tokens first, then the shell (sidebar,
   topbar), then components (cards, KPIs, tables, badges, buttons, forms, tabs, alerts), the dashboard
   and the sign-in pages. Light and dark use the same rules; only the tokens change.
   ===================================================================================================== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e3e8f0;
  --border-strong: #d2d9e5;
  --text: #0d1526;
  --text-2: #3c475b;
  --muted: #687489;
  --primary: #3358e6;
  --primary-600: #2443c4;
  --primary-50: #eef2ff;
  --primary-100: #dfe6ff;
  --ring: rgba(51, 88, 230, .18);
  --up: #0d9467; --up-50: #e8f8f1; --up-200: #a6e6cd;
  --down: #d92d3a; --down-50: #fdeeef; --down-200: #f6c0c4;
  --warn: #b25e09; --warn-50: #fff6e6; --warn-200: #f8d79a;
  --unknown: #6b7689;
  --side: #0a1222;
  --side-2: #121c31;
  --side-3: #19253e;
  --side-text: #98a4bb;
  --side-head: #5f6d86;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(13, 21, 38, .04), 0 1px 3px rgba(13, 21, 38, .05);
  --shadow-md: 0 4px 12px -2px rgba(13, 21, 38, .08), 0 2px 4px -2px rgba(13, 21, 38, .05);
  --shadow-lg: 0 24px 48px -12px rgba(13, 21, 38, .18);
  --accent: var(--primary);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
}
html[data-theme="dark"] {
  --bg: #080d18;
  --surface: #0f1729;
  --surface-2: #131d33;
  --surface-3: #1a2540;
  --border: #1f2b45;
  --border-strong: #2c3a5a;
  --text: #e5eaf3;
  --text-2: #b4bfd2;
  --muted: #8592aa;
  --primary: #6f8dff;
  --primary-600: #5876f5;
  --primary-50: #151f3f;
  --primary-100: #1d2a55;
  --ring: rgba(111, 141, 255, .28);
  --up: #34d39e; --up-50: #0c2620; --up-200: #165c47;
  --down: #f8717c; --down-50: #2c1219; --down-200: #6b2430;
  --warn: #f5b74e; --warn-50: #2b210d; --warn-200: #6a4c13;
  --unknown: #8f9bb1;
  --side: #060a14;
  --side-2: #0e1628;
  --side-3: #152039;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
}

body { font-size: 14px; line-height: 1.5; font-feature-settings: "cv11"; letter-spacing: -.003em; text-rendering: optimizeLegibility; }
h1, h2, h3 { letter-spacing: -.015em; }
h2 { font-size: 15.5px; font-weight: 650; }
::selection { background: var(--primary-100); }
code { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); font-size: 12px; padding: 1px 5px; }
html[data-theme="dark"] code { background: var(--surface-3); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- shell: sidebar ---------- */
.sidebar { background: var(--side); border-right: 1px solid rgba(255, 255, 255, .04);
  background-image: radial-gradient(420px 260px at -20% -10%, rgba(80, 110, 255, .16), transparent 60%); }
.brand { padding: 18px 18px 16px; margin: 0 10px 6px; border-bottom: 1px solid rgba(255, 255, 255, .06); padding-left: 8px; padding-right: 8px; }
.brand img { border-radius: 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 6px 16px -4px rgba(51, 88, 230, .6); }
.brand strong { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.brand span { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--side-head); margin-top: 1px; }
.sidebar nav { padding: 8px 10px 12px; scrollbar-color: #24304a transparent; }
.nav-link, .nav-group-head { position: relative; padding: 8px 10px; border-radius: 8px; color: var(--side-text); font-weight: 500; font-size: 13.5px; transition: background .12s ease, color .12s ease; }
.nav-link svg, .nav-group-head svg { opacity: .78; }
.nav-link:hover, .nav-group-head:hover { background: rgba(255, 255, 255, .045); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(91, 122, 255, .22), rgba(91, 122, 255, .06)); color: #fff; box-shadow: inset 0 0 0 1px rgba(124, 151, 255, .14); }
.nav-link.active svg { opacity: 1; color: #9fb4ff; }
.nav-link.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #7c97ff; }
.nav-group-body .nav-link.active::before { left: -19px; }
.nav-group[open] > .nav-group-head { color: #e7ecf7; }
.nav-group-body { margin: 2px 0 8px 19px; padding-left: 9px; border-left: 1px solid rgba(255, 255, 255, .07); }
.nav-group-body .nav-link { padding: 6px 10px; font-size: 13px; }
.nav-badge { background: #e5484d; font-size: 10.5px; padding: 1px 7px; line-height: 16px; box-shadow: 0 0 0 2px var(--side); font-variant-numeric: tabular-nums; }
.sidebar-foot { padding: 12px 18px 14px; margin: 0 10px; border-top: 1px solid rgba(255, 255, 255, .06); color: var(--side-head); font-size: 11px; letter-spacing: .04em; font-family: var(--mono); }

/* ---------- shell: topbar ---------- */
.topbar { height: 60px; padding: 0 28px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.6) blur(10px); border-bottom: 1px solid var(--border); }
html[data-theme="dark"] .topbar { background: color-mix(in srgb, var(--bg) 78%, transparent); }
.page-title { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.topbar-right { gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; color: var(--muted); transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.user-chip { padding: 3px 12px 3px 3px; margin: 0 4px; border: 1px solid var(--border); background: var(--surface); }
.user-chip:hover { background: var(--surface-2); border-color: var(--border-strong); }
.avatar { width: 30px; height: 30px; font-size: 12.5px; color: #fff; background: linear-gradient(135deg, #5b7cff, #3358e6); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.user-meta strong { font-size: 12.5px; font-weight: 600; }
.user-meta small { font-size: 11px; }
.content { padding: 26px 28px 40px; }
@media (min-width: 1700px) { .content { padding-left: 36px; padding-right: 36px; } }

/* ---------- cards ---------- */
.card { border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow); padding: 20px 22px; }
.card-head { margin-bottom: 16px; }
.card-head h2 { font-size: 15px; font-weight: 650; gap: 9px; }
.card-head h2 svg { color: var(--muted); }
.card.flush > .card-head, .card.flush > .pad:first-child { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--border); }
.card.flush > .card-head { margin-bottom: 0; }
.alert-card { border-color: color-mix(in srgb, var(--down-200) 70%, var(--border)); }
.alert-card .card-head h2 svg { color: var(--down); }
.empty-state { padding: 56px 24px; }
.empty-state > svg { color: var(--primary); background: var(--primary-50); border-radius: 16px; padding: 12px; width: 64px; height: 64px; }

/* ---------- stats & KPI tiles ---------- */
.stat { border-radius: var(--radius); padding: 16px 18px 16px 20px; transition: border-color .12s, box-shadow .12s, transform .12s; }
.stat::before { width: 3px; inset: 14px auto 14px 0; border-radius: 0 3px 3px 0; }
a.stat:hover, .stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stat-label, .kpi .stat-label { font-size: 11px; letter-spacing: .07em; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: 2px; }
.stat-sub { font-size: 12px; }
.kpis { gap: 14px; }
.kpi { border-radius: var(--radius); padding: 16px 18px; border-color: var(--border); box-shadow: var(--shadow); transition: border-color .14s, box-shadow .14s, transform .14s; }
.kpi:hover, a.kpi-link:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kpi::after { height: 0; }
.kpi::before { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.kpi-ok::before { background: var(--up); } .kpi-warn::before { background: var(--warn); } .kpi-crit::before { background: var(--down); }
.kpi-ico { top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent); }
.kpi-val { font-size: 27px; letter-spacing: -.03em; margin-top: 6px; }
.kpi-val small { font-size: 13px; }
.kpi-val-sm { font-size: 21px; }
a.kpi-link.kpi-on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

/* ---------- tables ---------- */
.table th { font-size: 11px; letter-spacing: .06em; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom-color: var(--border); }
.table td { padding: 11px 14px; border-bottom-color: color-mix(in srgb, var(--border) 75%, transparent); }
.table td, .table .num { font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background .08s; }
.table tbody tr:hover, html[data-theme="dark"] .table tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.card:not(.flush) .table th { background: transparent; border-bottom-color: var(--border); }
.row-down, html[data-theme="dark"] .row-down { background: color-mix(in srgb, var(--down) 6%, transparent); box-shadow: inset 3px 0 0 var(--down); }
.table th.sortable, .sortable th { cursor: pointer; }

/* ---------- badges ---------- */
.badge { font-size: 11.5px; font-weight: 600; padding: 2px 8px; gap: 5px; line-height: 18px; background: var(--surface-3); color: var(--text-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent); }
.badge-up { background: var(--up-50); color: var(--up); }
.badge-down { background: var(--down-50); color: var(--down); }
.badge-warn, .sev-warning { background: var(--warn-50); color: var(--warn); }
.badge-unknown, .badge-muted, html[data-theme="dark"] .badge, html[data-theme="dark"] .badge-unknown, html[data-theme="dark"] .badge-muted { background: var(--surface-3); }
html[data-theme="dark"] .badge-up { background: var(--up-50); } html[data-theme="dark"] .badge-down, html[data-theme="dark"] .sev-critical { background: var(--down-50); }
html[data-theme="dark"] .sev-warning, html[data-theme="dark"] .badge-warn { background: var(--warn-50); } html[data-theme="dark"] .sev-info { background: var(--primary-50); }
.badge-unknown, .badge-muted { color: var(--muted); }
.sev-critical { background: var(--down-50); color: var(--down); }
.sev-info { background: var(--primary-50); color: var(--primary); }
.badge-down .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 22%, transparent); }

/* ---------- buttons ---------- */
.btn { height: 36px; padding: 0 14px; border-radius: 9px; border-color: var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; font-size: 13.5px;
  box-shadow: 0 1px 2px rgba(13, 21, 38, .05); transition: background .12s, border-color .12s, box-shadow .12s, color .12s; }
.btn:hover, html[data-theme="dark"] .btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text) 20%); }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(13, 21, 38, .12), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn-primary:hover, html[data-theme="dark"] .btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
html[data-theme="dark"] .btn-primary { color: #0a1022; } html[data-theme="dark"] .btn-primary:hover { color: #0a1022; }
.btn-danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--down) 86%, #000); border-color: color-mix(in srgb, var(--down) 86%, #000); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; font-size: 14.5px; border-radius: 10px; }
.btn-primary-ghost { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.btn-on { background: var(--up-50); color: var(--up); border-color: var(--up-200); }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; } .btn-group .btn:last-child { border-radius: 0 9px 9px 0; }

/* ---------- forms ---------- */
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=date], input[type=datetime-local], input[type=time], input[type=url], input[type=tel], select, textarea {
  border-radius: 9px; border-color: var(--border-strong); background: var(--surface); color: var(--text); transition: border-color .12s, box-shadow .12s; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: var(--bg); border-color: var(--border-strong); }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--border-strong) 70%, var(--text) 18%); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field > span:first-child, .field-label { font-weight: 550; font-size: 12.5px; color: var(--text-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }

/* ---------- tabs ---------- */
.tabs { gap: 2px; border-bottom-color: var(--border); }
.tabs a { padding: 10px 14px; font-size: 13.5px; color: var(--muted); font-weight: 550; border-bottom-width: 2px; transition: color .12s, border-color .12s; }
.tabs a:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.tabs a.active { color: var(--text); border-bottom-color: var(--primary); }

/* ---------- flash / inline alerts ---------- */
.alert { border-radius: 10px; padding: 11px 14px 11px 16px; font-size: 13.5px; border-width: 1px; position: relative; box-shadow: var(--shadow); }
.alert::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: currentColor; opacity: .7; }
.alert-success { background: var(--up-50); border-color: var(--up-200); color: color-mix(in srgb, var(--up) 70%, var(--text)); }
.alert-error { background: var(--down-50); border-color: var(--down-200); color: color-mix(in srgb, var(--down) 72%, var(--text)); }
.alert-warning { background: var(--warn-50); border-color: var(--warn-200); color: color-mix(in srgb, var(--warn) 72%, var(--text)); }
.alert-info { background: var(--primary-50); border-color: var(--primary-100); color: color-mix(in srgb, var(--primary) 72%, var(--text)); }
html[data-theme="dark"] .alert-success, html[data-theme="dark"] .alert-error, html[data-theme="dark"] .alert-warning, html[data-theme="dark"] .alert-info { color: var(--text); }
html[data-theme="dark"] .alert-success { border-color: var(--up-200); } html[data-theme="dark"] .alert-error { border-color: var(--down-200); } html[data-theme="dark"] .alert-warning { border-color: var(--warn-200); }
.alert a { font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }

/* ---------- dashboard: welcome banner ---------- */
.dash-welcome { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 24px 28px; border-radius: 16px; color: #e8edf8; isolation: isolate;
  background: radial-gradient(600px 240px at 100% 0, rgba(91, 122, 255, .35), transparent 70%), linear-gradient(120deg, #0b1430 0%, #13204a 55%, #1a2b66 100%);
  box-shadow: var(--shadow-md); border: 1px solid rgba(255, 255, 255, .06); }
.dash-welcome::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 28px 28px; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 45%, #000 100%); mask-image: linear-gradient(90deg, transparent 0, #000 45%, #000 100%); }
.dash-welcome::after { content: ""; position: absolute; z-index: -1; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 1px solid rgba(160, 180, 255, .18); box-shadow: 0 0 0 36px rgba(160, 180, 255, .04), 0 0 0 72px rgba(160, 180, 255, .03); }
.dash-attention { background: radial-gradient(600px 240px at 100% 0, rgba(248, 113, 124, .32), transparent 70%), linear-gradient(120deg, #1d0d18 0%, #2c1424 55%, #3c1626 100%); }
.dash-watch { background: radial-gradient(600px 240px at 100% 0, rgba(245, 183, 78, .28), transparent 70%), linear-gradient(120deg, #17120a 0%, #261c0e 55%, #33240f 100%); }
.dw-text { min-width: 0; flex: 1 1 380px; }
.dw-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #9fb0d8; }
.dw-eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34d39e; box-shadow: 0 0 0 4px rgba(52, 211, 158, .18); }
.dash-attention .dw-eyebrow::before { background: #f8717c; box-shadow: 0 0 0 4px rgba(248, 113, 124, .22); animation: dw-pulse 1.6s ease-in-out infinite; }
.dash-watch .dw-eyebrow::before { background: #f5b74e; box-shadow: 0 0 0 4px rgba(245, 183, 78, .2); }
@keyframes dw-pulse { 50% { box-shadow: 0 0 0 7px rgba(248, 113, 124, .05); } }
.dash-welcome h1 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin: 8px 0 6px; color: #fff; }
.dash-welcome p { margin: 0; color: #b9c4de; font-size: 14px; max-width: 70ch; }
.dw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dw-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 550; color: #e8edf8;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); backdrop-filter: blur(6px); transition: background .12s, border-color .12s; }
.dw-btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); text-decoration: none; color: #fff; }
.dw-btn svg { opacity: .8; }
.dw-btn b { background: #e5484d; color: #fff; font-size: 11px; padding: 0 6px; border-radius: 99px; line-height: 17px; }

/* ---------- dashboard: health ring ---------- */
.dash-hero { gap: 16px; }
.dash-health { background: var(--surface); gap: 22px; padding: 22px 24px; }
.dash-health h2 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.ring circle { stroke-width: 10; stroke-linecap: round; }
.ring-bg { stroke: var(--surface-3); }
.ring-unk { stroke: var(--unknown); }
.ring-num { font: 700 23px var(--font); letter-spacing: -.03em; }
.ring-sub { font: 600 9.5px var(--font); letter-spacing: .1em; }
.legend-row { gap: 6px; }
.legend-row a, .legend-row > span { padding: 3px 10px 3px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; }
.legend-row a:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.lg { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg-up { background: var(--up); } .lg-down { background: var(--down); } .lg-unk, .lg-unknown { background: var(--unknown); }
.dash-row { gap: 16px; margin-bottom: 16px; }
.pop-chip { border-radius: 99px; padding: 5px 11px; background: var(--surface); border-color: var(--border); font-weight: 500; }
.pop-chip:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.mini-list li { padding: 9px 0; border-bottom-color: color-mix(in srgb, var(--border) 75%, transparent); }

/* ---------- sign-in pages ---------- */
.auth-body { background: var(--bg); }
.auth-body:not(.auth-split) { background: radial-gradient(900px 500px at 50% -20%, var(--primary-50), transparent 70%), var(--bg); }
.auth-card { border-radius: 16px; box-shadow: var(--shadow-lg); padding: 30px; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(0, 1fr); }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 40px 48px; color: #dfe6f6; isolation: isolate;
  background: radial-gradient(700px 420px at 15% 0%, rgba(91, 122, 255, .32), transparent 65%), radial-gradient(600px 400px at 100% 100%, rgba(52, 211, 180, .14), transparent 60%), linear-gradient(160deg, #070d1d 0%, #0c1633 55%, #0a1228 100%); }
.auth-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg, transparent 60%, rgba(3, 6, 14, .5)); }
.auth-hero-brand { display: flex; align-items: center; gap: 12px; }
.auth-hero-brand img, .auth-brand img { border-radius: 10px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 8px 20px -6px rgba(51, 88, 230, .7); }
.auth-hero-brand strong { display: block; font-size: 16px; color: #fff; letter-spacing: -.01em; }
.auth-hero-brand span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #8392b3; }
.auth-hero-art { flex: 1; display: grid; place-items: center; padding: 24px 0; min-height: 220px; }
.auth-hero-art img { width: 100%; max-width: 520px; height: auto; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .35)); }
.auth-eyebrow { display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #8fa6ff; margin-bottom: 10px; }
.auth-hero-copy h1 { font-size: 30px; line-height: 1.18; font-weight: 700; letter-spacing: -.035em; color: #fff; max-width: 18ch; margin-bottom: 18px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #b8c3dc; }
.auth-points svg { color: #8fa6ff; flex: none; width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: rgba(143, 166, 255, .1); box-shadow: inset 0 0 0 1px rgba(143, 166, 255, .18); }
.auth-hero-foot { margin-top: 32px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 12px; color: #6f7d9c; display: flex; align-items: center; gap: 8px; }
.auth-live { width: 7px; height: 7px; border-radius: 50%; background: #34d39e; box-shadow: 0 0 0 4px rgba(52, 211, 158, .16); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--bg);
  background-image: radial-gradient(600px 400px at 100% 0, color-mix(in srgb, var(--primary) 7%, transparent), transparent 70%); }
.auth-panel-inner { width: 100%; max-width: 400px; }
.auth-split .auth-card { padding: 0; border: 0; box-shadow: none; background: none; max-width: none; }
.auth-card-head { margin-bottom: 24px; }
.auth-split .auth-card h2 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 6px; }
.auth-split .auth-card-head p, .auth-split .auth-card > p.muted { margin: 0 0 22px; font-size: 14px; }
.auth-split .auth-card-head p { margin: 0; }
.auth-split .field { margin-bottom: 16px; }
.auth-split input[type=text], .auth-split input[type=password] { height: 44px; font-size: 14.5px; border-radius: 10px; }
.auth-split .btn-block { margin-top: 8px; }
.auth-split .auth-panel-inner > .alert { margin-bottom: 18px; }
.input-ico { position: relative; display: block; }
.input-ico > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-ico > input { width: 100%; padding-left: 40px !important; }
.input-ico > input:focus ~ svg, .input-ico:focus-within > svg { color: var(--primary); }
.input-reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.input-reveal:hover { background: var(--surface-3); color: var(--text); }
.input-reveal.on { color: var(--primary); }
.input-ico:has(.input-reveal) > input { padding-right: 44px; }
.auth-legal { margin: 28px 0 0; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.auth-brand-mobile { display: none; }
.auth-split .code-input { font-family: var(--mono); font-size: 20px; letter-spacing: .3em; text-align: center; height: 52px; }
@media (max-width: 960px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .auth-brand-mobile { display: flex; margin-bottom: 28px; }
  .auth-panel { align-items: start; padding-top: 12vh; }
}

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .topbar { padding: 0 14px; }
  .content { padding: 18px 16px 32px; }
  .dash-welcome { padding: 20px; border-radius: 14px; }
  .dash-welcome h1 { font-size: 22px; }
  .user-chip { border: 0; padding: 0; background: none; }
}
@media (prefers-reduced-motion: reduce) { .dash-attention .dw-eyebrow::before { animation: none; } .kpi, .stat, .btn { transition: none; } }
html[data-theme="dark"] .avatar { color: #fff; background: linear-gradient(135deg, #5b7cff, #3358e6); }
.stat::before { background: transparent; } .stat-up::before { background: var(--up); } .stat-down::before { background: var(--down); } .stat-warn::before { background: var(--warn); }
.search > .icon { z-index: 1; pointer-events: none; } .search:focus-within > .icon { color: var(--primary); }
.theme-toggle > span { display: grid; place-items: center; }
.theme-toggle .ico-sun, html[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
html[data-theme="dark"] .theme-toggle .ico-sun { display: grid; }

/* ---- v1.9.53: two boxes side by side with the same size (OLT page: Recent ONU events / Problem ONUs) ---- */
.grid-even { align-items: stretch; }
.grid-even > .card { height: 480px; display: flex; flex-direction: column; min-height: 0; }
.grid-even > .card > .scroll-y { max-height: none; flex: 1 1 auto; min-height: 0; }
.grid-even > .card:not(.flush) { overflow-y: auto; }
@media (max-width: 1100px) { .grid-even > .card { height: auto; max-height: 480px; } }
.onu-actions .inline-form { display: inline-block; margin: 0; }
.onu-actions .btn-icon svg { display: block; }
.onu-actions .btn-danger-ghost { color: var(--down); }

/* ---- v1.9.53: one stacked bar — share of the bandwidth bought per type ---- */
.cap-share .share-bar { display: flex; height: 38px; border-radius: 10px; overflow: hidden; background: var(--surface-2, #eef2f7); margin: 4px 0 12px; }
.share-seg { display: flex; align-items: center; justify-content: center; min-width: 0; width: 0; color: #fff; text-decoration: none; transition: width .5s ease, filter .12s; border-right: 2px solid var(--surface); }
.share-seg:last-child { border-right: 0; }
.share-seg:hover { filter: brightness(1.08); text-decoration: none; }
.share-txt { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.share-txt b { font-weight: 700; }
.share-hide { display: none; }
.share-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.share-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; }
.share-key:hover { text-decoration: underline; }
.share-key i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.share-total { margin-left: auto; font-weight: 600; }
.seg-c0 { background: #2563eb; } .seg-c1 { background: #16a34a; } .seg-c2 { background: #ea580c; } .seg-c3 { background: #9333ea; }
.seg-c4 { background: #0891b2; } .seg-c5 { background: #db2777; } .seg-c6 { background: #ca8a04; } .seg-c7 { background: #475569; }

/* ---- v1.9.53: dashboard alerts — the second line starts under the alert text, not under the badge ---- */
.mini-list li.dash-alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.dash-alert > .badge { margin-top: 1px; }
.dash-alert-body { min-width: 0; }
.dash-alert-body .alert-msg-parts { margin-top: 3px; }

/* ---- v1.9.55: OLT page header — the same rows on every OLT: name line + POP / OLT selects, buttons, then notes ---- */
.olt-head { flex-direction: column; align-items: stretch; gap: 10px; }
.olt-head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.olt-head-row .title-line { min-width: 0; }
.olt-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.olt-head-right .dev-nav select { max-width: 170px; }
.olt-buttons { gap: 6px; }
.olt-buttons .btn-icon { width: 36px; }
.olt-notes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---- v1.9.56: graphical touches ---- */
/* front panel: rack ears with screws and a lit edge, like the real box */
.fp-chassis { position: relative; padding-left: 40px; padding-right: 40px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -3px 0 rgba(0,0,0,.18), 0 3px 10px rgba(15,23,42,.14); }
.fp-chassis::before, .fp-chassis::after { content: ""; position: absolute; top: 8px; bottom: 8px; width: 16px; border-radius: 5px; pointer-events: none;
  background: radial-gradient(circle at 50% 16px, rgba(0,0,0,.5) 0 3px, rgba(255,255,255,.35) 3.5px 4px, transparent 4.5px),
              radial-gradient(circle at 50% calc(100% - 16px), rgba(0,0,0,.5) 0 3px, rgba(255,255,255,.35) 3.5px 4px, transparent 4.5px),
              linear-gradient(90deg, rgba(0,0,0,.10), rgba(255,255,255,.10)); }
.fp-chassis::before { left: 10px; }
.fp-chassis::after { right: 10px; }
.fp-group { box-shadow: inset 0 1px 2px rgba(0,0,0,.18); }
/* "no data yet" in a graph box: calmer, centred, with a dashed frame */
.chart-empty { display: flex; align-items: center; justify-content: center; min-height: 160px; border: 1px dashed var(--border); border-radius: 12px;
  color: var(--muted); font-size: 13px; background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--border) 25%, transparent) 10px 11px); }
/* graph boxes: the plot sits on a soft panel */
.chart .uplot { border-radius: 10px; }

/* ---- v1.9.57: dashboard POP health strip ---- */
.pop-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pop-tile { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; border-radius: 12px; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); background: var(--surface); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.pop-tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--up, #10b981); }
.pop-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15, 23, 42, .10); text-decoration: none; }
.pop-tile.pop-warn::before { background: #f59e0b; }
.pop-tile.pop-bad::before { background: var(--down, #ef4444); }
.pop-tile.pop-bad { background: color-mix(in srgb, var(--down, #ef4444) 7%, var(--surface)); border-color: color-mix(in srgb, var(--down, #ef4444) 35%, var(--border)); }
.pop-tile.pop-warn { background: color-mix(in srgb, #f59e0b 6%, var(--surface)); }
.pop-tile-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-tile-bar { position: absolute; left: 4px; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--border) 60%, transparent); }
.pop-tile-bar span { display: block; height: 100%; width: 0; background: #10b981; transition: width .5s; }
.pop-warn .pop-tile-bar span { background: #f59e0b; }
/* ONU page: Rx power gauge */
.rx-gauge { position: relative; display: block; height: 8px; margin-top: 10px; }
.rx-zones { display: flex; height: 100%; border-radius: 99px; overflow: hidden; opacity: .85; }
.rx-zones > span { display: block; height: 100%; width: 0; }
.rx-zones .z-bad { background: #ef4444; } .rx-zones .z-warn { background: #f59e0b; } .rx-zones .z-ok { background: #10b981; }
.rx-mark { position: absolute; inset: 0; pointer-events: none; }
.rx-mark > span { position: relative; display: block; height: 100%; width: 0; }
.rx-mark > span::after { content: ""; position: absolute; right: -7px; top: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
/* IPAM: address conflicts as cards */
.conflict-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.conflict-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--down, #ef4444) 30%, var(--border));
  background: color-mix(in srgb, var(--down, #ef4444) 5%, var(--surface)); color: var(--text); text-decoration: none; position: relative; }
.conflict-card:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(15, 23, 42, .10); }
.conflict-ip { font-size: 16px; font-weight: 700; color: var(--down, #dc2626); }
.conflict-n { position: absolute; top: 12px; right: 14px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--down, #ef4444) 14%, transparent); color: var(--down, #dc2626); }
.conflict-places { display: flex; flex-wrap: wrap; gap: 4px; }
.conflict-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.conflict-chip.more { color: var(--muted); }
/* usage bars: a soft track and a little shine */
.util .bar { background: color-mix(in srgb, var(--border) 70%, transparent); border-radius: 99px; }
.util .bar > span { border-radius: 99px; background-image: linear-gradient(180deg, rgba(255,255,255,.25), rgba(255,255,255,0)); }
/* ---- v1.9.57: wallboard ---- */
.wall-pops { margin-bottom: 18px; }
.wall .pop-strip { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.wall .pop-tile { padding: 12px 14px 14px; }
.wall .pop-tile-name { font-size: 15px; }
.wall-list li { font-size: 16px; padding: 10px 2px; }
.wall { padding-bottom: 64px; }
.wall-ticker { position: fixed; left: 0; right: 0; bottom: 0; height: 44px; overflow: hidden; display: flex; align-items: center; z-index: 20;
  background: linear-gradient(90deg, #7f1d1d, #b91c1c); color: #fff; font-size: 16px; box-shadow: 0 -4px 14px rgba(0,0,0,.25); }
.wall-ticker-run { display: inline-flex; gap: 48px; white-space: nowrap; padding-left: 100%; animation: wall-tick 36s linear infinite; }
.wall-tick b { margin-right: 6px; }
.wall-tick::before { content: "●"; margin-right: 8px; color: #fecaca; }
@keyframes wall-tick { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .wall-ticker-run { animation: none; padding-left: 16px; } }
/* ---- v1.9.57: "nothing here yet" messages in cards: centred, with an icon ---- */
.card p.pad.muted:not(.small) { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 30px 24px; margin: 0; line-height: 1.55; }
.card p.pad.muted:not(.small)::before { content: ""; width: 44px; height: 44px; border-radius: 14px; flex: none;
  background-color: var(--primary-50, #eef2ff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 22px; }

/* ---- v1.9.58: time range controls — one look everywhere (segmented pill), boxes that stay in view, the time dock ---- */
.range-picker { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2, #f1f5f9); overflow: visible; }
.range-picker button, .range-picker a { border: 0 !important; background: transparent; padding: 5px 11px; border-radius: 8px; font: 600 12.5px var(--font); color: var(--text-2);
  cursor: pointer; transition: background .12s, color .12s, box-shadow .12s; line-height: 1.2; }
.range-picker button:hover, .range-picker a:hover { background: var(--surface); color: var(--text); }
.range-picker button.active, .range-picker a.active, .range-picker button[data-range-custom].active {
  background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .14), 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent); }
.range-shift { gap: 0; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.range-shift .rs-btn { width: 34px; font-size: 17px; color: var(--muted); }
.range-shift .rs-btn:hover:not([disabled]) { background: var(--primary-50); color: var(--primary); }
.range-shift .range-label { font-weight: 500; color: var(--text-2); }
.range-shift .range-label-win { color: var(--primary); background: var(--primary-50); }
.range-custom { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 20px rgba(15, 23, 42, .10); }
.range-custom input { height: 34px; border-radius: 8px; }
html[data-theme="dark"] .range-picker { background: color-mix(in srgb, var(--surface) 70%, #000); }
html[data-theme="dark"] .range-picker button.active, html[data-theme="dark"] .range-picker a.active { background: var(--surface); }
/* the box with the range (Graphs, Graph trees, Service checks …) stays under the top bar while its graphs scroll */
.graph-range { top: 68px; z-index: 12; transition: box-shadow .15s; }
.graph-range.stuck { box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
/* the time dock: shown under the top bar when the page's range buttons are scrolled away */
.time-dock { position: fixed; top: 70px; left: calc(var(--side-w) + (100vw - var(--side-w)) / 2); transform: translate(-50%, -12px); z-index: 40; opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 260px);
  padding: 6px 8px 6px 12px; border-radius: 16px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(10px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18); transition: opacity .18s, transform .18s; }
.time-dock.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.time-dock .td-ico { width: 18px; height: 18px; flex: none; opacity: .7;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat; }
.time-dock .range-shift .range-label { width: auto; min-width: 90px; white-space: nowrap; }
.time-dock .td-custom { flex-basis: 100%; margin: 4px 0 2px; box-shadow: none; justify-content: center; }
@media (max-width: 900px) { .time-dock { left: 50%; max-width: calc(100vw - 16px); top: 64px; } .time-dock .td-ico { display: none; } }
@media print { .time-dock { display: none; } }

/* ---- v1.9.59: every graph in its own panel inside a card (Graphs page, device page …): clear space between graphs ---- */
.card .chart-grid { gap: 16px; }
.card .chart-grid > .chart-box:not(.card) { padding: 12px 14px 10px; border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2, #f8fafc) 55%, var(--surface)); min-width: 0; }
.card .chart-grid > .chart-box:not(.card) h3 { margin-bottom: 8px; }
.graph-device { margin-bottom: 18px; }
/* bandwidth share bar: a small part shows only its name */
.share-txt.share-short { padding: 0 4px; font-size: 11.5px; }
/* ---- v1.9.61: wallboard ---- */
.wall-actions { display: inline-flex; align-items: center; gap: 8px; }
.wall-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.wall-busy li { align-items: center; }
.wall-busy-name { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.wall-busy-name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wall-busy .util { display: block; } .wall-busy .util .bar { height: 6px; }
body.is-full .wall { padding-top: 12px; }
@media (max-width: 1100px) { .wall-two { grid-template-columns: 1fr; } }

/* ---- v1.9.62: down devices — why, in the red row / red box ---- */
.down-info { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 12px; }
.down-info .down-since { color: var(--down, #dc2626); font-weight: 600; }
.down-info .down-parent { color: var(--text-2); }
.down-info .down-parent.bad { color: var(--down, #dc2626); }
.down-info .down-parent::before { content: "↳ "; opacity: .6; }
.down-box { border: 1px solid color-mix(in srgb, var(--down, #ef4444) 45%, var(--border)); background: color-mix(in srgb, var(--down, #ef4444) 9%, var(--surface));
  border-left: 5px solid var(--down, #ef4444); border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; }
.down-box-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--down, #dc2626); font-size: 15px; }
.down-box-head span { color: var(--text-2); font-size: 13px; }
.down-box-list { margin: 8px 0 0; padding-left: 26px; font-size: 14px; }
.down-box-list li { margin: 3px 0; }
.down-box-list li.bad { color: var(--down, #dc2626); font-weight: 600; }
.down-box p { margin: 6px 0 0 26px; }
/* bonds (LAG) on the connections page */
.badge.bundle-up { background: color-mix(in srgb, #6366f1 14%, transparent); color: #4f46e5; }
.badge.bundle-degraded { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.badge.bundle-down { background: color-mix(in srgb, #ef4444 16%, transparent); color: #b91c1c; }
.badge.bundle-unknown { background: var(--surface-2); color: var(--muted); }
/* ---- v1.9.62: weathermap + bonds on the map ---- */
.map-legend-box .lg-weather { display: none; align-items: center; gap: 6px; }
.map-legend-box.weather-on .lg-weather { display: inline-flex; }
.map-legend-box.weather-on .lg-up, .map-legend-box.weather-on .lg-warm, .map-legend-box.weather-on .lg-hot { opacity: .35; }
.lg-grad { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #10b981, #84cc16 40%, #eab308 60%, #f97316 80%, #ef4444 95%); }
.netmap .mb-bundle-up { fill: #eef2ff; stroke: #a5b4fc; } .netmap .ml-bundle-up { fill: #4338ca; font-weight: 600; }
.netmap .mb-bundle-degraded { fill: #fffbeb; stroke: #f59e0b; } .netmap .ml-bundle-degraded { fill: #b45309; font-weight: 700; }
.netmap .mb-bundle-down { fill: #fef2f2; stroke: #ef4444; } .netmap .ml-bundle-down { fill: #b91c1c; font-weight: 700; }
.netmap .mb-bundle-unknown { fill: #f8fafc; stroke: #cbd5e1; } .netmap .ml-bundle-unknown { fill: #475569; }
html[data-theme="dark"] .netmap .mb-bundle-up { fill: #1e1b4b; } html[data-theme="dark"] .netmap .ml-bundle-up { fill: #c7d2fe; }

/* ---------- v1.9.63: PPPoE search (one list, state dot), tables as cards on phones ---------- */
.ppp-state { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: middle; flex-shrink: 0; }
.ppp-on { background: var(--up); box-shadow: 0 0 0 3px var(--up-50); }
.ppp-off { background: var(--down); box-shadow: 0 0 0 3px var(--down-50); }
.ppp-disabled { background: var(--muted); box-shadow: 0 0 0 3px var(--surface-2); }
.ppp-user { white-space: nowrap; }
.table tr.ppp-off-row td { background: color-mix(in srgb, var(--down-50) 55%, transparent); }
@media (max-width: 760px) {
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile, .table.stack-mobile tbody, .table.stack-mobile tr { display: block; width: 100%; }
  .table.stack-mobile tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 16px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.stack-mobile td.sn { display: none; }
  .table.stack-mobile td { display: block; flex: 0 1 auto; max-width: 100%; border: 0 !important; padding: 0 !important; background: none !important; white-space: normal; min-width: 0; }
  .table.stack-mobile .ip-ping { display: inline-flex; flex-wrap: nowrap; white-space: nowrap; }
  .table.stack-mobile td:first-child, .table.stack-mobile td.sn + td { flex: 1 1 100%; font-size: 15px; }
  .table.stack-mobile td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .table.stack-mobile td:empty, .table.stack-mobile td.actions:not(:has(*)) { display: none; }
  .table.stack-mobile td.actions { flex: 1 1 100%; text-align: left; }
  .table.stack-mobile td.num { text-align: left; }
}

/* =====================================================================================================
   v1.9.63 — cleaner look (softer cards, clearer headings, row hover) and a phone layout like an app
   (bottom navigation, tables as cards, bigger touch targets). Same tokens in light and dark.
   ===================================================================================================== */
:root { --radius: 14px; --shadow: 0 1px 2px rgba(13, 21, 38, .04), 0 2px 8px -2px rgba(13, 21, 38, .06); }
body { background: var(--bg); background-image: radial-gradient(1200px 500px at 100% -10%, color-mix(in srgb, var(--primary) 6%, transparent), transparent 60%); background-attachment: fixed; }
.card { border-radius: var(--radius); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card > .card-head:first-child h2::before, .card > form > .card-head:first-child h2::before { content: ""; width: 4px; height: 16px; border-radius: 3px; background: linear-gradient(var(--primary), color-mix(in srgb, var(--primary) 45%, transparent)); flex-shrink: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover > td { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.table td { vertical-align: middle; }
.btn { transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; }
.btn:active { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px rgba(13, 21, 38, .1), 0 4px 10px -4px color-mix(in srgb, var(--primary) 60%, transparent); }
.stat { border-radius: var(--radius); }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], input[type="email"], input[type="url"], input[type="tel"], select, textarea { border-radius: 9px; }
.toolbar .title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }

/* back arrow, ping next to an IP */
.back-btn { color: var(--text-2); }
.back-btn:hover { color: var(--primary); }
.ip-ping { display: inline-flex; align-items: center; gap: 4px; }
.ping-btn { width: 26px; height: 26px; padding: 0; color: var(--muted); border-color: transparent; background: transparent; }
.ping-btn:hover { color: var(--primary); background: var(--primary-50); }
.ping-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ping-btns { display: inline-flex; gap: 6px; margin-left: auto; }

/* tabs inside a page (Settings, user form) */
.tabs-root .settings-tabs, .user-form .tabs { position: sticky; top: 60px; z-index: 5; background: var(--bg); padding-top: 4px; }
.user-form .tabs { background: var(--surface); margin: -4px -2px 16px; }
.tabs a .icon { margin-right: 4px; vertical-align: -3px; }
.tabs .tab-link { margin-left: auto; }
.settings-card { max-width: 1200px; }
.set-group { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px 6px; margin: 0 0 16px; background: var(--surface-2); }
.set-group > legend { padding: 0 8px; font-weight: 650; font-size: 13.5px; display: flex; align-items: center; gap: 6px; color: var(--text); }
.check-grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.user-form { max-width: 1100px; }

/* alerts: acknowledged group, "still needed?" */
.acked-group { border-top: 1px solid var(--border); }
.acked-group > summary { cursor: pointer; padding: 12px 20px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text-2); list-style: none; }
.acked-group > summary::-webkit-details-marker { display: none; }
.acked-group > summary::after { content: "▸"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.acked-group[open] > summary::after { transform: rotate(90deg); }
.acked-group .table tr > td { opacity: .78; }
.stale-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; padding: 7px 10px; border-radius: 10px; background: var(--warn-50); border: 1px solid var(--warn-200); font-size: 12.5px; color: var(--warn); }
.stale-ask .inline-form { margin: 0; }

/* ONU state: the reason instead of "offline" */
.badge.onu-wire { background: var(--down-50); color: var(--down); }
.badge.onu-power { background: #fff3e2; color: #c2620a; }
html[data-theme="dark"] .badge.onu-power { background: #2e1f0b; color: #fbbf6a; }
.badge.onu-wire .dot, .badge.onu-power .dot { background: currentColor; }

/* OLT page: graph / events / problems behind buttons */
.pop-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
/* device page: detail cards behind buttons, right-aligned above the stats (v1.9.88) */
.pop-buttons.pop-right { justify-content: flex-end; margin: 0 0 12px; }
.pop-buttons .btn .pop-dot { width: 8px; height: 8px; margin-left: 2px; }
.pop-dot.pop-dot-up { background: var(--up); }
.pop-dot.pop-dot-down { background: var(--down); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.pop-dot.pop-dot-warn { background: var(--warn); }
.pop-dot.pop-dot-off { background: var(--muted); }
/* in the pop-up the window title already names the card: no second heading (a head with only the heading goes) */
.in-pop:is(#links, #neighbors, #flows, #gnmi, #sensors, #backups, #maint, #events) > .card-head > h2 { display: none; }
.in-pop:is(#links, #neighbors, #flows, #gnmi, #sensors, #backups, #maint, #events) > .card-head:has(> h2:only-child),
.in-pop:is(#links, #neighbors, #flows, #gnmi, #sensors, #backups, #maint, #events) > .card-head:has(> h2 + span.muted:last-child) { display: none; }
.btn-warn-ghost { border-color: var(--warn-200); background: var(--warn-50); color: var(--warn); }
.in-pop.card { margin: 0; box-shadow: none; border: 0; padding: 0; }
.in-pop .table-wrap.scroll-y { max-height: 62vh; }
.modal-wide { width: min(1100px, calc(100vw - 24px)); }

/* latency: small graph opens the big one */
.smoke-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 6px; }
.smoke-open:hover { box-shadow: 0 0 0 2px var(--ring); }
.latency-pop .toolbar { margin-bottom: 12px; }
.latency-pop .stats { margin-bottom: 12px; }

/* provider POP kinds */
.badge.pop-kind-nttn { background: #fdf2f8; color: #be185d; }
.badge.pop-kind-bandwidth { background: #e0f2fe; color: #0369a1; }
html[data-theme="dark"] .badge.pop-kind-nttn { background: #3b0d24; color: #f9a8d4; }
html[data-theme="dark"] .badge.pop-kind-bandwidth { background: #082f49; color: #7dd3fc; }
.netmap .pop-nttn-box { fill: var(--surface); stroke-width: 2; }
.netmap .pop-tower { color: #db2777; }
.netmap .pop-tower-line, .netmap .pop-tower-wave { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.netmap .pop-tower-wave { opacity: .7; }
.netmap .pop-tower-dot { fill: currentColor; }

/* upstream map: provider → circuit / bond → services */
.up-providers { display: flex; flex-direction: column; gap: 18px; }
.up-prov { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.up-cloud { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, #e0f2fe, #f0f9ff); border: 1px solid #bae6fd; position: sticky; top: 76px; }
html[data-theme="dark"] .up-cloud { background: linear-gradient(135deg, #082f49, #0c1a2e); border-color: #0c4a6e; }
.up-cloud svg { fill: #fff; stroke: #0284c7; stroke-width: 1.4; flex-shrink: 0; }
html[data-theme="dark"] .up-cloud svg { fill: #0c1a2e; stroke: #38bdf8; }
.up-circuits { display: flex; flex-direction: column; gap: 12px; border-left: 2px dashed #7dd3fc; padding-left: 16px; }
.up-circ { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); box-shadow: var(--shadow); }
.up-circ::before { content: ""; position: absolute; left: -18px; top: 22px; width: 16px; border-top: 2px dashed #7dd3fc; }
.up-circ.up-down { border-color: var(--down-200); background: var(--down-50); }
.up-circ.up-degraded { border-color: var(--warn-200); }
.up-circ-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.badge.up-st-up { background: var(--up-50); color: var(--up); }
.badge.up-st-down { background: var(--down-50); color: var(--down); }
.badge.up-st-degraded { background: var(--warn-50); color: var(--warn); }
.up-members { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.up-mem { display: inline-flex; align-items: center; gap: 5px; font: 12px var(--mono); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.up-mem .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
.up-mem.bad { border-color: var(--down-200); background: var(--down-50); color: var(--down); }
.up-mem.bad .dot { background: var(--down); }
.up-load, .up-svc-load { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.up-bar { display: inline-block; width: 140px; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.up-bar > span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .6s ease; }
.ld-0 > span { background: #16a34a; } .ld-1 > span { background: #84cc16; } .ld-2 > span { background: #eab308; } .ld-3 > span { background: #f97316; } .ld-4 > span { background: #dc2626; } .ld-none > span { background: var(--border-strong); }
.up-svcs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.up-svcs li { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.up-svcs li.bad { border-color: var(--down-200); background: var(--down-50); }
.up-svc-load { margin-top: 4px; }
.up-svc-load .up-bar { width: 100px; }

/* ---------- phones: an app-like layout ---------- */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .content { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .card { padding: 14px; margin-bottom: 14px; border-radius: 14px; }
  .card.flush { padding: 0; }
  .topbar { padding: 0 10px; height: 54px; }
  .page-title { font-size: 16px; }
  .user-meta { display: none; }
  .btn { height: 40px; }
  .btn-sm { height: 34px; }
  .icon-btn { width: 40px; height: 40px; }
  .stats, .stats-5, .stats-6 { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .bottom-nav { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.6) blur(12px); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px -10px rgba(13, 21, 38, .25); }
  .bottom-nav a, .bottom-nav button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 0; background: none;
    color: var(--muted); font: 600 10.5px var(--font); text-decoration: none; border-radius: 10px; cursor: pointer; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.active::before { content: ""; position: absolute; top: -6px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .bn-badge { position: absolute; top: 0; left: 50%; margin-left: 6px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px; background: var(--down); color: #fff; font: 700 10px/17px var(--font); text-align: center; }
  .up-prov { grid-template-columns: 1fr; }
  .up-cloud { position: static; }
  .up-svcs { grid-template-columns: 1fr; }
  .up-bar { width: 100px; }
  .tabs-root .settings-tabs, .user-form .tabs { top: 54px; }
  .pop-buttons .btn { flex: 1 1 auto; }
  .table.stack-mobile tr.row-down { background: var(--down-50); border-left: 3px solid var(--down); }
  .table.stack-mobile tr.pon-sep { display: block; padding: 8px 14px; background: var(--surface-3); }
  .table.stack-mobile tr.pon-sep td { display: block; }
  .table.stack-mobile tr.pon-sep td::before { content: none; }
}
.netmap .flow.flow-rev { animation-direction: reverse; }

/* ---------- v1.9.65: PPPoE search ----------
   desktop: no wrapping, the IP's buttons in one row, up time green / down time red
   phone card (3 columns: left · middle · right):
   1 user ................................ Customer ID: 7164
   2 OLT            ONU PON3 : ONU103            Laser
                    (state badge)
   3 Router         IP (+ buttons)               Up / down time
   4 Mobile         MAC                          Expiry
   5                [ Disconnect ] */
.m-only { display: none; }
.ppp-count { font-variant-numeric: tabular-nums; }
.ppp-table .pppoe-tools { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 4px; }
.ppp-table .up-time { color: var(--up); font-weight: 600; }
.ppp-table .down-time { color: var(--down); font-weight: 600; }
.ppp-table .c-onu-state { margin-top: 3px; }
@media (max-width: 760px) {
  .m-only { display: inline; color: var(--muted); font-family: var(--font); font-size: 12.5px; }
  .table.ppp-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px 6px; }
  .table.ppp-table td { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
  .table.ppp-table td.sn { display: none; }
  .table.ppp-table .c-user { grid-column: 1 / 3; grid-row: 1; font-size: 17px; }
  .table.ppp-table .c-user a { font-weight: 700; }
  .table.ppp-table .c-cid { grid-column: 3 / 4; grid-row: 1; text-align: right; align-self: center; font-size: 14px; }
  .table.ppp-table .c-cid b { font-size: 15px; }
  .table.ppp-table .c-olt { grid-column: 1; grid-row: 2; }
  .table.ppp-table .c-onu { grid-column: 2; grid-row: 2; text-align: center; white-space: nowrap; }
  .table.ppp-table .c-laser { grid-column: 3; grid-row: 2; text-align: right !important; white-space: nowrap; }
  .table.ppp-table .c-laser > div { display: none; }
  .table.ppp-table .c-router { grid-column: 1; grid-row: 3; }
  .table.ppp-table .c-ip { grid-column: 2; grid-row: 3; text-align: center; }
  .table.ppp-table .c-ip .pppoe-tools { justify-content: center; }
  .table.ppp-table .c-ip .btn-icon { width: 28px; height: 28px; }
  .table.ppp-table .c-up { grid-column: 3; grid-row: 3; text-align: right; }
  .table.ppp-table .c-mob { grid-column: 1; grid-row: 4; }
  .table.ppp-table .c-mac { grid-column: 2; grid-row: 4; text-align: center; }
  .table.ppp-table .c-exp { grid-column: 3; grid-row: 4; text-align: right; }
  .table.ppp-table .c-act { grid-column: 1 / 4; grid-row: 5; display: flex !important; justify-content: center; }
  .table.ppp-table .c-act .btn { min-width: 160px; }
  .table.ppp-table .c-user[data-label]::before, .table.ppp-table .c-cid[data-label]::before { display: none; }
}

/* ---------- v1.9.65: device list card on a phone ----------
   1 status · name (whole line: long names fit)
   2 VSOL / OLT · site · IP + ping
   3 latency · CPU · RAM · temp · uptime · SNMP (compact)   — no firmware / hardware on a phone */
@media (max-width: 760px) {
  #devices-table tr { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 6px; }
  #devices-table td.d-st { grid-column: 1 / 3; grid-row: 1; align-self: center; }
  #devices-table td.d-name { grid-column: 3 / 13; grid-row: 1; font-size: 15.5px; align-self: center; }
  #devices-table td.d-vt { grid-column: 1 / 5; grid-row: 2; }
  #devices-table td.d-site { grid-column: 5 / 8; grid-row: 2; }
  #devices-table td.d-ip { grid-column: 8 / 13; grid-row: 2; text-align: right; }
  #devices-table td.d-fw, #devices-table td.d-hw { display: none !important; }
  #devices-table td.d-lat { grid-column: 1 / 3; grid-row: 3; }
  #devices-table td.d-cpu { grid-column: 3 / 5; grid-row: 3; }
  #devices-table td.d-ram { grid-column: 5 / 7; grid-row: 3; }
  #devices-table td.d-tmp { grid-column: 7 / 9; grid-row: 3; }
  #devices-table td.d-up { grid-column: 9 / 11; grid-row: 3; white-space: nowrap; }
  #devices-table td.d-snmp { grid-column: 11 / 13; grid-row: 3; text-align: right; }
  #devices-table td.d-lat, #devices-table td.d-cpu, #devices-table td.d-ram, #devices-table td.d-tmp, #devices-table td.d-up { font-size: 12px; text-align: left; }
  #devices-table td.d-st[data-label]::before, #devices-table td.d-name[data-label]::before { display: none; }
  #devices-table .d-model, #devices-table .d-build, #devices-table .ip2-line { display: none; }
  #devices-table .d-type { display: inline; font-size: inherit; color: inherit; }
  #devices-table .d-type::before { content: " / "; }
  #devices-table td.d-name .down-info { font-size: 12px; }
  #olt-list tr > td:first-child .small.muted { display: inline-flex; align-items: center; gap: 4px; }
}
}

/* ONU list: the action buttons in one even row (centred; on a phone at the bottom of the card) */
.onu-actions { text-align: center; white-space: nowrap; }
.onu-actions > .btn, .onu-actions > .inline-form { display: inline-flex; vertical-align: middle; margin: 0 2px; }
.onu-actions .btn-icon { width: 32px; height: 32px; }
@media (max-width: 760px) {
  #onu-table td.onu-actions { flex: 1 1 100%; display: flex !important; justify-content: center; gap: 10px; padding-top: 4px !important; }
  #onu-table td.onu-actions::before { display: none; }
  #onu-table td:first-child { flex: 0 1 auto; }
}
@media (max-width: 760px) { #onu-table .onu-flaps { display: none; } }

/* power supplies */
.psu-none { margin: -8px 0 16px; }
@media (max-width: 760px) { #devices-table td.d-psu { display: none !important; } }

/* ---- v1.9.66: power supplies on the front panel ---- */
.fp-psu { margin-left: auto; display: flex; gap: 8px; align-items: center; padding-left: 14px; border-left: 1px dashed color-mix(in srgb, var(--fp-text, var(--border)) 35%, transparent); }
.fp-psu-plain { border: 0; padding: 0; margin: 0; justify-content: flex-start; flex-wrap: wrap; }
.fp-psu-unit { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; padding: 6px 8px; border-radius: 8px;
  background: #0f172a; color: #cbd5e1; border: 1px solid rgba(255,255,255,.14); cursor: help; font-size: 10px; line-height: 1.15;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 1px 3px rgba(0,0,0,.35); }   /* its own dark plate: readable on every panel colour */
.fp-psu-plain .fp-psu-unit { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.fp-psu-unit .fp-psu-name { font-family: var(--mono); font-weight: 600; letter-spacing: .02em; }
.fp-psu-unit .fp-psu-state { font-weight: 700; letter-spacing: .04em; }
.fp-psu-unit.psu-ok { color: #4ade80; box-shadow: 0 0 10px rgba(74,222,128,.25) inset; }
.fp-psu-unit.psu-bad { color: #f87171; border-color: rgba(248,113,113,.6); box-shadow: 0 0 12px rgba(248,113,113,.35); animation: psu-blink 1.4s ease-in-out infinite; }
.fp-psu-unit.psu-grey { color: #94a3b8; }
.fp-psu-plain .fp-psu-unit.psu-ok { color: var(--up); }
.fp-psu-plain .fp-psu-unit.psu-bad { color: var(--down); }
@keyframes psu-blink { 50% { box-shadow: 0 0 2px rgba(248,113,113,.15); } }
@media (prefers-reduced-motion: reduce) { .fp-psu-unit.psu-bad { animation: none; } }
@media (max-width: 700px) { .fp-psu { padding-left: 8px; } .fp-psu-unit { min-width: 44px; padding: 4px 6px; } }

/* ---- v1.9.66: POP tiles say why they are coloured ---- */
.pop-tile { gap: 4px; }
.pop-tile-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pop-tile-head .pop-tile-name { flex: 1; min-width: 0; }
.pop-tile-pill { flex: none; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--up, #10b981) 14%, transparent); color: var(--up, #059669); }
.pop-warn .pop-tile-pill { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.pop-bad .pop-tile-pill { background: var(--down, #ef4444); color: #fff; }
.pop-tile-why { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-warn .pop-tile-why { color: #b45309; font-weight: 600; }
.pop-bad .pop-tile-why { color: var(--down, #dc2626); font-weight: 600; }
.pop-tile-stats { display: flex; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pop-tile-stats b { color: var(--text); font-size: 14px; }
.wall .pop-tile-stats b { font-size: 17px; }
.wall .pop-tile-why { font-size: 13px; }
[data-theme="dark"] .pop-warn .pop-tile-pill, [data-theme="dark"] .pop-warn .pop-tile-why { color: #fbbf24; }
.error-403 .error-icon { width: 68px; height: 68px; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, #f59e0b 14%, transparent); color: #b45309; }
.error-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* ---- v1.9.66: dashboard order — the numbers first, then alerts beside the POPs ---- */
.dash-top { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 20px; align-items: start; }
.dash-top > .card { margin: 0; }
.dash-top-one { grid-template-columns: minmax(0, 1fr); }
.dash-top .pop-strip { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.dash-calm { display: flex; align-items: center; gap: 8px; margin: 4px 0; padding: 14px 16px; border-radius: 12px; color: var(--up); font-weight: 600;
  background: color-mix(in srgb, var(--up, #10b981) 8%, transparent); }
.alert-card:has(.dash-calm) { border-color: var(--border); }
.alert-card:has(.dash-calm) .card-head h2 svg { color: var(--up); }
.pop-legend { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 10px; }
.pop-legend .lg { margin-left: 4px; }
.lg-warn { background: #f59e0b; }
.kpis .kpi { min-height: 108px; }
.kpi .kpi-val { letter-spacing: -.02em; }
@media (max-width: 1000px) { .dash-top { grid-template-columns: minmax(0, 1fr); } }
/* ---- v1.9.66: device and OLT lists are tighter on a desktop (less empty space between columns) ---- */
@media (min-width: 761px) {
  #devices-table th, #devices-table td, #olt-list th, #olt-list td { padding-left: 9px; padding-right: 9px; }
  #devices-table th:first-child, #devices-table td:first-child, #olt-list th:first-child, #olt-list td:first-child { padding-left: 14px; }
  #devices-table td.d-st, #devices-table th:first-child { width: 1%; white-space: nowrap; }
}
/* a cell only for the phone card (one line instead of the desktop's separate columns) */
.mob-only-cell { display: none; }
@media (max-width: 760px) {
  .table.stack-mobile td.mob-only-cell { display: block; }
  .table.stack-mobile td.d-only { display: none; }
}
/* ---- v1.9.66: Telegram POPs per alert ---- */
.tg-pops-table th.tg-pop, .tg-pops-table th.tg-all { text-align: center; white-space: nowrap; font-size: 10.5px; }
.tg-pops-table td.tg-pop, .tg-pops-table td.tg-all { text-align: center; width: 1%; }
.tg-pops-table td.tg-all, .tg-pops-table th.tg-all { background: color-mix(in srgb, var(--primary, #2563eb) 6%, transparent); }
.tg-pops-table tr.muted td:first-child { color: var(--muted); }
.tg-pops-table input { width: 16px; height: 16px; }
/* the reason a device is down: wraps in its cell (two lines) so the other columns stay in view */
.down-info { max-width: 380px; white-space: normal; }
.down-info .down-parent, .down-info .down-since { overflow-wrap: anywhere; }
.down-info .down-why { display: block; padding-left: 14px; color: var(--muted); font-size: 11.5px; }
.down-info .down-parent.bad .down-why { color: color-mix(in srgb, var(--down, #dc2626) 75%, var(--muted)); }

/* ---- v1.9.66: NOC wallboard — one status line, icon tiles, calmer cards ---- */
.wall { background: radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--primary, #2563eb) 10%, transparent), transparent 60%), var(--bg); }
.wall-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.wall-title h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.wall-title h1 span { color: var(--muted); font-weight: 600; }
.wall-state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.wall-state-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }
.wall-state-ok { color: #10b981; background: color-mix(in srgb, #10b981 13%, transparent); }
.wall-state-warn { color: #f59e0b; background: color-mix(in srgb, #f59e0b 14%, transparent); }
.wall-state-bad { color: #fff; background: #dc2626; animation: wall-pulse 2s ease-in-out infinite; }
.wall-state-bad .wall-state-dot { background: #fff; }
@keyframes wall-pulse { 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, .25); } }
.wall-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.wall-kpi { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--border); overflow: hidden; }
.wall-kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--wk, #10b981); }
.wall-kpi.wk-up { --wk: #10b981; } .wall-kpi.wk-warn { --wk: #f59e0b; } .wall-kpi.wk-bad { --wk: #ef4444; } .wall-kpi.wk-info { --wk: #3b82f6; }
.wall-kpi.wk-bad { background: color-mix(in srgb, #ef4444 9%, var(--surface)); border-color: color-mix(in srgb, #ef4444 40%, var(--border)); }
.wk-ico { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: var(--wk); background: color-mix(in srgb, var(--wk) 14%, transparent); }
.wk-label { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding-right: 40px; }
.wk-val { font-size: 42px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.wk-val small { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.wall-kpi.wk-bad .wk-val { color: #ef4444; }
.wk-sub { font-size: 12px; color: var(--muted); }
.wall-grid-one { grid-template-columns: minmax(0, 1fr); }
.wall-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.wall-col > .card, .wall-col > .wall-two { margin: 0; }
.wall-two-one { grid-template-columns: minmax(0, 1fr); }
.wall-card h2 { display: flex; align-items: center; gap: 8px; }
.wall-card h2 svg { color: var(--muted); }
.wall-ok { display: flex; align-items: center; gap: 8px; }
.wall-alerts li { border-left: 3px solid transparent; padding-left: 8px; }
.wall-alerts li.wa-critical { border-left-color: #ef4444; }
.wall-alerts li.wa-warning { border-left-color: #f59e0b; }
.wall-alerts .wa-msg { display: block; color: var(--text-2); }
@media (max-width: 1100px) { .wall-grid { grid-template-columns: minmax(0, 1fr); } .wall-two { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .wall-state-bad { animation: none; } }
/* v1.9.67: the reason on a POP tile has room for two lines */
.pop-tile-why { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; min-height: 2.7em; }
.pop-tile { min-height: 112px; }
.wall .pop-tile { min-height: 124px; }

/* ---- v1.9.67: long lists scroll with the page; their header row stays under the top bar (a fixed copy) ---- */
.table-scroll { overflow-x: auto; overflow-y: visible; scroll-margin-top: 68px; }
.float-head { position: fixed; z-index: 30; overflow: hidden; pointer-events: auto; background: var(--surface);
  box-shadow: 0 6px 12px -8px rgba(15, 23, 42, .35); border-bottom: 1px solid var(--border); }
.float-head[hidden] { display: none; }
.float-head .float-head-table { margin: 0; table-layout: fixed; border-collapse: collapse; }
.float-head .float-head-table th { background: var(--surface-2); cursor: pointer; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }

/* ---- v1.9.67: settings tabs on every settings page, integrations overview, alert templates ---- */
.settings-tabs { overflow-x: auto; scrollbar-width: thin; }
.settings-tabs .tab-link { margin-left: 0; }
.page-intro { margin: 4px 0 14px; }
.int-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 18px; }
.int-tile { position: relative; display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
  transition: transform .12s, box-shadow .12s, border-color .12s; }
.int-tile:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15, 23, 42, .10); border-color: var(--border-strong, var(--border)); }
.int-ico { grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.int-on .int-ico { background: var(--up-50); color: var(--up); }
.int-name { font-weight: 600; font-size: 13.5px; }
.int-state { font-size: 12px; color: var(--muted); }
.int-on .int-state { color: var(--up); font-weight: 600; }
.int-off .int-state::before { content: "● "; color: var(--border-strong, #cbd5e1); }
form.card[id], section.card[id] { scroll-margin-top: 120px; }
.tpl-card { border-left: 3px solid transparent; transition: border-color .12s; }
.tpl-card.tpl-changed { border-left-color: #f59e0b; }
.tpl-card > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; list-style: none; }
.tpl-card > summary::-webkit-details-marker { display: none; }
.tpl-card > summary::before { content: "›"; display: inline-block; width: 12px; color: var(--muted); font-size: 18px; line-height: 1; transition: transform .15s; }
.tpl-card[open] > summary::before { transform: rotate(90deg); }
.tpl-title { flex: 1; min-width: 200px; }
.tpl-chs { display: inline-flex; gap: 4px; }
.tpl-ch { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tpl-ch.tpl-ch-on { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #b45309; }
.tpl-vars .tpl-var { padding: 4px 10px; border-radius: 8px; background: var(--surface-2); }
/* v1.9.70: the whole POP tile opens its devices (a stretched link); its badge opens its alerts */
.pop-tile.pop-click { cursor: pointer; }
.pop-tile .pop-tile-link { color: inherit; text-decoration: none; }
.pop-tile .pop-tile-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.pop-tile a.pop-tile-pill { position: relative; z-index: 2; text-decoration: none; cursor: pointer; }
.pop-tile.pop-click:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15, 23, 42, .10); }

/* ---- v1.9.70: alert templates ---- */
.tpl-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; margin: 4px 0 14px; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary, #2563eb) 9%, var(--surface)), var(--surface)); border: 1px solid var(--border); }
.tpl-intro p { margin: 4px 0 0; max-width: 80ch; }
.tpl-h { margin: 0; font-size: 18px; }
.tpl-count { display: flex; flex-direction: column; align-items: center; min-width: 90px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.tpl-count b { font-size: 26px; line-height: 1.1; }
.tpl-count span { font-size: 12px; color: var(--muted); }
.tpl-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tpl-tools .tpl-search { flex: 1 1 260px; max-width: 420px; }
.tpl-tools .filters { margin: 0; }
.tpl-body { display: grid; gap: 12px; padding-top: 4px; }
.tpl-vars-box { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.tpl-vars-box .tpl-vars { margin-top: 6px; gap: 6px; }
.tpl-var { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 4px 8px;
  font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; }
.tpl-var:hover { border-color: var(--primary); color: var(--text); }
.tpl-var code { color: var(--primary); background: none; padding: 0; }
.tpl-var span { color: var(--muted); }
.tpl-last { padding: 8px 12px; border-left: 3px solid var(--border); background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-radius: 0 8px 8px 0; font-size: 13px; }
.tpl-chans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tpl-chan > span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tpl-card[hidden] { display: none; }
@media (max-width: 900px) { .tpl-chans { grid-template-columns: minmax(0, 1fr); } .tpl-intro { flex-direction: column; align-items: flex-start; } }

/* ---- v1.9.70: alert templates ---- */
.tpl-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; margin: 4px 0 14px; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary, #2563eb) 9%, var(--surface)), var(--surface)); border: 1px solid var(--border); }
.tpl-intro p { margin: 4px 0 0; max-width: 80ch; }
.tpl-h { margin: 0; font-size: 18px; }
.tpl-count { display: flex; flex-direction: column; align-items: center; min-width: 90px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.tpl-count b { font-size: 26px; line-height: 1.1; }
.tpl-count span { font-size: 12px; color: var(--muted); }
.tpl-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tpl-tools .tpl-search { flex: 1 1 260px; max-width: 420px; }
.tpl-tools .filters { margin: 0; }
.tpl-body { display: grid; gap: 12px; padding-top: 4px; }
.tpl-vars-box { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.tpl-vars-box .tpl-vars { margin-top: 6px; gap: 6px; }
.tpl-var { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 4px 8px;
  font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; }
.tpl-var:hover { border-color: var(--primary); color: var(--text); }
.tpl-var code { color: var(--primary); background: none; padding: 0; }
.tpl-var span { color: var(--muted); }
.tpl-last { padding: 8px 12px; border-left: 3px solid var(--border); background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-radius: 0 8px 8px 0; font-size: 13px; }
.tpl-chans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tpl-chan > span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tpl-card[hidden] { display: none; }
@media (max-width: 900px) { .tpl-chans { grid-template-columns: minmax(0, 1fr); } .tpl-intro { flex-direction: column; align-items: flex-start; } }

/* ---- v1.9.70: fiber map ---- */
.fcore-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(15, 23, 42, .35); vertical-align: -1px; background: #94a3b8; }
.fcore-dot.fcore-clear { background: repeating-linear-gradient(45deg, #fff 0 2px, #e2e8f0 2px 4px); }
.fcore-row { display: inline-flex; flex-wrap: wrap; gap: 3px; max-width: 220px; }
.fcore { position: relative; display: inline-flex; padding: 2px; border-radius: 50%; }
.fcore-used { box-shadow: 0 0 0 2px var(--primary, #2563eb); }
.fcore-reserved { box-shadow: 0 0 0 2px #f59e0b; }
.fcore-broken { box-shadow: 0 0 0 2px var(--down, #dc2626); }
.fcore-free { opacity: .65; }
.fcore-table tr.fcore-broken td:first-child { color: var(--down); }
.fcore-table input, .fcore-table select { min-width: 110px; }
.fiber-draw-wrap { overflow-x: auto; padding: 8px 0; }
.fiber-draw { display: block; min-width: 100%; }
.fiber-draw .fe path { fill: none; stroke: var(--primary, #2563eb); stroke-width: 2.5; opacity: .75; }
.fiber-draw .fe text { font-size: 11.5px; fill: var(--text); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.fiber-draw .fe text.fe-sub { font-size: 10.5px; font-weight: 500; fill: var(--muted); }
.fiber-draw .fe-fault path { stroke: var(--down, #dc2626); stroke-dasharray: 6 4; opacity: 1; }
.fiber-draw a:hover .fe path { stroke-width: 4; opacity: 1; }
.fiber-draw .fn circle { fill: var(--surface); stroke: #64748b; stroke-width: 2.5; }
.fiber-draw .fn-office circle, .fiber-draw .fn-pop circle { fill: var(--primary, #2563eb); stroke: var(--primary, #2563eb); }
.fiber-draw .fn-joint circle, .fiber-draw .fn-splitter circle { stroke: #f59e0b; }
.fiber-draw .fn-olt circle { stroke: #10b981; fill: color-mix(in srgb, #10b981 25%, var(--surface)); }
.fiber-draw .fn text { font-size: 11.5px; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.fiber-draw a:hover .fn circle { stroke-width: 4; }
.fiber-legend { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.fiber-legend .fk { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #64748b; display: inline-block; margin-left: 6px; }
.fiber-legend .fk-office { background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); }
.fiber-legend .fk-joint { border-color: #f59e0b; }
.fiber-legend .fk-olt { border-color: #10b981; }
.fiber-legend .fl { width: 18px; border-top: 2px dashed var(--down, #dc2626); display: inline-block; margin-left: 6px; }
.fiber-empty ol { line-height: 1.7; max-width: 80ch; }
.otdr-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.otdr-form .field { margin: 0; min-width: 180px; }
.otdr-result { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.otdr-result.ok { background: color-mix(in srgb, var(--primary, #2563eb) 9%, transparent); color: var(--text); }
.otdr-result.bad { background: var(--down-50); color: var(--down); }
.fiber-route { display: flex; flex-direction: column; padding: 8px 18px 12px; }
.fr-step { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 6px 0 10px 4px; }
.fr-step::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: -6px; width: 2px; background: color-mix(in srgb, var(--primary, #2563eb) 45%, transparent); }
.fr-step:last-child::before { display: none; }
.fr-dot { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 3px solid #64748b; background: var(--surface); position: relative; z-index: 1; }
.fr-end .fr-dot { border-color: var(--primary, #2563eb); background: var(--primary, #2563eb); }
.fr-joint .fr-dot, .fr-splitter .fr-dot { border-color: #f59e0b; }
.fr-body { flex: 1; min-width: 0; }
.fr-new { display: flex; gap: 6px; }
.fr-new input { flex: 1; }
.fr-add, .fe-add { border-top: 1px solid var(--border); }
.fr-new select { width: auto; flex: none; }
.fr-new input { min-width: 0; }
.bl-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.bl-add .field { margin: 0; }
.bl-add input { min-width: 200px; }
.bl-badge { text-decoration: none; margin-left: 4px; }
.btn.btn-bl-on { color: #fff; background: var(--down, #dc2626); border-color: var(--down, #dc2626); }
/* v1.9.72: the POP tile's badge is a button (opens the POP's alerts): a raised key with a solid colour, no filters */
.pop-tile a.pop-tile-pill { --pb: #d97706; --pb-hi: #f59e0b; --pb-edge: #92400e; --pb-text: #fff;
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px 3px 10px; border-radius: 7px; border: 1px solid var(--pb-edge);
  color: var(--pb-text); background: linear-gradient(180deg, var(--pb-hi), var(--pb)); text-shadow: 0 1px 0 rgba(0,0,0,.18);
  box-shadow: 0 2px 0 var(--pb-edge), 0 3px 5px rgba(15, 23, 42, .16); transform: translateY(-2px);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease; will-change: transform; }
.pop-tile a.pop-tile-pill::after { content: ""; width: 5px; height: 5px; border-right: 2px solid currentColor; border-top: 2px solid currentColor;
  transform: rotate(45deg); margin-left: 2px; transition: transform .12s ease; }
.pop-bad a.pop-tile-pill { --pb: #dc2626; --pb-hi: #ef4444; --pb-edge: #991b1b; }
.pop-tile a.pop-tile-pill:hover, .pop-tile a.pop-tile-pill:focus-visible { background: linear-gradient(180deg, var(--pb-hi), var(--pb-hi));
  box-shadow: 0 3px 0 var(--pb-edge), 0 6px 10px rgba(15, 23, 42, .2); transform: translateY(-3px); outline: none; }
.pop-tile a.pop-tile-pill:hover::after { transform: translateX(2px) rotate(45deg); }
.pop-tile a.pop-tile-pill:active { transform: translateY(0); box-shadow: 0 0 0 var(--pb-edge), inset 0 2px 3px rgba(0,0,0,.25); transition-duration: .04s; }
.pop-tile a.pop-tile-pill:focus-visible { box-shadow: 0 3px 0 var(--pb-edge), 0 0 0 3px color-mix(in srgb, var(--pb) 35%, transparent); }
[data-theme="dark"] .pop-tile a.pop-tile-pill { color: var(--pb-text); }
/* the tile itself does not jump while the pointer is on its badge */
.pop-tile.pop-click:has(a.pop-tile-pill:hover) { transform: none; }
@media (prefers-reduced-motion: reduce) { .pop-tile a.pop-tile-pill, .pop-tile a.pop-tile-pill::after { transition: none; } }
/* v1.9.72: black list read progress */
.bl-read { min-width: min(420px, 80vw); }
.bl-read-bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--border) 70%, transparent); overflow: hidden; margin: 10px 0 6px; }
.bl-read-bar span { display: block; height: 100%; width: 4%; border-radius: inherit; background: linear-gradient(90deg, var(--primary, #2563eb), #60a5fa); transition: width .4s ease; }
.bl-read-bar.bad span { background: var(--down, #dc2626); }
.btn.btn-bl-on.btn-unblock { gap: 4px; font-weight: 600; padding-inline: 8px; }
.btn.btn-bl-on:hover { background: #b91c1c; border-color: #b91c1c; }
.netmap.editing .site-zone.movable { cursor: move; pointer-events: all; }
.netmap.editing .site-zone.movable:hover { fill: rgba(99, 102, 241, .11); stroke: rgba(99, 102, 241, .6); stroke-dasharray: none; }
.netmap.editing .site-zone-name.movable { cursor: move; }
.links-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding-top: 0; }
.links-filter .lf-field { margin: 0; min-width: 130px; }
.links-filter .lf-field select { min-width: 130px; max-width: 220px; }
.alert-link { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; font-weight: 600; }
.alert-link:hover { color: var(--primary, #2563eb); text-decoration-style: solid; }
/* v1.9.73: a smaller POP badge, and the POP name may take two lines instead of being cut */
.pop-tile a.pop-tile-pill { font-size: 9px; letter-spacing: .04em; padding: 1px 5px 1px 6px; border-radius: 5px; gap: 2px;
  box-shadow: 0 1.5px 0 var(--pb-edge), 0 2px 4px rgba(15, 23, 42, .14); transform: translateY(-1px); }
.pop-tile a.pop-tile-pill::after { width: 4px; height: 4px; border-width: 1.5px; margin-left: 1px; }
.pop-tile a.pop-tile-pill:hover, .pop-tile a.pop-tile-pill:focus-visible { box-shadow: 0 2px 0 var(--pb-edge), 0 4px 7px rgba(15, 23, 42, .18); transform: translateY(-2px); }
.pop-tile a.pop-tile-pill:active { transform: translateY(0); box-shadow: 0 0 0 var(--pb-edge), inset 0 1px 2px rgba(0,0,0,.25); }
.pop-tile-head { align-items: flex-start; }
.pop-tile-head .pop-tile-name { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; word-break: break-word; }
.pop-tile-head .pop-tile-pill { margin-top: 1px; }
/* v1.9.73: Unblock is a green shield icon (no text) */
.btn.btn-icon.btn-unblock-ico { color: #fff; background: #16a34a; border-color: #15803d; }
.btn.btn-icon.btn-unblock-ico:hover { background: #15803d; border-color: #166534; }
.text-warn { color: #b45309; }
[data-theme="dark"] .text-warn { color: #fbbf24; }
.cap-bar-name .cap-bar-id { display: block; font-weight: 400; margin-top: 1px; }
.legend-note { font-weight: 400; margin-left: 18px; }
.field-wrap:not([hidden]) { display: contents; }

/* v1.9.89: Telegram messages waiting for a retry (Settings) */
.tg-queue { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--warn-50); border-radius: 10px; background: var(--surface-2, transparent); }
.tg-queue p { margin: 0 0 8px; }

/* v1.9.89: alert templates — list with an Edit button, edit window with Default / Custom per channel */
.tpl-table td { vertical-align: middle; }
.tpl-table .tpl-th-ch { text-align: center; width: 110px; }
.tpl-dialog { width: min(820px, calc(100vw - 32px)); }
.tpl-dialog .tpl-vars-box { margin: 0 0 12px; }
.tpl-chan { margin: 14px 0 0; }
.tpl-chan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 6px; }
.tpl-chan-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tpl-mode { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.tpl-mode label { margin: 0; cursor: pointer; }
.tpl-mode input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-mode span { display: block; padding: 4px 14px; font-size: 12.5px; color: var(--muted); }
.tpl-mode input:checked + span { background: var(--primary); color: #fff; }
.tpl-mode input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.tpl-text { width: 100%; white-space: pre-wrap; line-height: 1.5; }
.tpl-text.tpl-ro { background: var(--surface-2, #f6f7f9); color: var(--muted); cursor: default; }
.tpl-chan-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; }

/* v1.9.89: graphs — reset button beside ‹ ›, and the part chosen with the mouse */
.range-shift .rs-reset { display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.range-shift .rs-reset svg { width: 15px; height: 15px; }
.uplot .u-select { background: rgba(37, 99, 235, .12); border-left: 1px solid rgba(37, 99, 235, .5); border-right: 1px solid rgba(37, 99, 235, .5); }
.uplot .u-over { cursor: crosshair; }

/* v1.9.89: live traffic — filled line (SSH / gNMI) and the "axis from" note */
.live-area-down { fill: #10b981; opacity: .16; stroke: none; }
.live-line-down { fill: none; stroke: #10b981; stroke-width: 2; stroke-linejoin: round; }
.live-line-up { fill: none; stroke: #2563eb; stroke-width: 2; stroke-linejoin: round; }
.live-from { font-size: 10.5px; opacity: .8; }

/* v1.9.89: port activity — the green LED blinks while data flows, faster with more traffic (like a switch) */
@keyframes fp-blink { 0%, 100% { background: #22c55e; box-shadow: 0 0 6px #22c55e; } 45% { background: #14532d; box-shadow: none; } 55% { background: #14532d; box-shadow: none; } }
.fp-up.fp-act .fp-led { animation: fp-blink 1.6s steps(1, end) infinite; }
.fp-up.fp-act-2 .fp-led { animation-duration: 1s; }
.fp-up.fp-act-3 .fp-led { animation-duration: .6s; }
.fp-up.fp-act-4 .fp-led { animation-duration: .32s; }
.fp-up.fp-act-5 .fp-led { animation-duration: .16s; }
/* ports next to each other do not blink in step */
.fp-port.fp-act:nth-child(3n+1) .fp-led { animation-delay: -.11s; }
.fp-port.fp-act:nth-child(3n+2) .fp-led { animation-delay: -.27s; }
@media (prefers-reduced-motion: reduce) { .fp-up.fp-act .fp-led { animation: none; } }

.optics-kpis { margin: 0 0 16px; }

/* v1.9.89: DNS analysis */
.dns-kpis { margin: 0 0 8px; }
.dns-legend { margin: 0 0 14px; }
.dns-legend .badge { margin: 0 2px; }
.dns-chip { margin: 1px 4px 1px 0; }
.dns-chip small { opacity: .8; font-weight: 500; }
.dns-bar { display: inline-block; width: 90px; height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; vertical-align: middle; }
.dns-bar-fill { display: block; height: 100%; }
.dns-bar-fill.dns-trusted { background: var(--up); } .dns-bar-fill.dns-suspicious { background: var(--down); } .dns-bar-fill.dns-unknown { background: var(--warn); }
.dns-bar-fill.w0 { width: 0%; }
.dns-bar-fill.w5 { width: 5%; }
.dns-bar-fill.w10 { width: 10%; }
.dns-bar-fill.w15 { width: 15%; }
.dns-bar-fill.w20 { width: 20%; }
.dns-bar-fill.w25 { width: 25%; }
.dns-bar-fill.w30 { width: 30%; }
.dns-bar-fill.w35 { width: 35%; }
.dns-bar-fill.w40 { width: 40%; }
.dns-bar-fill.w45 { width: 45%; }
.dns-bar-fill.w50 { width: 50%; }
.dns-bar-fill.w55 { width: 55%; }
.dns-bar-fill.w60 { width: 60%; }
.dns-bar-fill.w65 { width: 65%; }
.dns-bar-fill.w70 { width: 70%; }
.dns-bar-fill.w75 { width: 75%; }
.dns-bar-fill.w80 { width: 80%; }
.dns-bar-fill.w85 { width: 85%; }
.dns-bar-fill.w90 { width: 90%; }
.dns-bar-fill.w95 { width: 95%; }
.dns-bar-fill.w100 { width: 100%; }

.dns-user-list { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 6px 0; }
.dns-users-row td { background: var(--surface-2); }
.about-data { padding: 12px 16px; margin-top: 16px; }
.about-data ul { margin: 8px 0 0 18px; }
.dns-reflect { margin-bottom: 12px; }
.dns-line { margin: 0 0 14px; }
.fast-state { margin: -6px 0 12px; display: flex; align-items: center; gap: 6px; }
/* v1.9.90: fiber map tab, cable "carries", fixed-at, OTDR method */
.fiber-geo .fe polyline { fill: none; stroke: var(--primary, #2563eb); stroke-width: 2.5; opacity: .75; stroke-linejoin: round; }
.fiber-geo .fe-fault polyline { stroke: var(--down, #dc2626); stroke-dasharray: 6 4; opacity: 1; }
.fiber-geo a:hover .fe polyline { stroke-width: 4; opacity: 1; }
.fiber-tabs { margin-bottom: 12px; }
.fiber-carried li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.fe-fixed { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 10px; }
.fe-fixed .field { margin: 0; max-width: 240px; }
.otdr-method { margin: 4px 0 0; }
.fiber-settings form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
/* v1.9.91: MAC vendor under every MAC */
.mac { display: inline-flex; flex-direction: column; line-height: 1.25; vertical-align: top; }
.mac-vendor { font-size: 12px; font-weight: 600; color: var(--muted); font-family: var(--font-sans, inherit); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
/* v1.9.94: PPPoE info next to Billing (Maestro) on the customer page */
.cust-top-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: stretch; margin-bottom: 16px; }
.cust-top-cards > .card { margin-bottom: 0; }
.pppoe-info-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 12px; }
.pppoe-info-card dt { color: var(--muted); }
.pppoe-info-card dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pppoe-info-card .pppoe-tools { display: inline-flex; gap: 4px; }
.addr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 16px 10px; }
.addr-tools input[type=search] { min-width: 240px; }
.addr-tools .addr-dl { margin-left: auto; display: inline-flex; gap: 6px; }
.th-sort a { color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort a:hover { text-decoration: underline; }
.th-sorted a { color: var(--primary, #2563eb); }

/* v1.9.95: sortable headers show an arrow before the first click */
.th-sort .sort-ind { margin-left: 4px; font-size: 0.8em; opacity: 0.45; }
.th-sorted .sort-ind { opacity: 1; }
.th-reset a { cursor: pointer; }
#visits .card-head { flex-wrap: wrap; gap: 8px; }
/* v1.9.95: the PPPoE info card is as tall as the Billing card beside it; Disconnect at its foot */
.cust-top-cards > .pppoe-info-card { display: flex; flex-direction: column; }
.cust-top-cards > .pppoe-info-card > form:last-child, .cust-top-cards > .pppoe-info-card > .pppoe-foot { margin-top: auto; }
/* v1.9.95: device list: firmware narrow (long versions wrap), hardware on one line */
#devices-table td.d-fw { white-space: nowrap; }
#devices-table td.d-hw { white-space: nowrap; max-width: 21rem; overflow: hidden; text-overflow: ellipsis; }
.links-unresolved { margin: 0 18px 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* v1.9.95: server control */
.sysctl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.sysctl-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.sysctl-box h3 { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 15px; }
.sysctl-box .btn { margin-top: auto; align-self: flex-start; }
.sysctl-pw { max-width: 320px; }
.sysctl-pending { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.unres-list { margin: 4px 0 0; padding-left: 18px; width: 100%; } .unres-list li { margin: 2px 0; }
/* v1.9.97: latency addresses: filter on one line with its buttons; company / location columns */
.addr-tools input[type=search] { flex: 1 1 260px; max-width: 440px; width: auto; }
.addr-tools .btn { flex: 0 0 auto; }
#addresses td.geo-co { font-weight: 600; }
.geo-credit { margin: 8px 0 12px; }
.geo-line { margin-top: 2px; }
/* v1.9.97: map full screen on a phone: only the map */
.map-card.map-pseudo-full { z-index: 1000; }
.map-card.map-bare .map-ctrl, .map-card.map-bare .map-info, .map-card.map-bare .map-legend-box, .map-card.map-bare .map-edit-bar { display: none !important; }
.map-card.map-bare .netmap { height: 100vh; height: 100dvh; min-height: 0; border-radius: 0; }
.netmap { -webkit-tap-highlight-color: transparent; }
/* v1.9.98: the map's filters over the map in full screen (one click / tap shows / hides them) */
.map-card .map-toolbar.map-toolbar-float { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 5; margin: 0;
  background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  max-height: 60%; overflow: auto; }
.map-card.map-bare.filters-on .map-ctrl { display: flex !important; }
.map-card.filters-on .map-ctrl { top: 120px; }

/* =====================================================================================================
   v2.0.5 — tidy tables, company bars, read-only graph trees, clearer settings tabs, small polish
   ===================================================================================================== */
/* every IP: the external icon's place is kept when there is no web link, so IPs and ping buttons line up */
.ip-ext-slot { display: inline-block; width: 12px; }
.ip-nolink { white-space: nowrap; }
/* device list: the management IP column on the right side, the ping button at the far right */
@media (min-width: 761px) {
  #devices-table th.d-ip-h, #devices-table td.d-ip { text-align: right; }
  #devices-table td.d-ip .ip-ping { display: flex; justify-content: flex-end; }
  #devices-table td.d-ip .ip2-line { justify-content: flex-end; }
  #devices-table td.d-ip .ping-btn { order: 2; }
}
/* OLT list: POP in its own column, the up/down badge beside the IP, every cell from the top */
#olt-list .o-ip { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
#olt-list .o-ip .badge { margin-left: 2px; }
@media (min-width: 761px) {
  #olt-list td { vertical-align: top; padding-top: 11px; padding-bottom: 11px; }
  #olt-list th.num, #olt-list td.num { text-align: right; }
  #olt-list td.o-pop { white-space: nowrap; }
  #olt-list td .down-info { margin-top: 6px; }
}
@media (max-width: 760px) { #olt-list td.o-pop::before { content: "POP"; display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); } }
/* Bandwidth by Percentage: one bar per company */
.co-shares { display: grid; gap: 14px; margin: 6px 0 14px; }
.co-share-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; font-size: 13.5px; }
.co-share-head .mono { font-weight: 600; }
.cap-share .co-share .share-bar { height: 30px; margin: 0; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--border); }
/* by NTTN link / provider: the bill always on its own line under the company */
.cap-bar-co { display: flex; flex-direction: column; gap: 1px; line-height: 1.35; }
.cap-bar-co .cap-bill { color: var(--text-2); font-weight: 600; font-family: var(--mono); font-size: 12px; }
/* graph trees: read-only until Edit */
.tree-editbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 8px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px dashed var(--border); }
.tree-editbar .tree-editbar-btns { margin-left: auto; display: inline-flex; gap: 6px; }
.tree-editbar .tree-ed-note, .tree-editbar .tree-ed-only { display: none; }
.tree-editbar.tree-editing { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 45%, transparent); border-style: solid; }
.tree-editbar.tree-editing .tree-ro-note, .tree-editbar.tree-editing .tree-ro-only { display: none; }
.tree-editbar.tree-editing .tree-ed-note { display: inline; color: var(--primary); }
.tree-editbar.tree-editing .tree-ed-only { display: inline-flex; }
.tree-editbar .icon { vertical-align: -2px; }
[data-tree-order] .tree-ed-only { display: none !important; }
[data-tree-order].tree-editing .tree-ed-only { display: inline-flex !important; }
[data-tree-order] .chart-box h3.drag-handle { cursor: default; }
[data-tree-order].tree-editing .chart-box h3.drag-handle { cursor: grab; }
[data-tree-order].tree-editing .chart-box { outline: 1px dashed color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: -1px; }
.chart-box.tree-removed { opacity: .4; filter: grayscale(1); }
.chart-box.tree-removed h3 a { text-decoration: line-through; }
.tree-nav { border-radius: var(--radius); }
.tree-nav-head strong { font-size: 14.5px; }
.tree-link.active { box-shadow: inset 3px 0 0 var(--primary); }
.tree-main .chart-box { transition: box-shadow .15s, transform .15s; }
.tree-main .chart-box:hover { box-shadow: 0 6px 18px -8px rgba(15, 23, 42, .25); }
/* settings: the open tab is a filled pill; on a phone every tab is visible (wraps, no side scroller) */
.settings-tabs { gap: 6px; border-bottom: 0; padding: 6px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 18px; }
.settings-tabs a { border: 1px solid transparent; border-radius: 9px; padding: 8px 12px; margin: 0; }
.settings-tabs a:hover { background: var(--surface-2); border-color: var(--border); }
.settings-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary) 70%, transparent); }
.settings-tabs a.active .icon { color: #fff; }
@media (max-width: 760px) {
  .settings-tabs { flex-wrap: wrap; overflow: visible; }
  .settings-tabs a { flex: 1 1 calc(50% - 6px); justify-content: flex-start; font-size: 12.5px; padding: 8px 10px; white-space: normal; }
}
/* integrations on a phone: nothing wider than the screen */
.int-page { min-width: 0; max-width: 100%; }
.int-page .card { min-width: 0; overflow: hidden; }
.int-page p .mono, .int-page .small .mono { overflow-wrap: anywhere; word-break: break-word; }
.int-page pre.cmd { max-width: 100%; }
.int-page input, .int-page select { max-width: 100%; }
@media (max-width: 760px) { .int-page .inline-form { display: flex; flex-direction: column; align-items: stretch; } }
/* SFP optics: why a port has no history */
.optics-nohist { opacity: .75; }
.optics-nohist-note { display: block; margin-top: 3px; white-space: nowrap; }
/* general polish */
.table thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
.table td.num, .table th.num { font-variant-numeric: tabular-nums; }
.card { transition: box-shadow .15s; }
.badge { letter-spacing: .01em; }
.kpi-link:hover { transform: translateY(-1px); }
.btn:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }

/* =====================================================================================================
   v2.0.6 — aligned lists, equal bars, full-screen tree graphs, a more modern finish on every page
   ===================================================================================================== */
/* OLT list: OLT and POP on the left, every other column centred; up/down badge and ping at the right of the OLT cell */
@media (min-width: 761px) {
  #olt-list th, #olt-list td { text-align: center; }
  #olt-list th.o-name, #olt-list td.o-name, #olt-list th.o-pop, #olt-list td.o-pop { text-align: left; }
  #olt-list th.num, #olt-list td.num { text-align: center; }
  #olt-list td { vertical-align: middle; }
  #olt-list td.o-name { min-width: 250px; }
}
#olt-list .o-ip { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
#olt-list .o-right { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
#olt-list .o-right .badge { margin: 0; }

/* SFP optics: from "SFP vendor" to the end every column centred */
/* (v2.0.7: the list puts a # column first, so the position counts one more when it is there) */
#optics-table tr:has(> .sn) > :nth-child(n+7), #optics-table tr:not(:has(> .sn)) > :nth-child(n+6) { text-align: center; }
@media (max-width: 760px) { #optics-table tr > td { text-align: left !important; } }

/* By service / NTTN provider / NTTN link: one line per name, every bar starts at the same place and is as long */
.cap-bars { display: grid; grid-template-columns: max-content minmax(220px, 1fr) max-content; column-gap: 18px; row-gap: 4px; }
.cap-bars > .cap-bar-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; gap: 4px 18px; padding: 7px 10px; }
.cap-bar-name { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.cap-bar-name .cap-bar-cid { font-weight: 400; }
.cap-bars .util { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; }
.cap-bars .util .bar { width: 100%; height: 8px; flex: none; }
.cap-bars .util > .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-bar-row > .cap-bar-co { text-align: right; align-items: flex-end; white-space: nowrap; }
.cap-bar-note { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 1px; padding-left: 20px; line-height: 1.4; }
.co-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; }
@media (max-width: 760px) {
  .cap-bars { grid-template-columns: minmax(0, 1fr); }
  .cap-bars > .cap-bar-row { grid-template-columns: minmax(0, 1fr); }
  .cap-bar-name { white-space: normal; }
  .cap-bar-row > .cap-bar-co { text-align: left; align-items: flex-start; }
  .cap-bar-note { padding-left: 0; }
}

/* Graph trees: icon buttons, one graph full screen with previous / next */
.chart-tools .btn-icon { width: 28px; height: 28px; padding: 0; color: var(--muted); border-color: transparent; background: transparent; }
.chart-tools .btn-icon:hover { color: var(--primary); background: var(--primary-50); border-color: var(--border); }
.chart-tools .tree-rm-btn:hover { color: var(--down); background: var(--down-50); }
.chart-tools .tree-rm-btn.is-undo { color: var(--up); background: var(--up-50); }
[data-tree-order].tree-editing .tree-fs-btn { display: none; }
.chart-box.chart-full { position: fixed; inset: 0; z-index: 1200; margin: 0; border-radius: 0; padding: 22px 28px 76px; overflow: auto; background: var(--surface); }
.chart-box.chart-full h3 { font-size: 17px; }
.chart-box.chart-full .tree-fs-btn { display: none; }
body.has-chart-full { overflow: hidden; }
.chart-full-nav { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1210; display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.chart-full-nav .btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
.chart-full-nav .chart-full-close { font-size: 20px; margin-left: 4px; }
.chart-full-count { min-width: 56px; text-align: center; font: 600 13px var(--mono); color: var(--text-2); }
.chart-full-nav .chart-full-prev, .chart-full-nav .chart-full-next { background: var(--primary); color: #fff; border-color: var(--primary); }
.chart-full-nav .chart-full-prev:hover, .chart-full-nav .chart-full-next:hover { background: var(--primary-600); }

/* ---- modern finish, every page ---- */
.card { border-radius: 14px; transition: box-shadow .18s ease, border-color .18s ease; }
.card:hover { box-shadow: var(--shadow-md); }
.card.flush > .card-head, .card.flush > .pad-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.table th { background: var(--surface-2); border-bottom: 1px solid var(--border-strong); }
.table :where(tbody tr:nth-child(even)) > td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table tbody tr:hover > td { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.table tr.row-down > td { background: color-mix(in srgb, var(--down-50) 80%, transparent); }
.table tr.row-down > td:first-child { box-shadow: inset 3px 0 0 var(--down); }
.btn { border-radius: 9px; font-weight: 550; }
.btn:hover { border-color: var(--border-strong); }
.btn-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 88%, #fff), var(--primary)); border-color: var(--primary-600); }
.btn-primary:hover { background: var(--primary-600); }
.badge { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 16%, transparent); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); outline: none; }
.kpi { border-radius: 14px; transition: transform .12s, box-shadow .15s; }
.kpi:hover { box-shadow: var(--shadow-md); }
.kpi .kpi-val { font-weight: 700; }
.kpi-ico { border-radius: 10px; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent); }
.page-tabs:not(.settings-tabs) a { border-radius: 8px 8px 0 0; }
.page-tabs:not(.settings-tabs) a:hover { background: var(--surface-2); }
.page-tabs:not(.settings-tabs) a.active { font-weight: 650; }
.util .bar { background: var(--surface-3); }
.share-seg { text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }

/* =====================================================================================================
   v2.0.7 — OLT name on the left, NTTN numbers beside the bar, icon-only optics history, tighter optics table
   ===================================================================================================== */
#olt-list td.o-name > a.strong { display: inline-block; }
/* bars: name | bar | now · highest | company + bill — every bar the same length, the numbers right of it */
@media (min-width: 761px) {
  .cap-bars { grid-template-columns: max-content minmax(200px, 1fr) max-content max-content; }
  .cap-bars .util { display: contents; }
  .cap-bars .util .bar { align-self: center; }
  .cap-bars .util > .small { text-align: right; white-space: nowrap; overflow: visible; }
}
.optics-hist.btn-icon { width: 30px; height: 30px; padding: 0; }
.optics-hist.optics-nohist { color: var(--muted); }
#optics-table th, #optics-table td { padding-left: 7px; padding-right: 7px; }
#optics-table th:first-child, #optics-table td:first-child { padding-left: 14px; }

/* =====================================================================================================
   v2.0.8 — alert templates: every channel editable, the built-in text in full, a sample with the last alert
   ===================================================================================================== */
.tpl-chan-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tpl-chan-head .tpl-state { margin-left: auto; }
.tpl-chan-head .tpl-reset { padding: 3px 10px; }
.tpl-text { width: 100%; resize: vertical; line-height: 1.5; font-size: 12.5px; white-space: pre; overflow-x: auto; }
.tpl-vars .tpl-var-own { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: var(--primary-50); }
.tpl-preview { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--border); }
.tpl-preview pre { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; font: 12.5px/1.5 var(--mono); color: var(--text); }

/* =====================================================================================================
   v2.0.11 — flow period box, graph full screen with its time range, map Clear
   ===================================================================================================== */
/* Flow analysis: From → To as one solid box (the two date inputs were thin and loose) */
.flow-period { display: inline-flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; padding: 6px 6px 6px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.flow-period .fp-field { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.flow-period .fp-field > span { font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-left: 2px; }
.flow-period .fp-field input { height: 38px; min-width: 205px; padding: 6px 10px; font-size: 14px; font-weight: 550; font-variant-numeric: tabular-nums;
  border-width: 1.5px; border-radius: 9px; background: var(--surface-2); }
.flow-period .fp-field input:focus { background: var(--surface); }
.flow-period .fp-sep { align-self: center; margin-top: 16px; color: var(--muted); font-weight: 600; }
.flow-period .btn { height: 38px; padding: 0 16px; border-radius: 9px; }
@media (max-width: 760px) {
  .flow-period { display: flex; width: 100%; }
  .flow-period .fp-field { flex: 1 1 140px; }
  .flow-period .fp-field input { min-width: 0; width: 100%; }
  .flow-period .fp-sep { display: none; }
  .flow-period .btn { flex: 1 1 100%; }
}

/* Graph trees: a graph full screen keeps the time range card at the top middle */
body.has-chart-full .time-dock { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); top: 12px; left: 50%; z-index: 1220; }
body.has-chart-full .chart-box.chart-full { padding-top: 78px; }
@media (max-width: 900px) { body.has-chart-full .chart-box.chart-full { padding-top: 118px; } }

/* Network map: Clear beside the filters */
#map-clear { white-space: nowrap; }
