:root {
    /* Dégradé Couleur Or / Gold Premium */
    --gold-gradient: linear-gradient(135deg, #bf953f 0%, #fcf6ba 25%, #b38728 50%, #fbf5b7 75%, #aa771c 100%);
    --dark-bg: #1a1a1a;
    --sidebar-bg: #262626;
    --text-color: #333333;
    --light-gold: #fcf6ba;
}
/* ==========================================================================
   --- FIXATION DE LA STRUCTURE GLOBALE & DE LA TOPBAR ---
   ========================================================================== */

/* L'enveloppe verrouille le menu à gauche et le contenu à droite */
.app-wrapper {
    display: flex !important;
    min-height: 100vh;
    width: 100%;
    align-items: stretch;
}

#sidebar { 
    width: 280px; 
    background: #1a1a1a; 
    color: white; 
    min-height: 100vh; 
    z-index: 100;
    flex-shrink: 0; /* Empêche la sidebar de se déformer */
}
/* ==========================================================================
   --- STRUCTURE ET LAYOUT INCASSABLE (SIDEBAR & TOPBAR FIXES) ---
   ========================================================================== */

/* L'enveloppe globale prend toute la hauteur de l'écran sans scroll général */
.app-wrapper {
    display: flex !important;
    height: 100vh !important;
    width: 100%;
    overflow: hidden !important; /* Bloque le scroll sur toute la page */
    align-items: stretch;
}

/* 📌 SIDEBAR FIXE : Elle reste collée à gauche et gère son propre défilement si besoin */
#sidebar { 
    width: 280px; 
    background: #1a1a1a; 
    color: white; 
    height: 100vh !important; 
    z-index: 1050;
    flex-shrink: 0;
    overflow-y: auto; /* Permet de scroller dans la sidebar si les menus dépassent */
}

/* Zone de contenu globale (Divisée en Topbar fixe + Corps défilant) */
#content { 
    flex: 1; 
    display: flex;
    flex-direction: column; /* Aligne la Topbar au-dessus du contenu */
    height: 100vh !important;
    min-width: 0; 
    background-color: #f4f6f9;
}

/* Zone principale de travail */
#content { 
    flex: 1; 
    padding: 25px; 
    min-width: 0; 
    background-color: #f4f6f9;
}



/* ==========================================================================
   --- ARCHITECTURE DES DROPDOWNS SANS CONFLIT (UL / LI) ---
   ========================================================================== */

.sidebar-menu-list, 
.sidebar-submenu-list,
.nested-submenu-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
}
/* --- GRILLE RESPONSIVE DU DASHBOARD AGENT --- */
.dash-grid-statistiques {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    width: 100%;
}

.stat-card {
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

.border-gold {
    border-left: 4px solid #bf953f !important;
}
.border-dark {
    border-left: 4px solid #2d3748 !important;
}
section{
    margin-top:-1%;
}

/* Titres statiques de sections (Grisés) */
.menu-header {
    font-size: 0.72rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: #718096 !important;
    padding: 18px 20px 6px 20px !important;
    font-weight: 700 !important;
    user-select: none;
}

/* Déclencheurs de niveau 2 (Données de base, Flux de caisse, etc.) */
.menu-header-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #e2e8f0;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 10px 20px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}
.menu-header-toggle:hover {
    color: #bf953f;
}

/* 1. NIVEAU 2 : Caché par défaut */
.sidebar-submenu-list {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    border-left: 2px solid #bf953f; /* Ligne Or à gauche */
    margin: 2px 0 5px 15px;
}

/* Révélation du niveau 2 au clic */
.menu-item-dropdown.open-submenu > .sidebar-submenu-list {
    display: block !important;
}

/* Pivotement fin de la flèche du niveau 2 */
.menu-item-dropdown.open-submenu > .menu-header-toggle .arrow-indicator {
    transform: rotate(90deg);
    color: #bf953f;
}

/* Liens du niveau 2 (Société, Sources, Banques...) */
.sidebar-submenu-list li a {
    color: #cbd5e0 !important;
    display: block !important;
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
    text-decoration: none !important;
    text-align: left !important;
    transition: all 0.2s ease;
}
.sidebar-submenu-list li a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.03);
    padding-left: 20px !important;
}

