/* 04.26.1 — Dark mode contrast repair.
   Bridges legacy workspace variables to the shared UI tokens and neutralizes
   higher-specificity light-only rules without changing the light palette. */
:root{
  --bg:var(--ui-bg);
  --page:var(--ui-bg);
  --app-bg:var(--ui-bg);
  --panel:var(--ui-surface);
  --text:var(--ui-ink);
  --text-2:var(--ui-muted);
  --subtle:var(--ui-soft);
  --soft:var(--ui-soft);
  --danger:var(--ui-danger);
  --warning:var(--ui-warning);
  --success:var(--ui-success);
}

/* Legacy secondary actions were pinned to white. */
html[data-theme="dark"] .quiet,
html[data-theme="dark"] .danger-button,
html[data-theme="dark"] .social-action-button,
html[data-theme="dark"] .social-detail-close,
html[data-theme="dark"] .instagram-check{
  background:var(--ui-surface);
  color:var(--ui-ink);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .quiet:hover:not(:disabled),
html[data-theme="dark"] .danger-button:hover:not(:disabled),
html[data-theme="dark"] .social-action-button:hover:not(:disabled),
html[data-theme="dark"] .social-detail-close:hover:not(:disabled),
html[data-theme="dark"] .instagram-check:hover:not(:disabled){
  background:var(--ui-hover);
  color:var(--ui-ink);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .quiet:disabled,
html[data-theme="dark"] .danger-button:disabled,
html[data-theme="dark"] .social-action-button:disabled{
  background:var(--ui-surface);
  color:var(--ui-muted);
  border-color:var(--ui-line);
}

/* Inbox legacy hover styles had more specificity than the tokenized card rule. */
html[data-theme="dark"] .professional-card:hover:not(:disabled),
html[data-theme="dark"] .conversation-item:hover:not(:disabled){
  background:var(--ui-hover);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .professional-card.selected,
html[data-theme="dark"] .professional-card.selected:hover:not(:disabled){
  background:var(--ui-accent-soft);
  border-color:transparent;
}
html[data-theme="dark"] .inbox-nav-item:hover:not(:disabled),
html[data-theme="dark"] .channel-nav-item:hover:not(:disabled),
html[data-theme="dark"] .lifecycle-nav-item:hover:not(:disabled),
html[data-theme="dark"] .team-inbox-item:hover:not(:disabled),
html[data-theme="dark"] .social-nav-item:hover:not(:disabled){
  background:var(--ui-hover);
  color:var(--ui-ink);
}
html[data-theme="dark"] .inbox-nav-item.active:hover:not(:disabled),
html[data-theme="dark"] .channel-nav-item.active:hover:not(:disabled),
html[data-theme="dark"] .lifecycle-nav-item.active:hover:not(:disabled),
html[data-theme="dark"] .team-inbox-item.active:hover:not(:disabled),
html[data-theme="dark"] .social-nav-item.active:hover:not(:disabled){
  background:var(--ui-accent-soft);
  color:var(--ui-accent);
}
html[data-theme="dark"] .assigned-avatar,
html[data-theme="dark"] .thread-count,
html[data-theme="dark"] .lifecycle-contact{
  background:var(--ui-soft);
  color:var(--ui-muted);
}
html[data-theme="dark"] .lifecycle-contacted{
  background:var(--ui-accent-soft);
  color:var(--ui-accent);
}
html[data-theme="dark"] .lifecycle-disqualified{
  background:var(--ui-danger-bg);
  color:var(--ui-danger);
}

/* Social workspace connected/hover/detail states came from light-only legacy CSS. */
html[data-theme="dark"] .social-provider.connected{
  background:var(--ui-surface);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .social-provider.pending{
  background:var(--ui-note);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .social-lead-card:hover,
html[data-theme="dark"] .social-lead-card.expanded,
html[data-theme="dark"] .social-lead-card.selected-detail{
  background:var(--ui-hover);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .social-origin p,
html[data-theme="dark"] .social-source-post,
html[data-theme="dark"] .social-source-comment,
html[data-theme="dark"] .social-source-url,
html[data-theme="dark"] .social-thread-entry>div:last-child,
html[data-theme="dark"] .social-detail-datum{
  background:var(--ui-surface);
  border-color:var(--ui-line);
  color:var(--ui-ink);
}
html[data-theme="dark"] .social-thread-entry.page-authored>div:last-child,
html[data-theme="dark"] .social-intelligence-note{
  background:var(--ui-soft);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .social-intent-hot,
html[data-theme="dark"] .instagram-reply-error,
html[data-theme="dark"] .instagram-reply-notice.rejected{
  background:var(--ui-danger-bg);
  color:var(--ui-danger);
}
html[data-theme="dark"] .social-intent-potential,
html[data-theme="dark"] .instagram-reply-notice.unknown,
html[data-theme="dark"] .ig-alert{
  background:var(--ui-note);
  color:var(--ui-warning);
}
html[data-theme="dark"] .social-intent-unclassified,
html[data-theme="dark"] .social-intent-ignore,
html[data-theme="dark"] .social-status-ignored,
html[data-theme="dark"] .social-status-withdrawn{
  background:var(--ui-soft);
  color:var(--ui-muted);
}

/* Workflow workspace still had explicit light selected/status colors. */
html[data-theme="dark"] .ww-kpi.selected{
  background:var(--ui-accent-soft);
  border-color:var(--ui-accent);
}
html[data-theme="dark"] .ww-title h1 span,
html[data-theme="dark"] .ww-unread{
  background:var(--ui-accent-soft);
  color:var(--ui-accent);
}
html[data-theme="dark"] .ww-check.done{
  background:color-mix(in srgb,var(--ui-success) 16%,transparent);
  color:var(--ui-success);
}
html[data-theme="dark"] .ww-check.missing{
  background:var(--ui-note);
  color:var(--ui-warning);
}
html[data-theme="dark"] .ww-search-box button{
  color:var(--ui-accent);
}

/* Legacy modal/menu and conversation surfaces that can appear above any workspace. */
html[data-theme="dark"] .floating-menu,
html[data-theme="dark"] .thread-toolbar-wrap,
html[data-theme="dark"] .conversation-search,
html[data-theme="dark"] .composer-channel-select,
html[data-theme="dark"] .task-row,
html[data-theme="dark"] .activity-row,
html[data-theme="dark"] .global-panel,
html[data-theme="dark"] .account-popover,
html[data-theme="dark"] .social-detail-drawer>header,
html[data-theme="dark"] .social-detail-section{
  background:var(--ui-surface);
  color:var(--ui-ink);
  border-color:var(--ui-line);
}
html[data-theme="dark"] .uncertain-box,
html[data-theme="dark"] .notes-banner,
html[data-theme="dark"] .internal-note,
html[data-theme="dark"] .test-reply-feedback-warning{
  background:var(--ui-note);
  color:var(--ui-warning);
  border-color:var(--ui-line);
}

/* Keep embedded provider content itself unchanged; only its CRM frame follows theme. */
html[data-theme="dark"] .ig-asset{
  background:var(--ui-surface);
  border-color:var(--ui-line);
}
