/* Application-only semantic colours. Document canvases opt out with data-wsd-document. */
html[data-wsd-theme] {
 --bg-page:#f8fafc; --bg-surface:#fff; --bg-surface-secondary:#f1f5f9; --bg-sidebar:#fff; --bg-navbar:#fff;
 --text-primary:#172033; --text-secondary:#475569; --text-muted:#58677c; --text-disabled:#64748b; --text-inverse:#fff;
 --border-primary:#cbd5e1; --border-subtle:#e2e8f0; --input-bg:#fff; --input-border:#94a3b8;
 --table-header-bg:#f1f5f9; --table-row-bg:#fff; --table-row-hover:#eef2ff;
 --button-primary-bg:var(--company-primary,#5b5cf6); --button-primary-hover:var(--company-primary-hover,#4d4ee0);
 --focus-ring:#7778ff; --link-color:#5045bd;
 --success:#166534; --success-bg:#dcfce7; --warning:#854d0e; --warning-bg:#fef3c7;
 --danger:#991b1b; --danger-bg:#fee2e2; --info:#1e40af; --info-bg:#dbeafe;
 --bs-body-bg:var(--bg-page); --bs-body-color:var(--text-primary); --bs-secondary-color:var(--text-secondary);
 --bs-border-color:var(--border-primary); --bs-tertiary-bg:var(--bg-surface-secondary);
 min-height:100%; background:var(--bg-page); color:var(--text-primary);
}
html[data-wsd-theme="dark"] {
 --bg-page:#101725; --bg-surface:#1c2636; --bg-surface-secondary:#273346; --bg-sidebar:#192333; --bg-navbar:#192333;
 --text-primary:#f1f5fb; --text-secondary:#c1ccdc; --text-muted:#aab8cc; --text-disabled:#92a0b5;
 --border-primary:#4b5a70; --border-subtle:#344257; --input-bg:#131e2e; --input-border:#596b83;
 --table-header-bg:#273346; --table-row-bg:#1c2636; --table-row-hover:#303d53; --link-color:#c0b8ff; --focus-ring:#a7a3ff;
 --success:#9be7be; --success-bg:#153e32; --warning:#f6d789; --warning-bg:#483718;
 --danger:#ffb4b4; --danger-bg:#50232d; --info:#b3d5ff; --info-bg:#203c60;
}
html[data-wsd-theme] body, html[data-wsd-theme] body[class] {margin:0; min-height:100vh; background:var(--bg-page); color:var(--text-primary);}
html[data-wsd-theme] #main-content,html[data-wsd-theme] body > .flex.overflow-hidden {min-height:calc(100vh - 62px); background:var(--bg-page); color:var(--text-primary);}
html[data-wsd-theme] body > nav {background:var(--bg-navbar); border-color:var(--border-subtle);}
html[data-wsd-theme] #sidebar,html[data-wsd-theme] #sidebar > div {background:var(--bg-sidebar);}
.wsd-appearance {display:inline-flex; align-items:center; gap:.4rem; font-size:.75rem; color:var(--text-secondary);}
.wsd-appearance select {width:auto; min-height:36px; padding:.35rem 1.8rem .35rem .55rem; border:1px solid var(--border-primary); border-radius:.5rem; background-color:var(--input-bg); color:var(--text-primary);}
@media(max-width:1100px) {.wsd-appearance-label {position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%);}}
html[data-wsd-theme] :is(button,a,input,select,textarea):focus-visible:not(:where([data-wsd-document],[data-wsd-document] *)) {outline:2px solid var(--focus-ring); outline-offset:3px;}
html[data-wsd-theme] :is(input,select,textarea,button):disabled:not(:where([data-wsd-document],[data-wsd-document] *)) {opacity:.7; cursor:not-allowed;}
/* Central adapters for the existing Tailwind/Flowbite and Bootstrap components. */
html[data-wsd-theme="dark"] :is(.bg-white,.bg-gray-50,.bg-gray-100,.bg-slate-50,.bg-slate-100,.bg-light,.card,.modal-content,.dropdown-menu,.swal2-popup):not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--bg-surface); color:var(--text-primary);}
html[data-wsd-theme="dark"] :is(.bg-gray-200,.bg-gray-700,.bg-slate-200):not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--bg-surface-secondary);}
html[data-wsd-theme="dark"] :is(.text-black,.text-gray-900,.text-gray-800,.text-gray-700,.text-slate-900,.text-slate-800,.text-dark):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--text-primary);}
html[data-wsd-theme="dark"] :is(.text-gray-600,.text-gray-500,.text-gray-400,.text-slate-600,.text-slate-500,.text-muted):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--text-muted);}
html[data-wsd-theme="dark"] :is(.border-gray-100,.border-gray-200,.border-gray-300,.border-gray-600,.border-gray-700,.border-slate-200,.divide-gray-200 > * + *):not(:where([data-wsd-document],[data-wsd-document] *)) {border-color:var(--border-subtle);}
html[data-wsd-theme] :is(.form-control,.form-select,input:not([type=checkbox],[type=radio],[type=range],[type=hidden],[type=submit],[type=button],[type=color]),select,textarea):not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--input-bg); color:var(--text-primary); border-color:var(--input-border);}
html[data-wsd-theme] :is(input,textarea)::placeholder:not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--text-muted); opacity:1;}
html[data-wsd-theme] :is(input[type=checkbox],input[type=radio]):not(:where([data-wsd-document],[data-wsd-document] *)) {accent-color:var(--button-primary-bg);}
html[data-wsd-theme] input:autofill {box-shadow:0 0 0 100px var(--input-bg) inset; -webkit-text-fill-color:var(--text-primary);}
html[data-wsd-theme] :is(.vault-listing,.table):not(:where([data-wsd-document] *)) {color:var(--text-primary); --bs-table-bg:var(--table-row-bg); --bs-table-color:var(--text-primary); --bs-table-hover-bg:var(--table-row-hover);}
html[data-wsd-theme] thead:not(:where([data-wsd-document] *)) {background-color:var(--table-header-bg); color:var(--text-secondary);}
html[data-wsd-theme] :is(.vault-listing tbody tr,.table tbody tr):hover:not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--table-row-hover);}
html[data-wsd-theme="dark"] :is(.hover\:bg-gray-50,.hover\:bg-gray-100,.hover\:bg-gray-200):hover:not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--table-row-hover);}
html[data-wsd-theme="dark"] :is(.swal2-title,.swal2-html-container,.dropdown-item,.modal-title):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--text-primary);}
html[data-wsd-theme="dark"] :is(.btn-secondary,.btn-outline-secondary):not(:where([data-wsd-document],[data-wsd-document] *)) {background:var(--bg-surface-secondary); color:var(--text-primary); border-color:var(--border-primary);}
html[data-wsd-theme="dark"] :is(.bg-green-50,.bg-green-100,.bg-emerald-50,.bg-emerald-100,.alert-success):not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--success-bg); color:var(--success);}
html[data-wsd-theme="dark"] :is(.text-green-600,.text-green-700,.text-green-800,.text-green-900,.text-green-950,.text-emerald-600,.text-emerald-700,.text-emerald-800,.text-emerald-900,.text-emerald-950):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--success);}
html[data-wsd-theme="dark"] :is(.bg-yellow-50,.bg-yellow-100,.bg-amber-50,.bg-amber-100,.alert-warning):not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--warning-bg); color:var(--warning);}
html[data-wsd-theme="dark"] :is(.text-yellow-600,.text-yellow-700,.text-yellow-800,.text-yellow-900,.text-yellow-950,.text-amber-600,.text-amber-700,.text-amber-800,.text-amber-900,.text-amber-950):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--warning);}
html[data-wsd-theme="dark"] :is(.bg-red-50,.bg-red-100,.bg-rose-50,.bg-rose-100,.alert-danger):not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--danger-bg); color:var(--danger);}
html[data-wsd-theme="dark"] :is(.text-red-600,.text-red-700,.text-red-800,.text-red-900,.text-red-950,.text-rose-600,.text-rose-700,.text-rose-800,.text-rose-900,.text-rose-950):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--danger);}
html[data-wsd-theme="dark"] :is(.bg-blue-50,.bg-blue-100,.bg-indigo-50,.bg-indigo-100,.alert-info):not(:where([data-wsd-document],[data-wsd-document] *)) {background-color:var(--info-bg); color:var(--info);}
html[data-wsd-theme="dark"] :is(.text-blue-600,.text-blue-700,.text-blue-800,.text-blue-900,.text-blue-950,.text-indigo-600,.text-indigo-700,.text-indigo-800,.text-indigo-900,.text-indigo-950):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--info);}

