/* Moni : le téléphone d'abord (ADR 0002). Des jetons, deux thèmes (celui de l'appareil), des onglets au pouce, en bas. */

:root {
  --fond: #f6f7f5;
  --surface: #ffffff;
  --texte: #1c2321;
  --discret: #56615d;
  --trait: #d9dedb;
  --accent: #0f766e;
  --accent-texte: #ffffff;
  --refus: #b42318;
  --ok: #067647;
  --e-1: 4px;
  --e-2: 8px;
  --e-3: 12px;
  --e-4: 16px;
  --rayon: 10px;
  --onglets: 64px;
  /* Les graphiques (lot P6-1) : la palette de référence de la skill dataviz, ses deux premières séries (validées sur
     ces surfaces : la séparation pour les daltoniens, le plancher de vision normale ; l'orange sous 3:1 en clair, ses
     valeurs restent en texte), la grille et l'axe en traits fins. */
  --serie-1: #257de0;
  --serie-2: #f47230;
  --grille: #e7e7e7;
  --axe: #c2c2c2;
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121615;
    --surface: #1b2120;
    --texte: #e8ecea;
    --discret: #a3ada9;
    --trait: #2e3634;
    --accent: #2dd4bf;
    --accent-texte: #0b1211;
    --refus: #f97066;
    --ok: #47cd89;
    --serie-1: #338ced;
    --serie-2: #e76624;
    --grille: #303030;
    --axe: #474747;
  }
}

* { box-sizing: border-box; }
/* Un élément caché le reste, quel que soit son style (un libellé en `display: block`, lot P2-4). */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.4;
  padding-bottom: calc(var(--onglets) + env(safe-area-inset-bottom));
}

.aller-au-contenu { position: absolute; left: -999px; }
.aller-au-contenu:focus { left: var(--e-2); top: var(--e-2); background: var(--surface); padding: var(--e-2); z-index: 10; }

.tete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--e-3);
  padding: calc(var(--e-3) + env(safe-area-inset-top)) var(--e-4) var(--e-2);
}

.marque { margin: 0; font-size: 1.25rem; color: var(--accent); letter-spacing: 0.02em; }
.statut { margin: 0; color: var(--discret); font-size: 0.85rem; }

main { padding: 0 var(--e-4) var(--e-4); outline: none; }
main h2 { font-size: 1.15rem; margin: var(--e-2) 0 var(--e-3); }

.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: var(--e-3) var(--e-4);
  margin-bottom: var(--e-3);
}

.note { color: var(--discret); font-size: 0.9rem; }
.refus { color: var(--refus); }

.onglets {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--onglets) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--trait);
}

.onglets button {
  border: 0;
  border-radius: 0;
  padding: 0 var(--e-1);
  background: none;
  color: var(--discret);
  font: inherit;
  font-size: 0.78rem;
  min-height: 44px;
  cursor: pointer;
}

.onglets button[aria-current="page"] { color: var(--accent); font-weight: 600; box-shadow: inset 0 3px 0 var(--accent); }
.onglets button:focus-visible, main :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Les écrans (lot P1-4) : des cartes, des lignes, des formulaires au pouce (44 px), les montants en chiffres alignés. */

.carte h3 {
  margin: 0 0 var(--e-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--discret);
}

