/* Final color layer. Layout and type live in product.css; all palettes share these rules. */
:root{
  --accent-text:#2563eb;--accent-contrast:#fff;--accent-soft:#f0f4fe;--accent-hover:#2159d4;--accent-line:#91ace9;
  --surface-soft:#f9fafb;--surface-raised:#fff;--hover:#f5f6f8;--soft:var(--accent-soft);
  --sidebar-ink:#e7edf6;--sidebar-text:var(--sidebar-ink);--sidebar-muted:#9ba9bd;--sidebar-line:#2e3a51;
  --sidebar-hover:#1e2b42;--sidebar-active:#142a57;--sidebar-active-ink:#e7edf6;--sidebar-accent:#81a7fa;
  --success:#26754f;--success-soft:#e9f1ed;--success-bg:var(--success-soft);--success-line:#94b4a2;
  --warning:#89631f;--warning-soft:#f3efe9;--warning-bg:var(--warning-soft);--warning-line:#bfb08f;
  --danger:#b42332;--danger-soft:#f8ebed;--danger-bg:var(--danger-soft);--danger-line:#cf969c;
  --focus-ring:#2563eb40;--shadow-color:#1018280d;--overlay-color:#0c162866;
  --scrollbar-thumb:#c4cbd6;--scrollbar-track:#f5f7fa
}
body[data-theme]{--soft:var(--accent-soft);--primary-ink:var(--accent-contrast);--red:var(--danger);--amber:var(--warning);background:var(--bg);color:var(--ink)}
body[data-theme] ::selection{background:var(--accent);color:var(--accent-contrast)}
body[data-theme] *{scrollbar-color:var(--scrollbar-thumb) var(--scrollbar-track)}
body[data-theme] ::-webkit-scrollbar-track{background:var(--scrollbar-track)}
body[data-theme] ::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-color:var(--scrollbar-track)}
body[data-theme] :is(.workspace,.auth-screen){background:var(--bg);color:var(--ink)}
body[data-theme] :is(.topline,.card,.panel,.modal,.insight-own-modal,.filters,.material-card,.service-card,.task-card,.connection-card,.public-banner,.source-overview,.roadmap-hero,.auth-main){background:var(--surface);color:var(--ink);border-color:var(--line)}
body[data-theme] :is(.panel-head,.card-header,.panel-foot,.form-divider,.form-actions,.modal-heading,.tabs,.footer-note,.table-wrap,.task-line,.reading-item,.material-foot,.service-card,.profile-summary,.source-meta,.command-help,.command-hint){border-color:var(--line)}
body[data-theme] :is(h1,h2,h3,h4,.person-name,.profile-link,.task-line-title strong,.reading-item strong,.command-result strong,.connection-meta strong,.empty h3,.stat-value,.kpi-value,.metric-value){color:var(--ink)}
body[data-theme] :is(.muted,.small.muted,.person-sub,.cell-sub,.field-label,.hint,.footer-note,.stat-label,.stat-foot,.stat-top,.kpi-top,.kpi-bottom,.metric-top,.metric-note,.panel-head p,.section-note,.table-caption,.task-id,.task-date,.task-assignee,.material-meta,.source-caveat,.office-comparison-note,.product-office-details,.product-quality-note,.chart-caption,.chart-axis,.chart-day small,.command-help,.command-hint,.command-group-label,.command-result small,.auth-bottom){color:var(--muted)}
body[data-theme] .muted{color:var(--muted)!important}
body[data-theme] :is(a,.text-button,.profile-link:hover,.insight-office-link,.reading-item:hover strong,.material-card:hover h2){color:var(--accent-text)}
body[data-theme] :is(.task-line:hover,.reading-item:hover,.product-office-row:hover,.office-comparison-row:hover,.command-result:hover,.command-result.selected,.command-result.is-selected){background:var(--accent-soft)}

