:root {
    /* Plus large que le .container Bootstrap (~1320px) : meilleure utilisation des grands écrans */
    --visufec-content-max: min(1920px, 98vw);
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

.container {
    margin-top: 40px;
    background: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: var(--visufec-content-max);
    margin-left: auto;
    margin-right: auto;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-note {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 10px 0;
    font-size: 1.2em;
    color: #666;
}

.header-note img {
    margin-right: 8px;
}

.header-note p {
    margin: 0;
}

.heart {
    color: #e63946;
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 20px;
    margin: 0;
    align-items: center;
    justify-content: center;
}

nav ul li {
    display: inline;
}

nav ul li a {
    text-decoration: none;
    padding: 10px 20px;
    color: #007bff;
    border: 1px solid #007bff;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

nav ul li a:hover {
    background-color: #007bff;
    color: white;
}

.file-input-container {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

.custom-file-label {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    color: white;
    background-color: #007bff;
    border: 1px solid #007bff;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.custom-file-label i {
    margin-right: 5px;
}

.custom-file-input {
    display: none;
}

.custom-file-label:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.filter-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-top: 20px;
    margin-bottom: 15px;
    width: 100%;
}

.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    width: 100%;
    max-width: var(--visufec-content-max);
    margin: 0 auto;
}

.filter-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Résultat net : bandeau sous les filtres (toujours visible, y compris hors vue mensuelle) */
.resultat-net-standalone {
    display: none;
    width: 100%;
    max-width: var(--visufec-content-max);
    margin: 12px auto 16px;
    padding: 14px 22px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    background: linear-gradient(180deg, #e7f1ff 0%, #d8e9fc 100%);
    border: 2px solid #0d6efd;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(13, 110, 253, 0.18);
}

.resultat-net-standalone-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 10px 18px;
    text-align: center;
}

.resultat-net-standalone-label {
    font-size: 1.05rem;
    font-weight: 600;
    color: #052c65;
}

.resultat-net-standalone-amount {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #084298;
}

.resultat-net-standalone-amount.resultat-benefice {
    color: #0f5132;
}

.resultat-net-standalone-amount.resultat-perte {
    color: #842029;
}

table .merged-401411-row {
    background-color: #fff8e6 !important;
    font-weight: 500;
}

table .merged-401411-row td {
    border-color: #e6d4a8 !important;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: #495057;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.filter-checkbox-coloriage {
    border: 2px solid #0d6efd;
    background: linear-gradient(135deg, #e7f3ff 0%, #fff 55%);
    box-shadow: 0 1px 6px rgba(13, 110, 253, 0.15);
}
.filter-checkbox-coloriage:hover {
    border-color: #0a58ca;
    background: linear-gradient(135deg, #d3e7fd 0%, #fff 55%);
}

.filter-checkbox:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filter-checkbox span {
    user-select: none;
}

.button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 12px 15px;
    margin-top: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Les boutons peuvent se répartir sur plusieurs lignes sans dépasser du cadre */
.button-container > .btn {
    flex: 0 1 auto;
    max-width: 100%;
    white-space: normal;
    text-align: center;
}

.btn {
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background-color: #007bff;
    border: 1px solid #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background-color: #28a745;
    border: 1px solid #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn-secondary {
    background-color: #6c757d;
    border: 1px solid #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-info {
    background-color: #17a2b8;
    border: 1px solid #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

.btn-danger {
    background-color: #dc3545;
    border: 1px solid #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.table-responsive {
    margin-top: 20px;
}

.table th,
.table td {
    text-align: right;
}

.table th:nth-child(1),
.table td:nth-child(1),
.table th:nth-child(2),
.table td:nth-child(2) {
    text-align: left;
}

.notice,
.security-message {
    padding: 10px;
    text-align: center;
    margin-top: 20px;
    border-radius: 5px;
}

.notice {
    border: 2px solid #e63946;
    background-color: #ffebeb;
    color: #e63946;
}

.security-message {
    border: 2px solid #c3e6cb;
    background-color: #e9f7ef;
    color: #155724;
}

footer {
    margin-top: 20px;
    padding: 10px 0;
    background-color: #f8f9fa;
    text-align: center;
    color: #333;
    border-top: 1px solid #ddd;
}

/* Styles pour les lignes de totaux */
.subtotal-row td {
    font-weight: bold !important;
    background-color: #e9ecef !important;
    border-top: 2px solid #6c757d !important;
    border-bottom: 2px solid #6c757d !important;
}

.grand-total-row td {
    font-weight: bold !important;
    background-color: #343a40 !important;
    color: white !important;
    font-size: 1.1em;
    padding: 12px 8px !important;
}

.actif-passif-row td {
    font-weight: bold !important;
    font-size: 1.05em;
    padding: 10px 8px !important;
}

.separator-row {
    height: 10px;
    background-color: transparent;
}

/* Améliorer l'affichage des tableaux */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table tbody tr:hover:not(.subtotal-row):not(.grand-total-row):not(.actif-passif-row):not(.separator-row) {
    background-color: #f0f8ff;
}

/* Responsive */
@media (max-width: 768px) {
    .button-container {
        gap: 10px 12px;
    }

    .button-container > .btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 140px;
    }
}

/* ==============================================
   STYLES V2 - NOUVELLES FONCTIONNALITÉS
   ============================================== */

/* Contrôles V2 */
.v2-controls {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
}

.v2-filters {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
}

.filter-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
}

.filter-group label i {
    margin-right: 5px;
    color: #007bff;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 0.95em;
    transition: border-color 0.3s ease;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Section de résumé */
.summary-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 20px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.summary-section h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
}

.summary-section h3 i {
    margin-right: 8px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: white;
}

/* Styles pour le regroupement de comptes */
.account-group {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.account-group:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
}

.account-group td {
    padding: 12px 8px !important;
    font-weight: 600;
}

.toggle-icon {
    display: inline-block;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.account-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.group-totals {
    background-color: #e3f2fd !important;
    font-weight: 600;
}

.group-totals td {
    padding: 10px 8px !important;
    border-top: 2px solid #2196f3;
    border-bottom: 2px solid #2196f3;
}

.account-detail {
    background-color: #fafafa;
    transition: background-color 0.2s ease;
}

.account-detail:hover {
    background-color: #f0f8ff !important;
}

.account-detail.hidden {
    display: none;
}

/* Montants cliquables */
.amount {
    cursor: pointer;
    transition: all 0.2s ease;
}

.amount:hover {
    background-color: #fff3cd !important;
    font-weight: 600;
}

.amount.positive {
    color: #28a745;
}

.amount.negative {
    color: #dc3545;
}

/* Modal de détails (ancien plein écran — ne pas appliquer aux modales Bootstrap .fade) */
.modal:not(.fade) {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

/* Bootstrap 5 : au-dessus du backdrop (1050), fond laissé au .modal-backdrop — sinon fermeture / clics impossibles */
.modal.fade {
    z-index: 1055;
    background: transparent;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal:not(.fade) .modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 1200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal:not(.fade) .modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal:not(.fade) .modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.close:hover {
    color: #f8f9fa;
    transform: scale(1.1);
}

.modal:not(.fade) .modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.detail-summary {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.detail-summary h3 {
    margin-bottom: 15px;
    color: #1976d2;
    font-size: 1.2em;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.detail-stat {
    background: white;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.detail-stat-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-stat-value {
    font-size: 1.4em;
    font-weight: 700;
    color: #2c3e50;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.detail-table thead {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
}

.detail-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
}

.detail-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.detail-table tbody tr:hover {
    background-color: #f8f9fa;
}

.detail-table td {
    padding: 10px 8px;
}

.detail-table .amount-col {
    text-align: right;
    font-weight: 600;
}

/* Responsive pour les contrôles V2 */
@media (max-width: 768px) {
    .v2-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .modal:not(.fade) .modal-content {
        width: 95%;
        margin: 2% auto;
    }
    
    .modal:not(.fade) .modal-body {
        padding: 15px;
    }
    
    .detail-stats {
        grid-template-columns: 1fr;
    }
}

/* ==============================================
   STYLES POUR LA VUE MENSUELLE
   ============================================== */

/* Mode pleine largeur pour la vue mensuelle */
body.monthly-view-active {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

body.monthly-view-active .container {
    max-width: none !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: white;
}

/* Masquer TOUS les éléments sauf le tableau */
body.monthly-view-active .header-container,
body.monthly-view-active h1,
body.monthly-view-active .file-input-container,
body.monthly-view-active .progress,
body.monthly-view-active .button-container,
body.monthly-view-active .filter-container,
body.monthly-view-active .notice,
body.monthly-view-active .security-message,
body.monthly-view-active footer,
/* Uniquement dans .container : ne pas cibler la modale (body > .modal > .table-responsive) */
body.monthly-view-active .container .table-responsive:not(#tableContainer) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Modales : tableau toujours visible (sécurité si autre règle interfère) */
body.monthly-view-active .modal .table-responsive {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: 120px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

body.monthly-view-active #tableContainer {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    position: fixed;
    top: 0;
    left: 0;
    background: white;
    z-index: 9999;
    overflow: auto;
}

/* Bandeau résultat net (hors vue mensuelle le JS met display:flex) : masqué en plein écran mensuel */
body.monthly-view-active #resultatNetBarWrap,
body.monthly-view-active .resultat-net-standalone {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: none !important;
    box-shadow: none !important;
}

/* Modale « détail du mois » au-dessus du plein écran mensuel */
body.monthly-view-active .modal {
    z-index: 100500 !important;
}
body.monthly-view-active .modal-backdrop {
    z-index: 100400 !important;
}

.monthly-table {
    width: 100%;
    display: table;
    border-collapse: collapse;
    font-size: 0.85em;
}

body.monthly-view-active .monthly-table {
    width: max-content;
    min-width: 100%;
}

.monthly-table thead,
.monthly-table tbody {
    display: table-row-group;
}

.monthly-table tr {
    display: table-row;
}

.monthly-table th,
.monthly-table td {
    display: table-cell;
    min-width: 85px;
    max-width: 100px;
    padding: 5px 3px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid #dee2e6;
    font-size: 0.9em;
}

body.monthly-view-active .monthly-table th,
body.monthly-view-active .monthly-table td {
    padding: 6px 4px;
}

.monthly-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 12;
    background-color: #fff;
    min-width: 80px;
    max-width: 90px;
    padding: 5px 6px !important;
    text-align: left;
    border-right: 1px solid #dee2e6 !important;
    font-weight: 500;
    box-shadow: none;
}

.monthly-table .sticky-col-2 {
    position: sticky;
    left: 80px;
    z-index: 12;
    background-color: #fff;
    min-width: 180px;
    max-width: 250px;
    padding: 5px 8px !important;
    text-align: left;
    border-right: 1px solid #dee2e6 !important;
    box-shadow: none;
}

.monthly-table thead .sticky-col,
.monthly-table thead .sticky-col-2 {
    background: #e9ecef !important;
    color: #212529 !important;
    font-size: 0.85em;
    z-index: 13;
    border-right: 1px solid #ced4da !important;
    box-shadow: none !important;
}

.monthly-table thead .total-col {
    background: #e9ecef !important;
    color: #212529 !important;
    z-index: 13;
}

.monthly-table .group-totals .sticky-col,
.monthly-table .group-totals .sticky-col-2 {
    background-color: #f1f3f5 !important;
    border-right: 1px solid #ced4da;
}

.monthly-table .account-group .sticky-col,
.monthly-table .account-group .sticky-col-2 {
    background: #dee2e6 !important;
    color: #212529;
}

.monthly-table .account-detail .sticky-col {
    background-color: #fafafa !important;
}

.monthly-table .account-detail .sticky-col-2 {
    background-color: #fafafa !important;
}

.monthly-table .account-detail:hover .sticky-col,
.monthly-table .account-detail:hover .sticky-col-2 {
    background-color: #f0f8ff !important;
}

.monthly-table .month-header {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    text-align: center;
    min-width: 90px;
    max-width: 120px;
    font-size: 0.8em;
    border-bottom: 2px solid #dee2e6;
}

.monthly-table .total-col {
    background-color: #f8f9fa !important;
    font-weight: 600;
    border-left: 1px solid #adb5bd !important;
    min-width: 100px;
    max-width: 120px;
    padding: 5px 6px !important;
    position: sticky;
    right: 0;
    z-index: 11;
    box-shadow: none;
}

.monthly-table .account-num {
    cursor: pointer;
    color: #0d6efd;
    font-weight: 500;
}

.monthly-table .account-num:hover {
    text-decoration: underline;
    background-color: #f1f3f5;
}

.monthly-table .monthly-amount {
    cursor: pointer;
}

.monthly-table .monthly-amount:hover {
    background-color: #e9ecef !important;
    outline: 1px solid #adb5bd;
}

.monthly-table .group-header-cell {
    background: #e9ecef;
    color: #212529;
    padding: 8px 10px;
    font-weight: 600;
    border-bottom: 1px solid #ced4da;
}

/* Scroll horizontal amélioré */
.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

/* Amélioration de l'affichage des montants dans la vue mensuelle */
.monthly-table .amount.positive {
    color: #198754;
}

.monthly-table .amount.negative {
    color: #dc3545;
}

.monthly-table .account-group {
    cursor: pointer;
}

.monthly-table .account-group:hover .group-header-cell {
    background: #dee2e6;
}

.monthly-table .account-detail {
    background-color: #fff;
}

.monthly-table .account-detail:hover {
    background-color: #f8f9fa !important;
}

.monthly-view-font-scope {
    --monthly-view-font-family: Verdana, Geneva, "DejaVu Sans", sans-serif;
}

.monthly-view-font-scope .monthly-view-header,
.monthly-view-font-scope .monthly-table {
    font-family: var(--monthly-view-font-family) !important;
}

.monthly-view-font-scope .monthly-table th,
.monthly-view-font-scope .monthly-table td {
    font-size: 0.95em;
    -webkit-font-smoothing: antialiased;
}

.monthly-view-font-toolbar {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 10px !important;
    margin: -4px 0 4px 0 !important;
}

.monthly-font-select {
    max-width: min(100%, 340px);
    min-width: 200px;
}

.monthly-view-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    color: #212529;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px 16px;
    border-bottom: 1px solid #dee2e6;
    width: 100%;
}

/* Filtre classes 6 / 7 — bien visible sous le fil d’Ariane */
.monthly-view-only67-panel {
    border: 2px solid #0d6efd;
    border-radius: 12px;
    background: linear-gradient(160deg, #e7f1ff 0%, #f0f7ff 45%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.12);
    padding: 12px 14px;
}

.monthly-view-only67-panel-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
}

.monthly-view-only67-icon {
    flex: 0 0 auto;
    font-size: 1.85rem;
    line-height: 1;
    color: #0d6efd;
}

.monthly-view-only67-copy {
    flex: 1 1 200px;
    min-width: 0;
}

.monthly-view-only67-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: #052c65;
    margin-bottom: 2px;
}

.monthly-view-only67-desc {
    display: block;
    font-size: 0.8rem;
    color: #495057;
    line-height: 1.35;
}

.monthly-view-only67-switch {
    flex: 0 0 auto;
    padding-left: 2.75rem;
}

.monthly-view-only67-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    margin-top: 0.15rem;
    cursor: pointer;
}

.monthly-view-only67-switch-label {
    cursor: pointer;
    font-size: 0.95rem;
    color: #052c65;
    padding-top: 2px;
    max-width: 11rem;
    line-height: 1.25;
}

.monthly-view-only67-panel:has(#monthlyOnly67Cb:checked) {
    border-color: #198754;
    background: linear-gradient(160deg, #d1e7dd 0%, #e8f5ee 50%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(25, 135, 84, 0.15);
}

.monthly-view-only67-panel:has(#monthlyOnly67Cb:checked) .monthly-view-only67-icon {
    color: #198754;
}

.monthly-view-resultat-net {
    flex: 1 1 200px;
    text-align: center;
    padding: 6px 12px;
    background: #e7f1ff;
    border: 1px solid #0d6efd;
    border-radius: 8px;
    font-size: 0.95rem;
}

.monthly-view-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.monthly-view-actions {
    display: flex;
    gap: 8px;
}

.monthly-view-actions button {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    background: #fff;
    color: #495057;
}

.monthly-view-actions button:hover {
    background: #f8f9fa;
}

.monthly-view-actions .btn-back {
    border-color: #6c757d;
}

/* Modal détail vue mensuelle */
.monthly-detail-table-wrap {
    max-height: min(70vh, 600px);
    overflow: auto;
}

.monthly-detail-table {
    font-size: 0.8rem;
}

.monthly-detail-modal .modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 0.65rem 1rem;
}

/* Modale extraction FEC : tableau occupe tout l’espace sous l’en-tête */
.monthly-fec-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
    min-height: 50vh;
}

.monthly-fec-extract-modal .modal-body.monthly-fec-modal-body {
    max-height: none !important;
    flex: 1 1 auto !important;
    min-height: 280px !important;
}

.monthly-fec-table-scroll {
    flex: 1 1 auto;
    min-height: 320px;
    max-height: none;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
}

.monthly-fec-extract-table {
    font-size: 0.72rem;
    min-width: 1680px;
}

.monthly-fec-extract-table th,
.monthly-fec-extract-table td {
    white-space: nowrap;
}

.monthly-fec-extract-table td {
    white-space: normal;
    word-break: break-word;
    max-width: 12rem;
}

.monthly-fec-extract-table th.text-end,
.monthly-fec-extract-table td.text-end {
    white-space: nowrap;
    max-width: none;
}

body.monthly-view-active .monthly-fec-modal-root .modal-dialog {
    z-index: 100600;
}

/* Modale « écritures du mois » : corps toujours visible (évite hauteur 0) */
.monthly-account-month-dialog {
    max-width: min(1100px, 96vw);
    z-index: 100600;
}

.monthly-account-month-modal .modal-body.monthly-account-month-body,
.monthly-fec-modal-root .monthly-ecritures-modal-body {
    max-height: calc(100vh - 120px) !important;
    min-height: 220px !important;
    overflow-y: auto !important;
    padding: 1.25rem !important;
    background: #fff !important;
    color: #212529 !important;
}

.monthly-ecritures-cards {
    max-height: min(68vh, 620px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.monthly-ecriture-card {
    font-size: 0.95rem;
}

body.monthly-view-active .monthly-fec-modal-root.show,
body.monthly-view-active .monthly-fec-modal-root .modal-content {
    color: #212529;
}

/* Scroll optimisé pour le mode pleine largeur */
body.monthly-view-active #tableContainer::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

body.monthly-view-active #tableContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
}

body.monthly-view-active #tableContainer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

body.monthly-view-active #tableContainer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.monthly-table thead th {
    position: sticky;
    top: 0;
    z-index: 11;
    background: #e9ecef;
    color: #212529;
}

body.monthly-view-active .monthly-table thead th {
    top: 52px;
}

.monthly-table tbody tr:nth-child(even):not(.account-group):not(.group-totals) {
    background-color: #f8f9fa;
}

.monthly-table tbody tr:nth-child(odd):not(.account-group):not(.group-totals) {
    background-color: #ffffff;
}

/* Responsive pour la vue mensuelle */
@media (max-width: 768px) {
    .monthly-table .sticky-col {
        min-width: 70px;
        max-width: 70px;
        font-size: 0.75em;
    }
    
    .monthly-table .sticky-col-2 {
        left: 70px;
        min-width: 120px;
        max-width: 150px;
        font-size: 0.75em;
    }
    
    .monthly-table th,
    .monthly-table td {
        min-width: 80px;
        max-width: 100px;
        padding: 4px 2px;
        font-size: 0.75em;
    }
}

/* Fil d’Ariane commun (modules ouverts depuis Visu-FEC) */
nav.visufec-breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

nav.visufec-breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

nav.visufec-breadcrumb li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #6c757d;
}

nav.visufec-breadcrumb li:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    color: #adb5bd;
    font-weight: 400;
}

nav.visufec-breadcrumb a {
    color: #0d6efd;
    text-decoration: none;
}

nav.visufec-breadcrumb a:hover {
    text-decoration: underline;
}

nav.visufec-breadcrumb li[aria-current="page"] {
    color: #212529;
    font-weight: 600;
}

/* Vue mensuelle — détail mois : tableau compact */
.monthly-ecritures-table-wrap {
    overflow: auto;
    max-height: min(62vh, 560px);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

table.monthly-ecritures-compact-table {
    width: 100%;
    font-size: 0.78rem;
    border-collapse: collapse;
    margin: 0;
}

table.monthly-ecritures-compact-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #e9ecef;
    color: #212529;
    border-bottom: 2px solid #ced4da;
    padding: 0.35rem 0.45rem;
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
}

table.monthly-ecritures-compact-table tbody td {
    padding: 0.28rem 0.45rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

table.monthly-ecritures-compact-table tbody td.num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

table.monthly-ecritures-compact-table tbody tr:last-child td {
    border-bottom: none;
}

/* Vue carte — débit / crédit côte à côte */
.monthly-card-db-cr {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.75rem;
    align-items: flex-start;
}

.monthly-card-db-cr-col {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 6.5rem;
    padding-right: 1.25rem;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.monthly-card-db-cr-col:last-child {
    padding-right: 0;
    border-right: none;
}

.monthly-card-db-cr-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6c757d;
}

.monthly-card-db-cr-val {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: #212529;
}