/* PHOBOS console — visual language: IBM Carbon Design System (light theme g10 content, g100 UI shell).
   Tokens from carbondesignsystem.com: gray-10 #f4f4f4, gray-20 #e0e0e0, gray-30 #c6c6c6, gray-50 #8d8d8d,
   gray-70 #525252, gray-90 #262626, gray-100 #161616, blue-60 #0f62fe, blue-70 #0043ce, green-50 #24a148,
   yellow-30 #f1c21b, red-60 #da1e28, purple-60 #8a3ffc, teal-50 #009d9a, magenta-60 #d02670. */
:root {
  --ui-bg: #f4f4f4; --layer: #ffffff; --layer-hover: #e8e8e8; --field: #f4f4f4; --border-subtle: #e0e0e0; --border-strong: #8d8d8d;
  --text: #161616; --text-secondary: #525252; --text-helper: #6f6f6f; --text-placeholder: #a8a8a8; --text-on-color: #ffffff;
  --interactive: #0f62fe; --interactive-hover: #0353e9; --interactive-active: #002d9c; --link: #0f62fe;
  --support-success: #24a148; --support-warning: #f1c21b; --support-error: #da1e28; --support-info: #0043ce;
  --shell-bg: #161616; --shell-text: #c6c6c6; --shell-hover: #353535; --shell-active: #393939; --shell-border: #393939;
  --viz-1: #0f62fe; --viz-2: #8a3ffc; --viz-3: #009d9a; --viz-4: #d02670; --viz-5: #24a148; --viz-6: #f1c21b;
  --font: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif; --mono: "IBM Plex Mono", Menlo, Consolas, monospace;
  --sidebar: 256px; --topbar: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ui-bg); color: var(--text); font: 14px/1.43 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); }
.app { display: flex; height: 100vh; overflow: hidden; }

