/* Compléments propres à l'application. Les fichiers de charte (charte/) ne sont jamais modifiés. */
body { background: var(--amp-fond); font-family: var(--amp-police-app); }
.amp-sidebar { width: 232px; position: sticky; top: 0; height: 100vh; }
.amp-sidebar .nav-link { padding: var(--amp-esp-2) var(--amp-esp-4); }
.contenu { padding: var(--amp-esp-5) var(--amp-esp-6); min-width: 0; }
h1 { font-size: 28px; margin-bottom: var(--amp-esp-4); }
h2 { font-size: 22px; }
h3 { font-size: 18px; font-weight: 600; }
.texte-secondaire { color: var(--amp-texte-secondaire); font-size: 14px; }
.montant { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-sm td, .table-sm th { padding: var(--amp-esp-1) var(--amp-esp-2); }
.table thead th { white-space: nowrap; }
.carte-cle dt { font-weight: 600; color: var(--amp-texte-secondaire); font-size: 13px; }
.carte-cle dd { margin-bottom: var(--amp-esp-2); }

/* Pastilles d'état (charte § 3.4) */
.etat { display: inline-block; padding: 2px var(--amp-esp-2); border-radius: var(--amp-rayon-badge); font-size: 12px; font-weight: 600; }
.etat-ok { background: var(--amp-succes-fond); color: var(--amp-succes); }
.etat-attention { background: var(--amp-alerte-fond); color: var(--amp-orange-tres-fonce); }
.etat-retard { background: var(--amp-danger-fond); color: var(--amp-danger); }
.etat-info { background: var(--amp-info-fond); color: var(--amp-info); }
/* TVA comptabilisée mais pas encore acceptée sur jedeclare : orange clair (le vert est réservé à l'acceptation) */
/* Déclaration acceptée par la DGFiP avec alertes (ARS « ANOMALIE » dans jedeclare) : vert olive */
.etat-alertes { background: #F1F6DC; color: #5B6B0B; box-shadow: inset 0 0 0 1px #C9D77A; }
.etat-comptabilise { background: var(--amp-orange-50); color: var(--amp-orange-700); box-shadow: inset 0 0 0 1px var(--amp-orange-300); }
.etat-neutre { background: var(--amp-neutre-fond); color: var(--amp-neutre); }

/* Tableau du classeur */
.rubrique-ligne > td { cursor: pointer; }
.rubrique-ligne.sens-D .sens { color: var(--amp-info); }
.detail-comptes td { background: var(--amp-marine-50); font-size: 13px; }
.grille td.vide { color: var(--amp-marine-300); }
.solde-negatif { color: var(--amp-danger); }
.code-dlc { width: 96px; }

/* Liste des dossiers : colonne Nom réduite, texte complet au survol */
.table-dossiers { font-size: 13px; }
.table-dossiers .col-nom { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lien-montant { text-decoration: none; color: inherit; }
.lien-montant:hover { text-decoration: underline; color: var(--amp-bleu); }

/* Carte de chaleur des contrôles */
.carte-chaleur td, .carte-chaleur th { padding: 2px 3px; font-size: 12px; }
.carte-chaleur .etat { font-size: 11px; padding: 2px 4px; white-space: nowrap; text-decoration: none; }
.carte-chaleur .mois-choisi { background: var(--amp-marine-50); }
.carte-chaleur thead a { text-decoration: none; }
.histogramme td { height: 84px; vertical-align: bottom; }
.barre-volume { width: 70%; margin: 0 auto; min-height: 1px; background: var(--amp-marine); border-radius: 3px 3px 0 0; }
.barre-volume.anormale { background: var(--amp-orange); }

/* Workflow : justification repliée */
.justification summary { list-style: none; }
.justification summary::-webkit-details-marker { display: none; }
.justification[open] summary { margin-bottom: var(--amp-esp-1); }
.justification form { min-width: 260px; }

/* Déclarations : barres empilées */
.barre-declarations { height: 18px; font-size: 11px; }

/* Menu de gauche : logo agrandi (titre dessous), repliable en colonne d'icônes */
.amp-sidebar { position: sticky; transition: width .15s ease; }
.amp-sidebar .logo-menu { width: 132px; height: auto; padding: 6px; }
.amp-sidebar .titre-menu { font-size: 17px; letter-spacing: .02em; }
.bouton-menu { position: absolute; top: 8px; right: 8px; z-index: 2; border: 0; background: transparent;
  color: rgba(255, 255, 255, .65); padding: 4px 6px; border-radius: 4px; }
.bouton-menu:hover, .bouton-menu:focus-visible { color: #fff; background: rgba(255, 255, 255, .12); }
html.menu-replie .amp-sidebar { width: 64px; }
html.menu-replie .amp-sidebar .libelle, html.menu-replie .amp-sidebar .titre-menu { display: none !important; }
html.menu-replie .amp-sidebar .logo-menu { width: 40px; padding: 3px; margin-top: 26px; }
html.menu-replie .amp-sidebar .entete-menu { padding-left: 4px !important; padding-right: 4px !important; }
html.menu-replie .amp-sidebar .nav-link { text-align: center; padding-left: 0; padding-right: 0; }
html.menu-replie .amp-sidebar .nav-link i { margin-right: 0 !important; }
html.menu-replie .amp-sidebar .bouton-menu { right: 50%; transform: translateX(50%) rotate(180deg); }
html.menu-replie .amp-sidebar .mt-auto { padding-left: 8px !important; padding-right: 8px !important; }

/* Tableaux triables et filtrables */
table.table-tri thead th.triable { cursor: pointer; user-select: none; }
table.table-tri thead th.triable::after { content: " \2195"; color: var(--amp-marine-300); font-size: 11px; }
table.table-tri thead th[aria-sort="ascending"]::after { content: " \25B2"; color: var(--amp-marine); }
table.table-tri thead th[aria-sort="descending"]::after { content: " \25BC"; color: var(--amp-marine); }
table.table-tri .ligne-filtres th { padding-top: 2px; padding-bottom: 4px; font-weight: normal; }
table.table-tri .ligne-filtres input:not([type="checkbox"]) { min-width: 56px; font-size: 12px; padding: 1px 4px; }
.filtre-liste .form-check { padding-left: 1.4em; min-height: 0; line-height: 1.6; cursor: pointer; }
.filtre-liste .form-check-input { width: 14px; height: 14px; min-width: 0; margin-top: .2em; margin-left: -1.4em; padding: 0; }

/* Message d'erreur des actions (refus, erreur serveur) */
.message-flottant { position: fixed; top: 16px; right: 16px; z-index: 1080; max-width: 520px; }

/* Liste des dossiers : défilement dans le cadre (barre horizontale toujours visible en bas de l'écran),
   en-têtes figés en haut, colonnes Code et Nom figées à gauche */
.conteneur-fige { max-height: calc(100vh - 150px); overflow: auto; }
.conteneur-fige thead { position: sticky; top: 0; z-index: 3; }
.conteneur-fige thead th { background: var(--amp-marine-50); }
.conteneur-fige th:nth-child(1), .conteneur-fige td:nth-child(1) {
  position: sticky; left: 0; z-index: 2; width: 64px; min-width: 64px; max-width: 64px; }
.conteneur-fige th:nth-child(2), .conteneur-fige td:nth-child(2) {
  position: sticky; left: 64px; z-index: 2; box-shadow: 2px 0 0 var(--amp-bordure); }
.conteneur-fige tbody td:nth-child(1), .conteneur-fige tbody td:nth-child(2) { background: var(--amp-blanc); }
.conteneur-fige thead th:nth-child(1), .conteneur-fige thead th:nth-child(2) { z-index: 4; }
/* Tous les autres tableaux de dossiers : même principe, posé par app.js d'après les en-têtes (« Code » + « Nom »
   : deux colonnes figées ; « Dossier » : une colonne figée, code et nom dans la même case) */
.conteneur-fige-auto { max-height: calc(100vh - 150px); overflow: auto; }
.conteneur-fige-auto thead { position: sticky; top: 0; z-index: 3; }
.conteneur-fige-auto thead th { background: var(--amp-marine-50); }
.fige-1 th:nth-child(1), .fige-1 td:nth-child(1),
.fige-2 th:nth-child(1), .fige-2 td:nth-child(1),
.fige-2 th:nth-child(2), .fige-2 td:nth-child(2) { position: sticky; z-index: 2; }
.fige-1 th:nth-child(1), .fige-1 td:nth-child(1), .fige-2 th:nth-child(1), .fige-2 td:nth-child(1) { left: 0; }
.fige-2 th:nth-child(2), .fige-2 td:nth-child(2) { left: var(--fige-l1, 64px); }
.fige-1 th:nth-child(1), .fige-1 td:nth-child(1), .fige-2 th:nth-child(2), .fige-2 td:nth-child(2) {
  max-width: 300px; box-shadow: 2px 0 0 var(--amp-bordure); }
.fige-1 tbody td:nth-child(1), .fige-2 tbody td:nth-child(1), .fige-2 tbody td:nth-child(2) { background: var(--amp-blanc); }
.fige-1 thead th:nth-child(1), .fige-2 thead th:nth-child(1), .fige-2 thead th:nth-child(2) { z-index: 4; }
/* Ligne traitée (vert) ou en erreur (rouge) : les colonnes figées prennent la couleur de la ligne au lieu du blanc. */
.fige-1 tbody tr.ligne-traitee > td, .fige-2 tbody tr.ligne-traitee > td, .conteneur-fige tbody tr.ligne-traitee > td { background: var(--amp-succes-fond, #eef7f0); }
.fige-1 tbody tr.table-danger > td, .fige-2 tbody tr.table-danger > td, .conteneur-fige tbody tr.table-danger > td { background: var(--bs-danger-bg-subtle); }
.fige-1 tbody td[colspan], .fige-2 tbody td[colspan] { position: static; box-shadow: none; max-width: none; }
/* Prérévisions à faire : la liste des points restants doit rester lisible */
.col-points-restants { min-width: 280px; }
.bouton-copier { line-height: 1; color: var(--amp-marine-500); }
.bouton-copier.copie { color: var(--amp-succes); }

/* Vue annuelle de la TVA : cases compactes */
.tableau-annuel td .etat { font-size: 11px; padding: 2px 4px; white-space: nowrap; }

/* Entretiens PF : fond de la carte selon la pastille (vert clair dans la cible, rouge clair en alerte) */
.carte-pf.carte-ok { background-color: #EAF4EA; border-color: #A5D6A7; }
.carte-pf.carte-retard { background-color: #FBE9E7; border-color: #EF9A9A; }
.carte-pf .table { --bs-table-bg: transparent; }