.lignes { list-style: none; margin: 0; padding: 0; }
.lignes li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--e-3);
  padding: var(--e-2) 0;
  border-top: 1px solid var(--trait);
}
.lignes li:first-child { border-top: 0; }
.operations li { padding: 0; }
.quoi { min-width: 0; overflow-wrap: anywhere; }
.quoi small { display: block; color: var(--discret); font-size: 0.8rem; }
.montant { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.positif { color: var(--ok); }

button {
  font: inherit;
  min-height: 44px;
  padding: 0 var(--e-4);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--texte);
  cursor: pointer;
}
button.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); font-weight: 600; }
button.danger { color: var(--refus); border-color: var(--refus); }
button.lien { border: 0; background: none; color: var(--accent); padding: 0; }
/* Un libellé qui se donne l'air d'un bouton (le choix d'un fichier) ; le champ caché reste lisible aux lecteurs d'écran. */
label.bouton {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--e-4);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  cursor: pointer;
}
label.bouton:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ajout { margin-top: var(--e-3); }
.ajout summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; }
.ajout[open] summary { margin-bottom: var(--e-2); }
.ligne {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--e-3);
  padding: var(--e-2) 0;
  border: 0;
  border-radius: 0;
  background: none;
  text-align: left;
}
.ligne[aria-expanded="true"] .quoi { color: var(--accent); }

input, select {
  font: inherit;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 var(--e-3);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--fond);
  color: var(--texte);
}
input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type="file"] { padding: var(--e-2); }
.formulaire label { display: block; margin-bottom: var(--e-3); }
.formulaire label > span, .filtres label > span {
  display: block;
  margin-bottom: var(--e-1);
  font-size: 0.8rem;
  color: var(--discret);
}
.sens { display: flex; gap: var(--e-2); margin: 0 0 var(--e-3); padding: 0; border: 0; }
.sens legend { padding: 0; margin-bottom: var(--e-1); font-size: 0.8rem; color: var(--discret); }
.formulaire .sens label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--e-2);
  margin: 0;
  min-height: 44px;
  padding: 0 var(--e-3);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
}
.formulaire .sens label:has(:checked) { border-color: var(--accent); color: var(--accent); font-weight: 600; }
/* Trois sens tiennent à 390 px (lot P2-4) : un sélecteur segmenté, le rond du bouton radio caché, le libellé centré. */
.formulaire .sens label { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 var(--e-2); }
.sens input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.formulaire .sens label:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.deux, .filtres { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-3); }
.deux > *, .filtres > * { min-width: 0; }
.filtres { margin-bottom: var(--e-3); }
.actions { display: flex; flex-wrap: wrap; gap: var(--e-2); margin: var(--e-2) 0; }
.retrait p { margin: 0; }
.refus:empty { display: none; }
.avertissement { margin-top: var(--e-3); padding: var(--e-3); border: 1px solid var(--refus); border-radius: var(--rayon); }
.avertissement p { margin: 0 0 var(--e-2); }

.barre-mois {
  display: grid;
  grid-template-columns: 44px 1fr 44px auto;
  align-items: center;
  gap: var(--e-2);
  margin-bottom: var(--e-3);
}
.barre-mois p { margin: 0; text-align: center; font-weight: 600; }
.barre-mois p small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--discret); }
.barre-mois button:not(.principal) { padding: 0; font-size: 1.3rem; }

.bilan { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-3); margin: 0; }
.bilan dt { font-size: 0.8rem; color: var(--discret); }
.bilan dd { margin: 0; font-size: 1.3rem; font-weight: 600; text-align: left; }
.bilan.carte { margin-bottom: var(--e-3); }
.bilan.trois { grid-template-columns: repeat(3, 1fr); }
.bilan.trois dd { font-size: 1.05rem; }

/* Les enveloppes (lot P2-1) : une ligne, puis sa jauge ; une jauge dépassée en rouge (l'Accueil, lot P2-2). */
.enveloppes li { display: block; padding: 0 0 var(--e-2); }
progress.jauge {
  display: block;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 3px;
  background: var(--trait);
  overflow: hidden;
  appearance: none;
}
progress.jauge::-webkit-progress-bar { background: var(--trait); }
progress.jauge::-webkit-progress-value { background: var(--accent); }
progress.jauge::-moz-progress-bar { background: var(--accent); }
progress.jauge.depasse::-webkit-progress-value { background: var(--refus); }
progress.jauge.depasse::-moz-progress-bar { background: var(--refus); }