html[data-wsd-theme] [data-wsd-document] {background:#fff; color:#172033; color-scheme:light;}

/* Links are lighter than the action fill in dark mode. Inverse button labels stay white. */
html[data-wsd-theme="dark"] :is(.text-primary-500,.text-primary-600,.text-primary-700,.text-primary-800):not([class*="bg-primary-"]):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--link-color);}
html[data-wsd-theme] [data-wsd-theme-status]:not(.sr-only) {position:fixed;right:1rem;top:4.5rem;max-width:22rem;padding:1rem;border:1px solid var(--border-primary);border-radius:.75rem;background:var(--bg-surface);color:var(--text-primary);z-index:100;box-shadow:0 4px 20px #0003;}

@media(max-width:639px) {html[data-wsd-theme] .wsd-app-title {font-size:1rem;max-width:9rem;overflow:hidden;text-overflow:ellipsis;} html[data-wsd-theme] #accountDropdown .wsd-appearance-label {position:static;width:auto;height:auto;clip-path:none;}}

@media(max-width:639px) {.wsd-quick-appearance {display:none;}}

/* Authentication is part of the application; keep redirect/sign-in appearance consistent. */
html[data-wsd-theme] .auth-page {background:var(--bg-page);color:var(--text-primary);}
html[data-wsd-theme] .auth-card {background:var(--bg-surface);color:var(--text-primary);}
html[data-wsd-theme] :is(.auth-title,.auth-field label,.auth-content label,.auth-content):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--text-primary);}
html[data-wsd-theme] :is(.auth-description,.auth-secondary,.auth-footer):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--text-muted);}
html[data-wsd-theme] .auth-readonly {background:var(--bg-surface-secondary);}
html[data-wsd-theme] :is(.auth-description a,.auth-secondary a,.auth-content a):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--link-color);}
html[data-wsd-theme] :is(.auth-error,.auth-content .errorlist):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--danger);}
html[data-wsd-theme] .auth-alert {background:var(--danger-bg);color:var(--danger);border-color:var(--danger);}
html[data-wsd-theme] .auth-alert--success {background:var(--success-bg);color:var(--success);border-color:var(--success);}
html[data-wsd-theme] .auth-alert--warning {background:var(--warning-bg);color:var(--warning);border-color:var(--warning);}

html[data-wsd-theme] :is(.text-gray-400,.text-gray-500):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--text-muted);}
html[data-wsd-theme="light"] :is(.text-primary-500,.text-primary-600,.text-primary-700,.text-primary-800):not([class*="bg-primary-7"],[class*="bg-primary-6"]):not(:where([data-wsd-document],[data-wsd-document] *)) {color:var(--link-color);}
html[data-wsd-theme="dark"] .outlook-brand-link {color:var(--link-color);}
