/* Feuille de style unique. Texte volontairement large : ces comptes se
   relisent souvent à deux, parfois sur un écran de tablette. */

:root {
  --fond: #f4f5f7;
  --fond-carte: #ffffff;
  --trait: #d8dbe0;
  --texte: #1d2430;
  --texte-doux: #5b6675;
  --accent: #2f5fd0;
  --recette: #1f7a4d;
  --depense: #b4342a;
  --fond-recette: #e8f5ee;
  --fond-depense: #fcecea;
  --fond-attente: #fdf3dc;
  --part-generale: #6b7686;
  --rayon: 10px;
}

/* Le thème suit le système, sauf si les réglages imposent l'un des deux.
   L'attribut data-theme est posé sur <html> par le gabarit. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: #171a1f;
    --fond-carte: #1f242c;
    --trait: #333b47;
    --texte: #e8ebf0;
    --texte-doux: #9aa5b4;
    --accent: #7aa2f7;
    --recette: #6fcf97;
    --depense: #f08a80;
    --fond-recette: #1b2f26;
    --fond-depense: #2f1f1e;
    --fond-attente: #322a19;
    --part-generale: #8d98a8;
  }
}

:root[data-theme="sombre"] {
  --fond: #171a1f;
  --fond-carte: #1f242c;
  --trait: #333b47;
  --texte: #e8ebf0;
  --texte-doux: #9aa5b4;
  --accent: #7aa2f7;
  --recette: #6fcf97;
  --depense: #f08a80;
  --fond-recette: #1b2f26;
  --fond-depense: #2f1f1e;
  --fond-attente: #322a19;
  --part-generale: #8d98a8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  background: var(--fond);
}

/* --- En-tête et navigation --- */

.bandeau {
  background: var(--fond-carte);
  border-bottom: 1px solid var(--trait);
  padding: 14px 20px 0;
}

/* Le titre à gauche, les icônes à l'autre bout de la même ligne. */
.bandeau-haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.bandeau h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

/* Page de connexion : une colonne étroite, centrée, sans rien autour. */
.accueil {
  max-width: 430px;
  margin: 40px auto 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.accueil h2 { margin-top: 0; }
.accueil h3 { margin-top: 0; font-size: 1rem; }

/* Le compte en lecture seule n'a pas de formulaires : plutôt que de les
   griser, on ne les écrit pas. Reste ce bandeau, pour qu'il comprenne. */
.lecture-seule {
  border-left: 3px solid var(--accent);
  background: var(--fond);
  padding: 10px 14px;
  border-radius: var(--rayon);
  color: var(--texte-doux);
  font-size: 0.9rem;
}

/* Les deux blocs de la page d'accueil — entrer, ou demander à entrer — se
   ressemblent assez pour être confondus. Ce trait les sépare, et le second
   est posé en creux pour qu'on voie d'un coup d'œil que ce n'est pas le
   chemin ordinaire. */
.separateur-ou {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0;
  color: var(--texte-doux);
  font-size: 0.85rem;
}

.separateur-ou::before,
.separateur-ou::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--trait);
}

.accueil .demande {
  background: var(--fond);
  border-style: dashed;
}

/* Un accès en lecture seule ne voit pas les formulaires d'écriture : ils
   seraient refusés à l'envoi. Ce n'est qu'un confort, et cela ne protège
   rien : c'est index.php qui refuse ces envois, avant tout traitement. La
   sortie et le choix du mois ne sont pas des écritures. */
:root[data-droits="lecture"] form:not(.sortie):not(.choix-mois) {
  display: none;
}

/* Le compte rendu d'un examen d'import : trois nombres à lire d'un coup. */
.verdict {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--texte-doux);
}

.verdict strong { color: var(--texte); font-size: 1.1rem; }

input[type="file"] { font: inherit; color: var(--texte); }

/* Les téléchargements : des boutons qui passent à la ligne plutôt que de
   déborder sur téléphone. */
.boutons-export { display: flex; flex-wrap: wrap; gap: 8px; }

/* Un tableau qui ne tient pas dans la largeur défile pour lui seul, plutôt
   que de pousser toute la page de côté. */
.tableau-large { overflow-x: auto; }

/* Les formulaires d'une ligne, dans les tableaux d'administration. */
.ligne-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 8px 0 0;
}

.ligne-action select { width: auto; padding: 6px 8px; }
.ligne-action input[type="password"] { width: 11em; padding: 6px 8px; }

