/* Theme final repair: presentation-only, layered after all module styles.
   Uses the active preset variables from wl-branding.js; never modifies module logic. */
html.wl-theme-active {
 --wl-action:var(--wl-theme-primary);--wl-action-text:var(--wl-theme-on-primary);
 --wl-secondary:var(--wl-theme-surface);--wl-secondary-text:var(--wl-theme-fg);
 --wl-line:var(--wl-theme-border);--wl-page:var(--wl-theme-bg);
}
html.wl-theme-active body,html.wl-theme-active .shell {background:var(--wl-page);color:var(--wl-theme-fg)}
html.wl-theme-active .content :is(.wl-dashboard,.wl-heading,.wl-filter,.wl-panel,.wl-summary,.wl-kpis,.wl-kpi,.wl-total,.wl-tabs,.wl-pills,.wl-viewbar,.hr-root,.fin-root,.pm-root,.fu-root,.wps-wrap,.lead-root) {color:var(--wl-theme-fg)}
html.wl-theme-active .content :is(.wl-dashboard,.wl-heading,.wl-panel,.wl-kpi,.wl-tabs,.wl-filter,.hr-root,.fin-root,.pm-root,.fu-root,.wps-wrap) :is(h1,h2,h3,h4,h5,h6,label,strong):not(.wl-total strong):not(.wl-kpi strong){color:var(--wl-theme-fg)}
html.wl-theme-active .content :is(.wl-heading p,.wl-eyebrow,.wl-kpi small,.wl-kpi span,.wl-panel p,.wps-head p,.wps-panel p,.hr-card small,.fin-card small,.pm-card small,.fu-card small){color:var(--wl-theme-muted)}
/* Common surfaces and KPI tiles */
html.wl-theme-active .content :is(.wl-kpi,.wl-panel,.wl-filter,.wl-chart-center,.wl-legend,.wl-summary .wl-kpis>div,.hr-card,.hr-panel,.hr-person,.hr-stats>div,.fin-panel,.fin-card,.fin-stats article,.pm-panel,.pm-card,.fu-panel,.fu-card,.fu-health,.fu-project-section,.wps-panel,.wps-summary>div,.lead-card,.lead-filters,.lead-list,.lead-modal-panel){background:var(--wl-theme-surface)!important;color:var(--wl-theme-fg)!important;border-color:var(--wl-line)!important}
html.wl-theme-active .content :is(.wl-total,.hero-total){background:var(--wl-action)!important;color:var(--wl-action-text)!important;border-color:var(--wl-action)!important}
html.wl-theme-active .content :is(.wl-total,.hero-total) :is(span,strong,small,p){color:var(--wl-action-text)!important}
html.wl-theme-active .content :is(.wl-kpi,.wl-panel,.hr-card,.fin-card,.pm-card,.fu-card,.wps-panel,.lead-card) :is(strong,h1,h2,h3,h4){color:var(--wl-theme-fg)!important}
/* All primary actions, including modules which use bare buttons. */
html.wl-theme-active .content :is(.wl-quick-actions button,.wl-report button[type=submit],.wl-custom button,.wl-apply,.wl-dashboard .primary,.hr-btn.primary,.fin-primary,.fin-top button.active,.fin-actions button:first-child,.pm-primary,.pm-root .pm-primary,.fu-actions button[type=submit],.fu-card button,.lead-toolbar button,.lead-form-actions button:first-child,.lead-modal form>button,.wps-form .wps-primary,.wps-primary,.wps-wrap button[type=submit]):not(:disabled):not(.danger):not(.delete){background:var(--wl-action)!important;color:var(--wl-action-text)!important;border-color:var(--wl-action)!important}
html.wl-theme-active .content :is(.wl-quick-actions button,.wl-report button[type=submit],.wl-custom button,.hr-btn.primary,.fin-primary,.fin-actions button:first-child,.pm-primary,.fu-actions button[type=submit],.fu-card button,.lead-toolbar button,.lead-form-actions button:first-child,.wps-primary,.wps-wrap button[type=submit]):not(:disabled):hover{background:var(--wl-theme-hover)!important;color:var(--wl-action-text)!important;border-color:var(--wl-theme-accent)!important}
/* Secondary and selected navigation states across dashboard, HR, finance, follow-ups and property. */
html.wl-theme-active .content :is(.wl-tabs button,.wl-pills button,.wl-viewbar button,.dash-view-btn,.hr-tabs button,.hr-tabs span,.fin-tabs button,.fin-legacy-root-tabs button,.fin-legacy-entries button,.pm-tabs button,.fu-tabs button,.wps-wrap button,.wl-dashboard .secondary,.pm-btn,.hr-btn,.fin-btn,.fu-secondary,.fu-back):not(.primary):not(.fin-primary):not(.wps-primary):not(.danger):not(.delete){background:var(--wl-secondary)!important;color:var(--wl-secondary-text)!important;border-color:var(--wl-line)!important}
html.wl-theme-active .content :is(.wl-tabs button,.wl-pills button,.wl-viewbar button,.dash-view-btn,.hr-tabs button,.hr-tabs span,.fin-tabs button,.fin-legacy-root-tabs button,.fin-legacy-entries button,.pm-tabs button,.fu-tabs button):is(.selected,.active,[aria-selected="true"]){background:var(--wl-action)!important;color:var(--wl-action-text)!important;border-color:var(--wl-theme-accent)!important}
html.wl-theme-active .content :is(.wl-tabs button,.wl-pills button,.wl-viewbar button,.hr-tabs button,.fin-tabs button,.pm-tabs button,.fu-tabs button,.wps-wrap button):not(:disabled):hover{border-color:var(--wl-theme-accent)!important;box-shadow:inset 0 0 0 1px var(--wl-theme-accent)}
/* Project settings is a distinct namespace, not covered by generic panel selectors. */
html.wl-theme-active .content :is(.wps-wrap,.wps-wrap h1,.wps-wrap h2,.wps-wrap h3,.wps-wrap label,.wps-wrap strong){color:var(--wl-theme-fg)!important}
html.wl-theme-active .content :is(.wps-form input,.wps-form select,.wps-filters input,.wps-filters select,.wps-wrap textarea){background:var(--wl-theme-surface)!important;color:var(--wl-theme-fg)!important;border-color:var(--wl-line)!important}
html.wl-theme-active .content .wps-form .wps-primary{background:var(--wl-action)!important;color:var(--wl-action-text)!important;border-color:var(--wl-action)!important}
html.wl-theme-active .content :is(.wps-th,.fu-table thead,.hr-table th){background:var(--wl-theme-selection)!important;color:var(--wl-theme-fg)!important;border-color:var(--wl-line)!important}
/* Sidebar selection and mobile navigation use same accent/contrast. */
html.wl-theme-active #sidebar .nav-btn.active{background:var(--wl-theme-selection)!important;color:var(--wl-theme-fg)!important;box-shadow:inset 4px 0 var(--wl-theme-accent)!important}
html.wl-theme-active #sidebar .nav-btn:hover:not(.active){background:var(--wl-theme-hover)!important;color:var(--wl-theme-on-primary)!important}
html.wl-theme-active #wlBottomNav button.active{color:var(--wl-theme-primary)!important;border-color:var(--wl-theme-accent)!important}
/* Inputs and visible focus without touching color pickers, status indicators or chart colors. */
html.wl-theme-active .content :is(input:not([type=color]):not([type=checkbox]):not([type=radio]),select,textarea){border-color:var(--wl-line)!important;color:var(--wl-theme-fg)!important;background:var(--wl-theme-surface)!important}
html.wl-theme-active .content :is(button,a,input,select,textarea):focus-visible{outline:2px solid var(--wl-theme-accent)!important;outline-offset:2px}
/* Theme editor preview should remain within its column on all widths. */
html.wl-theme-active .tb-columns>*{min-width:0}
html.wl-theme-active .tb-preview,.tb-mock,.tb-mock-layout,.tb-mock-layout article{min-width:0;max-width:100%;overflow-wrap:anywhere}
html.wl-theme-active .tb-mock-layout article{overflow:hidden}
html.wl-theme-active .tb-mock :is(.tb-mock-card,.tb-mock-mini,.tb-mock-login){max-width:100%;min-width:0}
@media(max-width:900px){html.wl-theme-active .tb-columns{grid-template-columns:minmax(0,1fr)!important}}
