.billing-theme-toggle {
  flex:none; padding:6px 9px; min-height:32px; border:1px solid #b4a9f6;
  border-radius:8px; background:#f2efff; color:#352776; font:600 12px system-ui,sans-serif; cursor:pointer;
}
.billing-theme-toggle:focus-visible {outline:2px solid #9b84ff;outline-offset:2px}
.billing-theme-floating {position:fixed;right:16px;bottom:16px;z-index:30}
@media(max-width:600px){.billing-theme-toggle:not(.billing-theme-floating){padding-inline:6px;font-size:11px}}
@media print {.billing-theme-toggle{display:none!important}}
@media screen {html[data-billing-theme="light"] {color-scheme:light;}}
@media screen {
  html[data-billing-theme="dark"] {
    color-scheme:dark;
    --billing-bg:#101622;
    --billing-panel:#192334;
    --billing-raised:#233149;
    --billing-input:#111a2a;
    --billing-border:#394b65;
    --billing-text:#eef5ff;
    --billing-muted:#b8c9df;
    --billing-link:#9fcaff;
    --app-bg:var(--billing-bg);
    --app-ink:var(--billing-text);
    --app-muted:var(--billing-muted);
    --app-line:var(--billing-border);
  }
  html[data-billing-theme="dark"] body {
    background:var(--billing-bg)!important;color:var(--billing-text)!important;
  }
  html[data-billing-theme="dark"] body :is(main,form,h1,h2,h3,h4,h5,p,legend,label,dt,dd,strong,b,td,summary) {
    color:inherit;
  }
  html[data-billing-theme="dark"] body :is(p,small,dt,.muted,.description,.ic-diagnostic-row dt) {
    color:var(--billing-muted)!important;
  }
  html[data-billing-theme="dark"] body :is(a:not(.app-nav-link):not([class*="primary"]),.ic-port-open) {
    color:var(--billing-link);
  }
  html[data-billing-theme="dark"] body :is(
    .login,.panel,.nas-modal,.um-modal,dialog,
    .login-card,.auth-card,.app-user-panel,.nf-center,.nf-toast,.nf-progress-card,
    .finance-services-card,.pc-metric,.pc-settings fieldset,.pc-empty,.iv-info,
    .nas-detail-fields>div,.ic-optical-stats>div,.ic-diagnostic-row dd,.table,.scroll
  ) {
    background:var(--billing-panel)!important;color:var(--billing-text)!important;
    border-color:var(--billing-border)!important;
  }
  html[data-billing-theme="dark"] body :is(
    .app-workspace-header,.pc-header,.nf-center-head,.nf-monitor,.nf-sound-settings,
    .nas-modal-head,.nas-footer,.um-panel-head,.dp-box-head,.nas-detail-card-heading,
    .finance-services-scope,.ul-chart,.ic-diagnostic-row:nth-child(odd)
  ) {background:var(--billing-raised)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important}
  html[data-billing-theme="dark"] body :is(
    input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select,textarea,option
  ) {
    background:var(--billing-input)!important;color:var(--billing-text)!important;
    border-color:var(--billing-border)!important;color-scheme:dark;
  }
  html[data-billing-theme="dark"] body #app-workspace :is(table,tbody,tr,td,th,.ic-port-header,.ic-port-group,.nf-history-row) {
    border-color:var(--billing-border)!important;
  }
  html[data-billing-theme="dark"] body #app-workspace :is(.panel,.dp-box,.scroll) :is(th,thead,tbody tr:nth-child(even)) {
    background:var(--billing-raised)!important;color:var(--billing-text)!important;
  }
  html[data-billing-theme="dark"] body :is(.dp-btn,.iv-btn,.cm-btn,.pm-btn,.nm-button,.um-btn):not(.primary) {
    background:var(--billing-raised)!important;border-color:var(--billing-border)!important;color:var(--billing-text)!important;
  }
  html[data-billing-theme="dark"] body :is(.ic-rx,.ic-optical-stats>div:first-child strong,.ic-value-good){color:#71e1bc!important}
  html[data-billing-theme="dark"] body :is(.ic-tx,.ic-optical-stats>div:last-child strong,.dp-cpu-value){color:#c4b5fd!important}
  html[data-billing-theme="dark"] body .ic-value-bad{color:#ff9da8!important}
  html[data-billing-theme="dark"] body .ul-axis {fill:#b2c1da}
  html[data-billing-theme="dark"] body .ul-grid path {stroke:#40516d}
  html[data-billing-theme="dark"] body .billing-theme-toggle {background:#34285c;color:#f4efff;border-color:#7160ad}
}
.billing-theme-floating{left:16px;right:auto}
@media screen {
 html[data-billing-theme="dark"] body :is(.ul-stat strong,.dp-stat strong,.dp-money strong,.nas-detail-metric,.nf-history-row strong,.nf-toast strong,.finance-services-heading h2,.finance-services-card strong) {color:var(--billing-text)!important}
 html[data-billing-theme="dark"] body :is(.pc-page nav a,.nas-detail-view .nas-board-model,.ul-stat span,.nf-history-row small) {color:var(--billing-muted)!important}
 html[data-billing-theme="dark"] body .pc-page nav a {background:var(--billing-raised)!important;border-color:var(--billing-border)!important}
 html[data-billing-theme="dark"] body .pc-page nav a[aria-current] {background:#5344b6!important;color:#fff!important}
 html[data-billing-theme="dark"] body :is(.billing-action-notice,.notice,.iv-info,.nas-tip) {background:var(--billing-raised)!important;border-color:var(--billing-border)!important;color:var(--billing-text)!important}
 html[data-billing-theme="dark"] body .billing-action-notice.success strong {color:#7ee7ba!important}
 html[data-billing-theme="dark"] body .billing-action-notice.error strong {color:#ff9da8!important}
 html[data-billing-theme="dark"] body .billing-action-notice.info strong {color:#b3c9ff!important}
}
@media screen {
 html[data-billing-theme="dark"] body #app-workspace .dp-summary .dp-stat {
   background:linear-gradient(145deg,#26334a,#1c2639)!important;
   border-color:#3d4b65!important;
   color:#e8eef9!important;
   box-shadow:0 2px 0 #111827;
 }
 html[data-billing-theme="dark"] body #app-workspace .dp-summary .dp-stat strong {color:#f4f7ff!important}
 html[data-billing-theme="dark"] body #app-workspace .dp-summary .dp-stat :is(small,span) {color:#bdcbe1!important}
 html[data-billing-theme="dark"] body #app-workspace .dp-summary .dp-stat:hover {border-color:#8f7be4!important}
}

@media screen {
html[data-billing-theme="dark"] #app-workspace .cm-wrap,
html[data-billing-theme="dark"] #app-workspace .cm-wrap :is(.cm-panel,.cm-toolbar,.cm-sync,.cm-sync-meta,.cm-subbar,.cm-pagination,.cm-modal,.cm-form-body,.cm-modal-footer) {
background:var(--billing-panel)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important}
html[data-billing-theme="dark"] #app-workspace .cm-wrap :is(.cm-kpi,.cm-modal-head,.cm-table th) {
background:var(--billing-raised)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important}
html[data-billing-theme="dark"] #app-workspace .cm-wrap .cm-kpi[aria-current="true"]{border-color:#a794fc!important}
html[data-billing-theme="dark"] #app-workspace .cm-wrap .cm-table :is(tbody,tr,td) {
background:var(--billing-panel)!important;color:var(--billing-text)!important}
html[data-billing-theme="dark"] #app-workspace .cm-wrap .cm-table tr:nth-child(even) td{background:var(--billing-raised)!important}
html[data-billing-theme="dark"] #app-workspace .cm-wrap :is(.cm-head h2,.cm-kpi strong,.cm-list-status,.cm-customer-name,.cm-cell-package strong,.cm-nas-name) {
color:var(--billing-text)!important}
html[data-billing-theme="dark"] #app-workspace .cm-wrap :is(.cm-customer-id,.cm-customer-meta,.cm-data-stale,.cm-subbar-note,.cm-kpi small) {
color:var(--billing-muted)!important}
html[data-billing-theme="dark"] #app-workspace .cm-wrap .cm-signal-label{color:var(--billing-text)!important}
}

/* Shared surfaces for the Billing sidebar modules. */
@media screen {
html[data-billing-theme="dark"] #app-workspace :is(
 .dp-finance-context,.dp-chart-area,.dp-money,.dp-monitor article,.dp-nas-context,
 .nas-detail-header,.nas-detail-card,.nas-detail-metrics article,.nm-panel,.nm-kpi,.nm-tenant-board,.nm-tenant-card,
 .pm-kpi,.pm-panel,.pm-modal,.pm-body,.pm-speed,
 .hs-kpis>*,.hs-panel,.hs-config,
 .iv-kpi,.iv-panel,.iv-modal,.iv-body,.iv-detail>div,.iv-pay-total,
 .pr-kpi,.pr-panel,.pr-modal,.pr-detail,.pr-channels,.pr-chart-plot,
 .ps-modern-summary,.ps-nas-list a,.ps-panel,
 .st-tickets,.st-ticket-kpis>*,.st-ticket-create,.st-ticket-scope,
 .um-admin .um-admin-card,.um-kpi,.um-panel,.um-modal,.um-body,.um-perms>*,
 .wa-wrap,.wa-kpis>*,.wa-panel,.wa-detail,.wa-templates>*,.wa-superadmin,.wa-superadmin-header,.wa-pair-actions,
 .billing-company,.billing-setting-links a,.finance-services-group,.finance-services-card,
 .ua-panel,.ua-preview,.ua-form,.interface-connections .dp-box
){
 background:var(--billing-panel)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important;
 box-shadow:0 2px 0 #111827;
}
html[data-billing-theme="dark"] #app-workspace :is(
 .nm-filters,.nm-panel-head,.nm-panel-foot,.nm-info,.nm-search,
 .pm-filter,.pm-panel-head,.pm-modal-head,.pm-modal-foot,.pm-foot,.pm-note,.pm-search,
 .iv-filter,.iv-panel-head,.iv-modal-head,.iv-modal-foot,.iv-foot,.iv-warning,
 .pr-filter,.pr-panel-head,.pr-modal-head,.pr-modal-foot,.pr-foot,.pr-size,
 .st-ticket-filters,.st-ticket-inline-note,.st-ticket-validation-alert,
 .um-filter,.um-panel-head,.um-modal-head,.um-modal-foot,.um-note,.um-warning,.um-foot,.um-search,
 .wa-note,.ua-note,.finance-services-scope
){
 background:var(--billing-raised)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important
}
html[data-billing-theme="dark"] #app-workspace :is(
 .nm-table,.nas-inventory-table,.pm-table,.hs-panel table,.iv-table,.pr-table,.ps-panel table,.st-ticket-table,.um-table,.wa-table,.interface-connections table
) :is(tbody,tr,td){
 background:var(--billing-panel)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important
}
html[data-billing-theme="dark"] #app-workspace :is(
 .nm-table,.nas-inventory-table,.pm-table,.hs-panel table,.iv-table,.pr-table,.ps-panel table,.st-ticket-table,.um-table,.wa-table,.interface-connections table
) :is(th,tbody tr:nth-child(even) td){
 background:var(--billing-raised)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important
}
html[data-billing-theme="dark"] #app-workspace :is(
 .nm-kpi,.pm-kpi,.iv-kpi,.pr-kpi,.um-kpi,.hs-kpis,.wa-kpis,.st-ticket-kpis,.ps-modern-summary,
 .um-panel,.wa-panel,.wa-superadmin-header,.billing-company,.finance-services-group,.interface-connections
) :is(h2,h3,h4,strong,label,legend,dt,dd){
 color:var(--billing-text)!important
}
html[data-billing-theme="dark"] #app-workspace :is(
 .nm-btn,.hs-btn,.pr-btn,.ps-btn,.st-ticket-btn,.wa-btn,.ua-btn,.billing-setting-links a,.wa-admin-nav a,.wa-superadmin-nav a
):not(.primary):not(.danger){
 background:var(--billing-raised)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important
}
html[data-billing-theme="dark"] #app-workspace :is(.nm-tenant-badge,.nm-status,.pm-tag,.iv-tag,.pr-tag,.um-role,.um-status,.wa-pill,.hs-status,.st-ticket-status) {
 background:#2c3850!important;color:#d6e2f9!important;border-color:#445674!important
}
html[data-billing-theme="dark"] #app-workspace :is(.nm-status.online,.iv-tag.paid,.um-status.active,.hs-status.verified,.st-ticket-status.status-resolved) {
 background:#193d34!important;color:#a8efd1!important;border-color:#285849!important
}
html[data-billing-theme="dark"] #app-workspace :is(.nm-status.offline,.iv-tag.overdue,.um-status.inactive,.st-ticket-status.priority-urgent) {
 background:#472630!important;color:#ffc0cb!important;border-color:#6f3546!important
}
html[data-billing-theme="dark"] #app-workspace .wa-qr-box{background:#fff!important;color:#182b47!important}
html[data-billing-theme="dark"] #app-workspace :is(.ic-port-group,.ic-diagnostic-row) :is(dt,dd){color:var(--billing-text)!important}
html[data-billing-theme="dark"] #app-workspace .ic-diagnostic-row .ic-value-good{color:#71e1bc!important}
html[data-billing-theme="dark"] #app-workspace .ic-diagnostic-row .ic-value-bad{color:#ff9da8!important}
}
@media screen {
 html[data-billing-theme="dark"] #app-workspace .nas-scope-badge{background:#263752!important;color:#dce8fc!important;border-color:#435879!important}
 html[data-billing-theme="dark"] #app-workspace .pr-chart-plot{background:repeating-linear-gradient(to top,#192132 0,#192132 38px,#32425c 39px,#32425c 40px)!important}
 html[data-billing-theme="dark"] #app-workspace :is(.pr-bar-item,.dp-bar-item) :is(span,strong,small){color:#c5d3e9!important}
 html[data-billing-theme="dark"] #app-workspace :is(.pr-head,.iv-head,.pm-head,.nm-heading,.wa-superadmin-header) :is(small,[class*="kicker"],[class*="eyebrow"]){color:#c6baff!important}
 html[data-billing-theme="dark"] #app-workspace :is(.pr-bar-track,.dp-bar-track,.dp-meter){border-color:#43536e!important}
}