/* Le compte des demandes, posé sur l'icône des accès. */
.icone { position: relative; }

.pastille-alerte {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--depense);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.sortie { margin: 0; display: flex; }
.sortie .icone { border: none; background: none; cursor: pointer; padding: 0; }

/* Qui est entré : une initiale en pastille, et le nom quand la place le
   permet. Le nom seul serait illisible sur téléphone, l'initiale seule
   ambiguë entre deux prénoms proches : les deux ensemble tranchent. */
.qui {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 6px;
  color: var(--texte-doux);
  font-size: 0.88rem;
}

.qui .nom small {
  display: block;
  font-size: 0.72rem;
  opacity: 0.75;
  line-height: 1.1;
}

.qui .initiale {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
}

@media (max-width: 560px) {
  .qui .nom { display: none; }
}

/* Les icônes forment un groupe en creux, d'où celle qu'on survole ressort
   comme une pastille posée dessus. */
.outils {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: var(--fond);
}

.icone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--texte-doux);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

/* Tracé au trait, sans aplat : plus léger, et les deux icônes ont enfin la
   même graisse. */
.icone svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icone:hover {
  color: var(--texte);
  background: var(--fond-carte);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.14);
}

.icone.actif {
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

.icone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .icone { transition: none; }
}

.onglets { display: flex; flex-wrap: wrap; gap: 4px; }

.onglet {
  padding: 9px 16px;
  color: var(--texte-doux);
  text-decoration: none;
  border-radius: var(--rayon) var(--rayon) 0 0;
  border: 1px solid transparent;
  border-bottom: none;
}

.onglet:hover { color: var(--texte); background: var(--fond); }

.onglet.actif {
  color: var(--texte);
  background: var(--fond);
  border-color: var(--trait);
  font-weight: 600;
}

/* --- Barre de sélection du mois --- */

.barre-mois {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
}

.choix-mois { display: flex; align-items: center; gap: 8px; margin: 0; }
.choix-mois label { color: var(--texte-doux); }

/* Le menu des mois se dimensionne sur son contenu : la règle générale des
   formulaires l'étirerait sur toute la barre. */
.choix-mois select { width: auto; min-width: 10.5em; padding: 7px 10px; }

/* --- Contenu --- */

.contenu { max-width: 1060px; margin: 0 auto; padding: 0 20px 48px; }

h2 { font-size: 1.3rem; margin: 10px 0 18px; }
h3 { font-size: 1.05rem; margin: 28px 0 12px; }

section + section { margin-top: 8px; }

/* Aide contextuelle : un cadre sous les messages, au-dessus de la page. */
.panneau-aide {
  margin: 0 0 22px;
  padding: 14px 18px 16px;
  border: 1px solid var(--trait);
  border-left: 3px solid var(--accent);
  border-radius: var(--rayon);
  background: var(--fond-carte);
}

.panneau-aide h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--accent);
}

.panneau-aide ul { margin: 0; padding-left: 20px; }

.panneau-aide li { margin-bottom: 5px; }

.panneau-aide .pied-aide {
  margin: 12px 0 0;
  font-size: 0.88rem;
  color: var(--texte-doux);
}

/* Le guide : du texte long, donc une mesure de lecture raisonnable. */
.guide { max-width: 72ch; }
.guide h3 { margin-top: 30px; }
.guide dt { font-weight: 600; margin-top: 12px; }
.guide dd { margin: 3px 0 0 18px; color: var(--texte-doux); }
.guide ol { padding-left: 20px; }
.guide li { margin-bottom: 6px; }

.vide, .aide { color: var(--texte-doux); }
.aide { font-size: 0.9rem; max-width: 60ch; }
.resume { color: var(--texte-doux); }

/* --- Messages --- */

.message {
  padding: 11px 14px;
  border-radius: var(--rayon);
  border: 1px solid var(--trait);
  margin: 0 0 12px;
}

.message.succes { background: var(--fond-recette); border-color: var(--recette); }
.message.erreur { background: var(--fond-depense); border-color: var(--depense); }
.message.attente-categorie {
  background: var(--fond-attente);
  border-color: #c9a227;
}

/* --- Cartes de synthèse --- */

.cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.carte {
  background: var(--fond-carte);
  border: 1px solid var(--trait);
  border-left: 4px solid var(--trait);
  border-radius: var(--rayon);
  padding: 14px 16px;
}

