/* Gimly — feuille de style unique, mobile d'abord.
 *
 * Vocabulaire visuel « Registre » (maquette 1a, déclinée mobile en 1d → 1e) :
 * papier, encre, or patiné. L'or ne sert qu'à trois choses — la part de
 * Laurène, le symbole €, et ce qui est sélectionné ou demande un arbitrage.
 * Tout le reste est encre sur papier.
 *
 * Les chiffres sont tabulaires partout : deux colonnes de montants doivent
 * s'aligner à la virgule sans effort.
 */

:root {
  /* Papier */
  --papier: #f6f4ef;
  --papier-doux: #fbfaf7;
  --surface: #ffffff;

  /* Traits : du plus marqué au plus fin */
  --bordure: #e6e1d6;
  --bordure-interne: #eeeae1;
  --filet: #f1eee7;
  --controle: #d9d3c6;

  /* Encre */
  --encre: #1d1c1a;
  --encre-mi: #55524b;
  --encre-douce: #6b675e;
  --encre-faible: #8a857a;
  --encre-inerte: #b5afa3;

  /* Or patiné */
  --or: #c9a24a;
  --or-fonce: #b8902f;
  --or-encre: #8c6a1e;
  --or-fond: #f8f2e3;
  --or-nav: #efe7d2;

  /* Tons */
  --vert: #2f6b4a;
  --vert-fond: #e3eee6;
  --rouge: #a3412f;
  --rouge-fond: #f5e4df;
  --rouge-bande: #fbf1ee;
  --rouge-bordure: #ebcfc6;
  --rouge-fonce: #7e3324;
  --neutre-fond: #efece5;

  /* Contrepartie de l'or dans les barres : la part de Cédric */
  --contre: #2b2a27;

  /* Bouton principal, et la carte d'appel du tableau de bord */
  --action: #1d1c1a;
  --action-encre: #f6f4ef;
  --appel-fond: #1d1c1a;
  --appel-encre: #f6f4ef;
  --appel-douce: #b5afa3;
  --appel-accent: #d9b460;
  --appel-bordure: transparent;

  --ombre-dialogue: 0 20px 60px rgb(0 0 0 / 0.25);
  --voile: rgb(143 139 131 / 0.78);

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Newsreader", Georgia, serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Direction « Coffre » (maquette 1b / 1f) : le même registre, de nuit. */
    --papier: #12110f;
    --papier-doux: #1b1a17;
    --surface: #1b1a17;

    --bordure: #2c2924;
    --bordure-interne: #2c2924;
    --filet: #232221;
    --controle: #3a3630;

    --encre: #ede9e0;
    --encre-mi: #b9b3a8;
    --encre-douce: #9a948a;
    --encre-faible: #7d776d;
    --encre-inerte: #5e5950;

    --or: #d9b460;
    --or-fonce: #d9b460;
    --or-encre: #c9ae70;
    --or-fond: #2a2416;
    --or-nav: #24221e;

    --vert: #7fb98f;
    --vert-fond: #1d2b22;
    --rouge: #e39387;
    --rouge-fond: #33211d;
    --rouge-bande: #2a1c19;
    --rouge-bordure: #4a2e28;
    --rouge-fonce: #e39387;
    --neutre-fond: #24221e;

    --contre: #57524a;

    /* De nuit, le bouton principal est l'or : l'encre se confondrait au fond. */
    --action: #d9b460;
    --action-encre: #1a150a;
    --appel-fond: #241f14;
    --appel-encre: #d9b460;
    --appel-douce: #c9ae70;
    --appel-accent: #d9b460;
    --appel-bordure: #4a3f25;

    --ombre-dialogue: 0 20px 60px rgb(0 0 0 / 0.6);
    --voile: rgb(10 9 8 / 0.7);
  }
}

* { box-sizing: border-box; }

/* L'attribut `hidden` doit l'emporter sur tout `display` posé par une classe. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 400 14px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  /* Colonne pleine hauteur : la revue peut alors pousser ses deux boutons en
     bas de l'écran, comme la maquette 1e. */
  display: flex; flex-direction: column; min-height: 100dvh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}
main { flex: 1; }

a { color: var(--or-encre); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 600; }
h2 { font-size: 14px; font-weight: 600; }

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.discret { color: var(--encre-douce); }
.terne { color: var(--encre-faible); }
.petit { font-size: 12px; }