/* L'Accueil (lot P2-2) : le reste du mois en grand, l'action au pouce. */
.grand { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.15; text-align: left; }
#ce-mois .jauge { margin: var(--e-2) 0 var(--e-3); }
.carte h3 small { font-weight: 400; text-transform: none; letter-spacing: 0; }
.rapides { margin: 0 0 var(--e-3); }
.rappel { border-color: var(--accent); }

/* Vos catégories (lot P8-1) : rangées par groupe, chaque groupe sous son étiquette ; fondre, sous le formulaire. */
.groupe-categories h4 { margin: var(--e-3) 0 var(--e-1); font-size: 0.8rem; font-weight: 600; color: var(--discret); }
.groupe-categories:first-of-type h4 { margin-top: 0; }
.fondre { display: grid; gap: var(--e-2); margin-top: var(--e-3); }
.fondre p { margin: 0; }

/* Une opération répartie (lot P8-2) : chaque part sur sa ligne, la catégorie, le montant, le geste qui la retire. */
.repartition { display: grid; gap: var(--e-2); margin-bottom: var(--e-3); }
.titre-parts { margin: 0; font-size: 0.8rem; color: var(--discret); }
.parts { display: grid; gap: var(--e-2); }
.part { display: grid; grid-template-columns: 1fr 7.5rem 44px; gap: var(--e-2); align-items: center; }
.part > * { min-width: 0; }
#parts-reste { margin: 0; }

/* L'export pour un tableur (lot P8-4), sous la liste. */
#exporter-csv { margin-top: var(--e-3); text-align: left; }
.rappel p { margin: 0; }
/* La recherche (lot P6-3) : le champ, sa période, sur une ligne au pouce. */
/* Le champ sur sa propre ligne (lot P7-6) : à 390 px, son indication se lisait coupée. */
.recherche { display: grid; grid-template-columns: 1fr auto; gap: var(--e-2); margin-bottom: var(--e-3); }
.recherche input[type="search"] { grid-column: 1 / -1; }
.recherche > * { min-width: 0; }
.recherche select { width: auto; justify-self: start; }

/* Les récurrences (lot P2-3) : le montant et ses gestes au bout de la ligne ; une échéance passe à la ligne au besoin. */
.fin-de-ligne { display: flex; align-items: center; gap: var(--e-2); flex-shrink: 0; margin-left: auto; }
button.petit { padding: 0 var(--e-3); font-size: 0.85rem; }
/* Un geste qui défait se tient discret ; il ne passe au rouge qu'au moment de confirmer (vu à la relecture : cinq
   « Retirer » rouges criaient sur une seule carte). */
button.discret { color: var(--discret); }
button[data-confirmer="1"] { color: var(--refus); border-color: var(--refus); }
.lignes li.echeance { flex-wrap: wrap; align-items: center; }
.echeance .quoi { flex: 1 1 55%; }
.quoi small.proposee { color: var(--accent); }
.montant.virement { color: var(--discret); }

/* L'import d'un relevé (lot P3-2) : le gabarit, les propositions cochées. */
.ok { color: var(--ok); }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--accent); }
.formulaire label.case { display: flex; align-items: center; gap: var(--e-2); margin-top: 1.4rem; }
.gabarit { margin: var(--e-2) 0 var(--e-3); }
.propositions li { align-items: center; }
.coche { display: flex; align-items: center; gap: var(--e-3); min-width: 0; min-height: 44px; flex: 1; cursor: pointer; }
.avertissement ul { margin: 0; padding-left: var(--e-4); }
.propositions li.deja { color: var(--discret); }

