/* AudienceLens dark-mode component fixes v3
   Covers builder, readiness, reports, audience cards, location tree, composer/editor and sticky rails.
*/

html[data-theme="dark"] {
  --al-dark-page: #020617;
  --al-dark-surface: #0f172a;
  --al-dark-surface-2: #111827;
  --al-dark-surface-3: #1e293b;
  --al-dark-input: #08111f;
  --al-dark-border: #243044;
  --al-dark-border-2: #334155;
  --al-dark-text: #e5e7eb;
  --al-dark-heading: #f8fafc;
  --al-dark-muted: #94a3b8;
  --al-dark-accent: #ea580c;
}

/* Main builder/report component families */
html[data-theme="dark"] [class*="builder-"],
html[data-theme="dark"] [class*="readiness-"],
html[data-theme="dark"] [class*="composer-"],
html[data-theme="dark"] [class*="message-"],
html[data-theme="dark"] [class*="audience-"],
html[data-theme="dark"] [class*="location-"],
html[data-theme="dark"] [class*="report-"],
html[data-theme="dark"] [class*="scenario-"],
html[data-theme="dark"] [class*="context-"],
html[data-theme="dark"] [class*="checklist-"],
html[data-theme="dark"] [class*="legal-"],
html[data-theme="dark"] [class*="footer-"] {
  border-color: var(--al-dark-border) !important;
}

/* Cards, panels, shells and rows */
html[data-theme="dark"] [class*="builder-hero"],
html[data-theme="dark"] [class*="builder-card"],
html[data-theme="dark"] [class*="builder-panel"],
html[data-theme="dark"] [class*="builder-section"],
html[data-theme="dark"] [class*="builder-step"],
html[data-theme="dark"] [class*="builder-rail"],
html[data-theme="dark"] [class*="builder-sidebar"],
html[data-theme="dark"] [class*="builder-summary"],
html[data-theme="dark"] [class*="readiness-hero"],
html[data-theme="dark"] [class*="readiness-card"],
html[data-theme="dark"] [class*="readiness-panel"],
html[data-theme="dark"] [class*="readiness-step"],
html[data-theme="dark"] [class*="readiness-rail"],
html[data-theme="dark"] [class*="readiness-sidebar"],
html[data-theme="dark"] [class*="readiness-summary"],
html[data-theme="dark"] [class*="message-card"],
html[data-theme="dark"] [class*="message-panel"],
html[data-theme="dark"] [class*="message-section"],
html[data-theme="dark"] [class*="message-editor"],
html[data-theme="dark"] [class*="message-composer"],
html[data-theme="dark"] [class*="composer-card"],
html[data-theme="dark"] [class*="composer-panel"],
html[data-theme="dark"] [class*="audience-card"],
html[data-theme="dark"] [class*="audience-panel"],
html[data-theme="dark"] [class*="audience-option"],
html[data-theme="dark"] [class*="audience-picker"],
html[data-theme="dark"] [class*="audience-selection"],
html[data-theme="dark"] [class*="audience-recommend"],
html[data-theme="dark"] [class*="location-card"],
html[data-theme="dark"] [class*="location-panel"],
html[data-theme="dark"] [class*="location-tree"],
html[data-theme="dark"] [class*="location-node"],
html[data-theme="dark"] [class*="report-card"],
html[data-theme="dark"] [class*="report-panel"],
html[data-theme="dark"] [class*="report-section"],
html[data-theme="dark"] [class*="scenario-card"],
html[data-theme="dark"] [class*="context-card"],
html[data-theme="dark"] [class*="checklist-card"],
html[data-theme="dark"] [class*="checklist-item"] {
  background: linear-gradient(135deg, var(--al-dark-surface-2), var(--al-dark-surface)) !important;
  color: var(--al-dark-text) !important;
  border-color: var(--al-dark-border) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34) !important;
}

