/* ARCHIA365 | thème Light / Dark / Archia365 (après Bootstrap) */

:root {
  --a365-navy: #0C2E54;
  --a365-royal: #2A6EE0;
  --a365-silver: #A9AFB7;
  --a365-cyan: #00A4EF;
  --a365-yellow: #FFB900;
  --a365-radius: .75rem;
  --a365-radius-sm: .5rem;
}

/* ---- LIGHT (défaut) - contrastes WCAG 2.1 AA ---- */
[data-bs-theme="light"] {
  --bg: #F8FAFC;
  --bg-soft: #E2E8F0;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --text-muted: #5D6B81;
  --muted: #5D6B81;
  --border: #6B87AD;
  --primary: #0F6CBD;
  --primary-dark: #0B5CA3;
  --primary-ct: #FFFFFF;
  --accent: #0077AD;
  --nav-bg: #F8FAFC;
  --nav-text: #0F172A;
  --ring: rgba(15, 108, 189, .35);
  --success: #107C10;
  --warning: #B34A00;
  --danger: #C50F1F;
  --info: #006CC0;
  --radius: var(--a365-radius);
  --bs-primary: #0F6CBD;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-dark);
}

/* ---- DARK - contrastes WCAG 2.1 AA ---- */
[data-bs-theme="dark"] {
  --bg: #0F172A;
  --bg-soft: #1E293B;
  --surface: #0F172A;
  --surface-2: #1E293B;
  --text: #E2E8F0;
  --text-muted: #A7B4C5;
  --muted: #A7B4C5;
  --border: #607AA0;
  --primary: #479EF5;
  --primary-dark: #2F80E0;
  --primary-ct: #0B1220;
  --accent: #479EF5;
  --nav-bg: #0B1220;
  --nav-text: #E2E8F0;
  --ring: rgba(71, 158, 245, .45);
  --success: #43AB43;
  --warning: #FFA657;
  --danger: #F1707B;
  --info: #479EF5;
  --radius: var(--a365-radius);
  --bs-primary: #479EF5;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: #7BB8F8;
  color-scheme: dark;
}

/* ---- ARCHIA365 (marque immersive) - contrastes WCAG 2.1 AA ---- */
[data-bs-theme="archia"] {
  --bg: #0A2740;
  --bg-soft: #103A5C;
  --surface: #0A2740;
  --surface-2: #103A5C;
  --text: #EAF3FF;
  --text-muted: #A6C4E4;
  --muted: #A6C4E4;
  --border: #5199D1;
  --primary: #3AC1FF;
  --primary-dark: #00A4EF;
  --primary-ct: #06223A;
  --accent: #FFB900;
  --nav-bg: #082238;
  --nav-text: #EAF3FF;
  --ring: rgba(0, 164, 239, .45);
  --success: #72C872;
  --warning: #FFA657;
  --danger: #F59CA4;
  --info: #7CBAF8;
  --radius: var(--a365-radius);
  --bs-primary: #3AC1FF;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-link-color: var(--primary);
  --bs-link-hover-color: #66D0FF;
  color-scheme: dark;
}

/* ---- Application composants ---- */
html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  transition: background .25s ease, color .25s ease;
}

.card,
.kpi,
.session-card,
.auth-box,
.modal-content {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn,
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-color: var(--primary-ct);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-hover-color: var(--primary-ct);
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ct);
}

.btn:hover,
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: var(--primary-ct);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--border);
  background: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

/* Navbar publique / marque : suit data-bs-theme (comme sidebar) via --bg/--text/--border */
.navbar.navbar-a365,
header.navbar.navbar-a365 {
  background: var(--bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}

.navbar-a365 .brand-title,
.navbar-a365 .brand-on-dark .brand-title {
  color: var(--text);
}

.navbar-a365 .brand-subtitle,
.navbar-a365 .brand-on-dark .brand-subtitle {
  color: var(--text-muted);
}

.navbar-a365 .nav-inner nav a,
.navbar-a365 #publicMainNav a {
  color: var(--text);
}

.navbar-a365 .nav-inner nav a:hover,
.navbar-a365 #publicMainNav a:hover {
  color: var(--primary);
}

.navbar-a365 .public-main-nav-account {
  display: inline-flex;
  align-items: center;
}

.navbar-a365 .public-main-nav-account-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .15rem .35rem;
  border: 0;
  box-shadow: none;
  color: var(--text);
}

.navbar-a365 .public-main-nav-account-toggle::after {
  margin-left: .25rem;
}

.navbar-a365 .public-main-nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.navbar-a365 .public-main-nav-avatar--icon {
  color: var(--text);
  font-size: 1rem;
}

.navbar-a365 .public-main-nav-action-form {
  margin: 0;
}

.navbar-a365 .public-main-nav-action-form .dropdown-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
}

.navbar-a365 .btn-ghost {
  color: var(--text);
  border-color: var(--border);
  background: transparent;
}

.navbar-a365 .btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.navbar-a365 .btn:not(.btn-ghost):not(.dropdown-toggle) {
  background: var(--primary);
  color: var(--primary-ct);
  border-color: var(--primary);
}