@media screen {
html[data-billing-theme="dark"] body #app-workspace .cm-wrap .cm-filter {
 background:var(--billing-raised)!important;border-color:var(--billing-border)!important;color:var(--billing-text)!important
}
html[data-billing-theme="dark"] body #app-workspace .cm-wrap .cm-filter input::placeholder {
 color:var(--billing-muted);opacity:1
}
html[data-billing-theme="dark"] body #app-workspace .cm-wrap :is(.cm-sync-meta,.cm-customer-id) small {
 color:var(--billing-muted)!important
}
html[data-billing-theme="dark"] body #app-workspace .cm-wrap .cm-cell-billing .cm-pill {
 background:#2b3a53!important;border-color:#4a5a75!important;color:#e2edff!important
}
}

@media screen {
html[data-billing-theme="dark"] body #app-workspace .cm-modal,
html[data-billing-theme="dark"] body #app-workspace .cm-modal .cm-form-body {
 background:var(--billing-panel)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important
}
html[data-billing-theme="dark"] body #app-workspace .cm-modal :is(.cm-modal-head,.cm-modal-footer,.cm-detail>div) {
 background:var(--billing-raised)!important;color:var(--billing-text)!important;border-color:var(--billing-border)!important
}
html[data-billing-theme="dark"] body #app-workspace .cm-modal :is(.cm-modal-head h2,.cm-detail strong) {
 color:var(--billing-text)!important
}
html[data-billing-theme="dark"] body #app-workspace .cm-modal :is(.cm-modal-head p,.cm-detail small) {
 color:var(--billing-muted)!important
}
}

