/* ═══════════════════════════════════════════════════════════════════════════
   Thème « Nuit » ComplexSystem (plateforme, hors module Iqhra)
   Activé par html[data-theme="dark"] (voir js/theme-init.js et dark-mode-handler.js).
   Surfaces : mêmes valeurs que les cartes sombres de l'accueil (#141727 → #3A416F).
   Chargé APRÈS soft-ui-dashboard.css et complexsystem-charte.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Bouton du sélecteur de thème (jour / nuit / auto) — valable dans les 2 thèmes ── */
.theme-switcher .nav-icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #5A6780; text-decoration: none; transition: background .12s, color .12s;
}
.theme-switcher .nav-icon-btn:hover { background: #E9ECEF; color: #344767; }
.theme-switcher .nav-icon-btn:focus-visible { outline: 3px solid rgba(121, 40, 202, .45); outline-offset: 1px; }
.theme-switcher .nav-icon-btn i { font-size: .95rem; }
.theme-menu { min-width: 11.5rem; padding: .4rem; border-radius: 12px; }
.theme-menu .dropdown-item { border-radius: 8px; padding: .5rem .7rem; font-size: .85rem; border: 0; background: transparent; width: 100%; text-align: left; }
.theme-menu .dropdown-item i:first-child { width: 1.1rem; text-align: center; color: #7928CA; }
.theme-menu .theme-check { display: none; color: #146C43; }
.theme-menu .dropdown-item.active { background: #D4EDDA; color: #146C43; font-weight: 700; }
.theme-menu .dropdown-item.active .theme-check { display: inline-block; }
.theme-menu .dropdown-item.active i:first-child { color: #146C43; }

/* ═══════════════════════ THÈME NUIT ═══════════════════════ */
html[data-theme="dark"] {
  color-scheme: dark;
  --cs-fond: #141727; --cs-carte: #1E2238; --cs-fond-2: #262B47; --cs-ligne: #343A5C;
  --cs-texte: #F1F3F9; --cs-texte-2: #B4BCD3;
  /* variables propres au tableau de bord */
  --bg: #1E2238; --bg2: #262B47; --bg3: #2E3454; --border: rgba(255, 255, 255, .10);
  --text: #F1F3F9; --text2: #B4BCD3;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .bg-gray-100,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .main-content { background-color: #141727 !important; color: #E4E8F4; }

/* surfaces */
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .popover { background-color: #1E2238 !important; color: #E4E8F4; border-color: #343A5C; }
html[data-theme="dark"] .card.card-plain,
html[data-theme="dark"] .card.bg-transparent { background-color: #1E2238 !important; }
html[data-theme="dark"] .card { box-shadow: 0 6px 24px rgba(0, 0, 0, .35) !important; }
html[data-theme="dark"] .dropdown-item { color: #E4E8F4; }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background-color: #2E3454; color: #fff; }
html[data-theme="dark"] .theme-menu .dropdown-item.active { background: #173A2C; color: #7FD99F; }
html[data-theme="dark"] .theme-menu .dropdown-item.active i:first-child,
html[data-theme="dark"] .theme-menu .theme-check { color: #7FD99F; }
html[data-theme="dark"] .theme-menu .dropdown-item i:first-child { color: #C9A8F5; }

/* barre du haut, sidebar, pied de page */
html[data-theme="dark"] #navbarBlur,
html[data-theme="dark"] .navbar-main { background: rgba(20, 23, 39, .85) !important; }
html[data-theme="dark"] .navbar-main.blur { backdrop-filter: saturate(200%) blur(30px); }
html[data-theme="dark"] .sidenav,
html[data-theme="dark"] #sidenav-main,
html[data-theme="dark"] .sidenav-header { background-color: #1E2238 !important; }
html[data-theme="dark"] .sidenav .nav-link,
html[data-theme="dark"] .sidenav .nav-link .nav-link-text { color: #D5DAEA !important; }
html[data-theme="dark"] .sidenav .nav-link:hover { background: #2E3454 !important; }
html[data-theme="dark"] .sidenav .nav-link.active,
html[data-theme="dark"] .sidenav .nav-link.active .nav-link-text { color: #fff !important; }
html[data-theme="dark"] .sidenav .icon-shape,
html[data-theme="dark"] .sidenav .icon { background-color: #2E3454 !important; }
html[data-theme="dark"] .sidenav .icon i { color: #E4E8F4 !important; }
html[data-theme="dark"] .sidenav-hr, html[data-theme="dark"] hr { background-image: none !important; border-color: #343A5C !important; opacity: 1; }
html[data-theme="dark"] .brand-name, html[data-theme="dark"] .navbar-brand { color: #fff !important; }
html[data-theme="dark"] .brand-sub, html[data-theme="dark"] .sidenav-section-label,
html[data-theme="dark"] .cs-clients-count, html[data-theme="dark"] .cs-client-type { color: #B4BCD3 !important; }
html[data-theme="dark"] .sidenav-header img,
html[data-theme="dark"] .navbar-brand img { background: #fff; border-radius: 10px; padding: 2px; }
html[data-theme="dark"] .footer, html[data-theme="dark"] footer { background: transparent !important; }
html[data-theme="dark"] .footer-copy, html[data-theme="dark"] .footer-links a,
html[data-theme="dark"] .footer-legal, html[data-theme="dark"] .footer-legal span { color: #B4BCD3 !important; }
html[data-theme="dark"] .footer-copy a { color: #C9A8F5 !important; }

/* navigation haute */
html[data-theme="dark"] #navbarBlur .breadcrumb-item a,
html[data-theme="dark"] #navbarBlur .breadcrumb-item.text-sm a { color: #B4BCD3 !important; }
html[data-theme="dark"] .breadcrumb-item.active, html[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: #B4BCD3 !important; }
html[data-theme="dark"] .breadcrumb h6, html[data-theme="dark"] .navbar-main h6 { color: #fff !important; }
html[data-theme="dark"] .cs-search { background: #262B47 !important; border-color: #343A5C !important; }
html[data-theme="dark"] .cs-search input { color: #F1F3F9 !important; }
html[data-theme="dark"] .cs-search i { color: #B4BCD3 !important; }
html[data-theme="dark"] .cs-nav-action { color: #D5DAEA !important; }
html[data-theme="dark"] .cs-nav-action:hover { background: #2E3454 !important; border-color: #343A5C !important; color: #fff !important; }
html[data-theme="dark"] .nav-icon-btn, html[data-theme="dark"] .theme-switcher .nav-icon-btn { color: #D5DAEA !important; }
html[data-theme="dark"] .nav-icon-btn:hover, html[data-theme="dark"] .theme-switcher .nav-icon-btn:hover { background: #2E3454 !important; color: #fff !important; }
html[data-theme="dark"] .nav-vsep { background: #343A5C !important; }
html[data-theme="dark"] .cs-user-pill { background: #262B47 !important; border-color: #343A5C !important; color: #F1F3F9 !important; }
html[data-theme="dark"] .cs-sidenav-btn span { background: #D5DAEA !important; }

/* navigation mobile (bas) */
html[data-theme="dark"] #bottom-nav { background: #1E2238 !important; border-top-color: #343A5C !important; box-shadow: 0 -4px 18px rgba(0, 0, 0, .4) !important; }
html[data-theme="dark"] .bottom-nav-item { color: #B4BCD3; }
html[data-theme="dark"] .bottom-nav-item:hover { color: #fff; }
html[data-theme="dark"] .bottom-nav-item.active { color: #F08FD8; }
html[data-theme="dark"] .bottom-nav-item.active .bn-ico { background: #3A1633; color: #F08FD8; }
html[data-theme="dark"] .bottom-nav-item .notif-badge { border-color: #1E2238; }
html[data-theme="dark"] #mobileSearchBar { background: #1E2238 !important; border-top-color: #343A5C !important; }

/* texte */
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"] .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"] .text-dark, html[data-theme="dark"] .text-body, html[data-theme="dark"] label,
html[data-theme="dark"] .form-label, html[data-theme="dark"] .card-title { color: #F1F3F9 !important; }
html[data-theme="dark"] .text-secondary, html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-sm, html[data-theme="dark"] small { color: #B4BCD3 !important; }
html[data-theme="dark"] .text-gradient.text-dark { background-image: linear-gradient(310deg, #B4BCD3, #FFFFFF) !important; }
html[data-theme="dark"] .text-primary, html[data-theme="dark"] .link-primary { color: #F08FD8 !important; }
html[data-theme="dark"] .text-success { color: #7FD99F !important; }
html[data-theme="dark"] .text-warning { color: #F3D36B !important; }
html[data-theme="dark"] .text-danger { color: #FF8A80 !important; }
html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):not(.cs-nav-action):not(.bottom-nav-item):not(.lg-link) { color: #F08FD8; }
html[data-theme="dark"] .lg-link { color: #F08FD8 !important; }

/* formulaires */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select { background-color: #262B47 !important; border-color: #343A5C !important; color: #F1F3F9 !important; }
html[data-theme="dark"] ::placeholder { color: #8F98B8 !important; opacity: 1; }
html[data-theme="dark"] .form-control:focus, html[data-theme="dark"] .form-select:focus { border-color: #A56FF1 !important; box-shadow: 0 0 0 .2rem rgba(165, 111, 241, .28) !important; }
html[data-theme="dark"] .form-control:disabled, html[data-theme="dark"] .form-control[readonly] { background-color: #1E2238 !important; color: #B4BCD3 !important; }
html[data-theme="dark"] .pw-eye { color: #B4BCD3; }
html[data-theme="dark"] .pw-eye:hover { background: #2E3454; color: #fff; }
html[data-theme="dark"] .pw-rules { background: #262B47; border-color: #343A5C; color: #B4BCD3; }
html[data-theme="dark"] .pw-meter { background: #343A5C; }
html[data-theme="dark"] .pw-err, html[data-theme="dark"] .lg-alert.ko, html[data-theme="dark"] .lg-alert { color: #FF8A80; }
html[data-theme="dark"] .lg-alert { background: #43181A; border-color: #7A2A2C; }
html[data-theme="dark"] .pw-alert.ok { background: #173A2C; border-color: #2B6B4E; color: #7FD99F; }
html[data-theme="dark"] .pw-alert.ko { background: #43181A; border-color: #7A2A2C; color: #FF8A80; }

/* tableaux */
html[data-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: #E4E8F4; --bs-table-border-color: #343A5C; color: #E4E8F4; }
html[data-theme="dark"] .table > :not(caption) > * > * { background-color: transparent; color: #E4E8F4; border-bottom-color: #343A5C; }
html[data-theme="dark"] .table thead th { color: #B4BCD3 !important; background-color: #262B47 !important; }
html[data-theme="dark"] .table-hover > tbody > tr:hover > * { background-color: #2E3454; }
html[data-theme="dark"] .border, html[data-theme="dark"] .border-top, html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start, html[data-theme="dark"] .border-end { border-color: #343A5C !important; }

/* boutons */
html[data-theme="dark"] .btn-light, html[data-theme="dark"] .btn-outline-secondary { background-color: #262B47; border-color: #343A5C; color: #E4E8F4; }
html[data-theme="dark"] .btn-light:hover { background-color: #2E3454; color: #fff; }
html[data-theme="dark"] .btn-link { color: #F08FD8; }
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1); }

/* badges pastel : garder le texte foncé lisible sur fond clair */
html[data-theme="dark"] .badge.bg-light { color: #1E2238 !important; }

/* tableau de bord (page à variables propres) */
html[data-theme="dark"] .kpi, html[data-theme="dark"] .tc, html[data-theme="dark"] .cc,
html[data-theme="dark"] .bc:not(.bdk) { background: #1E2238; border-color: rgba(255, 255, 255, .10); }
html[data-theme="dark"] .tc-hd { background: #262B47; }
html[data-theme="dark"] .info-box { background: #2A2444; color: #E4E8F4; border-color: #4A3F73; }
html[data-theme="dark"] .kpi-val, html[data-theme="dark"] .en, html[data-theme="dark"] .tc-hd h5, html[data-theme="dark"] .ch h5 { color: #F1F3F9; }
html[data-theme="dark"] .mstrip, html[data-theme="dark"] .mtab { color: #B4BCD3; }
html[data-theme="dark"] .mtab.on { color: #7FD99F; border-bottom-color: #82D616; background: #262B47; }
html[data-theme="dark"] .gbtn { background: #262B47; color: #B4BCD3; border-color: rgba(255, 255, 255, .12); }
html[data-theme="dark"] .gbtn.on { background: #173A2C; border-color: #2B6B4E; color: #7FD99F; }
html[data-theme="dark"] .mission-strip { background: #173A2C; border-color: #2B6B4E; color: #BFEFD3; }
html[data-theme="dark"] .sinp, html[data-theme="dark"] .bul-select { background: #262B47; color: #F1F3F9; border-color: #343A5C; }
html[data-theme="dark"] .kn { background: #343A5C; color: #D5DAEA; }
html[data-theme="dark"] table td, html[data-theme="dark"] table th { border-color: #343A5C; }

/* ── compléments (sidebar active, barre d'accessibilité, icônes) ── */
html[data-theme="dark"] .navbar-vertical .navbar-nav > .nav-item .nav-link.active,
html[data-theme="dark"] .sidenav .navbar-nav .nav-item .nav-link.active {
  background: #2E3454 !important; color: #fff !important; box-shadow: inset 3px 0 0 #CB0C9F !important;
}
html[data-theme="dark"] .sidenav .navbar-nav .nav-item .nav-link.active .nav-link-text { color: #fff !important; }
html[data-theme="dark"] .navbar-vertical .navbar-nav > .nav-item .nav-link .icon,
html[data-theme="dark"] .sidenav .icon-shape,
html[data-theme="dark"] .sidenav .icon.icon-shape { background: #2E3454 !important; box-shadow: none !important; }
html[data-theme="dark"] .navbar-vertical .navbar-nav > .nav-item .nav-link.active .icon { background-image: linear-gradient(310deg, #7928CA, #CB0C9F) !important; }
html[data-theme="dark"] .sidenav .icon svg, html[data-theme="dark"] .sidenav .icon svg * { fill: #E4E8F4 !important; }
html[data-theme="dark"] .sidenav .collapse .nav-link, html[data-theme="dark"] .sidenav .nav .nav-link { color: #B4BCD3 !important; }
html[data-theme="dark"] .sidenav .nav .nav-link:hover, html[data-theme="dark"] .sidenav .nav .nav-link.active { color: #fff !important; }
html[data-theme="dark"] #accessibility-bar { background: #1E2238 !important; border-color: #343A5C !important; box-shadow: none !important; }
html[data-theme="dark"] .acc-btn, html[data-theme="dark"] .lang-toggle { background: #262B47 !important; border-color: #343A5C !important; color: #E4E8F4 !important; }
html[data-theme="dark"] .acc-btn:hover, html[data-theme="dark"] .lang-toggle:hover { background: #2E3454 !important; color: #fff !important; }
html[data-theme="dark"] .acc-btn[aria-pressed="true"] { background: #173A2C !important; border-color: #2B6B4E !important; color: #7FD99F !important; }
html[data-theme="dark"] .lang-menu { background: #1E2238 !important; border-color: #343A5C !important; }
html[data-theme="dark"] .lang-menu a { color: #E4E8F4 !important; }

/* ── page profil ── */
html[data-theme="dark"] .profile-identity { background: rgba(30, 34, 56, .92) !important; box-shadow: 0 8px 32px rgba(0, 0, 0, .45) !important; }
html[data-theme="dark"] .profile-name, html[data-theme="dark"] .info-row .info-key, html[data-theme="dark"] .rh-metric-value,
html[data-theme="dark"] .rh-row-value, html[data-theme="dark"] .pay-line-value, html[data-theme="dark"] .pay-line-total,
html[data-theme="dark"] .conge-name, html[data-theme="dark"] .eval-score, html[data-theme="dark"] .doc-name,
html[data-theme="dark"] .cs-card .cs-card-header h6, html[data-theme="dark"] .pf-stat .val { color: #F1F3F9; }
html[data-theme="dark"] .profile-meta, html[data-theme="dark"] .info-row .info-val, html[data-theme="dark"] .rh-metric-label,
html[data-theme="dark"] .rh-metric-sub, html[data-theme="dark"] .rh-row-label, html[data-theme="dark"] .pay-line-label,
html[data-theme="dark"] .conge-dates, html[data-theme="dark"] .eval-cat, html[data-theme="dark"] .doc-meta,
html[data-theme="dark"] .empty-state, html[data-theme="dark"] .setting-group-label, html[data-theme="dark"] .rh-section-label,
html[data-theme="dark"] .pf-stat .lbl, html[data-theme="dark"] .theme-note { color: #B4BCD3; }
html[data-theme="dark"] .cs-card, html[data-theme="dark"] .pf-stat { background: #1E2238; border-color: #343A5C; box-shadow: none; }
html[data-theme="dark"] .cs-card .cs-card-header, html[data-theme="dark"] .info-row, html[data-theme="dark"] .rh-row,
html[data-theme="dark"] .pay-line, html[data-theme="dark"] .conge-item, html[data-theme="dark"] .eval-row { border-color: #343A5C; }
html[data-theme="dark"] .profile-tabs { background: #262B47; }
html[data-theme="dark"] .profile-tabs .ptab { color: #B4BCD3; }
html[data-theme="dark"] .profile-tabs .ptab:hover { color: #fff; background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .profile-tabs .ptab.active { background: #1E2238; color: #F08FD8; box-shadow: none; }
html[data-theme="dark"] .rh-metric, html[data-theme="dark"] .profile-bio { background: #262B47; }
html[data-theme="dark"] .doc-item { border-color: #343A5C; }
html[data-theme="dark"] .doc-item:hover { background: #262B47; }
html[data-theme="dark"] .rh-action-btn:not(.primary), html[data-theme="dark"] .edit-btn, html[data-theme="dark"] .doc-dl { background: #262B47; border-color: #343A5C; color: #E4E8F4; }
html[data-theme="dark"] .rh-action-btn:not(.primary):hover, html[data-theme="dark"] .edit-btn:hover { background: #2E3454; color: #fff; }
html[data-theme="dark"] .pf-stat .ico.mag { background: #3A1633; color: #F08FD8; }
html[data-theme="dark"] .pf-stat .ico.vio { background: #2A2049; color: #C9A8F5; }
html[data-theme="dark"] .pf-stat .ico.ok  { background: #173A2C; color: #7FD99F; }
html[data-theme="dark"] .pf-stat .ico.sun { background: #3E3413; color: #F3D36B; }
html[data-theme="dark"] .pf-role { background: #2A2049; color: #C9A8F5; }
html[data-theme="dark"] .theme-opt { background: #262B47; border-color: #343A5C; color: #E4E8F4; }
html[data-theme="dark"] .theme-opt i { color: #C9A8F5; }
html[data-theme="dark"] .theme-opt.active, html[data-theme="dark"] .theme-opt[aria-pressed="true"] { background: #173A2C; border-color: #2B6B4E; color: #7FD99F; }
html[data-theme="dark"] .theme-opt.active i, html[data-theme="dark"] .theme-opt[aria-pressed="true"] i { color: #7FD99F; }

/* ── fiche élève ── */
html[data-theme="dark"] .el-id { background: rgba(30, 34, 56, .93); box-shadow: 0 8px 32px rgba(0, 0, 0, .45); }
html[data-theme="dark"] .el-name, html[data-theme="dark"] .el-card-h h6, html[data-theme="dark"] .el-row .k,
html[data-theme="dark"] .el-pay .cl, html[data-theme="dark"] .el-contact .nm { color: #F1F3F9; }
html[data-theme="dark"] .el-sub, html[data-theme="dark"] .el-row .v, html[data-theme="dark"] .el-pay .mt, html[data-theme="dark"] .el-empty { color: #B4BCD3; }
html[data-theme="dark"] .el-card { background: #1E2238; border-color: #343A5C; box-shadow: none; }
html[data-theme="dark"] .el-card-h, html[data-theme="dark"] .el-row, html[data-theme="dark"] .el-pay, html[data-theme="dark"] .el-contact { border-color: #343A5C; }
html[data-theme="dark"] .el-card-h h6 i { color: #C9A8F5; }
html[data-theme="dark"] .el-chip.mag { background: #3A1633; color: #F08FD8; }
html[data-theme="dark"] .el-chip.vio { background: #2A2049; color: #C9A8F5; }
html[data-theme="dark"] .el-chip.ok  { background: #173A2C; color: #7FD99F; }
html[data-theme="dark"] .el-chip.sun { background: #3E3413; color: #F3D36B; }
html[data-theme="dark"] .el-btn.ghost { background: #262B47; border-color: #343A5C; color: #F08FD8; }
html[data-theme="dark"] .el-contact a { color: #F08FD8; }
html[data-theme="dark"] .el-contact .ic { background: #173A2C; color: #7FD99F; }

/* ── accueil : carte « Suivi de mémorisation » (design Iqhra) en mode nuit : brun profond + or ── */
html[data-theme="dark"] .iq-home-card { background: #2A1F15 !important; border-color: #6b4d1f; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
html[data-theme="dark"] .iq-home-card::after { border-color: rgba(230, 190, 90, .25); }
html[data-theme="dark"] .iq-home-list strong { color: #F6EBD2 !important; }
html[data-theme="dark"] .iq-home-list span:not(.iq-ico) { color: #D8C39A !important; }
html[data-theme="dark"] .iq-ico, html[data-theme="dark"] .iq-btn .iq-btn-ico { background: #43331F; border-color: #7a5c22; }
html[data-theme="dark"] .iq-btn { background: #362819; border-color: #6b4d1f; color: #F6EBD2; box-shadow: none; }
html[data-theme="dark"] .iq-btn > i { color: #E6BE5A; }
html[data-theme="dark"] .iq-btn:hover { background: #8a6508; border-color: #b8860b; color: #fff; }
html[data-theme="dark"] .iq-home-sep { color: #E6BE5A; }
html[data-theme="dark"] a.iq-btn { color: #F6EBD2 !important; }
html[data-theme="dark"] a.iq-btn:hover { color: #fff !important; }
