/* ============================================================================================================
   FPCI ERP — feuille de style commune à tous les écrans (chargée par templates/base.html).

   1. Charte : les couleurs et dimensions de l'ERP sont des variables (« jetons ») définies une seule fois ci-dessous ;
      les écrans, les feuilles de style de module et les éditions PDF/Excel reprennent les mêmes teintes.
        - marine  #1a2744 : barre du haut, titres de saisie, bulle de l'assistant ;
        - turquoise #00b2c5 : accent de la charte (éditions PDF et Excel, pastilles, barres d'avancement) ;
        - turquoise foncé #007a89 : la couleur « primaire » des écrans (boutons, liens actifs, cases cochées, focus),
          assez foncée pour que le texte blanc reste lisible dessus ;
        - gris doux pour les fonds d'en-tête de tableau, filets et textes secondaires.
   2. Bootstrap 5.3 : seules ses variables sont redéfinies (pas de copie de ses règles), pour que tout ce qui est
      « primary » prenne la couleur de l'ERP.
   3. Gabarit (menu à deux colonnes, barre d'outils figée, en-têtes de tableau figés) : voir aussi static/base.js.
   4. Composants partagés entre plusieurs écrans, puis utilitaires de largeur nommés par l'écran qui les utilise.
   ============================================================================================================ */