@media screen {
html[data-billing-theme="dark"] body #app-workspace .nas-scope-pill{
 background:var(--billing-raised)!important;border-color:var(--billing-border)!important;color:var(--billing-text)!important
}
html[data-billing-theme="dark"] body #app-workspace .nas-scope-pill strong{color:var(--billing-text)!important}
html[data-billing-theme="dark"] body #app-workspace .nas-scope-pill span{color:var(--billing-muted)!important}
html[data-billing-theme="dark"] body #app-workspace .nas-scope-pill a{color:var(--billing-link)!important}
}

@media screen {
html[data-billing-theme="dark"] body #app-workspace .hs-screen :is(.hs-table,.hs-fields,.hs-config){
 background-color:var(--billing-panel)!important;border-color:var(--billing-border)!important;color:var(--billing-text)!important
}
html[data-billing-theme="dark"] body #app-workspace .hs-panel .hs-table :is(table,th,td) {
 border-color:var(--billing-border)!important
}
html[data-billing-theme="dark"] body #app-workspace .hs-panel .hs-fields label{color:var(--billing-text)!important}
html[data-billing-theme="dark"] body #app-workspace .hs-panel .hs-fields :is(input,textarea)::placeholder{color:var(--billing-muted);opacity:1}
}

@media screen {
html[data-billing-theme="dark"] body #app-workspace .pm-search input::placeholder{color:var(--billing-muted);opacity:1}
html[data-billing-theme="dark"] body #app-workspace .pm-table :is(.pm-tag,.pm-profile strong){overflow-wrap:normal;word-break:normal}
html[data-billing-theme="dark"] body #app-workspace .pm-table .pm-tag{max-width:none}
html[data-billing-theme="dark"] body #app-workspace .pm-table .pm-tag.regular{background:#1b4036!important;color:#a6ebce!important;border-color:#366353!important}
html[data-billing-theme="dark"] body #app-workspace .pm-table .pm-tag.isolation{background:#432735!important;color:#ffc0cc!important;border-color:#693a4d!important}
}
@media screen and (min-width:1150px) {
html[data-billing-theme="dark"] body #app-workspace .pm-table td:last-child{min-width:252px}
html[data-billing-theme="dark"] body #app-workspace .pm-table td:last-child .pm-btn{min-height:30px;padding:5px 7px;white-space:nowrap}
}