/* Sidebar has a distinct contrast context from the page surface. */
body[data-theme] .sidebar{background:var(--forest);color:var(--sidebar-ink);border-color:var(--sidebar-line);--scrollbar-thumb:var(--sidebar-line);--scrollbar-track:var(--forest)}
body[data-theme] .sidebar :is(.brand,.brand-home,.brand-name,.account-name){color:var(--sidebar-ink);background:transparent}
body[data-theme] :is(.brandmark,.sidebar .brandmark){background:var(--accent);color:var(--accent-contrast);box-shadow:none;border-color:var(--accent)}
body[data-theme] :is(.brand-dot,.nav-new-dot,.read-only-dot){color:var(--sidebar-accent)}
body[data-theme] :is(.nav-new-dot,.read-only-dot){background:var(--sidebar-accent)}
body[data-theme] .sidebar :is(.brand-sub,.nav-label,.sidebar-settings,.sidebar-workspace small,.sidebar-workspace>svg,.account .small,.account .icon-btn){color:var(--sidebar-muted)}
body[data-theme] .sidebar .account .small{color:var(--sidebar-muted)!important}
body[data-theme] .sidebar :is(.sidebar-bottom,.account,.sidebar-settings,.sidebar-workspace){border-color:var(--sidebar-line)}
body[data-theme] .sidebar :is(.account .avatar,.workspace-mini-avatar){background:var(--sidebar-hover);color:var(--sidebar-ink);border-color:var(--sidebar-line)}
body[data-theme] .sidebar .nav-link{background:transparent;color:var(--sidebar-muted);box-shadow:none}
body[data-theme] .sidebar .nav-link :is(svg,.ticon){color:inherit;opacity:1}
body[data-theme] .sidebar :is(.nav-link:hover,.sidebar-settings:hover,.account .icon-btn:hover){background:var(--sidebar-hover);color:var(--sidebar-ink)}
body[data-theme] .sidebar .nav-link.active{background:var(--sidebar-active);color:var(--sidebar-active-ink);box-shadow:inset 3px 0 0 var(--accent);border-color:var(--sidebar-line)}
body[data-theme] .sidebar .nav-link.active :is(svg,.ticon){color:var(--sidebar-accent)}
body[data-theme] .sidebar .sidebar-workspace{background:var(--sidebar-hover)}
body[data-theme] .sidebar .sidebar-workspace strong{color:var(--sidebar-ink)}

/* Controls, including native input accents and selection. */
body[data-theme] :is(.btn,.icon-btn,.insight-button,.global-search,.command-trigger,.segmented,.period-presets,.theme-card){background:var(--surface);color:var(--ink);border-color:var(--line);box-shadow:none}
body[data-theme] :is(.btn:hover,.icon-btn:hover,.insight-button:hover,.theme-card:hover){background:var(--accent-soft);color:var(--accent-text);border-color:var(--accent-line)}
body[data-theme] :is(.btn-primary,.btn-lime,.insight-primary,.hero-primary.btn){background:var(--accent);border-color:var(--accent);color:var(--accent-contrast);box-shadow:none}
body[data-theme] :is(.btn-primary:hover,.btn-lime:hover,.insight-primary:hover,.hero-primary.btn:hover){background:var(--accent-hover);border-color:var(--accent-hover);color:var(--accent-contrast)}
body[data-theme] :is(.btn-ghost,.theme-trigger,.global-search,.command-trigger){background:transparent;color:var(--muted);border-color:transparent}
body[data-theme] :is(.btn-ghost:hover,.theme-trigger:hover,.global-search:hover,.command-trigger:hover){background:var(--accent-soft);color:var(--accent-text)}
body[data-theme] :is(.period-presets,.segmented,.insight-segment){background:var(--surface-soft);border-color:var(--line)}
body[data-theme] :is(.period-presets button,.segmented button,.insight-segment button){background:transparent;color:var(--muted);border-color:transparent}
body[data-theme] :is(.period-presets button:hover,.period-presets button[aria-pressed=true],.segmented button.active,.insight-segment button.is-active){background:var(--accent-soft);color:var(--accent-text);border-color:var(--accent-line);box-shadow:none}
body[data-theme] :is(input,select,textarea,.form-control,.form-select){background-color:var(--surface);color:var(--ink);border-color:var(--line);accent-color:var(--accent);caret-color:var(--accent-text)}
body[data-theme] :is(input,textarea)::placeholder{color:var(--muted);opacity:.85}
body[data-theme] :is(input,select,textarea):disabled{background:var(--surface-soft);color:var(--muted);border-color:var(--line)}
body[data-theme] :is(input,select,textarea,.form-control,.form-select):focus,body[data-theme] :is(input,select,textarea,.form-control,.form-select):focus-visible{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--focus-ring)}
body[data-theme] :is(button,a,[tabindex]):focus-visible{outline:3px solid var(--focus-ring);outline-offset:3px}
body[data-theme] :is(input[type=checkbox],input[type=radio]){accent-color:var(--accent)}
body[data-theme] option{background:var(--surface);color:var(--ink)}
body[data-theme] :is(.search-box svg,.global-search svg,.command-trigger svg,.command-input-wrap>svg,.stat-top>svg,.kpi-top>svg,.panel-head>svg,.material-foot>svg){color:var(--muted)}
body[data-theme] :is(kbd,.command-input-wrap,.command-result-icon){background:var(--surface-soft);color:var(--muted);border-color:var(--line)}
body[data-theme] .command-input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--focus-ring)}
body[data-theme] .command-input-wrap input{background:transparent;border-color:transparent;box-shadow:none}
body[data-theme] .command-input-wrap input:focus{box-shadow:none;border-color:transparent}