:where(button, a, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--or-fonce);
  outline-offset: 2px;
}

/* ── Marque, barre latérale, onglets ─────────────────────────────────────────
 *
 * Un seul élément pour deux formes : en haut sur téléphone (maquette 1d),
 * colonne de 220 px à partir de 900 px (maquette 1a).
 */

.entete-app {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  background: var(--papier);
}

/* Logotype « Gımly » (maquette 2e) : le point du i est une pièce d'or.
   Le « ı » du HTML est sans point ; la pièce est ce disque, dimensionné en
   `em` pour suivre le corps du texte. */
.marque {
  font: 600 22px var(--serif); text-decoration: none; color: var(--encre);
}
.marque-i { position: relative; }
.marque-point {
  position: absolute; left: 50%; top: 0.02em;
  width: 0.24em; height: 0.24em; border-radius: 50%;
  background: var(--or); transform: translateX(-50%);
}

/* Pilule d'état du mois, à droite de la marque sur téléphone. */
.etat-mois { margin-left: auto; }

.pilule {
  display: inline-flex; align-items: center; white-space: nowrap;
  font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px;
  background: var(--neutre-fond); color: var(--encre-mi);
}
.pilule-vert { background: var(--vert-fond); color: var(--vert); }
.pilule-neutre { background: var(--neutre-fond); color: var(--encre-mi); }
.pilule-or { background: var(--or-fond); color: var(--or-encre); }

.pilules { display: flex; flex-wrap: wrap; gap: 6px; }

