/* =========================================================
   Mon Budget — styles
   Mobile d'abord, puis adaptation PC à partir de 800px.
   ========================================================= */

:root {
  --fond: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #f0f3f2;
  --texte: #13221d;
  --texte-doux: #5f6e68;
  --bordure: #e2e8e5;
  --principal: #12805c;
  --principal-texte: #ffffff;
  --positif: #1f8a5b;
  --negatif: #c8463d;
  --attention: #b97a0c;
  /* Graphiques : couleurs des séries (palette validée pour le daltonisme) */
  --serie-revenus: #2a78d6;
  --serie-depenses: #eb6834;
  --serie-tresorerie: #1baf7a;
  --mois-courant: #eaf1fd;
  --grille: #e8ebe9;
  --axe: #c3c9c6;
  --ombre: 0 1px 2px rgba(16, 24, 40, .05);
  --rayon: 10px;
  --largeur-nav: 232px;
  /* Menu : vert foncé, identique en mode clair et sombre */
  --nav-fond: linear-gradient(180deg, #0b3a31 0%, #0f5142 55%, #157058 100%);
  --nav-texte: rgba(255, 255, 255, .78);
  --nav-actif: #1f9e68;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121715;
    --surface: #1b2220;
    --surface-2: #252e2b;
    --texte: #e7eeeb;
    --texte-doux: #9aa8a2;
    --bordure: #2e3835;
    --principal: #3fb391;
    --principal-texte: #08130f;
    --positif: #4cc28a;
    --negatif: #ff7b70;
    --attention: #f0b545;
    --serie-revenus: #3987e5;
    --serie-depenses: #d95926;
    --serie-tresorerie: #199e70;
    --mois-courant: #1c2a3a;
    --grille: #2c3633;
    --axe: #3e4a46;
    --ombre: none;
  }
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; }

a { color: var(--principal); }

.positif { color: var(--positif); }
.negatif { color: var(--negatif); }
.texte-doux { color: var(--texte-doux); }

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: flex;
  gap: 2px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: #0d473b;
  background: var(--nav-fond);
}

.nav__logo { display: none; }

.nav__lien {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 10px;
  color: var(--nav-texte);
  font-size: .68rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav__lien[aria-current="page"] { background: var(--nav-actif); color: #fff; font-weight: 600; }

/* Icônes fines (traits), dessinées en SVG dans index.html */
.icone {
  width: 20px; height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav__icone { display: grid; place-items: center; }

/* ---------- Contenu ---------- */

.contenu {
  max-width: 760px;
  margin: 0 auto;
  /* En app installée sur iPhone, la barre d'état (heure, batterie) passe par-dessus le haut de l'écran */
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom));
}

.entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.entete h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }

.entete__titre { display: flex; align-items: center; gap: 4px; }
.entete__titre h1 { margin-right: 6px; }

/* Icônes Statistiques / Paramètres : seulement sur téléphone (sur PC, les liens sont dans le menu) */
.entete__reglages {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--surface);
  color: var(--texte-doux);
  text-decoration: none;
}
.entete__reglages:hover { color: var(--texte); }
.entete__reglages .icone { width: 18px; height: 18px; }
.nav__lien--pc { display: none; }

/* Phrase d'explication sous le titre de chaque écran */
.intro {
  margin: -6px 0 20px;
  padding-left: 12px;
  border-left: 3px solid var(--principal);
  font-weight: 600;
  font-size: .9rem;
  color: var(--texte-doux);
}

/* Sélecteur de mois : un seul bouton à bordure, comme un champ de date */
.mois {
  display: flex;
  align-items: center;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--ombre);
}

.mois__btn {
  width: 34px; height: 36px;
  border: none;
  background: none;
  color: var(--texte-doux);
  font-size: 1.2rem;
  cursor: pointer;
}
.mois__btn:hover { color: var(--texte); background: var(--surface-2); }
.mois__btn:first-child { border-radius: 8px 0 0 8px; }
.mois__btn:last-child { border-radius: 0 8px 8px 0; }

