/* CVPilot AI — final dark mode contrast contract (loaded last)
   Fixes section surfaces and text contrast consistently across public, account, tool and admin pages.
   Resume paper canvases remain white by design for accurate document previews/printing. */
html.dark,
html[data-theme="dark"] {
  color-scheme: dark;
  --cp-bg: #151629 !important;
  --cp-paper: #22243d !important;
  --cp-paper-2: #2b2e4b !important;
  --cp-ink: #f4f1fc !important;
  --cp-muted: #cbc6dc !important;
  --cp-soft-muted: #aaa5c1 !important;
  --cp-line: #484a68 !important;
  --cp-line-strong: #626484 !important;
  --cp-accent: #b9aaff !important;
  --cp-accent-strong: #d0c6ff !important;
  --cp-accent-soft: #383252 !important;
  --cp-mint-soft: #1d4140 !important;
  --cp-teal: #80dfcf !important;
  --cp-coral: #f1a99b !important;
  --cp-gold: #efd19b !important;
  --bg: var(--cp-bg) !important;
  --paper: var(--cp-paper) !important;
  --paper-2: var(--cp-paper-2) !important;
  --ink: var(--cp-ink) !important;
  --muted: var(--cp-muted) !important;
  --line: var(--cp-line) !important;
  --soft: var(--cp-paper-2) !important;
  --kr-bg: var(--cp-bg) !important;
  --kr-surface: var(--cp-paper) !important;
  --kr-surface-soft: var(--cp-paper-2) !important;
  --kr-ink: var(--cp-ink) !important;
  --kr-muted: var(--cp-muted) !important;
  --kr-line: var(--cp-line) !important;
  --cv-surface: var(--cp-paper) !important;
  --cv-surface-soft: var(--cp-paper-2) !important;
  --cv-ink: var(--cp-ink) !important;
  --cv-muted: var(--cp-muted) !important;
  --cv-line: var(--cp-line) !important;
}

