/* Shared semantic tokens. Specific root selector overrides legacy forced dark tokens. */
html[data-theme="dark"],html[data-theme="dark"] body{
 --ba-background:#090a0f;--ba-surface:#111319;--ba-surface-raised:#1b1e28;--ba-input:#101218;--ba-border:#2c303b;--ba-text:#f0f1f6;--ba-muted:#a7adbd;--ba-primary:#a3a1ff;--ba-secondary:#8dbfee;--ba-success:#7adeb6;--ba-warning:#efc579;--ba-danger:#ffadb6;--ba-media:#090c16;--ba-document:#151c2bf5;--ba-art-border:#7c8caf66;--ba-shadow:0 10px 28px #0002;color-scheme:dark;
}
html[data-theme="light"],html[data-theme="light"] body{
 --ba-background:#f6f7fb;--ba-surface:#fff;--ba-surface-raised:#eef0f7;--ba-input:#fff;--ba-border:#d1d6e2;--ba-text:#1b2031;--ba-muted:#586278;--ba-primary:#5542c5;--ba-secondary:#256494;--ba-success:#167154;--ba-warning:#855008;--ba-danger:#b12743;--ba-media:#e9edf7;--ba-document:#fcfdfff5;--ba-art-border:#7c8caf66;--ba-shadow:0 10px 28px #25345909;color-scheme:light;
}
html[data-theme],html[data-theme] body{--ba-ai-gradient:linear-gradient(110deg,#176aab,#6353cf 55%,#9950b3);--bg:var(--ba-background);--bg-card:var(--ba-surface);--bg-sidebar:var(--ba-background);--bg-sidebar-hover:var(--ba-surface-raised);--text:var(--ba-text);--text-secondary:var(--ba-muted);--text-light:var(--ba-muted);--text-sidebar:var(--ba-muted);--text-sidebar-active:var(--ba-text);--border:var(--ba-border);--border-light:var(--ba-border);--primary:var(--ba-primary);--muted:var(--ba-muted);--success:var(--ba-success);--danger:var(--ba-danger);--warning:var(--ba-warning);background:var(--ba-background);color:var(--ba-text)}
html[data-theme] :is(input,select,textarea){background:var(--ba-input);color:var(--ba-text);border-color:var(--ba-border)}html[data-theme] input::placeholder,html[data-theme] textarea::placeholder{color:var(--ba-muted);opacity:1}html[data-theme] :focus-visible{outline:2px solid var(--ba-primary);outline-offset:4px}html[data-theme] .nav-item.active{background:var(--ba-surface-raised);color:var(--ba-text);box-shadow:inset 3px 0 var(--ba-primary)}html[data-theme] :is(.sidebar,.topbar,.top-bar,.top-header){border-color:var(--ba-border);box-shadow:none}html[data-theme] .btn-primary{background:var(--ba-ai-gradient);color:#fff}html[data-theme] button:disabled{opacity:.5;cursor:not-allowed}
.ba-theme-switch{position:fixed;top:22px;right:26px;z-index:50;display:flex;padding:4px;gap:3px;border:1px solid var(--ba-border);border-radius:12px;background:var(--ba-background)}html[data-theme] .ba-theme-switch button{min-height:34px;padding:5px 11px;border:0;border-radius:8px;background:none;color:var(--ba-muted);font-size:12px;box-shadow:none}html[data-theme] .ba-theme-switch button[aria-pressed="true"]{background:var(--ba-surface-raised);color:var(--ba-text)}body:has(#app:not(.hidden)) .ba-theme-switch{top:auto;bottom:20px;right:20px}
html[data-theme] .auth-page{background:var(--ba-background)}html[data-theme] .auth-card{background:var(--ba-surface);color:var(--ba-text)}
/* Standalone platform shell shares tokens, not enterprise role semantics. */
html[data-theme] body.platform-theme header{background:var(--ba-background);border-color:var(--ba-border)}html[data-theme] body.platform-theme :is(.card,.operator-confirm){background:var(--ba-surface);border-color:var(--ba-border);box-shadow:none}html[data-theme] body.platform-theme :is(a,.muted,small,header span){color:var(--ba-muted)}html[data-theme] body.platform-theme :is(th,td){border-color:var(--ba-border)}html[data-theme] body.platform-theme button{background:var(--ba-ai-gradient);color:white}html[data-theme] body.platform-theme .notice{background:var(--ba-surface-raised);color:var(--ba-warning);border-color:var(--ba-border)}body.platform-theme header{padding-right:180px}
body:has(#appLayout:not(.hidden)) .ba-theme-switch{top:auto;bottom:20px;right:20px}html[data-theme] .ba-theme-switch button{background:none;color:var(--ba-muted)}html[data-theme] .ba-theme-switch button[aria-pressed="true"]{background:var(--ba-surface-raised);color:var(--ba-text)}
@media(max-width:800px){.ba-theme-switch{top:18px;right:20px}body.platform-theme header{padding-top:76px;padding-right:16px}}
html[data-theme] .ba-theme-switch button{background:none!important;color:var(--ba-muted)!important}html[data-theme] .ba-theme-switch button[aria-pressed="true"]{background:var(--ba-surface-raised)!important;color:var(--ba-text)!important;box-shadow:inset 0 0 0 1px var(--ba-border)}
html[data-theme] .sidebar :is(.logo-text,.sidebar-logo,.sidebar-brand,.brand){color:var(--ba-text)}html[data-theme] .sidebar .version{color:var(--ba-muted)}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