/* ------------------------------------------------------------------ 1. Charte ------------------------------ */
:root {
    --erp-marine: #1a2744;
    --erp-marine-clair: #24366b;
    --erp-primaire: #007a89;
    --erp-primaire-fonce: #00616d;
    --erp-primaire-rgb: 0, 122, 137;
    --erp-accent: #00b2c5;
    --erp-accent-clair: #e6f6f8;
    --erp-accent-pale: #f3fafb;
    --erp-texte: #212529;
    --erp-texte-doux: #5b6472;
    --erp-texte-discret: #8a94a6;
    --erp-fond: #f4f6f6;
    --erp-fond-page: #fafbfb;
    --erp-filet: #dee2e6;
    --erp-filet-leger: #eef0f1;
    --erp-rayon: .6rem;
    --erp-ombre: 0 1px 2px rgba(16, 24, 40, .05);
    /* bandeau du haut : dégradé de turquoise, du plus profond (à gauche) au plus clair, assez foncé pour garder le texte blanc lisible */
    --erp-degrade: linear-gradient(100deg, #00434d 0%, #007a89 55%, #0098a8 100%);

    /* Bootstrap : « primary » devient le turquoise foncé de l'ERP, les liens aussi. */
    --bs-primary: var(--erp-primaire);
    --bs-primary-rgb: var(--erp-primaire-rgb);
    --bs-primary-text-emphasis: var(--erp-primaire-fonce);
    --bs-primary-bg-subtle: var(--erp-accent-clair);
    --bs-primary-border-subtle: #9fdde5;
    --bs-link-color: var(--erp-primaire);
    --bs-link-color-rgb: var(--erp-primaire-rgb);
    --bs-link-hover-color: var(--erp-primaire-fonce);
    --bs-link-hover-color-rgb: 0, 97, 109;
    --bs-focus-ring-color: rgba(var(--erp-primaire-rgb), .25);
    --bs-border-radius: .4rem;
    --bs-border-radius-sm: .3rem;
    --bs-border-radius-lg: var(--erp-rayon);

    /* hauteurs de la barre du haut et de la barre d'outils figée, mesurées par base.js */
    --decalage-entete-tableau: 3.5rem;
    --hauteur-navbar: 3.5rem;
    --hauteur-onglets-module: 0px;
}

/* ------------------------------------------------------------------ 2. Bootstrap aux couleurs de l'ERP ----- */
.btn-primary {
    --bs-btn-bg: var(--erp-primaire); --bs-btn-border-color: var(--erp-primaire);
    --bs-btn-hover-bg: var(--erp-primaire-fonce); --bs-btn-hover-border-color: var(--erp-primaire-fonce);
    --bs-btn-active-bg: var(--erp-primaire-fonce); --bs-btn-active-border-color: var(--erp-primaire-fonce);
    --bs-btn-disabled-bg: var(--erp-primaire); --bs-btn-disabled-border-color: var(--erp-primaire);
    --bs-btn-focus-shadow-rgb: var(--erp-primaire-rgb);
}
.btn-outline-primary {
    --bs-btn-color: var(--erp-primaire); --bs-btn-border-color: var(--erp-primaire);
    --bs-btn-hover-bg: var(--erp-primaire); --bs-btn-hover-border-color: var(--erp-primaire);
    --bs-btn-active-bg: var(--erp-primaire-fonce); --bs-btn-active-border-color: var(--erp-primaire-fonce);
    --bs-btn-disabled-color: var(--erp-primaire); --bs-btn-disabled-border-color: var(--erp-primaire);
    --bs-btn-focus-shadow-rgb: var(--erp-primaire-rgb);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #7fd3dc;
    box-shadow: 0 0 0 .25rem rgba(var(--erp-primaire-rgb), .2);
}
.form-check-input:checked { background-color: var(--erp-primaire); border-color: var(--erp-primaire); }
.form-range::-webkit-slider-thumb { background-color: var(--erp-primaire); }
.form-range::-moz-range-thumb { background-color: var(--erp-primaire); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--erp-primaire); }
.list-group {
    --bs-list-group-active-bg: var(--erp-accent-clair);
    --bs-list-group-active-border-color: var(--erp-accent-clair);
    --bs-list-group-active-color: var(--erp-primaire-fonce);
}
.list-group-item.active { font-weight: 600; box-shadow: inset 3px 0 0 var(--erp-accent); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--erp-primaire); }
.pagination {
    --bs-pagination-active-bg: var(--erp-primaire); --bs-pagination-active-border-color: var(--erp-primaire);
    --bs-pagination-color: var(--erp-primaire); --bs-pagination-hover-color: var(--erp-primaire-fonce);
}
.progress { --bs-progress-bar-bg: var(--erp-accent); }
.table-primary { --bs-table-bg: var(--erp-accent-clair); --bs-table-border-color: #cfe9ec; }
.form-check-input.case-carree { border-radius: .25em; }

/* ------------------------------------------------------------------ 3. Gabarit ----------------------------- */
body { padding-top: 3.5rem; font-size: .83rem; color: var(--erp-texte); background-color: var(--erp-fond-page); }
/* Les liens texte ne se distinguent pas du texte courant (ni couleur ni soulignement) : seuls les boutons gardent leur habillage. */
a { color: inherit; text-decoration: none; }

/* Titres : un seul ton pour tous les écrans (marine, demi-gras), quelle que soit la taille demandée par le gabarit. */
h1, .h1, h2, .h2, h3, .h3 { color: var(--erp-marine); font-weight: 600; letter-spacing: -.01em; }
h1.h4, h1.h5 { font-size: 1.2rem; }
h2.h6, h3.h6 { font-size: .95rem; }
h2 { font-size: 1.05rem; }
.card-title { color: var(--erp-marine); }

/* Barre du haut : dégradé de turquoise (plutôt que le noir de Bootstrap). */
nav.navbar.bg-dark { background-color: var(--erp-primaire) !important; background-image: var(--erp-degrade); }
nav.navbar .navbar-text, nav.navbar .text-white-50 { color: rgba(255, 255, 255, .85) !important; }
nav.navbar .form-control { border-color: rgba(255, 255, 255, .4); }
.navbar-brand { font-weight: 600; letter-spacing: .01em; }
.navbar-decalee { left: 170px; }

/* Colonne A (sélecteur de module) : fixe, sur toute la hauteur, logo compris. */
.module-switcher-global {
    width: 170px; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 20;
    display: flex; flex-direction: column;
    background-color: #fff; border-right: 1px solid var(--erp-filet); border-radius: 0 .75rem .75rem 0; padding: 0 .5rem .5rem;
}
/* L'en-tête (logo) a la hauteur de la barre du haut : les deux s'alignent. */
.module-switcher-entete {
    display: flex; align-items: center; gap: .5rem; height: 3.5rem; box-sizing: border-box;
    padding-left: .5rem; margin: 0 -.5rem .5rem; border-bottom: 1px solid var(--erp-filet);
}
.module-switcher-entete .navbar-brand { color: var(--erp-marine); }
/* La liste occupe toute la hauteur ; le dernier séparateur pousse le bloc final (Gestion, Paramètres, Schéma) en bas. */
.module-switcher-liste { flex: 1 0 auto; --bs-list-group-border-color: transparent; }
.module-switcher-liste .list-group-item { border-radius: .4rem !important; margin-bottom: 1px; padding: .45rem .75rem; color: var(--erp-texte); }
.module-switcher-liste .list-group-item:hover { background-color: var(--erp-fond); }
.module-switcher-liste hr { margin-top: auto; margin-bottom: .5rem; }
.module-switcher-liste hr.separation-bloc { margin-top: .5rem; }
.module-switcher-liste[data-module-actif="comptabilite"] a[data-module="comptabilite"],
.module-switcher-liste[data-module-actif="consultation"] a[data-module="consultation"],
.module-switcher-liste[data-module-actif="capitaux"] a[data-module="capitaux"],
.module-switcher-liste[data-module-actif="souscripteurs"] a[data-module="souscripteurs"],
.module-switcher-liste[data-module-actif="participation"] a[data-module="participation"],
.module-switcher-liste[data-module-actif="ratio"] a[data-module="ratio"],
.module-switcher-liste[data-module-actif="ilpa"] a[data-module="ilpa"],
.module-switcher-liste[data-module-actif="aifm"] a[data-module="aifm"],
.module-switcher-liste[data-module-actif="demande_ia"] a[data-module="demande_ia"],
.module-switcher-liste[data-module-actif="administration"] a[data-module="administration"],
.module-switcher-liste[data-module-actif="ged"] a[data-module="ged"],
.module-switcher-liste[data-module-actif="gestion"] a[data-module="gestion"],
.module-switcher-liste[data-module-actif="migration"] a[data-module="migration"],
.module-switcher-liste[data-module-actif="schema"] a[data-module="schema"],
.module-switcher-liste[data-module-actif="parametres_cabinet"] a[data-module="parametres_cabinet"] {
    background-color: var(--erp-accent-clair); color: var(--erp-primaire-fonce); font-weight: 600; box-shadow: inset 3px 0 0 var(--erp-accent);
}
/* Colonne B (écrans du module) : volet par-dessus le contenu, ou figé (épinglé) et le contenu lui laisse la place. */
.sous-menu-module {
    display: none; width: 210px; position: fixed; top: 3.5rem; left: 170px; max-height: calc(100vh - 3.5rem); overflow-y: auto; z-index: 19;
    background-color: #fff; border-radius: 0 .75rem .75rem 0; box-shadow: 4px 0 16px rgba(0, 0, 0, .12); padding-top: .5rem;
}
.sous-menu-module.ouvert { display: block; }
.erp-layout-shell > .flex-grow-1 { margin-left: 186px; }
.erp-layout-shell:has(.sous-menu-module.epingle) > .flex-grow-1 { margin-left: 412px; }
.sous-menu-module-liste .list-group-item { padding: .4rem .75rem; font-size: .85rem; }
.sous-menu-module-liste .small.text-uppercase {
    margin-top: .6rem !important; margin-bottom: .2rem !important; padding-left: .75rem;
    color: var(--erp-texte-discret) !important; letter-spacing: .04em; font-size: .68rem;
}
.sous-menu-module-liste .small.text-uppercase:first-child { margin-top: 0 !important; }
.sous-menu-module-liste .small.text-uppercase:not(:first-child) { border-top: 1px solid var(--erp-filet-leger); padding-top: .6rem; }

/* En-tête d'écran figé (titre, filtres, boutons) : reste visible en défilant, sous la barre du haut. base.js mesure sa hauteur
   et la reporte dans --decalage-entete-tableau pour que l'en-tête du tableau se cale juste en dessous. */
.toolbar-figee { position: sticky; top: calc(var(--hauteur-navbar) + var(--hauteur-onglets-module)); background-color: var(--erp-fond-page); z-index: 5; padding-top: .5rem; padding-bottom: .5rem; }
.toolbar-grand-livre { padding: .6rem .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--erp-filet); box-shadow: 0 .35rem .5rem -.35rem rgba(0, 0, 0, .18); }
/* En-têtes de tableau figés au défilement (balance, grand livre, journaux…). */
.table thead th { position: sticky; top: var(--decalage-entete-tableau); background-color: #fff; z-index: 1; }
.carte-compte-grand-livre .card-header { position: sticky; top: var(--decalage-entete-tableau); z-index: 2; background-color: var(--erp-fond); }
.carte-compte-grand-livre thead th { top: calc(var(--decalage-entete-tableau) + 2.5rem); }
/* Dans un cadre à défilement horizontal, un en-tête figé se calerait sur ce cadre et non sur l'écran : désactivé. */
.table-responsive .table thead th { position: static; }

/* Onglets de sous-modules en haut de page (construits par base.js depuis le menu de gauche) : figés sous la barre du haut, comme l'en-tête
   d'écran (.toolbar-figee) qui vient se caler juste en dessous (base.js mesure leur hauteur dans --hauteur-onglets-module). */
#onglets-module { position: sticky; top: var(--hauteur-navbar); z-index: 6; background-color: var(--erp-fond-page); padding-bottom: .75rem; }
.onglets-module-liste { flex-wrap: wrap; margin-bottom: 0; }
.onglets-module-liste .nav-link { padding: .35rem .7rem; font-size: .85rem; }
@media print { #onglets-module { display: none; } }

@media (max-width: 768px) {
    .navbar-decalee { left: 0; }
    .erp-layout-shell { flex-direction: column; }
    .module-switcher-global { width: 100% !important; height: auto !important; position: static !important; max-height: none !important; overflow: visible !important; }
    .sous-menu-module { width: 100% !important; position: static !important; max-height: none !important; overflow: visible !important; box-shadow: none !important; }
    .erp-layout-shell > .flex-grow-1 { margin-left: 0 !important; }
}

/* Menu des alertes, recherche de module, notifications (base.html). */
.menu-alertes { min-width: 320px; }
.menu-dossiers { min-width: 260px; max-height: 70vh; overflow-y: auto; }
.recherche-modules-conteneur { width: 240px; }
.recherche-modules-resultats { z-index: 1050; width: 100%; max-height: 320px; overflow-y: auto; }
.toast-conteneur { z-index: 1080; }

/* ------------------------------------------------------------------ 4. Composants partagés ----------------- */
/* Cartes : coins doux, en-tête gris clair en demi-gras. */
.card { --bs-card-border-color: var(--erp-filet); --bs-card-cap-bg: #f6f8f8; --bs-card-border-radius: var(--erp-rayon); --bs-card-inner-border-radius: calc(var(--erp-rayon) - 1px); }
.card-header { font-weight: 600; color: #2f3b45; }
.card-header .text-muted, .card-header .form-text, .card-header .fw-normal { font-weight: 400; }

/* Tableaux : en-têtes gris doux, lignes aérées. */
.table > thead th { font-weight: 600; color: var(--erp-texte-doux); background-color: var(--erp-fond); border-bottom-color: var(--erp-filet); }
.table > :not(caption) > * > * { border-bottom-color: var(--erp-filet-leger); }
table.table-etat td, table.table-etat th { padding: .35rem .5rem; }
.ligne-total { font-weight: 600; background-color: var(--erp-fond); }
.niveau-0 { padding-left: 0; }
.niveau-1 { padding-left: 1rem; }
.niveau-2 { padding-left: 2rem; }
.montant, .champ-nombre-fr { text-align: right; font-variant-numeric: tabular-nums; }

/* Onglets façon classeur Excel (éditions). */
.sheet-tabs { border-bottom: 2px solid var(--erp-filet); gap: 2px; }
.sheet-tabs .nav-link { border: 1px solid var(--erp-filet); border-bottom: none; border-radius: .5rem .5rem 0 0; background: #eceff0; color: var(--erp-texte-doux); font-weight: 500; padding: .5rem 1rem; }
.sheet-tabs .nav-link:hover { background: #e2e6e7; }
.sheet-tabs .nav-link.active { background: #fff; color: var(--erp-primaire-fonce); font-weight: 700; border-color: var(--erp-filet); box-shadow: 0 -2px 0 var(--erp-accent) inset; }
.sheet-content { border: 1px solid var(--erp-filet); border-top: none; background: #fff; padding: 1.5rem; border-radius: 0 0 .5rem .5rem; }

/* États financiers à l'écran. */
.table-etat-visuel { border-collapse: separate; border-spacing: 0; }
.table-etat-visuel td { padding: .5rem .75rem; border-bottom: 1px solid var(--erp-filet-leger); }
.table-etat-visuel tr.ligne-detail td { color: #495057; }
.table-etat-visuel tr.ligne-sous-total td { font-weight: 600; background-color: var(--erp-fond); border-top: 1px solid var(--erp-filet); }
.table-etat-visuel tr.ligne-grand-total td { font-weight: 700; font-size: 1.05rem; color: #fff; background-color: var(--erp-primaire); border-top: 2px solid var(--erp-primaire-fonce); }
.table-etat-visuel tr.ligne-grand-total td:first-child { border-radius: .375rem 0 0 .375rem; }
.table-etat-visuel tr.ligne-grand-total td:last-child { border-radius: 0 .375rem .375rem 0; }
.ligne-etat-toggle { cursor: pointer; }
.table-comptes-sous-categorie { background-color: #fafbfc; }
.table-comptes-sous-categorie td { padding: .4rem .75rem .4rem 1.5rem; border-bottom: 1px dashed var(--erp-filet-leger); font-size: .92em; color: #495057; }
.pmv-positive { color: #198754; font-weight: 600; }
.pmv-negative { color: #dc3545; font-weight: 600; }
/* Listes de flux (Transaction, Actif et passif éligible) : une ligne traitée ou validée reste neutre (le statut le dit déjà) ;
   seule une ligne qui attend une action est signalée, par un liseré orange et une teinte légère. */
tr.ligne-op-en-attente > td, tr.ligne-a-traiter > td { background-color: rgba(253, 126, 20, .07); }
tr.ligne-op-en-attente > td:first-child, tr.ligne-a-traiter > td:first-child { box-shadow: inset 3px 0 0 #fd7e14; }
.table-flux > tbody > tr > td { padding-top: .5rem; padding-bottom: .5rem; }
.table-flux > tbody > tr:hover > td { background-color: var(--erp-accent-pale); }
.flux-date { white-space: nowrap; color: var(--erp-texte-doux); font-variant-numeric: tabular-nums; }
.flux-banque { color: var(--erp-texte-doux); }
.flux-libelle { font-weight: 600; color: var(--erp-texte); }
.flux-libelle a:hover { color: var(--erp-primaire); text-decoration: underline; }
.flux-debit { color: #b3382c; font-weight: 600; }
.flux-credit { color: #146c43; font-weight: 600; }
.flux-source { color: var(--erp-texte-discret); font-size: .78rem; }
.flux-modifier summary { color: var(--erp-primaire); font-size: .8rem; list-style: none; display: inline-block; padding: .15rem .55rem; border: 1px solid #cfe3e6; border-radius: .4rem; }
.flux-modifier summary::-webkit-details-marker { display: none; }
.flux-modifier summary:hover { background: var(--erp-accent-clair); }
.flux-modifier[open] { text-align: left; }
.flux-modifier form { margin-top: .4rem; min-width: 14rem; }
.badge-traite { color: #146c43; background-color: #e2f3ea; border: 1px solid #bfe3cf; font-weight: 600; }
/* Même habillage que « Traité », en turquoise : la ligne a au moins une pièce jointe (GED). */
.badge-justificatif { color: var(--erp-primaire-fonce); background-color: var(--erp-accent-clair); border: 1px solid #9fdde5; font-weight: 600; margin-left: .25rem; }
/* En-têtes de colonnes triables (Transaction) : la flèche ne se voit nettement que sur la colonne de tri. */
.entete-triable { color: inherit; white-space: nowrap; }
.entete-triable .fleche-tri { font-size: .7em; margin-left: .2rem; color: #adb5bd; }
.entete-triable.actif .fleche-tri { color: var(--erp-primaire); }
.entete-triable:hover .fleche-tri { color: var(--erp-primaire-fonce); }

/* Cartes et tableaux « aux couleurs de l'ERP » : liste des mouvements, saisie d'un engagement, récapitulatif des journaux. */
.carte-erp, .carte-journaux { border: 1px solid var(--erp-filet); border-radius: var(--erp-rayon); background: #fff; box-shadow: var(--erp-ombre); overflow: hidden; }
.table-erp, .table-journaux { --bs-table-bg: transparent; }
.table-journaux { border-collapse: separate; border-spacing: 0; }
.table-erp thead th, .table-journaux thead th { background: var(--erp-fond); color: var(--erp-texte-doux); font-size: .8rem; font-weight: 600; padding: .65rem .6rem; border-bottom: 1px solid var(--erp-filet); white-space: nowrap; }
.table-journaux thead th:first-child { border-top-left-radius: var(--erp-rayon); }
.table-journaux thead th:last-child { border-top-right-radius: var(--erp-rayon); }
.table-erp tbody td, .table-journaux tbody td { padding: .55rem .6rem; border-bottom: 1px solid var(--erp-filet-leger); }
.table-erp tbody tr:last-child td, .table-journaux tbody tr:last-child td { border-bottom: 0; }
.table-erp tbody tr:hover td, .table-journaux tbody tr:hover td { background: var(--erp-accent-pale); }
.table-erp .colonne-gauche { padding-left: 1rem; }
.table-journaux .colonne-journal { min-width: 15rem; padding-left: 1rem; text-align: left; }
.table-journaux td + td { border-left: 1px solid var(--erp-filet-leger); }
.code-journal, .pastille-code { display: inline-block; min-width: 2rem; padding: .15rem .55rem; border-radius: .4rem; background: var(--erp-accent-clair); color: var(--erp-primaire-fonce); font-weight: 600; font-size: .82rem; text-align: center; letter-spacing: .02em; }
.code-journal { min-width: 3.2rem; }
.nombre-ecritures { display: inline-block; min-width: 2rem; padding: .1rem .5rem; border-radius: 999px; background: var(--erp-accent-clair); color: var(--erp-primaire-fonce); font-weight: 600; font-size: .85rem; text-decoration: none; }
.nombre-ecritures:hover { background: var(--erp-primaire); color: #fff; }
.mois-vide { color: #ced4da; }
.recap-engage { max-width: 28rem; }
.titre-saisie { background: var(--erp-marine); color: #fff; font-weight: 600; font-size: .85rem; padding: .6rem 1rem; }
.grille-saisie { width: 100%; min-width: 62rem; border-collapse: collapse; }
.grille-saisie thead th { background: var(--erp-fond); color: var(--erp-texte-doux); font-size: .75rem; font-weight: 600; padding: .6rem .6rem .45rem; border-bottom: 1px solid var(--erp-filet); white-space: nowrap; }
.grille-saisie thead th:first-child, .grille-saisie tbody td:first-child { padding-left: 1rem; }
.grille-saisie tbody td { padding: .7rem .6rem .5rem; vertical-align: top; }
.grille-saisie .colonne-a-venir { color: #9aa3b2; }
.grille-saisie input, .grille-saisie select { min-width: 6.5rem; }
.indice-saisie { font-size: .68rem; color: #7b8494; margin-top: .2rem; line-height: 1.2; }
.erreur-saisie { color: #dc3545; font-size: .72rem; }
.pied-saisie { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--erp-fond); border-top: 1px solid var(--erp-filet); }
.champ-a-completer { background-color: #e9ecef !important; }

/* Lignes qui ouvrent un détail au clic, lignes cochées. */
.ligne-ecriture, .curseur-pointeur, .edition-interet { cursor: pointer; }
.ligne-ecriture:focus-visible { outline: 2px solid var(--erp-primaire); outline-offset: -2px; }
.ligne-ecriture:hover td { background: var(--erp-accent-pale); }
/* Consultation d'un compte : un mouvement coché (lettrage, extourne, provision) est surligné en turquoise très clair. */
tr.ligne-selectionnee > td, tr.ligne-selectionnee > th { background-color: #e6f6f8; }
.bouton-edition-interet { text-decoration: none; line-height: 1; }
/* Grand tableau modifiable (aperçu des imports) : c'est la page qui défile, pas un cadre interne. */
.tableau-defilant { margin-bottom: 1rem; }
.hurdle-inactif { opacity: .45; }

/* Trombone des justificatifs : gris sans pièce, couleur de l'ERP dès qu'une pièce est liée. */
.trombone-justificatif { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; text-decoration: none; }
.trombone-justificatif svg, .btn-commentaire svg { width: 1.05em; height: 1.05em; fill: currentColor; }
.trombone-justificatif.trombone-non, .btn-commentaire.commentaire-non { color: #adb5bd; }
.trombone-justificatif.trombone-non:hover, .btn-commentaire.commentaire-non:hover { color: #6c757d; }
.trombone-justificatif.trombone-oui { color: var(--erp-primaire); font-weight: 600; }
.trombone-justificatif.trombone-oui:hover { color: var(--erp-primaire-fonce); }
/* Bulle de commentaire d'un mouvement : grise sans commentaire, orange avec. */
.btn-commentaire { display: inline-flex; align-items: center; vertical-align: middle; padding: 0 2px; border: 0; background: none; cursor: pointer; }
.btn-commentaire.commentaire-oui { color: #e8590c; }
.btn-commentaire.commentaire-oui:hover { color: #c2410c; }
/* Dépôt de fichiers par glisser-déposer sur une ligne (transaction.html). */
.depot-message { min-height: 1.4rem; margin-bottom: .5rem; font-size: .9rem; font-weight: 500; }
.depot-message.ok { color: #146c43; }
.depot-message.erreur { color: #b3382c; }
tr.depot-cible > td { background-color: var(--erp-accent-clair) !important; box-shadow: inset 0 2px 0 var(--erp-primaire), inset 0 -2px 0 var(--erp-primaire); }
tr.depot-en-cours { opacity: .55; pointer-events: none; }

/* Page d'accueil : cartes de raccourci vers chaque module. */
.carte-accueil-module { width: 12rem; border-radius: var(--erp-rayon); transition: transform .12s ease, box-shadow .12s ease; }
.accueil-modules { max-width: 68rem; margin-left: auto; margin-right: auto; }
/* Page de présentation d'une édition (Consultation & Édition) : reprend la page de garde turquoise des PDF. */
.page-de-garde-ecran { border-top: 4px solid var(--erp-primaire); }
.page-de-garde-ecran .page-de-garde-denomination { color: var(--erp-primaire); font-weight: 700; }
.accueil-modules .carte-accueil-module .small { line-height: 1.25; }
.carte-accueil-module:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(16, 24, 40, .1) !important; }
.accueil-salutation { color: var(--erp-texte-doux); }

/* Tableau de bord Comptabilité : indicateurs et graphiques. */
.carte-indicateur, .carte-graphique { background: #fff; border: 1px solid var(--erp-filet); border-radius: var(--erp-rayon); box-shadow: var(--erp-ombre); }
.carte-indicateur { padding: 1.5rem 1.75rem; }
.carte-indicateur .libelle { font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--erp-texte-doux); }
.carte-indicateur .valeur { font-size: 2.3rem; font-weight: 700; color: var(--erp-primaire); }
.carte-graphique { padding: 1rem 1.25rem; }
.carte-graphique .titre-graphique { font-size: .8rem; font-weight: 700; letter-spacing: .02em; color: #495057; }
.conteneur-graphique { position: relative; height: 260px; }

/* Récapitulatif par type de parts : cadran « appelé / engagé ». */
.donut { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; background: conic-gradient(var(--erp-primaire) var(--part, 0%), #e9ecef 0); }
.donut-trou { width: 62px; height: 62px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; color: var(--erp-texte); }

/* TFAM : tableau serré, première colonne figée. */
.tfam-table th, .tfam-table td { padding: .15rem .3rem; font-size: .74rem; }
.tfam-table th { white-space: normal; line-height: 1.1; vertical-align: middle; }
.tfam-table input.form-control { padding: .1rem .3rem; font-size: .74rem; width: 5.8rem; min-width: 5.8rem; }
.tfam-ligne .tfam-periode { position: sticky; left: 0; background: var(--bs-body-bg, #fff); z-index: 1; min-width: 8.5rem; }

/* Choix d'un dossier : tri des colonnes, lien discret vers le dossier. */
#table-dossiers thead th[data-sort-key] { cursor: pointer; user-select: none; }
#table-dossiers .tri-indicateur { font-size: .7em; color: #6c757d; }
#table-dossiers .lien-dossier, .lien-souscripteur { color: inherit; text-decoration: none; font: inherit; cursor: pointer; }
#table-dossiers .lien-dossier:hover, #table-dossiers .lien-dossier:focus, .lien-souscripteur:hover, .lien-souscripteur:focus { color: inherit; text-decoration: none; }

/* Page Migration : cascade verticale d'étapes numérotées, avancement par partie et pour l'ensemble. */
.migration-avancement { border-left: 4px solid var(--erp-accent); }
.migration-avancement.est-complete { border-left-color: #198754; }
.migration-avancement .progress { height: .6rem; }
.migration-avancement.est-complete .progress-bar { background-color: #198754; }
.migration-cascade { list-style: none; padding-left: 0; margin: 0; position: relative; }
.migration-cascade::before { content: ""; position: absolute; left: 23px; top: 24px; bottom: 24px; width: 2px; background: #cfe9ec; }
.migration-section { position: relative; display: flex; gap: 1rem; margin-bottom: 1.25rem; }
.migration-pastille { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; font-weight: 700; color: #fff; background: var(--erp-accent); box-shadow: 0 0 0 4px var(--erp-fond-page); }
.migration-section.est-complete .migration-pastille { background: #198754; }
.migration-corps { flex: 1 1 auto; min-width: 0; }
.migration-corps > .card-header { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.migration-corps .titre-section { font-size: 1.05rem; font-weight: 600; margin: 0; }
.migration-corps .resume-section { color: var(--erp-texte-doux); margin: .15rem 0 0; font-weight: 400; }
.migration-etapes td { vertical-align: middle; }
.migration-etapes .libelle-etape { font-weight: 600; }
.migration-etapes .resume-etape { color: var(--erp-texte-doux); }
.statut-etape { display: inline-block; min-width: 6.5rem; text-align: center; }
.migration-option { height: 100%; }
.migration-option .titre-option { font-weight: 600; margin-bottom: .35rem; }
.migration-aide summary { cursor: pointer; color: var(--erp-primaire); }
.migration-aide summary:focus-visible { outline: 2px solid var(--erp-accent); outline-offset: 2px; }
.migration-aide p { font-size: .875rem; color: var(--erp-texte-doux); margin: .4rem 0 0; }
@media (max-width: 576px) {
    .migration-cascade::before { left: 17px; }
    .migration-pastille { flex-basis: 36px; width: 36px; height: 36px; font-size: 1rem; }
    .migration-section { gap: .6rem; }
}

/* Aperçu de l'import du portefeuille : bandeau d'un groupe de titres (reconnu / à corriger), lignes de total. */
.bloc-groupe-ok { background-color: var(--erp-accent-clair); border-left: 5px solid var(--erp-accent); }
.bloc-groupe-ko { background-color: #f8d7da; border-left: 5px solid #dc3545; }
tr.ligne-total-accent { --bs-table-bg: var(--erp-accent-clair); border-top: 2px solid var(--erp-accent); }
tr.ligne-accent-pale { --bs-table-bg: var(--erp-accent-pale); }

/* Pages d'erreur (templates/erreur_base.html). */
.page-erreur { max-width: 40rem; }

/* ------------------------------------------------------------------ 5. Utilitaires de largeur ------------- */
/* Nommés par leur dimension ; l'écran qui s'en sert est indiqué quand il est unique. */
.recherche-filtre { max-width: 320px; }           /* filtre texte en en-tête d'écran */
.colonne-case-a-cocher { width: 30px; }           /* case « tout sélectionner » */
.colonne-40 { width: 40px; }
.colonne-70 { width: 70px; }
.colonne-80 { width: 80px; }
.colonne-90 { width: 90px; }
.colonne-110 { width: 110px; }
.colonne-120 { width: 120px; }
.colonne-160 { width: 160px; }
.colonne-170 { width: 170px; }
.colonne-280 { width: 280px; }
.colonne-montant-140 { width: 140px; }            /* saisie d'écriture : Débit / Crédit */
/* saisie d'écriture : Compte plus étroit (30 %), le Libellé prend la place restante. Mise en page fixe : sans elle, la liste des
   comptes s'élargit jusqu'au plus long intitulé et ignore la largeur demandée. */
.table-saisie-ecriture { table-layout: fixed; }
.colonne-actions-provision { width: 1%; white-space: nowrap; }  /* Provision / CCA : date d'extourne + bouton, toujours alignés */
.colonne-compte-saisie { width: 30%; }
.colonne-cca-130 { width: 130px; }                /* ecriture_modifier.html */
.colonne-suppr-70 { width: 70px; }
.colonne-lettrage { white-space: nowrap; }
.bloc-solde { min-width: 140px; }
.champ-110 { width: 110px; }
.champ-date-150 { width: 150px; }
.cellule-max-150 { max-width: 150px; }
.cellule-max-160 { max-width: 160px; }
.form-max-420 { max-width: 420px; }
.form-max-480 { max-width: 480px; }
.form-max-520 { max-width: 520px; }
.form-max-560 { max-width: 560px; }
.form-max-720 { max-width: 720px; }
.form-max-760 { max-width: 760px; }
.form-max-900 { max-width: 900px; }
.card-max-620 { max-width: 620px; }
.alert-max-640 { max-width: 640px; }
.texte-max-62 { max-width: 62rem; }
.liste-scroll-180 { max-height: 180px; overflow-y: auto; }
.liste-scroll-220 { max-height: 220px; overflow-y: auto; }
.liste-comptes-scroll { max-height: 75vh; overflow-y: auto; }
.texte-preserve { white-space: pre-wrap; }
.largeur-auto { width: auto; }

/* Page de garde des éditions affichée en onglet (voir _page_de_garde.html et base.js) */
.masque-par-garde { display: none !important; }

/* Grand livre : mêmes largeurs de colonnes pour chaque compte (les tableaux sont séparés, un par compte) */
.table-grand-livre { table-layout: fixed; }
.table-grand-livre col.gl-date { width: 7.5rem; }
.table-grand-livre col.gl-journal { width: 6rem; }
.table-grand-livre col.gl-piece { width: 7rem; }
.table-grand-livre col.gl-montant { width: 10rem; }
.table-grand-livre td { overflow-wrap: anywhere; }

/* Filtres et tris par colonne (static/table_filtres.js, tableaux .table-filtrable) — version compacte : icône à côté du nom, 01/12/2026 */
.th-avec-filtre { white-space: nowrap; }
.bouton-filtre-colonne { border: 0; background: transparent; color: #9aa3b2; padding: 0 .15rem; margin-left: .2rem; line-height: 1; font-size: .85rem; vertical-align: baseline; border-radius: .2rem; cursor: pointer; }
.bouton-filtre-colonne svg { width: .7rem; height: .7rem; vertical-align: -.05rem; }
.bouton-filtre-colonne:hover { color: #1a2744; background: #e9eef6; }
.bouton-filtre-colonne:focus-visible { outline: 2px solid #00b2c5; outline-offset: 1px; }
.bouton-filtre-colonne.actif { color: #fff; background: #00b2c5; }
.bulle-filtre-colonne { position: absolute; z-index: 1080; min-width: 12rem; max-width: 18rem; background: #fff; border: 1px solid #d5dbe5; border-radius: .35rem; box-shadow: 0 .4rem 1rem rgba(26, 39, 68, .15); padding: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.bulle-filtre-colonne[hidden] { display: none; }
.bulle-filtre-titre { font-size: .75rem; font-weight: 600; color: #5b6475; }
.bulle-filtre-colonne .btn-link { align-self: flex-start; font-size: .8rem; }
.barre-filtres { margin: 0 0 .35rem .1rem; }

/* Fenêtre « Ajouter un souscripteur » : blocs Identité / Naissance / Coordonnées / Engagement et rattrapage (01/12/2026) */
.form-ajout-souscripteur .bloc-ajout-souscripteur { border: 1px solid #e3e8ef; border-radius: .4rem; padding: .55rem .8rem .7rem; margin-bottom: .75rem; background: #fff; }
.form-ajout-souscripteur .bloc-ajout-souscripteur legend { float: none; width: auto; font-size: .8rem; font-weight: 600; color: #1a2744; padding: 0 .35rem; margin: 0 0 .1rem -.35rem; }
.form-ajout-souscripteur .bloc-ajout-souscripteur .row + .row { margin-top: .35rem; }
.form-ajout-souscripteur .form-label { font-size: .78rem; color: #5b6475; margin-bottom: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.form-ajout-souscripteur .form-text { font-size: .72rem; margin-top: .1rem; }
.form-ajout-souscripteur .bloc-engagement { background: #f6f9fc; }

/* Pages de connexion et de mot de passe oublié (P8, 01/12/2026) : logo du cabinet et champs de l'assistant de connexion. */
.logo-connexion { max-height: 72px; max-width: 220px; object-fit: contain; }
.champ-connexion input:not([type=hidden]):not([type=checkbox]) {
    display: block; width: 100%; padding: .375rem .75rem; font-size: 1rem;
    border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); background: var(--bs-body-bg); color: var(--bs-body-color);
}
.champ-connexion input:focus { outline: 0; border-color: #86b7fe; box-shadow: 0 0 0 .25rem rgba(13,110,253,.25); }

/* Paramètres Cabinet › Accès utilisateurs › Droits par rôle (P10, 02/12/2026) */
.tableau-droits .colonne-role { width: 7.5rem; white-space: nowrap; }
.tableau-droits .ligne-module-droits th { background: var(--bs-tertiary-bg); font-weight: 600; padding-top: .6rem; }
.tableau-droits td { position: relative; }
.pastille-droit-modifie { display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: #fd7e14; vertical-align: middle; margin-left: .2rem; }
