/* Last palette layer: override fixed shell colors, without changing layout. */
html[data-theme]{--shell-sidebar:#323642;--shell-hover:#292d37;--shell-text:#f0f0f2;--shell-active:#ffd04b}
html[data-theme=blue]{--ui-page:#eef4ff;--shell-sidebar:#172b4d;--shell-hover:#213d65;--shell-active:#9dc8ff}
html[data-theme=green]{--ui-page:#eef7f1;--shell-sidebar:#14372d;--shell-hover:#1d4c3e;--shell-active:#96e2bc}
html[data-theme=violet]{--ui-page:#f5f0fb;--shell-sidebar:#2d2348;--shell-hover:#403262;--shell-active:#d1b7ff}
html[data-theme=rose]{--ui-page:#fcf0f5;--shell-sidebar:#402435;--shell-hover:#573047;--shell-active:#f5bbd5}
html[data-theme=sand]{--ui-page:#fbf4e8;--shell-sidebar:#403226;--shell-hover:#594533;--shell-active:#f3d29c}
html[data-theme=night]{--shell-sidebar:#11151b;--shell-hover:#242b35;--shell-active:#9ccaff}
html[data-theme] :is(body,.main,#welcome,#series42-panel,.viral-notes,.notes-overview,#resource-library){background-color:var(--ui-page)!important;color:var(--ui-text)}
html[data-theme] :is(.topbar,.card,.modal,.theme-dialog,.series42-dialog,.el-dialog,.el-select-dropdown,.el-table,.el-table__expanded-cell){background-color:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-line)!important}
html[data-theme] :is(.el-table th,.el-table td,.viral-table th,.viral-table td,.notes-table th,.notes-table td){background-color:var(--ui-surface)!important;color:var(--ui-text);border-color:var(--ui-line)!important}
html[data-theme] :is(.el-table th,.viral-table th,.notes-table th){background-color:var(--ui-surface-soft)!important}
html[data-theme] :is(input,select,textarea,.el-input__inner,.el-textarea__inner){background-color:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important;caret-color:var(--ui-text)!important}
html[data-theme] :is(.button.primary,.el-button--primary){background:var(--ui-accent)!important;border-color:var(--ui-accent)!important;color:var(--ui-on-accent)!important}
html[data-theme] :is(.button.primary,.el-button--primary):hover{background:var(--ui-accent-hover)!important;border-color:var(--ui-accent-hover)!important}
html[data-theme] :is(.el-button--text,.series42-vue-note-title,.reference-link){color:var(--ui-accent)!important}
html[data-theme] :is(.track-filter-chip[aria-pressed=true],.series42-vue-days .el-button--primary){background:var(--ui-accent-soft)!important;color:var(--ui-accent)!important;border-color:var(--ui-accent-line)!important}
html[data-theme] #sidebar{background:var(--shell-sidebar)!important;color:var(--shell-text)!important;--ui-surface:var(--shell-sidebar);--ui-text:var(--shell-text);--ui-secondary:var(--shell-text);--ui-accent:var(--shell-active)}
html[data-theme] #sidebar :is(.space-nav,.sidebar-menu-heading,.viral-submenu,.library-track-submenu){background:var(--shell-sidebar)!important}
html[data-theme] #sidebar :is(.space-nav>button,.sidebar-menu-heading>button,.viral-submenu button,.library-track-submenu button){color:var(--shell-text)!important}
html[data-theme] #sidebar :is(.space-nav>button,.sidebar-menu-heading>button,.viral-submenu button,.library-track-submenu button):hover{background:var(--shell-hover)!important}
html[data-theme] #sidebar :is(button[aria-current=page],button[aria-pressed=true]){color:var(--shell-active)!important;background:var(--shell-hover)!important}
.theme-dialog-actions{display:flex;justify-content:flex-end;gap:12px;padding-top:16px;margin-top:12px;border-top:1px solid var(--ui-line)}
.theme-dialog-actions button{min-width:100px}

/* Keep the brand panel within the selected sidebar palette. */
html[data-theme] #sidebar .sidebar-brand{background:var(--shell-sidebar)!important;color:var(--shell-text)!important;border-bottom:1px solid rgba(255,255,255,.12)!important;box-shadow:none!important}
html[data-theme] #sidebar .sidebar-brand strong{color:var(--shell-text)!important}
html[data-theme] #sidebar .sidebar-brand div>span,html[data-theme] #sidebar .sidebar-brand .icon-button{color:#c3cad6!important}
html[data-theme] #sidebar .sidebar-brand .brand-mark{background:var(--shell-hover)!important;color:var(--shell-active)!important;box-shadow:none!important}
.series42-account-tabs,.series42-account-buttons{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.series42-account-tabs .el-button+.el-button,.series42-account-buttons .el-button+.el-button{margin-left:0}
.series42-account-tabs .el-button{min-width:98px}
.series42-row-accounts{gap:5px;padding:4px 0}
.series42-row-accounts .el-button{padding:6px 8px;font-size:12px;min-width:0}
.series42-row-accounts small{width:100%;color:var(--ui-muted)}
html[data-theme] :is(.series42-account-tabs,.series42-account-buttons) button[aria-pressed=true]{background:var(--ui-accent)!important;border-color:var(--ui-accent)!important;color:var(--ui-on-accent)!important;box-shadow:0 0 0 2px var(--ui-accent-soft)}
.series42-account-buttons .el-button.is-disabled[aria-pressed=true]{opacity:.85}

/* Explicit selection contrast in the viral publishing filters. */
html[data-theme] #viral-notes .workbench-filter-matrix .track-filter-chip{background:var(--ui-surface)!important;border:1px solid var(--ui-border)!important;color:var(--ui-secondary)!important;box-shadow:none!important;font-weight:400}
html[data-theme] #viral-notes .workbench-filter-matrix .track-filter-chip:hover{border-color:var(--ui-accent)!important;color:var(--ui-accent)!important;background:var(--ui-accent-soft)!important}
html[data-theme] #viral-notes .workbench-filter-matrix .track-filter-chip[aria-pressed=true]{background:var(--ui-accent)!important;border-color:var(--ui-accent)!important;color:var(--ui-on-accent)!important;font-weight:700;box-shadow:0 0 0 3px var(--ui-accent-soft)!important}
html[data-theme] #viral-notes .workbench-filter-matrix .track-filter-chip:focus-visible{outline:2px solid var(--ui-accent);outline-offset:3px}