.navbar-a365 .dropdown-menu {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.navbar-a365 .dropdown-item {
  color: var(--text);
}

.navbar-a365 .dropdown-item:hover,
.navbar-a365 .dropdown-item:focus {
  background: var(--surface-2);
  color: var(--text);
}

.navbar-a365 .dropdown-header {
  color: var(--text-muted);
}

[data-bs-theme="light"] .navbar.navbar-a365,
[data-bs-theme="dark"] .navbar.navbar-a365,
[data-bs-theme="archia"] .navbar.navbar-a365,
[data-bs-theme="light"] header.navbar.navbar-a365,
[data-bs-theme="dark"] header.navbar.navbar-a365,
[data-bs-theme="archia"] header.navbar.navbar-a365 {
  background: var(--bg) !important;
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-bs-theme="light"] .navbar-a365 .brand-title,
[data-bs-theme="light"] .navbar-a365 .brand-on-dark .brand-title,
[data-bs-theme="light"] .navbar-a365 .nav-inner nav a,
[data-bs-theme="light"] .navbar-a365 #publicMainNav a,
[data-bs-theme="light"] .navbar-a365 .btn-ghost,
[data-bs-theme="dark"] .navbar-a365 .brand-title,
[data-bs-theme="dark"] .navbar-a365 .brand-on-dark .brand-title,
[data-bs-theme="dark"] .navbar-a365 .nav-inner nav a,
[data-bs-theme="dark"] .navbar-a365 #publicMainNav a,
[data-bs-theme="dark"] .navbar-a365 .btn-ghost,
[data-bs-theme="archia"] .navbar-a365 .brand-title,
[data-bs-theme="archia"] .navbar-a365 .brand-on-dark .brand-title,
[data-bs-theme="archia"] .navbar-a365 .nav-inner nav a,
[data-bs-theme="archia"] .navbar-a365 #publicMainNav a,
[data-bs-theme="archia"] .navbar-a365 .btn-ghost {
  color: var(--text) !important;
}

[data-bs-theme="light"] .navbar-a365 .brand-subtitle,
[data-bs-theme="light"] .navbar-a365 .brand-on-dark .brand-subtitle,
[data-bs-theme="dark"] .navbar-a365 .brand-subtitle,
[data-bs-theme="dark"] .navbar-a365 .brand-on-dark .brand-subtitle,
[data-bs-theme="archia"] .navbar-a365 .brand-subtitle,
[data-bs-theme="archia"] .navbar-a365 .brand-on-dark .brand-subtitle {
  color: var(--text-muted) !important;
}

/* Sidebar admin : suit data-bs-theme (Light / Dark / System / Archia365) via --bg/--text */
.sidebar {
  background: var(--bg);
  color: var(--text);
  border-right: 1px solid var(--border);
}

.sidebar .brand,
.sidebar .brand-title,
.sidebar .sidebar-link,
.sidebar nav a {
  color: var(--text);
}

.sidebar .brand-subtitle,
.sidebar-footer a,
.sidebar-footer-link {
  color: var(--text-muted);
}

.sidebar .sidebar-link:hover,
.sidebar .sidebar-link.active,
.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--surface-2);
  color: var(--text);
}

[data-bs-theme="light"] .sidebar,
[data-bs-theme="dark"] .sidebar,
[data-bs-theme="archia"] .sidebar {
  background: var(--bg) !important;
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border-right: 1px solid var(--border) !important;
}

[data-bs-theme="light"] .sidebar .brand,
[data-bs-theme="light"] .sidebar .brand-title,
[data-bs-theme="light"] .sidebar .sidebar-link,
[data-bs-theme="light"] .sidebar nav a,
[data-bs-theme="dark"] .sidebar .brand,
[data-bs-theme="dark"] .sidebar .brand-title,
[data-bs-theme="dark"] .sidebar .sidebar-link,
[data-bs-theme="dark"] .sidebar nav a,
[data-bs-theme="archia"] .sidebar .brand,
[data-bs-theme="archia"] .sidebar .brand-title,
[data-bs-theme="archia"] .sidebar .sidebar-link,
[data-bs-theme="archia"] .sidebar nav a {
  color: var(--text) !important;
}

[data-bs-theme="light"] .sidebar .brand-subtitle,
[data-bs-theme="light"] .sidebar-footer a,
[data-bs-theme="light"] .sidebar-footer-link,
[data-bs-theme="dark"] .sidebar .brand-subtitle,
[data-bs-theme="dark"] .sidebar-footer a,
[data-bs-theme="dark"] .sidebar-footer-link,
[data-bs-theme="archia"] .sidebar .brand-subtitle,
[data-bs-theme="archia"] .sidebar-footer a,
[data-bs-theme="archia"] .sidebar-footer-link {
  color: var(--text-muted) !important;
}

[data-bs-theme="light"] .sidebar .sidebar-link:hover,
[data-bs-theme="light"] .sidebar .sidebar-link.active,
[data-bs-theme="light"] .sidebar nav a:hover,
[data-bs-theme="light"] .sidebar nav a.active,
[data-bs-theme="dark"] .sidebar .sidebar-link:hover,
[data-bs-theme="dark"] .sidebar .sidebar-link.active,
[data-bs-theme="dark"] .sidebar nav a:hover,
[data-bs-theme="dark"] .sidebar nav a.active,
[data-bs-theme="archia"] .sidebar .sidebar-link:hover,
[data-bs-theme="archia"] .sidebar .sidebar-link.active,
[data-bs-theme="archia"] .sidebar nav a:hover,
[data-bs-theme="archia"] .sidebar nav a.active {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}

.admin-sidebar-offcanvas {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.admin-sidebar-offcanvas .offcanvas-header,
.admin-sidebar-offcanvas .offcanvas-body {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

.topbar {
  background: var(--surface);
  border-bottom-color: var(--border);
  color: var(--text);
}

/* Footer public : suit data-bs-theme via --bg/--text/--border */
.footer {
  background: var(--bg);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}

.footer .site-footer-brand strong,
.footer .site-footer-col h4 {
  color: var(--text);
}

.footer .site-footer-brand p,
.footer .site-footer-col a,
.footer .site-footer-bottom {
  color: var(--text-muted);
}

.footer .site-footer-col a:hover {
  color: var(--primary);
}

.footer .site-footer-bottom {
  border-top-color: var(--border);
}

[data-bs-theme="light"] .footer,
[data-bs-theme="dark"] .footer,
[data-bs-theme="archia"] .footer {
  background: var(--bg) !important;
  background-color: var(--bg) !important;
  color: var(--text-muted) !important;
  border-top: 1px solid var(--border) !important;
}

[data-bs-theme="light"] .footer .site-footer-brand strong,
[data-bs-theme="light"] .footer .site-footer-col h4,
[data-bs-theme="dark"] .footer .site-footer-brand strong,
[data-bs-theme="dark"] .footer .site-footer-col h4,
[data-bs-theme="archia"] .footer .site-footer-brand strong,
[data-bs-theme="archia"] .footer .site-footer-col h4 {
  color: var(--text) !important;
}

[data-bs-theme="light"] .footer .site-footer-brand p,
[data-bs-theme="light"] .footer .site-footer-col a,
[data-bs-theme="light"] .footer .site-footer-bottom,
[data-bs-theme="dark"] .footer .site-footer-brand p,
[data-bs-theme="dark"] .footer .site-footer-col a,
[data-bs-theme="dark"] .footer .site-footer-bottom,
[data-bs-theme="archia"] .footer .site-footer-brand p,
[data-bs-theme="archia"] .footer .site-footer-col a,
[data-bs-theme="archia"] .footer .site-footer-bottom {
  color: var(--text-muted) !important;
}

[data-bs-theme="light"] .footer .site-footer-col a:hover,
[data-bs-theme="dark"] .footer .site-footer-col a:hover,
[data-bs-theme="archia"] .footer .site-footer-col a:hover {
  color: var(--primary) !important;
}

.hero {
  background: linear-gradient(135deg, var(--a365-navy) 0%, var(--a365-cyan) 100%);
}

.hero .btn {
  background: #fff;
  color: var(--a365-navy);
}

/* Menu Thèmes (compact) : tokens de thème (navbar publique + topbar) */
.a365-theme-menu .a365-theme-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
  white-space: nowrap;
}

.a365-theme-menu .a365-theme-toggle:hover,
.a365-theme-menu .a365-theme-toggle:focus,
.a365-theme-menu .a365-theme-toggle.show {
  color: var(--text);
  background: var(--border);
}

.a365-theme-menu .a365-theme-toggle:focus-visible {
  outline: 2px solid var(--a365-cyan);
  outline-offset: 2px;
}

.a365-theme-menu .dropdown-menu {
  min-width: 12rem;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.a365-theme-menu .dropdown-header {
  color: var(--text-muted);
  font-weight: 700;
}

.a365-theme-menu .dropdown-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
}

.a365-theme-menu .dropdown-item:hover,
.a365-theme-menu .dropdown-item:focus {
  background: var(--surface-2);
  color: var(--text);
}

.a365-theme-menu .dropdown-item[aria-current="true"],
.a365-theme-menu .dropdown-item.active {
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text);
}

