/*
   PrepaConcours dark theme hardening
   Loaded last to provide stable contrast for text, cards, forms, tables and
   inline-colored sections across the public site.
*/

html[data-theme="dark"] {
  color-scheme: dark;
  --clr-primary: #7db7f0;
  --clr-primary-dk: #a8cff5;
  --clr-primary-lt: rgba(125, 183, 240, .16);
  --clr-accent: #9bc5ee;
  --clr-heading: #f6f9fc;
  --clr-text: #e8eef5;
  --clr-body: #e8eef5;
  --clr-muted: #c3ceda;
  --clr-border: rgba(148, 171, 195, .28);
  --clr-bg: #101820;
  --clr-bg-alt: #141e29;
  --clr-surface: #1a2633;
  --dark-bg: #101820;
  --dark-band: #141e29;
  --dark-surface: #1a2633;
  --dark-surface-2: #203041;
  --dark-soft: rgba(255, 255, 255, .06);
  --dark-line: rgba(148, 171, 195, .26);
  --dark-line-strong: rgba(172, 192, 214, .38);
  --dark-text: #e8eef5;
  --dark-heading: #f6f9fc;
  --dark-muted: #c3ceda;
  --dark-faint: #9fb0c2;
  --dark-link: #9cc9f5;
  --dark-focus: rgba(125, 183, 240, .36);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28), 0 8px 20px rgba(0, 0, 0, .15);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, .24);
  --shadow-lg: 0 22px 54px rgba(0, 0, 0, .32);
  --shadow-xl: 0 34px 82px rgba(0, 0, 0, .42);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--dark-bg) !important;
  color: var(--dark-text) !important;
}
html[data-theme="dark"] body { text-rendering: optimizeLegibility; }
html[data-theme="dark"] * { scrollbar-color: rgba(156, 201, 245, .42) rgba(255, 255, 255, .06); }
html[data-theme="dark"] ::selection { background: rgba(125, 183, 240, .28); color: var(--dark-heading); }
html[data-theme="dark"] :focus-visible { outline: 3px solid var(--dark-focus) !important; outline-offset: 3px; }

html[data-theme="dark"] .header {
  background: rgba(16, 24, 32, .92) !important;
  border-bottom-color: var(--dark-line) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .24) !important;
}
html[data-theme="dark"] .nav__logo,
html[data-theme="dark"] .nav__link,
html[data-theme="dark"] .nav__search-btn,
html[data-theme="dark"] .nav__burger,
html[data-theme="dark"] .nav__portal,
html[data-theme="dark"] .theme-toggle { color: var(--dark-heading) !important; }
html[data-theme="dark"] .nav__link:hover,
html[data-theme="dark"] .nav__link.active,
html[data-theme="dark"] .nav__portal:hover,
html[data-theme="dark"] .nav__portal--active,
html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .nav__search-btn:hover {
  background: rgba(125, 183, 240, .16) !important;
  border-color: rgba(156, 201, 245, .36) !important;
  color: var(--dark-heading) !important;
}

html[data-theme="dark"] .nav__dropdown {
  background: var(--dark-surface) !important;
  border-color: var(--dark-line) !important;
  box-shadow: var(--shadow-lg) !important;
}
html[data-theme="dark"] .nav__dropdown a {
  color: var(--dark-heading) !important;
}
html[data-theme="dark"] .nav__dropdown a:hover {
  background: rgba(125, 183, 240, .16) !important;
  color: var(--dark-heading) !important;
}

