/* Foyer : feuille de style unique. Mobile d'abord, clair et sombre, pas de dépendance externe. */

:root {
  color-scheme: light;
  --fond: #f5f3ee;
  --fond-haut: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2efe8;
  --surface-3: #e9e5dc;
  --encre: #1c1b18;
  --encre-2: #57534b;
  --encre-3: #8c877c;
  --trait: #e7e2d8;
  --accent: #2c6e5c;
  --accent-fort: #225a4b;
  --accent-doux: #e2efe9;
  --accent-encre: #ffffff;
  --bon: #2f8a5b;
  --bon-doux: #e3f3ea;
  --alerte: #b7791f;
  --alerte-doux: #fbf0dc;
  --danger: #c4453a;
  --danger-doux: #fbe7e4;
  --serie-1: #2a78d6;
  --serie-2: #eb6834;
  --barre: #2c6e5c;
  --ombre-1: 0 1px 2px rgba(40, 32, 20, .05), 0 1px 1px rgba(40, 32, 20, .03);
  --ombre-2: 0 10px 30px -12px rgba(40, 32, 20, .22), 0 2px 6px rgba(40, 32, 20, .05);
  --ombre-3: 0 24px 60px -20px rgba(20, 16, 10, .45);
  --rayon: 20px;
  --rayon-s: 14px;
  --rayon-xs: 10px;
  --police: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI",
    Inter, Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --police-titre: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display",
    "Segoe UI", Inter, Roboto, sans-serif;
  --haut-sur: env(safe-area-inset-top, 0px);
  --bas-sur: env(safe-area-inset-bottom, 0px);
  --largeur: 560px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    color-scheme: dark;
    --fond: #111210;
    --fond-haut: #151614;
    --surface: #1b1c1a;
    --surface-2: #242522;
    --surface-3: #2e302c;
    --encre: #f1efe9;
    --encre-2: #bdb9af;
    --encre-3: #8a867c;
    --trait: #2c2d2a;
    --accent: #5fbf9f;
    --accent-fort: #7fd1b5;
    --accent-doux: #1d3a31;
    --accent-encre: #0d1f19;
    --bon: #5cc48a;
    --bon-doux: #183224;
    --alerte: #e3ab4f;
    --alerte-doux: #3a2c12;
    --danger: #ef7d71;
    --danger-doux: #3d1d1a;
    --serie-1: #3987e5;
    --serie-2: #d95926;
    --barre: #5fbf9f;
    --ombre-1: 0 1px 2px rgba(0, 0, 0, .4);
    --ombre-2: 0 12px 30px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
    --ombre-3: 0 24px 60px -20px rgba(0, 0, 0, .9);
  }
}

:root[data-theme="sombre"] {
  color-scheme: dark;
  --fond: #111210;
  --fond-haut: #151614;
  --surface: #1b1c1a;
  --surface-2: #242522;
  --surface-3: #2e302c;
  --encre: #f1efe9;
  --encre-2: #bdb9af;
  --encre-3: #8a867c;
  --trait: #2c2d2a;
  --accent: #5fbf9f;
  --accent-fort: #7fd1b5;
  --accent-doux: #1d3a31;
  --accent-encre: #0d1f19;
  --bon: #5cc48a;
  --bon-doux: #183224;
  --alerte: #e3ab4f;
  --alerte-doux: #3a2c12;
  --danger: #ef7d71;
  --danger-doux: #3d1d1a;
  --serie-1: #3987e5;
  --serie-2: #d95926;
  --barre: #5fbf9f;
  --ombre-1: 0 1px 2px rgba(0, 0, 0, .4);
  --ombre-2: 0 12px 30px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
  --ombre-3: 0 24px 60px -20px rgba(0, 0, 0, .9);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--encre);
  font: 16px/1.45 var(--police);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--police-titre); letter-spacing: -.01em; }
.nombre { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cache { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------- coquille */

.appli { max-width: var(--largeur); margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.entete {
  position: sticky; top: 0; z-index: 20;
  padding: calc(14px + var(--haut-sur)) 18px 12px;
  display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--fond) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
}
.entete h1 { font-size: 24px; font-weight: 750; flex: 1; min-width: 0; }
.entete .sous { display: block; font: 500 13px/1.2 var(--police); color: var(--encre-3); letter-spacing: 0; margin-bottom: 2px; }
.entete .retour {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--ombre-1); flex: none;
}
.contenu { flex: 1; padding: 4px 16px calc(120px + var(--bas-sur)); }
.vue { animation: apparait .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } }

/* barre de navigation flottante */
/* Téléphone : barre collée au bas de l'écran, sur toute la largeur (zone du geste d'accueil comprise). */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: center;
  padding: 6px max(10px, calc((100% - 480px) / 2)) calc(6px + var(--bas-sur));
  border-radius: 22px 22px 0 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  box-shadow: 0 -8px 24px -14px rgba(40, 32, 20, .25); border-top: 1px solid var(--trait);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; border-radius: 18px;
  color: var(--encre-3); font-size: 11px; font-weight: 600;
  transition: color .15s, background .15s;
}
.nav a svg { width: 24px; height: 24px; }
.nav a.actif { color: var(--accent); background: var(--accent-doux); }
.nav .plus {
  justify-self: center; width: 60px; height: 60px; margin-top: -26px; border-radius: 22px;
  display: grid; place-items: center; color: var(--accent-encre);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 55%, var(--accent-fort));
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s;
}
.nav .plus svg { width: 30px; height: 30px; }
.nav .plus:active { transform: scale(.92); }

/* ---------------------------------------------------------------- briques */

.carte {
  background: var(--surface); border-radius: var(--rayon); padding: 18px;
  box-shadow: var(--ombre-1); margin-bottom: 14px; border: 1px solid color-mix(in srgb, var(--trait) 60%, transparent);
}
.carte > h2, .titre-section {
  font-size: 13px; font-weight: 700; color: var(--encre-3); text-transform: uppercase; letter-spacing: .06em;
  font-family: var(--police); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between;
}
.titre-section { margin: 22px 4px 10px; }
.titre-section a, .carte > h2 a { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; }
.ligne { display: flex; align-items: center; gap: 12px; }
.ligne .etire { flex: 1; min-width: 0; }
.muet { color: var(--encre-3); }
.doux { color: var(--encre-2); }
.petit { font-size: 13px; }
.centre { text-align: center; }
.espace { height: 10px; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 16px;
  background: var(--accent); color: var(--accent-encre); font-weight: 650; font-size: 16px;
  transition: transform .12s, filter .15s, background .15s; user-select: none;
}
.bouton:active { transform: scale(.97); }
.bouton:disabled { opacity: .5; pointer-events: none; }
.bouton.plein { width: 100%; min-height: 56px; font-size: 17px; border-radius: 18px; }
.bouton.second { background: var(--surface-2); color: var(--encre); }
.bouton.leger { background: var(--accent-doux); color: var(--accent-fort); }
.bouton.danger { background: var(--danger-doux); color: var(--danger); }
.bouton.petit { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.bouton svg { width: 20px; height: 20px; }
.lien-bouton { color: var(--accent); font-weight: 600; font-size: 15px; padding: 6px 2px; }

/* champs */
.champ { display: block; margin-bottom: 14px; }
.champ > span { display: block; font-size: 13px; font-weight: 600; color: var(--encre-2); margin: 0 4px 6px; }
.champ input, .champ select, .saisie-texte {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px;
  background: var(--surface-2); border: 1.5px solid transparent; outline: none;
  font-size: 16px; transition: border-color .15s, background .15s;
}
.champ input:focus, .champ select:focus, .saisie-texte:focus { border-color: var(--accent); background: var(--surface); }
.champ .aide { font-size: 13px; color: var(--encre-3); margin: 6px 4px 0; }
.champ-euros { position: relative; }
.champ-euros input { padding-right: 40px; font-variant-numeric: tabular-nums; }
.champ-euros::after { content: "€"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--encre-3); font-weight: 600; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* segments */
.segments {
  display: flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--surface-2); margin-bottom: 14px;
}
.segments button {
  flex: 1; min-height: 40px; border-radius: 12px; font-weight: 600; font-size: 15px; color: var(--encre-2);
  transition: background .18s, color .18s, box-shadow .18s;
}
.segments button.actif { background: var(--surface); color: var(--encre); box-shadow: var(--ombre-1); }