/* Keep pairing instructions and the QR card legible in dark mode. */
html[data-billing-theme="dark"] body #app-workspace .wa-panel ol {
 color:var(--billing-muted)!important;
}
html[data-billing-theme="dark"] body #app-workspace .wa-panel ol li {
 color:inherit!important;
}
html[data-billing-theme="dark"] body #app-workspace .wa-qr-box :is(p,strong,span,small) {
 color:#182b47!important;
}

@media screen {
  :is(#app-sidebar, #app-workspace) {
    --billing-ui-focus:#3769c6;
    --billing-ui-radius:.75rem;
    --billing-ui-shadow:0 1px 2px #13274712;
  }
  html[data-billing-theme="dark"] :is(#app-sidebar, #app-workspace) {
    --billing-ui-focus:#9bbaff;
    --billing-ui-shadow:0 1px 2px #0003;
  }

  #app-workspace :is(.dp-box, .nm-panel, .cm-panel, .iv-panel, .acs-content) {
    border-radius:var(--billing-ui-radius);
    box-shadow:var(--billing-ui-shadow);
  }

  #app-sidebar .app-nav-link,
  #app-workspace :is(.dp-btn, .iv-btn, .cm-btn, .nm-btn, .nm-button, .pm-btn) {
    transition:background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
  }

  #app-workspace :is(a[href], button, input, select, textarea, summary):focus-visible {
    outline:2px solid var(--billing-ui-focus);
    outline-offset:2px;
  }

  #app-workspace :is(.dp-btn, .iv-btn, .cm-btn, .nm-btn, .nm-button, .pm-btn):is(:disabled, [aria-disabled="true"]) {
    cursor:not-allowed;
  }
}

@media screen and (prefers-reduced-motion: reduce) {
  #app-sidebar .app-nav-link,
  #app-workspace :is(.dp-btn, .iv-btn, .cm-btn, .nm-btn, .nm-button, .pm-btn) {
    transition:none;
  }
}

@media screen {
  html[data-billing-theme="dark"] {
    --billing-shell-edge: #344052;
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.app-workspace-header, .app-dashboard-header),
  html[data-billing-theme="dark"] body #app-workspace :is(.app-workspace-header, .app-dashboard-header)
    :is(button, a, label, select, form, [class*="chip"], [class*="pill"], [class*="badge"]),
  html[data-billing-theme="dark"] body #app-sidebar,
  html[data-billing-theme="dark"] body #app-sidebar :is(.app-sidebar-head, .app-sidebar-footer, .app-nav-group, hr),
  html[data-billing-theme="dark"] body #app-sidebar .app-nav-link :is(.app-nav-icon, svg:first-child, span:first-child) {
    border-color: var(--billing-shell-edge) !important;
  }

  html[data-billing-theme="dark"] body #app-sidebar .app-nav-link:is(.active, [aria-current="page"]) {
    border-color: #48566b !important;
    box-shadow: inset 3px 0 #7899d6;
  }

  html[data-billing-theme="dark"],
  html[data-billing-theme="dark"] body #app-sidebar,
  html[data-billing-theme="dark"] body #app-sidebar #app-navigation {
    scrollbar-color: #526175 #171e28;
  }

  html[data-billing-theme="dark"] body.app-light #app-workspace > .app-workspace-header,
  html[data-billing-theme="dark"] body.app-light #app-workspace > .app-workspace-header
    :is(.app-header-left, .app-top-right) :is(button, a, form, label, [class*="chip"], [class*="pill"], [class*="avatar"], [class*="date"], [class*="switch"]),
  html[data-billing-theme="dark"] body.app-light #app-sidebar,
  html[data-billing-theme="dark"] body.app-light #app-sidebar .app-sidebar-footer,
  html[data-billing-theme="dark"] body.app-light #app-sidebar #app-navigation
    :is(.app-nav-icon, .app-nav-link[aria-current="page"]) {
    border-color: var(--billing-shell-edge) !important;
  }
}