.a365-theme-menu .dropdown-item[aria-current="true"]::after,
.a365-theme-menu .dropdown-item.active::after {
  content: "\F26B";
  font-family: "bootstrap-icons";
  margin-left: auto;
}

.topbar .a365-theme-menu .a365-theme-toggle,
.auth-theme-bar .a365-theme-menu .a365-theme-toggle {
  color: var(--text);
  background: var(--surface-2);
}

.topbar .a365-theme-menu .a365-theme-toggle:hover,
.topbar .a365-theme-menu .a365-theme-toggle.show,
.auth-theme-bar .a365-theme-menu .a365-theme-toggle:hover,
.auth-theme-bar .a365-theme-menu .a365-theme-toggle.show {
  color: var(--text);
  background: var(--border);
}

.auth-theme-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .75rem;
}

/* Navbar publique responsive */
.navbar-a365 .nav-inner {
  flex-wrap: wrap;
  gap: .5rem;
}

.navbar-a365 .nav-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  order: 2;
}

.navbar-a365 .navbar-toggler {
  min-width: 44px;
  min-height: 44px;
  padding: .35rem .6rem;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-2);
}

.navbar-a365 .navbar-toggler:focus-visible {
  outline: 2px solid var(--a365-cyan);
  outline-offset: 2px;
}

.navbar-a365 #publicMainNav {
  width: 100%;
  order: 3;
}

@media (min-width: 768px) {
  .navbar-a365 .nav-inner {
    flex-wrap: nowrap;
  }

  .navbar-a365 #publicMainNav {
    width: auto;
    flex: 1 1 auto;
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    order: 2;
    margin-left: 1rem;
  }

  .navbar-a365 .nav-actions {
    order: 3;
    margin-left: .75rem;
    flex: 0 0 auto;
  }
}

@media (max-width: 767.98px) {
  .navbar-a365 #publicMainNav.collapse:not(.show) {
    display: none;
  }

  .navbar-a365 #publicMainNav.show,
  .navbar-a365 #publicMainNav.collapsing {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
    padding: .5rem 0 .25rem;
  }

  .navbar-a365 #publicMainNav a,
  .navbar-a365 #publicMainNav .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* Tableaux données */
.table-responsive,
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Formulaires pleine largeur mobile */
@media (max-width: 575.98px) {
  .form-control,
  .form-select {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .card,
  .btn {
    transition: none !important;
  }
}

/* ---- Couverture pages (todo, mon-espace, calendrier, attestations) ---- */
.todo-app {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.todo-sidebar {
  background: var(--surface-2);
  border-color: var(--border);
}

.todo-nav-item { color: var(--text); }
.todo-nav-item:hover { background: var(--border); color: var(--text); }
.todo-nav-item.is-active {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary);
}
.todo-nav-section,
.todo-check,
.todo-steps { color: var(--text-muted); }
.todo-task { border-bottom-color: var(--border); }
.todo-task-title { color: var(--text); }
.todo-task.is-done .todo-task-title { color: var(--text-muted); }
.todo-cat {
  background: color-mix(in srgb, var(--c, var(--primary)) 22%, var(--surface));
}

.attendee-portal-hero {
  background: linear-gradient(135deg, var(--surface-2) 0%, color-mix(in srgb, var(--primary) 12%, var(--bg)) 100%);
}

.attendee-portal-avatar {
  background: var(--primary);
  color: var(--primary-ct);
}

.attendee-portal-tabs .nav-link {
  color: var(--text-muted);
  background: var(--surface-2);
  border-color: var(--border);
}

.attendee-portal-tabs .nav-link.active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
}

/* Thèmes sombres : fond d'onglet = --bg pour maximiser le contraste texte */
[data-bs-theme="dark"] .attendee-portal-tabs .nav-link,
[data-bs-theme="archia"] .attendee-portal-tabs .nav-link {
  background: var(--bg);
  color: var(--text-muted);
}

[data-bs-theme="dark"] .attendee-portal-tabs .nav-link:hover,
[data-bs-theme="dark"] .attendee-portal-tabs .nav-link:focus,
[data-bs-theme="archia"] .attendee-portal-tabs .nav-link:hover,
[data-bs-theme="archia"] .attendee-portal-tabs .nav-link:focus {
  background: var(--bg);
  color: var(--text);
}

[data-bs-theme="dark"] .attendee-portal-tabs .nav-link.active,
[data-bs-theme="archia"] .attendee-portal-tabs .nav-link.active {
  background: var(--bg);
  color: var(--primary);
  border-color: var(--border);
}

[data-bs-theme="dark"] .attendee-insc-pills .nav-link:not(.active),
[data-bs-theme="archia"] .attendee-insc-pills .nav-link:not(.active) {
  background: var(--bg);
  color: var(--text-muted);
}

[data-bs-theme="dark"] .attendee-insc-pills .nav-link:not(.active):hover,
[data-bs-theme="archia"] .attendee-insc-pills .nav-link:not(.active):hover {
  color: var(--text);
}