/* Data panels and charts. No palette-specific blue remains in metrics. */
body[data-theme] :is(.kpi-card,.product-stat-card,.metric,.stat-card,.tabler-stat-card,.task-column){background:var(--surface);color:var(--ink);border-color:var(--line);box-shadow:none}
body[data-theme] :is(.kpi-card:hover,.metric:hover,.stat-action:hover){border-color:var(--accent-line);box-shadow:none}
body[data-theme] :is(.metric.accent,.kpi-primary){background:var(--surface);border-color:var(--line)}
body[data-theme] :is(.kpi-symbol,.kpi-symbol.warning,.stat-icon,.stat-icon.violet,.stat-icon.amber,.metric-icon,.avatar,.top-user.avatar,.topbar-avatar,.office-symbol,.office-1,.office-2,.office-monogram,.office-color-1,.office-color-2,.material-icon,.material-card-icon,.service-icon,.reading-icon,.connection-symbol,.future-symbol,.roadmap-icon,.step-number){background:var(--accent-soft);color:var(--accent-text);border-color:var(--accent-line);box-shadow:none}
body[data-theme] :is(.product-stat-card.needs-review,.stat-card.needs-review){border-color:var(--accent-line)}
body[data-theme] :is(.product-stat-card.needs-review .kpi-value,.product-review-count,.office-review,.metric.warn .metric-value){color:var(--accent-text)}
body[data-theme] :is(.product-office-bar,.office-bar,.office-comparison-bar){background:var(--surface-soft)}
body[data-theme] :is(.product-office-bar i,.office-bar span,.office-comparison-bar span,.chart-legend-dot,.chart-legend i,.chart-legend i.amber){background:var(--accent)}
body[data-theme] :is(.product-quality-note,.product-snapshot,.table-caption){background:var(--surface-soft);border-color:var(--line);color:var(--muted)}
body[data-theme] .chart-bar{background:var(--accent)}
body[data-theme] .chart-bar.has-review:after{background:var(--accent-text)}
body[data-theme] .chart-line{stroke:var(--accent)}
body[data-theme] .chart-grid{stroke:var(--line)}
body[data-theme] .trend-chart text{fill:var(--muted)}
body[data-theme] .chart-day circle{fill:var(--surface);stroke:var(--accent)}
body[data-theme] :is(.chart-day:focus rect,.chart-day:hover rect){fill:var(--accent-soft)}
body[data-theme] .chart-day:focus{outline:none}
body[data-theme] .quality-ring{background:conic-gradient(var(--accent) var(--quality-percent),var(--surface-soft) 0)}
body[data-theme] .quality-ring>div{background:var(--surface)}
body[data-theme] .quality-ring :is(strong,span){color:var(--ink)}

