/* Final component contracts, shared by every palette and both modes. */
body { font-family:var(--font-sans); }
code,pre,kbd { font-family:var(--font-mono); }
html[data-palette] body .btn:not(.btn-light):not(.btn-secondary):not(.btn-danger) {
    background:var(--primary); color:var(--primary-foreground);
}
html[data-palette] body .btn-secondary { background:var(--secondary); color:var(--secondary-foreground); }
html[data-palette] body .btn-danger { background:var(--destructive); color:var(--destructive-foreground); }
html[data-palette] body .btn :is(strong,small,span) { color:inherit; }
/* Flat buttons in every palette and state, including label-based file pickers. */
html body :is(button, .btn, [role="button"], input[type="button"], input[type="submit"], input[type="reset"]) { box-shadow:none !important; }
html body input::file-selector-button { box-shadow:none !important; }
html.dark body :is(button, a.btn, input[type="button"], input[type="submit"], input[type="reset"]):focus-visible { outline:2px solid var(--ring); outline-offset:2px; }
html[data-palette] body .sidebar { background:var(--sidebar); color:var(--sidebar-foreground); border-color:var(--sidebar-border); }
html[data-palette] body .sidebar :is(.brand-copy strong,.sidebar-link,.space-link) { color:var(--sidebar-foreground); }
html[data-palette] body .sidebar :is(.brand-copy span,.sidebar-label,.sidebar-spaces-empty,.muted-space) { color:color-mix(in srgb,var(--sidebar-foreground) 78%,transparent); }
html[data-palette] body .sidebar :is(.sidebar-link,.space-link):is(:hover,.is-active) { background:var(--sidebar-accent); color:var(--sidebar-accent-foreground); }
html[data-palette] body .sidebar :is(.sidebar-link,.space-link).is-active::before { background:var(--sidebar-primary); }
html[data-palette] body .sidebar-close { background:transparent; color:var(--sidebar-foreground); }
html[data-palette] body :is(.brand-mark,.crm-company-avatar,.crm-detail-avatar) { background:var(--primary); color:var(--primary-foreground); }
html[data-palette] body :is(.global-search,.task-search,.crm-search,.login-input-wrap) input { background:transparent; color:var(--foreground); }
html[data-palette] body :is(input[type="checkbox"],input[type="radio"],input[type="range"],progress) { accent-color:var(--primary); }
html[data-palette] body input::file-selector-button { background:var(--muted); color:var(--foreground); border:1px solid var(--border); border-radius:var(--radius); padding:.5rem .75rem; }
html[data-palette] body .priority-chip.low { --priority-ink:var(--info); }
html[data-palette] body .priority-chip.medium { --priority-ink:var(--warning); }
html[data-palette] body .priority-chip.high { --priority-ink:var(--error); }
html[data-palette] body .priority-chip.critical { --priority-ink:var(--critical); }
html[data-palette] body :is(.task-upload-file-check,.permission-item.is-granted .permission-status) { color:var(--success); }
html[data-palette] body .project-form-shell .project-section .form-control:focus-visible { outline-color:var(--ring); }
html[data-palette] body .workspace-chat.chat-card .workspace-chat-error { color:var(--error); }
html[data-palette] body .workspace-chat.chat-card textarea:focus-visible { outline-color:var(--ring); }
/* Chart library tooltips render outside the normal card hierarchy. */
html[data-palette] body .apexcharts-tooltip,html[data-palette] body .apexcharts-menu { background:var(--popover); color:var(--popover-foreground); border:1px solid var(--border); }
html[data-palette] body .apexcharts-tooltip-title { background:var(--muted); border-color:var(--border); color:var(--foreground); }
html[data-palette] body .apexcharts-menu-item:hover { background:var(--muted); }
html[data-palette] body .apexcharts-text { fill:var(--muted-foreground); }
html[data-palette] body .apexcharts-tooltip :is(span,strong,div) { color:inherit; }
html[data-palette] body .messages li { color:var(--success); background:color-mix(in srgb,var(--success) 10%,var(--card)); border-color:color-mix(in srgb,var(--success) 30%,var(--card)); }
html[data-palette] body .messages li.error { color:var(--error); background:color-mix(in srgb,var(--error) 10%,var(--card)); border-color:var(--error); }
html[data-palette] body .messages li.warning { color:var(--warning); background:color-mix(in srgb,var(--warning) 10%,var(--card)); border-color:var(--warning); }
/* The artwork stays authored; only its surrounding frame follows appearance. */
html[data-palette] body .whiteboard-stage { border-color:var(--border); box-shadow:var(--shadow-md); }
html[data-palette] body .whiteboard-stage-hint { color:var(--artwork-ink); }
html[data-palette] body .mini-avatar:not([style]):not(.user-avatar-identity) { background:var(--primary); color:var(--primary-foreground); }