/* ---------- UI shell: side nav ---------- */
.sidebar { width: var(--sidebar); flex: 0 0 auto; background: var(--shell-bg); color: var(--shell-text); display: flex; flex-direction: column; transition: margin .15s; }
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar)); }
.logo { display: flex; align-items: center; gap: 12px; height: var(--topbar); padding: 0 16px; border-bottom: 1px solid var(--shell-border); }
.logo .mark { width: 24px; height: 24px; background: var(--interactive); color: #fff; font-weight: 600; font-size: 14px; display: grid; place-items: center; font-family: var(--mono); }
.logo .name { color: #f4f4f4; font-weight: 600; font-size: 12.5px; letter-spacing: .16px; white-space: nowrap; }
.logo .sub { color: var(--shell-text); font-size: 12px; }
.sidebar nav { padding: 8px 0; flex: 1; overflow: auto; }
.sidebar .group { color: #8d8d8d; font-size: 12px; letter-spacing: .32px; padding: 16px 16px 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 16px; color: var(--shell-text); text-decoration: none; cursor: pointer; border-left: 3px solid transparent; font-size: 14px; }
.sidebar nav a:hover { background: var(--shell-hover); color: #f4f4f4; }
.sidebar nav a.active { background: var(--shell-active); color: #f4f4f4; border-left-color: var(--interactive); }
/* motion.js: one marker slides to the active item (replaces the per-item left border) */
.sidebar nav { position: relative; }
.sidebar nav .nav-marker { position: absolute; left: 0; top: 0; width: 3px; background: var(--interactive); pointer-events: none; will-change: transform; }
.sidebar nav.has-marker a.active { border-left-color: transparent; }
.sidebar nav .badge { margin-left: auto; background: #393939; color: #c6c6c6; padding: 0 6px; font-size: 12px; min-width: 18px; text-align: center; }
.ic { width: 16px; height: 16px; display: inline-block; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.ic-dash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h8v10H3zM13 3h8v6h-8zM13 11h8v10h-8zM3 15h8v6H3z'/%3E%3C/svg%3E"); }
.ic-topo { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='5' r='3'/%3E%3Ccircle cx='5' cy='19' r='3'/%3E%3Ccircle cx='19' cy='19' r='3'/%3E%3Cpath d='M11 8l-5 8h2l4-6.5L16 16h2z'/%3E%3C/svg%3E"); }
.ic-ue { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2h10v20H7zm2 2v14h6V4z'/%3E%3C/svg%3E"); }
.ic-cell { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 9h2v13h-2zM4 4l2 1a8 8 0 0 0 0 10l-2 1a10 10 0 0 1 0-12zm16 0a10 10 0 0 1 0 12l-2-1a8 8 0 0 0 0-10z'/%3E%3Ccircle cx='12' cy='10' r='2.5'/%3E%3C/svg%3E"); }
.ic-log { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16v2H4zm0 5h16v2H4zm0 5h10v2H4zm0 5h16v2H4z'/%3E%3C/svg%3E"); }
.ic-deploy { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l9 5v10l-9 5-9-5V7zm0 2.3L5 8v8l7 3.7 7-3.7V8z'/%3E%3C/svg%3E"); }
.ic-ho { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 8h12V4l5 5-5 5v-4H4zm16 8H8v4l-5-5 5-5v4h12z'/%3E%3C/svg%3E"); }
.ic-traffic { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17l5-6 4 4 4-7 5 5v6H3z'/%3E%3C/svg%3E"); }
.ic-fault { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2L1 21h22zm-1 7h2v6h-2zm0 7h2v2h-2z'/%3E%3C/svg%3E"); }
.ic-conf { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6h10v2H4zm12 0h4v2h-4zM4 11h4v2H4zm6 0h10v2H10zM4 16h12v2H4zm14 0h2v2h-2z'/%3E%3C/svg%3E"); }
.ic-res { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20h16v2H4zM5 10h3v8H5zm5-6h3v14h-3zm5 4h3v10h-3z'/%3E%3C/svg%3E"); }
.ic-jobs { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm-1 3h2v6l4 2-1 1.7-5-2.7z'/%3E%3C/svg%3E"); }
.ic-api { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5l-6 7 6 7 1.5-1.4L4.8 12l4.7-5.6zm8 0l-1.5 1.4L19.2 12l-4.7 5.6L16 19l6-7z'/%3E%3C/svg%3E"); }
.sidefoot { padding: 12px 16px; border-top: 1px solid var(--shell-border); color: #8d8d8d; font-size: 12px; line-height: 1.5; font-family: var(--mono); }

/* ---------- UI shell: header ---------- */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 16px; height: var(--topbar); background: var(--layer); border-bottom: 1px solid var(--border-subtle); }
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: 0; }
/* first load: an indeterminate bar under the header (Carbon loading pattern) and dimmed views until data is in */
.bootbar { height: 2px; background: transparent; position: relative; overflow: hidden; flex: 0 0 auto; }
body.booting .bootbar { background: var(--border-subtle); }
body.booting .bootbar::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--interactive); animation: bootbar 1.1s cubic-bezier(.2, 0, .38, .9) infinite; }
@keyframes bootbar { 0% { left: -40%; } 100% { left: 100%; } }
body.booting main .view.active { opacity: .45; pointer-events: none; transition: opacity .15s; }
@media (prefers-reduced-motion: reduce) { body.booting .bootbar::after { animation: none; left: 0; width: 100%; opacity: .5; } }
.iconbtn { background: none; border: none; color: var(--text-secondary); width: 32px; height: 32px; cursor: pointer; font-size: 16px; }
.iconbtn:hover { background: var(--layer-hover); }
.topstats { display: flex; margin-left: auto; }
.tstat { display: flex; flex-direction: column; line-height: 1.2; padding: 0 16px; border-left: 1px solid var(--border-subtle); }
.tstat .l { color: var(--text-helper); font-size: 12px; }
.tstat .v { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.stopbtn { height: 32px; padding: 0 14px; background: var(--support-error); color: #fff; border: none; font: 600 13px var(--font); letter-spacing: .5px; cursor: pointer; }
.stopbtn:hover { background: #ba1b23; }
.stopbtn.create { background: var(--interactive); }
.stopbtn.create:hover { background: var(--interactive-hover); }
.conn { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; padding-left: 16px; border-left: 1px solid var(--border-subtle); min-width: 90px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--support-success); } .dot.warn { background: var(--support-warning); } .dot.bad { background: var(--support-error); }
main { flex: 1; overflow: auto; padding: 24px 32px; }
.view { display: none; } .view.active { display: block; }

/* ---------- tiles / layout ---------- */
.card { background: var(--layer); border: 1px solid var(--border-subtle); margin-bottom: 16px; min-width: 0; display: flex; flex-direction: column; }
.card-h { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); min-height: 48px; }
.card-h h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.card-h .toolbar, .card-h .status, .card-h .link, .card-h .muted { margin-left: auto; }
.card-b { padding: 16px; }
.card-b.scroll, .scroll { max-height: 62vh; overflow: auto; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cols-side { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.span2 { grid-column: span 2; }
@media (max-width: 1250px) { .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .cols-2, .cols-3, .cols-side { grid-template-columns: 1fr; } .span2 { grid-column: auto; } .topstats { display: none; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); margin-bottom: 12px; }
.kpi { background: var(--layer); border: 1px solid var(--border-subtle); border-left: 3px solid var(--border-subtle); padding: 12px 16px; position: relative; overflow: hidden; min-height: 92px; }
.kpi .l { color: var(--text-secondary); font-size: 12px; }
.kpi .v { font-size: 28px; font-weight: 300; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.kpi .v .s { font-size: 14px; color: var(--text-helper); }
.kpi .s { color: var(--text-helper); font-size: 12px; }
.kpi.ok { border-left-color: var(--support-success); } .kpi.warn { border-left-color: var(--support-warning); } .kpi.bad { border-left-color: var(--support-error); } .kpi.info { border-left-color: var(--interactive); }
.kpi canvas { position: absolute; right: 12px; bottom: 10px; width: 72px; height: 28px; }
.kpis.small .kpi { min-height: 72px; } .kpis.small .kpi .v { font-size: 20px; }

/* ---------- data tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 0 16px; height: 40px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; vertical-align: middle; }
.tbl th { color: var(--text); font-weight: 600; background: var(--ui-bg); position: sticky; top: 0; z-index: 1; }
.tbl tr:hover td { background: #f6f8fc; }
.tbl.sortable th { cursor: pointer; user-select: none; } .tbl.sortable th:hover { background: var(--layer-hover); }
.tbl.sortable th.asc::after { content: " ↑"; color: var(--text-secondary); } .tbl.sortable th.desc::after { content: " ↓"; color: var(--text-secondary); }
.tbl tr.click { cursor: pointer; } .tbl tr.sel td { background: #edf5ff; }
.tbl.kv td { height: 32px; } .tbl.kv td:first-child { color: var(--text-secondary); width: 42%; }
/* a table wider than its card scrolls inside the card instead of spilling over the next one (dashboard: the
   Components table's "ready" column ran into the Proxy barrier card) */
.card-b:has(> table.tbl) { overflow-x: auto; }
#d-pods th, #d-pods td { padding: 0 10px; }
#d-pods td:first-child { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tbl td.num { font-variant-numeric: tabular-nums; text-align: right; }
.tbl .mono, .mono { font-family: var(--mono); font-size: 13px; }
.tag { display: inline-block; padding: 0 8px; height: 20px; line-height: 20px; border-radius: 10px; font-size: 12px; background: #e0e0e0; color: var(--text); }
.tag.ok { background: #a7f0ba; color: #044317; } .tag.warn { background: #fdd13a55; color: #684e00; } .tag.bad { background: #ffd7d9; color: #750e13; } .tag.info { background: #d0e2ff; color: #002d9c; }

/* ---------- forms ---------- */
.form fieldset { border: none; border-top: 1px solid var(--border-subtle); padding: 8px 0 8px; margin: 0 0 12px; }
.form legend { color: var(--text-secondary); font-size: 12px; padding: 0 8px 0 0; }
.form label { display: grid; grid-template-columns: 1fr 224px; align-items: center; gap: 16px; margin: 8px 0; }
.form label span { color: var(--text-secondary); font-size: 13px; }
.form label.chk { grid-template-columns: auto 1fr; }
input, select, textarea { background: var(--field); color: var(--text); border: none; border-bottom: 1px solid var(--border-strong); border-radius: 0; height: 32px; padding: 0 12px; font: 14px var(--font); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--interactive); outline-offset: -2px; }
input::placeholder { color: var(--text-placeholder); }
input[type=checkbox] { width: 16px; height: 16px; height: auto; accent-color: var(--interactive); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input { min-width: 200px; }
.actions { display: flex; gap: 1px; margin-top: 16px; }
button, .btn { background: var(--layer); color: var(--interactive); border: 1px solid var(--interactive); border-radius: 0; height: 40px; padding: 0 16px; cursor: pointer; font: 14px var(--font); text-decoration: none; display: inline-flex; align-items: center; }
button:hover, .btn:hover { background: #edf5ff; }
button.sm, .btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
button.primary { background: var(--interactive); border-color: var(--interactive); color: #fff; } button.primary:hover { background: var(--interactive-hover); }
button.danger { background: var(--layer); border-color: var(--support-error); color: var(--support-error); } button.danger:hover { background: var(--support-error); color: #fff; }
button:disabled { opacity: .4; cursor: default; }
.tabs { display: flex; border-bottom: 1px solid var(--border-subtle); margin-bottom: 16px; }
.tabs a { padding: 8px 16px; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--interactive); font-weight: 600; }
.pane { display: none; } .pane.active { display: block; }
.hint { color: var(--text-helper); font-size: 12px; margin: 16px 0 0; line-height: 1.5; }
.muted { color: var(--text-secondary); } .link { color: var(--link); cursor: pointer; font-size: 13px; }
.status { font-size: 13px; }
.list { list-style: none; padding: 0; margin: 0; } .list li { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border-subtle); } .list li:hover { background: var(--layer-hover); } .list li.active { background: #edf5ff; border-left: 3px solid var(--interactive); }
textarea { width: 100%; height: 64vh; font: 13px/1.5 var(--mono); padding: 8px 12px; }
.log { background: #262626; color: #f4f4f4; border: none; padding: 12px 16px; margin: 12px 0 0; font: 12px/1.5 var(--mono); max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.log.tall { max-height: 68vh; min-height: 320px; }
.log .err { color: #ff8389; } .log .ok { color: #42be65; } .log .ts { color: #8d8d8d; } .log .job { color: #be95ff; }
.progress { height: 4px; background: var(--border-subtle); overflow: hidden; margin-top: 12px; }
.progress div { height: 100%; width: 0; background: var(--interactive); transition: width .3s; }
.steps { display: flex; flex-wrap: wrap; gap: 0; margin-top: 12px; }
.step { padding: 4px 12px; background: var(--ui-bg); color: var(--text-helper); font-size: 12px; border-right: 1px solid var(--layer); }
.step.done { color: var(--text); background: #a7f0ba; } .step.now { color: #fff; background: var(--interactive); }

/* ---------- topology ---------- */
.topo { width: 100%; min-height: 520px; max-height: 78vh; overflow: auto; } .topo svg { width: 100%; height: auto; display: block; touch-action: none; }
#topo-reset { margin-left: auto; }
.topo-mini { min-height: 260px; } .topo-mini svg { width: 100%; height: 260px; touch-action: none; }
.tn { cursor: pointer; } .tn rect { fill: var(--layer); stroke: var(--border-strong); rx: 0; } .tn:hover rect { stroke: var(--interactive); stroke-width: 2; }
.tn text { fill: var(--text); font: 12px var(--font); } .tn .t { font-weight: 600; } .tn .s { fill: var(--text-secondary); font-size: 11px; }
.tn.bad rect { stroke: var(--support-error); stroke-width: 2; } .tn.ok rect { stroke: var(--support-success); }
.tl { stroke: #c6c6c6; stroke-width: 1.5; fill: none; } .tl.active { stroke: var(--interactive); stroke-dasharray: 4 6; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -20; } }
.tz rect { fill: var(--ui-bg); stroke: var(--border-subtle); rx: 0; } .tz text { fill: var(--text-secondary); font: 12px var(--font); }

/* ---------- alarms / notifications / events ---------- */
.alarm { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); align-items: flex-start; }
.alarm:last-child { border: 0; } .alarm .sev { flex: 0 0 auto; margin-top: 6px; }
.alarm .m { font-size: 13px; }
.eventbar { border-top: 1px solid var(--border-subtle); background: var(--layer); padding: 8px 32px 10px; }
.eventbar .eb-h { display: flex; gap: 12px; align-items: center; font-size: 13px; font-weight: 600; }
.eventbar .eb-h .muted { font-weight: 400; }
.eventbar .eb-h button { margin-left: auto; } .eventbar .eb-h button + button { margin-left: 0; }
.eventbar .log { max-height: 130px; margin-top: 8px; } .eventbar.collapsed .log { display: none; }

/* ---------- modal / toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(22,22,22,.5); display: grid; place-items: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-box { background: var(--layer); padding: 24px; width: 520px; max-width: 92vw; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.modal-box h3 { margin: 0 0 12px; font-size: 18px; font-weight: 400; } .modal-box p { margin: 6px 0; }
.modal-box .actions { justify-content: flex-end; margin: 24px -24px -24px; } .modal-box .actions button { height: 48px; padding: 0 48px 0 16px; flex: 1; justify-content: flex-start; }
.modal-box label.chk { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.toasts { position: fixed; right: 16px; top: 56px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--layer); border: 1px solid var(--border-subtle); border-left: 3px solid var(--interactive); padding: 12px 16px; font-size: 13px; min-width: 288px; max-width: 420px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.toast.err { border-left-color: var(--support-error); } .toast.ok { border-left-color: var(--support-success); }

/* ---------- radio map ---------- */
.rmap { width: 100%; max-height: 72vh; overflow: auto; background: var(--ui-bg); border: 1px solid var(--border-subtle); user-select: none; }
/* fallback SVG map only: Leaflet's own overlay <svg> (coverage areas, circles) must keep the size and
   position Leaflet gives it, or every vector shape is drawn off-screen */
.rmap:not(.geo) svg { width: 100%; height: auto; display: block; touch-action: none; }
.rm-zoom { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }
.rm-zoom button { min-width: 28px; } #rm-zoom-v { min-width: 42px; text-align: center; font-size: 12px; }
.rm-cell { fill: rgba(15,98,254,.08); stroke: var(--interactive); stroke-width: 1.5; }
.rm-cell.c1 { fill: rgba(138,63,252,.08); stroke: var(--viz-2); }
.rm-site { fill: var(--layer); stroke: var(--text); stroke-width: 1.5; }
.rm-label { font: 600 12px var(--font); fill: var(--text); } .rm-sub { font: 11px var(--font); fill: var(--text-secondary); }
.rm-ue { cursor: grab; } .rm-ue:active { cursor: grabbing; }
.rm-ue circle { fill: var(--viz-1); stroke: #fff; stroke-width: 1.5; } .rm-ue.c1 circle { fill: var(--viz-2); }
.rm-ue.pending circle { stroke: var(--viz-4); stroke-width: 3; } .rm-ue.out circle { fill: var(--border-strong); }
.rm-ue text { font: 9px var(--mono); fill: var(--text-secondary); pointer-events: none; }
.rm-ue.drag circle { r: 9; stroke: var(--text); }
label.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); font-weight: 500; user-select: none; }
label.switch input { appearance: none; -webkit-appearance: none; width: 32px; height: 16px; border-radius: 8px; background: #8d8d8d; position: relative; margin: 0; cursor: pointer; transition: background .15s; border: none; outline: none; }
label.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
label.switch input:checked { background: var(--support-success); }
label.switch input:checked::after { left: 19px; background: #fff; background-image: none; }
label.switch input:focus-visible { box-shadow: 0 0 0 2px var(--layer), 0 0 0 4px var(--interactive); }
label.switch input:hover { background: #6f6f6f; } label.switch input:checked:hover { background: #198038; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 13px; } label.inline input[type=range] { width: 140px; height: auto; background: none; border: none; accent-color: var(--interactive); }

/* ---------- sequence diagram ---------- */
.seq { overflow: auto; max-height: 64vh; background: var(--layer); }
.seq svg { display: block; min-width: 640px; }
.seq .lane { stroke: var(--border-strong); stroke-width: 1; } .seq .lane-t { font: 600 12px var(--font); fill: var(--text); }
.seq .arrow { stroke: var(--interactive); stroke-width: 1.5; marker-end: url(#arr); } .seq .arrow.l { stroke: var(--viz-2); }
.seq .arrow.nas { stroke: var(--viz-3); } .seq .arrow.sctp { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.seq .lbl { font: 11px var(--mono); fill: var(--text); } .seq .tm { font: 10px var(--mono); fill: var(--text-secondary); }
.dp-ues td { height: 32px; font-size: 13px; }
h3.sub { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-secondary); margin: 16px 0 6px; }

/* ---------- resizable side layout / overflow safety ---------- */
.cols-side > .card { min-width: 0; overflow: hidden; }
.cols-side.resizable { grid-template-columns: var(--side, 484px) 8px 1fr; gap: 0 8px; }
.splitter { cursor: col-resize; background: var(--border-subtle); width: 8px; border-radius: 2px; margin-bottom: 16px; position: relative; }
.splitter::after { content: ''; position: absolute; top: 50%; left: 2px; width: 4px; height: 28px; margin-top: -14px; border-left: 1px solid var(--border-strong); border-right: 1px solid var(--border-strong); }
.splitter:hover, .splitter.active { background: var(--interactive); }
body.resizing { cursor: col-resize; user-select: none; }
@media (max-width: 900px) { .cols-side.resizable { grid-template-columns: 1fr; } .splitter { display: none; } }
.scroll-x { overflow-x: auto; max-width: 100%; }
.tbl.wrap td { white-space: normal; word-break: break-all; }
.card-h .toolbar { min-width: 0; flex-wrap: wrap; }
.card-h label.inline { margin-left: auto; }
.tracers { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.tracer-row { border: 1px solid var(--border-subtle); padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.tracer-id { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tracer-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.contents { display: contents; }   /* generated form rows (one RSRP field per cell) sit in the parent form's grid */

/* panels that grow with the number of cells scroll instead of stretching the page */
.scroll-box { max-height: 50vh; overflow: auto; }                       /* per-cell tables; RAN table also scrolls sideways */
.scroll-box .tbl th { position: sticky; top: 0; background: var(--layer); z-index: 1; }
.cell-strip { max-height: 190px; overflow-y: auto; margin-top: -4px; }  /* dashboard: one tile per cell */
.cell-strip:empty { display: none; }
.run-pane { max-height: 78vh; overflow-y: auto; }    /* Mobility "Run": the pane scrolls, not the page */
.rounds-box { max-height: 30vh; }                     /* one row per handover round */
/* deployment form: UE worker nodes as checkboxes (one per discovered VM worker) */
.form .frow { display: grid; grid-template-columns: 1fr 224px; align-items: start; gap: 16px; margin: 8px 0; }
.form .frow > span { color: var(--text-secondary); font-size: 13px; padding-top: 2px; }
.form .node-boxes { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 120px; overflow-y: auto; }
.form .node-boxes label { display: inline-flex; align-items: center; gap: 4px; margin: 0; grid-template-columns: none; font-size: 13px; }
/* radio map on OpenStreetMap (Leaflet) */
.rmap.geo { height: 68vh; max-height: none; overflow: hidden; }
.rm-site-geo .sq { width: 12px; height: 12px; background: #fff; border: 2px solid; box-sizing: border-box; }
.rm-site-geo span, .rm-ue-geo span { position: absolute; left: 14px; top: -3px; white-space: nowrap; font: 600 11px var(--mono); color: #161616; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.rm-ue-geo .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-sizing: border-box; box-shadow: 0 0 2px rgba(0,0,0,.6); }
.rm-ue-geo .dot.pending { border-color: #f1c21b; border-width: 3px; }
/* in transit (walking to its drop point, or a handover underway): blinks so the user sees it is not settled yet */
@keyframes ue-transit { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
.rm-ue-geo .dot.transit, .rm-ue.transit circle { animation: ue-transit .9s ease-in-out infinite; }
.rm-ue-geo .dot.transit { border-color: var(--viz-4); border-width: 3px; }
.rm-ue.transit circle { stroke: var(--viz-4); stroke-width: 3; }
@media (prefers-reduced-motion: reduce) {
  .rm-ue-geo .dot.transit, .rm-ue.transit circle { animation: none; outline: 2px dashed var(--viz-4); outline-offset: 2px; }
}
.rm-ue-geo span { font-weight: 400; font-size: 10px; left: 13px; }
/* Leaflet stacks its panes at z-index 400-1000: confine them to the map box so the confirmation dialog
   (z-index 50) and toasts (60) stay on top -- otherwise the map covers the dialog and the page looks frozen */
.rmap.geo { position: relative; z-index: 0; isolation: isolate; }
/* radio map zoomed out: labels that would overlap are hidden (rmLabelDensity) */
.rmap.geo.hide-cell-labels .rm-site-geo span, .rmap.geo.hide-ue-labels .rm-ue-geo span { display: none; }
/* the hidden attribute must win over component display rules (buttons are display: inline-flex), e.g. the
   information dialog hides its Cancel button */
[hidden] { display: none !important; }
/* New deployment form locked while an emulation is up or a deploy/teardown job runs */
.lockable { position: relative; }
.lockable.locked form { opacity: .35; filter: grayscale(1); pointer-events: none; user-select: none; }
.lock-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px; padding: 24px; text-align: center; }   /* at the top: centred on the long form it sat halfway down the page */
.lock-overlay p { max-width: 420px; background: var(--layer); border: 1px solid var(--border-subtle); padding: 12px 16px; margin: 0; }
.lock-overlay .actions { display: flex; gap: 8px; }
.topo-sel-box { max-height: 70vh; }   /* topology selection: the gNB / UE lists */
/* topology: drawing and Selection side by side, the Selection list pinned in view next to it */
.topo-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.topo-layout > .card { margin: 0; }
.topo-sel-card { position: sticky; top: 64px; }
.topo-sel-card .topo-sel-box { max-height: calc(100vh - 160px); }
@media (max-width: 1100px) { .topo-layout { grid-template-columns: 1fr; } .topo-sel-card { position: static; } }
/* BLER card: the form on one row */
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form label { flex: 0 1 160px; }

.sc-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.sc-list .group { margin-top: 8px; font-size: 11px; text-transform: uppercase; opacity: .7; }
.sc-item { display: block; padding: 8px; border: 1px solid var(--line, #ccc3); border-radius: 6px; cursor: pointer; }
.sc-item.sel { border-color: var(--accent, #4a8); }
.sc-head { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-steps td { vertical-align: top; }
.sc-p { display: inline-block; margin: 0 6px 4px 0; white-space: nowrap; font-size: 12px; }
.nowrap { white-space: nowrap; }

/* radio map full screen */
#rm-card:fullscreen, #rm-card.rm-full { display: flex; flex-direction: column; background: var(--layer, var(--ui-bg)); overflow: hidden; margin: 0; border-radius: 0; }
#rm-card.rm-full { position: fixed; inset: 0; z-index: 1000; }
/* cloud faults (chronos) */
.chaos-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 24px; }
@media (max-width: 900px) { .chaos-grid { grid-template-columns: 1fr; } }
.chaos-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.chaos-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; background: var(--ui-bg, #f4f4f4); }
.chaos-kpis b { font: 600 22px/1.2 var(--mono, monospace); font-variant-numeric: tabular-nums; }
.chaos-chart { position: relative; height: 220px; }
.chaos-kpis-ping { margin-top: 16px; }
/* above the window-filling map (no Fullscreen API): its dialogs, toasts and help */
body:has(#rm-card.rm-full) .modal { z-index: 1100; }
body:has(#rm-card.rm-full) .toasts { z-index: 1110; }
body:has(#rm-card.rm-full) .hint-pop { z-index: 1120; }
#rm-card:fullscreen .card-b, #rm-card.rm-full .card-b { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#rm-card:fullscreen .rmap, #rm-card.rm-full .rmap { flex: 1; height: auto; max-height: none; min-height: 0; }
#rm-card:fullscreen .hint, #rm-card.rm-full .hint { display: none; }
.rm-zoom-set { width: 64px; margin-left: 6px; font-size: 12px; }
.alarm-hidden { font-size: 12px; margin-top: 6px; }

/* deployment going away: shown on every view until a new deployment can start */
.dep-banner { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: #fcf4d6; color: #161616;
  border-bottom: 1px solid var(--support-warning); font-size: 13px; }
.dep-banner.bad { background: #fff1f1; border-bottom-color: var(--support-error); }
.dep-banner b { font-weight: 600; }
.dep-banner .spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: dep-spin 0.9s linear infinite; flex: none; }
.dep-banner .step { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@keyframes dep-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dep-banner .spin { animation: none; } }

/* BLER overlay (data plane): the per-UE list scrolls inside the dialog */
.bler-list { max-height: 50vh; overflow: auto; }
.modal-box:has(.bler-list) { width: 680px; }
td.num.bad { color: var(--support-error); font-weight: 600; } td.num.warn { color: #8e6a00; font-weight: 600; }

/* RIC: A3 handover control */
.a3-form { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; }
.a3-form label { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.a3-form input[type=range] { width: 220px; max-width: 100%; }

/* enlarged dashboard time series */
.kpi:has(canvas[data-hist]), #chart-attach { cursor: zoom-in; }
.kpi:has(canvas[data-hist]):hover { background: var(--layer-hover); }
.chart-box { width: min(1100px, 94vw); }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.chart-head h3 { margin: 0; }
.chart-wrap { position: relative; height: min(60vh, 520px); }

/* radio map base tiles: neutral, keep detail and contrast (the coverage colours carry the meaning) */
.rm-tiles { filter: saturate(.75); }   /* colour only: the tiles keep their own contrast and brightness */

/* parameter help: "?" after a label, Carbon-style tooltip (class qhint: "hint" is the explanatory paragraphs) */
.qhint { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; padding: 0; border: 1px solid var(--border-strong);
        border-radius: 50%; background: transparent; color: var(--text-secondary); font: 600 10px/1 var(--font); cursor: help; vertical-align: middle; flex: 0 0 auto; }
.qhint:hover, .qhint:focus-visible { border-color: var(--interactive); color: var(--interactive); outline: none; }
.hint-pop { position: fixed; z-index: 80; background: #393939; color: #f4f4f4; font: 12px/1.45 var(--font); letter-spacing: .16px; padding: 8px 12px;
            box-shadow: 0 2px 6px rgba(0,0,0,.3); pointer-events: none; }
.hint-pop[hidden] { display: none; }

/* test scenarios: full-width list; the editor slides in as a side panel when a scenario is picked */
.sc-layout { display: block; }
/* visual only: clicks pass through, so + New and the list stay usable while the panel is open (it covered them) */
.sc-scrim { position: fixed; inset: 0; background: rgba(22,22,22,.18); z-index: 39; pointer-events: none; }
.sc-panel { position: fixed; top: var(--topbar); right: 0; bottom: 0; width: min(1100px, 94vw); margin: 0; z-index: 40;
            overflow: auto; box-shadow: -8px 0 24px rgba(0,0,0,.18); }
.sc-panel .card-h { position: sticky; top: 0; z-index: 2; background: var(--layer); }
.sc-scrim[hidden], .sc-panel[hidden] { display: none; }

.sc-live { align-self: flex-end; font-size: 12px; padding-bottom: 8px; }

/* Quick start card (Deployment page): the one-click path for newcomers */
.card.quick { border-left: 3px solid var(--interactive); }
.quick-b { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.quick-b h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.quick-b p { margin: 0; color: var(--text-secondary); max-width: 720px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-actions button { height: 48px; }

/* A3 trigger on the map: a floating panel in the map's top-right corner, collapsible to a pill */
.rm-wrap { position: relative; }
.rm-empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 4; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 8px; background: var(--ui-bg); border: 1px solid var(--border-subtle); color: var(--text-secondary); text-align: center; pointer-events: none; }
#rm-card:fullscreen .rm-wrap, #rm-card.rm-full .rm-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.a3-float { position: absolute; top: 12px; right: 12px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: calc(100% - 24px); }
.a3-pill { height: 36px; padding: 0 4px 0 12px; gap: 10px; background: var(--layer); color: var(--text); border: 1px solid var(--interactive);
           font: 600 13px var(--mono); box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; }
.a3-pill .a3-cta { font: 600 13px var(--font); color: #fff; background: var(--interactive); height: 28px; display: inline-flex; align-items: center; padding: 0 10px; }
.a3-pill:hover { background: #edf5ff; } .a3-pill:hover .a3-cta { background: var(--interactive-hover); }
.a3-float.off .a3-pill { border-color: var(--border-strong); padding-right: 12px; cursor: default; }
.a3-float.off .a3-pill { color: var(--text-secondary); }
.a3-float-body { width: 300px; max-width: 100%; background: var(--layer); border: 1px solid var(--border-subtle); box-shadow: 0 4px 16px rgba(0,0,0,.22); padding: 12px 14px; }
.a3-float.collapsed .a3-float-body { display: none; }
.a3-float:not(.collapsed) .a3-pill { display: none; }
.a3-float-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.a3-float-h .sm { height: 24px; padding: 0 8px; }
.a3-float .a3-form { display: flex; flex-direction: column; gap: 8px; }
.a3-float .a3-form label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.a3-float .a3-form label > span { display: inline-flex; align-items: center; }
.a3-float .a3-form input[type=range], .a3-float .a3-form select { width: 100%; }
.a3-float .a3-form button:not(.qhint) { width: 100%; justify-content: center; }
.a3-float-note { margin: 8px 0 0; font-size: 11px; color: var(--text-helper); }

/* the "?" stays a 16 px circle whatever the label's layout (flex column, full-width form buttons) */
button.qhint { width: 16px; min-width: 16px; max-width: 16px; height: 16px; aspect-ratio: 1; box-sizing: border-box; align-self: center; flex: none; }
.chaos-go { display: flex; gap: 8px; flex-wrap: wrap; }
.chaos-go button { flex: 1 1 160px; padding-block: 12px; }
.chaos-adv { margin-block: 4px; }
.chaos-adv summary { cursor: pointer; color: var(--muted, #6f6f6f); }
.chaos-adv[open] { display: flex; flex-direction: column; gap: 8px; }
.chaos-adv h4 { margin: 8px 0 0; font-size: 12px; }
/* channel engine KPI: two columns wide, its subline on one line (never wraps, so the radio view does not jump) */
#kpi-rmeng { grid-column: span 2; }
#kpi-rmeng .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
@media (max-width: 500px) { #kpi-rmeng { grid-column: auto; } }