/* Thèmes sombres : pattern général surfaces claires → --bg */
[data-bs-theme="dark"],
[data-bs-theme="archia"] {
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-color: var(--text-muted);
  --bs-secondary-bg: var(--bg);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--border);
  --bs-card-bg: var(--bg);
  --bs-card-cap-bg: var(--bg);
  --bs-card-color: var(--text);
  --bs-modal-bg: var(--bg);
  --bs-modal-color: var(--text);
  --bs-dropdown-bg: var(--bg);
  --bs-dropdown-color: var(--text);
  --bs-dropdown-link-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--surface-2);
  --bs-dropdown-link-hover-color: var(--text);
  --bs-offcanvas-bg: var(--bg);
  --bs-offcanvas-color: var(--text);
  --bs-toast-bg: var(--bg);
  --bs-toast-color: var(--text);
  --bs-popover-bg: var(--bg);
  --bs-popover-body-color: var(--text);
  --bs-popover-header-bg: var(--surface-2);
  --bs-table-bg: var(--bg);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: color-mix(in srgb, var(--text) 5%, var(--bg));
  --bs-table-hover-bg: color-mix(in srgb, var(--text) 8%, var(--bg));
  --bs-light: var(--bg);
  --bs-light-rgb: 15, 23, 42;
  --bs-form-control-bg: var(--bg);
  --bs-body-bg-rgb: 15, 23, 42;
}

[data-bs-theme="archia"] {
  --bs-light-rgb: 10, 39, 64;
  --bs-body-bg-rgb: 10, 39, 64;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .kpi,
[data-bs-theme="dark"] .session-card,
[data-bs-theme="dark"] .auth-box,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="archia"] .card,
[data-bs-theme="archia"] .kpi,
[data-bs-theme="archia"] .session-card,
[data-bs-theme="archia"] .auth-box,
[data-bs-theme="archia"] .modal-content,
[data-bs-theme="archia"] .list-group-item,
[data-bs-theme="archia"] .dropdown-menu {
  background: var(--bg);
  background-color: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer,
[data-bs-theme="dark"] .card-body,
[data-bs-theme="archia"] .card-header,
[data-bs-theme="archia"] .card-footer,
[data-bs-theme="archia"] .card-body {
  background: var(--bg);
  background-color: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-body-tertiary,
[data-bs-theme="dark"] .bg-body-secondary,
[data-bs-theme="archia"] .bg-light,
[data-bs-theme="archia"] .bg-body-tertiary,
[data-bs-theme="archia"] .bg-body-secondary {
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
}

[data-bs-theme="dark"] .bg-light .text-muted,
[data-bs-theme="dark"] .bg-light .small,
[data-bs-theme="archia"] .bg-light .text-muted,
[data-bs-theme="archia"] .bg-light .small,
[data-bs-theme="dark"] .card .text-muted,
[data-bs-theme="archia"] .card .text-muted {
  color: var(--text-muted) !important;
}

[data-bs-theme="dark"] .bg-light h1,
[data-bs-theme="dark"] .bg-light h2,
[data-bs-theme="dark"] .bg-light h3,
[data-bs-theme="dark"] .bg-light h4,
[data-bs-theme="dark"] .bg-light h5,
[data-bs-theme="dark"] .bg-light h6,
[data-bs-theme="dark"] .card h1,
[data-bs-theme="dark"] .card h2,
[data-bs-theme="dark"] .card h3,
[data-bs-theme="dark"] .card h4,
[data-bs-theme="dark"] .card h5,
[data-bs-theme="dark"] .card h6,
[data-bs-theme="archia"] .bg-light h1,
[data-bs-theme="archia"] .bg-light h2,
[data-bs-theme="archia"] .bg-light h3,
[data-bs-theme="archia"] .bg-light h4,
[data-bs-theme="archia"] .bg-light h5,
[data-bs-theme="archia"] .bg-light h6,
[data-bs-theme="archia"] .card h1,
[data-bs-theme="archia"] .card h2,
[data-bs-theme="archia"] .card h3,
[data-bs-theme="archia"] .card h4,
[data-bs-theme="archia"] .card h5,
[data-bs-theme="archia"] .card h6 {
  color: var(--text);
}

[data-bs-theme="dark"] .attendee-stat-tile,
[data-bs-theme="dark"] .attendee-assessment-meta,
[data-bs-theme="dark"] .attendee-badge-card,
[data-bs-theme="dark"] .attendee-assessment-card,
[data-bs-theme="archia"] .attendee-stat-tile,
[data-bs-theme="archia"] .attendee-assessment-meta,
[data-bs-theme="archia"] .attendee-badge-card,
[data-bs-theme="archia"] .attendee-assessment-card {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

[data-bs-theme="dark"] .attendee-assessment-card,
[data-bs-theme="archia"] .attendee-assessment-card {
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--surface) 55%, var(--bg)) 100%);
}

[data-bs-theme="dark"] .questionnaire-public-hero,
[data-bs-theme="dark"] .questionnaire-public-question,
[data-bs-theme="dark"] .questionnaire-public-card,
[data-bs-theme="dark"] .questionnaire-score-card,
[data-bs-theme="dark"] .questionnaire-choice,
[data-bs-theme="dark"] .questionnaire-choice.card,
[data-bs-theme="archia"] .questionnaire-public-hero,
[data-bs-theme="archia"] .questionnaire-public-question,
[data-bs-theme="archia"] .questionnaire-public-card,
[data-bs-theme="archia"] .questionnaire-score-card,
[data-bs-theme="archia"] .questionnaire-choice,
[data-bs-theme="archia"] .questionnaire-choice.card {
  background: var(--bg) !important;
  background-color: var(--bg) !important;
  color: var(--text);
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .questionnaire-choice:has(input:checked),
[data-bs-theme="archia"] .questionnaire-choice:has(input:checked) {
  background: color-mix(in srgb, var(--primary) 18%, var(--bg)) !important;
  border-color: var(--primary) !important;
  color: var(--text);
}

[data-bs-theme="dark"] .questionnaire-public-icon-sm,
[data-bs-theme="archia"] .questionnaire-public-icon-sm {
  background: color-mix(in srgb, var(--primary) 22%, var(--bg));
  color: var(--primary);
}

[data-bs-theme="dark"] .questionnaire-public-hero .questionnaire-hero-toggle.accordion-button,
[data-bs-theme="archia"] .questionnaire-public-hero .questionnaire-hero-toggle.accordion-button {
  background: transparent;
  color: var(--text);
}

[data-bs-theme="dark"] .questionnaire-q-prompt,
[data-bs-theme="archia"] .questionnaire-q-prompt {
  color: var(--text);
}

[data-bs-theme="dark"] .accordion-item,
[data-bs-theme="dark"] .accordion-button,
[data-bs-theme="archia"] .accordion-item,
[data-bs-theme="archia"] .accordion-button {
  background: var(--bg);
  color: var(--text);
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed),
[data-bs-theme="archia"] .accordion-button:not(.collapsed) {
  background: var(--bg);
  color: var(--text);
  box-shadow: none;
}

.attendee-stat-tile,
.attendee-assessment-meta,
.attendee-badge-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.attendee-stat-tile .stat-label,
.attendee-portal .help,
.attendee-portal .attendee-register-form .form-section-title,
.attendee-insc-pills .nav-link {
  color: var(--text-muted);
}

.attendee-insc-pills .nav-link.active {
  background: var(--primary);
  color: var(--primary-ct);
}

.attendee-score,
.attendee-assessment-meta__value { color: var(--text); }

.attendee-icon-action {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}

.attendee-icon-action:hover {
  background: var(--primary);
  color: var(--primary-ct);
}

.attendee-icon-action.is-muted {
  color: var(--text-muted);
  background: var(--surface-2);
}

.attendee-assessment-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-color: var(--border) !important;
}

