/* MagicFeather MF6 Dark Surface Audit follow-up
   v6.2i12-mf6-dark-surface-audit-contract
   v6.2i12a-mf6-dark-surface-audit-followup-contract

   This file is intentionally loaded after every legacy and MF6 stylesheet.
   It does not patch individual pages. It maps remaining legacy white surfaces
   back to the shared MF6 surface tokens in Dark Mode only. */

html[data-mf-theme="dark"] body.mf6 {
  background: var(--mf6-page) !important;
  color: var(--mf6-text) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-page-header,
  .mf6-module-header,
  .module-hero-v524b,
  .series-header,
  .series-hero-polished,
  .mf-v6-page-hero,
  .mf-v6-book-hero,
  .mf6-book-hero,
  .mf-volume-hero-v526c2,
  .volume-question-hero-v46,
  .detail-hero-row,
  .cockpit-hero-v511,
  .ai-hero-v50,
  .delete-impact-hero-v58a,
  .theme-audit-hero-v527a,
  .theme-audit-hero-v527b,
  .mf6-section,
  .mf6-audit-section,
  .mf6-library-section,
  .mf-v6-library-section,
  .mf6-dashboard-grid > section,
  .mf-v6-dashboard-grid > section,
  .mf6-panel,
  .mf6-card,
  .mf6-component-card,
  .mf-v6-component-card,
  .mf6-rule,
  .mf-v6-section,
  .mf-v6-panel,
  .mf-v6-main-panel,
  .mf-v6-side-card,
  .mf-v6-focus-card,
  .series-main-panel,
  .manuscript-panel,
  .timeline-drag-panel-v520a,
  .timeline-drag-panel-v520e,
  .storycontrol-warning-panel-v44,
  .storycontrol-chapter-map-v44,
  .knowledge-dashboard-card,
  .knowledge-guidance-v21 > div,
  .timeline-hint-v520e,
  .storycontrol-chapter-row-v44,
  .knowledge-character-group-v43,
  .timeline-group-v520e,
  .storycontrol-group-v44,
  .card,
  .hero-card,
  .small-card,
  .project-card,
  .dashboard-card,
  .form-card,
  .account-card,
  .auth-card,
  .export-main-card,
  .import-preview-card,
  .fullbook-card-v520d,
  .fullbook-preview-v520d,
  .fullbook-info-card-v520d,
  .fullbook-protocol-v520d,
  .import-fullbook-card-v520c,
  .delete-impact-card-v58a,
  .delete-impact-confirm-v58a,
  .story-ai-hero-v54,
  .story-ai-form-card-v54,
  .story-ai-answer-v54,
  .story-ai-prompt-v54,
  .story-ai-history-v54,
  .secret-help-panel-v44,
  .server-cockpit-card,
  .metric-v511,
  .cockpit-card-v511,
  .history-card-v512,
  .local-ai-info-grid-v510 > div,
  .smart-mini-v513,
  .price-stat-v515,
  .module-entry-card-v524e,
  .mf6-object-card,
  .mf6-object-row,
  .knowledge-card,
  .knowledge-card-v43,
  .knowledge-state-card,
  .secret-card,
  .storylogic-card-v40a,
  .storycontrol-card-v44,
  .timeline-card-v520e,
  .timeline-item-v520e,
  .chapter-tile,
  .manuscript-section-tile,
  .volume-book-card,
  .mf-v6-project-card,
  .trash-item-v58,
  .ai-model-row-v50,
  .mf6-ki-result-card,
  .ai-volume-answer-v53,
  .volume-question-result-v46,
  .mf6-rail-card,
  .mf-v6-rail-card,
  .mf6-dialog-card,
  .mf-modal-card,
  .mf-app-modal-card-v524m1,
  .mf6-drawer-card
) {
  background: var(--mf6-surface-raised) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
  box-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-section-head,
  .section-title,
  .mf-v6-section-head,
  .clean-title,
  .knowledge-character-head-v43,
  .timeline-group-head-v520e,
  .storycontrol-group-v44 > .section-title,
  .mf-v6-manuscript-group > header,
  .manuscript-group-head-v518a,
  .ai-task-group-head-v52,
  .ai-task-group-head-v52a,
  .filter-form,
  .mf6-filter-bar,
  .compact-search,
  .price-filter-v515,
  .story-check-filterbar-v520h,
  .storylogic-filter-v40a,
  .knowledge-filter-v20,
  .knowledge-filter-v43,
  .timeline-filter-v520e,
  .empty-state,
  .inline-empty,
  .compact-empty-v51,
  .storylogic-empty-v40a,
  .delete-impact-empty-v58a,
  .mf-v6-empty-state,
  .mf6-empty-state,
  .chapter-empty,
  .volume-empty,
  .timeline-empty-v520e,
  .empty-index-card,
  .transfer-lock-note,
  .mf-v6-empty-inline,
  .mf6-empty-inline,
  .mf6-dialog-head,
  .mf6-dialog-body,
  .mf6-dialog-actions,
  .mf-modal-head,
  .mf-modal-body,
  .mf-modal-actions,
  .mf-app-modal-head-v524m1,
  .mf-app-modal-body-v524m1,
  .mf-app-modal-actions-v524m1
) {
  background: var(--mf6-surface-soft) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-stat-strip > *,
  .mf6-hero-metrics > *,
  .mf-v6-hero-metrics > *,
  .mf6-kpi-row > *,
  .mf-v6-kpi-row > *,
  .storylogic-stats-v40a > *,
  .storycontrol-stats-v44 > *,
  .timeline-stats-v520e > *,
  .knowledge-stats-v43 > *,
  .mf-v6-kpi-inline span,
  .timeline-context-grid > span,
  .live-check-summary > span,
  .story-logic-score-grid-v42 > span,
  .chapter-note-score-v45 > span,
  .textproof-score-grid > span,
  .ai-context-preview-grid > span,
  .mf6-rail-stat,
  .mf-v6-rail-stat
) {
  background: var(--mf6-surface-elevated) !important;
  color: var(--mf6-text) !important;
  border: 1px solid var(--mf6-line) !important;
  box-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea,
  .field input,
  .field select,
  .field textarea,
  .filter-form input,
  .filter-form select,
  .mf6-filter-bar input,
  .mf6-filter-bar select,
  .project-index-search input,
  .mf-v6-index-search input,
  #chapterText,
  .writing-textarea,
  .writing-textarea-v10,
  .writing-textarea-v11
) {
  background: var(--mf6-surface-field) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line-strong) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .btn:not(.primary):not(.danger):not(.danger-btn-v58):not(.danger-soft-v58):not(.danger-soft-v54b),
  button.btn:not(.primary):not(.danger):not(.danger-btn-v58):not(.danger-soft-v58):not(.danger-soft-v54b),
  a.btn:not(.primary):not(.danger):not(.danger-btn-v58):not(.danger-soft-v58):not(.danger-soft-v54b),
  .mini-btn,
  .download-link,
  .auth-link,
  .project-index-tabs button:not(.active),
  .mf-v6-index-tabs button:not(.active),
  .knowledge-filter-chip:not(.active),
  .cockpit-chip:not(.status-accent),
  .footer-health-chip-v522h,
  .mf6-quick-list a,
  .mf6-quick-action,
  .mf-v6-quick-list a,
  .mf-v6-quick-list button,
  .mf-v6-quick-action,
  .mf6-story-bible-grid a,
  .mf6-action-card:not(.primary),
  .mf-v6-action-card:not(.primary)
) {
  background: var(--mf6-surface-control) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line-strong) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .btn:not(.primary):not(.danger):hover,
  .mini-btn:hover,
  .download-link:hover,
  .auth-link:hover,
  .project-index-tabs button:not(.active):hover,
  .mf-v6-index-tabs button:not(.active):hover,
  .knowledge-filter-chip:not(.active):hover,
  .mf6-quick-list a:hover,
  .mf6-quick-action:hover,
  .mf-v6-quick-list a:hover,
  .mf-v6-quick-list button:hover,
  .mf-v6-quick-action:hover,
  .mf6-story-bible-grid a:hover,
  .mf6-action-card:not(.primary):hover,
  .mf-v6-action-card:not(.primary):hover
) {
  background: var(--mf6-surface-control-hover) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line-strong) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .btn.primary,
  button.primary,
  a.primary,
  .primary,
  .project-index-tabs button.active,
  .mf-v6-index-tabs button.active,
  .knowledge-filter-chip.active,
  .mf6-action-card.primary,
  .mf-v6-action-card.primary,
  #manualSaveButton
) {
  background: var(--mf6-gold-500) !important;
  color: #071126 !important;
  border-color: var(--mf6-gold-300) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .badge,
  .pill,
  .chip,
  .status-pill,
  .count-pill,
  .meta-pill,
  .mini-pill,
  .type-pill,
  .quality-chip,
  .price-badge,
  .price-badge-v515,
  .section-status,
  .section-type-badge,
  .word-pill,
  .save-state-pill,
  .context-chip,
  .project-index-chip,
  .mf6-chip,
  .mf6-object-chip,
  .knowledge-meta-badges span,
  .knowledge-state-badges-v43 span,
  .storylogic-chip-row-v40a span,
  .meta-row span,
  .drawer-meta span,
  .drawer-facts span,
  .mini-chip-v511,
  .timeline-warn-chip-v520e
) {
  background: var(--mf6-surface-soft) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-object-icon,
  .index-avatar,
  .cover-thumb,
  .logo-thumb,
  .series-logo,
  .book-cover-frame,
  .volume-hero-cover,
  .mf6-media-frame,
  .module-entry-icon-v524e,
  .detail-icon,
  .drawer-icon,
  .side-nav-icon,
  .empty-icon,
  .knowledge-type-icon
) {
  background: var(--mf6-surface-icon) !important;
  color: var(--mf6-gold-300) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .danger-chip-v40a,
  .btn.danger,
  .danger-btn-v58,
  .danger-soft-v58,
  .danger-soft-v54b,
  .danger-chip-v40a,
  .has-conflict-v43,
  .timeline-hint-v520e.danger
) {
  background: var(--mf6-surface-danger) !important;
  color: #ffb3aa !important;
  border-color: rgba(255, 142, 130, .36) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  strong,
  label,
  .field span,
  .form-field label,
  .module-hero-copy-v524b h1,
  .module-hero-copy-v524b h2,
  .mf6-module-header h1,
  .mf6-module-header h2,
  .theme-audit-hero-v527a h1,
  .theme-audit-hero-v527b h1,
  .mf6-component-card h3,
  .mf6-rule h3
) {
  color: var(--mf6-text) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  p,
  li,
  dd,
  td,
  .module-hero-copy-v524b p:not(.eyebrow),
  .series-hero-copy p:not(.eyebrow),
  .mf-v6-book-copy p:not(.eyebrow),
  .storylogic-help-v40a,
  .storylogic-desc-v40a,
  .timeline-hint-v520e span
) {
  color: var(--mf6-muted) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .muted,
  small,
  .helptext,
  .hint,
  .eyebrow,
  .project-body p,
  .knowledge-card p,
  .detail-section p,
  .mini-list small,
  .series-side-nav small,
  .index-entry-text small,
  .mf6-story-bible-grid span
) {
  color: var(--mf6-muted) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(code, pre) {
  background: var(--mf6-surface-field) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(table, .mf-table-scroll) {
  background: var(--mf6-surface-raised) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(th, .transfer-file-row-head) {
  background: var(--mf6-surface-table-head) !important;
  color: var(--mf6-muted) !important;
  border-color: var(--mf6-line) !important;
}

/* v7-desktop-dark-touch-gate: legacy shared table rows, Story-Control meta
   tiles and primary action copy participate in the semantic Dark surfaces. */
html[data-mf-theme="dark"] body.mf6 .table-v511 :is(tbody tr, td) {
  background: var(--mf6-surface-raised) !important;
  color: var(--mf6-muted) !important;
}

html[data-mf-theme="dark"] body.mf6 .storycontrol-timeline-v44 > div {
  background: var(--mf6-surface-elevated) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6 .storycontrol-timeline-v44 > div :is(span, strong, small) {
  color: inherit !important;
}

html[data-mf-theme="dark"] body.mf6 :is(.mf6-action-card.primary, .mf-v6-action-card.primary) :is(strong, small, span) {
  color: #071126 !important;
}

/* v6.2i12b-mf6-dark-contrast-runtime-contract
   Second browser-audit pass: remaining Dark Mode failures were not page bugs,
   but missing global contrast handling for high-specificity editor textareas,
   inline audit/warning surfaces and editor tool popups. */

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  textarea#chapterText.writing-textarea,
  textarea[name="content"],
  #id_content,
  .chapter-textarea,
  [data-editor-textarea]
) {
  background: var(--mf6-editor-paper) !important;
  color: var(--mf6-text) !important;
  -webkit-text-fill-color: var(--mf6-text) !important;
  caret-color: var(--mf6-gold-300) !important;
  border-color: var(--mf6-line) !important;
  text-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  textarea#chapterText.writing-textarea,
  textarea[name="content"],
  #id_content,
  .chapter-textarea,
  [data-editor-textarea]
)::placeholder {
  color: var(--mf6-muted) !important;
  -webkit-text-fill-color: var(--mf6-muted) !important;
  opacity: .9 !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  textarea,
  input,
  [contenteditable="true"],
  #chapterText,
  .mf6-writing-sample,
  .writing-textarea,
  .writing-textarea-v10,
  .writing-textarea-v11
)::selection {
  background: rgba(68, 188, 210, .48) !important;
  color: #f7fbff !important;
  -webkit-text-fill-color: #f7fbff !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-object-card,
  .storycontrol-card-v44,
  .knowledge-card-v43,
  .knowledge-state-card,
  .timeline-card-v520e,
  .storylogic-card-v40a,
  .story-check-problem-card-v520h
) :is(
  .storycontrol-workflow-v44,
  .storycontrol-timeline-v44 > div,
  .storycontrol-issues-v44 > div,
  .storycontrol-terms-v44,
  .knowledge-warning-v43,
  .story-check-alert-v520h,
  .story-check-recommendation-v520h,
  .story-check-problem-body-v520h,
  .timeline-hint-v520e,
  .timeline-context-grid > span,
  .live-check-summary > span,
  .story-logic-score-grid-v42 > span,
  .chapter-note-score-v45 > span,
  .textproof-score-grid > span
) {
  background: var(--mf6-surface-elevated) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
  box-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .storycontrol-timeline-v44 > div,
  .storycontrol-issues-v44 > div,
  .knowledge-warning-v43,
  .story-check-alert-v520h,
  .story-check-recommendation-v520h,
  .timeline-hint-v520e
) :is(span, strong, small, p) {
  color: inherit !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .storycontrol-issues-v44 > div,
  .knowledge-warning-v43,
  .story-check-alert-v520h,
  .story-check-recommendation-v520h,
  .timeline-hint-v520e.warning,
  .timeline-hint-v520e.warn
) {
  background: rgba(224, 174, 58, .14) !important;
  color: #f4d89a !important;
  border-color: rgba(224, 174, 58, .35) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .storycontrol-issues-v44 > .issue-danger,
  .storycontrol-issues-v44 > .issue-critical,
  .story-check-alert-v520h.danger,
  .story-check-problem-card-v520h.danger,
  .story-check-problem-card-v520h.critical,
  .timeline-hint-v520e.danger,
  .knowledge-card-v43.has-conflict-v43,
  .knowledge-state-card.has-conflict-v43
) {
  background: var(--mf6-surface-danger) !important;
  color: #ffb3aa !important;
  border-color: rgba(255, 142, 130, .42) !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  .editor-popup-card-v55d,
  .editor-tool-card-v55a.is-open-v55a,
  .editor-textproof-card.is-open-v55a,
  .editor-comfort-modal,
  .editor-comfort-card,
  .chapter-tool-modal,
  .chapter-tool-card
) {
  background: var(--mf6-surface-raised) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
  box-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  .editor-tool-card-v55a.is-open-v55a .editor-popup-head-v55d,
  .editor-textproof-card.is-open-v55a .editor-popup-head-v55d,
  .editor-tool-card-v55a.is-open-v55a .focus-card-head,
  .editor-textproof-card.is-open-v55a .focus-card-head,
  .editor-tool-card-v55a.is-open-v55a details > summary,
  .editor-tool-card-v55a.is-open-v55a .live-check-group h4,
  .editor-tool-card-v55a.is-open-v55a .textproof-section > h4,
  .editor-tool-card-v55a.is-open-v55a .textproof-details > summary
) {
  background: var(--mf6-surface-modal-head) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  .editor-tool-card-v55a.is-open-v55a .timeline-context-grid,
  .editor-tool-card-v55a.is-open-v55a .live-check-summary,
  .editor-tool-card-v55a.is-open-v55a .story-logic-score-grid-v42,
  .editor-tool-card-v55a.is-open-v55a .chapter-note-score-v45,
  .editor-tool-card-v55a.is-open-v55a .textproof-score-grid,
  .editor-textproof-card.is-open-v55a .textproof-score-grid,
  .editor-tool-card-v55a.is-open-v55a details,
  .editor-tool-card-v55a.is-open-v55a .live-check-group,
  .editor-tool-card-v55a.is-open-v55a .textproof-section,
  .editor-tool-card-v55a.is-open-v55a .textproof-details
) {
  background: var(--mf6-surface-soft) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  .editor-tool-card-v55a.is-open-v55a .timeline-context-grid > span,
  .editor-tool-card-v55a.is-open-v55a .live-check-summary > span,
  .editor-tool-card-v55a.is-open-v55a .story-logic-score-grid-v42 > span,
  .editor-tool-card-v55a.is-open-v55a .chapter-note-score-v45 > span,
  .editor-tool-card-v55a.is-open-v55a .textproof-score-grid > span,
  .editor-textproof-card.is-open-v55a .textproof-score-grid > span,
  .editor-tool-card-v55a.is-open-v55a .timeline-mini-item,
  .editor-tool-card-v55a.is-open-v55a .live-check-row,
  .editor-tool-card-v55a.is-open-v55a .story-logic-rule-v42,
  .editor-tool-card-v55a.is-open-v55a .chapter-note-item-v45,
  .editor-tool-card-v55a.is-open-v55a .textproof-issue,
  .editor-tool-card-v55a.is-open-v55a .textproof-structure-row,
  .editor-textproof-card.is-open-v55a .textproof-issue,
  .editor-textproof-card.is-open-v55a .textproof-structure-row
) {
  background: var(--mf6-surface-elevated) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  .editor-tool-card-v55a.is-open-v55a strong,
  .editor-textproof-card.is-open-v55a strong,
  .editor-tool-card-v55a.is-open-v55a .textproof-score-grid strong,
  .editor-textproof-card.is-open-v55a .textproof-score-grid strong
) {
  color: var(--mf6-text) !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  .editor-tool-card-v55a.is-open-v55a small,
  .editor-textproof-card.is-open-v55a small,
  .editor-tool-card-v55a.is-open-v55a span,
  .editor-textproof-card.is-open-v55a span,
  .editor-tool-card-v55a.is-open-v55a p,
  .editor-textproof-card.is-open-v55a p
) {
  color: var(--mf6-muted) !important;
}


/* v6.2i12c-mf6-dashboard-library-surface-contract
   Third browser-audit pass: dashboard/start/library tiles and hero metrics are
   central dashboard/library components. They are mapped here through the same
   late Dark Mode surface layer, not through page-specific color fixes. */

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-dashboard-grid,
  .mf-v6-dashboard-grid,
  .mf6-project-grid,
  .mf-v6-project-grid,
  .mf6-library-grid,
  .mf-v6-library-grid
) {
  background: transparent !important;
  color: var(--mf6-text) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-library-section,
  .mf-v6-library-section,
  .mf6-dashboard-grid > section,
  .mf-v6-dashboard-grid > section,
  .mf6-start-section,
  .mf-v6-start-section,
  .mf6-project-section,
  .mf-v6-project-section,
  .mf6-list-section,
  .mf-v6-list-section
) {
  background: var(--mf6-surface-raised) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
  box-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-library-section,
  .mf-v6-library-section,
  .mf6-dashboard-grid > section,
  .mf-v6-dashboard-grid > section,
  .mf6-start-section,
  .mf-v6-start-section,
  .mf6-project-section,
  .mf-v6-project-section,
  .mf6-list-section,
  .mf-v6-list-section
) :is(
  .mf6-section-head,
  .mf-v6-section-head,
  .section-title,
  .clean-title,
  .mf6-empty-inline,
  .mf-v6-empty-inline,
  .inline-empty,
  .empty-state
) {
  background: var(--mf6-surface-soft) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-hero-metrics > *,
  .mf-v6-hero-metrics > *,
  .mf6-kpi-row > *,
  .mf-v6-kpi-row > *,
  .mf6-dashboard-stat,
  .mf-v6-dashboard-stat,
  .dashboard-stat,
  .dashboard-metric,
  .dashboard-kpi
) {
  background: var(--mf6-surface-elevated) !important;
  color: var(--mf6-text) !important;
  border: 1px solid var(--mf6-line) !important;
  box-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-hero-metrics,
  .mf-v6-hero-metrics,
  .mf6-kpi-row,
  .mf-v6-kpi-row,
  .mf6-dashboard-stat,
  .mf-v6-dashboard-stat,
  .dashboard-stat,
  .dashboard-metric,
  .dashboard-kpi
) :is(strong, small, span, p) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-project-card,
  .mf-v6-project-card,
  .mf6-book-card,
  .mf-v6-book-card,
  .mf6-library-card,
  .mf-v6-library-card,
  .mf6-start-card,
  .mf-v6-start-card,
  .mf6-choice-card,
  .mf-v6-choice-card,
  .project-type-hint,
  .mf-v6-choice-hints > *
) {
  background: var(--mf6-surface-elevated) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line) !important;
  box-shadow: none !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-project-card,
  .mf-v6-project-card,
  .mf6-book-card,
  .mf-v6-book-card,
  .mf6-library-card,
  .mf-v6-library-card,
  .mf6-start-card,
  .mf-v6-start-card,
  .mf6-choice-card,
  .mf-v6-choice-card,
  .project-type-hint,
  .mf-v6-choice-hints > *
):hover {
  background: var(--mf6-surface-control-hover) !important;
  color: var(--mf6-text) !important;
  border-color: var(--mf6-line-strong) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-project-copy,
  .mf-v6-project-copy,
  .mf6-book-copy,
  .mf-v6-book-copy,
  .mf6-library-copy,
  .mf-v6-library-copy,
  .mf6-start-copy,
  .mf-v6-start-copy,
  .project-type-hint
) :is(h2, h3, h4, strong) {
  color: var(--mf6-text) !important;
}

html[data-mf-theme="dark"] body.mf6 :is(
  .mf6-project-copy,
  .mf-v6-project-copy,
  .mf6-book-copy,
  .mf-v6-book-copy,
  .mf6-library-copy,
  .mf-v6-library-copy,
  .mf6-start-copy,
  .mf-v6-start-copy,
  .project-type-hint
) :is(p, small, span) {
  color: var(--mf6-muted) !important;
}

/* v6.2i14-visual-rich-editor-contract: Rich editor joins global editor surface family. */
html[data-mf-theme="dark"] body.mf6.mf-route-editor :is(
  .mf6-rich-editor-shell,
  .mf6-rich-editor-status,
  .mf6-rich-editor-surface,
  .mf6-rich-editor-source
) {
  background: var(--mf6-editor-paper) !important;
  color: var(--mf6-editor-ink) !important;
  border-color: var(--mf6-editor-line) !important;
}

html[data-mf-theme="dark"] body.mf6.mf-route-editor .mf6-rich-editor-surface blockquote {
  background: var(--mf6-editor-soft) !important;
  color: var(--mf6-editor-ink) !important;
  border-color: var(--mf6-gold-500) !important;
}
