/* Shared appearance layer. Operational colors and graph series keep their meaning. */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;flex:none;width:36px;height:36px;min-width:36px;padding:8px!important;border:1px solid #e0e5ee;border-radius:10px;background:#fff;color:#586b86;cursor:pointer;vertical-align:middle}
.theme-toggle svg{display:block;width:19px;height:19px;pointer-events:none}
.theme-toggle:focus-visible{outline:3px solid #739cff;outline-offset:3px}
#login [data-theme-toggle],.login-panel [data-theme-toggle],.team-auth-page [data-theme-toggle]{display:none!important}
.theme-toggle[hidden]{display:none!important}
:root[data-theme=dark]{color-scheme:dark;--astro-canvas:#0e1522;--astro-surface:#172131;--astro-section:#1c293b;--astro-border:#2b394e;--astro-ink:#e2eaf5;--astro-teal:#739aff;--blue:#82a5ff;--accent:#4a78f5;--ink:#e2eaf5;--muted:#a0aec4;--edge:#2b394e;--dark-hover:#22314a;--dark-blue:#8aabff;--dark-red:#ff8195;--dark-green:#63d4ac;--dark-amber:#f0c269}
html[data-theme=dark] body,html[data-theme=dark] .shell,html[data-theme=dark] .ml-wall{background:var(--astro-canvas);color:var(--astro-ink)}
html[data-theme=dark] :is(.shell>aside,.shell>div>header,body>header,.ml-wall .ml-wall-header){background:#131d2d;color:var(--astro-ink);border-color:var(--astro-border);box-shadow:none}
html[data-theme=dark] :is(h1,h2,h3,.shell #pageTitle,.brand,.brand-system-name,.shell>aside .brand,.shell>aside .brand .brand-system-name,.dash-panel-title,.device-heading-toggle,.device-header-content strong,.ml-device-title strong,.ml-summary strong){color:var(--astro-ink)!important}
html[data-theme=dark] :is(small,.muted,label,.breadcrumb,.eyebrow,.live-context,.side-footer,.brand-note,.dash-eyebrow,#dashFresh,.dash-footnote,.dash-empty,.dash-chart-hint,.graph-branding,.ml-traffic,.ml-device-title small,.ml-state-label,.topology-keyvalue dt,.topology-note,.graph-range,.graph-hover){color:var(--muted)}
html[data-theme=dark] a{color:var(--dark-blue)}
html[data-theme=dark] :is(.panel,.dash-panel,.shell .panel,.shell .dash-panel,.ml-device-card,.sensor,.service-card,.software-update-card,dialog,.shell dialog,body dialog.account-dialog,body dialog.team-password-dialog,.login-panel){background:var(--astro-surface);color:var(--astro-ink);border-color:var(--astro-border);box-shadow:none}
html[data-theme=dark] :is(.panel-head,.dash-panel-head,.shell .panel-head,.shell .dash-panel-head,.section-head,.device-title,.device-row,.shell .device-title,.shell .device-row,.shell .group-title,#overview .group-title,.ml-device-header,#main-links .ml-device-header,.topology-status,.topology-side,.topology-legend){background:var(--astro-surface);border-color:var(--astro-border);color:var(--astro-ink)}
html[data-theme=dark] :is(.shell .view>.toolbar,.shell .topo-toolbar,#main-links>.ml-toolbar,.toolbar,.inventory-tools,.graph-toolbar,.graph-controls,.graph-time-controls,.history-controls,.graph-inspection,.sensor-inspection){background:var(--astro-section);border-color:var(--astro-border);color:var(--astro-ink)}
html[data-theme=dark] .shell .dash-toolbar{background:transparent}
html[data-theme=dark] :is(th,.shell th){background:#1b2739;color:#a9b8ce;border-color:var(--astro-border)}
html[data-theme=dark] :is(td,.shell td,.dash-link-row,.dash-event,.ml-interface,.account-session,.topology-keyvalue,.graph-channels,.graph-info){border-color:var(--astro-border)}
html[data-theme=dark] :is(button,input,select,textarea,.button,summary.screen-display-toggle,.header-account-menu>summary,.screen-display-settings>summary,.display-menu>summary){background:#192538;color:#dce6f5;border-color:#374861}
html[data-theme=dark] :is(input,select,textarea){color-scheme:dark}
html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder{color:#8f9eb5;opacity:1}
html[data-theme=dark] :is(input,select,textarea):focus{border-color:#81a6ff;outline-color:#81a6ff40}
html[data-theme=dark] :is(button.primary,.shell button.primary,.button.primary,.shell .tabs button.active,.graph-toolbar button.active,.account-tabs button[aria-selected=true]){background:#416ee7;border-color:#5e86f0;color:#fff}
html[data-theme=dark] :is(button.primary,.button.primary):hover{background:#527df0;border-color:#82a5ff}
html[data-theme=dark] :is(button,.button):disabled{opacity:.5}
html[data-theme=dark] :is(.header-account-popup,.screen-display-panel,.display-menu-content,[data-target-device-list],.sensor-device-options,.sensor-device-results){background:#1a273a;border-color:var(--astro-border);color:var(--astro-ink);box-shadow:0 12px 36px #0005}
html[data-theme=dark] .shell .side-nav :is(button,a){background:transparent;color:#abb9cf}
html[data-theme=dark] .shell .side-nav .nav-icon{color:#91a3bf}
html[data-theme=dark] .shell .side-nav button.active{background:#24375d;color:#a9c1ff;box-shadow:inset 3px 0 #83a6ff}
html[data-theme=dark] .shell .side-nav button.active .nav-icon{color:#a9c1ff}
html[data-theme=dark] .navigation-toggle{background:#1c2a3e;border-color:var(--astro-border);color:#b6c8e3}
html[data-theme=dark] .shell #dashboard .dash-kpi{background:var(--astro-surface);border-color:var(--astro-border);border-top-color:#7d9aff;color:var(--astro-ink)}
html[data-theme=dark] .shell #dashboard .dash-kpi :is(.dash-kpi-label,.dash-kpi-detail){color:#aab8ce}
html[data-theme=dark] .shell #dashboard .dash-kpi .dash-kpi-value{color:#97b4ff}
html[data-theme=dark] .shell #dashboard .dash-kpi[data-kind=down]{background:#2b1e2e;border-top-color:#ee6c88}
html[data-theme=dark] .shell #dashboard .dash-kpi[data-kind=down] .dash-kpi-value{color:var(--dark-red)}
html[data-theme=dark] .shell #dashboard .dash-kpi[data-kind=healthy]{background:#142b2b;border-top-color:#50b995}
html[data-theme=dark] .shell #dashboard .dash-kpi[data-kind=healthy] .dash-kpi-value{color:var(--dark-green)}
html[data-theme=dark] .shell #dashboard .dash-kpi[data-kind=warning]{background:#2b271e;border-top-color:#c59b50}
html[data-theme=dark] .dash-meter{background:#2c3a50}
html[data-theme=dark] #overview details[data-group]{background:var(--astro-surface);border-color:var(--astro-border)}
html[data-theme=dark] #overview .sensor{background:var(--astro-surface);border-top-color:var(--astro-border);border-right-color:var(--astro-border);border-bottom-color:var(--astro-border)}
html[data-theme=dark] #overview #counts .counter{background:#192536;border-color:var(--astro-border);color:#afbed2}
html[data-theme=dark] #overview #counts .counter[data-filter=all]{background:#1c2b48;--summary-color:#92b1ff}
html[data-theme=dark] #overview #counts .counter[data-filter=down]{--summary-color:#ff8195}
html[data-theme=dark] #overview #counts .counter[data-filter=warning]{--summary-color:#f0c269}
html[data-theme=dark] #overview #counts .counter[data-filter=up]{--summary-color:#63d4ac}
html[data-theme=dark] :is(.pill,.state,.status,.tag,.badge,.ml-health-item){background:#23324a;border-color:#394c68;color:#b7cae7}
html[data-theme=dark] :is(.software-update-card[data-state=available],.software-update-card[data-state=busy]){background:#1a2a48;border-color:#37558c}
html[data-theme=dark] :is(.software-update-detail,.software-update-notes,.software-update-eyebrow){color:#a9bbd8}
html[data-theme=dark] :is(.note,.message,.ml-notice,.topology-banner,.update-setup textarea){background:#1d2d43;color:#b4c9e7;border-color:#344c6b}
html[data-theme=dark] :is(.error,.message.error,.software-update-card[data-state=error],.ml-notice[data-error=true],.topology-banner[data-error=true]){background:#352331;color:#ff98a8;border-color:#744052}
html[data-theme=dark] :is(.ml-interface[data-state=down],#main-links .ml-interface[data-state=down]){background:#30202c}
html[data-theme=dark] :is(.ml-interface[data-state=down] .ml-state-label,.ml-down-time){color:var(--dark-red)}
html[data-theme=dark] .ml-interface[data-state=up] .ml-state-label{color:var(--dark-green)}
html[data-theme=dark] :is(.graph-wrap,.shell .graph-wrap,.graph,.dash-chart){background:var(--astro-surface)}
/* Style neutral SVG surfaces only: traffic, alarm and optical series stay intact. */
html[data-theme=dark] :is(.graph,.graph-wrap,.dash-chart,.topology-canvas) :is(rect[fill="#fff"],rect[fill="#ffffff"],rect[fill="#f8fbff"],rect[fill="#f9fcff"]){fill:#182437}
html[data-theme=dark] :is(.graph,.graph-wrap,.dash-chart,.topology-canvas) :is([stroke="#e2eaf1"],[stroke="#e2eaf2"],[stroke="#e6eef5"],[stroke="#dfe9f2"],[stroke="#e2eaf3"]){stroke:#304058}
html[data-theme=dark] :is(.graph,.graph-wrap,.dash-chart) text{fill:#a4b6ce}
html[data-theme=dark] .topology-canvas{background-color:#111c2b;background-image:radial-gradient(#34465f 1px,transparent 1px)}
html[data-theme=dark] .topology-canvas [data-map-node] rect[fill="#fff"]{fill:#1c2c43;stroke:#647eaa}
html[data-theme=dark] .topology-canvas [data-map-node] text{fill:#dce8f9}
html[data-theme=dark] .topology-canvas [data-map-label] text{fill:#c2d0e5}
html[data-theme=dark] .topology-canvas [data-map-label] rect{fill:#17263c;stroke:#3c5272}
html[data-theme=dark] dialog::backdrop{background:#020713aa}
html[data-theme=dark] :is(.session-boot,.ml-wall-boot){background:var(--astro-canvas);color:var(--astro-ink)}
html[data-theme=dark] :is(.session-boot-card,.account-brand-preview){background:var(--astro-surface);border-color:var(--astro-border);color:var(--astro-ink)}
html[data-theme=dark] #login :is(.login-card){background:#152238f5;border-color:#455975;color:#e2eaf5;box-shadow:0 20px 65px #0005}
html[data-theme=dark] #login :is(.login-card-identity,.login-card h2,.login-card label){color:#e2eaf5}
html[data-theme=dark] #login :is(.login-intro,.login-help,.login-card-caption){color:#a4b6ce;border-color:#35475f}
html[data-theme=dark] #login .login-card input{background:#101c2d;border-color:#405470;color:#e2eaf5}
@media(hover:hover){html[data-theme=dark] :is(button,.button):not(:disabled):not(.primary):hover,html[data-theme=dark] .shell button:not(:disabled):not(.primary):not(.sensor):not(.counter):not(.dash-kpi):hover{background:var(--dark-hover);border-color:#5978a4;color:#e2eaf5}html[data-theme=dark] :is(.shell .side-nav a,.shell .side-nav button):hover{background:#223451;color:#b9ceff}html[data-theme=dark] :is(.sensor,.dash-link-row,.ml-interface):not([data-state=down]):hover{background:#20304a}html[data-theme=dark] tbody tr:hover>td{background-color:#8299bd12}}
@media(prefers-reduced-motion:reduce){.theme-toggle{transition:none!important;transform:none!important}}
@media print{[data-theme-toggle]{display:none!important}}

/* Alarm lists and detail drawers preserve severity without bright table backgrounds. */
html[data-theme=dark] :is(.alarm-compact-table td,.alarm-summary-chip,.alarm-row-menu>div,.alarm-down-help>div,.alarm-row-menu button){background:var(--astro-surface);color:var(--astro-ink);border-color:var(--astro-border)}
html[data-theme=dark] :is(.alarm-more-filters,.alarm-detail-facts,.alarm-note-preview,.alarm-primary-tabs span,.alarm-down-filterbar button span){background:#23334b;color:#b4c9e7;border-color:#405875}
html[data-theme=dark] :is(.alarm-primary-tabs button[aria-pressed=true],.alarm-down-filterbar button[aria-pressed=true]){background:#263c61;border-color:#476798;color:#bad0ff}
html[data-theme=dark] :is(.alarm-down-table tr,.incident-critical,.incident-major){background:#30212e}
html[data-theme=dark] .alarm-down-table tr:nth-child(even){background:#382533}
html[data-theme=dark] .incident-warning{background:#302b20}
html[data-theme=dark] .incident-suppressed{background:#253144}
html[data-theme=dark] :is(.alarm-down-table th){background:#1b2739}
html[data-theme=dark] :is(.alarm-down-table td,.alarm-down-tools,.alarm-toolbar,.alarm-down-header,.alarm-investigation,.alarm-maintenance,.alarm-footnote){border-color:var(--astro-border)}
html[data-theme=dark] :is(.alarm-down-for,.alarm-down-badge,.alarm-severity-pill[data-level=critical]){color:#ff95a7}
html[data-theme=dark] .alarm-severity-pill[data-level=critical]{background:#522b3c}
html[data-theme=dark] .alarm-severity-pill[data-level=major]{background:#4b3225;color:#ffbb8e}
html[data-theme=dark] .alarm-severity-pill[data-level=warning]{background:#433c24;color:#f3d083}
html[data-theme=dark] :is(.alarm-down-link,.alarm-down-message summary){color:#b7ceef}
html[data-theme=dark] :is(.graph,.graph-wrap,.dash-chart) rect[fill="#fafcfe"]{fill:#152235}
html[data-theme=dark] :is(.graph,.graph-wrap,.dash-chart) :is([stroke="#e0e8ef"],[stroke="#edf2f7"],[stroke="#e5edf4"]){stroke:#304058}

html[data-theme=dark] .shell #dashboard .dash-kpi[data-kind=warning] .dash-kpi-value{color:var(--dark-amber)}
html[data-theme=dark] .shell #dashboard .dash-kpi:is([data-kind=busy-idle],[data-kind=neutral]){border-top-color:#60738f}
html[data-theme=dark] .shell .dash-status-breakdown [data-status=up]{color:var(--dark-green)}
html[data-theme=dark] .shell .dash-status-breakdown [data-status=down]{color:var(--dark-red)}
html[data-theme=dark] .shell .dash-status-breakdown [data-status=warning]{color:var(--dark-amber)}
html[data-theme=dark] :is(#detail #ranges,#detail #sensorMetrics,#customRange,.graph-traffic-tooltip,.graph-readout.has-reading){background:var(--astro-section);border-color:var(--astro-border);color:var(--astro-ink)}
html[data-theme=dark] :is(.graph-inspect-time strong,.graph-info b,.channel-value){color:var(--astro-ink)}
html[data-theme=dark] :is(.graph-inspect-time,.graph-inspect-empty,.graph-total-note){color:var(--muted)}
html[data-theme=dark] .graph-inspect-secondary{border-color:var(--astro-border)}
html[data-theme=dark] #dashboard{color:var(--astro-ink)}

html[data-theme=dark] #main-links .ml-device-card{border-color:var(--astro-border)}
html[data-theme=dark] .ml-wall-brand{color:var(--astro-ink)}

html[data-theme=dark] .topology-canvas [data-map-node] rect[stroke="#0797b9"]{stroke:#79beff;fill:#243e60}
html[data-theme=dark] #overview .sensor :is(.sensor-value,.sensor-name){color:var(--astro-ink)}
html[data-theme=dark] #overview .sensor[data-health=down]{background:#30212e}
html[data-theme=dark] #overview .sensor[data-health=down] .sensor-value{color:var(--dark-red)}
html[data-theme=dark] #overview .sensor[data-health=warning]{background:#302b20}
html[data-theme=dark] #overview .sensor[data-health=warning] .sensor-value{color:var(--dark-amber)}
html[data-theme=dark] #overview .sensor .measurement-unit{color:var(--muted)}

/* Use consistent spacing below field labels without shifting toggles or toolbars. */
:root {
 --nms-field-gap: 7px;
 --nms-field-focus: #3664ce;
}
:root[data-theme=dark] { --nms-field-focus: #93b0ff; }

:is(form,dialog) label:has(+ :is(input,select,textarea):not([type=checkbox],[type=radio],[type=hidden],[type=range],[type=button],[type=submit])) {
 margin-block-end: var(--nms-field-gap);
}


:is(form,dialog) label > :is(input,select,textarea):not([type=checkbox],[type=radio],[type=hidden],[type=range],[type=button],[type=submit]) {
 margin-block-start: var(--nms-field-gap);
}

html body :is(input,select,textarea):not([type=hidden],[type=button],[type=submit],[type=reset]):focus {
 outline: 2px solid var(--nms-field-focus) !important;
 outline-offset: 1px !important;
}

dialog.device-fields-dialog {
 --device-dialog-padding: clamp(16px, 4vw, 24px);
 box-sizing: border-box;
 max-width: calc(100vw - 24px);
 max-height: 92dvh;
 overflow: hidden;
 padding: 0;
}
.device-fields-dialog > form {
 display: grid;
 grid-template-rows: auto minmax(0, 1fr) auto;
 margin: 0;
 max-height: calc(92dvh - 2px);
}
.device-fields-dialog > form > h2 {
 margin: 0;
 padding: 16px var(--device-dialog-padding) 12px;
 border-bottom: 1px solid var(--astro-border, #e1e8f0);
}
.device-dialog-fields {
 min-width: 0;
 overflow: auto;
 padding: 10px var(--device-dialog-padding) 16px;
 scroll-padding-block: 10px 16px;
}
.device-fields-dialog > form > .actions {
 flex-wrap: wrap;
 margin: 0;
 padding: 12px var(--device-dialog-padding);
 border-top: 1px solid var(--astro-border, #e1e8f0);
}