.carte .etiquette {
  display: block;
  font-size: 0.85rem;
  color: var(--texte-doux);
  margin-bottom: 4px;
}

.carte strong {
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

/* Seconde rangée : une carte par lieu, centrée sous les cartes du milieu
   plutôt qu'étirée sur toute la largeur comme la grille principale. */
.cartes.cartes-lieux {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.cartes-lieux .carte { flex: 0 1 240px; }

.carte .complement {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--texte-doux);
}

.carte.recette { border-left-color: var(--recette); }
.carte.recette strong { color: var(--recette); }
.carte.depense { border-left-color: var(--depense); }
.carte.depense strong { color: var(--depense); }
.carte.neutre { border-left-color: var(--accent); }

/* --- Tableaux --- */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--fond-carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--trait);
  vertical-align: top;
}

th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--texte-doux);
  background: var(--fond);
}

tbody tr:last-child td { border-bottom: none; }

td.nombre, th.nombre {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.recette { color: var(--recette); font-weight: 600; }
td.depense { color: var(--depense); font-weight: 600; }

tr.pointee { background: var(--fond-recette); }
tr.inactive { opacity: 0.55; }

td .note { display: block; color: var(--texte-doux); font-size: 0.85rem; }

.colonne-actions { white-space: nowrap; text-align: right; }

/* --- Pastilles d'état --- */

.puce {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--trait);
  color: var(--texte-doux);
  background: var(--fond);
}

