/* MBS — styles de la page */
:root {
  --fond: #f2f4f8;
  --carte: #ffffff;
  --trait: #e3e7ee;
  --trait-fort: #cfd5df;
  --texte: #1f2430;
  --discret: #667085;
  --accent: #2459d6;
  --accent-sombre: #1b47b0;
  --accent-fond: #e7eefc;
  --accent-fort: #d5e2fa;
  --accent-leger: #f4f7fd;
  --fond-doux: #f7f8fb;
  --ok: #1a7f4b;
  --ok-fond: #e6f5ec;
  --refus: #b42318;
  --refus-fond: #fdecea;
  --alerte: #8a5a00;
  --alerte-fond: #fff4d6;
  --neutre-fond: #eef0f4;
  --sortie-fond: #fdf1ef;
  --entree-fond: #edf7f1;
  /* bandeau */
  --nuit: #131c31;
  --nuit-texte: #c3cbdb;
  --nuit-discret: #8b96ad;
  --rayon: 8px;
  --ombre: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --ombre-haute: 0 12px 32px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 13px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-fort); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Bandeau : nom, onglets, fichier ouvert, utilisateur, sur une seule ligne. Il reste en haut de la fenêtre ;
   --tete (sa hauteur) est posé par la page. */
.tete-fixe { position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(16, 24, 40, .16); }

