/* Unified Theme V1: presentation only. Presets are authoritative from branding API.
   No module event handlers, records, permissions or status meanings are changed. */
html.wl-theme-active {
  --wl-theme-button-text:var(--wl-theme-on-primary);
  color-scheme:normal;
}
html.wl-theme-active[data-wl-theme-mode="dark"] {color-scheme:dark}
html.wl-theme-active :is(body,.main,.content){color:var(--wl-theme-fg)}
html.wl-theme-active :is(.main,.content){background:var(--wl-theme-bg)!important}
html.wl-theme-active :is(.topbar,.side-top){border-color:var(--wl-theme-border)!important}
html.wl-theme-active .topbar{background:var(--wl-theme-surface)!important;color:var(--wl-theme-fg)!important}
html.wl-theme-active .topbar :is(.crumb,.crumb b,.live){color:var(--wl-theme-fg)!important}
html.wl-theme-active #sidebar{background:var(--wl-theme-primary)!important;color:var(--wl-theme-on-primary)!important}
html.wl-theme-active #sidebar :is(.nav-btn,.side-top,.side-footer,.user-meta,.nav-group){color:var(--wl-theme-on-primary)!important}
html.wl-theme-active #sidebar .nav-btn:hover{background:var(--wl-theme-hover)!important;color:var(--wl-theme-on-primary)!important}
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}
/* Heading, captions and secondary copy, including frozen Dashboard modules. */
html.wl-theme-active .content :is(h1,h2,h3,h4,h5,h6,.dash-heading,.lead-heading,.fu-heading,.pm-head,.hr-heading,.fin-heading){color:var(--wl-theme-fg)!important}
html.wl-theme-active .content :is(.page-head p,.dash-subtitle,.dash-kicker,.dash-eyebrow,.hint,.muted,.subtext,.pm-subtitle,.fu-subtitle,.hr-hint){color:var(--wl-theme-muted)!important}
/* Panels and KPI tiles retain their layout, but use the same active palette. */
html.wl-theme-active .content :is(.panel,.card,.stat,.stat-card,.kpi-card,.metric-card,.status-tile,.dash-status-grid .status-tile,.hero-total,.dash-top-grid .hero-total,.module-card,.feature-card,.module-summary,.lead-card,.lead-filters,.lead-list,.lead-list-heading,.lead-modal-panel,.fu-panel,.fu-card,.fu-project-section,.fu-project-row,.fu-project-stat,.hr-panel,.hr-card,.hr-person,.pm-panel,.pm-card,.pm-home-btn,.fin-card,.fin-overview,.fin-my-deal,.fin-modal,.wl-card,.wl-panel,.tb-card):not(.tb-card){background:var(--wl-theme-surface)!important;color:var(--wl-theme-fg)!important;border-color:var(--wl-theme-border)!important}
html.wl-theme-active .content :is(.hero-total,.dash-top-grid .hero-total){background:var(--wl-theme-primary)!important;color:var(--wl-theme-on-primary)!important}
html.wl-theme-active .content :is(.hero-total,.dash-top-grid .hero-total) :is(h1,h2,h3,h4,strong,small,span,p){color:var(--wl-theme-on-primary)!important}
html.wl-theme-active .content :is(.dash-status-grid,.dash-metrics,.fu-metrics,.hr-stats,.pm-stats,.fin-stats) :is(h1,h2,h3,h4,strong,b){color:var(--wl-theme-fg)!important}
html.wl-theme-active .content :is(.dash-status-grid,.dash-metrics,.fu-metrics,.hr-stats,.pm-stats,.fin-stats) :is(p,small,.hint){color:var(--wl-theme-muted)!important}
/* Buttons: explicit primary and selected states; secondary is surface with accent border.
   Do not recolor destructive/status-specific buttons or semantic status badges. */
