/* Portefeuille — ordinateur : menu à gauche, bulle + en bas à droite ; APK : onglets en bas, gros + au centre. */
:root {
  --gouttiere: 24px;
  --bg: #F7F8F5; --surface: #FFFFFF; --surface-2: #F0F3F6; --texte: #0A1424; --texte-2: #56627A; --trait: #E3E7ED;
  --accent: #0E6A8C; --accent-doux: #E2EEF6; --orange: #F2803A; --orange-texte: #A9480F;
  --ok: #1D6B3A; --ok-bg: #DDF3E5; --alerte: #B42318; --alerte-bg: #FDE7E4; --warn-bg: #FFE9D9;
  --carte-fond: #0A1424; --carte-texte: #FFFFFF; --voile: rgba(6, 12, 23, .45);
  --ombre: 0 1px 2px rgba(10, 20, 36, .05), 0 14px 34px -18px rgba(10, 20, 36, .28);
  --f-texte: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-chiffre: "Space Grotesk", Inter, system-ui, sans-serif;
  color-scheme: only light;
}
@media (max-width: 900px) { :root { --gouttiere: 16px; } }
:root[data-theme="sombre"] {
  --bg: #0A1424; --surface: #111E33; --surface-2: #16294A; --texte: #EEF2F8; --texte-2: #9DABC2; --trait: #1F3150;
  --accent: #5FD0DC; --accent-doux: #12324A; --orange-texte: #F6A46E;
  --ok: #6FD39A; --ok-bg: #123524; --alerte: #FF8A7A; --alerte-bg: #3A1714; --warn-bg: #3A2412;
  --carte-fond: #16294A; --voile: rgba(0, 0, 0, .6);
  --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 34px -18px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--texte); font: 15px/1.45 var(--f-texte); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; padding: 0; }
input, select, textarea { font: inherit; color: var(--texte); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.chiffre { font-family: var(--f-chiffre); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.doux { color: var(--texte-2); }
.cache .sensible { filter: blur(9px); }
.demarrage { display: grid; place-items: center; height: 100vh; color: var(--texte-2); }

/* Logo : foncé en clair, blanc en sombre */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.logo img { height: 22px; width: auto; }
.logo__img--sombre { display: none; }
:root[data-theme="sombre"] .logo__img--clair { display: none; }
:root[data-theme="sombre"] .logo__img--sombre { display: inline; }

/* ---------- Mise en page ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.menu { position: sticky; top: 0; height: 100vh; padding: 24px 16px; border-right: 1px solid var(--trait); display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.menu .logo { padding: 0 8px 18px; }
.menu .onglet { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--texte-2); font-weight: 500; text-align: left; }
.menu .onglet svg { width: 20px; height: 20px; }
.menu .onglet[aria-current="page"] { background: var(--accent-doux); color: var(--texte); }
.menu .bas-menu { margin-top: auto; font-size: 13px; color: var(--texte-2); padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.principal { min-width: 0; }
.haut { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px var(--gouttiere) 6px; max-width: 920px; margin: 0 auto; }
.haut .salut { font-size: 13px; color: var(--texte-2); }
.haut .nom { font-weight: 600; font-size: 17px; }
.haut .actions { display: flex; gap: 8px; align-items: center; }
.contenu { padding: 6px var(--gouttiere) 120px; max-width: 920px; margin: 0 auto; }
.barre-bas { display: none; }
.bulle-plus { position: fixed; right: calc(var(--gouttiere) + env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); width: 64px; height: 64px; border-radius: 22px; background: var(--orange); color: #fff; display: grid; place-items: center; box-shadow: 0 14px 28px -10px rgba(242, 128, 58, .8); z-index: 20; transition: transform .15s; }
.bulle-plus:hover { transform: translateY(-2px); }
.bulle-plus svg { width: 28px; height: 28px; }

@media (max-width: 900px), (pointer: coarse) {
  .app { grid-template-columns: 1fr; }
  .menu { display: none; }
  .bulle-plus { display: none; }
  .haut { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .barre-bas { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 8px var(--gouttiere) calc(10px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--trait); }
  .barre-bas .onglet { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--texte-2); padding: 6px 0; }
  .barre-bas .onglet svg { width: 22px; height: 22px; }
  .barre-bas .onglet[aria-current="page"] { color: var(--texte); font-weight: 600; }
  .plus-centre { justify-self: center; width: 60px; height: 60px; border-radius: 20px; background: var(--orange); color: #fff; display: grid; place-items: center; box-shadow: 0 12px 24px -10px rgba(242, 128, 58, .8); transform: translateY(-14px); }
  .plus-centre svg { width: 28px; height: 28px; }
}

/* ---------- Éléments ---------- */
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--ok-bg); color: var(--ok); white-space: nowrap; }
.pastille i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pastille.horsligne { background: var(--warn-bg); color: var(--orange-texte); }
.ico-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--ombre); flex: 0 0 auto; }
.ico-btn svg { width: 19px; height: 19px; }
h2 { font-size: 13px; font-weight: 600; color: var(--texte-2); letter-spacing: .04em; text-transform: uppercase; margin: 24px 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2 .lien { font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--accent); font-weight: 500; }
.carte { background: var(--surface); border-radius: 18px; box-shadow: var(--ombre); }
.liste { background: var(--surface); border-radius: 18px; box-shadow: var(--ombre); overflow: hidden; }
.vide { padding: 22px; text-align: center; color: var(--texte-2); }
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 14px; background: var(--texte); color: var(--bg); font-weight: 600; }
.btn.second { background: var(--surface-2); color: var(--texte); }
.btn.danger { background: var(--alerte-bg); color: var(--alerte); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.large { width: 100%; }
.btn-petit { padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--texte); color: var(--bg); white-space: nowrap; }
.btn-petit.second { background: var(--surface-2); color: var(--texte); }
.tag { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--texte-2); font-weight: 500; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.trop { background: var(--alerte-bg); color: var(--alerte); }
.tag.warn { background: var(--warn-bg); color: var(--orange-texte); }
.champ { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--texte-2); }
.champ input, .champ select, .champ textarea { border: 1px solid var(--trait); background: var(--surface); border-radius: 12px; padding: 11px 12px; font-size: 15px; min-width: 0; }