.attendee-assessment-card__icon {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--surface)), color-mix(in srgb, var(--primary) 28%, var(--surface)));
  color: var(--primary);
}

.attendee-assessment-deck .assessment-exam-dot {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.attendee-assessment-deck .assessment-exam-dot.is-current {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-ct);
}

.attestation-directory-hero {
  background:
    radial-gradient(1200px 420px at 12% -10%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 60%),
    linear-gradient(180deg, var(--surface-2) 0%, var(--bg) 100%);
  border-bottom-color: var(--border);
}

.attestation-directory-kicker {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--primary);
}

.attestation-directory-hero h1,
.attestation-profile-name,
.attestation-profile-facts dd,
.attestation-directory-pagination .page-link {
  color: var(--text);
}

.attestation-directory-lead,
.attestation-profile-title,
.attestation-directory-empty {
  color: var(--text-muted);
}

.attestation-directory-status,
.attestation-directory-filters .form-label,
.attestation-profile-facts dt {
  color: var(--text-muted);
}

.attestation-profile-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Dark / Archia365 : bordure visible (contreborde border-0) sur fond --bg */
[data-bs-theme="dark"] .attestation-profile-card,
[data-bs-theme="archia"] .attestation-profile-card {
  background: var(--bg);
  background-color: var(--bg);
  color: var(--text);
  border: 1px solid var(--border) !important;
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .attestation-profile-card:hover,
[data-bs-theme="archia"] .attestation-profile-card:hover {
  border-color: color-mix(in srgb, var(--border) 70%, var(--text)) !important;
  box-shadow: 0 0.85rem 1.6rem color-mix(in srgb, var(--bg) 40%, transparent) !important;
}

.attestation-directory-empty {
  background: var(--surface-2);
  border-color: var(--border);
}

.attestation-directory-empty .bi,
.attestation-profile-facts code,
.attestation-directory-pagination .page-item.active .page-link,
.attestation-directory-pagination .page-link:hover {
  color: var(--primary);
}

.attestation-directory-pagination .page-item.active .page-link,
.attestation-directory-pagination .page-link:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}