html[data-theme="dark"] .section,
html[data-theme="dark"] .section--alt,
html[data-theme="dark"] .competitions-section,
html[data-theme="dark"] .shared-section,
html[data-theme="dark"] .qz-page,
html[data-theme="dark"] .modules-page,
html[data-theme="dark"] .search-page,
html[data-theme="dark"] .dash-body {
  background: var(--dark-bg) !important;
  color: var(--dark-text) !important;
}
html[data-theme="dark"] .section--alt,
html[data-theme="dark"] .competitions-section,
html[data-theme="dark"] .shared-section,
html[data-theme="dark"] .dash-body {
  background: linear-gradient(180deg, var(--dark-band), var(--dark-bg)) !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .section__title,
html[data-theme="dark"] .hero__title,
html[data-theme="dark"] .module-hero__title,
html[data-theme="dark"] .qz-hero h1,
html[data-theme="dark"] .search-hero h1,
html[data-theme="dark"] .auth-card__logo h1,
html[data-theme="dark"] .dash-hero h1 {
  color: var(--dark-heading) !important;
  text-shadow: none !important;
}
html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] td,
html[data-theme="dark"] th,
html[data-theme="dark"] label,
html[data-theme="dark"] small,
html[data-theme="dark"] .section__desc,
html[data-theme="dark"] .hero__subtitle,
html[data-theme="dark"] .module-hero__desc,
html[data-theme="dark"] .qz-hero p,
html[data-theme="dark"] .search-meta,
html[data-theme="dark"] .results-summary { color: var(--dark-muted) !important; }
html[data-theme="dark"] strong,
html[data-theme="dark"] b,
html[data-theme="dark"] .stat-card__value,
html[data-theme="dark"] .dash-stat__val,
html[data-theme="dark"] .portal-stat__val { color: var(--dark-heading) !important; }

html[data-theme="dark"] .section__tag,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .nav__comp-badge,
html[data-theme="dark"] .shared-item__badge,
html[data-theme="dark"] .result-card__type-badge,
html[data-theme="dark"] .qz-counter,
html[data-theme="dark"] .cloud-tag,
html[data-theme="dark"] .page-btn,
html[data-theme="dark"] .qz-tab,
html[data-theme="dark"] .qz-switch__pill {
  background: rgba(125, 183, 240, .14) !important;
  border-color: rgba(156, 201, 245, .3) !important;
  color: var(--dark-heading) !important;
}