/* Explicit known classes */
html[data-theme="dark"] .builder-readiness-hero,
html[data-theme="dark"] .builder-readiness-hero--active,
html[data-theme="dark"] .builder-readiness-card,
html[data-theme="dark"] .builder-readiness-card--active,
html[data-theme="dark"] .builder-readiness-step,
html[data-theme="dark"] .builder-readiness-step--active,
html[data-theme="dark"] .builder-readiness-step--complete,
html[data-theme="dark"] .builder-readiness-sidebar,
html[data-theme="dark"] .builder-readiness-rail,
html[data-theme="dark"] .builder-readiness-checklist,
html[data-theme="dark"] .builder-readiness-status {
  background: linear-gradient(135deg, var(--al-dark-surface-2), var(--al-dark-surface)) !important;
  color: var(--al-dark-text) !important;
  border-color: var(--al-dark-border) !important;
}

/* Any hard-coded light Tailwind blocks inside those areas */
html[data-theme="dark"] [class*="builder-"] [class*="bg-white"],
html[data-theme="dark"] [class*="builder-"] [class*="bg-slate-50"],
html[data-theme="dark"] [class*="builder-"] [class*="bg-gray-50"],
html[data-theme="dark"] [class*="builder-"] [class*="bg-zinc-50"],
html[data-theme="dark"] [class*="builder-"] [class*="bg-neutral-50"],
html[data-theme="dark"] [class*="builder-"] [class*="bg-orange-50"],
html[data-theme="dark"] [class*="builder-"] [class*="bg-amber-50"],
html[data-theme="dark"] [class*="builder-"] [class*="bg-yellow-50"],
html[data-theme="dark"] [class*="readiness-"] [class*="bg-white"],
html[data-theme="dark"] [class*="readiness-"] [class*="bg-slate-50"],
html[data-theme="dark"] [class*="readiness-"] [class*="bg-gray-50"],
html[data-theme="dark"] [class*="readiness-"] [class*="bg-orange-50"],
html[data-theme="dark"] [class*="audience-"] [class*="bg-white"],
html[data-theme="dark"] [class*="audience-"] [class*="bg-slate-50"],
html[data-theme="dark"] [class*="audience-"] [class*="bg-orange-50"],
html[data-theme="dark"] [class*="location-"] [class*="bg-white"],
html[data-theme="dark"] [class*="location-"] [class*="bg-slate-50"],
html[data-theme="dark"] [class*="location-"] [class*="bg-gray-50"],
html[data-theme="dark"] [class*="report-"] [class*="bg-white"],
html[data-theme="dark"] [class*="report-"] [class*="bg-slate-50"],
html[data-theme="dark"] [class*="report-"] [class*="bg-gray-50"] {
  background: var(--al-dark-surface) !important;
  background-image: none !important;
  color: var(--al-dark-text) !important;
  border-color: var(--al-dark-border) !important;
}

/* Direct light Tailwind classes on the target element itself */
html[data-theme="dark"] [class*="builder-"][class*="bg-white"],
html[data-theme="dark"] [class*="builder-"][class*="bg-slate-50"],
html[data-theme="dark"] [class*="builder-"][class*="bg-gray-50"],
html[data-theme="dark"] [class*="builder-"][class*="bg-orange-50"],
html[data-theme="dark"] [class*="readiness-"][class*="bg-white"],
html[data-theme="dark"] [class*="readiness-"][class*="bg-slate-50"],
html[data-theme="dark"] [class*="readiness-"][class*="bg-gray-50"],
html[data-theme="dark"] [class*="readiness-"][class*="bg-orange-50"],
html[data-theme="dark"] [class*="audience-"][class*="bg-white"],
html[data-theme="dark"] [class*="audience-"][class*="bg-slate-50"],
html[data-theme="dark"] [class*="audience-"][class*="bg-gray-50"],
html[data-theme="dark"] [class*="audience-"][class*="bg-orange-50"],
html[data-theme="dark"] [class*="location-"][class*="bg-white"],
html[data-theme="dark"] [class*="location-"][class*="bg-slate-50"],
html[data-theme="dark"] [class*="location-"][class*="bg-gray-50"],
html[data-theme="dark"] [class*="report-"][class*="bg-white"],
html[data-theme="dark"] [class*="report-"][class*="bg-slate-50"],
html[data-theme="dark"] [class*="report-"][class*="bg-gray-50"] {
  background: var(--al-dark-surface) !important;
  background-image: none !important;
  color: var(--al-dark-text) !important;
  border-color: var(--al-dark-border) !important;
}