@media screen {
  #app-workspace,
  #app-workspace > .app-workspace-header > :is(.app-header-left,.app-top-right) {
    min-inline-size: 0;
  }

  #app-workspace dialog {
    box-sizing: border-box;
    max-inline-size: calc(100% - 1rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    max-block-size: calc(100vh - 1rem);
    max-block-size: calc(100dvh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
}

@media screen and (max-width: 760px) {
  #app-workspace > .app-workspace-header,
  #app-workspace > .app-workspace-header > .app-top-right {
    flex-wrap: wrap;
  }

  #app-workspace > .app-workspace-header > .app-top-right {
    max-inline-size: 100%;
  }

  #app-workspace > .app-workspace-header :is(select,input) {
    min-inline-size: 0;
    max-inline-size: 100%;
  }
}

@media screen and (max-width: 760px) and (pointer: coarse) {
  #app-workspace dialog :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
    font-size: max(1rem,16px);
  }
}

@media screen {
  html[data-billing-theme="dark"] body #app-workspace :is(.dp-summary,.dp-overview,.ul-box) {
    --summary-dark-surface:#232d3c;
    --summary-dark-edge:#394960;
    --summary-dark-text:#edf4ff;
    --summary-dark-muted:#b7c9e2;
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.dp-summary,.dp-overview,.ul-box) :is(.dp-box-head,.dp-box-head h3) {
    color:var(--summary-dark-text)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.dp-summary,.dp-overview,.ul-box) .dp-box-head small {
    color:var(--summary-dark-muted)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace .ul-box > .dp-box-head,
  html[data-billing-theme="dark"] body #app-workspace :is(.dp-summary,.dp-overview) .dp-btn:not(.primary) {
    background:var(--summary-dark-surface)!important;
    border-color:var(--summary-dark-edge)!important;
    color:var(--summary-dark-text)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace .ul-box :is(.ul-mode-switch [aria-pressed="false"],#ul-toggle) {
    color:var(--summary-dark-text)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace .ul-box #ul-toggle:disabled {
    color:var(--summary-dark-muted)!important;
    opacity:.75;
  }
}

/* Shared dark surfaces for the authenticated Billing workspace. */
@media screen {
  html[data-billing-theme="dark"] body :is(#app-workspace,#app-sidebar) {
    --app-bg:var(--billing-bg);
    --app-ink:var(--billing-text);
    --app-muted:var(--billing-muted);
    --app-line:var(--billing-border);
    --glass-panel:var(--billing-panel);
    --glass-raised:var(--billing-raised);
    --glass-dialog:var(--billing-panel);
    --glass-border:var(--billing-border);
    --billing-panel-depth:inset 0 1px #c4dbff14,0 4px 12px #050b1660;
    --billing-control-depth:inset 0 1px #d7e5ff18,0 2px 4px #050b1660;
  }

  html[data-billing-theme="dark"] body #app-workspace :is(
    .app-workspace-header,.dp-box,.cm-panel,.iv-panel,.nm-panel,.pm-panel,
    .pr-panel,.ps-panel,.um-panel,.wa-panel,.hs-panel,.acs-content,.sbm-section
  ) {
    box-shadow:var(--billing-panel-depth);
  }

  html[data-billing-theme="dark"] body #app-workspace :is(
    .cm-kpi,.iv-kpi,.nm-kpi,.pm-kpi,.pr-kpi,.um-kpi,.dp-stat,.customer-map-counts > div
  ) {
    box-shadow:var(--billing-control-depth);
  }

  html[data-billing-theme="dark"] body #app-workspace :is(
    .dp-btn,.cm-btn,.iv-btn,.nm-button,.pm-btn,.um-btn
  ):not(:disabled):not([aria-disabled="true"]) {
    box-shadow:var(--billing-control-depth);
  }

  html[data-billing-theme="dark"] body #app-workspace dialog {
    box-shadow:inset 0 1px #c4dbff18,0 16px 48px #050b16aa;
  }

  html[data-billing-theme="dark"] body #app-workspace dialog::backdrop {
    background-color:#080e19a6;
  }

  html[data-billing-theme="dark"] body #app-sidebar .app-nav-link[aria-current="page"] {
    box-shadow:inset 3px 0 #78abff,inset 0 1px #c4dbff1a,0 2px 5px #050b164d;
  }
}