.haut {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 48px;
  padding: 0 20px;
  background: var(--nuit);
  color: var(--nuit-texte);
}
.haut h1 { display: flex; align-items: baseline; gap: 7px; margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .04em; color: #fff; white-space: nowrap; }
.haut h1::before { content: ""; align-self: center; width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, #6ea8ff 0 50%, #4fd39a 50% 100%); }
.version { font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--nuit-discret); }
.haut #etat-dossier { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-size: 12px; color: var(--nuit-discret); }
.haut button.lien, .haut button.lien:disabled { flex: none; font-size: 12px; color: var(--nuit-texte); white-space: nowrap; }

/* Onglets : une pastille de couleur rappelle le rôle (bleu : Dashboard ; jaune : alimenter ; vert : Transactions) */
.onglets { display: flex; flex: none; gap: 2px; align-self: stretch; align-items: stretch; }
.onglets button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 0;
  padding: 0 13px;
  background: none;
  box-shadow: inset 0 -3px 0 transparent;
  color: var(--nuit-texte);
  white-space: nowrap;
  --teinte: #aab4c8;
}
.onglets button[data-couleur="bleu"] { --teinte: #6ea8ff; }
.onglets button[data-couleur="jaune"] { --teinte: #f5c451; }
.onglets button[data-couleur="vert"] { --teinte: #4fd39a; }
.onglets button[data-couleur="gris"] { --teinte: #8b95a8; }
.onglets button[data-couleur="rouge"] { --teinte: #ff6b6b; }
.onglets button[data-couleur]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--teinte); }
.onglets button:hover:not(:disabled) { background: rgba(255, 255, 255, .06); color: #fff; }
.onglets button.actif, .onglets button.actif:hover:not(:disabled) { background: rgba(255, 255, 255, .1); box-shadow: inset 0 -5px 0 var(--teinte); color: #fff; font-weight: 600; }
.onglets button:focus-visible { outline-offset: -2px; outline-color: #fff; }
/* Compteur « à classer » : le texte complet reste dans la page (lecteurs d'écran, essais), seule la pastille se voit */
.onglets .compteur { font-size: 0; }
.onglets .compteur::before { content: attr(data-nb); display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 9px; background: #f5c451; color: #3a2a00; font-size: 11px; font-weight: 700; text-align: center; }

main { max-width: 1560px; margin: 0 auto; padding: 18px 20px 48px; }

.carte {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: 12px;
  box-shadow: var(--ombre);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.carte h2 { margin: 0 0 12px; font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.titre-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.titre-ligne h2 { margin: 0; }

button {
  font: inherit;
  padding: 5px 12px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--rayon);
  background: var(--carte);
  color: var(--texte);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-leger); }
button:disabled { opacity: .5; cursor: default; }
button.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.principal:hover:not(:disabled) { background: var(--accent-sombre); border-color: var(--accent-sombre); }
button.lien { border: 0; padding: 0; background: none; color: var(--accent); }
button.lien:hover:not(:disabled) { background: none; text-decoration: underline; }
button.lien:disabled { opacity: 1; color: var(--discret); text-decoration: none; }
button.icone { border: 0; padding: 0 4px; background: none; color: var(--discret); }
button.icone:hover:not(:disabled) { background: none; color: var(--accent); }

input[type="text"], input[type="search"], input[type="password"], select {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--rayon);
  background: #fff;
  color: var(--texte);
}
input[type="text"]:focus, input[type="search"]:focus, input[type="password"]:focus, input[type="date"]:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input::placeholder { color: #9aa3b2; }
input[type="checkbox"] { accent-color: var(--accent); }

.discret { color: var(--discret); }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ligne + .ligne { margin-top: 8px; }

/* Barres de défilement fines */
* { scrollbar-width: thin; scrollbar-color: #c3c9d4 transparent; }

/* Messages */
.message {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  margin-bottom: 12px;
  border-left: 4px solid var(--discret);
  border-radius: var(--rayon);
  background: var(--carte);
  box-shadow: var(--ombre);
}
.message.erreur { background: var(--refus-fond); border-left-color: var(--refus); color: var(--refus); }
.message.alerte { background: var(--alerte-fond); border-left-color: #e0a100; color: var(--alerte); }
.message .actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Dépôt des PDF */
.depot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 18px;
  border: 2px dashed var(--trait-fort);
  border-radius: 12px;
  background: var(--fond-doux);
  transition: background .12s, border-color .12s;
  text-align: center;
  color: var(--discret);
}
.depot p { margin: 0; }
.depot.survol { border-color: var(--accent); background: var(--accent-fond); color: var(--accent); }
.progression { margin: 10px 0 0; color: var(--discret); }

/* Rapports d'import */
.barre-rapports { display: flex; justify-content: flex-end; margin-top: 10px; }
.rapport {
  margin-top: 10px;
  border: 1px solid var(--trait);
  border-left-width: 4px;
  border-radius: var(--rayon);
  padding: 8px 12px;
}
.rapport.ok { border-left-color: var(--ok); }
.rapport.rien { border-left-color: var(--discret); }
.rapport.refuse { border-left-color: var(--refus); }
.rapport .tete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.rapport .fichier { font-weight: 600; }
.verdict { margin-left: auto; padding: 1px 8px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.rapport.ok .verdict { background: var(--ok-fond); color: var(--ok); }
.rapport.rien .verdict { background: var(--neutre-fond); color: var(--discret); }
.rapport.refuse .verdict { background: var(--refus-fond); color: var(--refus); }
.rapport .resume { margin: 4px 0 0; }
.rapport .raison { margin: 4px 0 0; color: var(--refus); font-weight: 600; }
.rapport details { margin-top: 4px; }
.rapport summary { cursor: pointer; color: var(--discret); }
.controles { list-style: none; margin: 6px 0 2px; padding: 0; }
.controles li { padding: 2px 0 2px 22px; position: relative; }
.controles li::before { position: absolute; left: 2px; font-weight: 700; }
.controles li.ok::before { content: "✓"; color: var(--ok); }
.controles li.echec::before { content: "✗"; color: var(--refus); }
.controles li.saute::before { content: "–"; color: var(--discret); }
.controles li.echec { color: var(--refus); }
.controles li.saute { color: var(--discret); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
th { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--discret); white-space: nowrap; }
tbody tr:hover { background: var(--fond-doux); }
/* En-têtes collés sous le bandeau ; le trait du bas est une ombre, une bordure ne suit pas une cellule collée. */
thead th { position: sticky; top: calc(var(--tete, 0px) + var(--barre, 0px)); z-index: 5; background: var(--carte); border-bottom: 0; box-shadow: inset 0 -1px 0 var(--trait); }
thead tr.titres th { height: 30px; padding-bottom: 2px; box-shadow: none; }
thead tr.filtres th { top: calc(var(--tete, 0px) + var(--barre, 0px) + 30px); padding-top: 0; }
button.tri { border: 0; padding: 0; background: none; font-size: inherit; font-weight: 600; letter-spacing: inherit; text-transform: inherit; color: var(--discret); }
button.tri:hover:not(:disabled) { background: none; color: var(--accent); }
.filtre-colonne { width: 100%; min-width: 48px; padding: 2px 6px; font: inherit; font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; border: 1px solid var(--trait); border-radius: 6px; background: var(--fond-doux); }
.filtre-colonne:focus { background: #fff; }
.filtre-colonne:not(:placeholder-shown) { border-color: var(--accent); background: var(--accent-leger); }
.filtre-colonne.invalide { border-color: var(--refus); background: var(--refus-fond); }
th.nombre .filtre-colonne { text-align: right; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.fixe { white-space: nowrap; }
td.neg { color: var(--refus); }
/* Texte de toute la ligne : rouge pour une sortie, vert pour une entrée. Le solde du compte garde sa propre couleur. */
tbody tr.ligne-sortie td, tbody tr.ligne-sortie td .commentaire { color: var(--refus); }
tbody tr.ligne-entree td, tbody tr.ligne-entree td .commentaire { color: var(--ok); }
tbody tr.ligne-sortie td.solde, tbody tr.ligne-entree td.solde { color: var(--texte); }
tbody tr.ligne-sortie td.solde.neg, tbody tr.ligne-entree td.solde.neg { color: var(--refus); }
/* Ligne à classer : fond rouge clair pour une sortie, vert clair pour une entrée */
tbody tr.a-classer-neg { background: var(--sortie-fond); }
tbody tr.a-classer-pos { background: var(--entree-fond); }
tbody tr.cliquable { cursor: pointer; }
tbody tr.cliquable:hover { background: var(--accent-leger); }
tbody tr.a-classer-neg:hover { background: #fbe6e2; }
tbody tr.a-classer-pos:hover { background: #e0f1e7; }
tbody tr.selectionne { background: var(--accent-fond); }
tbody tr.choisi { background: var(--accent-fond); }
/* Cases à cocher des grilles, barre de sélection, boutons de fin de ligne */
th.selection, td.selection { width: 28px; padding-right: 0; }
th.selection input, td.selection input { margin: 2px 0 0; cursor: pointer; }
.barre-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.barre-selection .nb-selection { color: var(--discret); }
button.danger { border-color: var(--refus); color: var(--refus); }
button.danger:hover:not(:disabled) { background: var(--refus-fond); border-color: var(--refus); }
button.danger:disabled { border-color: var(--trait); color: var(--discret); }
td.actions button.icone { padding: 1px 7px; font-size: 15px; }
td.actions button.supprimer:hover { color: var(--refus); }
/* Icône « effacer les filtres », au bout de la ligne des filtres */
thead tr.filtres th button.effacer-filtres { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 4px; color: var(--accent); }
thead tr.filtres th button.effacer-filtres:hover:not(:disabled) { background: var(--accent-fond); }
thead tr.filtres th button.effacer-filtres:disabled { color: var(--discret); opacity: .45; }
tr.detail td { background: var(--fond-doux); }
.detail-grille { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); gap: 16px; }
.detail-grille pre { margin: 0; font: 12px/1.5 Consolas, monospace; white-space: pre-wrap; }
.detail-grille dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; }
.detail-grille dt { color: var(--discret); }
.detail-grille dd { margin: 0; overflow-wrap: anywhere; }
.vide { padding: 14px 0 4px; color: var(--discret); }

/* Catégories, commentaires, mots-clés */
.compte-lignes { margin: 0 0 6px; color: var(--discret); }
/* Titre d'une carte de grille : le compteur de lignes à côté du titre */
.titre-compte { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.titre-compte h2 { margin: 0; }
.titre-compte .compte-lignes { margin: 0; white-space: nowrap; }
/* Haut d'une grille, collé sous le bandeau ; les en-têtes du tableau se collent dessous (--barre, posé par la page) */
.barre-grille { position: sticky; top: var(--tete, 0px); z-index: 6; background: var(--carte); padding-bottom: 8px; }
.barre-grille > :last-child { margin-bottom: 0; }
/* Numéro de ligne */
th.rang, td.rang { width: 1%; }
th.manuelle, td.manuelle { width: 1%; text-align: center; }
tbody tr td.rang, tbody tr.ligne-sortie td.rang, tbody tr.ligne-entree td.rang { color: var(--discret); }
/* Filtre d'une colonne par cases à cocher (Compte, Catégorie) : même hauteur que les champs de filtre */
thead tr.filtres th details.filtre-choix summary { padding: 2px 6px; border-radius: 6px; font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; border-color: var(--trait); background: var(--fond-doux); color: var(--texte); overflow: hidden; text-overflow: ellipsis; }
thead tr.filtres th details.filtre-choix .panneau { font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--texte); text-align: left; }
thead tr.filtres th details.filtre-choix .panneau .filtre-colonne { margin-bottom: 6px; text-align: left; }
details.choix .panneau label[hidden] { display: none; }
thead tr.filtres th:nth-last-child(-n+2) details.filtre-choix .panneau { left: auto; right: 0; }
/* Dates du 1 au 15 en gras : la coupure du mois se voit */
td.date.debut-mois { font-weight: 700; }
/* Regroupement : bouton dans l'en-tête, rangée d'en-tête de chaque groupe */
button.grouper { margin-left: 4px; font-size: 13px; letter-spacing: 0; }
button.grouper.actif { color: var(--accent); background: var(--accent-fond); border-radius: 4px; }
tbody tr.groupe { cursor: pointer; }
tbody tr.groupe td { background: var(--neutre-fond); font-weight: 600; }
tbody tr.groupe:hover td { background: var(--accent-fond); }
.groupe-ligne { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.groupe-ligne .fleche { width: 12px; color: var(--discret); }
.groupe-ligne .nom { min-width: 180px; }
.groupe-ligne .chiffre { color: var(--discret); font-variant-numeric: tabular-nums; white-space: nowrap; }
.groupe-ligne .chiffre .pos { color: var(--ok); }
.groupe-ligne .chiffre .neg { color: var(--refus); }
td.categorie { white-space: nowrap; }
td.categorie { position: relative; }
td.categorie select.choix-categorie { position: absolute; z-index: 1; }
button.cat, span.cat { border: 0; padding: 2px 10px; border-radius: 999px; background: var(--neutre-fond); color: var(--texte); font-size: 12px; font-weight: 500; }
span.cat { display: inline-block; font-weight: 600; }
/* Couleur d'une catégorie : une pastille de la couleur choisie, le code écrit dedans, la flèche ouvre le choix de couleur */
.nuancier { display: inline-flex; align-items: stretch; height: 26px; border: 1px solid var(--trait-fort); border-radius: var(--rayon); background: #fff; color: var(--texte); overflow: hidden; vertical-align: middle; }
.nuancier:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.nuancier .pipette { position: relative; display: flex; align-items: center; justify-content: center; width: 24px; border-right: 1px solid rgba(0, 0, 0, .14); cursor: pointer; }
.nuancier .pipette::before { content: "▾"; font-size: 12px; }
.nuancier .pipette:hover { background: rgba(0, 0, 0, .08); }
.nuancier .pipette input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.nuancier input.hexa { width: 72px; margin: 0; padding: 0 6px; border: 0; border-radius: 0; outline: 0; background: transparent; color: inherit; font: 12px Consolas, monospace; }
.nuancier input.hexa::placeholder { color: #9aa3b2; }
.nuancier input.hexa.invalide { background: var(--refus-fond); color: var(--refus); }
td.couleur .erreur-champ { margin-top: 2px; font-size: 12px; color: var(--refus); white-space: normal; max-width: 220px; }
td.couleur button.icone { margin-left: 4px; }
button.cat:hover:not(:disabled) { outline: 2px solid var(--accent); outline-offset: 0; }
button.cat.manuelle, button.cat.manuelle:hover { background: var(--accent-fond); color: var(--accent); }
button.cat:not(.manuelle):not(.aucune):not(.plusieurs):not(.sans-categorie):hover { background: var(--neutre-fond); }
button.cat.interne { color: var(--discret); }
/* à classer : même pastille jaune, que ce soit d'office ou par choix manuel (le crayon distingue le choix manuel) */
button.cat.aucune, button.cat.plusieurs, button.cat.sans-categorie, button.cat.aucune:hover, button.cat.plusieurs:hover, button.cat.sans-categorie:hover { background: var(--alerte-fond); color: var(--alerte); font-weight: 600; }
.commentaire { margin-top: 2px; font-style: italic; color: var(--discret); }
.libelle-commentaire { display: block; margin-top: 10px; color: var(--discret); }
.champ-commentaire { display: block; width: 100%; margin-top: 3px; }
td.mots { line-height: 2; }
.mot button.priorite { color: var(--discret); opacity: 0.55; }
.mot button.priorite:hover, .mot.prioritaire button.priorite { color: #b7791f; opacity: 1; }
.mot.prioritaire { background: #fdf3d7; }
.mot .texte-mot { cursor: pointer; }
.mot .texte-mot:hover, .mot .texte-mot:focus-visible { text-decoration: underline; }
dialog.mot-cle { min-width: 460px; }
dialog.mot-cle .condition { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
dialog.mot-cle .condition select { width: auto; flex: none; }
dialog.mot-cle #dlg-ajouter-condition { display: block; margin: 8px 0 4px; }
dialog.mot-cle .condition.montant { margin-top: 0; }
dialog.mot-cle .condition.montant input { width: 110px; flex: none; text-align: right; }
.mot { display: inline-block; margin-right: 6px; padding: 1px 4px; border-radius: 999px; background: var(--neutre-fond); white-space: nowrap; line-height: 1.6; }
td.ecart { color: var(--alerte); font-weight: 600; }
.puces { margin: 6px 0 2px; padding-left: 20px; }
.puces li { padding: 1px 0; }
.puces.echec { color: var(--refus); }

/* Onglet Cash : ligne de saisie en tête de la grille, compte rappelé sur les lignes qui en portent un */
tr.saisie td { background: var(--accent-fond); vertical-align: top; border-bottom-color: var(--accent-fort); }
tr.saisie input, tr.saisie select { width: 100%; min-width: 60px; font: inherit; padding: 4px 6px; border: 1px solid var(--trait-fort); border-radius: 6px; background: #fff; color: var(--texte); }
tr.saisie input:focus, tr.saisie select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
/* width: 1% : la colonne Montant se réduit au plus étroit (le champ de saisie, les montants), au lieu de prendre la largeur d'office d'un champ */
tr.saisie td.saisie-montant { width: 1%; }
tr.saisie .saisie-montant input { text-align: right; min-width: 80px; }
tr.saisie .erreur-champ { margin-top: 2px; font-size: 12px; color: var(--refus); }
tr.saisie { scroll-margin-top: calc(var(--tete, 0px) + var(--barre, 0px) + 80px); }
.compte-ligne { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 10px; background: var(--neutre-fond); color: var(--discret); font-size: 12px; white-space: nowrap; }

/* Onglet Graphiques : filtres */
.carte h3 { margin: 0; font-size: 13px; font-weight: 650; }
.filtres-vues { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.filtres-vues input[type="date"] { font: inherit; padding: 4px 8px; border: 1px solid var(--trait-fort); border-radius: var(--rayon); }
.filtres-vues .erreur-champ { color: var(--refus); }
.segment { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--rayon); background: var(--neutre-fond); }
.segment button { border: 0; border-radius: 6px; padding: 4px 12px; background: none; color: var(--discret); }
.segment button:hover:not(:disabled) { background: rgba(255, 255, 255, .6); color: var(--texte); }
.segment button[aria-pressed="true"], .segment button[aria-pressed="true"]:hover { background: var(--carte); box-shadow: var(--ombre); color: var(--accent); font-weight: 600; }
details.choix { position: relative; }
details.choix summary { list-style: none; padding: 5px 10px; border: 1px solid var(--trait-fort); border-radius: var(--rayon); background: #fff; cursor: pointer; user-select: none; white-space: nowrap; }
details.choix summary::-webkit-details-marker { display: none; }
details.choix summary::after { content: " ▾"; color: var(--discret); }
details.choix summary:hover { border-color: var(--accent); }
details.choix.actif summary { border-color: var(--accent); background: var(--accent-leger); }
details.choix .panneau { position: absolute; z-index: 15; top: calc(100% + 4px); left: 0; min-width: 210px; max-height: 380px; overflow: auto; padding: 8px 12px; background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; box-shadow: var(--ombre-haute); }
details.choix .panneau label { display: block; padding: 2px 0; white-space: nowrap; cursor: pointer; }
details.choix .panneau .groupe { margin: 8px 0 2px; font-size: 11px; font-weight: 600; color: var(--discret); text-transform: uppercase; letter-spacing: .04em; }
details.choix .panneau .ligne { padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--trait); }
.a-classer { color: var(--alerte); }
.export { display: inline-flex; align-items: center; gap: 6px; color: var(--discret); white-space: nowrap; }

/* Graphiques : --serie-1 (colonnes, barres) et --serie-2 (ligne du cumul), validées ensemble sur fond blanc */
:root { --serie-1: #2a78d6; --serie-2: #eb6834; --grille: #e8eaee; --axe: #b9bec7; }
.legende { display: flex; gap: 18px; margin: 4px 0 2px; font-size: 12px; color: var(--discret); }
.legende > span { display: inline-flex; align-items: center; gap: 6px; }
.g-cle { display: inline-block; flex: none; }
.g-cle.carre { width: 10px; height: 10px; border-radius: 2px; background: var(--serie-1); }
.g-cle.trait { width: 16px; height: 0; border-top: 2px solid var(--serie-2); }
.graphique { position: relative; margin-bottom: 12px; }
.graphique svg { display: block; max-width: 100%; }
.g-grille { stroke: var(--grille); stroke-width: 1; }
.g-zero { stroke: var(--axe); stroke-width: 1; }
.g-texte { fill: var(--discret); font-size: 11px; font-variant-numeric: tabular-nums; }
.g-barre { fill: var(--serie-1); pointer-events: none; rx: 3px; }
.g-ligne { fill: none; stroke: var(--serie-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.g-point { fill: var(--serie-2); stroke: var(--carte); stroke-width: 2; pointer-events: none; }
.g-etiquette { fill: var(--texte); font-size: 11px; font-weight: 600; pointer-events: none; }
.g-zone { fill: transparent; cursor: pointer; outline: none; }
.g-zone:hover, .g-zone:focus-visible { fill: rgba(31, 95, 191, .07); }
.g-zone.choisie { fill: rgba(31, 95, 191, .13); }
.g-bulle { position: absolute; z-index: 10; padding: 6px 10px; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre-haute); font-size: 12px; white-space: nowrap; pointer-events: none; }
.g-bulle .titre { margin-bottom: 2px; font-weight: 600; }
.g-bulle .rang { display: flex; align-items: center; gap: 6px; color: var(--discret); }
.g-bulle .rang strong { margin-left: auto; padding-left: 16px; color: var(--texte); font-variant-numeric: tabular-nums; }
.g-bulle .detail { margin-top: 3px; color: var(--discret); }

/* Répartition : barres de part et d'autre de zéro */
.barres { margin: 6px 0 14px; }
.barres .rangee { display: grid; grid-template-columns: 200px 1fr 104px; column-gap: 12px; align-items: center; padding: 2px 6px; border-radius: 4px; cursor: pointer; outline: none; }
.barres .rangee:hover, .barres .rangee:focus-visible { background: var(--accent-leger); }
.barres .rangee.choisie { background: var(--accent-fond); }
.barres .rangee.groupe { margin-top: 6px; font-weight: 600; }
.barres .rangee.groupe:first-child { margin-top: 0; }
.barres .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barres .piste { position: relative; height: 14px; }
.barres .zero { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--axe); }
.barres .barre { position: absolute; top: 0; height: 14px; min-width: 2px; background: var(--serie-1); }
.barres .barre.pos { border-radius: 0 4px 4px 0; }
.barres .barre.neg { border-radius: 4px 0 0 4px; }
.barres .valeur { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Tableau croisé. Tant qu'il tient dans la page, il défile avec elle (en-tête collé sous les onglets, comme les autres
   tableaux). Plus large que la page (classe « large », posée par la page), il défile dans son cadre : en-tête, première
   colonne et total collés au cadre. */
.croise { border: 1px solid var(--trait); border-radius: var(--rayon); }
.croise table { width: auto; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.croise.large { overflow: auto; max-height: calc(100vh - var(--tete, 0px) - 24px); }
.croise.large thead th { top: 0; }
.croise.large th:first-child, .croise.large td:first-child { position: sticky; left: 0; z-index: 4; background: var(--carte); }
.croise.large thead th:first-child { z-index: 6; }
.croise tr.classe td, .croise tr.classe td:first-child { font-weight: 600; background: var(--fond-doux); }
.croise tr.categorie td:first-child { padding-left: 20px; }
.croise td.case { cursor: pointer; }
.croise td.case:hover { background: var(--accent-leger); }
.croise td.case.choisie, .croise tr.classe td.case.choisie { background: var(--accent-fort); }
.croise tfoot td, #table-cumul tfoot td { font-weight: 600; border-top: 1px solid var(--axe); border-bottom: 0; }
.croise.large tfoot td { position: sticky; bottom: 0; z-index: 4; background: var(--carte); }
.croise.large tfoot td:first-child { z-index: 6; }

/* Boîtes de dialogue */
dialog { border: 0; border-radius: 14px; padding: 20px 22px; min-width: 360px; max-width: 480px; color: var(--texte); box-shadow: var(--ombre-haute); }
dialog::backdrop { background: rgba(19, 28, 49, .45); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 6px; font-size: 16px; font-weight: 650; }
dialog p { margin: 0 0 12px; color: var(--discret); }
dialog label { display: block; margin: 10px 0 3px; font-size: 12px; color: var(--discret); }
dialog input[type="text"], dialog input[type="password"], dialog input[type="date"], dialog select, dialog textarea { width: 100%; }
dialog input[type="date"], dialog textarea { font: inherit; padding: 5px 8px; border: 1px solid var(--trait-fort); border-radius: var(--rayon); }
dialog .erreur-champ { margin-top: 3px; font-size: 12px; color: var(--refus); }
dialog .boutons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
dialog.aide { max-width: 720px; }
dialog.aide dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; }
dialog.aide dt { font-weight: 600; }
dialog.aide dd { margin: 0; }

/* Camembert de la répartition : anneau et légende ; les couleurs viennent de mbs-graphiques.js (une par rang) */
.camembert { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin: 6px 0 14px; }
.g-camembert { flex: 0 0 auto; }
.g-part { cursor: pointer; outline: none; transition: stroke-width .12s; }
.g-part.survol, .g-part:focus-visible { stroke-width: 42; }
.g-centre { pointer-events: none; }
.camembert-legende { flex: 1 1 280px; max-width: 520px; }
.rangee-cam { display: grid; grid-template-columns: 14px 1fr auto 56px; column-gap: 10px; align-items: center; padding: 3px 6px; border-radius: 4px; cursor: pointer; outline: none; }
.rangee-cam:hover, .rangee-cam.survol, .rangee-cam:focus-visible { background: var(--accent-leger); }
.rangee-cam .puce { width: 10px; height: 10px; border-radius: 2px; }
.rangee-cam .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rangee-cam .valeur, .rangee-cam .pc { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rangee-cam .pc { color: var(--discret); }

/* Objectif d'accumulation : ligne en pointillé du graphique du cumul, résumé au-dessus, saisie dans l'onglet Config */
:root { --objectif: #2aa876; }
.g-objectif { fill: none; stroke: var(--objectif); stroke-width: 2; stroke-dasharray: 6 5; pointer-events: none; }
.g-cle.pointille { width: 16px; height: 0; border-top: 2px dashed var(--objectif); }
.objectif-resume { margin: 4px 0 10px; }
.objectif-resume .retard { color: #b3261e; font-weight: 600; }
.objectif-resume .avance { color: #1c7a55; font-weight: 600; }
#zone-objectifs table { width: auto; }
#zone-objectifs input { width: 130px; text-align: right; }
#zone-objectifs td .erreur-champ { display: inline-block; margin-left: 8px; }
/* Mot-clé limité à certains comptes : cases des comptes dans la fenêtre du mot-clé */
.comptes-mot { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 2px; }
.comptes-mot label { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; margin: 0; }
.case-filtre { display: inline-flex; align-items: center; gap: 5px; }

/* Sélecteur de portefeuille (fichier de données) dans la carte Données du Dashboard, application Windows seulement */
#zone-paquet { gap: 6px; }
#zone-paquet select { max-width: 260px; font-weight: 600; }
.liste-paquets { margin: 8px 0; max-height: 50vh; overflow: auto; }
.rangee-paquet { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0; border-top: 1px solid var(--trait); }
.rangee-paquet:first-child { border-top: 0; }
.rangee-paquet .discret { font-size: 12px; word-break: break-all; }

/* Carte Données du Dashboard : le portefeuille en tête, bien visible */
#zone-paquet { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--trait); }
#zone-paquet > .discret { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
#zone-paquet select { min-width: 200px; padding: 6px 10px; font-size: 14px; }

/* Tablette : le bandeau garde ses six onglets, le rappel du fichier disparaît en premier */
@media (max-width: 1180px) {
  .haut { gap: 12px; padding: 0 12px; }
  .onglets button { padding: 0 9px; }
  main { padding: 14px 12px 40px; }
}
@media (max-width: 980px) {
  .haut #etat-dossier { display: none; }
  .haut button.lien { margin-left: auto; }
  .onglets button[data-couleur]::before { display: none; }
}

/* Chiffres clés du Dashboard : entrées, sorties, solde, à classer, pour les filtres en cours */
.chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 10px 0 12px; }
.tuile { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 14px; border: 1px solid var(--trait); border-left: 4px solid var(--trait-fort); border-radius: 10px; background: var(--fond-doux); text-align: left; }
.tuile .titre { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--discret); }
.tuile strong { font-size: 22px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tuile .detail { font-size: 12px; color: var(--discret); }
.tuile.pos { border-left-color: var(--ok); }
.tuile.pos strong { color: var(--ok); }
.tuile.neg { border-left-color: var(--refus); }
.tuile.neg strong { color: var(--refus); }
.tuile.alerte { border-left-color: #e0a100; background: var(--alerte-fond); }
.tuile.alerte strong { color: var(--alerte); }
button.tuile:hover:not(:disabled) { border-color: var(--accent); border-left-color: var(--accent); }
@media (max-width: 760px) { .chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Grille plus large que la fenêtre : la page défile en largeur (les en-têtes collés restent ceux de la page). La carte
   s'élargit avec sa grille au lieu de la laisser déborder ; le contenu du bandeau et les messages restent en vue
   (--large, largeur visible de la fenêtre, est posé par la page). */
body { min-width: fit-content; }
.tete-fixe { background: var(--nuit); }
.haut, #messages { position: sticky; left: 0; width: var(--large, 100%); max-width: 100%; }
#messages { width: calc(var(--large, 100%) - 40px); }
/* le tableau croisé, lui, défile dans son cadre : sa largeur ne compte pas dans celle de la page */
.croise { contain: inline-size; }

/* Recherche libre des grilles et de l'onglet Catégories : un champ large */
#vue-filtre, #filtre-cash, #t-filtre, #filtre-categories { width: 340px; max-width: 100%; }

/* Onglet Catégories : le nom et la classe se modifient d'un clic */
button.cat.renommer { font-weight: 600; }
button.classe { border: 0; padding: 0; background: none; color: var(--texte); }
button.classe:hover:not(:disabled) { background: none; color: var(--accent); text-decoration: underline; }

/* Carte « Classes » de l'onglet Catégories */
.classes { display: flex; flex-wrap: wrap; gap: 8px; }
.classe-carte { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border: 1px solid var(--trait); border-radius: 999px; background: var(--fond-doux); }
.classe-carte .discret { font-size: 12px; }
.classe-carte button.nom-classe { border: 0; padding: 0; background: none; font-weight: 650; }
.classe-carte button.nom-classe:hover:not(:disabled) { background: none; color: var(--accent); text-decoration: underline; }
.classe-carte button.icone { width: 20px; height: 20px; padding: 0; border-radius: 50%; line-height: 1; }
.classe-carte button.icone:hover:not(:disabled) { background: var(--accent-fond); }
.classe-carte button.retirer:hover:not(:disabled) { background: var(--refus-fond); color: var(--refus); }

/* un onglet masqué (Admin, hors de la page en ligne ou pour un compte qui n'est pas admin) ne prend pas de place */
.onglets button[hidden] { display: none; }

/* Page en ligne : tant qu'on n'est pas connecté (et le temps de le savoir), seul le formulaire de connexion est visible. */
body.demarrage .tete-fixe, body.demarrage main, body.deconnecte .tete-fixe, body.deconnecte main { display: none; }
#ecran-connexion { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
#ecran-connexion[hidden] { display: none; }
#ecran-connexion form { width: 320px; max-width: 100%; background: var(--carte, #fff); border-radius: 14px; padding: 22px; box-shadow: var(--ombre-haute); display: flex; flex-direction: column; gap: 10px; }
#ecran-connexion input { width: 100%; box-sizing: border-box; }
#ecran-connexion .erreur-champ { min-height: 16px; font-size: 12px; color: var(--refus); }

/* Menu du compte (page en ligne) : s'ouvre sous « Utilisateur : … », à droite du bandeau. */
.menu-compte { position: absolute; top: calc(100% + 6px); right: 12px; z-index: 30; min-width: 230px; padding: 6px; background: var(--carte); color: var(--texte); border-radius: 12px; box-shadow: var(--ombre-haute); display: flex; flex-direction: column; gap: 2px; }
.menu-compte[hidden] { display: none; }
.menu-compte-qui { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--trait, #e4e8ef); margin-bottom: 4px; font-size: 13px; }
.menu-compte button { text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: inherit; }
.menu-compte button:hover, .menu-compte button:focus-visible { background: var(--fond-survol, #eef2f9); }

/* Champ secret avec son bouton « œil » (mot de passe, phrase secrète) */
.champ-secret { position: relative; display: flex; align-items: center; width: 100%; }
.champ-secret input { width: 100%; padding-right: 36px; }
.champ-secret .oeil { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--discret); cursor: pointer; }
.champ-secret .oeil:hover, .champ-secret .oeil:focus-visible { background: var(--fond-survol, #eef2f9); color: var(--texte); }