html.dark body.public-site-body,
html.dark body.admin-console-body,
html[data-theme="dark"] body.public-site-body,
html[data-theme="dark"] body.admin-console-body {
  color: var(--cp-ink) !important;
  background-color: var(--cp-bg) !important;
  background-image:
    radial-gradient(ellipse at 4% 4%, rgba(128, 105, 220, .18), transparent 34rem),
    radial-gradient(ellipse at 96% 12%, rgba(37, 155, 146, .14), transparent 31rem),
    radial-gradient(ellipse at 62% 100%, rgba(165, 103, 137, .09), transparent 38rem),
    linear-gradient(145deg, #151629 0%, #191d35 54%, #173437 100%) !important;
}

/* Sections that previously retained pale Aurora gradients because of !important rules. */
html.dark body.public-site-body .kr-template-section,
html.dark body.public-site-body .kr-tools-section,
html.dark body.public-site-body .kr-process-section,
html.dark body.public-site-body .kr-pricing-section,
html.dark body.public-site-body .kr-faq-section,
html[data-theme="dark"] body.public-site-body .kr-template-section,
html[data-theme="dark"] body.public-site-body .kr-tools-section,
html[data-theme="dark"] body.public-site-body .kr-process-section,
html[data-theme="dark"] body.public-site-body .kr-pricing-section,
html[data-theme="dark"] body.public-site-body .kr-faq-section {
  color: var(--cp-ink) !important;
  background:
    radial-gradient(ellipse at 4% 3%, rgba(128, 105, 220, .15), transparent 32rem),
    radial-gradient(ellipse at 96% 20%, rgba(41, 151, 143, .10), transparent 28rem),
    linear-gradient(135deg, #1b1b32 0%, #20253d 54%, #193536 100%) !important;
  border-color: var(--cp-line) !important;
}
html.dark body.public-site-body .kr-faq-section,
html[data-theme="dark"] body.public-site-body .kr-faq-section {
  background:
    radial-gradient(ellipse at 5% 75%, rgba(163, 119, 111, .11), transparent 29rem),
    radial-gradient(ellipse at 90% 5%, rgba(125, 107, 213, .13), transparent 30rem),
    linear-gradient(130deg, #1b1b31 0%, #22233c 55%, #1b3437 100%) !important;
}
html.dark body.public-site-body .kr-faq-wrap h2,
html[data-theme="dark"] body.public-site-body .kr-faq-wrap h2 { color: #f7f3ff !important; }
html.dark body.public-site-body .kr-faq-wrap .kr-kicker,
html.dark body.public-site-body .kr-faq-wrap > div:first-child p,
html[data-theme="dark"] body.public-site-body .kr-faq-wrap .kr-kicker,
html[data-theme="dark"] body.public-site-body .kr-faq-wrap > div:first-child p { color: #d0c8ee !important; }
html.dark body.public-site-body .kr-faq-wrap .faq-item,
html[data-theme="dark"] body.public-site-body .kr-faq-wrap .faq-item { border-color: #51516f !important; }
html.dark body.public-site-body .kr-faq-wrap .faq-question,
html[data-theme="dark"] body.public-site-body .kr-faq-wrap .faq-question { color: #f0edfb !important; }
html.dark body.public-site-body .kr-faq-wrap .faq-answer,
html[data-theme="dark"] body.public-site-body .kr-faq-wrap .faq-answer { color: #cbc6dc !important; }
html.dark body.public-site-body .kr-faq-wrap .faq-question svg,
html[data-theme="dark"] body.public-site-body .kr-faq-wrap .faq-question svg { color: #b9aaff !important; }

/* Shared page headings and supporting copy. */
html.dark body.public-site-body :where(
  .career-page-header h1, .career-page-header h2, .workspace-top h1,
  .page-hero h1, .page-hero h2, .page-hero h3, .page-heading h1,
  .page-heading h2, .page-title, .section-title, .section-head h2,
  .panel-head h2, .panel-head h3, .section-heading h2, .section-heading h3,
  .editorial-page h1, .editorial-section-heading h2,
  .editorial-article-header h1, .admin-section-heading h1,
  .template-library-title-row h2, .template-library-heading h1,
  .ats-results-header h1, .ats-page h1, .pdf-tools-heading h1,
  .checkout-heading h1, .contact-hero h1
) { color: #f4f1fc !important; }
html.dark body.public-site-body :where(
  .career-page-header p, .workspace-top > div > p, .page-hero p,
  .page-heading p, .section-head p, .panel-head p, .subhead,
  .field-hint, .field-hint-inline, .form-hint, .form-description,
  .editor-section-sub, .contact-hero > p, .page-intro,
  .template-library-title-row p, .template-library-heading p,
  .ats-page-intro, .pdf-tools-intro, .workspace-description,
  .editorial-section-heading p, .editorial-prose p,
  .editorial-prose li, .legal-copy p, .legal-copy li
) { color: #c9c5d9 !important; }
html.dark body.public-site-body :where(.muted, .text-muted, .help-text, .support-note, .meta-copy, .field-hint) {
  color: #b8b3cb !important;
}

/* Shared cards and workspace surfaces. */
html.dark body.public-site-body :where(
  .panel, .career-panel, .editor-panel, .preview-panel, .account-panel,
  .auth-card, .contact-form, .contact-aside-card, .contact-confirmation,
  .career-profile-intro, .price-card, .kr-price-card, .example-card,
  .example-guidance-strip, .job-stat-card, .stat-card, .dashboard-card,
  .quick-tool-card, .follow-up-panel, .dashboard-resumes-panel,
  .pdf-tool-card, .tool-option, .ats-guide-panel, .ats-history-panel,
  .ats-form-panel, .ats-results-panel, .tailor-main, .career-side-panel,
  .interview-output-panel, .letter-library, .cover-editor-panel,
  .billing-history-panel, .billing-current-plan, .checkout-method-panel,
  .checkout-summary-panel, .application-kit-result, .editorial-featured-card,
  .editorial-article-card, .editorial-empty-state, .editorial-aside-card,
  .editorial-bottom-cta, .template-card-premium, .kr-home-template-card,
  .admin-table-panel, .admin-settings-panel, .admin-gateways-panel,
  .admin-pricing-panel, .admin-template-ops-panel, .admin-analytics-panel,
  .admin-analytics-page-panel, .admin-provider-card, .admin-stat-card,
  .admin-quick-panel, .admin-mail-config-panel, .admin-mail-status-panel,
  .admin-mail-help-panel, .admin-ai-status-card, .admin-ai-config-panel,
  .admin-ai-check-panel, .admin-ai-model-info, .admin-users-metric-card,
  .admin-users-overview, .admin-commandbar, .admin-user-delete-dialog
) {
  color: #eeeaf8 !important;
  background: linear-gradient(145deg, #24253e 0%, #292b48 100%) !important;
  border-color: #4a4b69 !important;
  box-shadow: 0 14px 34px rgba(0,0,0,.20) !important;
}
html.dark body.public-site-body :where(
  .panel p, .career-panel p, .editor-panel p, .preview-panel p,
  .account-panel p, .auth-card p, .contact-form p, .contact-aside-card p,
  .price-card p, .kr-price-card p, .example-card p, .dashboard-card p,
  .quick-tool-card p, .pdf-tool-card p, .tool-option span,
  .ats-guide-panel p, .ats-history-panel p, .ats-form-panel p,
  .ats-results-panel p, .career-side-panel p, .interview-output-panel p,
  .billing-history-panel p, .billing-current-plan p, .checkout-summary-panel p,
  .editorial-article-card p, .editorial-aside-card p,
  .admin-provider-card p, .admin-analytics-note p, .admin-mail-help-panel p,
  .admin-ai-status-card p, .admin-ai-model-info p, .admin-users-overview p
) { color: #c7c3d8 !important; }
html.dark body.public-site-body :where(
  .panel h1, .panel h2, .panel h3, .panel h4,
  .career-panel h1, .career-panel h2, .career-panel h3,
  .editor-panel h1, .editor-panel h2, .editor-panel h3,
  .preview-panel h1, .preview-panel h2, .preview-panel h3,
  .account-panel h1, .account-panel h2, .account-panel h3,
  .auth-card h1, .auth-card h2, .auth-card h3,
  .contact-form h2, .contact-form h3, .price-card h2, .price-card h3,
  .kr-price-card h2, .kr-price-card h3, .example-card h2, .example-card h3,
  .dashboard-card h2, .dashboard-card h3, .pdf-tool-card h2, .pdf-tool-card h3,
  .ats-form-panel h2, .ats-results-panel h2, .ats-guide-panel h2,
  .admin-provider-card h3, .admin-mail-config-panel h2,
  .admin-ai-config-panel h2, .admin-ai-model-info h3
) { color: #f5f2ff !important; }

/* Header, navigation, tabs, buttons and dropdowns. */
html.dark body.public-site-body .site-header,
html.dark body.admin-console-body .admin-console-topbar,
html.dark body.admin-console-body .admin-console-sidebar { background: rgba(25,26,46,.96) !important; border-color: #454660 !important; }
html.dark body.public-site-body :where(.main-nav a, .nav-quiet, .brand-wordmark, .mobile-menu) { color: #e8e3f5 !important; }
html.dark body.public-site-body :where(.main-nav a:hover, .main-nav a.is-current, .nav-quiet:hover) { color: #c5b8ff !important; }
html.dark body.public-site-body :where(.btn-outline, .btn-secondary, .btn-ghost, .theme-toggle, .mobile-menu, .editor-tab, .tab-button, .filter-chip, .template-filter-chip) {
  color: #e9e5f5 !important;
  background: linear-gradient(145deg,#30314f,#282a45) !important;
  border-color: #5a5b7a !important;
}
html.dark body.public-site-body :where(.editor-tab.active, .tab-button.active, .filter-chip.active, .template-filter-chip.active) {
  color: #e5ddff !important;
  background: #39345c !important;
  border-color: #8e80d2 !important;
}
html.dark body.public-site-body :where(.dropdown-menu, .select-menu, .popover, .menu-panel, .command-menu, .modal-content, dialog) {
  color: #eeeaf8 !important;
  background: #252640 !important;
  border-color: #555676 !important;
}
html.dark body.public-site-body :where(.dropdown-menu a, .select-menu button, .popover a, .menu-panel a) { color: #e5e0f1 !important; }

/* Form controls: readable input text, labels, helper copy and placeholders. */
html.dark body.public-site-body :where(
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  select, textarea, .search-box input, .kr-template-search input,
  .template-search-input, .admin-page-search input
) {
  color: #f2effa !important;
  background: #1d2038 !important;
  border-color: #565878 !important;
  caret-color: #c4b6ff !important;
}
html.dark body.public-site-body :where(input,textarea,select)::placeholder { color: #a9a5bd !important; opacity: 1 !important; }
html.dark body.public-site-body :where(label, .field label, .form-label, .auth-card label, .editor-section-title) { color: #e8e3f4 !important; }
html.dark body.public-site-body :where(.field small, .field-hint, .field-hint-inline, .form-help, .input-help) { color: #bdb8cf !important; }
html.dark body.public-site-body select option { color: #f2effa; background: #1d2038; }
html.dark body.public-site-body :where(input[type=checkbox], input[type=radio]) { accent-color: #a99bff; }

/* Tables, lists, dividers and notices. */
html.dark body.public-site-body :where(table, thead, tbody, tr, th, td) { border-color: #484a68 !important; }
html.dark body.public-site-body :where(th) { color: #f1edfb !important; background: #292b47 !important; }
html.dark body.public-site-body :where(td) { color: #d4cfe1 !important; background-color: rgba(35,37,62,.62) !important; }
html.dark body.public-site-body :where(.notice, .notice.success, .notice.warning, .tool-note, .support-safety-note, .ats-disclaimer, .ats-signin-note, .billing-policy-note, .admin-gateway-notice, .admin-analytics-note, .admin-security-note) {
  color: #e6e1f2 !important;
  background: #292b46 !important;
  border-color: #555675 !important;
}
html.dark body.public-site-body :where(.notice p, .tool-note p, .support-safety-note p, .ats-disclaimer p, .billing-policy-note p) { color: #c9c4d8 !important; }
html.dark body.public-site-body :where(.divider, hr, .section-divider) { border-color: #4b4c68 !important; }

/* Footer remains distinct from the page and fully readable. */
html.dark body.public-site-body footer.site-footer {
  background:
    radial-gradient(ellipse at 8% 0%, rgba(132,104,223,.24), transparent 26rem),
    radial-gradient(ellipse at 92% 6%, rgba(35,147,140,.18), transparent 25rem),
    linear-gradient(122deg,#201b3e 0%,#202945 55%,#164246 100%) !important;
  color: #f2eefb !important;
  border-color: #575171 !important;
}
html.dark body.public-site-body footer.site-footer :where(.brand-wordmark,.footer-col strong) { color: #fffaff !important; }
html.dark body.public-site-body footer.site-footer :where(.footer-brand p,.footer-col a,.footer-bottom,.footer-bottom-links,.footer-bottom-links span) { color: #d8d2e8 !important; }
html.dark body.public-site-body footer.site-footer a:hover { color: #ffffff !important; }

/* Special cases: keep real resume previews and print sheets paper-white in dark app mode. */
html.dark body.public-site-body :where(
  .template-preview-page, .resume-preview, .resume-preview-page,
  .resume-document, .resume-paper, .resume-print-document .resume-preview,
  .resume-print-document .resume-paper, .resume-sheet
) {
  color: #252a3b !important;
  background: #ffffff !important;
  border-color: #e0e3eb !important;
}
html.dark body.public-site-body :where(.template-preview-page,.resume-preview,.resume-preview-page,.resume-document,.resume-paper,.resume-sheet) :where(h1,h2,h3,h4,p,span,li,strong,small,b) {
  /* Document-specific template rules retain their own typography and accents. */
  color: inherit;
}

/* Scrollbars and focus states remain visible on dark surfaces. */
html.dark body.public-site-body ::selection,
html.dark body.admin-console-body ::selection { color: #ffffff; background: #6456b8; }
html.dark body.public-site-body :where(a,button,input,select,textarea,[tabindex]):focus-visible,
html.dark body.admin-console-body :where(a,button,input,select,textarea,[tabindex]):focus-visible {
  outline: 3px solid rgba(185,170,255,.78) !important;
  outline-offset: 3px !important;
}
html.dark body.public-site-body ::-webkit-scrollbar-thumb,
html.dark body.admin-console-body ::-webkit-scrollbar-thumb { background: #555675; border-radius: 10px; }

@media (max-width: 760px) {
  html.dark body.public-site-body .kr-faq-section,
  html.dark body.public-site-body .kr-template-section,
  html.dark body.public-site-body .kr-tools-section,
  html.dark body.public-site-body .kr-process-section,
  html.dark body.public-site-body .kr-pricing-section {
    background: linear-gradient(145deg,#1b1b31 0%,#20233d 60%,#193638 100%) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.dark body.public-site-body *, html.dark body.admin-console-body * { scroll-behavior: auto !important; }
}


/* Additional edge surfaces used by account, blog, cookie and admin workflows. */
html.dark body.public-site-body :where(
  .form-wrap, .auth-page, .editorial-page, .editorial-sidebar,
  .editorial-prose, .editorial-prose blockquote, .editorial-prose pre,
  .editorial-prose table, .editorial-prose th, .editorial-prose td,
  .blog-admin-library, .blog-admin-editor, .blog-admin-post-card,
  .blog-admin-publish-panel, .blog-admin-editorial-tip,
  .support-ticket-item, .support-ticket-detail, .support-message,
  .support-reply-form, .support-ticket-context,
  .account-settings-grid, .account-danger-panel, .account-export-panel,
  .account-meta, .account-verification-status,
  .admin-hero-card, .admin-analytics-note, .admin-gateway-summary-card,
  .admin-gateway-encryption-warning, .admin-webhook-url-panel,
  .admin-provider-row, .admin-template-config-row, .admin-template-kpi,
  .admin-user-dialog, .admin-user-delete-warning, .admin-user-person-copy,
  .admin-mail-banner, .admin-mail-test-box, .admin-mail-save-note,
  .admin-ai-help-row, .admin-ai-master-toggle, .admin-ai-clear-key,
  .admin-ai-state-note, .admin-ai-model-info, .admin-users-empty-state,
  .admin-users-directory, .admin-users-overview, .admin-users-table-wrap
) {
  color: #e9e5f4 !important;
  background-color: #24253f !important;
  border-color: #4a4c69 !important;
}
html.dark body.public-site-body :where(
  .editorial-prose blockquote, .editorial-prose pre, .editorial-prose th,
  .blog-admin-editorial-tip, .support-ticket-context,
  .admin-gateway-encryption-warning, .admin-mail-save-note,
  .admin-ai-help-row, .admin-ai-state-note
) { background: #2a2c49 !important; }
html.dark body.public-site-body :where(
  .editorial-prose p, .editorial-prose li, .editorial-prose blockquote,
  .support-ticket-item p, .support-ticket-detail p, .support-message p,
  .admin-analytics-note p, .admin-gateway-encryption-warning p,
  .admin-webhook-url-panel small, .admin-provider-row p,
  .admin-user-dialog-intro, .admin-user-delete-warning p,
  .admin-mail-test-copy p, .admin-mail-help-panel p,
  .admin-ai-help-row p, .admin-users-empty-state p
) { color: #c8c3d8 !important; }
html.dark body.public-site-body :where(
  .editorial-prose h2, .editorial-prose h3, .editorial-prose h4,
  .support-ticket-item strong, .support-ticket-detail strong,
  .support-message strong, .admin-gateway-summary-card strong,
  .admin-provider-row strong, .admin-template-config-row strong,
  .admin-user-dialog strong, .admin-mail-banner strong,
  .admin-mail-test-copy strong, .admin-ai-help-row strong,
  .admin-users-empty-state strong
) { color: #f3effb !important; }
html.dark body.public-site-body :where(
  .cookie-consent-banner, .cookie-settings-dialog, .cookie-category,
  .cookie-settings-head, .cookie-settings-actions,
  .cookie-settings-note, .cookie-consent-copy
) {
  color: #f0ecf8 !important;
  background: #24253f !important;
  border-color: #50516f !important;
}
html.dark body.public-site-body :where(.cookie-consent-copy p, .cookie-settings-intro, .cookie-settings-note, .cookie-category small) { color: #c9c4d9 !important; }
html.dark body.public-site-body :where(.cookie-consent-copy a, .cookie-settings-dialog a, .cookie-settings-dialog .eyebrow) { color: #c5b8ff !important; }
html.dark body.public-site-body :where(.cookie-always-on) { background: #29483f !important; color: #a8e4ce !important; border-color: #3c7062 !important; }
html.dark body.public-site-body :where(.admin-console-sidebar a, .admin-nav-link, .admin-console-site-link, .admin-console-footer) { color: #c8c4d8 !important; }
html.dark body.public-site-body :where(.admin-console-nav-label, .admin-console-brand small, .admin-console-user small, .admin-console-live) { color: #aaa5c0 !important; }
html.dark body.public-site-body :where(.admin-console-topbar, .admin-console-sidebar, .admin-console-root .panel) { border-color: #494b69 !important; }
html.dark body.public-site-body :where(.admin-console-user-avatar, .admin-quick-icon, .admin-template-kpi-icon, .admin-user-dialog-icon) { color: #d7ceff !important; background: #383456 !important; }
html.dark body.public-site-body :where(.badge, .status-badge, .plan-badge, .admin-provider-badge) { border-color: #555675; }
html.dark body.public-site-body :where(.badge-success, .status-success) { color: #a8e7ca !important; background: #24483d !important; }
html.dark body.public-site-body :where(.badge-warning, .status-warning) { color: #f1d6a0 !important; background: #4a3b29 !important; }
html.dark body.public-site-body :where(.badge-danger, .status-danger) { color: #ffc2c9 !important; background: #4a2c3b !important; }

/* Admin console has its own markup namespace and receives the same contrast contract. */
html.dark body.admin-console-body :where(
  .admin-console-sidebar, .admin-console-topbar, .admin-console-main,
  .admin-sidebar, .admin-commandbar, .admin-hero-card, .admin-stat-card,
  .admin-analytics-panel, .admin-analytics-page-panel, .admin-table-panel,
  .admin-settings-panel, .admin-gateways-panel, .admin-pricing-panel,
  .admin-template-ops-panel, .admin-provider-card, .admin-quick-panel,
  .admin-mail-config-panel, .admin-mail-status-panel, .admin-mail-help-panel,
  .admin-ai-config-panel, .admin-ai-check-panel, .admin-ai-model-info,
  .admin-users-metric-card, .admin-users-overview, .admin-users-directory,
  .admin-users-table-wrap, .admin-user-delete-dialog, .admin-user-dialog,
  .admin-webhook-url-panel, .admin-gateway-summary-card
) {
  color: #eeeaf8 !important;
  background: linear-gradient(145deg,#23243d 0%,#292b48 100%) !important;
  border-color: #4a4b69 !important;
}
html.dark body.admin-console-body :where(
  .admin-section-heading h1, .admin-section-heading h2,
  .admin-page-title, .admin-console-user strong, .admin-stat-card strong,
  .admin-chart-total, .admin-table-panel h2, .admin-settings-panel h2,
  .admin-provider-card h3, .admin-ai-model-info h3,
  .admin-users-overview h2, .admin-users-directory h2
) { color: #f4f1fc !important; }
html.dark body.admin-console-body :where(
  .admin-section-heading p, .admin-stat-caption, .admin-stat-footer,
  .admin-chart-legend, .admin-chart-day, .admin-chart-foot,
  .admin-provider-card p, .admin-provider-footnote,
  .admin-webhook-url-panel small, .admin-quick-link small,
  .admin-users-overview-copy p, .admin-mail-help-panel p,
  .admin-ai-check-copy, .admin-ai-model-info li
) { color: #c5c1d7 !important; }
html.dark body.admin-console-body :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) {
  color: #f2effa !important; background: #1d2038 !important; border-color: #565878 !important;
}
html.dark body.admin-console-body :where(input,textarea,select)::placeholder { color: #aaa5bf !important; }
html.dark body.admin-console-body :where(th) { background: #292b47 !important; color: #f1edfb !important; }
html.dark body.admin-console-body :where(td) { background: rgba(35,37,62,.62) !important; color: #d4cfe1 !important; border-color: #484a68 !important; }
html.dark body.admin-console-body :where(.admin-console-nav-label,.admin-console-user small,.admin-console-brand small,.admin-console-footer) { color: #aaa5c0 !important; }
html.dark body.admin-console-body :where(.admin-console-sidebar a,.admin-nav-link,.admin-console-site-link) { color: #c8c4d8 !important; }
html.dark body.admin-console-body :where(.admin-console-sidebar a:hover,.admin-nav-link.active) { color: #e4dcff !important; background: #343253 !important; }