/* --------------------------------------------------------------------------
   --- NIVEAU 3 : SOUS-SOUS-MENUS IMBRIQUÉS (Catégories / Sous-Catégories) ---
   -------------------------------------------------------------------------- */

/* Liens parents de niveau 3 ayant un sous-choix */
.nested-dropdown-item > a {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
}

/* Petite flèche discrète de niveau 3 */
.nested-dropdown-item > a::after {
    content: "▶";
    font-size: 0.6rem;
    color: #718096;
    transition: transform 0.2s ease;
}

/* 2. NIVEAU 3 : Caché par défaut */
.nested-submenu-list {
    display: none;
    background: rgba(0, 0, 0, 0.15) !important;
    margin-left: 10px !important;
    border-left: 1px dashed rgba(255, 255, 255, 0.15);
}

/* Révélation du niveau 3 au clic */
.nested-dropdown-item.open-nested > .nested-submenu-list {
    display: block !important;
}

/* Pivotement fin de la flèche du niveau 3 */
.nested-dropdown-item.open-nested > a::after {
    transform: rotate(90deg);
    color: #bf953f;
}

/* Liens de niveau 3 finaux (Catégories d'entrée / dépenses) */
.nested-submenu-list li a {
    color: #a0aec0 !important;
    padding: 6px 16px !important;
    font-size: 0.8rem !important;
}
.nested-submenu-list li a:hover {
    color: #bf953f !important;
    padding-left: 20px !important;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; display: flex; background-color: #f4f6f9; color: var(--text-color); min-height: 100vh; }

/* Sidebar au design Or */
#sidebar {position:fixed; width: 280px; background: var(--sidebar-bg); color: white; min-height: 100vh; padding: 0; box-shadow: 4px 0 10px rgba(0,0,0,0.3); transition: transform 0.3s ease; position: relative; z-index: 100; }
.sidebar-brand { background: var(--gold-gradient); color: #000; padding: 20px; font-weight: bold; text-align: center; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.user-info { padding: 15px; background: rgba(0,0,0,0.2); font-size: 0.9rem; text-align: center; border-bottom: 1px solid #3d3d3d; color: #fbf5b7; }
/* L'enveloppe prend le relais de l'alignement horizontal strict */

.menu-group { padding: 10px 0; }
.menu-header { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #888; padding: 10px 20px 5px 20px; font-weight: bold; }

#sidebar a { color: #d1d1d1; display: block; padding: 10px 20px; text-decoration: none; font-size: 0.95rem; transition: all 0.3s ease; border-left: 4px solid transparent; }
#sidebar a:hover, #sidebar a.active { background: rgba(255, 255, 255, 0.05); color: #fff; border-left-color: #bf953f; }

/* Contenu principal */
#content { flex: 1; padding: 30px; min-width: 0; transition: all 0.3s ease; }
.content-header { background: white; padding: 20px; margin:-30px -30px 30px -30px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; }
.date-systeme { font-size: 0.9rem; color: #666; display: block; margin-top: 4px; }
/* ==========================================================================
   --- BOUTON PREMIUM OUTLINE GOLD & DARK ---
   ========================================================================== */
.btn-chic-outline-gold {
    background: transparent;
    color: #2d3748 !important; /* Texte gris très foncé / anthracite */
    border: 2px solid #bf953f !important; /* Bordure Or premium */
    padding: 8px 20px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
    border-radius: 6px !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* 🌟 EFFET AU SURVOL (HOVER) : Inversion de couleur chic et légère élévation */
.btn-chic-outline-gold:hover {
    background: #1a1a1a !important; /* Fond noir intense */
    color: #ffffff !important;      /* Texte blanc pur */
    border-color: #1a1a1a !important; /* La bordure fusionne avec le fond */
    transform: translateY(-1px);    /* Léger effet de suspension */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12); /* Ombre portée douce */
}

/* Effet au clic (Active) */
.btn-chic-outline-gold:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
/* ==========================================================================
   --- CONFIGURATION HORIZONTALE ET DESIGN DES ONGLETS ANALYTIQUES ---
   ========================================================================== */

/* Force l'alignement strict en ligne de la liste des onglets */
#pills-tab-appros,
#pills-tab-depenses {
    display: flex !important;
    flex-direction: row !important; /* Force l'alignement horizontal */
    flex-wrap: nowrap !important;   /* Interdit le retour à la ligne automatique */
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important; /* Espace chic entre chaque onglet */
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

/* Redimensionnement et neutralisation des boutons pour l'aspect onglet */
#pills-tab-appros .nav-item,
#pills-tab-depenses .nav-item {
    display: inline-block !important; /* Empêche l'élément de prendre toute la largeur */
    flex: 0 1 auto !important;
}

/* Style chic des onglets au repos (Boutons désactivés) */
#pills-tab-appros .nav-link,
#pills-tab-depenses .nav-link {
    background: #f8fafc !important; /* Fond gris très clair discret */
    color: #4a5568 !important;     /* Texte anthracite lisible */
    border: 1px solid #cbd5e0 !important; /* Fine bordure neutre */
    padding: 10px 24px !important; /* Confort de clic horizontal */
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    border-radius: 6px !important; /* Coins légèrement arrondis style onglet */
    white-space: nowrap !important; /* Interdit le texte sur 2 lignes */
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* 🌟 EFFET HOVER (Survol) : Illumination subtile */
#pills-tab-appros .nav-link:hover,
#pills-tab-depenses .nav-link:hover {
    color: #bf953f !important;
    background: #ffffff !important;
    border-color: #bf953f !important;
}

/* 🌟 L'ONGLET ACTIF (Sélectionné) : Style Prestige Or et Noir Intense */
#pills-tab-appros .nav-link.active,
#pills-tab-depenses .nav-link.active {
    background: #1a1a1a !important; /* Fond noir profond */
    color: #ffffff !important;      /* Texte blanc pur */
    border-color: #bf953f !important; /* Bordure Or premium */
    border-bottom-width: 3px !important; /* Assise visuelle surélevée */
    box-shadow: 0 4px 6px rgba(0,0,0,0.06);
}

.page-section { background: white; padding: 25px; border-radius: 8px; margin-top:1%; box-shadow: 0 4px 6px rgba(0,0,0,0.05); animation: fadeIn 0.4s ease; }
.hidden { display: none !important; }

/* Bouton de soumission Or */
.btn-gold-submit { background: var(--gold-gradient); color: black; border: none; padding: 10px 20px; font-weight: bold; cursor: pointer; border-radius: 4px; transition: opacity 0.2s; }
.btn-gold-submit:hover { opacity: 0.9; }

/* Raccourci Déconnexion */
.logout-btn { color: #ff6b6b !important; margin-top: 20px; border-top: 1px solid #3d3d3d; }
.logout-btn:hover { background: rgba(231, 76, 60, 0.1) !important; color: #ff4747 !important; }

/* COMPOSANTS INDÉPENDANTS DU MENU RESPONSIVE */
.menu-toggle { display: none; background: var(--gold-gradient); border: none; font-size: 1.5rem; padding: 8px 15px; border-radius: 5px; cursor: pointer; color: #000; font-weight: bold; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 90; backdrop-filter: blur(2px); }

/* ==========================================================================
   --- LOOK & FEEL : STYLISATION DES FORMULAIRES & BOUTONS ---
   ========================================================================== */

/* 1. Design des champs de saisie (Inputs, Selects) */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: #2d3748;
    background-color: #ffffff;
    border: 2px solid #e2e8f0; /* Bordure grise discrète par défaut */
    border-radius: 6px; /* Angles légèrement arrondis, très moderne */
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02); /* Légère ombre interne */
    transition: all 0.25s ease-in-out; /* Transition douce pour l'animation au clic */
}

/* Animation et effet visuel lorsque l'utilisateur clique dans un champ (Focus) */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: #bf953f; /* La bordure s'illumine en couleur Or */
    box-shadow: 0 0 0 3px rgba(191, 149, 63, 0.15); /* Halos doré subtil autour du champ */
    background-color: #fff;
    outline: none; /* Supprime la bordure bleue par défaut des navigateurs */
}

/* Stylisation des placeholders (les textes d'indication gris dans les champs) */
::placeholder {
    color: #a0aec0;
    opacity: 1;
}

/* 2. Boutons d'Action Principaux (Bouton Or Premium pour les soumissions) */
.btn-gold-submit,
.btn-gold {
    background: linear-gradient(135deg, #bf953f 0%, #fcf6ba 25%, #b38728 50%, #fbf5b7 75%, #aa771c 100%) !important;
    color: #1a1a1a !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 24px;
    border: none !important;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(187, 143, 44, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

/* Effet au survol (Hover) du bouton Or */
.btn-gold-submit:hover,
.btn-gold:hover {
    transform: translateY(-1px); /* Le bouton s'élève très légèrement */
    box-shadow: 0 6px 12px rgba(187, 143, 44, 0.25), 0 2px 4px rgba(0, 0, 0, 0.1);
    filter: brightness(1.05); /* Augmente discrètement la luminosité du dégradé */
}

/* Effet au clic (Active) du bouton Or */
.btn-gold-submit:active,
.btn-gold:active {
    transform: translateY(1px); /* Effet d'enfoncement physique */
    box-shadow: 0 2px 4px rgba(187, 143, 44, 0.1);
}

/* 3. Boutons de Statuts Spécifiques pour le Tableau (Activer / Désactiver) */

/* Bouton Activer (Vert moderne) */
.btn-success {
    background-color: #10b981 !important; /* Vert émeraude */
    border: 1px solid #059669 !important;
    color: #ffffff !important;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
    transition: all 0.2s;
}
.btn-success:hover {
    background-color: #059669 !important;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
}

/* Bouton Désactiver (Rouge moderne) */
.btn-danger {
    background-color: #ef4444 !important; /* Rouge corail */
    border: 1px solid #dc2626 !important;
    color: #ffffff !important;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
    transition: all 0.2s;
}
.btn-danger:hover {
    background-color: #dc2626 !important;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}

/* 4. Petits ajustements de confort pour les formulaires en grille Bootstrap */
.card-header {
    border-bottom: none;
}
.form-label {
    margin-bottom: 6px;
    font-size: 0.88rem;
    letter-spacing: 0.3px;
}
/* --- PIECE CSS INDISPENSABLE POUR L'EFFET DE VAGUE JS --- */
.js-ripple-effect {
    position: absolute;
    background: rgba(255, 255, 255, 0.4); /* Onde blanche semi-transparente */
    border-radius: 50%;
    transform: scale(0);
    animation: rippleAnimation 0.6s linear;
    pointer-events: none; /* Empêche l'onde de bloquer les clics */
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
}

/* Les boutons sombres reçoivent une onde plus claire */
.btn-success .js-ripple-effect,
.btn-danger .js-ripple-effect {
    background: rgba(255, 255, 255, 0.3);
}
/* --- ALIGNEMENT CENTRÉ GLOBAL DES TABLEAUX --- */
.table th, 
.table td {
    text-align: center !important; /* Centre horizontalement le texte, les badges et les boutons */
    vertical-align: middle !important; /* Centre verticalement le contenu si les lignes ont des hauteurs différentes */
}

/* Ajustement pour le défilement horizontal Bootstrap : conserve le centrage strict */
.table-responsive table {
    margin: 0 auto;
}

@keyframes rippleAnimation {
    to {
        transform: scale(4); /* L'onde grandit pour couvrir le bouton */
        opacity: 0;         /* Et s'efface en fondu */
    }
}


@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* --- GRILLE DES 5 FORMES DU DASHBOARD --- */
.dash-grid-statistiques {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* Style général d'une forme statistique */
.stat-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* Variantes de bordures pour le rythme visuel */
.border-gold { border-top: 4px solid #bf953f; }
.border-dark { border-top: 4px solid #262626; }

/* Conteneurs de texte à l'intérieur des formes */
.stat-icon { font-size: 2rem; }
.stat-info { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 0.8rem; text-transform: uppercase; color: #777; font-weight: 600; letter-spacing: 0.5px; }
.stat-number { font-size: 1.35rem; font-weight: bold; color: #262626; }

/* Couleurs spécifiques aux valeurs */
.text-gold { color: #b38728 !important; }
.text-red { color: #e74c3c !important; }

/* --- COMPORTEMENT RESPONSIVE DES FORMES (MEDIA QUERIES) --- */
@media (max-width: 992px) {
    .dash-grid-statistiques {
        grid-template-columns: repeat(2, 1fr); /* Passe à 2 colonnes sur tablette */
        gap: 15px;
    }
    
}
@media (max-width: 768px) {
    .table th, 
    .table td {
        text-align: center !important; /* Conserve le centrage même sur petit écran */
        padding: 10px 12px !important; /* Compresse légèrement les cellules pour le tactile */
    }
}
/* ==========================================================================
   --- DESIGN CHIC & PREMIUM DES FORMULAIRES ---
   ========================================================================== */

.form-group-chic {
    margin-bottom: 5px;
}

/* Étiquettes fines et élégantes */
.label-chic {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #718096;
    margin-bottom: 8px;
    display: block;
    transition: color 0.25s ease;
}

/* Conteneur de champ avec icône intégrée */
.input-wrapper-chic {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icônes grises chic à gauche */
.input-icon-chic {
    padding: 0 12px;
    font-size: 1.1rem;
    color: #a0aec0;
    user-select: none;
    border-right: 1px solid #edf2f7;
}

/* Style épuré des inputs et des selects */
.input-chic, 
.select-chic {
    flex: 1;
    border: none !important;
    padding: 12px 14px;
    font-size: 0.95rem;
    color: #2d3748;
    background: transparent;
    outline: none !important;
    width: 100%;
}

/* Retouche spécifique pour harmoniser le calendrier natif (icône système masquée/allégée) */
.date-picker-chic::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

/* 🌟 EFFET FOCUS INTERACTIF : Bordure Or éclatante au clic */
.input-wrapper-chic.focused {
    border-color: #bf953f;
    box-shadow: 0 0 0 4px rgba(191, 149, 63, 0.12);
}

/* --- BOUTON EN DÉGRADÉ OR CHIC --- */
.btn-gold-chic {
    background: linear-gradient(135deg, #bf953f 0%, #fcf6ba 30%, #b38728 70%, #aa771c 100%) !important;
    border: none !important;
    border-radius: 30px; /* Forme pilule très élégante */
    color: #111111 !important;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-gold-chic:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(179, 135, 40, 0.3);
    filter: brightness(1.03);
}

.btn-gold-chic:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(179, 135, 40, 0.15);
}
/* --- ALIGNEMENT DES LABELS HORIZONTAUX --- */
@media (min-width: 768px) {
    .text-end {
        text-align: right !important;
    }
}
@media (max-width: 767px) {
    .text-end {
        text-align: left !important;
        margin-bottom: 4px;
    }
    /* Sur petit écran, on repasse les structures imbriquées en bloc vertical classique */
    .col-4, .col-8 {
        width: 100% !important;
    }
}
/* ==========================================================================
   --- DESIGN APPLI CAISSE PREMIUM & COMPACT ---
   ========================================================================== */

/* Libellés fins alignés à droite */
.form-label-chic {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    color: #4a5568 !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 0 !important;
}

/* Inputs fins et raffinés */
.form-input-chic,
.form-select-chic {
    width: 100% !important;
    height: 38px !important; /* Hauteur compacte standardisée */
    padding: 6px 12px !important;
    font-size: 0.9rem !important;
    color: #2d3748 !important;
    background-color: #ffffff !important;
    border: 2px solid #edf2f7 !important; /* Bordure extra-fine et claire */
    border-radius: 6px !important;
    box-shadow: none !important;
    transition: all 0.2s ease-in-out !important;
}

/* Effet d'illumination douce au clic (Focus) */
.form-input-chic:focus,
.form-select-chic:focus {
    border-color: #bf953f !important; /* Illumination Or */
    background-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(191, 149, 63, 0.1) !important;
    outline: none !important;
}

/* Bordures douces pour les boîtes de formulaires */
.rounded-4 {
    border-radius: 12px !important;
}

/* Adaptation réactive pour les écrans de téléphones */
@media (max-width: 768px) {
    .text-end {
        text-align: left !important; /* Remet à gauche sur mobile pour éviter les chevauchements */
        margin-bottom: 3px !important;
    }
    .col-5, .col-7 {
        width: 100% !important; /* Les champs s'empilent verticalement sur mobile */
        max-width: 100% !important;
    }
}


@media (max-width: 768px) {
    .dash-grid-statistiques {
        grid-template-columns: 1fr; /* Passe à une seule colonne verticale sur smartphone */
        gap: 12px;
    }
    .stat-card { padding: 15px; }
    .stat-number { font-size: 1.2rem; }
}
/* --- COMPOSANTS DE DEUXIÈME NIVEAU DU DASHBOARD --- */
.analytics-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.analytics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.analytics-card-header h4 {
    font-size: 0.95rem;
    color: var(--dark-bg);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Variantes visuelles Or et Noir */
.border-left-gold { border-left: 5px solid #bf953f; }
.border-left-dark { border-left: 5px solid #262626; }

/* Compteurs d'alertes */
.badge-count {
    background: #e74c3c;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
}

/* Compactage pour les mini-tables du dashboard */
.mini-table table {
    min-width: 100% !important;
}

.mini-table th, .mini-table td {
    padding: 8px 10px;
    font-size: 0.82rem;
}

/* Badges d'action et de type */
.badge-type {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}
.badge-entree { background: rgba(46, 204, 113, 0.15); color: #27ae60; }
.badge-depense { background: rgba(231, 76, 60, 0.15); color: #c0392b; }
.badge-transfert { background: rgba(52, 152, 219, 0.15); color: #2980b9; }

/* Boutons d'action rapide sur le Dashboard */
.btn-action-small {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: bold;
}
.btn-valider { background: #2ecc71; color: white; margin-right: 5px; }
.btn-rejeter { background: #e74c3c; color: white; }
.link-preuve { color: #b38728; text-decoration: underline; font-size: 0.75rem; cursor: pointer; }

/* --- RESPONSIVE ADAPTATION --- */
@media (max-width: 992px) {
    .dash-grid-analytics {
        grid-template-columns: 1fr !important; /* Force l'affichage l'un sous l'autre sur petit écran */
        gap: 20px;
    }
}
/* Bordure spécifique pour le panneau des risques d'alerte */
.border-left-red { border-left: 5px solid #e74c3c; }

/* Éléments d'alerte individuels */
.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.2);
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.alert-item strong { color: #c0392b; }
.badge-danger-light { background: #e74c3c; color: white; padding: 2px 6px; border-radius: 4px; font-weight: bold; font-size: 0.75rem; }

/* --- RESPONSIVE DES GRAPHIQUES --- */
@media (max-width: 992px) {
    .dash-grid-charts {
        grid-template-columns: 1fr !important; /* Devient vertical sur tablette et mobile */
        gap: 20px;
    }
}
/* Sécurité : Force la modale à rester invisible tant que Bootstrap n'est pas chargé */
.modal:not(.show) {
    display: none !important;
}
/* --- ACTIVATION FORCEE DU SCROLL HORIZONTAL DU TABLEAU --- */
.table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important; /* 🌟 FORCE l'apparition du scroll horizontal si ça dépasse */
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important; /* Rend le défilement au doigt fluide sur iPhone/Android */
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

/* On donne une largeur minimale à la table pour qu'elle garde sa structure sur mobile */
.table-responsive table {
    min-width: 850px !important; /* 🌟 CRUCIAL : Force le tableau à garder une taille confortable, ce qui déclenche le scroll */
    width: 100% !important;
}

/* Confort visuel pour le texte des colonnes */
.table th, .table td {
    white-space: nowrap !important; /* Empêche les textes de se casser en deux lignes */
    padding: 12px 16px !important;
}




/* --- ENVELOPPE DE SÉCURITÉ CONTRE LE DÉBORDEMENT DES TABLEAUX --- */
#content {
    flex: 1;
    padding: 30px;
    /* 🌟 CRUCIAL : Permet au conteneur de se contracter sur mobile au lieu de forcer sa taille */
    min-width: 0; 
    width: 100%;
    overflow-x: hidden; /* Empêche la page entière de bouger de gauche à droite */
}



/* Force les cellules de texte très longues (comme les UUID ou descriptions) à passer à la ligne */
.table td, .table th {
    white-space: normal !important; /* Annule le blocage de ligne */
    word-break: break-word;        /* Coupe les mots trop longs si nécessaire */
}
/* Force l'affichage noir intense et gras sur le champ de code bloqué */
#cat_depense_code[readonly] {
    color: #000000 !important;
    font-weight: 700 !important;
    background-color: #ffffff !important; /* Conserve un fond blanc propre */
    border: 2px solid #cbd5e0;
}
/* --- FOOTER FIXE HAUT DE GAMME --- */
#app-fixed-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 38px;
    background-color: #1a202c !important; /* Anthracite sombre */
    border-top: 2px solid #bf953f; /* Ligne de séparation Or */
    z-index: 999; /* Reste toujours au-dessus du contenu */
    display: flex;
    align-items: center;
    font-size: 0.78rem;
    color: #a0aec0 !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
}

.footer-container-chic {
    width: 100%;
    padding: 0 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-logo-footer {
    font-weight: 700;
    color: #fbd561; /* Texte Jaune d'Or */
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.footer-separator {
    color: #4a5568;
}

.app-version {
    font-size: 0.72rem;
    background: #2d3748;
    padding: 2px 8px;
    border-radius: 4px;
    color: #cbd5e0;
}

.footer-center {
    font-weight: 500;
}

.footer-link-provider {
    color: #bf953f !important;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.footer-link-provider:hover {
    color: #fbd561 !important;
    text-decoration: underline;
}

/* 🌟 CRITIQUE ANTI-MASQUAGE : Ajoute un espace en bas de votre page de gestion 
   pour que le footer ne cache pas le bas de vos grilles ou formulaires */
body, #main-content, .page-section {
    padding-bottom: 45px !important;
}


/* ==========================================================================
   --- ADAPTATION PORTABLE (RESPONSIVE) ---
   ========================================================================== */

@media (max-width: 992px) {
    #sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); box-shadow: none; }
    #sidebar.open { transform: translateX(0); box-shadow: 5px 0 15px rgba(0,0,0,0.4); }

    #content { padding-top: 30px; }
    .content-header { margin: -30px -30px 30px -30px; padding: 20px; display: flex; width: auto; position: relative; }
    
    /* Configuration stricte de la Topbar de droite pour accueillir le burger */
    .topbar-right { display: flex !important; justify-content: flex-end; align-items: center; padding-right: 5px; }
    .menu-toggle { display: block; }
    .sidebar-overlay.active { display: block; }

    .menu-group { display: flex; flex-direction: column; padding: 5px 0; }
    #sidebar a { padding: 15px 25px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
    #sidebar a:hover, #sidebar a.active { background-color: rgba(255, 255, 255, 0.05); color: #ffffff; border-left: 4px solid #bf953f; padding-left: 21px; }
}

@media (max-width: 768px) {
    #content { padding: 15px; padding-top: 15px; }
    .content-header { margin: -15px -15px 20px -15px; padding: 15px; display: flex; flex-direction: row; justify-content: space-between; align-items: center; }
    
    .topbar-left h2 { font-size: 1.1rem; max-width: 180px; word-wrap: break-word; }
    .date-systeme { font-size: 0.8rem; }
    
    .topbar-right { padding-right: 1px; }
    .menu-toggle { padding: 6px 12px; font-size: 1.3rem; }

    .page-section { padding: 15px; }
    #sidebar a { padding: 12px 20px; font-size: 0.88rem; }
    #sidebar a:hover, #sidebar a.active { border-left: 3px solid #bf953f; padding-left: 17px; }

    input, select, textarea { width: 100%; font-size: 0.95rem; }
    .btn-gold-submit { width: 100%; padding: 12px; font-size: 0.9rem; }

    .table-container { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 15px; border: 1px solid #e2e8f0; }
    table { min-width: 600px; }
}