/* Text inside affected components */
html[data-theme="dark"] [class*="builder-"] h1,
html[data-theme="dark"] [class*="builder-"] h2,
html[data-theme="dark"] [class*="builder-"] h3,
html[data-theme="dark"] [class*="builder-"] h4,
html[data-theme="dark"] [class*="builder-"] strong,
html[data-theme="dark"] [class*="readiness-"] h1,
html[data-theme="dark"] [class*="readiness-"] h2,
html[data-theme="dark"] [class*="readiness-"] h3,
html[data-theme="dark"] [class*="readiness-"] h4,
html[data-theme="dark"] [class*="readiness-"] strong,
html[data-theme="dark"] [class*="audience-"] h1,
html[data-theme="dark"] [class*="audience-"] h2,
html[data-theme="dark"] [class*="audience-"] h3,
html[data-theme="dark"] [class*="audience-"] strong,
html[data-theme="dark"] [class*="location-"] h1,
html[data-theme="dark"] [class*="location-"] h2,
html[data-theme="dark"] [class*="location-"] h3,
html[data-theme="dark"] [class*="location-"] strong,
html[data-theme="dark"] [class*="report-"] h1,
html[data-theme="dark"] [class*="report-"] h2,
html[data-theme="dark"] [class*="report-"] h3,
html[data-theme="dark"] [class*="report-"] strong {
  color: var(--al-dark-heading) !important;
}

html[data-theme="dark"] [class*="builder-"] p,
html[data-theme="dark"] [class*="builder-"] span,
html[data-theme="dark"] [class*="builder-"] li,
html[data-theme="dark"] [class*="builder-"] label,
html[data-theme="dark"] [class*="readiness-"] p,
html[data-theme="dark"] [class*="readiness-"] span,
html[data-theme="dark"] [class*="readiness-"] li,
html[data-theme="dark"] [class*="readiness-"] label,
html[data-theme="dark"] [class*="audience-"] p,
html[data-theme="dark"] [class*="audience-"] span,
html[data-theme="dark"] [class*="audience-"] li,
html[data-theme="dark"] [class*="audience-"] label,
html[data-theme="dark"] [class*="location-"] p,
html[data-theme="dark"] [class*="location-"] span,
html[data-theme="dark"] [class*="location-"] li,
html[data-theme="dark"] [class*="location-"] label,
html[data-theme="dark"] [class*="report-"] p,
html[data-theme="dark"] [class*="report-"] span,
html[data-theme="dark"] [class*="report-"] li,
html[data-theme="dark"] [class*="report-"] label {
  color: var(--al-dark-text) !important;
}

/* Muted text utilities */
html[data-theme="dark"] [class*="builder-"] [class*="text-slate-500"],
html[data-theme="dark"] [class*="builder-"] [class*="text-slate-600"],
html[data-theme="dark"] [class*="builder-"] [class*="text-gray-500"],
html[data-theme="dark"] [class*="builder-"] [class*="text-gray-600"],
html[data-theme="dark"] [class*="readiness-"] [class*="text-slate-500"],
html[data-theme="dark"] [class*="readiness-"] [class*="text-slate-600"],
html[data-theme="dark"] [class*="audience-"] [class*="text-slate-500"],
html[data-theme="dark"] [class*="audience-"] [class*="text-slate-600"],
html[data-theme="dark"] [class*="location-"] [class*="text-slate-500"],
html[data-theme="dark"] [class*="location-"] [class*="text-slate-600"],
html[data-theme="dark"] [class*="report-"] [class*="text-slate-500"],
html[data-theme="dark"] [class*="report-"] [class*="text-slate-600"] {
  color: var(--al-dark-muted) !important;
}