/* Mini CV formateur (/formateurs/{id}/biographie) */
.formateur-cv {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.formateur-cv-aside {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.formateur-cv-main {
  background: var(--surface);
  color: var(--text);
}

.formateur-cv-fact-icon {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary);
}

.formateur-cv-session-link {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

.formateur-cv-prose,
.formateur-cv-fact-value,
.formateur-cv-session-title,
.formateur-cv-sessions-heading,
.formateur-cv-block-title {
  color: var(--text);
}

.formateur-cv-aside-title,
.formateur-cv-fact-label,
.formateur-cv-session-event,
.formateur-cv-session-meta,
.formateur-cv-sessions-empty,
.formateur-cv-empty,
.formateur-cv-back a {
  color: var(--text-muted);
}

[data-bs-theme="dark"] .formateur-cv,
[data-bs-theme="archia"] .formateur-cv {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

[data-bs-theme="dark"] .formateur-cv-aside,
[data-bs-theme="archia"] .formateur-cv-aside {
  background: var(--bg) !important;
  color: var(--text);
  border-color: var(--border);
}

[data-bs-theme="dark"] .formateur-cv-main,
[data-bs-theme="archia"] .formateur-cv-main {
  background: var(--bg) !important;
  color: var(--text);
}

[data-bs-theme="dark"] .formateur-cv-session-link,
[data-bs-theme="archia"] .formateur-cv-session-link {
  background: var(--bg) !important;
  border-color: var(--border);
  color: var(--text);
}

[data-bs-theme="dark"] .formateur-cv-prose,
[data-bs-theme="dark"] .formateur-cv-prose p,
[data-bs-theme="dark"] .formateur-cv-prose li,
[data-bs-theme="dark"] .cms-body,
[data-bs-theme="dark"] .cms-body p,
[data-bs-theme="dark"] .cms-body li,
[data-bs-theme="archia"] .formateur-cv-prose,
[data-bs-theme="archia"] .formateur-cv-prose p,
[data-bs-theme="archia"] .formateur-cv-prose li,
[data-bs-theme="archia"] .cms-body,
[data-bs-theme="archia"] .cms-body p,
[data-bs-theme="archia"] .cms-body li {
  color: var(--text) !important;
}

[data-bs-theme="dark"] .formateur-cv-fact-value,
[data-bs-theme="dark"] .formateur-cv-session-title,
[data-bs-theme="dark"] .formateur-cv-sessions-heading,
[data-bs-theme="archia"] .formateur-cv-fact-value,
[data-bs-theme="archia"] .formateur-cv-session-title,
[data-bs-theme="archia"] .formateur-cv-sessions-heading {
  color: var(--text) !important;
}

[data-bs-theme="dark"] .formateur-cv-fact-label,
[data-bs-theme="dark"] .formateur-cv-aside-title,
[data-bs-theme="dark"] .formateur-cv-block-title,
[data-bs-theme="dark"] .formateur-cv-session-event,
[data-bs-theme="dark"] .formateur-cv-session-meta,
[data-bs-theme="dark"] .formateur-cv-sessions-empty,
[data-bs-theme="dark"] .formateur-cv-empty,
[data-bs-theme="archia"] .formateur-cv-fact-label,
[data-bs-theme="archia"] .formateur-cv-aside-title,
[data-bs-theme="archia"] .formateur-cv-block-title,
[data-bs-theme="archia"] .formateur-cv-session-event,
[data-bs-theme="archia"] .formateur-cv-session-meta,
[data-bs-theme="archia"] .formateur-cv-sessions-empty,
[data-bs-theme="archia"] .formateur-cv-empty {
  color: var(--text-muted) !important;
}

.ms-cert-page {
  --ms-ink: var(--text);
  --ms-muted: var(--text-muted);
  --ms-link: var(--primary);
  --ms-card: var(--bg);
  background: var(--bg);
  color: var(--text);
}

.ms-cert-page-title h1 {
  color: var(--text);
}

/* Attestation / surfaces blanches figées → fond sombre + texte contrasté */
[data-bs-theme="dark"] .ms-cert-page,
[data-bs-theme="archia"] .ms-cert-page {
  --ms-card: var(--bg);
  --ms-ink: var(--text);
  --ms-muted: var(--text-muted);
}

[data-bs-theme="dark"] .ms-cert-card,
[data-bs-theme="archia"] .ms-cert-card {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

[data-bs-theme="dark"] .ms-cert-name,
[data-bs-theme="dark"] .ms-cert-achievement,
[data-bs-theme="dark"] .ms-cert-brand-name,
[data-bs-theme="dark"] .ms-cert-facts dd,
[data-bs-theme="dark"] .ms-cert-sign-line,
[data-bs-theme="dark"] .ms-cert-skills h2,
[data-bs-theme="dark"] .ms-cert-skills li,
[data-bs-theme="archia"] .ms-cert-name,
[data-bs-theme="archia"] .ms-cert-achievement,
[data-bs-theme="archia"] .ms-cert-brand-name,
[data-bs-theme="archia"] .ms-cert-facts dd,
[data-bs-theme="archia"] .ms-cert-sign-line,
[data-bs-theme="archia"] .ms-cert-skills h2,
[data-bs-theme="archia"] .ms-cert-skills li {
  color: var(--text);
}

[data-bs-theme="dark"] .ms-cert-phrase,
[data-bs-theme="dark"] .ms-cert-brand-sub,
[data-bs-theme="dark"] .ms-cert-facts dt,
[data-bs-theme="dark"] .ms-cert-sign-meta,
[data-bs-theme="archia"] .ms-cert-phrase,
[data-bs-theme="archia"] .ms-cert-brand-sub,
[data-bs-theme="archia"] .ms-cert-facts dt,
[data-bs-theme="archia"] .ms-cert-sign-meta {
  color: var(--text-muted);
}

[data-bs-theme="dark"] .ms-cert-verify-btn,
[data-bs-theme="archia"] .ms-cert-verify-btn {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

[data-bs-theme="dark"] .ms-cert-verify-btn:hover,
[data-bs-theme="archia"] .ms-cert-verify-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Utilitaires / composants encore en #fff → var(--bg) */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-body,
[data-bs-theme="archia"] .bg-white,
[data-bs-theme="archia"] .bg-body {
  background-color: var(--bg) !important;
  color: var(--text) !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] .page-link,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .toast,
[data-bs-theme="dark"] .popover,
[data-bs-theme="dark"] .popover-body,
[data-bs-theme="dark"] .accordion-item,
[data-bs-theme="dark"] .accordion-button,
[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .table > :not(caption) > * > *,
[data-bs-theme="archia"] .form-control,
[data-bs-theme="archia"] .form-select,
[data-bs-theme="archia"] .form-control:focus,
[data-bs-theme="archia"] .form-select:focus,
[data-bs-theme="archia"] .input-group-text,
[data-bs-theme="archia"] .page-link,
[data-bs-theme="archia"] .offcanvas,
[data-bs-theme="archia"] .toast,
[data-bs-theme="archia"] .popover,
[data-bs-theme="archia"] .popover-body,
[data-bs-theme="archia"] .accordion-item,
[data-bs-theme="archia"] .accordion-button,
[data-bs-theme="archia"] .table,
[data-bs-theme="archia"] .table > :not(caption) > * > * {
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border);
}

[data-bs-theme="dark"] .page-link:hover,
[data-bs-theme="dark"] .page-item.active .page-link,
[data-bs-theme="archia"] .page-link:hover,
[data-bs-theme="archia"] .page-item.active .page-link {
  background-color: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border);
}

[data-bs-theme="dark"] .assessment-exam-dot,
[data-bs-theme="dark"] .attendee-assessment-deck .assessment-exam-dot,
[data-bs-theme="archia"] .assessment-exam-dot,
[data-bs-theme="archia"] .attendee-assessment-deck .assessment-exam-dot {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}

[data-bs-theme="dark"] .dd-chat-panel,
[data-bs-theme="dark"] .dd-chat-messages,
[data-bs-theme="dark"] .dd-chat-composer,
[data-bs-theme="dark"] .dd-personal-planning,
[data-bs-theme="dark"] .planning-preview-sheet,
[data-bs-theme="dark"] .todo-app,
[data-bs-theme="dark"] .todo-sidebar,
[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] .auth-box,
[data-bs-theme="dark"] .kpi,
[data-bs-theme="dark"] .session-card,
[data-bs-theme="dark"] table.data,
[data-bs-theme="dark"] table.data th,
[data-bs-theme="dark"] table.data td,
[data-bs-theme="archia"] .dd-chat-panel,
[data-bs-theme="archia"] .dd-chat-messages,
[data-bs-theme="archia"] .dd-chat-composer,
[data-bs-theme="archia"] .dd-personal-planning,
[data-bs-theme="archia"] .planning-preview-sheet,
[data-bs-theme="archia"] .todo-app,
[data-bs-theme="archia"] .todo-sidebar,
[data-bs-theme="archia"] .topbar,
[data-bs-theme="archia"] .auth-box,
[data-bs-theme="archia"] .kpi,
[data-bs-theme="archia"] .session-card,
[data-bs-theme="archia"] table.data,
[data-bs-theme="archia"] table.data th,
[data-bs-theme="archia"] table.data td {
  background: var(--bg) !important;
  background-color: var(--bg) !important;
  color: var(--text);
  border-color: var(--border);
}

/* Dépôt admin/public : cards + champs formulaire (Dark / Archia365) */
[data-bs-theme="dark"] .gh-depot,
[data-bs-theme="archia"] .gh-depot {
  --gh-border: var(--border);
  --gh-muted: var(--text-muted);
  --gh-surface: var(--bg);
  --gh-panel: var(--bg);
  --gh-code-bg: #020617;
  --gh-code-fg: #e2e8f0;
  color: var(--text);
}

[data-bs-theme="dark"] .gh-depot-list,
[data-bs-theme="dark"] .gh-depot-preview,
[data-bs-theme="dark"] .gh-depot-breadcrumb,
[data-bs-theme="dark"] .gh-depot-upload,
[data-bs-theme="dark"] .gh-depot-folder-create,
[data-bs-theme="dark"] .gh-depot-preview-head,
[data-bs-theme="dark"] .gh-depot-preview-body,
[data-bs-theme="dark"] .gh-depot-branch,
[data-bs-theme="archia"] .gh-depot-list,
[data-bs-theme="archia"] .gh-depot-preview,
[data-bs-theme="archia"] .gh-depot-breadcrumb,
[data-bs-theme="archia"] .gh-depot-upload,
[data-bs-theme="archia"] .gh-depot-folder-create,
[data-bs-theme="archia"] .gh-depot-preview-head,
[data-bs-theme="archia"] .gh-depot-preview-body,
[data-bs-theme="archia"] .gh-depot-branch {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .gh-depot-upload,
[data-bs-theme="archia"] .gh-depot-upload {
  background: color-mix(in srgb, var(--primary) 12%, var(--bg)) !important;
  border: 1px dashed var(--border) !important;
}

[data-bs-theme="dark"] .gh-depot-folder-create,
[data-bs-theme="archia"] .gh-depot-folder-create {
  background: color-mix(in srgb, var(--success, #43ab43) 12%, var(--bg)) !important;
  border: 1px dashed var(--border) !important;
}

[data-bs-theme="dark"] .gh-depot-search-fields input,
[data-bs-theme="dark"] .gh-depot-upload-fields input,
[data-bs-theme="dark"] .gh-depot-table th,
[data-bs-theme="dark"] .gh-depot-table td,
[data-bs-theme="archia"] .gh-depot-search-fields input,
[data-bs-theme="archia"] .gh-depot-upload-fields input,
[data-bs-theme="archia"] .gh-depot-table th,
[data-bs-theme="archia"] .gh-depot-table td {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .gh-depot-repo-name,
[data-bs-theme="dark"] .gh-depot-item-link,
[data-bs-theme="dark"] .gh-depot-md,
[data-bs-theme="dark"] .gh-depot-md p,
[data-bs-theme="dark"] .gh-depot-md li,
[data-bs-theme="archia"] .gh-depot-repo-name,
[data-bs-theme="archia"] .gh-depot-item-link,
[data-bs-theme="archia"] .gh-depot-md,
[data-bs-theme="archia"] .gh-depot-md p,
[data-bs-theme="archia"] .gh-depot-md li {
  color: var(--text) !important;
}

[data-bs-theme="dark"] .gh-depot-col-size,
[data-bs-theme="dark"] .gh-depot-bc-sep,
[data-bs-theme="dark"] .gh-depot-deep,
[data-bs-theme="dark"] .gh-depot .help,
[data-bs-theme="archia"] .gh-depot-col-size,
[data-bs-theme="archia"] .gh-depot-bc-sep,
[data-bs-theme="archia"] .gh-depot-deep,
[data-bs-theme="archia"] .gh-depot .help {
  color: var(--text-muted) !important;
}

/* Admin : cards + champs formulaire (pattern sombre général) */
[data-bs-theme="dark"] .main .card,
[data-bs-theme="dark"] .content .card,
[data-bs-theme="dark"] .layout .card,
[data-bs-theme="dark"] .page-head + .card,
[data-bs-theme="archia"] .main .card,
[data-bs-theme="archia"] .content .card,
[data-bs-theme="archia"] .layout .card,
[data-bs-theme="archia"] .page-head + .card {
  background: var(--bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

[data-bs-theme="dark"] .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
[data-bs-theme="dark"] .form-grid select,
[data-bs-theme="dark"] .form-grid textarea,
[data-bs-theme="dark"] .dd-bootstrap-form input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
[data-bs-theme="dark"] .dd-bootstrap-form select,
[data-bs-theme="dark"] .dd-bootstrap-form textarea,
[data-bs-theme="archia"] .form-grid input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
[data-bs-theme="archia"] .form-grid select,
[data-bs-theme="archia"] .form-grid textarea,
[data-bs-theme="archia"] .dd-bootstrap-form input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
[data-bs-theme="archia"] .dd-bootstrap-form select,
[data-bs-theme="archia"] .dd-bootstrap-form textarea {
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .text-dark,
[data-bs-theme="archia"] .text-dark {
  color: var(--text) !important;
}

[data-bs-theme="dark"] .text-body,
[data-bs-theme="archia"] .text-body {
  color: var(--text) !important;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end,
[data-bs-theme="archia"] .border,
[data-bs-theme="archia"] .border-top,
[data-bs-theme="archia"] .border-bottom,
[data-bs-theme="archia"] .border-start,
[data-bs-theme="archia"] .border-end {
  border-color: var(--border) !important;
}

.dd-cal-weekday,
.dd-cal-day-cell.is-outside,
.dd-cal-mini-day.has-multi-events {
  background: var(--surface-2);
  color: var(--text-muted);
}

.dd-cal-day-cell {
  background: var(--surface);
  color: var(--text);
}

.dd-cal-day-num { color: var(--text); }
.dd-cal-mini-day { color: var(--text-muted); }

.dd-calendar-popover-host {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.dd-calendar-page .card,
.dd-calendar-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.dd-calendar-body {
  border: 1px solid var(--border);
  border-color: var(--border);
  background: var(--surface);
}

[data-bs-theme="light"] .dd-calendar-body,
[data-bs-theme="dark"] .dd-calendar-body,
[data-bs-theme="archia"] .dd-calendar-body {
  border: 1px solid var(--border) !important;
  border-color: var(--border) !important;
}

.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem var(--ring);
}

.table,
table.data {
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  color: var(--text);
}

.table > :not(caption) > * > * {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.dropdown-menu {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.dropdown-item {
  color: var(--text);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--surface-2);
  color: var(--text);
}

.modal-content {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.modal-header,
.modal-footer {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.modal-title,
.modal-body {
  color: var(--text);
}

.modal-body {
  background: var(--surface);
}

/* Admin Messagerie (/admin/mail) : chrome sombre (Dark / Archia365) */
[data-bs-theme="dark"] .mail-app,
[data-bs-theme="archia"] .mail-app {
  --mail-accent: var(--primary);
  --mail-border: var(--border);
  --mail-panel-head-bg: var(--bg);
  --mail-hover-bg: color-mix(in srgb, var(--text) 8%, var(--bg));
  --mail-active-bg: color-mix(in srgb, var(--primary) 16%, var(--bg));
  color: var(--text);
}

[data-bs-theme="dark"] .mail-toolbar.card,
[data-bs-theme="dark"] .mail-folders.card,
[data-bs-theme="dark"] .mail-list.card,
[data-bs-theme="dark"] .mail-read.card,
[data-bs-theme="dark"] .mail-panel-head,
[data-bs-theme="dark"] .mail-folders .list-group-item,
[data-bs-theme="dark"] .mail-message-list,
[data-bs-theme="dark"] .mail-read-content,
[data-bs-theme="archia"] .mail-toolbar.card,
[data-bs-theme="archia"] .mail-folders.card,
[data-bs-theme="archia"] .mail-list.card,
[data-bs-theme="archia"] .mail-read.card,
[data-bs-theme="archia"] .mail-panel-head,
[data-bs-theme="archia"] .mail-folders .list-group-item,
[data-bs-theme="archia"] .mail-message-list,
[data-bs-theme="archia"] .mail-read-content {
  background: var(--bg) !important;
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .mail-folders .list-group-item:hover,
[data-bs-theme="dark"] .mail-row:hover,
[data-bs-theme="archia"] .mail-folders .list-group-item:hover,
[data-bs-theme="archia"] .mail-row:hover {
  background: color-mix(in srgb, var(--text) 8%, var(--bg)) !important;
  color: var(--text) !important;
}

[data-bs-theme="dark"] .mail-folders .list-group-item.active,
[data-bs-theme="dark"] .mail-row.active,
[data-bs-theme="archia"] .mail-folders .list-group-item.active,
[data-bs-theme="archia"] .mail-row.active {
  background: color-mix(in srgb, var(--primary) 16%, var(--bg)) !important;
  color: var(--text) !important;
}

[data-bs-theme="dark"] .mail-row,
[data-bs-theme="dark"] .mail-row-from,
[data-bs-theme="dark"] .mail-row-subject,
[data-bs-theme="dark"] .mail-read-header,
[data-bs-theme="dark"] .mail-attachments,
[data-bs-theme="dark"] .mail-panel-head,
[data-bs-theme="archia"] .mail-row,
[data-bs-theme="archia"] .mail-row-from,
[data-bs-theme="archia"] .mail-row-subject,
[data-bs-theme="archia"] .mail-read-header,
[data-bs-theme="archia"] .mail-attachments,
[data-bs-theme="archia"] .mail-panel-head {
  color: var(--text) !important;
}

[data-bs-theme="dark"] .mail-row-meta,
[data-bs-theme="dark"] .mail-row-preview,
[data-bs-theme="dark"] .mail-blocked-image,
[data-bs-theme="dark"] .mail-app .text-muted,
[data-bs-theme="archia"] .mail-row-meta,
[data-bs-theme="archia"] .mail-row-preview,
[data-bs-theme="archia"] .mail-blocked-image,
[data-bs-theme="archia"] .mail-app .text-muted {
  color: var(--text-muted) !important;
}

[data-bs-theme="dark"] .mail-app .border-top,
[data-bs-theme="archia"] .mail-app .border-top {
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .mail-read-body,
[data-bs-theme="archia"] .mail-read-body {
  background: #fff !important;
  color: #0f172a !important;
  border-color: var(--border) !important;
}

/* Pop-ups / modales : contraste header + message (Dark / Archia365) */
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-body,
[data-bs-theme="dark"] .modal-footer,
[data-bs-theme="archia"] .modal-content,
[data-bs-theme="archia"] .modal-header,
[data-bs-theme="archia"] .modal-body,
[data-bs-theme="archia"] .modal-footer {
  background: var(--bg) !important;
  background-color: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-bs-theme="dark"] .modal-title,
[data-bs-theme="dark"] .modal-body p,
[data-bs-theme="dark"] .modal-body,
[data-bs-theme="dark"] #ddNotifyModal .modal-body,
[data-bs-theme="dark"] #ddConfirmModal .modal-body,
[data-bs-theme="dark"] #ddPreviewModal .modal-body,
[data-bs-theme="archia"] .modal-title,
[data-bs-theme="archia"] .modal-body p,
[data-bs-theme="archia"] .modal-body,
[data-bs-theme="archia"] #ddNotifyModal .modal-body,
[data-bs-theme="archia"] #ddConfirmModal .modal-body,
[data-bs-theme="archia"] #ddPreviewModal .modal-body {
  color: var(--text) !important;
}

[data-bs-theme="dark"] #ddNotifyModal[data-dd-notify-type="info"] .dd-notify-header,
[data-bs-theme="archia"] #ddNotifyModal[data-dd-notify-type="info"] .dd-notify-header,
[data-bs-theme="dark"] #ddNotifyModal:not([data-dd-notify-type]) .dd-notify-header,
[data-bs-theme="archia"] #ddNotifyModal:not([data-dd-notify-type]) .dd-notify-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  color: var(--primary-ct) !important;
}

[data-bs-theme="dark"] #ddNotifyModal[data-dd-notify-type="info"] .dd-notify-header .modal-title,
[data-bs-theme="archia"] #ddNotifyModal[data-dd-notify-type="info"] .dd-notify-header .modal-title,
[data-bs-theme="dark"] #ddNotifyModal:not([data-dd-notify-type]) .dd-notify-header .modal-title,
[data-bs-theme="archia"] #ddNotifyModal:not([data-dd-notify-type]) .dd-notify-header .modal-title {
  color: var(--primary-ct) !important;
}

[data-bs-theme="dark"] .modal .btn-close,
[data-bs-theme="archia"] .modal .btn-close {
  filter: invert(1) grayscale(100%);
  opacity: .85;
}

[data-bs-theme="dark"] #ddNotifyModal .dd-notify-header .btn-close,
[data-bs-theme="archia"] #ddNotifyModal .dd-notify-header .btn-close {
  filter: invert(1) grayscale(100%);
}

[data-bs-theme="dark"] .dd-toast,
[data-bs-theme="dark"] .dd-toast .toast-body,
[data-bs-theme="archia"] .dd-toast,
[data-bs-theme="archia"] .dd-toast .toast-body {
  color: var(--text) !important;
}

[data-bs-theme="dark"] .popover,
[data-bs-theme="dark"] .popover-body,
[data-bs-theme="dark"] .popover-header,
[data-bs-theme="archia"] .popover,
[data-bs-theme="archia"] .popover-body,
[data-bs-theme="archia"] .popover-header {
  background: var(--bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.list-group-item {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.help,
.text-muted {
  color: var(--text-muted) !important;
}