/* Shared shell and dashboard surfaces resolve from the active theme. */
@media screen {
  html[data-billing-theme="light"] body :is(#app-workspace,#app-sidebar) {
    --billing-shell-surface:#f7faff;
    --billing-section-surface:#edf4fc;
    --billing-shell-control:#fff;
    --billing-shell-line:#cddbef;
    --billing-title-ink:#1c3251;
    --billing-caption-ink:#476382;
    --billing-selection-accent:#2466bb;
  }

  html[data-billing-theme="dark"] body :is(#app-workspace,#app-sidebar) {
    --billing-shell-surface:#10192b;
    --billing-section-surface:#172339;
    --billing-shell-control:#1d2d47;
    --billing-shell-line:#344d70;
    --billing-title-ink:#edf5ff;
    --billing-caption-ink:#b9cde7;
    --billing-selection-accent:#8bbdff;
  }

  html[data-billing-theme] body:is(.app-light,.app-dark) #app-workspace > .app-workspace-header,
  html[data-billing-theme] body #app-workspace > .app-workspace-header,
  html[data-billing-theme] body #app-sidebar,
  html[data-billing-theme] body #app-sidebar :is(.app-sidebar-head,.app-sidebar-company,.app-sidebar-footer) {
    background-color:var(--billing-shell-surface)!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-workspace > .app-workspace-header
    :is(button,a,select,label,form,.app-top-right > *) {
    border-color:var(--billing-shell-line)!important;
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link[aria-current="page"] {
    background:var(--billing-section-surface)!important;
    color:var(--billing-title-ink)!important;
    border-color:var(--billing-shell-line)!important;
    box-shadow:inset 3px 0 var(--billing-selection-accent);
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link[aria-current="page"] .app-nav-text,
  html[data-billing-theme] body #app-workspace :is(.dp-box,.dp-strip)
    :is(.dp-heading-with-png,h2,h3,h4) {
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-workspace :is(.dp-box,.dp-monitor,.dp-finance-context) .dp-box-head {
    background:var(--billing-section-surface)!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-workspace :is(.dp-box-head,.dp-heading-with-png)
    :is(small,time,.muted,[data-ppp-updated]) {
    color:var(--billing-caption-ink)!important;
  }

  html[data-billing-theme] body #app-workspace :is(.dp-box-head,#ul-recovery) .dp-btn:not(.primary) {
    background:var(--billing-shell-control)!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-sidebar #app-navigation :is(.app-nav-heading,.app-nav-group) {
    color:var(--billing-caption-ink);
    border-color:var(--billing-shell-line);
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link:not([aria-current="page"]):hover {
    background-color:var(--billing-section-surface)!important;
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link .app-nav-icon {
    border-color:var(--billing-shell-line)!important;
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link:focus-visible {
    outline-color:var(--billing-selection-accent);
  }

  html[data-billing-theme] body #app-workspace :is(
    .cm-panel,.iv-panel,.nm-panel,.pm-panel,.pr-panel,.um-panel,.ps-panel,.hs-panel,.wa-panel,.acs-content,.sbm-section
  ) {
    background-color:var(--billing-shell-surface)!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-workspace :is(
    .cm-toolbar,.iv-panel-head,.nm-panel-head,.pm-panel-head,.pr-panel-head,.um-panel-head,
    .nas-modal-head,.nas-footer,.um-modal-foot,.iv-modal-head,.iv-modal-foot
  ) {
    background-color:var(--billing-section-surface)!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-workspace :is(
    .cm-table-clean,.iv-table,.nm-table,.nas-inventory-table,.pm-table,.pr-table,.um-table,.wa-table
  ) thead th {
    background-color:var(--billing-section-surface)!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-workspace :is(dialog,.cm-filter,.iv-filter,.nm-filters,.pm-filter,.pr-filter,.um-filter)
    :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {
    background-color:var(--billing-shell-control)!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-workspace :is(dialog,.nas-modal,.iv-modal,.um-modal,.pm-modal,.pr-modal) {
    border-color:var(--billing-shell-line)!important;
  }
}

/* NAS inventory contrast across tenant summaries and device rows. */
@media screen {
  html[data-billing-theme="dark"] body #app-workspace :is(.nm-tenant-board,.nas-noc-inventory)
    :is(.nm-panel-head,.nm-filters,.nm-filter,.nm-search) {
    background:var(--billing-section-surface,#172339)!important;
    color:var(--billing-title-ink,#edf5ff)!important;
    border-color:var(--billing-shell-line,#344d70)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace .nas-noc-inventory .nm-panel-head :is(h2,h3,h4,strong) {
    color:var(--billing-title-ink,#edf5ff)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.nm-tenant-board table,.nas-inventory-table) tbody tr {
    --nas-row-surface:var(--billing-shell-surface,#10192b);
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.nm-tenant-board table,.nas-inventory-table) tbody tr:nth-child(even) {
    --nas-row-surface:var(--billing-section-surface,#172339);
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.nm-tenant-board table,.nas-inventory-table) tbody tr:is(:hover,:focus-within) {
    --nas-row-surface:var(--billing-shell-control,#1d2d47);
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.nm-tenant-board table,.nas-inventory-table) tbody tr > :is(td,th) {
    background:var(--nas-row-surface)!important;
    color:var(--billing-title-ink,#edf5ff)!important;
    border-color:var(--billing-shell-line,#344d70)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace :is(.nm-tenant-board table,.nas-inventory-table) tbody :is(td,th) strong {
    color:var(--billing-title-ink,#edf5ff)!important;
  }

  html[data-billing-theme="dark"] body #app-workspace .nas-noc-inventory :is(.nm-filters,.nm-filter,.nm-panel-head)
    :is(button,a):not(.primary) {
    background:var(--billing-shell-control,#1d2d47)!important;
    color:var(--billing-title-ink,#edf5ff)!important;
    border-color:var(--billing-shell-line,#344d70)!important;
  }
}

/* Compact network-operations navigation. */
@media screen {
  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-heading {
    color:var(--billing-caption-ink)!important;
    padding-inline:.65rem;
    margin-block:.8rem .35rem;
    letter-spacing:.075em;
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link {
    min-block-size:2.35rem;
    padding:.34rem .6rem;
    gap:.55rem;
    border-radius:.48rem;
    color:var(--billing-caption-ink)!important;
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link .app-nav-icon {
    display:inline-grid;
    place-items:center;
    flex:none;
    inline-size:1.55rem;
    block-size:1.55rem;
    background:transparent!important;
    border-color:transparent!important;
    box-shadow:none!important;
    color:var(--billing-selection-accent);
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link:is(:hover,[aria-current="page"]) {
    background:var(--billing-section-surface)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link[aria-current="page"] {
    border-color:var(--billing-shell-line)!important;
    box-shadow:inset 3px 0 var(--billing-selection-accent);
  }

  @media (pointer:coarse) {
    html[data-billing-theme] body #app-sidebar #app-navigation .app-nav-link {
      min-block-size:2.75rem;
    }
  }
}

/* Light workspace with graphite navigation. */
@media screen {
  html[data-billing-theme="light"] body #app-sidebar {
    --billing-shell-surface:#283549;
    --billing-section-surface:#3b4d67;
    --billing-shell-line:#526782;
    --billing-title-ink:#f3f7fd;
    --billing-caption-ink:#cfdaea;
    --billing-selection-accent:#8ebeff;
    scrollbar-color:#6d829e #283549;
  }

  html[data-billing-theme="light"] body #app-sidebar #app-navigation .app-nav-link .app-nav-text {
    color:inherit!important;
  }

  html[data-billing-theme="light"] body #app-workspace {
    --billing-shell-surface:#fff;
    --billing-section-surface:#f1f5fa;
    --billing-shell-line:#d4dfed;
    --billing-title-ink:#182a43;
    --billing-caption-ink:#4b627c;
  }

  html[data-billing-theme="light"] body #app-workspace > .app-workspace-header
    :is(button,a:not(.primary),label,select,.app-top-right > *) {
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme="light"] body #app-workspace :is(.dp-overview,.dp-summary) {
    background:#fff!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme="light"] body #app-workspace :is(.dp-overview,.dp-summary) :is(h2,h3,h4,strong) {
    color:var(--billing-title-ink)!important;
  }

  html[data-billing-theme="light"] body #app-workspace :is(.dp-overview,.dp-summary) :is(p,small,.muted,[data-ppp-updated]) {
    color:var(--billing-caption-ink)!important;
  }

  html[data-billing-theme="light"] body #app-workspace :is(.dp-summary .dp-stat,.dp-overview .dp-btn:not(.primary)) {
    background:#fff!important;
    border-color:var(--billing-shell-line)!important;
    color:var(--billing-title-ink)!important;
    box-shadow:0 1px 2px #23375516;
  }

  html[data-billing-theme="light"] body #app-workspace .dp-summary .dp-stat {
    padding-block:.55rem;
  }

  html[data-billing-theme="light"] body #app-workspace .ul-box .ul-interval-control span {
    color:var(--billing-caption-ink)!important;
  }
}

@media screen {
  html[data-billing-theme="light"] body:is(.app-light,.app-dark) #app-sidebar #app-navigation .app-nav-link:is(.active,[aria-current="page"]),
  html[data-billing-theme="light"] body #app-sidebar #app-navigation .app-nav-link:is(.active,[aria-current="page"]) {
    background:#eaf1fb!important;
    border-color:#cad9ee!important;
    color:#17375e!important;
    box-shadow:inset 3px 0 #3371c5;
  }

  html[data-billing-theme="light"] body:is(.app-light,.app-dark) #app-sidebar #app-navigation .app-nav-link:is(.active,[aria-current="page"]) .app-nav-text,
  html[data-billing-theme="light"] body #app-sidebar #app-navigation .app-nav-link:is(.active,[aria-current="page"]) .app-nav-text {
    color:#17375e!important;
  }

  html[data-billing-theme="light"] body #app-workspace > .app-workspace-header .app-header-left button {
    color:#17375e!important;
  }

  html[data-billing-theme="light"] body #app-workspace > .app-workspace-header .app-header-left button svg {
    color:inherit!important;
  }
}

/* Compact dashboard for billing and network monitoring. */
@media screen {
  html[data-billing-theme] body #app-workspace :is(.dp-summary,.dp-overview,.ul-box) {
    border-radius:.65rem;
    box-shadow:0 2px 5px #20375512;
  }

  html[data-billing-theme] body #app-workspace .dp-summary .dp-strip {
    gap:.45rem;
  }

  html[data-billing-theme] body #app-workspace .dp-summary .dp-stat {
    min-block-size:0;
    padding:.45rem .65rem;
    border-radius:.5rem;
  }

  html[data-billing-theme] body #app-workspace .dp-summary .dp-stat > div > strong {
    font-size:clamp(1.04rem,.95rem + .35vw,1.34rem);
    line-height:1.2;
  }

  html[data-billing-theme] body #app-workspace .dp-box > .dp-box-head {
    padding-block:.6rem;
  }

  html[data-billing-theme] body #app-workspace .ul-box .ul-chart-head {
    margin-block-end:.4rem;
    padding:.5rem;
    border-radius:.55rem;
    
  }

  @media (min-width: 1000px) {
    html[data-billing-theme] body #app-workspace .dp-summary {
      padding-block:.65rem;
    }
  }

  @media (min-width: 1120px) {
    html[data-billing-theme] body #app-workspace .dp-heading.dp-overview {
      display:grid!important;
      grid-template-columns:minmax(0,1fr) auto;
      align-items:center;
      gap:1rem;
      padding:.65rem .9rem!important;
    }

    html[data-billing-theme] body #app-workspace .dp-heading.dp-overview > .dp-overview-main {
      min-inline-size:0;
      justify-content:flex-start;
    }

    html[data-billing-theme] body #app-workspace .dp-heading.dp-overview h2 {
      font-size:1.15rem;
      margin:0;
    }

    html[data-billing-theme] body #app-workspace .dp-heading.dp-overview > .dp-overview-cpu {
      border:0;
      border-inline-start:1px solid var(--billing-shell-line);
      margin:0;
      padding:0 0 0 1rem;
    }

    html[data-billing-theme] body #app-workspace .dp-summary > h3 {
      margin-block:0 .32rem;
    }

    html[data-billing-theme] body #app-workspace .dp-summary .dp-stat {
      padding:.25rem .55rem!important;
      box-shadow:none;
    }

    html[data-billing-theme] body #app-workspace .dp-summary .dp-stat > div > strong {
      margin-block:.1rem;
    }
  }
}