.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(78px + env(safe-area-inset-bottom));
  padding: 12px 4px env(safe-area-inset-bottom);
  background: var(--papier-doux); border-top: 1px solid var(--bordure);
}
.onglets a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 2px 4px; text-decoration: none;
  font-size: 11px; color: var(--encre-faible); text-align: center;
}
.onglets svg {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.onglets a[aria-current="true"] { color: var(--encre); font-weight: 600; }

/* Sur telephone les libelles sont courts (maquette 1d), au long dans la
   colonne (maquette 1a) ; le compteur n'apparait que dans la colonne. */
.onglet-libelle, .onglet-badge { display: none; }
.onglet-court { display: inline; }

@media (min-width: 900px) {
  body {
    display: grid; grid-template-columns: 220px minmax(0, 1fr);
    min-height: 100vh; padding-bottom: 0;
    /* La colonne et son filet sont peints sur le fond de la page : la barre
       latérale, elle, est collante et ne fait qu'une hauteur d'écran. */
    background-image: linear-gradient(to right,
      var(--papier-doux) 0 219px, var(--bordure) 219px 220px, transparent 220px);
  }
  .entete-app {
    position: sticky; top: 0; align-self: start;
    height: 100vh; flex-direction: column; align-items: stretch; gap: 2px;
    padding: 22px 14px; overflow-y: auto;
    background: none;
  }
  .marque { padding: 0 10px 22px; font-size: 24px; }
  .etat-mois { display: none; }

  .onglets {
    position: static; display: flex; flex-direction: column; gap: 2px;
    height: auto; padding: 0; border: 0; background: none;
  }
  .onglets a {
    flex-direction: row; align-items: center; justify-content: space-between;
    gap: 10px; padding: 8px 10px; border-radius: 6px;
    font-size: 13.5px; text-align: left; color: var(--encre-mi);
  }
  .onglets a:hover { background: var(--filet); }
  .onglets svg, .onglet-court { display: none; }
  .onglet-libelle { display: inline; }
  .onglets a[aria-current="true"] { background: var(--or-nav); color: var(--encre); }
  .onglets a[aria-current="true"]:hover { background: var(--or-nav); }
  .onglet-badge {
    display: inline; font: 500 11px var(--mono); color: var(--or-encre);
  }
  .onglets-pied {
    margin-top: auto; padding: 14px 10px 0;
    border-top: 1px solid var(--bordure);
    font-size: 12px; line-height: 1.5; color: var(--encre-douce);
  }
}

@media (max-width: 899px) {
  .onglets-pied { display: none; }
}

/* ── Mise en page ────────────────────────────────────────────────────────── */

main {
  min-width: 0;
  display: flex; flex-direction: column; gap: 14px;
  padding: 10px 18px 18px;
}
main:focus { outline: none; }

@media (min-width: 900px) {
  main {
    gap: 22px; padding: 28px 36px 36px;
    max-width: 1180px;
  }
}

/* Les deux rangées du tableau de bord (maquette 1a). Sur téléphone tout
   s'empile dans l'ordre du DOM, qui est celui de la maquette 1d. */
.grille-dash, .grille-bas { display: grid; gap: 14px; min-width: 0; }
.colonne { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

@media (min-width: 900px) {
  .grille-dash, .grille-bas { gap: 22px; align-items: start; }
  .grille-dash { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .grille-bas { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
}

/* ── Carte ───────────────────────────────────────────────────────────────── */

.carte {
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: 14px; min-width: 0;
}
.carte-corps { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }

.carte-entete {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  align-items: baseline; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--bordure-interne);
}
.carte-note { font-size: 12px; color: var(--encre-douce); }

@media (min-width: 900px) {
  .carte { border-radius: 10px; }
  .carte-corps { padding: 16px 20px; }
  .carte-entete { padding: 14px 20px; }
}

/* ── Bandeau du mois : pas à pas, état, actions ──────────────────────────── */

.bandeau-mois {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px 16px;
}
.pas-de-mois { display: flex; align-items: center; gap: 12px; }
.pas-de-mois h1 { font-size: 20px; }

.pas {
  width: 30px; height: 30px; flex: none; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--controle); border-radius: 6px;
  background: var(--surface); color: var(--encre-mi);
  font: 400 16px/1 var(--sans); cursor: pointer;
}
.pas:disabled { color: var(--encre-inerte); cursor: default; }

.actions-bandeau { display: flex; flex-wrap: wrap; gap: 8px; }

/* Sur telephone, l'etat du mois est deja dans la barre du haut (maquette 1d). */
@media (max-width: 899px) {
  .pas-de-mois > .pilule { display: none; }
}

@media (min-width: 900px) {
  .pas-de-mois h1 { font-size: 24px; }
}

/* ── Bandeau « à verser » (maquette 1a, replié en 1d) ────────────────────── */

.bandeau-verser {
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: 14px; overflow: hidden;
  display: grid; grid-template-columns: 1fr;
}

.verser-cellule {
  padding: 14px 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline; gap: 2px 12px;
  border-bottom: 1px solid var(--bordure-interne);
}
.verser-etiquette { font-size: 14px; color: var(--encre); }
.verser-etiquette b { font-weight: 500; }
.verser-somme {
  grid-column: 2; text-align: right; white-space: nowrap;
  font: 600 30px/1.1 var(--sans); letter-spacing: -0.01em;
}
.verser-somme .euro { color: var(--or-fonce); }
.verser-somme.negatif { color: var(--rouge); }
.verser-note {
  grid-column: 1 / -1; font-size: 12px; color: var(--encre-douce);
}

.verser-prorata {
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px; justify-content: center;
}
.prorata-chiffres {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; color: var(--encre-douce);
}
.barre-prorata {
  display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--filet);
}
.barre-prorata .segment { min-width: 3px; }
.segment-laurene { background: var(--or); }
.segment-cedric { background: var(--contre); }

.prorata-legende {
  list-style: none; margin: 0; padding: 0;
  display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px;
}
.prorata-legende li { display: flex; align-items: center; gap: 6px; }
.pastille { width: 8px; height: 8px; flex: none; border-radius: 2px; }
.pastille-laurene { background: var(--or); }
.pastille-cedric { background: var(--contre); }

@media (min-width: 900px) {
  .bandeau-verser {
    border-radius: 10px;
    grid-template-columns: 1fr 1fr 1.15fr;
  }
  .verser-cellule {
    padding: 22px 24px;
    grid-template-columns: 1fr; align-content: start; gap: 6px;
    border-bottom: 0; border-right: 1px solid var(--bordure-interne);
  }
  .verser-etiquette { font-size: 12.5px; color: var(--encre-douce); }
  .verser-somme {
    grid-column: auto; text-align: left;
    font-size: 38px;
  }
  .verser-note { grid-column: auto; }
  .verser-prorata { padding: 22px 24px; }
  .barre-prorata { height: 10px; border-radius: 5px; }
}

/* ── Tableaux de chiffres ────────────────────────────────────────────────── */

.tableau { width: 100%; border-collapse: collapse; }
.tableau caption { text-align: left; }

.tableau thead th {
  padding: 9px 20px; border-bottom: 1px solid var(--bordure-interne);
  font: 400 11.5px var(--sans); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--encre-faible); text-align: right; white-space: nowrap;
}
.tableau thead th:first-child { text-align: left; }

