/* Shared appearance controls. The light theme remains the default. */
.theme-toggle{display:inline-grid;place-items:center;flex:0 0 40px;width:40px;height:40px;padding:0;border:1px solid #c9dfd1;border-radius:10px;background:#ffffffb3;color:#326e48;font:24px/1 sans-serif;cursor:pointer}
.theme-toggle:hover{background:#e3f2e8}.theme-toggle:focus-visible{outline:3px solid #53ab76;outline-offset:3px}
.login-theme-control{display:flex;justify-content:flex-end;margin-bottom:16px}
.login-page.login-simple{display:grid;place-items:center;min-height:100dvh;padding:24px;background:linear-gradient(135deg,#fff,#e6f3e9)}
.login-page.login-simple::before{display:none}
.login-simple .login-shell{display:block;width:min(440px,100%);min-height:0}
.login-simple .login-form-side{padding:0;display:block}
.login-simple .auth-card{width:100%;max-width:none;margin:0;padding:32px;background:#ffffffed;border:1px solid #d9e9dd;border-radius:20px;box-shadow:0 16px 50px #214d3010}
.login-brand{display:flex;align-items:center;gap:14px;margin-bottom:28px;color:#264c34;font-size:16px;font-weight:600}
.login-brand img{width:82px;height:auto;filter:brightness(.65) saturate(.9)}
.login-simple .auth-card h2{font-size:25px}.login-simple .form-help{justify-content:flex-end}
@media(max-width:480px){.login-page.login-simple{padding:18px}.login-simple .auth-card{padding:26px 22px}.theme-toggle{flex-basis:36px;width:36px;height:36px}.user-portal .workspace-top{flex-wrap:wrap}.user-portal .workspace-top .top-actions{margin-left:auto}}

/* Dark surfaces and text cover both legacy admin and account components. */
html[data-theme="dark"]{color-scheme:dark;--bg:#101a16;--paper:#101a16;--white:#1a2921;--ink:#e0eee5;--muted:#a1b6a9;--line:#354a3e;--mint:#223d2e;--green-soft:#223d2e;--forest:#b2dfc2;--deep:#d8eddf;--green:#58bb7e;--green-dark:#32945c;--bright:#7cd49c;background:#101a16;color:#e0eee5}
html[data-theme="dark"] body{background:#101a16!important;color:#e0eee5}
html[data-theme="dark"] :is(.sidebar,.workspace-sidebar){background:linear-gradient(165deg,#192b21,#112019)!important;color:#d5e9dd!important;border-color:#354a3e!important;scrollbar-color:#54745f transparent}
html[data-theme="dark"] :is(.topbar,.workspace-top,.player-bar){background:#17251f!important;border-color:#354a3e!important;color:#d5e9dd!important}
html[data-theme="dark"] :is(.panel,.auth-card,.dialog-card,.modal,.modal-card,.modal-content,.studio-panel,.auto-card,.auto-section,.auto-history-item,.auto-history-card,.device-card,.stat-card,.asset-table-wrap,.source-panel,.queue-panel,.planner-meta,.favorites-panel,.favorite-voice,.ranking-row,.account-settings,.settings-section,.notification-list,.operation-list,.queue-drag-ghost){background:#1a2921!important;border-color:#354a3e!important;color:#e0eee5!important;box-shadow:0 8px 25px #00000018}
html[data-theme="dark"] :is(.welcome-panel,.welcome-strip,.insight-strip,#devicesView.ui-workspace-ready>.page-heading){background:linear-gradient(110deg,#20382a,#182b21)!important;border-color:#3e5c48!important;color:#e0eee5!important}
html[data-theme="dark"] :is(.content-block,.notice,.empty,.empty-state,.auto-empty,.auto-copy,.sidebar-card,.source-item,.queue-item,.queue-row,.device-runtime-group,.device-web-info-group,.ui-device-info,.ui-device-summary article,.notification-card,.account-overview,.settings-row,.delete-asset-name,.profile-summary,.automation-editor,.automation-page){background:#1b2e24!important;border-color:#354a3e!important;color:#d7e8de!important}
html[data-theme="dark"] :is(h1,h2,h3,h4,strong,label,dt,dd,.login-brand,.field,.studio-field,.studio-checkbox,.asset-name,.device-name,.notification-device,.settings-value,.automation-heading){color:#e0eee5!important}
html[data-theme="dark"] :is(p,small,.muted,.tiny,.eyebrow,.kicker,.nav-caption,.workspace-label,.device-id,.session-info,.breadcrumb,.save-state,.studio-count,.studio-muted,.studio-eyebrow,.auto-muted,.settings-role,.notification-footer,.notification-read,.notification-device span,.form-help,.form-note,.form-footer,.queue-authors){color:#a8c0b1!important}
html[data-theme="dark"] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),textarea,select,.control,.search){background:#111f18!important;color:#e2eee7!important;border-color:#466151!important}
html[data-theme="dark"] ::placeholder{color:#8fa99a!important;opacity:1}
html[data-theme="dark"] :is(input,textarea,select):focus{outline-color:#72ce98;border-color:#72ce98!important}
html[data-theme="dark"] input:-webkit-autofill{ -webkit-box-shadow:0 0 0 1000px #111f18 inset!important;-webkit-text-fill-color:#e2eee7!important;caret-color:#e2eee7}
html[data-theme="dark"] :is(.nav-item,.workspace-nav button,.workspace-nav a,.account-management-link,.sidebar-account button,.profile button){color:#bdd8c7!important}
html[data-theme="dark"] :is(.nav-item.active,.workspace-nav .active){background:#294d37!important;color:#e6f8ec!important;box-shadow:inset 3px 0 #70cf94!important}
html[data-theme="dark"] :is(.nav-item:hover,.workspace-nav button:hover,.workspace-nav a:hover,.account-management-link:hover){background:#233f2e!important;color:#e6f8ec!important}
html[data-theme="dark"] :is(.nav-item .icon,.workspace-nav .ui-icon,.text-button,.studio-link,.asset-rename,.dialog-close,.reveal,.password-toggle,.favorites-close){color:#83cea0!important}
html[data-theme="dark"] :is(.nav-count,.avatar,.account-avatar,.settings-avatar,.asset-icon,.wave-icon,.badge,.ready,.auto-badge,.settings-role,.password-configured){background:#294734!important;color:#a4dfb9!important}
html[data-theme="dark"] :is(.secondary,.secondary-btn,.studio-secondary,.studio-modal-close,.welcome-secondary,.icon-button,.inbox-button,.profile-button,.theme-toggle,.tabs,.device-tabs,.library-tabs,.voice-drag-handle,.automation-page button,.automation-editor button){background:#233c2d!important;color:#cee9d8!important;border-color:#486451!important}
html[data-theme="dark"] :is(.primary,.primary-btn,.studio-primary,.auto-primary,.automation-page .auto-primary,.automation-editor .auto-primary){background:#2f8050!important;color:#fff!important;border-color:#469762!important}
html[data-theme="dark"] :is(.tabs button,.device-tabs button,.library-tabs button){color:#abcbb7!important;background:transparent!important}
html[data-theme="dark"] :is(.tabs button.active,.device-tabs button.active,.library-tabs button.active,.studio-voice.selected){background:#294d37!important;color:#e2f4e8!important;border-color:#608b6e!important}
html[data-theme="dark"] :is(table,th,td){border-color:#354a3e!important;color:#c8ddcf!important}
html[data-theme="dark"] th{background:#21372a!important}
html[data-theme="dark"] tbody tr:hover{background:#223b2c!important}
html[data-theme="dark"] :is(.message,.studio-status){color:#96d4ab!important}
html[data-theme="dark"] :is(.error,.studio-error,.auto-error,.message.error,.danger-button){color:#ffb5a6!important}
html[data-theme="dark"] :is(.danger-button,.badge.fail,.notice.error){background:#482e28!important;border-color:#795046!important}
html[data-theme="dark"] :is(.badge.wait,.notification-symbol,.plan-badge){background:#493f25!important;color:#f0d498!important;border-color:#756338!important}
html[data-theme="dark"] :is(.brand-logo,.workspace-logo img,.login-brand img){filter:none}
html[data-theme="dark"] .theme-toggle:hover{background:#31553e!important}
html[data-theme="dark"] :is(.auth-tabs button,.auth-tabs button.active){color:#bddbc8!important}
html[data-theme="dark"] :is(.dialog-mask,.modal-overlay,.navigation-backdrop,.favorites-backdrop){background:#0009!important}
html[data-theme="dark"] .studio-settings::backdrop{background:#0009}
html[data-theme="dark"] .login-simple .auth-card{background:#1a2921!important}
/* Details shared by device tools, editors and dialogs. */
html[data-theme="dark"] :is(.studio-voice,.studio-sound,.studio-copy-tools,.sidebar-account,.panel-footer,.auth-tabs,.ui-workspace-tabs,.device-summary-bar,.settings-list,.notification-footer){border-color:#354a3e!important}
html[data-theme="dark"] :is(.ui-device-search,.ui-search-empty,.ui-device-tabs,.device-queue-item,.device-queue-empty,.device-queue-panel,.auto-rule,.auto-preview,.auto-confirm,.file-drop,.upload-zone,.device-empty,.queue-empty span){background:#1c3025!important;color:#c4ddce!important;border-color:#3c5645!important}
html[data-theme="dark"] :is(.ui-tab,.device-overview-meta>span,.device-card-head>span,.device-queue-heading span,.queue-status,.ui-search-count){color:#abcbb7!important}
html[data-theme="dark"] .ui-tab[aria-selected="true"]{background:#294d37!important;color:#c6efd4!important}
html[data-theme="dark"] :is(.device-queue-heading span,.queue-status){background:#294734!important}
html[data-theme="dark"] :is(.device-queue-add button,.device-queue-item button,.panel-title button,.add-slot,.add-queue,.device-meta button,.voltage-card button,.mobile-menu,.portal-menu-button){background:#233c2d!important;color:#cee9d8!important;border-color:#486451!important}
html[data-theme="dark"] .automation-page .auto-confirm .auto-danger{background:#74372f!important;color:#ffe0d9!important}
html[data-theme="dark"] :is(.automation-page,.automation-editor){background:transparent!important}
html[data-theme="dark"] :is(#autoLoopPanel,.mp3-transfer-panel,.device-overview-meta,.device-message-panel,.voltage-chart-panel,.voltage-card,.device-connect-panel,.topic-panel,.message-panel,.device-params-panel,.transfer-record,.transfer-history-card){background:#1b2e24!important;border-color:#354a3e!important;color:#c6ddcf!important}
html[data-theme="dark"] :is(#autoLoopPanel .panel-title span,.device-overview-meta span,.device-overview-meta strong,.device-card-head>span,.device-summary,.device-summary-bar,.device-location,.device-details summary,#syncState){color:#adcbb7!important}
html[data-theme="dark"] :is(.device-card-head>span,.loop-state,.device-queue-index){background:#294734!important;color:#b6d9c3!important}
html[data-theme="dark"] :is(.queue-actions button,.add-row){background:#233c2d!important;color:#cee9d8!important;border-color:#486451!important}
html[data-theme="dark"] :is(.device-overview-meta,.device-summary,.device-summary-bar,.device-details,.queue-list,.mini-metric){border-color:#354a3e!important}
html[data-theme="dark"] .ui-workspace-tabs .ui-tab[aria-selected="true"]{background:transparent!important}
html[data-theme="dark"] #devicesView.ui-workspace-ready>.page-heading .save-state{background:#294734!important}
html[data-theme="dark"] :is(.device-connect,.downlink-summary article,.downlink-log-panel,.downlink-item,.manual-http-panel,.advanced-section,.transfer-options,.device-settings,.device-settings-group,.operation-log-item,.ranking-list,.transfer-history-overview,.transfer-device-group,.transfer-history-global-empty){background:#1a2921!important;color:#d5e9dd!important;border-color:#354a3e!important}
html[data-theme="dark"] :is(.device-actions button,.message-clear,.device-local-settings-save,.transfer-history-pager button){background:#233c2d!important;color:#cee9d8!important;border-color:#486451!important}
html[data-theme="dark"] :is(summary,.device-report,.setting-description,.activity-label,.activity-note,.queue-number,.device-summary span){color:#adcbb7!important}
html[data-theme="dark"] .architecture-note code{background:#111f18!important;color:#b9d8c5!important}
/* Shared header order: sync time, theme, inbox; account access lives in the sidebar. */
.topbar .top-actions,.workspace-top .top-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-left:auto;min-width:0;flex-shrink:0}
.topbar .top-actions #syncState,.workspace-top .top-actions #syncState{display:block;font-size:12px;color:#607e6a;white-space:normal;max-width:240px;line-height:1.5;text-align:right}
.top-actions .inbox-button{position:relative;display:inline-flex;align-items:center;justify-content:center;flex:0 0 40px;width:40px;height:40px;min-height:40px;border:1px solid #c9dfd1;border-radius:10px;background:#ffffffb3;color:#326e48;text-decoration:none;padding:0}
.top-actions .inbox-button svg{width:21px;height:21px}
.top-actions .inbox-count{position:absolute;top:-7px;right:-7px;min-width:18px;height:18px;padding:0 4px;border-radius:12px;background:#b45437;color:white;border:2px solid white;font-size:10px;line-height:14px;text-align:center}
.top-actions .inbox-unavailable{border-color:#bd8b4a}
.sidebar-account-link{display:flex;align-items:center;gap:10px;flex:1;min-width:0;padding:6px 2px;border-radius:8px;text-decoration:none;color:inherit}
.sidebar-account-link>div{min-width:0}.sidebar-account-link:hover{background:#cce6d84d}
.sidebar-account-link:focus-visible{outline:3px solid #53ab76;outline-offset:3px}
.sidebar-account-link .avatar,.sidebar-account-link .account-avatar,#currentActor{flex-shrink:0}
html[data-theme="dark"] .sidebar-account-link:hover{background:#294d37}
@media(max-width:760px){
 .topbar,.workspace-top,.user-portal .workspace-top{height:auto;min-height:72px;display:flex;flex-wrap:wrap;gap:10px;padding:12px 18px}
 .topbar .top-actions,.workspace-top .top-actions{flex-basis:100%;gap:12px}
 .top-actions .theme-toggle{width:40px;height:40px;flex-basis:40px}
 .workspace-top[data-admin-header]>span{max-width:none}
}
