/*
 * Dark mode — final sweep layer.
 * Loaded last so it catches new intelligence panels, AI surfaces,
 * mobile sheets, reminder popups, and any inline-style leaks missed
 * by feature-specific dark sheets. Document/print canvases stay white.
 */

/* ── Shared token bridge for newer components ─────────────────── */
html[data-theme="dark"] {
  --surface: #1a1a1a;
  --surface-1: #1a1a1a;
  --surface-2: #1e1e1e;
  --surface-subtle: #1e1e1e;
  --card: #1a1a1a;
  --panel: #1a1a1a;
  --text: #f0f0f0;
  --text-primary: #f0f0f0;
  --text-secondary: #b0b0b0;
  --text-muted: #909090;
  --muted: #8a8a8a;
  --border: rgba(240, 240, 240, 0.2);
  --border-color: rgba(240, 240, 240, 0.2);
  --border-subtle: rgba(240, 240, 240, 0.14);
  --link: #87a6c4;
  --primary: #87a6c4;
  --primary-500: #87a6c4;
  --primary-600: #87a6c4;
  --danger: #f87171;
  --danger-text: #fca5a5;
  --warning: #fbbf24;
  --warning-text: #fcd34d;
}

/* ── Contact Intelligence (Overview tab) ──────────────────────── */
html[data-theme="dark"] .contact-intelligence {
  --ci-border: rgba(240, 240, 240, 0.18);
  --ci-surface: #1a1a1a;
  --ci-muted: #8a8a8a;
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.18) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .contact-intelligence__header h2,
html[data-theme="dark"] .contact-intelligence__status h3,
html[data-theme="dark"] .contact-intelligence__next-action h3,
html[data-theme="dark"] .contact-intelligence__section summary {
  color: #f0f0f0 !important;
  -webkit-text-fill-color: #f0f0f0 !important;
}