/* Inputs/editors inside builder/report pages */
html[data-theme="dark"] [class*="builder-"] input,
html[data-theme="dark"] [class*="builder-"] textarea,
html[data-theme="dark"] [class*="builder-"] select,
html[data-theme="dark"] [class*="builder-"] [contenteditable="true"],
html[data-theme="dark"] [class*="builder-"] .ProseMirror,
html[data-theme="dark"] [class*="message-"] input,
html[data-theme="dark"] [class*="message-"] textarea,
html[data-theme="dark"] [class*="message-"] select,
html[data-theme="dark"] [class*="message-"] [contenteditable="true"],
html[data-theme="dark"] [class*="message-"] .ProseMirror,
html[data-theme="dark"] [class*="location-"] input,
html[data-theme="dark"] [class*="location-"] textarea,
html[data-theme="dark"] [class*="location-"] select {
  background: var(--al-dark-input) !important;
  color: var(--al-dark-heading) !important;
  border-color: var(--al-dark-border-2) !important;
  caret-color: var(--al-dark-heading) !important;
}

/* Toolbars */
html[data-theme="dark"] [class*="toolbar"],
html[data-theme="dark"] [class*="Toolbar"],
html[data-theme="dark"] [role="toolbar"] {
  background: var(--al-dark-surface) !important;
  color: var(--al-dark-text) !important;
  border-color: var(--al-dark-border-2) !important;
}

/* Sticky/floating navs and legal bars */
html[data-theme="dark"] nav,
html[data-theme="dark"] footer,
html[data-theme="dark"] [class*="sticky"],
html[data-theme="dark"] [class*="floating"],
html[data-theme="dark"] [class*="legal"],
html[data-theme="dark"] [class*="footer"] {
  background: rgba(15, 23, 42, 0.96) !important;
  background-image: none !important;
  color: var(--al-dark-text) !important;
  border-color: var(--al-dark-border) !important;
  backdrop-filter: blur(14px);
}

/* Chips, badges, pills, selected labels */
html[data-theme="dark"] [class*="chip"],
html[data-theme="dark"] [class*="Chip"],
html[data-theme="dark"] [class*="badge"],
html[data-theme="dark"] [class*="Badge"],
html[data-theme="dark"] [class*="pill"],
html[data-theme="dark"] [class*="Pill"],
html[data-theme="dark"] [class*="tag"],
html[data-theme="dark"] [class*="Tag"],
html[data-theme="dark"] [class*="selected"],
html[data-theme="dark"] [class*="Selected"],
html[data-theme="dark"] [aria-selected="true"],
html[data-theme="dark"] [aria-current="page"] {
  background: var(--al-dark-surface-3) !important;
  color: #dbeafe !important;
  border-color: var(--al-dark-border-2) !important;
}

/* Done/complete status badges */
html[data-theme="dark"] [class*="done"],
html[data-theme="dark"] [class*="Done"],
html[data-theme="dark"] [class*="complete"],
html[data-theme="dark"] [class*="Complete"] {
  border-color: #047857 !important;
}

/* Disabled / locked / not ready panels */
html[data-theme="dark"] [class*="disabled"],
html[data-theme="dark"] [class*="Disabled"],
html[data-theme="dark"] [class*="locked"],
html[data-theme="dark"] [class*="Locked"],
html[data-theme="dark"] [disabled],
html[data-theme="dark"] [aria-disabled="true"] {
  background: #0b1220 !important;
  color: #64748b !important;
  border-color: var(--al-dark-border) !important;
}