/* Full-width finance and server panels. */
@media screen and (min-width: 1120px) {
  html[data-billing-theme] body #app-workspace > :is(.dp-finance-box,.dp-host) {
    min-inline-size:0;
    border-radius:.75rem;
    
  }

  html[data-billing-theme] body #app-workspace > .dp-finance-box .dp-finance {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,2fr) minmax(0,1fr);
    gap:.75rem;
  }

  html[data-billing-theme] body #app-workspace > .dp-host .dp-monitor {
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:.55rem;
  }

  html[data-billing-theme] body #app-workspace > .dp-host .dp-monitor article {
    min-inline-size:0;
    min-block-size:0;
    padding:.65rem .72rem;
    border-radius:.62rem;
    background:var(--billing-shell-control);
    border-color:var(--billing-shell-line);
  }

  html[data-billing-theme] body #app-workspace > .dp-host .dp-monitor article strong {
    display:block;
    margin-block:.2rem;
    font-size:clamp(.95rem,.85rem + .2vw,1.16rem);
    line-height:1.35;
    font-variant-numeric:tabular-nums;
    overflow-wrap:normal;
    word-break:normal;
    text-wrap:pretty;
  }

  html[data-billing-theme] body #app-workspace > .dp-host > .dp-box-head {
    flex-wrap:wrap;
    gap:.3rem .65rem;
  }
}

