/* Profile controls use normal document flow; no floating action button. */
.xf-profile-appearance{max-width:760px;border:1px solid var(--border,#dce3eb);border-radius:14px;background:var(--card,#fff);color:var(--foreground,#122033);overflow:hidden}
.xf-profile-appearance>header{padding:24px 26px 20px}
.xf-profile-appearance h2{font-family:inherit;font-size:18px;font-weight:650;line-height:1.4;margin:0 0 7px}
.xf-profile-appearance p{font-size:13px;line-height:1.6;margin:0;color:var(--muted-foreground,#64748b)}
.xf-appearance-row{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:22px 26px;border-top:1px solid var(--border,#dce3eb);border-bottom:1px solid var(--border,#dce3eb)}
.xf-appearance-row label{font-size:14px;font-weight:650;display:block;margin:0 0 5px}
.xf-theme-toggle{position:relative;display:inline-flex;align-items:center;flex:none;width:48px;height:28px;padding:3px;border:1px solid #94a3b8;border-radius:999px;background:#cbd5e1;cursor:pointer;transition:background .15s}
.xf-theme-toggle>span{display:block;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;transform:translateX(0);transition:transform .15s}
.xf-theme-toggle[aria-checked="true"]{background:#2563eb;border-color:#3b82f6}.xf-theme-toggle[aria-checked="true"]>span{transform:translateX(20px)}
.xf-theme-toggle:focus-visible,.xf-theme-retry:focus-visible{outline:3px solid #60a5fa;outline-offset:4px}.xf-theme-toggle:disabled{opacity:.65;cursor:wait}
.xf-profile-appearance>footer{padding:16px 26px;display:flex;align-items:center;gap:14px;flex-wrap:wrap}.xf-profile-appearance [data-error="true"]{color:#b42339}
.xf-theme-retry{border:1px solid var(--border,#cbd5e1);border-radius:7px;padding:6px 10px;background:var(--secondary,#edf2f7);color:var(--foreground,#122033);font:inherit;font-size:12px;cursor:pointer}.xf-theme-retry[hidden]{display:none}

html[data-xf-theme="dark"]{
 color-scheme:dark;--background:#101826;--foreground:#e5edf7;--card:#162235;--card-foreground:#e5edf7;--popover:#1b2a40;--popover-foreground:#e5edf7;
 --primary:#2563eb;--primary-foreground:#fff;--secondary:#23344c;--secondary-foreground:#e5edf7;--muted:#1d2c42;--muted-foreground:#acbdd2;
 --accent:#213d60;--accent-foreground:#d5e7ff;--destructive:#fb7185;--border:#33465f;--input:#405675;--ring:#60a5fa;
 --sidebar:#101b2c;--sidebar-foreground:#bed0e5;--sidebar-primary:#2563eb;--sidebar-primary-foreground:#fff;--sidebar-accent:#203655;--sidebar-accent-foreground:#e5edf7;--sidebar-border:#2e4059;--sidebar-ring:#60a5fa;
 --xf-surface:#1d2e46;--xf-hover:#21344f;--xf-blue:#8abaff;--xf-good-bg:#133c32;--xf-good:#8de0bd;--xf-warn-bg:#3c301a;--xf-warn:#f7d188;--xf-bad-bg:#402536;--xf-bad:#ffb0be;
}
html[data-xf-theme="dark"] body{background:var(--background);color:var(--foreground)}
html[data-xf-theme="dark"] ::selection{background:#315b91;color:#fff}
html[data-xf-theme="dark"] :is(.bg-white,.bg-slate-50,.bg-gray-50,.bg-slate-100,.bg-gray-100,[class*="bg-white/"],[data-slot="card"],[data-slot="dialog-content"],[data-slot="dropdown-menu-content"]){background-color:var(--card);color:var(--foreground)}
html[data-xf-theme="dark"] :is([class~="bg-[#f5f7fa]"],[class~="bg-[#eef2f6]"]){background-color:var(--background)}
html[data-xf-theme="dark"] :is(.text-slate-900,.text-slate-950,.text-gray-900,.text-slate-800,.text-gray-800){color:var(--foreground)!important}
html[data-xf-theme="dark"] :is(.text-slate-400,.text-slate-500,.text-slate-600,.text-slate-700,.text-gray-500,.text-gray-600,.text-gray-700){color:var(--muted-foreground)!important}
html[data-xf-theme="dark"] :is([class*="border-slate-"],[class*="border-gray-"]){border-color:var(--border)!important}
html[data-xf-theme="dark"] :is(.bg-blue-50,.bg-blue-100,.bg-sky-50){background:var(--accent)!important;color:var(--accent-foreground)!important}
html[data-xf-theme="dark"] :is(.text-blue-600,.text-blue-700,.text-blue-800,.text-blue-900,.text-sky-700){color:var(--xf-blue)!important}
html[data-xf-theme="dark"] :is(.bg-emerald-50,.bg-green-50){background:var(--xf-good-bg)!important;color:var(--xf-good)!important}
html[data-xf-theme="dark"] :is(.bg-amber-50,.bg-yellow-50){background:var(--xf-warn-bg)!important;color:var(--xf-warn)!important}
html[data-xf-theme="dark"] :is(.bg-rose-50,.bg-red-50){background:var(--xf-bad-bg)!important;color:var(--xf-bad)!important}
html[data-xf-theme="dark"] :is(.text-emerald-700,.text-emerald-900,.text-green-700){color:var(--xf-good)!important}
html[data-xf-theme="dark"] :is(.text-amber-700,.text-amber-900,.text-amber-950,.text-yellow-700){color:var(--xf-warn)!important}
html[data-xf-theme="dark"] :is(.text-rose-700,.text-rose-900,.text-red-700){color:var(--xf-bad)!important}
html[data-xf-theme="dark"] [data-slot="sidebar-menu-button"][data-active="true"]{background:#214b79;color:#fff!important}
html[data-xf-theme="dark"] [data-slot="sidebar-menu-button"][data-active="true"] svg{color:#fff!important}
html[data-xf-theme="dark"] :is(input,select,textarea){background-color:#111e30;color:var(--foreground);border-color:var(--input)}
html[data-xf-theme="dark"] :is(input,textarea)::placeholder{color:#91a6c0;opacity:1}
html[data-xf-theme="dark"] input[type="checkbox"]{accent-color:#3b82f6}
html[data-xf-theme="dark"] [data-slot="dropdown-menu-item"][data-highlighted]{background:var(--accent);color:var(--accent-foreground)}
html[data-xf-theme="dark"] .xf-profile-appearance [data-error="true"]{color:var(--xf-bad)}
html[data-xf-theme="dark"] .xf-theme-toggle:not([aria-checked="true"]){background:#354b68;border-color:#60738e}

/* Email has ID-specific rules: the theme matches that specificity explicitly. */
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations){--xe-fg:var(--foreground);--xe-muted:var(--muted-foreground);--xe-border:var(--border);--xe-bg:var(--background);--xe-card:var(--card);--xe-blue:var(--primary);--surface:var(--xf-surface);color-scheme:dark}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) button{background:var(--xf-surface);border-color:var(--border);color:var(--foreground)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) button:hover{background:var(--xf-hover);border-color:#597ca5}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) button.xe-primary{background:#2563eb;border-color:#3b82f6;color:#fff}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) button.xe-primary:hover{background:#1d4ed8}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) button.xe-danger{color:var(--xf-bad);border-color:#734456}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) :is(input:not([type="checkbox"]),select,textarea){background:#111e30;color:var(--foreground);border-color:var(--input)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) :is(label,.xe-eyebrow,th){color:var(--muted-foreground)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) th{background:var(--xf-surface);border-color:var(--border)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) td{border-color:#2a3b52}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) tbody tr:hover{background:#1b2c43}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-tabs button{background:transparent;color:var(--muted-foreground);border-color:transparent}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-tabs [aria-current="page"]{background:var(--accent);color:var(--accent-foreground)}
html[data-xf-theme="dark"] #xforce-email-nav [data-active="true"]{background:var(--accent);color:var(--accent-foreground)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) :is(.xe-badge,.xe-empty,code,pre){background:var(--xf-surface);color:var(--muted-foreground);border-color:var(--border)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-badge.xe-good{background:var(--xf-good-bg);color:var(--xf-good)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-badge.xe-warn{background:var(--xf-warn-bg);color:var(--xf-warn)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-badge.xe-bad{background:var(--xf-bad-bg);color:var(--xf-bad)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-notice{background:var(--accent);color:var(--accent-foreground);border-color:var(--border)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-pilot{background:var(--xf-warn-bg);color:var(--xf-warn);border-color:#665334}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) :is(.xe-notice.xe-error,.xe-form-error){background:var(--xf-bad-bg);color:var(--xf-bad);border-color:#704252}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-quota meter::-webkit-meter-bar{background:#34465e}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-quota meter::-webkit-meter-optimum-value{background:#60a5fa}
html[data-xf-theme="dark"] :is(.xd-tracker,.xd-detail){--xd-ink:var(--foreground);--xd-muted:var(--muted-foreground);--xd-line:var(--border);--xd-good:var(--xf-good);--xd-bad:var(--xf-bad);--xd-warn:var(--xf-warn);color:var(--foreground)}
html[data-xf-theme="dark"] :is(.xd-filters,.xd-summary article,.xd-table-scroll,.xd-spam-summary,.xd-response pre,.xd-timeline pre,.xl-card){background:var(--card);color:var(--foreground);border-color:var(--border)}
html[data-xf-theme="dark"] :is(.xd-detail .xd-facts dt,.xd-detail .xd-timeline time,.xd-detail .xd-symbols small,.xl-muted,.xl-table small,.xs-entries small,.xs-audit small){color:var(--muted-foreground)}
html[data-xf-theme="dark"] :is(.xd-neutral,.xd-direction,.xd-detail .xd-pill){background:var(--xf-surface);color:var(--muted-foreground);border-color:var(--border)}
html[data-xf-theme="dark"] :is(.xs-ok,.xd-good){background:var(--xf-good-bg);color:var(--xf-good);border-color:#2d5b4e}
html[data-xf-theme="dark"] :is(.xs-warning,.xs-note,.xd-warn,.xd-notice){background:var(--xf-warn-bg);color:var(--xf-warn);border-color:#665334}
html[data-xf-theme="dark"] :is(.xd-bad,.xd-error){background:var(--xf-bad-bg);color:var(--xf-bad);border-color:#704252}
html[data-xf-theme="dark"] .xd-filters :is(input,select){background:#111e30!important;color:var(--foreground)!important;border-color:var(--input)!important}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) :is(.xe-chart,.xe-flow article){background:var(--xf-surface)}
html[data-xf-theme="dark"] :is(#xforce-email-page,#xforce-email-operations) .xe-chart line{stroke:var(--border)}
html[data-xf-theme="dark"] .xd-table td .xd-dir-in{background:var(--accent);color:var(--accent-foreground)}
html[data-xf-theme="dark"] .xd-table td .xd-dir-out{background:#332c56;color:#c4b5fd}
html[data-xf-theme="dark"] :is(.xd-score-clean,.xd-negative){color:var(--xf-good)}
html[data-xf-theme="dark"] :is(.xd-score-spam,.xd-positive){color:var(--xf-bad)}
html[data-xf-theme="dark"] .xd-score-temporary{color:var(--xf-warn)}

/* Home, resource charts, infrastructure cards, dialogs and the online footer. */
html[data-xf-theme="dark"] :is(.xh-page,.xh-infra,.xh-dialog,#xforce-home-footer){--xh-ink:var(--foreground);--xh-muted:var(--muted-foreground);--xh-line:var(--border);--xh-blue:var(--xf-blue);--xh-green:var(--xf-good);--xh-violet:#b7a1ff;color:var(--foreground)}
html[data-xf-theme="dark"] .xh-page{background:var(--background)}
html[data-xf-theme="dark"] :is(.xh-card,.xh-kpi,.xh-mini,.xh-dialog){background:var(--card);border-color:var(--border);box-shadow:none}
html[data-xf-theme="dark"] :is(.xh-kpi-label,.xh-empty-state strong){color:var(--muted-foreground)}
html[data-xf-theme="dark"] .xh-btn{background:var(--xf-surface)!important;border-color:var(--border)!important;color:var(--foreground)!important}
html[data-xf-theme="dark"] .xh-btn:hover{background:var(--xf-hover)!important}
html[data-xf-theme="dark"] :is(.xh-service,.xh-event,.xh-alert-row){color:var(--foreground);border-color:#2a3b52}
html[data-xf-theme="dark"] :is(.xh-track,.xh-router-dot){background:#30435d}
html[data-xf-theme="dark"] .xh-track>span{background:#60a5fa}
html[data-xf-theme="dark"] .xh-track .xh-fill-warn{background:#e5b55d}
html[data-xf-theme="dark"] .xh-spark path{stroke:#30435d}
html[data-xf-theme="dark"] .xh-kpi>.xh-kpi-icon{background:#203e64;color:var(--xf-blue)}
html[data-xf-theme="dark"] .xh-kpi-green>.xh-kpi-icon{background:var(--xf-good-bg);color:var(--xf-good)}
html[data-xf-theme="dark"] .xh-kpi-violet>.xh-kpi-icon{background:#332c56;color:#c4b5fd}
html[data-xf-theme="dark"] .xh-kpi-red>.xh-kpi-icon{background:var(--xf-bad-bg);color:var(--xf-bad)}
html[data-xf-theme="dark"] .xh-kpi-red .xh-kpi-content>strong{color:var(--xf-bad)}
html[data-xf-theme="dark"] .xh-kpi-amber>.xh-kpi-icon{background:var(--xf-warn-bg);color:var(--xf-warn)}
html[data-xf-theme="dark"] .xh-badge{background:var(--xf-surface);color:var(--muted-foreground)}
html[data-xf-theme="dark"] :is(.xh-badge.xh-good,.xh-router-count){background:var(--xf-good-bg);color:var(--xf-good)}
html[data-xf-theme="dark"] :is(.xh-badge.xh-warn,.xh-warning){background:var(--xf-warn-bg);color:var(--xf-warn)}
html[data-xf-theme="dark"] :is(.xh-badge.xh-bad,.xh-critical,.xh-event-bad){background:var(--xf-bad-bg);color:var(--xf-bad)}
html[data-xf-theme="dark"] .xh-event-icon{background:var(--xf-surface);color:var(--xf-blue)}
html[data-xf-theme="dark"] .xh-quick-grid button{background:var(--xf-surface);color:var(--xf-blue);border-color:var(--border)}
html[data-xf-theme="dark"] .xh-quick-grid button:nth-child(2){background:var(--xf-good-bg);color:var(--xf-good);border-color:#2d5b4e}
html[data-xf-theme="dark"] .xh-quick-grid button:nth-child(3){background:#332c56;color:#c4b5fd;border-color:#4d416f}
html[data-xf-theme="dark"] .xh-dialog th{background:var(--xf-surface);color:var(--muted-foreground)}
html[data-xf-theme="dark"] .xh-notice{background:var(--xf-warn-bg);color:var(--xf-warn);border-color:#665334}
html[data-xf-theme="dark"] #xforce-home-footer{background:#17263bed;border-color:var(--border);color:var(--muted-foreground)}
html[data-xf-theme="dark"] .xh-footer-separator{background:var(--border)}

/* Existing MikroTik and user-access extensions share the same surfaces. */
html[data-xf-theme="dark"] :is(#xforce-mikrotik-page,.mt-dialog,.xforce-user-panel){background:var(--background);color:var(--foreground)}
html[data-xf-theme="dark"] :is(.mt-device-card,.mt-card,.mt-summary article,.mt-empty,.mt-company-card,.mt-panel,.mt-dialog,.mt-company-filter,.xforce-user-panel){background:var(--card);color:var(--foreground);border-color:var(--border)}
html[data-xf-theme="dark"] .mt-device-card.is-inactive{background:var(--xf-surface)}
html[data-xf-theme="dark"] .mt-lifecycle-state{background:var(--xf-good-bg);color:var(--xf-good);border-color:#2d5b4e}
html[data-xf-theme="dark"] .mt-lifecycle-state.is-inactive{background:var(--xf-surface);color:var(--muted-foreground);border-color:var(--border)}
html[data-xf-theme="dark"] :is(.mt-company-filter select,.mt-lifecycle-state span,.mt-company-filter>span){background:var(--xf-surface);color:var(--muted-foreground);border-color:var(--border)}
html[data-xf-theme="dark"] :is(#xforce-mikrotik-page,.mt-dialog) :is(th,button,input,select,textarea,pre,code){background:var(--xf-surface);color:var(--foreground);border-color:var(--border)}
html[data-xf-theme="dark"] :is(#xforce-mikrotik-page,.mt-dialog) :is(.muted,p,dt,small){color:var(--muted-foreground)}
html[data-xf-theme="dark"] :is(#xforce-mikrotik-page,.mt-dialog) button.primary{background:#2563eb;color:white}
html[data-xf-theme="dark"] :is(.mt-badge.good,.mt-summary .good){color:var(--xf-good);background:var(--xf-good-bg)}
html[data-xf-theme="dark"] :is(.mt-badge.warn,.mt-summary .warn){color:var(--xf-warn);background:var(--xf-warn-bg)}
html[data-xf-theme="dark"] :is(.mt-badge.bad,.mt-summary .bad){color:var(--xf-bad);background:var(--xf-bad-bg)}
@media(max-width:600px){.xf-profile-appearance>header,.xf-appearance-row,.xf-profile-appearance>footer{padding-left:18px;padding-right:18px}}
@media(prefers-reduced-motion:reduce){.xf-theme-toggle,.xf-theme-toggle>span{transition:none}}
@media print{.xf-theme-toggle,.xf-theme-retry{display:none}}