/* Keep real orange primary CTAs orange */
html[data-theme="dark"] button[class*="orange"],
html[data-theme="dark"] a[class*="orange"],
html[data-theme="dark"] button[class*="amber"],
html[data-theme="dark"] a[class*="amber"],
html[data-theme="dark"] button[class*="primary"],
html[data-theme="dark"] a[class*="primary"] {
  background: var(--al-dark-accent) !important;
  color: #fff7ed !important;
  border-color: #fb923c !important;
}

/* Location tree specific */
html[data-theme="dark"] [class*="location-tree"] button,
html[data-theme="dark"] [class*="location-tree"] [role="treeitem"],
html[data-theme="dark"] [class*="location-node"],
html[data-theme="dark"] [class*="tree-node"],
html[data-theme="dark"] [class*="TreeNode"] {
  background: var(--al-dark-surface) !important;
  color: var(--al-dark-text) !important;
  border-color: var(--al-dark-border-2) !important;
}

/* Final action / readiness footer block */
html[data-theme="dark"] [class*="final"],
html[data-theme="dark"] [class*="Final"],
html[data-theme="dark"] [class*="submit"],
html[data-theme="dark"] [class*="Submit"] {
  border-color: var(--al-dark-border) !important;
}

/* AudienceLens dark-mode fix: builder summary rail / readiness panel */
html[data-theme="dark"] section.panel.review-panel.workspace-support.builder-summary-rail.al-surface-card,
html[data-theme="dark"] .builder-summary-rail,
html[data-theme="dark"] .review-panel.workspace-support,
html[data-theme="dark"] .al-surface-card.builder-summary-rail {
  background: #0f172a !important;
  background-image: none !important;
  color: #e5e7eb !important;
  border-color: #243044 !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38) !important;
}