.tableau tbody th, .tableau tbody td {
  padding: 11px 20px; border-bottom: 1px solid var(--filet);
  font-size: 14px; text-align: right; vertical-align: baseline;
}
.tableau tbody th {
  font-weight: 400; text-align: left;
}
.tableau .indice { font-size: 12px; color: var(--encre-faible); }
.tableau .colonne-total { color: var(--encre-douce); }

/* Dernière ligne : la balance, posée sur l'or. */
.tableau .ligne-balance th, .tableau .ligne-balance td {
  padding: 14px 20px; border-bottom: 0;
  background: var(--or-fond); font-size: 15px; font-weight: 600;
}
.tableau .ligne-balance .colonne-total { font-weight: 500; }
.tableau .ligne-balance .indice { font-weight: 400; color: var(--or-encre); }

@media (max-width: 559px) {
  .tableau thead th, .tableau tbody th, .tableau tbody td { padding-inline: 14px; }
  .tableau .colonne-total { display: none; }
  .tableau .ligne-balance th, .tableau .ligne-balance td { padding-inline: 14px; }
}

/* ── Listes de lignes (versements, avances, catégories, exclues) ─────────── */

.ligne-cle {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; font-size: 13.5px;
}
.coche { color: var(--vert); }
.croix { color: var(--rouge); }

.chiffre-cle { font-size: 26px; font-weight: 600; }
.chiffre-cle.nul { color: var(--encre-faible); }

.liste-filets { list-style: none; margin: 0; padding: 0; }
.liste-filets > li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 10px 18px; border-top: 1px solid var(--filet); font-size: 14px;
}
.liste-filets > li:first-child { border-top: 0; }

@media (min-width: 900px) {
  .liste-filets > li { padding-inline: 20px; }
}