.mois__libelle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
  padding: 0 8px;
  border-left: 1px solid var(--bordure);
  border-right: 1px solid var(--bordure);
  font-weight: 600;
  font-size: .9rem;
}
.mois__libelle .icone { width: 16px; height: 16px; color: var(--texte-doux); }

/* ---------- Cartes et blocs ---------- */

.cartes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.carte, .bloc {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

.carte { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.carte--solde { grid-column: 1 / -1; padding: 18px 16px; }
.carte__label { font-size: .85rem; color: var(--texte-doux); }
.carte__valeur { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.carte--solde .carte__valeur { font-size: 2rem; }

.bloc { padding: 16px; margin-top: 16px; }
.bloc h2 { margin-bottom: 12px; }
.bloc p { margin: 0 0 12px; }
.bloc p:last-child { margin-bottom: 0; }

.bloc__entete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.bloc__entete h2 { margin-bottom: 0; }

.vide {
  margin: 0;
  padding: 16px 0;
  text-align: center;
  color: var(--texte-doux);
}

.banniere {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--rayon);
  background: var(--surface-2);
  background: color-mix(in srgb, var(--principal) 12%, var(--surface));
  font-size: .9rem;
}

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

.repartition { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.repartition__haut {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: .9rem;
}

.repartition__montant { color: var(--texte-doux); font-variant-numeric: tabular-nums; white-space: nowrap; }

.piste { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.remplissage { height: 100%; border-radius: 4px; }

/* ---------- Liste des transactions ---------- */

.liste { list-style: none; margin: 0; padding: 0; }
.liste li + li { border-top: 1px solid var(--bordure); }

.ligne {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
}
.ligne:hover { background: var(--surface-2); }

.pastille {
  flex: none;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.15rem;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--c) 20%, transparent);
}

.ligne__textes { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ligne__titre { font-weight: 600; }
.ligne__sous {
  font-size: .85rem;
  color: var(--texte-doux);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ligne__montant { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

.groupe { padding-top: 12px; padding-bottom: 6px; }
.groupe__date {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--texte-doux);
  margin-bottom: 4px;
}

.resume { margin: 0; font-size: .9rem; color: var(--texte-doux); }

/* ---------- Filtres ---------- */

.filtres {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.filtres input { grid-column: 1 / -1; }

.filtres select, .filtres input, .champ input, .champ select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bordure);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1rem; /* 16px minimum : évite le zoom automatique sur iPhone */
}

/* ---------- Boutons ---------- */

.btn {
  padding: 9px 16px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn--principal { background: var(--principal); border-color: var(--principal); color: var(--principal-texte); }
.btn--principal:hover { background: var(--principal); filter: brightness(1.08); }
.btn--danger { color: var(--negatif); }

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

/* Les deux grands boutons d'ajout en haut de l'écran Transactions */
.ajout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.ajout__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  border: none;
  border-radius: var(--rayon);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--ombre);
  transition: transform .1s, filter .15s;
}
.ajout__btn:hover { filter: brightness(1.08); }
.ajout__btn:active { transform: scale(.98); }
.ajout__btn--depense { background: var(--negatif); }
.ajout__btn--revenu { background: var(--positif); }
.ajout__signe { font-size: 1.8rem; line-height: 1; }

/* ---------- Modale ---------- */

.modale {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 20px;
  border: none;
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--texte);
}
.modale::backdrop { background: rgba(0, 0, 0, .45); }
.modale h2 { margin-bottom: 16px; font-size: 1.2rem; }
.modale form { display: grid; gap: 14px; }
.modale h2 { margin-bottom: 0; }

.champ { display: flex; flex-direction: column; gap: 6px; }
.champ__label { font-size: .85rem; color: var(--texte-doux); }
.champ .champ__montant { font-size: 1.5rem; font-weight: 600; }

.bascule {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}
.bascule__option input { position: absolute; opacity: 0; pointer-events: none; }
.bascule__option span {
  display: block;
  padding: 8px;
  border-radius: 9px;
  text-align: center;
  font-weight: 600;
  color: var(--texte-doux);
  cursor: pointer;
}
.bascule__option input:focus-visible + span { outline: 2px solid var(--principal); }
.bascule__option--depense input:checked + span { background: var(--negatif); color: #fff; }
.bascule__option--revenu input:checked + span { background: var(--positif); color: #fff; }

.erreur { margin: 0; color: var(--negatif); font-size: .9rem; min-height: 1em; }
.erreur:empty { display: none; }

.modale__actions { display: flex; gap: 8px; align-items: center; }
.espace { flex: 1; }

/* ---------- Catégories (Paramètres) ---------- */

.puces { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.puce {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .85rem;
}

/* ---------- Budgets ---------- */

.remplissage--ok { background: var(--positif); }
.remplissage--attention { background: var(--attention); }
.remplissage--depasse { background: var(--negatif); }
.texte-ok { color: var(--texte-doux); }
.texte-attention { color: var(--attention); }
.texte-depasse { color: var(--negatif); font-weight: 600; }

.piste--grande { height: 12px; border-radius: 6px; margin: 6px 0; }

.carte__sous { font-size: .9rem; }

.ligne-budget {
  width: 100%;
  display: block;
  padding: 12px 4px;
  border: none;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.ligne-budget:hover { background: var(--surface-2); }

.ligne-budget__bas {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: .85rem;
  color: var(--texte-doux);
}

.ligne-simple { display: flex; align-items: center; gap: 12px; padding: 8px 4px; }
.ligne-simple > :first-child { flex: 1; }

.btn--petit { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.aide { margin: 0; font-size: .85rem; color: var(--texte-doux); }
.aide:empty { display: none; }

/* ---------- Épargne ---------- */

.barre-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.objectif:first-of-type { margin-top: 0; }

.objectif__haut { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.objectif__montants { display: flex; align-items: baseline; gap: 6px; }
.objectif__montants strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.objectif__pct { margin-left: auto; font-weight: 600; }

.objectif__conseil { font-size: .9rem; color: var(--texte-doux); margin: 8px 0 14px !important; }

.btn-icone {
  flex: none;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
.btn-icone:hover { background: var(--surface-2); }

.historique { margin-top: 14px; }
.historique summary { cursor: pointer; font-size: .9rem; color: var(--texte-doux); }
.historique ul { list-style: none; margin: 8px 0 0; padding: 0; }
.historique li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--bordure);
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}
.historique .btn-icone { color: var(--texte-doux); font-size: .8rem; }

.choix-icones { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: none; }
.choix-icones legend { padding: 0; margin-bottom: 6px; }
.choix-icones input { position: absolute; opacity: 0; pointer-events: none; }
.choix-icones span {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 1.3rem;
  cursor: pointer;
}
.choix-icones input:checked + span { border-color: var(--principal); }
.choix-icones input:focus-visible + span { outline: 2px solid var(--principal); outline-offset: 2px; }

/* ---------- Abonnements ---------- */

.ajout--seul { grid-template-columns: 1fr; }
.ajout--seul .ajout__btn { flex-direction: row; justify-content: center; gap: 10px; }
.ajout__btn--principal { background: var(--principal); color: var(--principal-texte); }

.ligne--pause { opacity: .6; }
.ligne__unite { font-weight: 400; font-size: .8rem; color: var(--texte-doux); }

.champs-cote { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }

.case { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.case input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--principal); flex: none; }
.case small { display: block; color: var(--texte-doux); font-size: .8rem; }

/* ---------- Comptes ---------- */

.sous-titre {
  margin: 24px 0 10px;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--texte-doux);
}

.bloc--comptes { margin-top: 0; }

.nouvelle-categorie { display: grid; gap: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.nouvelle-categorie .choix-icones span { background: var(--surface); }

#champs-comptes { grid-template-columns: 1fr 1fr; }
#champs-comptes.champs-cote--seul { grid-template-columns: 1fr; }

.comptes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }

.compte {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}

.compte__corps {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
}

.compte__solde { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.comptes__total { margin: 12px 0 0 !important; font-size: .95rem; }

.ajout--trois { grid-template-columns: 1fr 1fr; }
.ajout--trois .ajout__btn--virement { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 10px; padding: 12px; }
.ajout__btn--virement { background: var(--surface-2); color: var(--texte); box-shadow: none; border: 1px solid var(--bordure); }

.bascule__option--virement input:checked + span { background: var(--texte-doux); color: var(--surface); }

.filtres--comptes select:first-child { grid-column: 1 / -1; }

/* ---------- Trésorerie (onglet #statistiques) ---------- */

/* Ligne de filtres au-dessus de tout ce qu'elle concerne */
.filtre-treso {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.filtre-treso__periode,
.filtre-treso__select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--ombre);
  font-size: .9rem;
  font-weight: 600;
}
.filtre-treso__periode .icone { width: 16px; height: 16px; color: var(--texte-doux); }

.periode { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--bordure); }
.periode__btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--texte-doux);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.periode__btn[aria-pressed="true"] { background: var(--surface); color: var(--texte); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.cartes.cartes--treso { grid-template-columns: 1fr 1fr; }
.cartes--treso .carte__valeur { font-variant-numeric: normal; font-size: 1.2rem; }

.bloc--treso { padding: 16px 0 0; overflow: hidden; }

.legende-treso {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 0 16px 8px;
  font-size: .82rem;
  color: var(--texte-doux);
}
.legende-treso > span { display: inline-flex; align-items: center; gap: 6px; }
.legende-treso__droite { margin-left: auto; }
.legende__cle { width: 10px; height: 10px; border-radius: 50%; }
.legende__cle--revenus { background: var(--serie-revenus); }
.legende__cle--depenses { background: var(--serie-depenses); }
.legende__trait { width: 16px; height: 2px; border-radius: 1px; background: var(--serie-tresorerie); }

.graphique { position: relative; width: auto; min-height: 260px; margin: 0 12px 0 4px; }
.graphique__svg { display: block; overflow: visible; }
.graphique .grille { stroke: var(--grille); stroke-width: 1; }
.graphique .grille--zero { stroke: var(--axe); }
.graphique .axe { fill: var(--texte-doux); font-size: 11px; font-variant-numeric: tabular-nums; }
.graphique .axe--mois { fill: var(--texte); font-weight: 600; }
.graphique .axe--courant { font-weight: 700; }
.graphique .mois-courant { fill: var(--mois-courant); }
.graphique .serie-revenus { fill: var(--serie-revenus); }
.graphique .serie-depenses { fill: var(--serie-depenses); }
.graphique .colonne--prevision { opacity: .3; }
.graphique .ligne-tresorerie { fill: none; stroke: var(--serie-tresorerie); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphique .ligne-tresorerie--prevision { stroke-dasharray: 5 5; }
.graphique .point-tresorerie { fill: var(--serie-tresorerie); stroke: var(--surface); stroke-width: 2; }
.graphique .zone-survol { fill: transparent; cursor: pointer; outline: none; }
.graphique .zone-survol--active { fill: var(--texte); fill-opacity: .05; }

.note-prevision { margin: 4px 16px 12px !important; font-size: .8rem; color: var(--texte-doux); }

.bulle {
  position: absolute;
  top: 0;
  z-index: 2;
  min-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
  font-size: .85rem;
  pointer-events: none;
}
.bulle__titre { font-weight: 600; margin-bottom: 4px; }
.bulle__ligne { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 6px; }
.bulle__ligne strong { font-variant-numeric: tabular-nums; }
.bulle__ligne span:last-child { color: var(--texte-doux); }
.bulle__cle { width: 12px; height: 2px; border-radius: 1px; }
.bulle__cle--revenus { background: var(--serie-revenus); }
.bulle__cle--depenses { background: var(--serie-depenses); }
.bulle__cle--tresorerie { background: var(--serie-tresorerie); }

/* Tableau détaillé : défile horizontalement, la première colonne reste visible */
.tableau-treso { overflow-x: auto; border-top: 1px solid var(--bordure); }
.tableau-treso table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
.tableau-treso th, .tableau-treso td { padding: 10px 14px; border-bottom: 1px solid var(--bordure); white-space: nowrap; text-align: right; }
.tableau-treso tbody th, .tableau-treso .col-libelle {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 190px;
  text-align: left;
  font-weight: 500;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--bordure);
}
.tableau-treso thead th { font-weight: 600; background: var(--surface-2); vertical-align: top; }
.tableau-treso thead .col-libelle { background: var(--surface-2); }
.col-annee, .col-note { display: block; font-size: .75rem; font-weight: 400; color: var(--texte-doux); }
.col-note { font-style: italic; }

.tableau-treso .col--courant { background: var(--mois-courant); }
.tableau-treso thead .col--courant { background: var(--mois-courant); box-shadow: inset 0 -2px 0 var(--serie-revenus); }
.tableau-treso td.col--futur { color: var(--texte-doux); font-style: italic; }
.tableau-treso .cellule--zero { color: var(--texte-doux); opacity: .7; }

.ligne-treso th, .ligne-treso td { font-weight: 700; background: var(--surface-2); }
.ligne-treso td.col--courant { background: var(--mois-courant); }
.ligne-groupe td { font-weight: 600; }
.ligne-variation th { color: var(--texte-doux); }

.basculer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: none;
  background: none;
  font-weight: 600;
  cursor: pointer;
}
.basculer__fleche { display: inline-block; width: 12px; transition: transform .15s; color: var(--texte-doux); }
.basculer[aria-expanded="true"] .basculer__fleche { transform: rotate(90deg); }

.sous-ligne th { padding-left: 34px; }
/* Catégorie en étiquette, comme dans les logiciels de compta */
.etiquette {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--bordure);
  font-size: .82rem;
}

@media (min-width: 800px) {
  .cartes.cartes--treso { grid-template-columns: repeat(4, 1fr); }
  .graphique { margin: 0 20px 0 8px; }
  .legende-treso { padding: 0 20px 8px; }
}

/* ---------- App installable ---------- */

.etapes { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 4px; }

.bandeau-maj {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 21;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--bordure);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  font-size: .9rem;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--texte);
  color: var(--fond);
  font-size: .9rem;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast--visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- PC ---------- */

