/* Shared controls and explicit dark palette; no filter inversion of media. */
:root{--pbx-bg:#f4f6f9;--pbx-panel:#fff;--pbx-raised:#e8edf5;--pbx-text:#172033;--pbx-muted:#596273;--pbx-line:#ccd3dd;--pbx-link:#174dbb;color-scheme:light}
html[data-theme="dark"]{--pbx-bg:#0c1422;--pbx-panel:#172235;--pbx-raised:#223149;--pbx-text:#e6edf7;--pbx-muted:#adbbce;--pbx-line:#40516b;--pbx-link:#a5c7ff;--border:var(--pbx-line);color-scheme:dark;background:var(--pbx-bg);color:var(--pbx-text)}
.theme-picker{display:flex;align-items:center;gap:8px;white-space:nowrap;font-size:13px;color:var(--pbx-muted)}
.theme-picker select{width:auto;min-width:102px;padding:7px 10px;color:var(--pbx-text);background:var(--pbx-panel);border:1px solid var(--pbx-line)}
.topbar{height:auto;min-height:72px;gap:14px;padding:14px 0;flex-wrap:wrap}.topbar>div:last-child{flex-wrap:wrap}
.login-theme{display:flex;justify-content:flex-end;margin-bottom:16px}
html[data-theme="dark"] body{background:var(--pbx-bg);color:var(--pbx-text)}
html[data-theme="dark"] :is(.card,.panel,.secret-box,.resource-card,.phone-key-properties,dialog){background:var(--pbx-panel);color:var(--pbx-text);border-color:var(--pbx-line)}
html[data-theme="dark"] :is(input,select,textarea,button,.button){background:var(--pbx-panel);color:var(--pbx-text);border-color:var(--pbx-line)}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#9caec6;opacity:1}
html[data-theme="dark"] :is(input,select,textarea,button,a,summary):focus-visible{outline:3px solid #9ac4ff;outline-offset:3px}
html[data-theme="dark"] :is(input[type="checkbox"],input[type="radio"],progress){accent-color:#8bb8ff}
html[data-theme="dark"] input:autofill{box-shadow:0 0 0 1000px var(--pbx-panel) inset;color:var(--pbx-text)}
html[data-theme="dark"] a{color:var(--pbx-link)}
html[data-theme="dark"] :is(label,.muted,.card span,.status-text,.status-legend,.secret-details summary,.resource-note,.diag-muted,.diag-events time,.diag-node small,th){color:var(--pbx-muted)}
html[data-theme="dark"] :is(th,td,fieldset,hr,.diag-details dt,.diag-details dd,.diag-events>div,.backup-card,.conference-prompts,.service-audio article){border-color:var(--pbx-line)}
html[data-theme="dark"] :is(.badge,.pill,.diag-result,.phone-device-stage,pre){background:var(--pbx-raised);color:var(--pbx-text)}
html[data-theme="dark"] :is(.button.primary,button[type="submit"]){background:#245fd6;color:#fff;border-color:#638fed}
html[data-theme="dark"] :is(.button.danger,button.danger){background:#46232c;color:#ffb4b4;border-color:#a85a66}
html[data-theme="dark"] :is(.pill.ok,.flash.ok,.diag-result.success){background:#153b2d;color:#9de8b9}
html[data-theme="dark"] :is(.pill.locked,.flash.error,.diag-result.failure){background:#46232c;color:#ffb4b4}
html[data-theme="dark"] .sidebar{background:#080f1c;color:#e6edf7;border-right:1px solid #283851}
html[data-theme="dark"] .sidebar :is(a,.advanced-nav,.advanced-nav summary){color:#d4dfef}
html[data-theme="dark"] .sidebar :is(a:hover,a[aria-current="page"],summary:hover){background:#23344e;color:#fff}
html[data-theme="dark"] .diag-node{background:var(--pbx-panel);border-color:var(--pbx-line)}
html[data-theme="dark"] .diag-node.ok{background:#153b2d;border-color:#4cbe85}
html[data-theme="dark"] .diag-node.error{background:#46232c;border-color:#e77f86}
html[data-theme="dark"] .diag-node.active{background:#453a1c;border-color:#e5be58}
html[data-theme="dark"] .diag-node .diag-icon{color:#a5c7ff}
html[data-theme="dark"] :is(.diag-warning,.notice){color:#f4d17b;border-color:#9a813c}
html[data-theme="dark"] .phone-profile-notice{background:#213653;color:var(--pbx-text)}
html[data-theme="dark"] #phone-profile-panel h3{border-color:var(--pbx-line)}
html[data-theme="dark"] .help-wrap pre{background:#080f1c;color:#d4dfef}
html[data-theme="dark"] .help-wrap code{color:inherit}
html[data-theme="dark"] .resource-chart path{stroke:var(--pbx-line)}
html[data-theme="dark"] #cpu-line{stroke:#8bb8ff}
html[data-theme="dark"] #ram-line{stroke:#6cdbad}
/* Existing pages use a few inline semantic status colors. */
html[data-theme="dark"] [style*="color:#a34b00"],html[data-theme="dark"] [style*="color:#a54200"]{color:#f4d17b!important}
html[data-theme="dark"] [style*="color:#176b35"]{color:#9de8b9!important}
html[data-theme="dark"] [style*="color:#039"]{color:var(--pbx-link)!important}
html[data-theme="dark"] ::selection{background:#37598d;color:#fff}
@media(max-width:650px){.topbar{align-items:flex-start}.topbar>div:last-child{gap:8px!important}.theme-picker{font-size:12px}.theme-picker select{min-width:92px}}
@media print{html[data-theme="dark"],html[data-theme="dark"] body{background:#fff;color:#111}.theme-picker{display:none}html[data-theme="dark"] :is(.card,.panel,.resource-card,pre,th,td){background:#fff;color:#111}}
.topbar button,body>main>.card button{border:1px solid var(--pbx-line);border-radius:8px;padding:8px 11px;cursor:pointer}