html[data-theme="dark"] .contact-intelligence__eyebrow,
html[data-theme="dark"] .contact-intelligence__section-label,
html[data-theme="dark"] .contact-intelligence__descriptor,
html[data-theme="dark"] .contact-intelligence__confidence,
html[data-theme="dark"] .contact-intelligence__disclaimer,
html[data-theme="dark"] .contact-intelligence__factor-label,
html[data-theme="dark"] .contact-intelligence__metrics dt,
html[data-theme="dark"] .contact-intelligence__reason {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .contact-intelligence__factor:not(.contact-intelligence__factor--concern) .contact-intelligence__factor-label {
  color: #6ee7b7 !important;
  -webkit-text-fill-color: #6ee7b7 !important;
}

html[data-theme="dark"] .contact-intelligence__factor--concern .contact-intelligence__factor-label {
  color: #fca5a5 !important;
  -webkit-text-fill-color: #fca5a5 !important;
}

html[data-theme="dark"] .contact-intelligence__factor p,
html[data-theme="dark"] .contact-intelligence__metrics dd {
  color: #e6e6e6 !important;
  -webkit-text-fill-color: #e6e6e6 !important;
}

html[data-theme="dark"] .contact-intelligence__panel,
html[data-theme="dark"] .contact-intelligence__section,
html[data-theme="dark"] .contact-intelligence__signal,
html[data-theme="dark"] .contact-intelligence__signal-card,
html[data-theme="dark"] .contact-intelligence__timeline-item {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .contact-intelligence__header-actions button:not(:first-child),
html[data-theme="dark"] .contact-intelligence__section button,
html[data-theme="dark"] .contact-intelligence--error button {
  background: #222222 !important;
  background-image: none !important;
  color: #dcdcdc !important;
  -webkit-text-fill-color: #dcdcdc !important;
  border-color: rgba(240, 240, 240, 0.22) !important;
}

html[data-theme="dark"] .contact-intelligence__header-actions button:first-child,
html[data-theme="dark"] .contact-intelligence__next-action button {
  background: var(--accent, #87a6c4) !important;
  background-image: none !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .contact-intelligence__badges span,
html[data-theme="dark"] .contact-intelligence__count {
  background: rgba(136, 192, 208, 0.16) !important;
  color: #88c0d0 !important;
  -webkit-text-fill-color: #88c0d0 !important;
}

html[data-theme="dark"] .contact-intelligence__section[open] summary,
html[data-theme="dark"] .contact-intelligence__section summary:hover {
  background: rgba(136, 192, 208, 0.06) !important;
}

/* ── Company / Relationship Intelligence ──────────────────────── */
html[data-theme="dark"] .relationship-summary,
html[data-theme="dark"] .company-intelligence {
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.18) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .company-intelligence__headline h2,
html[data-theme="dark"] .company-intelligence h3,
html[data-theme="dark"] .company-intelligence h4 {
  color: #f0f0f0 !important;
  -webkit-text-fill-color: #f0f0f0 !important;
}

html[data-theme="dark"] .company-intelligence__headline p,
html[data-theme="dark"] .company-intelligence__timing,
html[data-theme="dark"] .company-intelligence__disclaimer,
html[data-theme="dark"] .company-intelligence footer small {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .company-intelligence__health,
html[data-theme="dark"] .company-intelligence__card,
html[data-theme="dark"] .company-intelligence__factor,
html[data-theme="dark"] .company-intelligence__metric,
html[data-theme="dark"] .company-intelligence__split > section {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

/* ── Meeting Intelligence modal ───────────────────────────────── */
html[data-theme="dark"] .meeting-intelligence-modal {
  --mi-border: rgba(240, 240, 240, 0.2);
  --mi-muted: #8a8a8a;
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.2) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] .meeting-intelligence-modal__header,
html[data-theme="dark"] .meeting-intelligence-modal__footer {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
}

html[data-theme="dark"] .meeting-intelligence-modal__body,
html[data-theme="dark"] .meeting-intelligence__hero,
html[data-theme="dark"] .meeting-intelligence__objective,
html[data-theme="dark"] .meeting-intelligence__summary,
html[data-theme="dark"] .meeting-intelligence__talk-track,
html[data-theme="dark"] .meeting-intelligence__questions,
html[data-theme="dark"] .meeting-intelligence__risks {
  background: transparent !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .meeting-intelligence-modal__header > div > p:last-child,
html[data-theme="dark"] .meeting-intelligence__hero p,
html[data-theme="dark"] .meeting-intelligence__objective p {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .meeting-intelligence__icon-btn,
html[data-theme="dark"] .meeting-intelligence-modal__footer button:not(.primary):not(.btn-primary) {
  background: #222222 !important;
  background-image: none !important;
  color: #dcdcdc !important;
  border-color: rgba(240, 240, 240, 0.22) !important;
}

html[data-theme="dark"] .meeting-intelligence__pill,
html[data-theme="dark"] .meeting-intelligence__chip,
html[data-theme="dark"] .meeting-intelligence__list li {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

/* ── AI Draft panel (Momentum) — core dark rules live in grounded-draft-panel.css ── */
html[data-theme="dark"] .grounded-draft-panel {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] .gd-primary,
html[data-theme="dark"] .grounded-draft-panel .btn.primary {
  background: linear-gradient(135deg, #87a6c4 0%, #87a6c4 100%) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

html[data-theme="dark"] .gd-grounding summary,
html[data-theme="dark"] .gd-grounding li,
html[data-theme="dark"] .gd-empty-state h3 {
  color: #e6e6e6 !important;
  -webkit-text-fill-color: #e6e6e6 !important;
}

/* ── Pipeline Intelligence slide-out ──────────────────────────── */
html[data-theme="dark"] .pi-panel {
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] .pi-header,
html[data-theme="dark"] .pi-controls {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
}

html[data-theme="dark"] .pi-eyebrow {
  color: #88c0d0 !important;
  -webkit-text-fill-color: #88c0d0 !important;
}

html[data-theme="dark"] .pi-close:hover,
html[data-theme="dark"] .pi-close:focus-visible {
  background: #242424 !important;
}

html[data-theme="dark"] .pi-controls label,
html[data-theme="dark"] .pi-loading,
html[data-theme="dark"] .pi-error,
html[data-theme="dark"] .pi-disclaimer {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .pi-controls select,
html[data-theme="dark"] .pi-controls button:not(.primary):not(.btn-primary) {
  background: #1e1e1e !important;
  background-image: none !important;
  color: #e6e6e6 !important;
  border-color: rgba(240, 240, 240, 0.24) !important;
  color-scheme: dark !important;
}

html[data-theme="dark"] .pi-section {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .pi-section h3 {
  color: #f0f0f0 !important;
}

html[data-theme="dark"] .pi-section__badge,
html[data-theme="dark"] .pi-metric {
  background: #222222 !important;
  background-image: none !important;
  color: #c6c6c6 !important;
  border-color: rgba(240, 240, 240, 0.14) !important;
}

html[data-theme="dark"] .pi-preview-badge {
  background: #2a2a2a !important;
  color: #88c0d0 !important;
}

html[data-theme="dark"] .pi-state--partial,
html[data-theme="dark"] .pi-state--stale,
html[data-theme="dark"] .pi-quality-warning {
  background: #3b2f14 !important;
  color: #fcd34d !important;
  border-color: rgba(251, 191, 36, 0.28) !important;
}

html[data-theme="dark"] .pi-disclaimer {
  background: rgba(129, 161, 193, 0.12) !important;
  border-color: rgba(136, 192, 208, 0.24) !important;
}

html[data-theme="dark"] .pi-metric__label,
html[data-theme="dark"] .pi-metric__note {
  color: #8a8a8a !important;
}

html[data-theme="dark"] .pi-metric__value {
  color: #f0f0f0 !important;
}

/* ── AI Command Center widget internals ───────────────────────── */
html[data-theme="dark"] .ai-cc-state {
  color: #8a8a8a !important;
}

html[data-theme="dark"] .ai-cc-state strong {
  color: #f0f0f0 !important;
}

html[data-theme="dark"] .ai-cc-state--restricted {
  border-color: rgba(240, 240, 240, 0.22) !important;
  background: #1e1e1e !important;
}

html[data-theme="dark"] .ai-cc-skeleton {
  background: linear-gradient(90deg, #1e1e1e, #242424, #1e1e1e) !important;
  background-size: 200% 100% !important;
}

html[data-theme="dark"] .ai-cc-focus-item,
html[data-theme="dark"] .ai-cc-card-list > li,
html[data-theme="dark"] .ai-cc-exec section {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .ai-cc-focus-rank,
html[data-theme="dark"] .ai-cc-metrics > div {
  background: #222222 !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .ai-cc-greeting span,
html[data-theme="dark"] .ai-cc-card-heading span,
html[data-theme="dark"] .ai-cc-card-heading time,
html[data-theme="dark"] .ai-cc-focus-main time,
html[data-theme="dark"] .ai-cc-list span,
html[data-theme="dark"] .ai-cc-list time,
html[data-theme="dark"] .ai-cc-meta,
html[data-theme="dark"] .ai-cc-metrics span,
html[data-theme="dark"] .ai-cc-footnote,
html[data-theme="dark"] .ai-cc-question-list small {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .ai-cc-question-list button {
  background: #1e1e1e !important;
  background-image: none !important;
  color: #e6e6e6 !important;
  border-color: rgba(240, 240, 240, 0.2) !important;
}

html[data-theme="dark"] .ai-cc-question-list button:hover,
html[data-theme="dark"] .ai-cc-question-list button:focus-visible {
  border-color: rgba(136, 192, 208, 0.45) !important;
  background: #242424 !important;
}

/* ── Ask rich response cards ──────────────────────────────────── */
html[data-theme="dark"] .ask-rich-response {
  --ask-rich-bg: #1a1a1a;
  --ask-rich-soft: #1e1e1e;
  --ask-rich-border: rgba(240, 240, 240, 0.18);
  --ask-rich-text: #f0f0f0;
  --ask-rich-muted: #8a8a8a;
  color: #f0f0f0 !important;
}

html[data-theme="dark"] .ask-rich-block,
html[data-theme="dark"] .ask-rich-metric,
html[data-theme="dark"] .ask-rich-table-wrap,
html[data-theme="dark"] .ask-rich-action-row button:not(.primary) {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .ask-rich-response__header p,
html[data-theme="dark"] .ask-rich-definitions p,
html[data-theme="dark"] .ask-rich-block p {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

/* ── Deal Coach primary CTA (Ask about this deal) ─────────────── */
html[data-theme="dark"] .ask-deal-coach__ask .btn.primary,
html[data-theme="dark"] .ask-deal-coach__action.btn.primary {
  background: var(--accent, #87a6c4) !important;
  background-image: none !important;
  border-color: var(--accent, #87a6c4) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: none !important;
}

/* ── Server Action Gateway preview/confirm ────────────────────── */
html[data-theme="dark"] .sag-preview,
html[data-theme="dark"] .sag-confirm {
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.18) !important;
}

html[data-theme="dark"] .sag-kicker,
html[data-theme="dark"] .sag-muted,
html[data-theme="dark"] .sag-kv dt,
html[data-theme="dark"] .sag-diff li span:first-child,
html[data-theme="dark"] .sag-conflicts li strong {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .sag-badge,
html[data-theme="dark"] .sag-notice,
html[data-theme="dark"] .sag-state,
html[data-theme="dark"] .sag-result,
html[data-theme="dark"] .sag-diff li,
html[data-theme="dark"] .sag-conflicts li,
html[data-theme="dark"] .sag-section ul li {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .sag-badge--high,
html[data-theme="dark"] .sag-badge--medium {
  background: #3b2f14 !important;
  color: #fcd34d !important;
}

html[data-theme="dark"] .sag-result--succeeded {
  background: #242424 !important;
  border-color: rgba(74, 222, 128, 0.28) !important;
  color: #86efac !important;
}

html[data-theme="dark"] .sag-result--blocked,
html[data-theme="dark"] .sag-result--failed {
  background: #3b1f24 !important;
  border-color: rgba(248, 113, 113, 0.28) !important;
  color: #fca5a5 !important;
}

/* ── Book Client wizard (non-glass fallback) ──────────────────── */
html[data-theme="dark"] .bc-wizard-backdrop:not(.td-glass-modal-backdrop) .modal.bc-wizard,
html[data-theme="dark"] .modal.bc-wizard:not(.td-glass-modal) {
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.2) !important;
}

html[data-theme="dark"] .bc-wizard__hero,
html[data-theme="dark"] .bc-wizard__step,
html[data-theme="dark"] .bc-wizard__card,
html[data-theme="dark"] .bc-wizard__summary {
  background: #1e1e1e !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.16) !important;
  color: #e6e6e6 !important;
}

html[data-theme="dark"] .modal.bc-wizard input,
html[data-theme="dark"] .modal.bc-wizard select,
html[data-theme="dark"] .modal.bc-wizard textarea {
  background: #1e1e1e !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.24) !important;
  color-scheme: dark !important;
}

/* ── Task / Event reminder popup (inline styles in app.js) ────── */
html[data-theme="dark"] .td-task-reminder-popup > div,
html[data-theme="dark"] .td-event-reminder-modal-backdrop.td-task-reminder-popup > div {
  background: #1a1a1a !important;
  background-image: none !important;
  border-color: rgba(240, 240, 240, 0.2) !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55) !important;
}

html[data-theme="dark"] .td-task-reminder-popup [id="td-event-reminder-title"],
html[data-theme="dark"] .td-task-reminder-popup [style*="color:#64748b"],
html[data-theme="dark"] .td-task-reminder-popup [style*="color:#475569"],
html[data-theme="dark"] .td-task-reminder-popup [style*="color:#94a3b8"] {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .td-task-reminder-popup [style*="color:#0f172a"] {
  color: #f0f0f0 !important;
  -webkit-text-fill-color: #f0f0f0 !important;
}

html[data-theme="dark"] .td-task-reminder-popup button[data-role="snooze5"],
html[data-theme="dark"] .td-task-reminder-popup button[data-role="snooze15"],
html[data-theme="dark"] .td-task-reminder-popup button[data-role="snooze30"] {
  background: #222222 !important;
  background-image: none !important;
  color: #c6c6c6 !important;
  border-color: rgba(240, 240, 240, 0.24) !important;
}

html[data-theme="dark"] .td-task-reminder-popup button[data-role="dismiss"] {
  background: #1e1e1e !important;
  color: #e6e6e6 !important;
  border-color: rgba(240, 240, 240, 0.2) !important;
}

/* ── Mobile More sheet + backdrop ─────────────────────────────── */
html[data-theme="dark"] #mobileMoreSheet.mobile-more-sheet,
html[data-theme="dark"] .mobile-more-sheet.open {
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-top-color: rgba(240, 240, 240, 0.18) !important;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45) !important;
}

html[data-theme="dark"] .mobile-more-sheet-handle {
  background: rgba(240, 240, 240, 0.35) !important;
}

html[data-theme="dark"] .mobile-more-sheet-title,
html[data-theme="dark"] .mobile-more-account__hint,
html[data-theme="dark"] .mobile-more-account__email {
  color: #8a8a8a !important;
  -webkit-text-fill-color: #8a8a8a !important;
}

html[data-theme="dark"] .mobile-more-account,
html[data-theme="dark"] .mobile-more-item,
html[data-theme="dark"] .mobile-more-account-btn {
  background: transparent !important;
  color: #e6e6e6 !important;
  border-color: rgba(240, 240, 240, 0.14) !important;
}

html[data-theme="dark"] .mobile-more-item:hover,
html[data-theme="dark"] .mobile-more-item:focus-visible,
html[data-theme="dark"] .mobile-more-account-btn:hover,
html[data-theme="dark"] .mobile-more-account-btn:focus-visible {
  background: #242424 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] #mobileMoreBackdrop {
  background: rgba(0, 0, 0, 0.62) !important;
}

/* ── Grow menu hover (beats injected #tools-actions-styles) ───── */
html[data-theme="dark"] #__toolsMenu .tools-action-item:hover,
html[data-theme="dark"] #__toolsMenu .tools-action-item:focus-visible,
html[data-theme="dark"] #__fileMenu .file-action-item:hover,
html[data-theme="dark"] #__fileMenu .file-action-item:focus-visible,
html[data-theme="dark"] #__simpleMoreMenu .file-action-item:hover,
html[data-theme="dark"] #__simpleMoreMenu .file-action-item:focus-visible {
  background: #242424 !important;
  background-image: none !important;
  transform: translateY(-2px);
}

/* ── Briefing shelf + AI segment explain + search slash ───────── */
html[data-theme="dark"] .briefing-shelf,
html[data-theme="dark"] .briefing-shelf__panel,
html[data-theme="dark"] #aiSegmentExplainPanel,
html[data-theme="dark"] #searchSlashPanel,
html[data-theme="dark"] #listOptionsPanel,
html[data-theme="dark"] #sortMenu,
html[data-theme="dark"] #mainNavTabOrderFlyout {
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.2) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .briefing-shelf__head,
html[data-theme="dark"] .briefing-shelf__item,
html[data-theme="dark"] #aiSegmentExplainPanel .ai-segment-explain-row,
html[data-theme="dark"] #searchSlashPanel button,
html[data-theme="dark"] #listOptionsPanel button,
html[data-theme="dark"] #sortMenu button {
  color: #e6e6e6 !important;
  border-color: rgba(240, 240, 240, 0.14) !important;
}

html[data-theme="dark"] .briefing-shelf__item:hover,
html[data-theme="dark"] #searchSlashPanel button:hover,
html[data-theme="dark"] #listOptionsPanel button:hover,
html[data-theme="dark"] #sortMenu button:hover {
  background: #242424 !important;
}

/* ── Contact / Filter modals (static shells) ──────────────────── */
html[data-theme="dark"] body[data-theme="momentum"] #contactModal .modal,
html[data-theme="dark"] body[data-theme="momentum"] #contactModal .modalBody,
html[data-theme="dark"] body[data-theme="momentum"] #filterModal .modal,
html[data-theme="dark"] body[data-theme="momentum"] #filterModal .filter-panel-v3,
html[data-theme="dark"] body[data-theme="momentum"] #addRelationshipBackdrop .modal,
html[data-theme="dark"] body[data-theme="momentum"] #ownerAssignmentSelectBackdrop .modal,
html[data-theme="dark"] body[data-theme="momentum"] #folderModal .modal {
  background: #1a1a1a !important;
  background-image: none !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.2) !important;
}

html[data-theme="dark"] body[data-theme="momentum"] #contactModal input,
html[data-theme="dark"] body[data-theme="momentum"] #contactModal select,
html[data-theme="dark"] body[data-theme="momentum"] #contactModal textarea,
html[data-theme="dark"] body[data-theme="momentum"] #filterModal input,
html[data-theme="dark"] body[data-theme="momentum"] #filterModal select {
  background: #1e1e1e !important;
  color: #f0f0f0 !important;
  border-color: rgba(240, 240, 240, 0.24) !important;
  color-scheme: dark !important;
}

/* ── Left folder sidebar polish ───────────────────────────────── */
html[data-theme="dark"] .folderPane,
html[data-theme="dark"] .folderPane .folderList,
html[data-theme="dark"] .folderPane .folderItem {
  background: #181818 !important;
  background-image: none !important;
  color: #c6c6c6 !important;
  border-color: rgba(240, 240, 240, 0.12) !important;
}

html[data-theme="dark"] .folderPane .folderItem:hover,
html[data-theme="dark"] .folderPane .folderItem.active,
html[data-theme="dark"] .folderPane .folderItem[aria-selected="true"] {
  background: #242424 !important;
  color: #f0f0f0 !important;
}

/* ── Universal portaled inline-style neutralizer (scoped) ─────── */
html[data-theme="dark"] body[data-theme="momentum"] :is(
  #__toolsMenu,
  #__fileMenu,
  #mobileMoreSheet,
  .td-task-reminder-popup,
  .grounded-draft-panel,
  .pi-panel,
  .meeting-intelligence-modal,
  .contact-intelligence,
  .company-intelligence,
  .briefing-shelf,
  #aiSegmentExplainPanel,
  #searchSlashPanel,
  #listOptionsPanel,
  #sortMenu,
  #mainNavTabOrderFlyout,
  .sag-preview,
  .sag-confirm
) :is(
  [style*="background:#fff"],
  [style*="background: #fff"],
  [style*="background:#ffffff"],
  [style*="background: #ffffff"],
  [style*="background:#f8fafc"],
  [style*="background: #f8fafc"],
  [style*="background:#f9fafb"],
  [style*="background: #f9fafb"],
  [style*="background:#f1f5f9"],
  [style*="background: #f1f5f9"]
) {
  background: #1a1a1a !important;
  background-image: none !important;
}

html[data-theme="dark"] body[data-theme="momentum"] :is(
  #__toolsMenu,
  #__fileMenu,
  .td-task-reminder-popup,
  .grounded-draft-panel,
  .pi-panel,
  .meeting-intelligence-modal,
  .contact-intelligence,
  .company-intelligence
) :is(
  [style*="color:#0f172a"],
  [style*="color: #0f172a"],
  [style*="color:#334155"],
  [style*="color: #334155"],
  [style*="color:#374151"],
  [style*="color: #374151"],
  [style*="color:#475569"],
  [style*="color: #475569"]
) {
  color: #e6e6e6 !important;
  -webkit-text-fill-color: #e6e6e6 !important;
}