html[data-theme="dark"] .comp-card,
html[data-theme="dark"] .module-card,
html[data-theme="dark"] .test-card,
html[data-theme="dark"] .shared-item,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .path-item,
html[data-theme="dark"] .sidebar-card,
html[data-theme="dark"] .sidebar-widget,
html[data-theme="dark"] .chapter,
html[data-theme="dark"] .objectives,
html[data-theme="dark"] .key-term,
html[data-theme="dark"] .callout,
html[data-theme="dark"] .qz-card,
html[data-theme="dark"] #quiz-root,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .dash-card,
html[data-theme="dark"] .dash-comp,
html[data-theme="dark"] .comp-picker,
html[data-theme="dark"] .progress-card,
html[data-theme="dark"] .quiz-hist-item,
html[data-theme="dark"] .fav-card,
html[data-theme="dark"] .search-cloud,
html[data-theme="dark"] .search-overlay__box {
  background: var(--dark-surface) !important;
  border-color: var(--dark-line) !important;
  color: var(--dark-text) !important;
  box-shadow: var(--shadow-sm) !important;
}
html[data-theme="dark"] .comp-card:hover,
html[data-theme="dark"] .module-card:hover,
html[data-theme="dark"] .test-card:hover,
html[data-theme="dark"] .shared-item:hover,
html[data-theme="dark"] .result-card:hover,
html[data-theme="dark"] .path-item:hover,
html[data-theme="dark"] .progress-card:hover,
html[data-theme="dark"] .fav-card:hover {
  background: var(--dark-surface-2) !important;
  border-color: var(--dark-line-strong) !important;
  box-shadow: var(--shadow-md) !important;
}
html[data-theme="dark"] .comp-card__body,
html[data-theme="dark"] .chapter__body,
html[data-theme="dark"] .qz-body,
html[data-theme="dark"] .qz-foot,
html[data-theme="dark"] .module-card__body { background: transparent !important; color: var(--dark-text) !important; }
html[data-theme="dark"] .chapter__header,
html[data-theme="dark"] .chapter.is-open .chapter__header,
html[data-theme="dark"] .qz-header,
html[data-theme="dark"] .comp-card__cta,
html[data-theme="dark"] .search-form-bar,
html[data-theme="dark"] .qz-toolbar,
html[data-theme="dark"] .qz-sort,
html[data-theme="dark"] .comp-widget__stats > div {
  background: var(--dark-surface-2) !important;
  border-color: var(--dark-line) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .comp-card__title,
html[data-theme="dark"] .module-card__title,
html[data-theme="dark"] .test-card__title,
html[data-theme="dark"] .shared-item__title,
html[data-theme="dark"] .result-card__title,
html[data-theme="dark"] .path-item__title,
html[data-theme="dark"] .chapter__title,
html[data-theme="dark"] .chapter__body h3,
html[data-theme="dark"] .chapter__body h4,
html[data-theme="dark"] .sidebar-card h3,
html[data-theme="dark"] .sidebar-widget h4,
html[data-theme="dark"] .qz-q,
html[data-theme="dark"] .qz-review-title,
html[data-theme="dark"] .qz-ri__q,
html[data-theme="dark"] .auth-field label,
html[data-theme="dark"] .dash-section h2,
html[data-theme="dark"] .progress-card__title,
html[data-theme="dark"] .fav-card__title,
html[data-theme="dark"] .quiz-hist-item__title,
html[data-theme="dark"] .comp-widget__title { color: var(--dark-heading) !important; }
html[data-theme="dark"] .comp-card__desc,
html[data-theme="dark"] .comp-card__sub,
html[data-theme="dark"] .comp-stat,
html[data-theme="dark"] .module-card__desc,
html[data-theme="dark"] .module-card__tag,
html[data-theme="dark"] .module-card__meta,
html[data-theme="dark"] .test-card__desc,
html[data-theme="dark"] .test-card p,
html[data-theme="dark"] .shared-item__badge,
html[data-theme="dark"] .result-card__label,
html[data-theme="dark"] .result-card__snippet,
html[data-theme="dark"] .path-item__meta,
html[data-theme="dark"] .chapter__meta,
html[data-theme="dark"] .toc-list li a,
html[data-theme="dark"] .modules-nav a,
html[data-theme="dark"] .qz-hint,
html[data-theme="dark"] .qz-count,
html[data-theme="dark"] .qz-sort label,
html[data-theme="dark"] .dash-stat__lbl,
html[data-theme="dark"] .progress-card__meta,
html[data-theme="dark"] .fav-card__comp,
html[data-theme="dark"] .quiz-hist-item__date,
html[data-theme="dark"] .comp-widget__desc,
html[data-theme="dark"] .comp-widget__stats span,
html[data-theme="dark"] .resume-banner__text span { color: var(--dark-muted) !important; }
html[data-theme="dark"] .chapter__body p,
html[data-theme="dark"] .chapter__body li,
html[data-theme="dark"] .chapter__body td,
html[data-theme="dark"] .chapter__body span,
html[data-theme="dark"] .chapter__body div,
html[data-theme="dark"] .lesson-block,
html[data-theme="dark"] .lesson-block p,
html[data-theme="dark"] .lesson-block li { color: var(--dark-text) !important; }
html[data-theme="dark"] .chapter__body em,
html[data-theme="dark"] .chapter__body .muted,
html[data-theme="dark"] .chapter__body .caption,
html[data-theme="dark"] .chapter__body figcaption { color: var(--dark-muted) !important; }

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .search-form-bar input,
html[data-theme="dark"] .nav__search-inline,
html[data-theme="dark"] .search-overlay-form {
  background: #0e1620 !important;
  border-color: var(--dark-line) !important;
  color: var(--dark-heading) !important;
  caret-color: var(--dark-link);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--dark-faint) !important; opacity: 1; }