/* Solid dashboard surfaces and clear chart marks in both themes. */
@media screen {
  html[data-billing-theme="light"] #app-workspace:has(.app-dashboard-header) {
    --dashboard-surface:#f8fafc;
    --dashboard-raised:#f4f7fa;
    --dashboard-edge:#dce4ed;
    --dashboard-selected:#e2edf9;
    --dashboard-selected-ink:#224c77;
  }

  html[data-billing-theme="dark"] #app-workspace:has(.app-dashboard-header) {
    --dashboard-surface:#182436;
    --dashboard-raised:#1d2b3f;
    --dashboard-edge:#334459;
    --dashboard-selected:#2a405c;
    --dashboard-selected-ink:#dceaff;
  }

  html[data-billing-theme] #app-workspace .app-dashboard-header .app-menu-toggle {
    color:var(--billing-title-ink)!important;
    background:var(--billing-shell-control)!important;
    box-shadow:none!important;
  }

  html[data-billing-theme] #app-workspace .app-dashboard-header .app-toggle-bars,
  html[data-billing-theme] #app-workspace .app-dashboard-header .app-toggle-bars::before,
  html[data-billing-theme] #app-workspace .app-dashboard-header .app-toggle-bars::after {
    background:currentColor!important;
  }

  html[data-billing-theme] #app-workspace :is(
    .app-dashboard-header,.dp-overview,.dp-summary,.ul-box,.dp-finance-box,.dp-customer-analysis,.dp-host
  ) {
    background:var(--dashboard-surface,var(--billing-shell-surface))!important;
    border-color:var(--dashboard-edge,var(--billing-shell-line))!important;
    color:var(--billing-title-ink)!important;
    box-shadow:none!important;
    backdrop-filter:none!important;
  }

  html[data-billing-theme] #app-workspace :is(
    .dp-summary .dp-stat,.dp-fin-column,.dp-chart,.dp-money,.dp-monitor article,.ul-chart
  ) {
    background:var(--dashboard-raised,var(--billing-shell-control))!important;
    border-color:var(--dashboard-edge,var(--billing-shell-line))!important;
    box-shadow:none!important;
  }

  html[data-billing-theme] #app-workspace :is(
    .dp-overview .dp-btn,.dp-summary .dp-stat,.ul-box .ul-legend,.ul-box .ul-mode-switch,
    .ul-box #ul-interval,.ul-box #ul-toggle
  ) {
    font-variant-numeric:tabular-nums;
    box-shadow:none!important;
  }

  html[data-billing-theme] #app-workspace .ul-box .ul-chart-head,
  html[data-billing-theme] body #app-workspace :is(.ul-box,.dp-finance-box,.dp-customer-analysis,.dp-host) .dp-box-head {
    background:var(--dashboard-raised,var(--billing-section-surface))!important;
    border-color:var(--dashboard-edge,var(--billing-shell-line))!important;
    box-shadow:none!important;
  }

  html[data-billing-theme] #app-workspace .ul-box :is(.ul-plot-scale,.ul-time,.ul-inspect-hint) {
    color:var(--billing-caption-ink)!important;
  }

  html[data-billing-theme] #app-workspace .ul-box :is(.ul-grid path,.ul-grid-vertical) {
    stroke:var(--billing-shell-line)!important;
  }

  html[data-billing-theme] #app-workspace .ul-box :is(.ul-line-rx,.ul-line-tx,.ul-dot-rx,.ul-dot-tx) {
    filter:none!important;
  }

  html[data-billing-theme] #app-workspace .ul-box .ul-mode-switch .dp-btn[aria-pressed="true"] {
    background:var(--dashboard-selected,#e2edf9)!important;
    color:var(--dashboard-selected-ink,#224c77)!important;
    box-shadow:none!important;
  }
}