html[data-theme="dark"] .builder-summary-rail *,
html[data-theme="dark"] .review-panel.workspace-support *,
html[data-theme="dark"] .al-surface-card.builder-summary-rail * {
  border-color: #243044 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-hero,
html[data-theme="dark"] .builder-summary-rail .builder-readiness-hero--active {
  background: linear-gradient(135deg, #111827, #0f172a) !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .builder-summary-rail .section-label,
html[data-theme="dark"] .builder-summary-rail .metric-label {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .builder-summary-rail strong,
html[data-theme="dark"] .builder-summary-rail .builder-readiness-hero strong,
html[data-theme="dark"] .builder-summary-rail .builder-next-action-card strong,
html[data-theme="dark"] .builder-summary-rail .builder-rail-meta strong {
  color: #f8fafc !important;
  background: transparent !important;
}

html[data-theme="dark"] .builder-summary-rail p,
html[data-theme="dark"] .builder-summary-rail span {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-grid {
  background: transparent !important;
  color: #e5e7eb !important;
  border-color: #243044 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item,
html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--missing,
html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--done,
html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--optional {
  background: #111827 !important;
  background-image: none !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--missing {
  border-color: #92400e !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--done {
  border-color: #047857 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--optional {
  border-color: #475569 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  border-radius: 999px !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--missing strong {
  background: #451a03 !important;
  color: #fed7aa !important;
  border-color: #92400e !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--done strong {
  background: #064e3b !important;
  color: #d1fae5 !important;
  border-color: #047857 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-readiness-item--optional strong {
  background: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: #475569 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-next-action-card {
  background: #111827 !important;
  background-image: none !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-rail-meta {
  background: transparent !important;
  color: #e5e7eb !important;
  border-color: #243044 !important;
}

html[data-theme="dark"] .builder-summary-rail .builder-rail-meta > div {
  background: #111827 !important;
  background-image: none !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  border-radius: 14px !important;
}

html[data-theme="dark"] .builder-summary-rail button.primary-button {
  background: #ea580c !important;
  color: #fff7ed !important;
  border-color: #fb923c !important;
  box-shadow: 0 12px 30px rgba(234, 88, 12, 0.22) !important;
}

html[data-theme="dark"] .builder-summary-rail button.primary-button:disabled,
html[data-theme="dark"] .builder-summary-rail button.primary-button[disabled] {
  background: #1e293b !important;
  color: #64748b !important;
  border-color: #334155 !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

html[data-theme="dark"] .builder-summary-rail svg,
html[data-theme="dark"] .builder-summary-rail .ui-icon {
  color: currentColor !important;
  stroke: currentColor !important;
}

/* Override old scanner tags in this rail */
html[data-theme="dark"] .builder-summary-rail [data-al-dark-scanned],
html[data-theme="dark"] .builder-summary-rail [data-al-dark-border] {
  border-color: #334155 !important;
}


/* AudienceLens dark-mode fix: Step 4 builder CTA panel */
html[data-theme="dark"] .builder-cta-panel,
html[data-theme="dark"] .builder-cta-panel--workspace,
html[data-theme="dark"] .al-surface-action.builder-cta-panel,
html[data-theme="dark"] section.builder-cta-panel.builder-cta-panel--workspace.al-surface-action {
  background: linear-gradient(135deg, #111827, #0f172a) !important;
  background-image: linear-gradient(135deg, #111827, #0f172a) !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34) !important;
}

html[data-theme="dark"] .builder-cta-panel *,
html[data-theme="dark"] .builder-cta-panel--workspace *,
html[data-theme="dark"] .al-surface-action.builder-cta-panel * {
  border-color: #334155 !important;
}

html[data-theme="dark"] .builder-cta-panel .metric-label,
html[data-theme="dark"] .builder-cta-panel--workspace .metric-label {
  color: #94a3b8 !important;
  background: transparent !important;
}

html[data-theme="dark"] .builder-cta-panel strong,
html[data-theme="dark"] .builder-cta-panel--workspace strong {
  color: #f8fafc !important;
  background: transparent !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .builder-cta-panel p,
html[data-theme="dark"] .builder-cta-panel span,
html[data-theme="dark"] .builder-cta-panel .picker-note,
html[data-theme="dark"] .builder-cta-panel--workspace p,
html[data-theme="dark"] .builder-cta-panel--workspace span,
html[data-theme="dark"] .builder-cta-panel--workspace .picker-note {
  color: #cbd5e1 !important;
  background: transparent !important;
}

html[data-theme="dark"] .builder-cta-panel .primary-button,
html[data-theme="dark"] .builder-cta-panel .workspace-primary-button,
html[data-theme="dark"] .builder-cta-panel--workspace .primary-button,
html[data-theme="dark"] .builder-cta-panel--workspace .workspace-primary-button {
  background: #ea580c !important;
  color: #fff7ed !important;
  border: 1px solid #fb923c !important;
  box-shadow: 0 12px 30px rgba(234, 88, 12, 0.22) !important;
}

html[data-theme="dark"] .builder-cta-panel .primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel .workspace-primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel .primary-button[disabled],
html[data-theme="dark"] .builder-cta-panel .workspace-primary-button[disabled],
html[data-theme="dark"] .builder-cta-panel--workspace .primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel--workspace .workspace-primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel--workspace .primary-button[disabled],
html[data-theme="dark"] .builder-cta-panel--workspace .workspace-primary-button[disabled] {
  background: #1e293b !important;
  color: #64748b !important;
  border-color: #334155 !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

html[data-theme="dark"] .builder-cta-panel svg,
html[data-theme="dark"] .builder-cta-panel .ui-icon,
html[data-theme="dark"] .builder-cta-panel--workspace svg,
html[data-theme="dark"] .builder-cta-panel--workspace .ui-icon {
  color: currentColor !important;
  stroke: currentColor !important;
}

/* Override old dark scanner attributes inside CTA panel */
html[data-theme="dark"] .builder-cta-panel [data-al-dark-scanned],
html[data-theme="dark"] .builder-cta-panel [data-al-dark-border],
html[data-theme="dark"] .builder-cta-panel--workspace [data-al-dark-scanned],
html[data-theme="dark"] .builder-cta-panel--workspace [data-al-dark-border] {
  border-color: #334155 !important;
}


/* AudienceLens dark-mode fix: Step 4 builder CTA panel */
html[data-theme="dark"] .builder-cta-panel,
html[data-theme="dark"] .builder-cta-panel--workspace,
html[data-theme="dark"] .al-surface-action.builder-cta-panel,
html[data-theme="dark"] section.builder-cta-panel.builder-cta-panel--workspace.al-surface-action {
  background: linear-gradient(135deg, #111827, #0f172a) !important;
  background-image: linear-gradient(135deg, #111827, #0f172a) !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34) !important;
}

html[data-theme="dark"] .builder-cta-panel *,
html[data-theme="dark"] .builder-cta-panel--workspace *,
html[data-theme="dark"] .al-surface-action.builder-cta-panel * {
  border-color: #334155 !important;
}

html[data-theme="dark"] .builder-cta-panel .metric-label,
html[data-theme="dark"] .builder-cta-panel--workspace .metric-label {
  color: #94a3b8 !important;
  background: transparent !important;
}

html[data-theme="dark"] .builder-cta-panel strong,
html[data-theme="dark"] .builder-cta-panel--workspace strong {
  color: #f8fafc !important;
  background: transparent !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .builder-cta-panel p,
html[data-theme="dark"] .builder-cta-panel span,
html[data-theme="dark"] .builder-cta-panel .picker-note,
html[data-theme="dark"] .builder-cta-panel--workspace p,
html[data-theme="dark"] .builder-cta-panel--workspace span,
html[data-theme="dark"] .builder-cta-panel--workspace .picker-note {
  color: #cbd5e1 !important;
  background: transparent !important;
}

html[data-theme="dark"] .builder-cta-panel .primary-button,
html[data-theme="dark"] .builder-cta-panel .workspace-primary-button,
html[data-theme="dark"] .builder-cta-panel--workspace .primary-button,
html[data-theme="dark"] .builder-cta-panel--workspace .workspace-primary-button {
  background: #ea580c !important;
  color: #fff7ed !important;
  border: 1px solid #fb923c !important;
  box-shadow: 0 12px 30px rgba(234, 88, 12, 0.22) !important;
}

html[data-theme="dark"] .builder-cta-panel .primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel .workspace-primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel .primary-button[disabled],
html[data-theme="dark"] .builder-cta-panel .workspace-primary-button[disabled],
html[data-theme="dark"] .builder-cta-panel--workspace .primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel--workspace .workspace-primary-button:disabled,
html[data-theme="dark"] .builder-cta-panel--workspace .primary-button[disabled],
html[data-theme="dark"] .builder-cta-panel--workspace .workspace-primary-button[disabled] {
  background: #1e293b !important;
  color: #64748b !important;
  border-color: #334155 !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

html[data-theme="dark"] .builder-cta-panel svg,
html[data-theme="dark"] .builder-cta-panel .ui-icon,
html[data-theme="dark"] .builder-cta-panel--workspace svg,
html[data-theme="dark"] .builder-cta-panel--workspace .ui-icon {
  color: currentColor !important;
  stroke: currentColor !important;
}

/* Override old dark scanner attributes inside CTA panel */
html[data-theme="dark"] .builder-cta-panel [data-al-dark-scanned],
html[data-theme="dark"] .builder-cta-panel [data-al-dark-border],
html[data-theme="dark"] .builder-cta-panel--workspace [data-al-dark-scanned],
html[data-theme="dark"] .builder-cta-panel--workspace [data-al-dark-border] {
  border-color: #334155 !important;
}


/* AudienceLens dark-mode fix: past reports / review queue rows */
html[data-theme="dark"] .review-queue-summary,
html[data-theme="dark"] summary.review-queue-summary {
  background: #0f172a !important;
  background-image: none !important;
  color: #e5e7eb !important;
  border: 1px solid #243044 !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34) !important;
}

html[data-theme="dark"] .review-queue-summary *,
html[data-theme="dark"] summary.review-queue-summary * {
  border-color: #334155 !important;
}

html[data-theme="dark"] .review-queue-score,
html[data-theme="dark"] .review-queue-main,
html[data-theme="dark"] .review-queue-meta,
html[data-theme="dark"] .review-queue-weakest,
html[data-theme="dark"] .review-queue-date,
html[data-theme="dark"] .review-queue-actions {
  background: transparent !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}

html[data-theme="dark"] .review-queue-titleline,
html[data-theme="dark"] .review-queue-title,
html[data-theme="dark"] .review-queue-issue,
html[data-theme="dark"] .review-queue-weakest strong,
html[data-theme="dark"] .review-queue-date small,
html[data-theme="dark"] .review-queue-score small,
html[data-theme="dark"] .history-score-label,
html[data-theme="dark"] .history-weak-spot {
  color: #e5e7eb !important;
  background: transparent !important;
}

html[data-theme="dark"] .review-queue-title,
html[data-theme="dark"] .review-queue-titleline strong,
html[data-theme="dark"] .review-queue-weakest strong {
  color: #f8fafc !important;
}

html[data-theme="dark"] .review-queue-issue,
html[data-theme="dark"] .review-queue-date small,
html[data-theme="dark"] .review-queue-weakest small {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .history-score {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .history-score-label,
html[data-theme="dark"] .history-score-label--urgent,
html[data-theme="dark"] .history-weak-spot,
html[data-theme="dark"] .history-weak-spot--urgent {
  background: transparent !important;
  color: #fed7aa !important;
  border-color: #92400e !important;
}

html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .review-queue-status-pill,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .chip-row .chip {
  background: #1e293b !important;
  color: #dbeafe !important;
  border: 1px solid #334155 !important;
}

html[data-theme="dark"] .review-queue-status-pill--urgent,
html[data-theme="dark"] .status-pill.review-queue-status-pill--urgent {
  background: #451a03 !important;
  color: #fed7aa !important;
  border-color: #92400e !important;
}

html[data-theme="dark"] .review-queue-actions .primary-button,
html[data-theme="dark"] .history-improve-button {
  background: #ea580c !important;
  color: #fff7ed !important;
  border: 1px solid #fb923c !important;
  box-shadow: 0 12px 30px rgba(234, 88, 12, 0.22) !important;
}

html[data-theme="dark"] .review-queue-actions .ghost-button,
html[data-theme="dark"] .ghost-button[data-open-scenario],
html[data-theme="dark"] .history-compare-button {
  background: #111827 !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .review-queue-actions .ghost-button:hover,
html[data-theme="dark"] .history-compare-button:hover {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

/* Override older scanner attributes inside review queue */
html[data-theme="dark"] .review-queue-summary [data-al-dark-bg],
html[data-theme="dark"] .review-queue-summary [data-al-dark-text],
html[data-theme="dark"] .review-queue-summary [data-al-dark-border],
html[data-theme="dark"] .review-queue-summary [data-al-dark-scanned] {
  border-color: #334155 !important;
}

html[data-theme="dark"] .review-queue-summary [data-al-dark-bg="surface"] {
  background: transparent !important;
}

html[data-theme="dark"] .review-queue-summary [data-al-dark-text="dark"] {
  color: #e5e7eb !important;
}

html[data-theme="dark"] .review-queue-summary [data-al-dark-text="muted"] {
  color: #94a3b8 !important;
}

