/* Fichier : css/recap.css (Version Compacte & Verrouillée 50/50) */

.header-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.header-section h3 {
    margin: 0;
}

.header-section #print-recap-btn {
    flex-shrink: 0;
}

.badge-ajustements {
    background: #e9ecef;
    color: #495057;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 700;
    border: 1px solid #ced4da;
    letter-spacing: 0.3px;
}

.solde-initial-container {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    display: grid;
    grid-template-columns: minmax(140px, auto) 120px auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #dee2e6;
}

.solde-initial-container label {
    white-space: nowrap;
    text-align: left;
}

.solde-initial-container input {
    padding: 6px 8px;
    font-size: 0.95rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 100%;
    text-align: right;
    color: #0056b3;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.solde-initial-container .currency {
    text-align: left;
    color: #6c757d;
    font-weight: 500;
}

/* Grille des KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-card {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
    border-top: 3px solid #ddd;
}

.kpi-card h4 {
    margin: 0 0 5px 0;
    color: #6c757d;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card p {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Couleurs spécifiques */
.kpi-card.entree { border-top-color: #28a745; }
.kpi-card.sortie { border-top-color: #dc3545; }
.kpi-card.net { border-top-color: #6610f2; }
.kpi-card.activite { border-top-color: #fd7e14; }
.kpi-card.probable { border-top-color: #17a2b8; opacity: 0.8; }

.kpi-card.final.highlight { 
    background-color: #0056b3; 
    color: white; 
    border-top: none;
}
.kpi-card.final.highlight h4 { color: #dbe4f0; }
.kpi-card.final.highlight p { color: white; }


/* --- GRAPHIQUES (Partie Corrigée) --- */

.charts-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 50px;
    /* CHANGE 1 : On force le conteneur à prendre toute la largeur disponible */
    width: 100%;
}

/* La carte globale */
.chart-card {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    
    /* Taille compacte */
    height: 550px;  /* Augmenté pour accueillir canvas + table résumé */
    
    /* --- CHANGE 2 : LE VERROUILLAGE 50/50 --- */
    flex: 1;       /* Signifie "Partagez l'espace équitablement" */
    width: 0;      /* CRUCIAL : Force le navigateur à ignorer la largeur du contenu (canvas) pour le calcul */
    min-width: 0;  /* Sécurité supplémentaire pour Flexbox */

    /* Alignement interne */
    display: flex;
    flex-direction: column; 
    overflow: hidden; 
}

/* Le titre ne doit pas bouger */
.chart-card h4 {
    margin-bottom: 10px;
    flex-shrink: 0; 
}

/* --- LE NOUVEAU CONTENEUR (C'est lui qui sauve la mise) --- */
.graph-container {
    position: relative;
    flex-grow: 1;       /* Il prend toute la place qui reste sous le titre */
    min-height: 0;      /* Permet au conteneur de rétrécir sans bloquer */
    width: 100%;
}

/* Le dessin suit exactement la taille de son conteneur */
.graph-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Note : J'ai supprimé le bloc ".chart-card canvas" qui était tout en bas 
   de votre fichier car il entrait en conflit avec ".graph-container canvas" */