/* ══════════════════════════════════════════════════════════════════════════════
   Rezo Mityèl — jetons de design partagés (préfixe rm-)
   Source unique des couleurs clair / sombre pour les espaces connectés :
   Admin, Super Admin, Membre, Investisseur, et les pages React (Inertia).
   Le site public n'utilise pas data-bs-theme="dark" et reste donc toujours clair.

   Fichier statique (public/css) : chargé sans build Vite, pour que les pages
   Blade ne dépendent jamais d'un manifest à jour.
   ══════════════════════════════════════════════════════════════════════════════ */

:root, [data-bs-theme="light"]{
    --rm-bg:#F4F7FA; --rm-surface:#FFFFFF; --rm-surface-2:#F8FAFC; --rm-line:#E2E8F0; --rm-line-2:#CBD5E1;
    --rm-text:#0F172A; --rm-text-2:#475569; --rm-text-3:#94A3B8;
    --rm-navy:#0B3B66; --rm-lime:#B8F28E;
    /* Vert de marque : --rm-green pour le texte/icônes, --rm-green-strong pour les fonds sous texte blanc */
    --rm-green:#3E8E1F; --rm-green-strong:#3E8E1F; --rm-green-soft:#ECFDF3;
    --rm-blue:#1D4ED8; --rm-blue-soft:#EFF6FF;
    --rm-amber:#B45309; --rm-amber-soft:#FFF7E6;
    --rm-red:#B42318; --rm-red-soft:#FEF3F2;
    --rm-violet:#6D28D9; --rm-violet-soft:#F3E8FF;
    --rm-side-bg:#0B2A47; --rm-side-text:#A9BCD0; --rm-side-hover:rgba(255,255,255,.07);
    --rm-shadow:0 10px 30px rgba(15,23,42,.06);
    --rm-shadow-lg:0 20px 44px rgba(15,23,42,.18);
    --rm-radius:16px; --rm-radius-sm:12px;
    --rm-font:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
}

[data-bs-theme="dark"]{
    /* Gris foncé doux (style VS Code) — ni bleu, ni noir pur */
    --rm-bg:#1E1E1E; --rm-surface:#252526; --rm-surface-2:#2D2D30; --rm-line:#3C3C3C; --rm-line-2:#4A4A4A;
    --rm-text:#D4D4D4; --rm-text-2:#A7A7A7; --rm-text-3:#808080;
    --rm-navy:#E0E0E0; --rm-lime:#B8F28E;
    --rm-green:#7CC95A; --rm-green-strong:#3E8E1F; --rm-green-soft:rgba(62,142,31,.2);
    --rm-blue:#8AB4FF; --rm-blue-soft:rgba(37,99,235,.18);
    --rm-amber:#F6B65C; --rm-amber-soft:rgba(217,119,6,.18);
    --rm-red:#F08A7E; --rm-red-soft:rgba(220,74,61,.18);
    --rm-violet:#C4A5FF; --rm-violet-soft:rgba(124,58,237,.2);
    --rm-side-bg:#181818; --rm-side-text:#A0A0A0; --rm-side-hover:rgba(255,255,255,.06);
    --rm-shadow:0 8px 24px rgba(0,0,0,.35);
    --rm-shadow-lg:0 20px 44px rgba(0,0,0,.5);
    /* Bootstrap 5.3 suit les mêmes surfaces */
    --bs-body-bg:#1E1E1E; --bs-body-color:#D4D4D4; --bs-border-color:#3C3C3C;
    --bs-secondary-bg:#2D2D30; --bs-tertiary-bg:#252526; --bs-emphasis-color:#E6E6E6;
    --bs-secondary-color:#A7A7A7; --bs-link-color:#8AB4FF; --bs-link-hover-color:#B3CCFF;
    --bs-link-color-rgb:138,180,255; --bs-link-hover-color-rgb:179,204,255;
    color-scheme:dark;
}

/* ── Bouton clair / sombre (même rendu partout) ── */
.rm-theme-toggle{width:42px;height:42px;flex-shrink:0;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;font-size:17px;cursor:pointer;
    background:var(--rm-surface-2);border:1px solid var(--rm-line);color:var(--rm-text);transition:border-color .15s ease,color .15s ease}