@media (min-width: 800px) {
  .app { padding-left: var(--largeur-nav); }

  .nav {
    top: 0; right: auto;
    width: var(--largeur-nav);
    flex-direction: column;
    gap: 2px;
    padding: 18px 12px;
  }
  .nav__lien--pc { display: flex; }
  .entete__reglages { display: none; }
  .nav__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 22px;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.01em;
  }
  .nav__logo-marque {
    display: grid;
    place-items: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    font-size: 1rem;
  }
  .nav__lien {
    flex: none;
    flex-direction: row;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: .92rem;
  }
  .nav__lien:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .nav__lien[aria-current="page"] { background: var(--nav-actif); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
  .nav__lien .icone { width: 18px; height: 18px; }
  /* Paramètres tout en bas du menu, comme dans les logiciels pro */
  .nav__lien--bas { margin-top: auto; }

  .contenu { max-width: 1080px; padding: 28px 40px 48px; }
  .entete h1 { font-size: 1.75rem; }

  .cartes { grid-template-columns: 2fr 1fr 1fr; }
  .carte--solde { grid-column: auto; }

  .filtres { grid-template-columns: 1fr 1fr 2fr; }
  .filtres input { grid-column: auto; }
  .filtres--comptes { grid-template-columns: 1fr 1fr 1fr 2fr; }
  .filtres--comptes select:first-child { grid-column: auto; }

  .comptes { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

  .toast { bottom: 32px; }
  .bandeau-maj { bottom: 32px; }
}