/* Complete records retain success semantics; ordinary review is a theme accent. */
body[data-theme] :is(.badge,.badge.gray,.pill-number){background:var(--surface-soft);color:var(--muted);border-color:var(--line)}
body[data-theme] :is(.badge.blue,.badge.amber,.day-value.review,.insight-badge.is-review,.insight-badge.is-event){background:var(--accent-soft);color:var(--accent-text);border-color:var(--accent-line)}
body[data-theme] :is(.badge.green,.insight-badge.is-complete){background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
body[data-theme] :is(.badge.red,.notice.error,.form-error,.error-state,.insight-error){background:var(--danger-bg);color:var(--danger);border-color:var(--danger-line)}
body[data-theme] :is(.notice,.notice.warning){background:var(--accent-soft);color:var(--ink);border-color:var(--accent-line)}
body[data-theme] :is(.notice svg,.notice.warning svg){color:var(--accent-text)}
body[data-theme] .notice.success{background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
body[data-theme] :is(.notice.error svg,.insight-filter-error){color:var(--danger)}
body[data-theme] .notice.success svg{color:var(--success)}
body[data-theme] .warning-list{color:var(--warning)}
body[data-theme] .task-date.overdue{color:var(--warning)}
body[data-theme] .task-status-mark.todo{background:var(--surface-soft);border-color:var(--muted)}
body[data-theme] :is(.task-status-mark.in_progress,.task-status-mark.review){background:var(--accent-soft);border-color:var(--accent)}
body[data-theme] .task-status-mark.done{background:var(--success);border-color:var(--success)}
body[data-theme] .day-value{color:var(--accent-text);background:var(--accent-soft)}
body[data-theme] .day-value.unknown{color:var(--muted);background:transparent}
body[data-theme] :is(.legend-swatch,.legend-swatch.amber,.quality-dot,.quality-dot.warning){background:var(--accent)}
body[data-theme] :is(.table,table){color:var(--ink);border-color:var(--line)}
body[data-theme] :is(.table th,table th){color:var(--muted);background:var(--surface-soft);border-color:var(--line)}
body[data-theme] :is(.table td,table td){color:var(--ink);background:var(--surface);border-color:var(--line);box-shadow:none}
body[data-theme] :is(.table tbody tr:hover td,table tbody tr:hover td){background:var(--hover)}
body[data-theme] :is(.calendar-table th:first-child,.calendar-table td:first-child){background:var(--surface);box-shadow:1px 0 var(--line)}
body[data-theme] .calendar-table th.weekend{background:var(--surface-soft)}
body[data-theme] .calendar-table .day-head span{color:var(--muted)}
body[data-theme] .tab{color:var(--muted);background:transparent}
body[data-theme] .tab.active{color:var(--accent-text);border-bottom-color:var(--accent)}

/* Shared analytics: guard against earlier selector specificity and fixed gradients. */
body[data-theme] :is(.insight-content,.insight-profile,.insight-filters){--insight-blue:var(--accent);--insight-soft:var(--accent-soft);--insight-border:var(--line)}
body[data-theme] .insight-metric.insight-blue{background:var(--accent-soft);border-color:var(--accent-line);box-shadow:none}
body[data-theme] .insight-metric.insight-blue :is(span,small){color:var(--muted)}
body[data-theme] .insight-metric.insight-blue>strong{color:var(--accent-text)}
body[data-theme] .insight-metric.insight-amber>strong{color:var(--accent-text)}
body[data-theme] :is(.insight-profile-avatar,.insight-calendar-day.is-selected>span){background:var(--accent);color:var(--accent-contrast)}
body[data-theme] .insight-calendar-day{background:var(--surface);color:var(--muted);border-color:var(--line)}
body[data-theme] .insight-calendar-day.is-complete{background:var(--success-bg);color:var(--success);border-color:var(--success-line)}
body[data-theme] :is(.insight-calendar-day.is-review,.insight-calendar-day.is-event){background:var(--accent-soft);color:var(--accent-text);border-color:var(--accent-line)}
body[data-theme] .insight-calendar-day.is-selected{background:var(--accent-soft);border-color:var(--accent);box-shadow:0 0 0 2px var(--accent)}
body[data-theme] .insight-calendar-day:hover{border-color:var(--accent);filter:none}
body[data-theme] :is(.insight-legend i,.insight-bar-dot.is-review,.insight-calendar-legend i.is-review){background:var(--accent)}
body[data-theme] .insight-calendar-legend i.is-complete{background:var(--success)}
body[data-theme] .insight-record p.insight-record-reason{color:var(--accent-text)}
body[data-theme] .insight-bar-track i{background:var(--accent)}
body[data-theme] :is(.insight-chip.is-active,.insight-chip:hover){background:var(--accent-soft);border-color:var(--accent-line);color:var(--accent-text)}

/* Dialogs, uploads and less frequent screens follow the same palette. */
body[data-theme] :is(.modal-backdrop,.insight-modal-overlay,.nav-scrim,.sidebar-overlay){background:var(--overlay-color)}
body[data-theme] :is(.modal,.insight-own-modal){box-shadow:0 24px 80px var(--shadow-color)}
body[data-theme] :is(.empty-icon,.dropzone .upload-icon,.file-selected){background:var(--accent-soft);color:var(--accent-text)}
body[data-theme] .dropzone{background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
body[data-theme] .dropzone.dragover{background:var(--accent-soft);border-color:var(--accent)}
body[data-theme] .checkbox-label{color:var(--ink)}
body[data-theme] .loader{border-color:var(--line);border-top-color:var(--accent)}
body[data-theme] .auth-side{background:var(--forest);color:var(--sidebar-ink)}
body[data-theme] .auth-side :is(.brand,.brand-name,.auth-copy h1){color:var(--sidebar-ink)}
body[data-theme] .auth-side :is(.brand-sub,.auth-copy p,.auth-foot,.auth-eyebrow){color:var(--sidebar-muted)}
body[data-theme] .auth-offices span{background:var(--sidebar-hover);border-color:var(--sidebar-line);color:var(--sidebar-ink)}
body[data-theme] :is(.auth-decoration,.auth-decoration:after){border-color:var(--sidebar-line)}
body[data-theme] .auth-kicker{color:var(--accent-text)}
body[data-theme] #toast{background:var(--forest);color:var(--sidebar-ink);border-color:var(--sidebar-line);box-shadow:0 8px 28px var(--shadow-color)}
body[data-theme] .source-pipeline-step.active{background:var(--accent-soft);border-color:var(--accent-line);color:var(--accent-text)}
body[data-theme] :is(.theme-card.selected,.theme-card.selected:hover){background:var(--accent-soft);border-color:var(--accent);box-shadow:0 0 0 2px var(--focus-ring)}
body[data-theme] .theme-card.selected:after{background:var(--accent);color:var(--accent-contrast)}
body[data-theme] .theme-card strong{color:var(--ink)}
body[data-theme] .theme-card small{color:var(--muted)}
body[data-theme] .theme-preview{background:var(--theme-bg);border-color:var(--theme-line)}
body[data-theme] .theme-preview i{background:var(--theme-sidebar)}
body[data-theme] .theme-preview b{background:var(--theme-surface);border-color:var(--theme-line)}
body[data-theme] .theme-preview em{background:var(--theme-surface);border-color:var(--theme-line)}
body[data-theme] .theme-preview em:last-child{background:var(--theme-accent);border-color:var(--theme-accent)}

/* Lead metric in the actual canonical and public dashboard markup. */
body[data-theme] .product-stat-card:first-child,
body[data-theme] .product-metrics>.metric:first-child{background:var(--accent-soft);border-color:var(--accent-line)}
body[data-theme] .product-stat-card:first-child :is(.stat-value,.kpi-value,.metric-value),
body[data-theme] .product-metrics>.metric:first-child .metric-value{color:var(--accent-text)}

/* Action links use the same accessible text color as primary buttons. */
body[data-theme] a.btn.btn-primary,body[data-theme] a.btn.btn-primary:visited,body[data-theme] a.btn.btn-primary:hover,body[data-theme] a.btn.btn-primary:focus-visible{color:var(--accent-contrast)}