/* Solde et comptes */
.solde { padding: 10px 0 4px; }
.solde .lib { font-size: 13px; color: var(--texte-2); }
.solde .val { font-size: 40px; font-weight: 600; margin-top: 2px; }
.solde .val small, .grand small { font-size: .5em; color: var(--texte-2); font-weight: 500; }
.comptes { display: flex; gap: 10px; overflow-x: auto; margin: 12px calc(-1 * var(--gouttiere)) 0; padding: 4px var(--gouttiere) 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.comptes::-webkit-scrollbar { display: none; }
.compte { flex: 0 0 160px; scroll-snap-align: start; border-radius: 18px; padding: 14px; background: var(--surface); box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 18px; text-align: left; }
.compte .t { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; min-width: 0; }
.compte .t span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 10.5px; font-weight: 700; flex: 0 0 auto; }
.compte .m { font-size: 18px; font-weight: 600; }
.compte.fonce { background: var(--carte-fond); color: var(--carte-texte); }
.anneau { display: flex; gap: 16px; align-items: center; padding: 16px; }
.anneau svg { flex: 0 0 76px; }
.anneau .l1 { font-size: 13px; color: var(--texte-2); }
.anneau .l2 { font-size: 22px; font-weight: 600; margin: 2px 0; }
.anneau .l3 { font-size: 12.5px; color: var(--texte-2); }
.favoris { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--gouttiere)); padding: 2px var(--gouttiere) 6px; scrollbar-width: none; }
.favoris::-webkit-scrollbar { display: none; }
.fav { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--trait); font-size: 13.5px; }
.fav .ic { width: 28px; height: 28px; border-radius: 9px; }
.fav .ic svg { width: 15px; height: 15px; }