/* Barres de catégories (maquette 1a) */
.barres { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.barres li {
  display: grid; grid-template-columns: minmax(0, 7rem) 1fr 74px;
  align-items: center; gap: 10px; font-size: 13px;
}
.barre-libelle {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.barre-piste { height: 6px; background: var(--filet); border-radius: 3px; }
.barre {
  display: block; height: 6px; border-radius: 3px;
  background: var(--contre); min-width: 2px;
}
.barre-valeur { text-align: right; }

@media (min-width: 900px) {
  .barres li { grid-template-columns: 130px 1fr 74px; }
}

/* Lignes d'opérations resserrées : les exclues, les avances ouvertes */
.lignes-ops { display: grid; }
.lignes-ops > * {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center; gap: 4px 10px;
  padding: 9px 18px; border-top: 1px solid var(--filet); font-size: 12.5px;
}
.lignes-ops > *:first-child { border-top: 0; }
.op-date { color: var(--encre-faible); }
.op-libelle {
  font: 400 11.5px var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.op-nature {
  justify-self: start; font-size: 11.5px; padding: 2px 8px; border-radius: 4px;
  background: var(--neutre-fond); color: var(--encre-mi);
}
.op-somme { text-align: right; white-space: nowrap; }

/* Sur téléphone : la date, le libellé et le montant sur une ligne, la nature
   dessous — plutôt que le montant renvoyé seul à la ligne suivante. */
@media (max-width: 759px) {
  .lignes-ops > * { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .lignes-ops .op-somme { grid-column: 3; grid-row: 1; }
  .lignes-ops .op-nature { grid-column: 2 / -1; grid-row: 2; }
}
@media (min-width: 760px) {
  .lignes-ops > * {
    grid-template-columns: 44px minmax(0, 1fr) 130px 84px;
    padding-inline: 20px;
  }
}

/* ── Carte d'appel : ce qui reste à faire ────────────────────────────────── */

.appel {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 2px 12px;
  padding: 16px 18px; border-radius: 14px; text-decoration: none;
  background: var(--appel-fond); color: var(--appel-encre);
  border: 1px solid var(--appel-bordure);
}
.appel-titre { font-size: 15px; font-weight: 600; }
.appel-note { grid-column: 1; font-size: 12px; color: var(--appel-douce); }
.appel-fleche {
  grid-row: 1 / -1; grid-column: 2;
  font-size: 13px; color: var(--appel-accent); white-space: nowrap;
}

@media (min-width: 900px) { .appel { border-radius: 10px; padding: 16px 20px; } }

/* ── Boutons et pilules de choix ─────────────────────────────────────────── */

.bouton {
  font: 500 15px var(--sans);
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 18px; border: 0; border-radius: 12px;
  background: var(--action); color: var(--action-encre);
  cursor: pointer; text-decoration: none; text-align: center;
}
.bouton-secondaire {
  background: var(--surface); color: var(--encre);
  border: 1px solid var(--controle);
}
.bouton:disabled { opacity: 0.55; cursor: progress; }

@media (min-width: 900px) {
  .bouton {
    font-size: 13px; min-height: 0; padding: 9px 14px; border-radius: 7px;
  }
}

.lien { color: var(--or-encre); font-weight: 500; text-decoration: none; }
.lien:hover { text-decoration: underline; }

/* Segments : filtres de la liste, choix d'une personne (maquette 1j) */
.segments {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 2px; scrollbar-width: none;
}
.segments::-webkit-scrollbar { display: none; }
.segment-choix {
  font: 400 12.5px var(--sans); white-space: nowrap; cursor: pointer;
  min-height: 34px; padding: 5px 12px; border-radius: 6px;
  border: 1px solid var(--controle); background: var(--surface); color: var(--encre-mi);
}
.segment-choix[aria-selected="true"], .segment-choix[aria-pressed="true"] {
  background: var(--action); color: var(--action-encre); border-color: var(--action);
}
.compte { opacity: 0.6; }

/* ── Liste des opérations (vocabulaire de la maquette 1g) ────────────────── */

.liste-operations {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: 14px; overflow: hidden;
}
.operation { border-top: 1px solid var(--filet); }
.operation:first-child { border-top: 0; }
.operation.a-verifier { box-shadow: inset 3px 0 0 var(--rouge); }

.operation-resume {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer;
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  gap: 3px 10px; padding: 11px 16px;
}
.operation-resume:disabled { cursor: default; }
.operation-resume:focus-visible { outline: 2px solid var(--or-fonce); outline-offset: -2px; }

.operation-date { font-size: 12.5px; color: var(--encre-faible); padding-top: 1px; }
.operation-libelle { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.operation-titre {
  font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.operation-brut {
  font: 400 11.5px var(--mono); color: var(--encre-faible);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.operation-somme { text-align: right; white-space: nowrap; font-size: 14px; }
.operation-somme.credit { color: var(--vert); }
.operation-classement {
  grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--encre-douce);
}

/* Étiquettes de provenance du classement (maquette 1g, colonne « Source ») */
.source {
  font-size: 11.5px; padding: 2px 8px; border-radius: 4px; white-space: nowrap;
  background: var(--neutre-fond); color: var(--encre-mi);
}
.source-regle { background: var(--neutre-fond); color: var(--encre-mi); }
.source-defaut { background: var(--neutre-fond); color: var(--encre-faible); }
.source-auto { background: var(--vert-fond); color: var(--vert); }
.source-corrigee { background: var(--or-fond); color: var(--or-encre); }
.source-verifier { background: var(--rouge-fond); color: var(--rouge); }

.operation-detail { display: none; padding: 0 16px 14px; }
.operation.ouverte .operation-detail { display: block; }
@media (min-width: 560px) { .operation-detail { padding-left: calc(3.2rem + 26px); } }

.formulaire-correction {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 8px;
}
.formulaire-correction label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px; color: var(--encre-douce);
}
.formulaire-correction select {
  font: 400 14px var(--sans); min-height: 44px; padding: 0 10px;
  border: 1px solid var(--controle); border-radius: 8px;
  background: var(--surface); color: var(--encre);
}
.actions-correction { display: flex; flex-wrap: wrap; gap: 8px; }
.explication-nature {
  flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--encre-douce);
}

@media (min-width: 900px) { .liste-operations { border-radius: 10px; } }

/* ── Revue « À vérifier » (maquette 1e / 1f) ─────────────────────────────── */

.revue { flex: 1; display: flex; flex-direction: column; gap: 14px; }

.revue-entete {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 10px; font-size: 14px;
}
.revue-retour { color: var(--encre-faible); text-decoration: none; justify-self: start; }
.revue-titre { font-weight: 600; }
.revue-avancement { color: var(--encre-faible); justify-self: end; }

.jauge { height: 4px; border-radius: 2px; background: var(--bordure); }
.jauge span { display: block; height: 4px; border-radius: 2px; background: var(--or); }

.revue-carte {
  border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.revue-meta {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12.5px; color: var(--encre-douce);
}
.revue-libelle { font: 500 13px var(--mono); overflow-wrap: anywhere; }
.revue-somme { font: 600 34px/1.1 var(--sans); }
.revue-somme.credit { color: var(--vert); }
.revue-motif {
  align-self: flex-start; font-size: 12px; padding: 4px 9px; border-radius: 5px;
  background: var(--rouge-fond); color: var(--rouge);
}
.revue-motif.propose { background: var(--or-fond); color: var(--or-encre); }

.revue-etiquette { font-size: 12.5px; color: var(--encre-douce); }

.grille-natures { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tuile-nature {
  all: unset; box-sizing: border-box; cursor: pointer;
  min-height: 52px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--bordure); background: var(--surface);
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
}
.tuile-nature:focus-visible { outline: 2px solid var(--or-fonce); outline-offset: 2px; }
.tuile-nature[aria-pressed="true"] {
  border: 1.5px solid var(--or-fonce); background: var(--or-fond);
}
.tuile-libelle { font-size: 14px; font-weight: 500; }
.tuile-sous { font-size: 11.5px; color: var(--encre-douce); }

.revue-pied {
  margin-top: auto; padding-top: 4px;
  display: grid; grid-template-columns: 1fr 2fr; gap: 10px;
}
.revue-pied .bouton { width: 100%; }

.revue-fini {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
}

@media (min-width: 900px) {
  .revue { max-width: 560px; }
  .revue-pied .bouton { min-height: 44px; font-size: 14px; border-radius: 9px; }
}

/* ── Import (maquette 1g) ───────────────────────────────────────────────── */

.zone-depot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 36px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--controle); border-radius: 10px;
  background: var(--papier-doux);
}
.zone-depot:focus-visible, .zone-depot.survol {
  border-color: var(--or-fonce); background: var(--or-fond); outline: none;
}
.zone-depot-titre { font-size: 15px; font-weight: 500; }

.bande-fichier {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px;
  display: grid; grid-template-columns: 1fr; overflow: hidden;
}
.bande-cellule {
  padding: 16px 20px; display: flex; flex-direction: column; gap: 5px;
  border-top: 1px solid var(--bordure-interne);
}
.bande-cellule:first-child { border-top: 0; }
.bande-cellule.appuyee { background: var(--papier-doux); }
.bande-etiquette { font-size: 12px; color: var(--encre-douce); }
.bande-valeur { font-size: 14px; font-weight: 500; }
.bande-mono { font: 500 13px var(--mono); overflow-wrap: anywhere; }

@media (min-width: 760px) {
  .bande-fichier { grid-template-columns: 1fr 1.3fr 1fr; }
  .bande-cellule { border-top: 0; border-left: 1px solid var(--bordure-interne); }
  .bande-cellule:first-child { border-left: 0; }
}

.compteurs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compteur {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 4px;
}
.compteur-etiquette { font-size: 12px; color: var(--encre-douce); }
.compteur-valeur { font-size: 26px; font-weight: 600; }
.compteur-neuf { border-color: var(--or); }
.compteur-neuf .compteur-etiquette { color: var(--or-encre); }
.compteur-terne .compteur-valeur { color: var(--encre-faible); }
.compteur-rejet { background: var(--rouge-bande); border-color: var(--rouge-bordure); }
.compteur-rejet .compteur-etiquette, .compteur-rejet .compteur-valeur { color: var(--rouge); }

@media (min-width: 760px) { .compteurs { grid-template-columns: repeat(4, 1fr); } }

.actions-import { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

/* Le rapport s'insere dans le flux de la page : meme rythme vertical. */
.resultat-import, .resultat-invitation {
  display: flex; flex-direction: column; gap: 14px;
}
.resultat-import:empty, .resultat-invitation:empty { display: none; }

/* ── Bandes de message ──────────────────────────────────────────────────── */

.bande {
  margin: 0; padding: 10px 14px; border-radius: 8px;
  font-size: 13px; line-height: 1.5;
}
.bande-info { background: var(--neutre-fond); color: var(--encre-mi); }
.bande-bon { background: var(--vert-fond); color: var(--vert); }
.bande-attention { background: var(--or-fond); color: var(--or-encre); }
.bande-alerte { background: var(--rouge-bande); color: var(--rouge-fonce); }

/* ── Dialogue de clôture (maquette 1k) ──────────────────────────────────── */

.dialogue {
  width: 620px; max-width: calc(100% - 24px); padding: 0; border: 0;
  border-radius: 14px; background: var(--surface); color: var(--encre);
  box-shadow: var(--ombre-dialogue);
}
.dialogue::backdrop { background: var(--voile); }

.dialogue-tete {
  padding: 24px 24px 0; display: flex; flex-direction: column; gap: 8px;
}
.dialogue-tete h2 { font-size: 19px; }
.dialogue-tete p {
  margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--encre-mi);
  text-wrap: pretty;
}
.dialogue-recap {
  margin: 20px 24px 0; border: 1px solid var(--bordure);
  border-radius: 10px; overflow: hidden;
}
.dialogue-recap .tableau thead th {
  padding: 8px 16px; background: var(--papier-doux); border-bottom: 0;
  font-size: 11px;
}
.dialogue-recap .tableau tbody th,
.dialogue-recap .tableau tbody td {
  padding: 9px 16px; border-bottom: 0; border-top: 1px solid var(--filet);
  font-size: 13.5px;
}
.dialogue-recap .tableau .ligne-balance th,
.dialogue-recap .tableau .ligne-balance td {
  padding: 11px 16px; border-top: 1px solid var(--bordure);
}
.dialogue-bande { margin: 16px 24px 0; }
.dialogue-bande-ligne {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.dialogue-note { margin: 12px 24px 0; font-size: 12.5px; color: var(--encre-douce); }
.dialogue-pied {
  padding: 22px 24px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px;
}
.dialogue-pied .bouton { min-height: 44px; font-size: 14px; border-radius: 8px; padding: 0 16px; }

@media (min-width: 900px) {
  .dialogue-tete { padding: 24px 28px 0; }
  .dialogue-tete h2 { font-size: 21px; }
  .dialogue-recap, .dialogue-bande, .dialogue-note { margin-inline: 28px; }
  .dialogue-pied { padding: 22px 28px; }
  .dialogue-pied .bouton { padding: 10px 16px; }
}

/* ── Aide ───────────────────────────────────────────────────────────────── */

.aide, .aide-natures { scroll-margin-top: 80px; }
/* L'aide est du texte suivi : les cartes portent leur marge elles-memes. */
.carte.aide { padding: 16px 18px; }
.carte.aide > * + * { margin-top: 10px; }
.aide p { margin: 0; line-height: 1.55; }
.aide h1 { font-size: 20px; }

/* Un libelle de bouton cite dans une phrase (ecran Aide). */
.bouton-texte {
  display: inline-block; padding: 2px 10px; border-radius: 6px;
  border: 1px solid var(--controle); font-size: 12.5px; font-weight: 500;
  color: var(--encre);
}
.titre-hors-carte { margin: 4px 2px 0; }

.sommaire { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.sommaire a {
  display: inline-block; padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--controle); background: var(--surface);
  text-decoration: none; font-size: 12.5px; color: var(--encre-mi);
}

.etapes { margin: 0; padding-left: 1.2rem; display: grid; gap: 6px; line-height: 1.55; }

.guide { list-style: none; margin: 0; padding: 0; counter-reset: guide; }
.guide li {
  counter-increment: guide;
  display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  align-items: baseline; gap: 4px 10px;
  padding: 10px 0; border-top: 1px solid var(--filet); font-size: 13.5px;
}
.guide li:first-child { border-top: 0; }
.guide li::before { content: counter(guide) "."; color: var(--encre-faible); }
@media (max-width: 559px) {
  .guide li { grid-template-columns: 1.5rem minmax(0, 1fr); }
  .guide li .lien { grid-column: 2; }
}

.aide-natures { display: grid; gap: 12px; }
@media (min-width: 760px) {
  .aide-natures { grid-template-columns: 1fr 1fr; }
  .aide-natures .titre-hors-carte { grid-column: 1 / -1; }
}
.nature-entete {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: 8px;
}
.nature-entete h3 { font-size: 15px; }
.nature-resume { font-weight: 500; }
.nature-details { margin: 0; display: grid; gap: 2px; }
.nature-details dt {
  margin-top: 8px; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--encre-faible);
}
.nature-details dd { margin: 0; font-size: 13.5px; line-height: 1.55; }
.nature-details ul { margin: 2px 0 0; padding-left: 1.1rem; }

/* ── Connexion, compte, utilisateurs (spec §2) ──────────────────────────── */

/* Sans session, l'application se réduit à son écran de connexion : ni
   onglets, ni barre latérale, rien à cliquer qui mènerait à un 401. */
body.sans-session .entete-app { display: none; }
body.sans-session { padding-bottom: 0; background-image: none; }
@media (min-width: 900px) {
  body.sans-session { display: flex; grid-template-columns: none; }
}

.connexion {
  width: 100%; max-width: 380px; margin: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 24px 0;
}
.connexion-marque {
  font: 600 28px var(--serif); color: var(--encre); text-align: center;
  margin-bottom: 4px;
}
.connexion h1 { font-size: 20px; }

.formulaire-connexion, .formulaire-mdp, .formulaire-invitation {
  display: flex; flex-direction: column; gap: 12px; margin: 0;
}
.formulaire-connexion label,
.formulaire-mdp label,
.formulaire-invitation label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; color: var(--encre-douce);
}
.formulaire-connexion input,
.formulaire-mdp input,
.formulaire-invitation input {
  font: 400 15px var(--sans); min-height: 46px; padding: 0 12px;
  border: 1px solid var(--controle); border-radius: 9px;
  background: var(--surface); color: var(--encre);
}
.formulaire-connexion input:focus-visible,
.formulaire-mdp input:focus-visible,
.formulaire-invitation input:focus-visible {
  border-color: var(--or-fonce); outline: 1px solid var(--or-fonce);
}

/* Vide, le paragraphe d'erreur ne doit pas réserver de place. */
.erreur-connexion, .erreur-formulaire {
  margin: 0; font-size: 13px; color: var(--rouge);
}
.erreur-connexion:empty, .erreur-formulaire:empty { display: none; }

.actions-formulaire { display: flex; flex-wrap: wrap; gap: 8px; }

.bouton-petit { min-height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
@media (min-width: 900px) { .bouton-petit { padding: 6px 12px; } }

/* Le mot de passe engendré, montré une seule fois. */
.secret {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; border-radius: 10px;
  background: var(--or-fond); border: 1px solid var(--or);
}
.secret-etiquette { font-size: 12px; color: var(--or-encre); }
.secret-valeur {
  font: 500 18px var(--mono); color: var(--encre);
  overflow-wrap: anywhere; user-select: all;
}

.liste-filets .utilisateur-identite {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.liste-filets .utilisateur-actions {
  display: flex; align-items: center; gap: 8px; flex: none;
}

/* Accès au compte depuis la barre du haut, sur téléphone seulement. */
.acces-compte {
  margin-left: auto; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  color: var(--encre-douce); text-decoration: none;
}
.acces-compte svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
/* La pilule d'état garde sa place : le bouton vient après elle. */
.etat-mois + .acces-compte { margin-left: 8px; }

@media (max-width: 899px) {
  /* Cinq onglets en bas, pas sept : le compte et les utilisateurs se
     rejoignent par la barre du haut (maquette 1d). */
  .onglets a[data-onglet="compte"],
  .onglets a[data-onglet="utilisateurs"] { display: none; }
}
@media (min-width: 900px) {
  .acces-compte { display: none; }
}

/* ── Chargement et annonces ─────────────────────────────────────────────── */

.chargement { display: flex; justify-content: center; gap: 6px; padding: 48px 0; }
.chargement span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--encre-inerte);
  animation: pulsation 1s infinite ease-in-out;
}
.chargement span:nth-child(2) { animation-delay: 0.15s; }
.chargement span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulsation { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.annonce {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 10px;
  background: var(--encre); color: var(--papier); font-size: 13px;
  transition: opacity 0.2s, transform 0.2s;
}
.annonce.visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .annonce { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) {
  .chargement span { animation: none; opacity: 0.6; }
  .annonce { transition: none; }
}