/* Une pièce lue (lot P4-3) : chaque champ, sa confiance en mots, la ligne d'où il vient. */
textarea {
  font: inherit;
  width: 100%;
  min-height: 7.5rem;
  padding: var(--e-2) var(--e-3);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--fond);
  color: var(--texte);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.82rem;
}
.confiance { font-size: 0.72rem; padding: 0 6px; border: 1px solid var(--trait); border-radius: 999px; }
.c-sur { color: var(--ok); border-color: var(--ok); }
.c-doute { color: var(--refus); border-color: var(--refus); }
.formulaire .source { display: block; margin-top: 2px; color: var(--discret); font-size: 0.78rem; overflow-wrap: anywhere; }
.detail-lu { margin-bottom: var(--e-3); }
/* Chaque ligne lue, sa catégorie sous son libellé (lot P8-6). */
.ligne-lue select { display: block; width: 100%; margin-top: var(--e-1); font-size: 0.85rem; }

/* La capture et la pièce jointe (lot P5-1). */
.capture canvas { display: block; max-width: 100%; height: auto; margin: var(--e-2) 0; border-radius: var(--rayon);
  touch-action: none; }
.piece-jointe { display: block; max-width: 100%; max-height: 60vh; margin: 0 0 var(--e-3); border-radius: var(--rayon);
  border: 1px solid var(--trait); }
.detail-lu summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; }
/* Une ligne rapprochée : « C'en est une autre » passe sous elle, aligné sur son texte ; la case garde sa taille (vu à la
   relecture : le bouton glissé entre le libellé et le montant, la case écrasée en un point). */
.propositions li { flex-wrap: wrap; }
.propositions .montant { order: 1; }
.propositions .separer { order: 2; flex-basis: 100%; text-align: left; padding-left: calc(var(--e-3) + 20px);
  min-height: 36px; font-size: 0.85rem; }
.coche input[type="checkbox"] { flex-shrink: 0; width: 20px; height: 20px; }
.rapides .principal { flex: 1; }

/* Les rapports (lot P6-1) : des marques fines, une grille effacée, les nombres en chiffres alignés. */
.graphique { display: block; width: 100%; height: auto; overflow: visible; margin: var(--e-2) 0; }
.graphique .grille { stroke: var(--grille); stroke-width: 1; }
.graphique .axe { stroke: var(--axe); stroke-width: 1; }
.graphique .graduation { fill: var(--discret); font-size: 11px; font-variant-numeric: tabular-nums; }
.graphique .etiquette { fill: var(--texte); font-size: 12px; }
.graphique .trace { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphique .trace.serie-1 { stroke: var(--serie-1); }
.graphique .trace.serie-2 { stroke: var(--serie-2); }
.graphique .point { stroke: var(--surface); stroke-width: 2; }
.graphique .point.serie-1 { fill: var(--serie-1); }
.graphique .point.serie-2 { fill: var(--serie-2); }
.graphique .reticule { stroke: var(--discret); stroke-width: 1; }
.graphique .cible { fill: transparent; cursor: pointer; outline: none; }
.graphique .cible:focus-visible { stroke: var(--accent); stroke-width: 1; }
.barre { display: block; width: 100%; height: 8px; margin-top: var(--e-1); }
.barre path { fill: var(--serie-1); }
.rapport-categories li { display: block; }
.rapport-categories .rang { display: flex; justify-content: space-between; align-items: baseline; gap: var(--e-3); }
.legende { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2) var(--e-4); font-size: 0.85rem; }
.legende .unite { color: var(--discret); margin-left: auto; }
.cle { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: var(--e-1); }
.cle.serie-1 { background: var(--serie-1); }
.cle.serie-2 { background: var(--serie-2); }
.infobulle { min-height: 2.6em; margin: var(--e-2) 0 0; }
.tableau-vue summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; }
table.tableau { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tableau th, .tableau td { padding: var(--e-1) var(--e-1); border-top: 1px solid var(--trait); text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 400; }
.tableau th:first-child { text-align: left; }
.tableau thead th { color: var(--discret); border-top: 0; }

@media (min-width: 720px) {
  body { max-width: 720px; margin: 0 auto; }
  .onglets { max-width: 720px; margin: 0 auto; }
}