.rm-theme-toggle:hover{border-color:var(--rm-text-3)}
.rm-theme-toggle .rm-i-sun{display:none}
[data-bs-theme="dark"] .rm-theme-toggle .rm-i-moon{display:none}
[data-bs-theme="dark"] .rm-theme-toggle .rm-i-sun{display:inline;color:#FCD34D}

/* ── Composants Bootstrap en mode sombre (surfaces codées en clair dans les pages) ── */
[data-bs-theme="dark"] :is(.modal-content, .dropdown-menu, .offcanvas, .popover, .toast){background-color:var(--rm-surface);color:var(--rm-text);border-color:var(--rm-line)}
[data-bs-theme="dark"] :is(.modal-header, .modal-footer){border-color:var(--rm-line)}
[data-bs-theme="dark"] .btn-close{filter:invert(1) grayscale(100%) brightness(200%)}
[data-bs-theme="dark"] :is(.form-control, .form-select){background-color:var(--rm-surface-2);border-color:var(--rm-line);color:var(--rm-text)}
[data-bs-theme="dark"] .form-control::placeholder{color:var(--rm-text-3)}
[data-bs-theme="dark"] :is(.form-control, .form-select):disabled,
[data-bs-theme="dark"] .form-control[readonly]{background-color:#2A2A2C;color:var(--rm-text-2)}
[data-bs-theme="dark"] :is(.input-group-text){background-color:#333336;border-color:var(--rm-line);color:var(--rm-text-2)}
[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator{filter:invert(.8)}
[data-bs-theme="dark"] :is(.bg-white, .bg-light){background-color:var(--rm-surface-2) !important;color:var(--rm-text) !important}
[data-bs-theme="dark"] .text-dark{color:var(--rm-text) !important}
[data-bs-theme="dark"] :is(.text-muted, .text-secondary){color:#A6A6A6 !important}
[data-bs-theme="dark"] .text-primary{color:var(--rm-blue) !important}
[data-bs-theme="dark"] .text-success{color:var(--rm-green) !important}
[data-bs-theme="dark"] .text-danger{color:var(--rm-red) !important}
[data-bs-theme="dark"] .text-warning{color:var(--rm-amber) !important}
[data-bs-theme="dark"] .text-info{color:#7DD3E8 !important}
[data-bs-theme="dark"] .badge.bg-light{background-color:#3A3A3D !important;color:var(--rm-text) !important}
[data-bs-theme="dark"] .badge.bg-warning{color:#1E1E1E !important}
[data-bs-theme="dark"] .table{--bs-table-bg:transparent;--bs-table-color:var(--rm-text);--bs-table-striped-bg:rgba(255,255,255,.03);--bs-table-striped-color:var(--rm-text);--bs-table-hover-bg:rgba(255,255,255,.05);--bs-table-hover-color:var(--rm-text);border-color:var(--rm-line)}
[data-bs-theme="dark"] :is(.table-light, thead.table-light) {--bs-table-bg:var(--rm-surface-2);--bs-table-color:var(--rm-text-2);--bs-table-border-color:var(--rm-line)}
[data-bs-theme="dark"] :is(.list-group-item){background-color:var(--rm-surface);color:var(--rm-text);border-color:var(--rm-line)}
[data-bs-theme="dark"] .page-link{background-color:var(--rm-surface);border-color:var(--rm-line);color:var(--rm-text-2)}
[data-bs-theme="dark"] .page-item.active .page-link{background-color:var(--rm-green-strong);border-color:var(--rm-green-strong);color:#fff}
[data-bs-theme="dark"] .page-item.disabled .page-link{background-color:var(--rm-surface-2);color:var(--rm-text-3)}
[data-bs-theme="dark"] .alert-success{background:rgba(62,142,31,.16);border-color:rgba(124,201,90,.3);color:#A8E08A}
[data-bs-theme="dark"] .alert-danger{background:rgba(220,74,61,.14);border-color:rgba(240,138,126,.3);color:#F5B0A7}
[data-bs-theme="dark"] .alert-warning{background:rgba(217,119,6,.14);border-color:rgba(246,182,92,.3);color:#F2D2A2}
[data-bs-theme="dark"] .alert-info{background:rgba(37,99,235,.14);border-color:rgba(138,180,255,.3);color:#BBD0FF}
[data-bs-theme="dark"] hr{border-color:var(--rm-line);opacity:1}

/* SweetAlert2 suit le thème */
[data-bs-theme="dark"] .swal2-popup{background:var(--rm-surface) !important;color:var(--rm-text) !important;border:1px solid var(--rm-line)}
[data-bs-theme="dark"] :is(.swal2-title, .swal2-html-container){color:var(--rm-text) !important}
[data-bs-theme="dark"] :is(.swal2-input, .swal2-textarea, .swal2-select){background:var(--rm-surface-2) !important;color:var(--rm-text) !important;border-color:var(--rm-line) !important}
[data-bs-theme="dark"] .swal2-icon.swal2-success [class^=swal2-success-circular-line],
[data-bs-theme="dark"] .swal2-icon.swal2-success .swal2-success-fix{background:transparent !important}

/* Barres de défilement discrètes en sombre */
[data-bs-theme="dark"] ::-webkit-scrollbar{width:10px;height:10px}
[data-bs-theme="dark"] ::-webkit-scrollbar-track{background:#1E1E1E}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb{background:#424242;border-radius:8px;border:2px solid #1E1E1E}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover{background:#4F4F4F}

/* Images claires (logos sur fond blanc) : légère atténuation en sombre */
[data-bs-theme="dark"] img.rm-dim{filter:brightness(.9)}

/* Impression : toujours en clair */
@media print{
    html[data-bs-theme="dark"]{color-scheme:light}
}