html[data-theme="dark"] .btn--primary,
html[data-theme="dark"] button[type="submit"],
html[data-theme="dark"] .auth-submit,
html[data-theme="dark"] .search-form-bar button {
  background: #4f86bd !important;
  border-color: #4f86bd !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .btn--primary:hover,
html[data-theme="dark"] button[type="submit"]:hover,
html[data-theme="dark"] .auth-submit:hover,
html[data-theme="dark"] .search-form-bar button:hover {
  background: #6298cb !important;
  border-color: #6298cb !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .btn--outline,
html[data-theme="dark"] .btn--ghost,
html[data-theme="dark"] .btn--ghost-white,
html[data-theme="dark"] .qz-btn-prev,
html[data-theme="dark"] .module-actions__btn.btn--outline {
  background: rgba(255, 255, 255, .06) !important;
  border-color: var(--dark-line-strong) !important;
  color: var(--dark-heading) !important;
}
html[data-theme="dark"] .btn--outline:hover,
html[data-theme="dark"] .btn--ghost:hover,
html[data-theme="dark"] .btn--ghost-white:hover,
html[data-theme="dark"] .qz-btn-prev:hover {
  background: rgba(125, 183, 240, .16) !important;
  border-color: rgba(156, 201, 245, .5) !important;
  color: var(--dark-heading) !important;
}

html[data-theme="dark"] .qz-opt { background: var(--dark-surface) !important; border-color: var(--dark-line) !important; color: var(--dark-text) !important; }
html[data-theme="dark"] .qz-opt:hover:not(:disabled) { background: var(--dark-surface-2) !important; border-color: rgba(156, 201, 245, .48) !important; color: var(--dark-heading) !important; }
html[data-theme="dark"] .qz-opt__letter,
html[data-theme="dark"] .chapter__num,
html[data-theme="dark"] .toc-list li a .toc-num,
html[data-theme="dark"] .module-card__icon,
html[data-theme="dark"] .test-card__icon,
html[data-theme="dark"] .result-card__icon,
html[data-theme="dark"] .fav-btn {
  background: rgba(125, 183, 240, .14) !important;
  border-color: rgba(156, 201, 245, .28) !important;
  color: var(--dark-heading) !important;
}
html[data-theme="dark"] .qz-opt--correct,
html[data-theme="dark"] .qz-feedback--ok,
html[data-theme="dark"] .qz-score--great,
html[data-theme="dark"] .qz-ri--ok,
html[data-theme="dark"] .quiz-hist-item__badge--great { background: rgba(35, 134, 88, .18) !important; border-color: rgba(74, 222, 128, .42) !important; color: #b9f6ce !important; }
html[data-theme="dark"] .qz-opt--wrong,
html[data-theme="dark"] .qz-feedback--ko,
html[data-theme="dark"] .qz-score--low,
html[data-theme="dark"] .qz-ri--ko,
html[data-theme="dark"] .quiz-hist-item__badge--low { background: rgba(185, 69, 69, .18) !important; border-color: rgba(252, 165, 165, .42) !important; color: #ffd1d1 !important; }
html[data-theme="dark"] .qz-score--ok,
html[data-theme="dark"] .quiz-hist-item__badge--ok { background: rgba(180, 120, 42, .18) !important; border-color: rgba(251, 191, 36, .42) !important; color: #ffe6a6 !important; }
html[data-theme="dark"] .qz-ri__correct { color: #b9f6ce !important; }
html[data-theme="dark"] .qz-ri__yours { color: #ffd1d1 !important; }

html[data-theme="dark"] mark { background: rgba(250, 204, 21, .24) !important; color: #fff0a6 !important; border-radius: .2rem; }
html[data-theme="dark"] table,
html[data-theme="dark"] .bl-table { border-color: var(--dark-line) !important; }
html[data-theme="dark"] table th,
html[data-theme="dark"] .bl-table th { background: var(--dark-surface-2) !important; color: var(--dark-heading) !important; border-color: var(--dark-line) !important; }
html[data-theme="dark"] table td,
html[data-theme="dark"] .bl-table td { background: rgba(255, 255, 255, .025) !important; color: var(--dark-text) !important; border-color: rgba(148, 171, 195, .18) !important; }
html[data-theme="dark"] table tr:nth-child(even) td,
html[data-theme="dark"] .bl-table tr:nth-child(even) td { background: rgba(255, 255, 255, .05) !important; }
html[data-theme="dark"] code,
html[data-theme="dark"] pre { background: #0e1620 !important; border-color: var(--dark-line) !important; color: #dbeafe !important; }

html[data-theme="dark"] .hero,
html[data-theme="dark"] .module-hero,
html[data-theme="dark"] .test-hero,
html[data-theme="dark"] .dash-hero,
html[data-theme="dark"] .portal-hero { color: var(--dark-heading) !important; }
html[data-theme="dark"] .hero::before,
html[data-theme="dark"] .module-hero::before,
html[data-theme="dark"] .test-hero::before {
  background: linear-gradient(90deg, rgba(16, 24, 32, .22), rgba(16, 24, 32, .62)), radial-gradient(circle at 18% 20%, rgba(255, 255, 255, .12), transparent 32%) !important;
}
html[data-theme="dark"] .hero *,
html[data-theme="dark"] .module-hero *,
html[data-theme="dark"] .test-hero *,
html[data-theme="dark"] .dash-hero *,
html[data-theme="dark"] .portal-hero * { text-shadow: none !important; }
html[data-theme="dark"] .hero p,
html[data-theme="dark"] .module-hero p,
html[data-theme="dark"] .test-hero p,
html[data-theme="dark"] .dash-hero p,
html[data-theme="dark"] .portal-hero p,
html[data-theme="dark"] .hero span,
html[data-theme="dark"] .module-hero span,
html[data-theme="dark"] .test-hero span,
html[data-theme="dark"] .dash-hero span,
html[data-theme="dark"] .portal-hero span { color: inherit; }

html[data-theme="dark"] [style*="color:#475569"],
html[data-theme="dark"] [style*="color: #475569"],
html[data-theme="dark"] [style*="color:#64748b"],
html[data-theme="dark"] [style*="color: #64748b"],
html[data-theme="dark"] [style*="color:#94a3b8"],
html[data-theme="dark"] [style*="color: #94a3b8"],
html[data-theme="dark"] [style*="color:var(--clr-muted)"],
html[data-theme="dark"] [style*="color: var(--clr-muted)"] { color: var(--dark-muted) !important; }
html[data-theme="dark"] [style*="color:#1e293b"],
html[data-theme="dark"] [style*="color: #1e293b"],
html[data-theme="dark"] [style*="color:#172033"],
html[data-theme="dark"] [style*="color: #172033"],
html[data-theme="dark"] [style*="color:var(--clr-text)"],
html[data-theme="dark"] [style*="color: var(--clr-text)"] { color: var(--dark-heading) !important; }
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #ffffff"] { background: var(--dark-surface) !important; border-color: var(--dark-line) !important; }
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#f1f5f9"],
html[data-theme="dark"] [style*="background: #f1f5f9"] { background: var(--dark-surface-2) !important; border-color: var(--dark-line) !important; }
html[data-theme="dark"] .page-btn--disabled,
html[data-theme="dark"] .comp-pick:disabled { opacity: .72 !important; }
html[data-theme="dark"] .footer { background: #0c131b !important; color: var(--dark-muted) !important; border-top-color: var(--dark-line) !important; }

@media (max-width: 768px) {
  html[data-theme="dark"] .nav__list {
    background: rgba(16, 24, 32, .98) !important;
    border-color: var(--dark-line) !important;
    box-shadow: var(--shadow-lg) !important;
  }
  html[data-theme="dark"] .nav__list .nav__link { color: var(--dark-heading) !important; }
}


/* Final contrast edge cases from automated audit */
html[data-theme="dark"] .nav__logo-icon {
  color: transparent !important;
  font-size: 0 !important;
}

html[data-theme="dark"] .btn--primary,
html[data-theme="dark"] .btn.btn--primary,
html[data-theme="dark"] button[type="submit"],
html[data-theme="dark"] .auth-submit,
html[data-theme="dark"] .search-form-bar button,
html[data-theme="dark"] .back-to-top {
  background: #356b9c !important;
  border-color: #356b9c !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .btn--primary:hover,
html[data-theme="dark"] .btn.btn--primary:hover,
html[data-theme="dark"] button[type="submit"]:hover,
html[data-theme="dark"] .auth-submit:hover,
html[data-theme="dark"] .search-form-bar button:hover,
html[data-theme="dark"] .back-to-top:hover {
  background: #3e78ad !important;
  border-color: #3e78ad !important;
  color: #ffffff !important;
}

html[data-theme="dark"] [style*="color:#6366f1"],
html[data-theme="dark"] [style*="color: #6366f1"],
html[data-theme="dark"] [style*="color:#818cf8"],
html[data-theme="dark"] [style*="color: #818cf8"] {
  color: #dbeafe !important;
}

html[data-theme="dark"] [style*="background:#818cf815"],
html[data-theme="dark"] [style*="background: #818cf815"],
html[data-theme="dark"] [style*="background:#818cf8"],
html[data-theme="dark"] [style*="background: #818cf8"] {
  background: rgba(125, 183, 240, .18) !important;
  border-color: rgba(156, 201, 245, .34) !important;
}

html[data-theme="dark"] .qz-tab__count,
html[data-theme="dark"] .qz-switch__count {
  color: var(--dark-heading) !important;
}

html[data-theme="dark"] .auth-card__logo p,
html[data-theme="dark"] .auth-divider,
html[data-theme="dark"] .auth-footer,
html[data-theme="dark"] .auth-footer a {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .auth-social__badge {
  background: rgba(180, 120, 42, .22) !important;
  border-color: rgba(251, 191, 36, .38) !important;
  color: #ffe6a6 !important;
}


html[data-theme="dark"] .qz-tab.active .qz-tab__count,
html[data-theme="dark"] .qz-tab .qz-tab__count,
html[data-theme="dark"] .qz-switch__pill.active .qz-switch__count,
html[data-theme="dark"] .qz-switch__pill .qz-switch__count {
  color: #ffffff !important;
}


html[data-theme="dark"] [style*="color:#4f6ef7"],
html[data-theme="dark"] [style*="color: #4f6ef7"],
html[data-theme="dark"] [style*="background:#4f6ef7"],
html[data-theme="dark"] [style*="background: #4f6ef7"] {
  color: #dbeafe !important;
  background: rgba(125, 183, 240, .18) !important;
  border-color: rgba(156, 201, 245, .34) !important;
}

html[data-theme="dark"] .comp-widget__label,
html[data-theme="dark"] .module-hero__tag,
html[data-theme="dark"] .module-hero__meta span {
  color: #dbeafe !important;
}


/* Mobile navigation dark-mode final rules */
@media (max-width: 768px) {
  html[data-theme="dark"] .nav__burger,
  html[data-theme="dark"] .nav__portal,
  html[data-theme="dark"] .theme-toggle,
  html[data-theme="dark"] .nav-login-btn,
  html[data-theme="dark"] .nav-user__btn,
  html[data-theme="dark"] .nav__search-btn {
    background: rgba(23,32,51,.94) !important;
    border-color: rgba(147,197,253,.28) !important;
    color: var(--dark-heading) !important;
  }
  html[data-theme="dark"] .nav__list.is-open {
    background: rgba(15,23,42,.98) !important;
    border-color: var(--dark-line) !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.42) !important;
  }
  html[data-theme="dark"] .nav__list.is-open .nav__link {
    color: var(--dark-heading) !important;
    background: transparent !important;
  }
  html[data-theme="dark"] .nav__list.is-open .nav__link:hover,
  html[data-theme="dark"] .nav__list.is-open .nav__link.active {
    color: #f8fbff !important;
    background: rgba(53,107,156,.32) !important;
  }
  html[data-theme="dark"] body.nav-open::before {
    background: rgba(2,6,23,.42) !important;
  }
}


/* Final mobile nav geometry: loaded last */
@media (max-width: 768px) {
  .header { overflow: visible !important; }
  .nav {
    direction: ltr !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: 4rem !important;
    gap: .4rem !important;
    padding-inline: .7rem !important;
    min-width: 0 !important;
  }
  .nav__logo {
    direction: ltr !important;
    margin-right: auto !important;
    margin-left: 0 !important;
    min-width: 0 !important;
    max-width: calc(100vw - 10.5rem) !important;
  }
  .nav__logo span:last-child {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .nav > div[style*="display:flex"] {
    margin: 0 !important;
    margin-inline: 0 !important;
    direction: ltr !important;
    flex: 0 0 auto !important;
  }
  .nav__comp-badge,
  .nav__cta,
  .nav__search-inline,
  .nav-user__name { display: none !important; }
  .nav__portal,
  .theme-toggle,
  .nav-login-btn,
  .nav-user__btn,
  .nav__search-btn,
  .nav__burger {
    width: 2.25rem !important;
    height: 2.25rem !important;
    min-width: 2.25rem !important;
    max-width: 2.25rem !important;
    padding: 0 !important;
    font-size: 0 !important;
    flex: 0 0 2.25rem !important;
  }
  .nav__burger {
    position: static !important;
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .nav__list { display: none !important; }
  .nav__list.is-open {
    direction: rtl !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    position: fixed !important;
    top: 4rem !important;
    left: .75rem !important;
    right: .75rem !important;
    width: auto !important;
    max-height: min(70vh, 28rem) !important;
    overflow-y: auto !important;
    padding: .65rem !important;
    gap: .35rem !important;
    border-radius: 1rem !important;
    z-index: 150 !important;
  }
  .nav__list.is-open .nav__link {
    direction: rtl !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 2.75rem !important;
    padding: .75rem .9rem !important;
    font-size: .94rem !important;
    font-weight: 800 !important;
    text-align: right !important;
  }
  body.nav-open::before { top: 4rem !important; }
}
/* ── Correction de contraste : --clr-primary est éclairci en mode sombre
   (#7db7f0) pour rester lisible SUR fond sombre, mais certains composants
   l'utilisent comme texte/fond BLANC (badge rond, bouton blanc) où ce bleu
   clair devient illisible (ratio ~2.1, sous le seuil WCAG de 3.0). On fixe
   ici un bleu foncé constant pour ces cas précis, indépendamment du thème. */
html[data-theme="dark"] .step__number,
html[data-theme="dark"] .nav-user__avatar {
  background: #1d4ed8 !important;
  color: #fff !important;
}
html[data-theme="dark"] .btn--white {
  color: #1d4ed8 !important;
}

@media (max-width: 420px) {
  .nav { padding-inline: .55rem !important; gap: .3rem !important; }
  .nav__logo { max-width: calc(100vw - 9.2rem) !important; }
  .nav__portal,
  .theme-toggle,
  .nav-login-btn,
  .nav-user__btn,
  .nav__search-btn,
  .nav__burger {
    width: 2.1rem !important;
    height: 2.1rem !important;
    min-width: 2.1rem !important;
    max-width: 2.1rem !important;
    flex-basis: 2.1rem !important;
    overflow: hidden;
  }
  .nav-user__avatar {
    width: 1.35rem !important;
    height: 1.35rem !important;
  }
}