.puces { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.puce {
  min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--surface-2);
  font-size: 14px; font-weight: 600; color: var(--encre-2); display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid transparent; transition: all .15s;
}
.puce.actif { background: var(--accent-doux); color: var(--accent-fort); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* avatars */
.avatar {
  --c: #888; width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 750; color: #fff; font-size: 16px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
}
.avatar.mini { width: 22px; height: 22px; font-size: 11px; }
.avatar.grand { width: 72px; height: 72px; font-size: 30px; }

/* pastille de catégorie */
.pastille {
  --c: #888; width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-size: 22px;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
}
.pastille.reglement { background: var(--accent-doux); }

/* listes */
.liste { display: flex; flex-direction: column; }
.element {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px; width: 100%; text-align: left;
  border-radius: 14px; transition: background .12s;
}
.element:active { background: var(--surface-2); }
.element + .element { border-top: 1px solid var(--trait); border-radius: 0; }
.element .etire { flex: 1; min-width: 0; }
.element .titre { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.element .detail { font-size: 13px; color: var(--encre-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.element .montant { font-weight: 650; font-size: 16px; text-align: right; white-space: nowrap; }
.element .montant small { display: block; font-size: 12px; font-weight: 500; color: var(--encre-3); }
.element .chevron { color: var(--encre-3); width: 18px; height: 18px; flex: none; }
.etiquette {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--encre-2);
}
.etiquette.perso { background: color-mix(in srgb, var(--serie-2) 14%, var(--surface)); color: color-mix(in srgb, var(--serie-2) 75%, var(--encre)); }
.etiquette.auto { background: var(--accent-doux); color: var(--accent-fort); }
.jour-entete {
  display: flex; justify-content: space-between; font-size: 13px; font-weight: 650; color: var(--encre-3);
  padding: 16px 6px 6px; text-transform: capitalize;
}

/* ---------------------------------------------------------------- accueil */

.solde {
  position: relative; overflow: hidden; border-radius: 26px; padding: 22px 20px 18px; margin-bottom: 14px;
  color: #fff; box-shadow: var(--ombre-2);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .16), transparent 55%),
    linear-gradient(150deg, #3a8a73, #245c4d 60%, #1c4a3e);
}
.solde::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}
.solde .qui { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; opacity: .92; }
.solde .gros { font: 800 44px/1.05 var(--police-titre); margin: 10px 0 4px; letter-spacing: -.02em; }
.solde .gros small { font-size: 26px; font-weight: 700; opacity: .85; }
.solde .phrase { font-size: 14px; opacity: .8; }
.solde .actions { display: flex; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.solde .bouton { background: rgba(255, 255, 255, .95); color: #1c4a3e; }
.solde .bouton.verre { background: rgba(255, 255, 255, .16); color: #fff; }
.solde.equilibre { background: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, .18), transparent 55%), linear-gradient(150deg, #4c8f6b, #2f7353); }

.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chiffre { background: var(--surface-2); border-radius: 16px; padding: 12px; min-width: 0; }
.chiffre .val { font: 750 17px/1.2 var(--police-titre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chiffre .lib { font-size: 12px; color: var(--encre-3); font-weight: 600; margin-top: 2px; }

.jauge { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.jauge > i {
  display: block; height: 100%; border-radius: 99px; background: var(--bon); width: 0;
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}
.jauge.alerte > i { background: var(--alerte); }
.jauge.depasse > i { background: var(--danger); }
.budget { padding: 10px 0; }
.budget + .budget { border-top: 1px solid var(--trait); }
.budget .haut { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.budget .haut .pastille { width: 36px; height: 36px; font-size: 18px; border-radius: 11px; }
.budget .nom { font-weight: 600; flex: 1; min-width: 0; }
.budget .reste { font-size: 13px; font-weight: 600; }
.budget .reste.bon { color: var(--bon); }
.budget .reste.alerte { color: var(--alerte); }
.budget .reste.depasse { color: var(--danger); }

.bienvenue { background: linear-gradient(160deg, var(--accent-doux), var(--surface) 70%); }
.bienvenue h3 { font-size: 19px; margin-bottom: 4px; }
.etape { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.etape .rond {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--encre-2); font-weight: 700; font-size: 14px;
}
.etape.faite .rond { background: var(--bon); color: #fff; }
.etape.faite .lib { color: var(--encre-3); text-decoration: line-through; }
.etape .lib { flex: 1; font-weight: 600; }

.vide { text-align: center; padding: 26px 10px; color: var(--encre-3); }
.vide .emoji { font-size: 40px; display: block; margin-bottom: 6px; }

/* mois */
.mois {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px;
  background: var(--surface); border-radius: 16px; padding: 4px; box-shadow: var(--ombre-1);
}
.mois button { width: 44px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--encre-2); }
.mois button:active { background: var(--surface-2); }
.mois button:disabled { opacity: .3; }
.mois strong { font: 700 16px var(--police-titre); text-transform: capitalize; }

.recherche { position: relative; margin-bottom: 12px; }
.recherche input { padding-left: 44px; }
.recherche svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--encre-3); }

/* ---------------------------------------------------------------- feuille de saisie (bottom sheet) */

.voile {
  position: fixed; inset: 0; z-index: 50; background: rgba(12, 10, 6, .42);
  animation: fondu .2s ease; display: flex; align-items: flex-end; justify-content: center;
}
.voile.ferme { animation: fondu-sortie .2s ease forwards; }
.feuille {
  width: 100%; max-width: var(--largeur); max-height: calc(100dvh - 30px - var(--haut-sur));
  background: var(--fond-haut); border-radius: 28px 28px 0 0; box-shadow: var(--ombre-3);
  display: flex; flex-direction: column; animation: monte .34s cubic-bezier(.2, .9, .25, 1);
}
.voile.ferme .feuille { animation: descend .22s ease forwards; }
.feuille .poignee { width: 40px; height: 5px; border-radius: 9px; background: var(--surface-3); margin: 10px auto 4px; flex: none; }
.feuille .tete { display: flex; align-items: center; gap: 10px; padding: 6px 18px 10px; flex: none; }
.feuille .tete h2 { flex: 1; font-size: 20px; }
.feuille .fermer { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--encre-2); }
.feuille .corps { overflow-y: auto; padding: 4px 18px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.feuille .pied { padding: 10px 18px calc(14px + var(--bas-sur)); flex: none; border-top: 1px solid var(--trait); background: var(--fond-haut); }
@media (min-width: 620px) {
  .voile { align-items: center; }
  .feuille { border-radius: 28px; max-height: min(860px, calc(100dvh - 60px)); }
  .feuille .poignee { display: none; }
}
@keyframes fondu { from { opacity: 0; } }
@keyframes fondu-sortie { to { opacity: 0; } }
@keyframes monte { from { transform: translateY(100%); } }
@keyframes descend { to { transform: translateY(100%); } }

.montant-saisie { text-align: center; padding: 8px 0 14px; }
.montant-saisie .boite { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; }
.montant-saisie input {
  border: 0; outline: none; background: none; text-align: right; width: 5.5ch; max-width: 70vw;
  font: 800 54px/1.1 var(--police-titre); letter-spacing: -.03em; font-variant-numeric: tabular-nums; padding: 0;
  caret-color: var(--accent);
}
.montant-saisie input::placeholder { color: var(--surface-3); }
.montant-saisie .euro { font: 700 34px var(--police-titre); color: var(--encre-3); }
.montant-saisie .part { font-size: 14px; color: var(--encre-3); min-height: 20px; }

.grille-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 16px; }
.cat {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px 7px; border-radius: 16px;
  font-size: 11.5px; font-weight: 600; color: var(--encre-2); text-align: center; line-height: 1.15;
  border: 1.5px solid transparent; transition: background .15s, border-color .15s, transform .1s;
}
.cat:active { transform: scale(.95); }
.cat .pastille { width: 46px; height: 46px; border-radius: 15px; }
.cat.actif { background: color-mix(in srgb, var(--c, var(--accent)) 10%, var(--surface)); border-color: color-mix(in srgb, var(--c, var(--accent)) 55%, transparent); color: var(--encre); }

.qui-paie { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.qui-paie button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px;
  background: var(--surface-2); font-weight: 650; border: 1.5px solid transparent; transition: all .15s;
}
.qui-paie button .avatar { width: 32px; height: 32px; font-size: 14px; }
.qui-paie button.actif { background: var(--surface); border-color: var(--accent); box-shadow: var(--ombre-1); }

.photo-ticket {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface-2);
  width: 100%; text-align: left; font-weight: 600; color: var(--encre-2);
}
.photo-ticket img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }
.photo-ticket .ico { width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); }
.photo-plein { width: 100%; border-radius: 16px; display: block; }

/* ---------------------------------------------------------------- bilan et graphiques */

.barres-cat .ligne-cat { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; }
.barres-cat .emoji { font-size: 20px; text-align: center; }
.barres-cat .nom { font-size: 14px; font-weight: 600; margin-bottom: 5px; display: flex; justify-content: space-between; gap: 8px; }
.barres-cat .nom span:last-child { color: var(--encre-3); font-weight: 500; }
.barres-cat .piste { height: 10px; border-radius: 4px; background: var(--surface-2); }
.barres-cat .piste i { display: block; height: 100%; border-radius: 4px; background: var(--barre); min-width: 4px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.barres-cat .val { font-weight: 650; font-size: 15px; text-align: right; }

.histo { position: relative; }
.histo svg { width: 100%; height: auto; display: block; overflow: visible; }
.histo .grille line { stroke: var(--trait); stroke-width: 1; }
.histo .axe text { fill: var(--encre-3); font-size: 11px; font-family: var(--police); }
.histo .s1 { fill: var(--serie-1); }
.histo .s2 { fill: var(--serie-2); }
.histo .colonne { cursor: pointer; }
.histo .colonne .zone { fill: transparent; }
.histo .colonne:hover .zone, .histo .colonne.actif .zone { fill: var(--surface-2); }
.legende { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--encre-2); margin: 4px 0 10px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legende .l1 { background: var(--serie-1); }
.legende .l2 { background: var(--serie-2); }
.infobulle {
  position: absolute; pointer-events: none; background: var(--encre); color: var(--fond); padding: 8px 10px;
  border-radius: 10px; font-size: 12.5px; line-height: 1.45; box-shadow: var(--ombre-2); white-space: nowrap;
  transform: translate(-50%, -100%); z-index: 2;
}
.infobulle b { font-weight: 700; text-transform: capitalize; }

.repartition-membres .lm { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.repartition-membres .piste { height: 10px; border-radius: 4px; background: var(--surface-2); }
.repartition-membres .piste i { display: block; height: 100%; border-radius: 4px; background: var(--c); }

.equation { display: grid; gap: 8px; }
.equation .l { display: flex; justify-content: space-between; font-size: 15px; }
.equation .l.total { border-top: 1.5px solid var(--trait); padding-top: 10px; margin-top: 2px; font-weight: 750; font-size: 18px; }
.equation .l.total.negatif { color: var(--danger); }

/* ---------------------------------------------------------------- réglages */

.menu .element .ico {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--accent-doux); color: var(--accent-fort); font-size: 18px;
}
.choix-regle { display: grid; gap: 10px; margin-bottom: 16px; }
.choix-regle button {
  text-align: left; padding: 14px 16px; border-radius: 18px; background: var(--surface);
  border: 1.5px solid var(--trait); display: flex; gap: 12px; align-items: flex-start; transition: all .15s;
}
.choix-regle button .rad { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface-3); flex: none; margin-top: 1px; }
.choix-regle button.actif { border-color: var(--accent); background: color-mix(in srgb, var(--accent-doux) 55%, var(--surface)); }
.choix-regle button.actif .rad { border: 7px solid var(--accent); }
.choix-regle strong { display: block; font-size: 16px; }
.choix-regle small { color: var(--encre-3); font-size: 13.5px; line-height: 1.35; display: block; margin-top: 2px; }
.curseur { width: 100%; accent-color: var(--accent); height: 30px; }
.apercu-partage {
  display: flex; border-radius: 14px; overflow: hidden; height: 46px; font-weight: 700; font-size: 14px; color: #fff; gap: 2px;
}
.apercu-partage div { display: flex; align-items: center; justify-content: center; min-width: 54px; transition: flex-grow .3s; white-space: nowrap; padding: 0 8px; }
.couleurs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.couleurs button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--trait); }
.couleurs button.actif { box-shadow: 0 0 0 2.5px var(--encre); }
.encart { background: var(--accent-doux); color: var(--encre); border-radius: 16px; padding: 14px 16px; font-size: 14.5px; line-height: 1.5; margin-bottom: 14px; }
.encart.alerte { background: var(--alerte-doux); }
.encart strong { color: var(--accent-fort); }
.resultat-logement { text-align: center; padding: 8px 0 4px; }
.resultat-logement .gros { font: 800 40px/1.1 var(--police-titre); color: var(--accent-fort); }

/* ---------------------------------------------------------------- connexion */

.connexion {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 32px 22px calc(32px + var(--bas-sur)); max-width: 420px; margin: 0 auto; text-align: center;
}
.logo {
  width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; margin-bottom: 18px;
  background: linear-gradient(150deg, #3a8a73, #1f5143); box-shadow: 0 18px 40px -16px rgba(31, 81, 67, .7);
}
.logo svg { width: 48px; height: 48px; }
.connexion h1 { font-size: 34px; font-weight: 800; }
.connexion .accroche { color: var(--encre-3); margin: 6px 0 28px; }
.qui { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-bottom: 22px; }
.qui button {
  padding: 18px 10px 14px; border-radius: 22px; background: var(--surface); box-shadow: var(--ombre-1);
  border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; transition: all .18s;
}
.qui button.actif { border-color: var(--accent); box-shadow: var(--ombre-2); transform: translateY(-2px); }
.connexion form { width: 100%; }
.erreur { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 22px; margin: 2px 0 10px; }

/* ---------------------------------------------------------------- notifications */

.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--bas-sur)); transform: translateX(-50%); z-index: 80;
  background: var(--encre); color: var(--fond); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px;
  box-shadow: var(--ombre-2); animation: toast .3s cubic-bezier(.2, .9, .25, 1); max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px;
}
.toast button { color: var(--accent); font-weight: 700; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 14px); } }