html.wl-theme-active .content :is(button,.primary,.btn,.hr-btn,.pm-btn,.fin-btn,.fu-btn,.lead-toolbar button,.lead-actions button,.lead-actions a,.tb-btn):not(.tb-btn):not(.danger):not(.delete):not([data-danger]):not(:disabled){border-color:var(--wl-theme-border);transition:background-color .18s ease,color .18s ease,border-color .18s ease,box-shadow .18s ease}
html.wl-theme-active .content :is(.primary,button.primary,.btn-primary,.hr-btn.primary,.pm-btn.primary,.fin-btn.primary,.fu-btn.primary,.lead-toolbar button,.dash-quick button,.dash-quick .primary):not(.danger):not(.delete):not(:disabled){background:var(--wl-theme-primary)!important;color:var(--wl-theme-on-primary)!important;border-color:var(--wl-theme-primary)!important}
html.wl-theme-active .content :is(.primary,button.primary,.btn-primary,.hr-btn.primary,.pm-btn.primary,.fin-btn.primary,.fu-btn.primary,.lead-toolbar button,.dash-quick button,.dash-quick .primary):not(.danger):not(.delete):not(:disabled):hover{background:var(--wl-theme-hover)!important;color:var(--wl-theme-on-primary)!important;border-color:var(--wl-theme-accent)!important}
html.wl-theme-active .content :is(.dash-tabs button,.dash-filters button,.dash-periods button,.fu-tabs button,.fu-actions button,.hr-tabs button,.pm-tabs button,.fin-tabs button,.lead-pagination button,.module-filter button,.filter-grid button,.function-list button):not(.danger):not(:disabled){background:var(--wl-theme-surface)!important;color:var(--wl-theme-fg)!important;border:1px solid var(--wl-theme-border)!important}
html.wl-theme-active .content :is(.dash-tabs button,.dash-filters button,.dash-periods button,.fu-tabs button,.fu-actions button,.hr-tabs button,.pm-tabs button,.fin-tabs button,.lead-pagination button,.module-filter button,.filter-grid button,.function-list button):is(.active,.selected,[aria-selected="true"]):not(:disabled){background:var(--wl-theme-primary)!important;color:var(--wl-theme-on-primary)!important;border-color:var(--wl-theme-accent)!important}
html.wl-theme-active .content :is(.dash-tabs button,.dash-filters button,.dash-periods button,.fu-tabs button,.fu-actions button,.hr-tabs button,.pm-tabs button,.fin-tabs button,.lead-pagination button,.module-filter button,.filter-grid button,.function-list button):not(:disabled):hover{border-color:var(--wl-theme-accent)!important;box-shadow:0 0 0 1px var(--wl-theme-accent)}
/* Controls and tables, scoped to CRM, excluding theme editor and semantic badges. */
html.wl-theme-active .content :is(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),select,textarea):not(.tb-fields input):not(.tb-fields select){background:var(--wl-theme-surface)!important;color:var(--wl-theme-fg)!important;border-color:var(--wl-theme-border)!important}
html.wl-theme-active .content :is(input,textarea)::placeholder{color:var(--wl-theme-muted)!important;opacity:1}
html.wl-theme-active .content :is(.data-table,.fu-table,.hr-table,.fin-table,.pm-table,table):not(.tb-table){color:var(--wl-theme-fg);border-color:var(--wl-theme-border)}
html.wl-theme-active .content :is(.data-table,.fu-table,.hr-table,.fin-table,.pm-table,table):not(.tb-table) :is(th,td){border-color:var(--wl-theme-border)}
html.wl-theme-active .content :is(.data-table,.fu-table,.hr-table,.fin-table,.pm-table,table):not(.tb-table) th{background:var(--wl-theme-selection);color:var(--wl-theme-fg)}
html.wl-theme-active .content :is(.data-table,.fu-table,.hr-table,.fin-table,.pm-table,table):not(.tb-table) td{background:var(--wl-theme-surface);color:var(--wl-theme-fg)}
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 is always legible and its mock must match the selected palette. */
html.wl-theme-active .content .tb-wrap{color:var(--wl-theme-fg)}
html.wl-theme-active .content .tb-card{background:var(--wl-theme-surface)!important;color:var(--wl-theme-fg)!important;border-color:var(--wl-theme-border)!important}
html.wl-theme-active .content .tb-preset{background:var(--wl-theme-surface);color:var(--wl-theme-fg);border-color:var(--wl-theme-border)}
html.wl-theme-active .content .tb-preset.selected{border-color:var(--wl-theme-accent);box-shadow:inset 0 0 0 1px var(--wl-theme-accent)}
html.wl-theme-active .content .tb-btn.primary{background:var(--wl-theme-primary)!important;color:var(--wl-theme-on-primary)!important;border-color:var(--wl-theme-primary)!important}
html.wl-theme-active .content .tb-btn:not(.primary){background:var(--wl-theme-surface);color:var(--wl-theme-fg);border-color:var(--wl-theme-border)}
html.wl-theme-active .content .tb-fields :is(input,select){background:var(--wl-theme-surface);color:var(--wl-theme-fg);border-color:var(--wl-theme-border)}
.tb-mock{color:var(--mt)!important;background:var(--mb)!important}
.tb-mock .tb-mock-card,.tb-mock .tb-mock-mini,.tb-mock .tb-mock-login{color:var(--mt)!important;background:var(--ms)!important}
.tb-mock .tb-mock-card :is(h3,p),.tb-mock .tb-mock-login :is(b,p){color:var(--mt)!important}
.tb-mock .tb-mock-top,.tb-mock .tb-mock-nav{color:#fff!important;background:var(--mp)!important}
.tb-mock :is(button){color:#191919!important;background:var(--ma)!important}
@media(max-width:600px){html.wl-theme-active .content :is(button,.btn,.primary){max-width:100%}.tb-mock-layout{grid-template-columns:minmax(72px,26%) minmax(0,1fr)}}