.puce.ok { color: var(--recette); border-color: var(--recette); background: var(--fond-recette); }
.puce.attente { color: #8a6d1f; border-color: #c9a227; background: var(--fond-attente); }

@media (prefers-color-scheme: dark) {
  .puce.attente { color: #e8c468; }
}

/* --- Répartition par catégorie --- */

.repartition { list-style: none; margin: 0; padding: 0; }

.repartition li {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 3fr auto;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
}

.repartition .jauge {
  background: var(--fond-carte);
  box-shadow: inset 0 0 0 1px var(--trait);
  border-radius: 999px;
  height: 14px;
}

/* Pas d'overflow caché : la jauge porte des parts, et chaque part porte une
   infobulle qui doit pouvoir sortir. */
.repartition .remplissage {
  display: flex;
  height: 100%;
  border-radius: 999px;
  background: var(--depense);
}

.repartition .valeur { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Dépenses par origine : une seule barre, une couleur par lieu --- */

/* Pas d'overflow caché ici : l'infobulle d'une part doit pouvoir déborder.
   Ce sont donc les parts des deux bouts qui portent l'arrondi. */
.barre-parts {
  display: flex;
  height: 26px;
  margin: 2px 0 14px;
  border-radius: 999px;
  background: var(--fond-carte);
  box-shadow: inset 0 0 0 1px var(--trait);
}

/* Une part : un morceau de barre empilée, dans la grande barre comme dans la
   jauge d'une catégorie. */
.part {
  position: relative;
  display: block;
  min-width: 4px;
  cursor: default;
}

.part.sans-couleur { background: var(--part-generale); }
.part:first-child { border-radius: 999px 0 0 999px; }
.part:last-child { border-radius: 0 999px 999px 0; }
.part:only-child { border-radius: 999px; }

.part:hover,
.part:focus-visible {
  outline: none;
  filter: brightness(1.12);
}

.bulle {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--texte);
  color: var(--fond-carte);
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: nowrap;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.bulle b {
  display: block;
  font-variant-numeric: tabular-nums;
}

/* Petite pointe sous l'infobulle. */
.bulle::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--texte);
}

.part:hover .bulle,
.part:focus-visible .bulle { opacity: 1; }

/* La légende dit la même chose sans survol : au doigt, et à l'impression. */
.legende-parts {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.legende-parts li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.legende-parts .valeur {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.legende-parts .pourcent { color: var(--texte-doux); }

.pastille {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.legende-parts .pastille { margin-right: 0; flex: none; }
.pastille.sans-couleur { background: var(--part-generale); }

.champ.case label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  color: var(--texte);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
}

.champ.case input { width: auto; }

.discret { color: var(--texte-doux); font-size: 0.9rem; }

/* Le lieu se reconnaît aussi sur sa carte, au même coup d'œil. */
.carte-lieu { border-top: 3px solid var(--trait); }

/* --- Formulaires --- */

.bloc-formulaire {
  background: var(--fond-carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 4px 18px 18px;
  margin-top: 20px;
}

.grille-formulaire {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px 16px;
  margin: 0;
}

.champ { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.champ.large { grid-column: span 2; }
.champ.case { justify-content: flex-end; }
.champ label { font-size: 0.88rem; color: var(--texte-doux); }
.champ small { color: var(--texte-doux); font-size: 0.8rem; }

input[type="text"], input[type="date"], input[type="number"], select {
  font: inherit;
  padding: 9px 10px;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--trait);
  border-radius: 7px;
  width: 100%;
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.champ.case label {
  flex-direction: row;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--texte);
}

.actions-formulaire {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 6px 0 0;
}

/* --- Boutons et liens d'action --- */

.bouton {
  font: inherit;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid var(--trait);
  background: var(--fond-carte);
  color: var(--texte);
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}

.bouton:hover { border-color: var(--accent); }

.bouton.principal {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.bouton.discret { color: var(--texte-doux); }

.lien-action {
  font: inherit;
  font-size: 0.9rem;
  background: none;
  border: none;
  padding: 2px 4px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.lien-action:hover { text-decoration: underline; }
.lien-action.danger { color: var(--depense); }

.en-ligne { display: inline-flex; align-items: center; gap: 4px; margin: 0; }

.pointage .montant-ajuste { width: 92px; padding: 5px 7px; font-size: 0.9rem; }

/* --- Téléphone --- */

@media (max-width: 620px) {
  .champ.large { grid-column: span 1; }
  .repartition li { grid-template-columns: 1fr auto; }
  .repartition .jauge { grid-column: 1 / -1; }
  table { display: block; overflow-x: auto; }
}

/* ------------------------------------------------------------------
   Tableau des charges mensuelles
   Reprend la disposition du tableau papier : deux colonnes côte à côte,
   leurs totaux, le reste en grand, puis un bloc par lieu.
   ------------------------------------------------------------------ */

.actions-impression {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}

.feuille {
  background: var(--fond-carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 26px 30px 30px;
}

.titre-feuille {
  margin: 0 0 2px;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
}

.mois-feuille {
  margin: 0 0 6px;
  text-align: center;
  color: var(--texte-doux);
}

/* Solde du mois : toutes les opérations de la période, lieux compris. Il ne
   se confond pas avec le RESTE du bas, qui ne compte que les générales. */
.solde-feuille {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0 10px;
  margin: 0 0 22px;
}

.solde-feuille strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.solde-feuille strong.recette { color: var(--recette); }
.solde-feuille strong.depense { color: var(--depense); }

.deux-colonnes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 26px;
  align-items: start;
}

.blocs-lieux { margin-top: 26px; }

/* La grille gère déjà l'écart : sans cela, la règle générale « section +
   section » décale la colonne de droite de 8 px vers le bas. */
.deux-colonnes > section + section { margin-top: 0; }

.entete-bloc {
  margin: 0 0 6px;
  text-align: center;
  font-size: 1rem;
}

.entete-bloc.majuscules { text-transform: uppercase; }

/* Le tableau papier n'a aucune bordure. À l'écran comme à l'impression, une
   filet léger par ligne garde les colonnes de chiffres lisibles sans
   alourdir la page. */
.tableau-papier {
  width: 100%;
  border: none;
  border-radius: 0;
  background: none;
  font-size: 0.95rem;
}

.tableau-papier th,
.tableau-papier td {
  padding: 4px 7px;
  border-bottom: 1px solid var(--trait);
  background: none;
}

.tableau-papier thead th {
  text-transform: none;
  font-size: 0.9rem;
  letter-spacing: 0;
  color: var(--texte);
  border-bottom: 1.5px solid var(--texte-doux);
}

.tableau-papier tfoot th,
.tableau-papier tfoot td {
  border-bottom: none;
  border-top: 1.5px solid var(--texte-doux);
  font-weight: 700;
}

.tableau-papier tfoot tr + tr th,
.tableau-papier tfoot tr + tr td {
  border-top: none;
  font-weight: 400;
  text-transform: none;
  color: var(--texte-doux);
}

.tableau-papier .col-date {
  width: 3.4em;
  text-align: center;
  color: var(--texte-doux);
}

.tableau-papier .ligne-vide td { height: 1.55em; }

/* Ligne repliée : la catégorie en italique, soulignée en pointillé pour dire
   qu'il y a quelque chose dessous. Le détail ne sort qu'au survol. */
.groupe {
  position: relative;
  display: inline-block;
  cursor: default;
}

.groupe em {
  font-style: italic;
  border-bottom: 1px dotted var(--texte-doux);
}

.groupe:hover em,
.groupe:focus-visible em { color: var(--accent); }

.groupe:focus-visible { outline: none; }

.groupe .bulle {
  bottom: calc(100% + 7px);
  white-space: nowrap;
  text-align: left;
}

.groupe:hover .bulle,
.groupe:focus-visible .bulle { opacity: 1; }

.bulle .ligne-detail {
  display: grid;
  grid-template-columns: 1.6em 1fr auto;
  gap: 0 14px;
}

.bulle .ligne-detail span:first-child { color: var(--trait); text-align: right; }
.bulle .ligne-detail span:last-child { font-variant-numeric: tabular-nums; }

.reste {
  margin: 24px 0 0;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.reste strong {
  font-size: 1.5rem;
  margin-left: 10px;
  font-variant-numeric: tabular-nums;
}

/* Récapitulatif : lieu par lieu, les lieux ensemble, puis tout. */
.recapitulatif {
  width: auto;
  min-width: 340px;
  margin: 26px auto 0;
}

.recapitulatif caption {
  padding: 0 0 6px;
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.9rem;
}

.recapitulatif th {
  text-transform: none;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--texte);
  padding-right: 28px;
}

.recapitulatif .ligne-cumul th,
.recapitulatif .ligne-cumul td { font-weight: 700; }

.recapitulatif .ligne-generale th,
.recapitulatif .ligne-generale td {
  border-top: 1.5px solid var(--texte-doux);
  border-bottom: none;
  padding-top: 7px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.note-feuille {
  margin: 22px 0 0;
  font-size: 0.82rem;
  color: var(--texte-doux);
  text-align: center;
}

.puce.lieu {
  border-color: var(--accent);
  color: var(--accent);
}

/* ------------------------------------------------------------------
   Impression : une page A4 portrait, rien que la feuille.
   Marges reprises du tableau d'origine (0,7 pouce sur les côtés).
   ------------------------------------------------------------------ */

@page {
  size: A4 portrait;
  margin: 1.9cm 1.8cm;
}

@media print {
  /* Forcer le rendu clair : une page sombre gaspille l'encre et se lit mal. */
  :root {
    --fond: #fff;
    --fond-carte: #fff;
    --trait: #999;
    --texte: #000;
    --texte-doux: #444;
    --accent: #000;
  }

  body { background: #fff; color: #000; font-size: 11pt; }

  .bandeau,
  .barre-mois,
  .actions-impression,
  .message,
  .note-feuille { display: none; }
  .outils, .panneau-aide, .qui { display: none; }

  .contenu { max-width: none; margin: 0; padding: 0; }

  .feuille {
    border: none;
    border-radius: 0;
    padding: 0;
    background: none;
  }

  .titre-feuille { font-size: 15pt; }
  .mois-feuille { margin-bottom: 3pt; color: #000; }
  .solde-feuille { margin-bottom: 14pt; }
  .solde-feuille strong,
  .solde-feuille strong.recette,
  .solde-feuille strong.depense { font-size: 13pt; color: #000; }
  .entete-bloc { font-size: 11pt; }

  .tableau-papier { font-size: 10pt; }
  .tableau-papier th, .tableau-papier td { padding: 2.5pt 5pt; }
  .tableau-papier .ligne-vide td { height: 1.45em; }

  .reste { margin-top: 16pt; font-size: 13pt; }
  .reste strong { font-size: 17pt; }

  .recapitulatif { min-width: 0; width: 62%; margin-top: 14pt; }
  .recapitulatif caption { font-size: 10pt; }
  .recapitulatif th { font-size: 10pt; padding-right: 20pt; }

  .deux-colonnes { gap: 10pt 20pt; }
  .blocs-lieux { margin-top: 16pt; }

  /* Ne jamais couper un bloc en deux pages. */
  .feuille section,
  .tableau-papier,
  .recapitulatif,
  .deux-colonnes { break-inside: avoid; page-break-inside: avoid; }

  .puce { border: none; background: none; color: #444; padding: 0; }

  /* Sur le papier il n'y a pas de survol : le détail n'a rien à y faire, et
     le pointillé n'invite plus à rien. */
  .bulle { display: none; }
  .groupe em { border-bottom: none; }

  a { color: #000; text-decoration: none; }
}