.chargement { display: grid; place-items: center; padding: 60px 0; }
.chargement::before {
  content: ""; width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 620px) {
  .contenu { padding-left: 20px; padding-right: 20px; }
}

/* ---------------------------------------------------------------- vue PC (grand écran)
   Téléphone : une colonne, barre flottante en bas. À partir de 1024 px : colonne latérale fixe,
   contenu sur deux colonnes, survols, raccourci clavier N. */

.nav .marque, .nav .lien-reglages, .nav .lien-projets, .nav .lib-plus, .nav kbd { display: none; }
.colonnes > .col { min-width: 0; }

@media (hover: hover) {
  .element:hover { background: var(--surface-2); }
  .element + .element:hover { border-radius: 12px; }
  .cat:hover { background: var(--surface-2); }
  .puce:hover:not(.actif) { background: var(--surface-3); }
  .bouton:hover { filter: brightness(1.06); }
}

@media (min-width: 1024px) {
  .appli { max-width: none; margin: 0 0 0 256px; }
  .entete { padding: 30px 40px 18px; }
  .entete h1 { font-size: 30px; }
  .entete .sous { font-size: 14px; }
  .entete > button[aria-label="Réglages"] { display: none; }
  .contenu { padding: 2px 40px 56px; max-width: 1200px; }

  .colonnes { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0 24px; align-items: start; }
  .colonnes.etroite { grid-template-columns: 340px minmax(0, 1fr); }
  .col.collante { position: sticky; top: 104px; }
  .titre-section.premier { margin-top: 2px; }

  .nav {
    left: 0; right: auto; top: 0; bottom: 0; transform: none; width: 256px;
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    padding: 26px 16px 18px; border-radius: 0; border: 0; border-right: 1px solid var(--trait);
    background: var(--surface); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .nav .marque {
    order: -2; display: flex; align-items: center; gap: 11px; padding: 0 8px 22px;
    font: 800 23px var(--police-titre); color: var(--encre); background: none;
  }
  .nav .marque:hover { background: none; }
  .nav .logo-mini {
    width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(150deg, #3a8a73, #1f5143); box-shadow: 0 8px 18px -10px rgba(31, 81, 67, .8);
  }
  .nav .logo-mini svg { width: 22px; height: 22px; }
  .nav a { flex-direction: row; gap: 12px; padding: 11px 12px; font-size: 15px; font-weight: 600; border-radius: 12px; }
  .nav a svg { width: 22px; height: 22px; }
  .nav a:not(.actif):not(.marque):hover { background: var(--surface-2); color: var(--encre); }
  .nav .plus {
    order: -1; width: 100%; height: 50px; margin: 0 0 16px; border-radius: 15px;
    display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 15px;
  }
  .nav .plus svg { width: 22px; height: 22px; }
  .nav .plus:active { transform: scale(.98); }
  .nav .lib-plus { display: inline; }
  .nav .lien-projets { display: flex; }
  .nav kbd {
    display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
    font: 700 12px var(--police); background: rgba(255, 255, 255, .2); color: inherit;
  }
  .nav .lien-reglages {
    display: flex; margin-top: auto; align-items: center; gap: 11px; padding: 10px 12px;
    border: 1px solid var(--trait); border-radius: 16px;
  }
  .nav .lien-reglages .avatar { width: 36px; height: 36px; font-size: 15px; }
  .nav .lien-reglages strong { display: block; color: var(--encre); font-size: 14.5px; }
  .nav .lien-reglages small { display: block; font-size: 12.5px; color: var(--encre-3); font-weight: 500; }
  .nav .lien-reglages svg { width: 18px; height: 18px; }

  .solde { padding: 26px 26px 22px; }
  .solde .gros { font-size: 54px; }
  .carte { padding: 20px 22px; }
  .chiffre .val { font-size: 20px; }
  .toast { left: calc(50% + 128px); bottom: 32px; }
  .feuille { max-width: 600px; }
  .grille-cats { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 1440px) {
  .contenu { max-width: 1280px; }
  .colonnes.etroite { grid-template-columns: 380px minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- remboursements reçus */
.element .montant.credit { color: var(--bon); }
.etiquette.credit { background: var(--bon-doux); color: var(--bon); }
.montant-saisie.credit input, .montant-saisie.credit .euro { color: var(--bon); }
.montant-saisie.credit .boite::before { content: "+"; font: 700 34px var(--police-titre); color: var(--bon); margin-right: 2px; }

/* ---------------------------------------------------------------- entrées d'argent et projets */
.etiquette.projet { background: color-mix(in srgb, var(--serie-1) 12%, var(--surface)); color: color-mix(in srgb, var(--serie-1) 70%, var(--encre)); }
.carte-projet { display: block; width: 100%; text-align: left; }
.carte-projet .tete-projet { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.carte-projet .tete-projet .emoji { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; background: var(--accent-doux); flex: none; }
.carte-projet .tete-projet .etire { flex: 1; min-width: 0; }
.carte-projet .tete-projet strong { display: block; font: 700 17px var(--police-titre); }
.carte-projet .chiffres-projet { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--encre-2); margin-top: 8px; gap: 8px; flex-wrap: wrap; }
.ligne-poste { padding: 9px 0; }
.ligne-poste + .ligne-poste { border-top: 1px solid var(--trait); }
.ligne-poste .haut { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; margin-bottom: 7px; }
.ligne-poste .haut span:last-child { color: var(--encre-2); font-size: 13.5px; white-space: nowrap; }
.editeur-lignes .ligne-edit { display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
.editeur-lignes .ligne-edit input { min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid transparent; outline: none; width: 100%; font-size: 15px; }
.editeur-lignes .ligne-edit input:focus { border-color: var(--accent); background: var(--surface); }
.editeur-lignes .ligne-edit button { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--encre-3); }
.editeur-lignes .ligne-edit button svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- type de saisie (bouton +) : en second plan */
.autres-natures {
  display: flex; justify-content: center; gap: 2px; margin: -6px -8px 14px; overflow-x: auto; scrollbar-width: none;
}
.autres-natures::-webkit-scrollbar { display: none; }
.autres-natures button {
  flex: none; min-height: 32px; padding: 0 9px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--encre-3);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.autres-natures button:hover { color: var(--encre); background: var(--surface-2); }
.autres-natures button.actif { background: var(--accent-doux); color: var(--accent-fort); }