/* Mouvements */
.mvt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--trait); width: 100%; text-align: left; }
.mvt:first-child { border-top: 0; }
.ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; position: relative; }
.ic svg { width: 20px; height: 20px; }
.ic .qui { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; color: #fff; border: 2px solid var(--surface); }
.mvt .mid { flex: 1; min-width: 0; }
.mvt .t1, .mvt .t2 { display: block; }
.mvt .t1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mvt .t2 { font-size: 12.5px; color: var(--texte-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mvt .m { font-weight: 600; white-space: nowrap; text-align: right; }
.mvt .m.plus { color: var(--ok); }
.mvt .m small { font-weight: 500; color: var(--texte-2); }
.mvt .attente { display: block; font-size: 11px; color: var(--orange-texte); font-family: var(--f-texte); font-weight: 500; }
.jour { font-size: 12.5px; color: var(--texte-2); margin: 18px 2px 8px; display: flex; justify-content: space-between; }
.jour span:first-child::first-letter { text-transform: uppercase; }
.recherche { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--trait); border-radius: 14px; padding: 10px 12px; margin-top: 8px; }
.recherche input { border: 0; background: none; flex: 1; outline: none; min-width: 0; }
.puces { display: flex; gap: 6px; overflow-x: auto; margin: 10px calc(-1 * var(--gouttiere)) 0; padding: 0 var(--gouttiere); scrollbar-width: none; }
.puces::-webkit-scrollbar { display: none; }
.puce { flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; font-size: 13px; border: 1px solid var(--trait); background: var(--surface); }
.puce[aria-pressed="true"] { background: var(--texte); color: var(--bg); border-color: var(--texte); }

/* Budget */
.mois { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 10px; }
.mois .nm { font-family: var(--f-chiffre); font-size: 22px; font-weight: 600; }
.statut-mois { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--texte-2); margin-top: 8px; flex-wrap: wrap; }
.resume { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.resume div { background: var(--surface); border-radius: 14px; padding: 10px 12px; box-shadow: var(--ombre); min-width: 0; }
.resume span { display: block; font-size: 11.5px; color: var(--texte-2); }
.resume b { font-size: 15px; }
.env { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-top: 1px solid var(--trait); }
.env:first-child { border-top: 0; }
.env .l { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.env .l .ic { width: 34px; height: 34px; border-radius: 10px; }
.env .l .ic svg { width: 17px; height: 17px; }
.env .nm { flex: 1; font-weight: 500; min-width: 0; }
.env .nm small { display: block; font-size: 11.5px; color: var(--texte-2); font-weight: 400; }
.env .r { font-size: 13px; color: var(--texte-2); text-align: right; white-space: nowrap; }
.env .r b { color: var(--texte); font-size: 14px; }
.chev { flex: 0 0 auto; color: var(--texte-2); transition: transform .2s; }
.env .l[aria-expanded="true"] .chev { transform: rotate(180deg); }
.barre { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.barre i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.barre i.warn { background: var(--orange); }
.barre i.trop { background: var(--alerte); }
.depasse { font-size: 12px; color: var(--alerte); font-weight: 500; }
.sous { display: flex; flex-direction: column; margin-top: 4px; padding: 6px 0 0 46px; border-top: 1px dashed var(--trait); }
.sous-ligne { padding: 6px 0; font-size: 13.5px; display: flex; justify-content: space-between; gap: 10px; }
.sous-ligne span:last-child { color: var(--texte-2); white-space: nowrap; }
.sous-ligne b { color: var(--texte); }
.cta { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px; border-radius: 18px; background: var(--accent-doux); text-align: left; width: 100%; }
.cta > svg { width: 28px; height: 28px; flex: 0 0 auto; color: var(--accent); }
.cta b { display: block; }
.cta span { font-size: 12.5px; color: var(--texte-2); }
.hors { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 14px; border-radius: 18px; border: 1.5px solid var(--alerte); background: var(--alerte-bg); }
.hors .t1 { font-weight: 600; color: var(--alerte); }
.regles { margin-top: 16px; padding: 14px 16px; font-size: 13.5px; line-height: 1.5; }
.regles summary { font-weight: 600; cursor: pointer; }
.regles ol { padding-left: 20px; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; color: var(--texte-2); }

/* Dettes */
.segment { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.segment button { padding: 9px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--texte-2); }
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--texte); box-shadow: var(--ombre); }
.grand { font-size: 30px; font-weight: 600; }
.dette { padding: 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.dette .l { display: flex; align-items: center; gap: 12px; }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; background: var(--accent-doux); color: var(--accent); flex: 0 0 auto; }
.dette .nm { flex: 1; font-weight: 500; min-width: 0; }
.dette .nm small, .dette .reste small { display: block; font-size: 12.5px; color: var(--texte-2); font-weight: 400; font-family: var(--f-texte); }
.dette .reste { text-align: right; font-weight: 600; white-space: nowrap; }
.dette .act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dette .act .tag { margin-right: auto; }

/* ---------- Fenêtres (feuille sur téléphone, panneau sur ordinateur) ---------- */
.voile { position: fixed; inset: 0; background: var(--voile); z-index: 40; opacity: 0; transition: opacity .2s; }
.voile.ouvert { opacity: 1; }
.feuille { position: fixed; z-index: 41; background: var(--bg); display: flex; flex-direction: column; gap: 12px; overflow-y: auto; overscroll-behavior: contain;
  right: var(--gouttiere); bottom: 24px; width: min(460px, calc(100vw - 2 * var(--gouttiere))); max-height: calc(100vh - 48px); border-radius: 22px; padding: 18px var(--gouttiere); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45);
  transform: translateY(20px); opacity: 0; transition: transform .25s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.feuille.ouvert { transform: none; opacity: 1; }
@media (max-width: 900px), (pointer: coarse) {
  .feuille { left: 0; right: 0; bottom: 0; width: auto; max-height: 94%; border-radius: 26px 26px 0 0; padding: 8px var(--gouttiere) calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateY(100%); opacity: 1; }
}
#saisie { display: flex; flex-direction: column; gap: 12px; }
.poignee { width: 40px; height: 5px; border-radius: 9px; background: var(--trait); margin: 2px auto; }
@media (min-width: 901px) and (pointer: fine) { #saisie { display: flex; flex-direction: column; gap: 12px; }
.poignee { display: none; } }
.f-tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.f-tete b { font-size: 18px; font-family: var(--f-chiffre); }
.types { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 14px; padding: 4px; }
.types button { padding: 8px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--texte-2); }
.types button[aria-pressed="true"] { background: var(--surface); color: var(--texte); box-shadow: var(--ombre); }
.saisie-montant { text-align: center; }
.saisie-montant .v { font-size: 46px; font-weight: 600; line-height: 1.1; }
.saisie-montant .v small { font-size: 22px; color: var(--texte-2); font-weight: 500; }
.saisie-montant .v.vide { color: var(--texte-2); }
.raccourcis { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.raccourcis button { padding: 6px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 500; }
.cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; font-size: 11.5px; border: 1.5px solid transparent; text-align: center; min-width: 0; }
.cat > span:not(.ic) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .ic { width: 38px; height: 38px; }
.cat[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-doux); }
.cat .rest { font-size: 10.5px; color: var(--texte-2); }
.cat .rest.neg { color: var(--alerte); }
.choix { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.choix::-webkit-scrollbar { display: none; }
.choix button { flex: 0 0 auto; display: flex; gap: 7px; align-items: center; padding: 7px 11px 7px 7px; border-radius: 12px; border: 1.5px solid var(--trait); font-size: 13px; background: var(--surface); }
.choix button.sans-pt { padding: 7px 11px; }
.choix button[aria-pressed="true"] { border-color: var(--accent); }
.choix .pt { width: 20px; height: 20px; border-radius: 6px; font-size: 9px; }
.choix small { color: var(--texte-2); font-size: 11px; }
.lbl { font-size: 12px; color: var(--texte-2); margin-bottom: -6px; }
.note { font-size: 12.5px; color: var(--texte-2); }
.note.alerte { color: var(--alerte); }
.note.warn { color: var(--orange-texte); }
.ligne-champs { display: flex; gap: 8px; }
.ligne-champs input { flex: 1; min-width: 0; border: 1px solid var(--trait); background: var(--surface); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.ligne-champs button { padding: 0 12px; border-radius: 12px; border: 1px solid var(--trait); background: var(--surface); font-size: 13px; color: var(--texte-2); white-space: nowrap; }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pave button { height: 48px; border-radius: 14px; background: var(--surface); font-family: var(--f-chiffre); font-size: 22px; font-weight: 500; box-shadow: 0 1px 0 var(--trait); }
.pave button:active { background: var(--surface-2); }
@media (min-width: 901px) and (pointer: fine) { .pave { display: none; } }
.enregistrer { height: 54px; border-radius: 16px; background: var(--texte); color: var(--bg); font-weight: 600; font-size: 16px; flex: 0 0 auto; }
.enregistrer:disabled { opacity: .35; cursor: default; }
.prep-cat { background: var(--surface); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.pc-haut { display: flex; align-items: center; gap: 10px; }
.pc-haut .ic { width: 30px; height: 30px; border-radius: 9px; }
.pc-haut .ic svg { width: 16px; height: 16px; }
.pc-haut b { flex: 1; font-size: 14px; }
.pc-ligne { display: grid; grid-template-columns: auto minmax(0, 1fr) 110px; gap: 6px; align-items: center; }
.pc-ligne.off input[type="text"], .pc-ligne.off .pc-m { opacity: .45; text-decoration: line-through; }
.pc-ligne input[type="text"], .pc-m { border: 0; background: var(--surface-2); padding: 7px 9px; border-radius: 10px; font-size: 13.5px; min-width: 0; }
.pc-m { text-align: right; }
.interr { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.interr input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.interr span { position: absolute; inset: 0; border-radius: 99px; background: var(--trait); transition: .2s; pointer-events: none; }
.interr span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.interr input:checked + span { background: var(--ok); }
.interr input:checked + span::after { transform: translateX(16px); }
.interr input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.prep-pied { position: sticky; bottom: -18px; background: var(--bg); padding: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--trait); }
.delai { font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--orange-texte); }

/* Message flottant */
.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); width: min(460px, calc(100vw - 2 * var(--gouttiere))); background: var(--texte); color: var(--bg); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; }
.toast.vu { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast span { flex: 1; }
.toast button { color: var(--orange); font-weight: 600; }

/* Écrans de connexion, blocage, verrou */
.ecran { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gouttiere); }
.ecran .boite { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.ecran h1 { font-family: var(--f-chiffre); font-size: 28px; margin: 8px 0 0; text-wrap: balance; }
.ecran p { margin: 0; color: var(--texte-2); }
.google { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 14px; background: var(--surface); border: 1px solid var(--trait); font-weight: 600; box-shadow: var(--ombre); }
.code { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code input { width: 100%; height: 58px; border-radius: 14px; border: 2px solid var(--trait); background: var(--surface); text-align: center; font: 600 26px var(--f-chiffre); }
.code input:focus { border-color: var(--accent); outline: none; }
.erreur { color: var(--alerte); font-size: 14px; min-height: 1em; }
.pin-points { display: flex; gap: 14px; justify-content: center; margin: 10px 0; }
.pin-points i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--texte-2); }
.pin-points i.plein { background: var(--texte); border-color: var(--texte); }
.seul-mobile { display: none; }
@media (max-width: 900px), (pointer: coarse) { .seul-mobile { display: block; } h2.seul-mobile { display: flex; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= Finition : allure moderne ================= */
:root { --rayon: 20px; --ressort: cubic-bezier(.32, .72, 0, 1); --hero: linear-gradient(140deg, #0A1424 0%, #102A4C 55%, #0E6A8C 130%); }
:root[data-theme="sombre"] { --hero: linear-gradient(140deg, #16294A 0%, #12325A 55%, #0E6A8C 140%); }
body { background:
  radial-gradient(900px 420px at 85% -120px, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
  radial-gradient(700px 380px at -10% 10%, color-mix(in srgb, var(--orange) 7%, transparent), transparent 70%), var(--bg);
  background-attachment: fixed; }
button, .btn, .compte, .fav, .cat, .mvt, .puce { transition: transform .15s var(--ressort), background-color .2s, box-shadow .2s, border-color .2s; }
button:active:not(:disabled), .btn:active { transform: scale(.97); }
.contenu.entree > * { animation: monte .45s var(--ressort) both; }
.contenu.entree > *:nth-child(2) { animation-delay: .03s; } .contenu.entree > *:nth-child(3) { animation-delay: .06s; }
.contenu.entree > *:nth-child(4) { animation-delay: .09s; } .contenu.entree > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes monte { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* En-tête */
.qui-suis-je { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #fff; font: 600 17px var(--f-chiffre); box-shadow: 0 8px 18px -8px rgba(14, 106, 140, .6); }
h2 .aide { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Carte portefeuille */
.hero { position: relative; overflow: hidden; margin-top: 10px; padding: 22px 22px 18px; border-radius: 26px; background: var(--hero); color: #fff;
  box-shadow: 0 24px 50px -24px rgba(10, 20, 36, .7), inset 0 1px 0 rgba(255, 255, 255, .08); isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: auto -80px -120px auto; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(242, 128, 58, .35), transparent 65%); z-index: -1; }
.hero::after { content: ""; position: absolute; inset: -140px auto auto -60px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(95, 208, 220, .22), transparent 65%); z-index: -1; }
.hero-haut { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: rgba(255, 255, 255, .72); flex-wrap: wrap; }
.hero-var { padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-weight: 500; color: #fff; font-size: 12px; }
.hero-var small { color: rgba(255, 255, 255, .6); }
.hero-var.monte { color: #8CE3B0; } .hero-var.baisse { color: #FFB59E; }
.hero-solde { font-size: clamp(36px, 7vw, 52px); font-weight: 600; margin: 6px 0 2px; letter-spacing: -.02em; }
.hero-solde small { color: rgba(255, 255, 255, .6); font-size: .45em; }
.courbe { display: block; width: 100%; height: 64px; margin: 4px 0 10px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hero-stats div { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 9px 11px; min-width: 0; backdrop-filter: blur(6px); }
.hero-stats span { display: block; font-size: 11px; line-height: 1.3; color: rgba(255, 255, 255, .65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-stats b { font-size: 15px; font-weight: 600; }
.cache .hero .sensible { filter: blur(10px); }

/* Comptes en cartes de couleur */
.comptes { margin-top: 0; padding-top: 2px; }
.compte { --c: #56627A; flex: 0 0 180px; min-height: 118px; gap: 10px; color: #fff; border-radius: 20px; position: relative; overflow: hidden;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 92%, #fff) 0%, var(--c) 45%, color-mix(in srgb, var(--c) 55%, #0A1424) 100%);
  box-shadow: 0 14px 26px -16px color-mix(in srgb, var(--c) 80%, #000); }
.compte::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.compte .pt { background: rgba(255, 255, 255, .22); }
.compte .m { font-size: 19px; margin-top: auto; }
.compte .m small { color: rgba(255, 255, 255, .75); }
.compte .num { font-size: 11.5px; color: rgba(255, 255, 255, .75); letter-spacing: .04em; }
.compte:hover { transform: translateY(-2px); }

/* Anneau du budget */
.anneau { width: 100%; text-align: left; border-radius: var(--rayon); }
.anneau > span { flex: 1; min-width: 0; }
.anneau .l1, .anneau .l2, .anneau .l3 { display: block; }
.anneau > svg:last-child { width: 18px; height: 18px; flex: 0 0 auto; color: var(--texte-2); }
.anneau-trait { animation: trace 1s var(--ressort) both; }
@keyframes trace { from { stroke-dasharray: 0 999; } }

/* Favoris */
.fav { border: 0; box-shadow: var(--ombre); padding: 8px 14px 8px 8px; border-radius: 16px; }
.fav > span:last-child { display: flex; flex-direction: column; text-align: left; line-height: 1.25; font-weight: 500; }
.fav b { font-size: 12px; color: var(--texte-2); font-weight: 600; }
.fav .ic { width: 34px; height: 34px; border-radius: 11px; }

/* Listes */
.liste, .carte { border-radius: var(--rayon); }
.mvt:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.ic { border-radius: 13px; }
.jour { position: sticky; top: 0; z-index: 2; padding: 8px 2px; margin: 10px 0 6px; background: linear-gradient(var(--bg) 70%, transparent); font-weight: 500; }
.puce[aria-pressed="true"] { box-shadow: 0 6px 14px -8px rgba(10, 20, 36, .6); }
.recherche { border: 0; box-shadow: var(--ombre); border-radius: 16px; }

/* Budget */
.barre { height: 8px; }
.barre i { background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #5FD0DC)); transition: width .8s var(--ressort); }
.barre i.warn { background: linear-gradient(90deg, #F2803A, #F6B26B); }
.barre i.trop { background: linear-gradient(90deg, #B42318, #F2803A); }
.resume div { border-radius: 16px; }
.cta { border-radius: var(--rayon); background: linear-gradient(120deg, var(--accent-doux), color-mix(in srgb, var(--orange) 10%, var(--accent-doux))); }

/* Saisie et fenêtres */
.feuille { transition: transform .38s var(--ressort), opacity .25s; border: 1px solid color-mix(in srgb, var(--trait) 60%, transparent); }
.saisie-montant .v { font-size: 52px; letter-spacing: -.02em; }
.types, .segment { border-radius: 16px; }
.cat { border-radius: 16px; }
.cat[aria-pressed="true"] { background: var(--surface); border-color: var(--accent); box-shadow: 0 10px 20px -14px var(--accent); }
.cat[aria-pressed="true"] .ic { transform: scale(1.06); }
.pave button { border-radius: 16px; box-shadow: var(--ombre); }
.enregistrer { background: linear-gradient(135deg, #0A1424, #16294A); box-shadow: 0 14px 28px -16px rgba(10, 20, 36, .8); }
:root[data-theme="sombre"] .enregistrer { background: linear-gradient(135deg, #F2803A, #E26A22); color: #fff; }
.enregistrer:not(:disabled):hover { transform: translateY(-1px); }

/* Boutons + */
.bulle-plus, .plus-centre { background: linear-gradient(140deg, #F6A14F, #F2803A 50%, #E2621A); }
.bulle-plus::after, .plus-centre::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 0 rgba(242, 128, 58, .45); animation: halo 2.8s ease-out 1.5s 2; }
.bulle-plus, .plus-centre { position: relative; }
@keyframes halo { to { box-shadow: 0 0 0 16px rgba(242, 128, 58, 0); } }
.bulle-plus:hover { transform: translateY(-3px) rotate(90deg); }

/* Barre d'onglets flottante (téléphone) */
@media (max-width: 900px), (pointer: coarse) {
  .barre-bas { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); padding: 6px 10px; border-radius: 26px; border: 1px solid color-mix(in srgb, var(--trait) 70%, transparent);
    background: color-mix(in srgb, var(--surface) 82%, transparent); box-shadow: 0 18px 40px -18px rgba(10, 20, 36, .45); }
  .barre-bas .onglet[aria-current="page"] svg { color: var(--accent); }
  .plus-centre { transform: translateY(-18px); border: 4px solid var(--bg); width: 64px; height: 64px; }
  .contenu { padding-bottom: 130px; }
  .toast { bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
}
/* Menu ordinateur */
.menu { background: color-mix(in srgb, var(--surface) 75%, transparent); backdrop-filter: blur(16px); }
.menu .onglet[aria-current="page"] { background: var(--texte); color: var(--bg); box-shadow: 0 10px 20px -12px rgba(10, 20, 36, .7); }
.menu .onglet:hover:not([aria-current]) { background: var(--surface-2); }

/* Écrans de connexion */
.ecran { background: radial-gradient(600px 400px at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); }
.ecran h1 { font-size: 34px; letter-spacing: -.02em; }
.google:hover { transform: translateY(-1px); box-shadow: 0 18px 30px -18px rgba(10, 20, 36, .5); }
.code input { border-radius: 16px; transition: border-color .2s, transform .2s; }
.code input:focus { transform: translateY(-2px); box-shadow: 0 10px 20px -14px var(--accent); }
@media (prefers-reduced-motion: reduce) { .contenu.entree > *, .anneau-trait, .bulle-plus::after, .plus-centre::after { animation: none !important; } }

@media (max-width: 480px) { .hero { padding: 18px 16px 14px; } .hero-stats div { padding: 8px 9px; } .hero-stats span { white-space: normal; } }
:root[data-theme="sombre"] .compte { border: 1px solid rgba(255, 255, 255, .1); }
#s-ok { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -12px 20px -6px var(--bg), 0 14px 28px -16px rgba(10, 20, 36, .8); }
@media (max-width: 900px), (pointer: coarse) { .pave button { height: 44px; } #saisie { gap: 10px; } .saisie-montant .v { font-size: 46px; } }

/* Épargne : répartition, cagnottes */
.hero-repart { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; color: rgba(255, 255, 255, .72); margin: 2px 0 4px; }
.hero-repart i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.hero-repart b { color: #fff; font-weight: 600; margin-left: 4px; }
.cagnottes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.cagnotte { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); text-align: left; border-left: 4px solid var(--c); min-width: 0; }
.cagnotte svg { flex: 0 0 56px; }
.cg-t { display: flex; flex-direction: column; min-width: 0; }
.cg-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-t span { font-size: 13px; }
.cg-t small { font-size: 12px; color: var(--texte-2); }
.cg-entete { padding: 14px; border-radius: 18px; background: color-mix(in srgb, var(--c) 10%, var(--surface)); }

/* Accueil (connexion, code, installation) : panneau illustré + carte */
.ecran.accueil { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); place-items: stretch; padding: 0; background: var(--bg); }
.accueil > .boite { align-self: center; justify-self: center; width: min(420px, 100%); padding: 48px var(--gouttiere); gap: 16px; animation: monter .6s var(--ressort) both; }
.accueil .logo { margin-bottom: 18px; }
.accueil .sur-titre { align-self: flex-start; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-doux); padding: 5px 10px; border-radius: 999px; }
.accueil h1 { font-size: 44px; line-height: 1.05; margin: 0; letter-spacing: -.03em; }
.accueil > .boite > p:not(.note):not(.erreur) { font-size: 16.5px; line-height: 1.55; }
.accueil .google { height: 56px; border-radius: 16px; font-size: 16px; margin-top: 8px; transition: transform .2s var(--ressort), box-shadow .2s; }
.accueil .google:active { transform: scale(.98); }
.accueil .etapes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.accueil .etapes span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--texte); font: 600 11px var(--f-chiffre); }
.accueil .etapes span:not(:first-child) { margin-left: 6px; }
.accueil .lien { align-self: center; text-decoration: underline; text-underline-offset: 3px; }

.visuel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 48px; min-height: 100vh; color: #fff; background: var(--hero); isolation: isolate; }
.visuel::before, .visuel::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); opacity: .55; }
.visuel::before { width: 420px; height: 420px; right: -120px; top: -80px; background: #0E6A8C; animation: flotter 14s ease-in-out infinite alternate; }
.visuel::after { width: 320px; height: 320px; left: -80px; bottom: -60px; background: #F2803A; opacity: .28; animation: flotter 18s ease-in-out infinite alternate-reverse; }
.visuel-logo { height: 26px; width: auto; align-self: flex-start; }
.visuel-texte h2 { font: 700 clamp(28px, 3.2vw, 42px)/1.08 var(--f-chiffre); letter-spacing: -.03em; margin: 0 0 22px; max-width: 14ch; text-wrap: balance; color: #fff; text-transform: none; display: block; }
.visuel-texte ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.visuel-texte li { padding: 9px 14px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); font-size: 14px; color: rgba(255, 255, 255, .82); backdrop-filter: blur(8px); }
.visuel-texte li b { color: #fff; font-family: var(--f-chiffre); margin-right: 4px; }

.visuel-scene { position: relative; flex: 1; min-height: 300px; }
.vcarte { position: absolute; border-radius: 22px; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(14px); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); animation: flotter 9s ease-in-out infinite alternate; }
.vcarte-solde { left: 6%; top: 14%; width: min(320px, 70%); padding: 22px; display: flex; flex-direction: column; gap: 18px; background: linear-gradient(150deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .05)); transform: rotate(-6deg); }
.vcarte-t { font-size: 13px; color: rgba(255, 255, 255, .75); }
.vcarte-barres { display: flex; flex-direction: column; gap: 9px; }
.vcarte-barres i { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .85); width: 72%; }
.vcarte-barres i:nth-child(2) { width: 48%; opacity: .5; }
.vcarte-barres i:nth-child(3) { width: 60%; opacity: .3; }
.vcarte-pied { display: flex; align-items: center; }
.vcarte-pied i { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9); background: #5FD0DC; }
.vcarte-pied i + i { margin-left: -10px; background: #F2803A; }
.vcarte-pied em { margin-left: 10px; font-style: normal; font-size: 13px; color: rgba(255, 255, 255, .8); }
.vcarte-anneau { right: 6%; top: 46%; padding: 18px 20px; display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 600; animation-duration: 11s; animation-delay: -3s; }
.vcarte-anneau svg { width: 58px; height: 58px; transform: rotate(-90deg); }
.vcarte-anneau circle { fill: none; stroke-width: 5; stroke: rgba(255, 255, 255, .14); }
.vcarte-anneau .a1 { stroke: #5FD0DC; stroke-dasharray: 42 100; stroke-linecap: round; }
.vcarte-anneau .a2 { stroke: #F2803A; stroke-dasharray: 22 100; stroke-dashoffset: -46; stroke-linecap: round; }
.vcarte-anneau .a3 { stroke: #fff; stroke-dasharray: 18 100; stroke-dashoffset: -72; stroke-linecap: round; }
.vcarte-puce { left: 14%; bottom: 8%; padding: 10px 16px 10px 12px; border-radius: 999px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; animation-duration: 7s; animation-delay: -1s; }
.vcarte-puce.p2 { left: auto; right: 22%; bottom: auto; top: 8%; animation-delay: -4s; }
.vcarte-puce i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent); }

@keyframes flotter { from { translate: 0 0; } to { translate: 0 -14px; } }
@keyframes monter { from { opacity: 0; translate: 0 16px; } to { opacity: 1; translate: 0 0; } }

@media (max-width: 900px) {
  .ecran.accueil { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .visuel { min-height: 0; padding: 20px var(--gouttiere) 26px; gap: 18px; border-radius: 0 0 28px 28px; }
  .visuel-scene, .visuel-texte ul { display: none; }
  .visuel-texte h2 { font-size: 24px; margin: 0; max-width: 20ch; }
  .accueil > .boite { padding: 28px var(--gouttiere) 40px; align-self: start; }
  .accueil > .boite > .logo { display: none; }
  .accueil h1 { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) { .visuel::before, .visuel::after, .vcarte, .accueil > .boite { animation: none !important; } }
