:root {
  --vert: #0B6B3A; --fond: #F5F7F6; --bord: #E3E6E8; --texte: #1B1F1D; --doux: #5F6B66;
  --rouge: #D93025; --orange: #F29900; --jaune: #E8B800; --vert-c: #1E8E3E; --bleu: #1A73E8;
  --rouge-f: #FDECEA; --orange-f: #FFF1E0; --jaune-f: #FFF8D6; --vert-c-f: #E6F4EA; --bleu-f: #E8F0FE;
  --rouge-t: #B3261E; --orange-t: #B25E00; --jaune-t: #7A6200; --vert-c-t: #1E6B34; --bleu-t: #174EA6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 760px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.page { padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); }
h1 { font-size: 24px; margin: 0 0 14px; font-weight: 800; }
h2 { font-size: 16px; margin: 18px 0 8px; }
a { color: var(--vert); }

/* barre du bas */
nav.onglets { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--bord); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav.onglets .in { display: flex; width: 100%; max-width: 760px; }
nav.onglets a { flex: 1; text-align: center; padding: 10px 4px 9px; text-decoration: none; color: var(--doux); font-size: 12px; font-weight: 600; }
nav.onglets a .ico { display: block; font-size: 22px; line-height: 1.1; }
nav.onglets a.actif { color: var(--vert); }

/* formulaires */
label { display: block; font-size: 13px; font-weight: 600; color: var(--doux); margin: 0 0 6px; }
.champ { margin-bottom: 14px; }
.saisie { display: flex; align-items: center; background: #fff; border: 1.5px solid var(--bord); border-radius: 12px; padding: 0 12px; }
.saisie input, .saisie textarea, .saisie select { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 17px; color: #111; padding: 12px 0; min-width: 0; }
.saisie textarea { min-height: 78px; resize: vertical; }
.saisie:focus-within { border-color: var(--vert); }
.oeil { border: 0; background: transparent; font-size: 18px; padding: 6px; cursor: pointer; }
input[type=search], .recherche { width: 100%; background: #fff; border: 1.5px solid var(--bord); border-radius: 12px; padding: 11px 14px; font: inherit; font-size: 16px; color: #111; margin-bottom: 10px; }

button.btn { display: block; width: 100%; border: 0; border-radius: 12px; background: var(--vert); color: #fff; font: inherit; font-size: 16px; font-weight: 700; padding: 14px 18px; min-height: 50px; cursor: pointer; text-align: center; text-decoration: none; }
button.btn.sec { background: #fff; color: var(--vert); border: 1.5px solid var(--vert); }
button.btn.danger { background: #B3261E; }
button.btn:disabled { opacity: .6; }
.rang { display: flex; gap: 10px; margin-bottom: 12px; }
.rang > * { flex: 1; }
a.btn { display: block; border-radius: 12px; background: var(--vert); color: #fff; font-weight: 700; padding: 14px 18px; text-align: center; text-decoration: none; }
a.btn.sec { background: #fff; color: var(--vert); border: 1.5px solid var(--vert); }
.espace { height: 12px; }

/* puces */
.puces { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; flex-wrap: nowrap; }
.puces.libre { flex-wrap: wrap; overflow: visible; }
.puces::-webkit-scrollbar { display: none; }
.puce { flex: 0 0 auto; border: 1.5px solid var(--bord); background: #fff; color: var(--texte); border-radius: 20px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.puce.actif { background: var(--vert); border-color: var(--vert); color: #fff; }
.puce.c-rouge.actif { background: var(--rouge); border-color: var(--rouge); }
.puce.c-orange.actif { background: var(--orange); border-color: var(--orange); }
.puce.c-jaune.actif { background: var(--jaune); border-color: var(--jaune); color: #222; }
.puce.c-vert.actif { background: var(--vert-c); border-color: var(--vert-c); }
.puce.c-bleu.actif { background: var(--bleu); border-color: var(--bleu); }

/* cartes */
.carte { background: #fff; border: 1px solid var(--bord); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.ligne-dette { display: flex; padding: 0; overflow: hidden; cursor: pointer; text-decoration: none; color: inherit; }
.ligne-dette .barre { width: 6px; background: #D5DAD7; flex: 0 0 auto; }
.ligne-dette .corps { flex: 1; padding: 12px; min-width: 0; }
.ligne-dette .haut { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ligne-dette .nom { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.montant { font-weight: 800; white-space: nowrap; }
.montant.recevoir { color: var(--vert-c-t); }
.montant.payer { color: var(--orange-t); }
.doux { color: var(--doux); font-size: 12px; margin-top: 2px; }
.msg { border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 13px; }
.b-rouge { background: var(--rouge); } .b-orange { background: var(--orange); } .b-jaune { background: var(--jaune); } .b-vert { background: var(--vert-c); } .b-bleu { background: var(--bleu); }
.m-rouge { background: var(--rouge-f); color: var(--rouge-t); } .m-orange { background: var(--orange-f); color: var(--orange-t); } .m-jaune { background: var(--jaune-f); color: var(--jaune-t); } .m-vert { background: var(--vert-c-f); color: var(--vert-c-t); } .m-bleu { background: var(--bleu-f); color: var(--bleu-t); }
.bord-rouge { border: 2px solid var(--rouge); } .bord-orange { border: 2px solid var(--orange); } .bord-jaune { border: 2px solid var(--jaune); } .bord-vert { border: 2px solid var(--vert-c); } .bord-bleu { border: 2px solid var(--bleu); }

.resume { display: flex; gap: 10px; margin-bottom: 12px; }
.resume .carte { flex: 1; margin: 0; }
.resume .t { font-size: 12px; font-weight: 600; color: var(--doux); }
.resume .v { font-size: 18px; font-weight: 800; margin-top: 2px; }

.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }
.kv span:first-child { color: var(--doux); }
.kv span:last-child { font-weight: 600; text-align: right; }
.gros { font-size: 30px; font-weight: 800; }
.erreur { background: var(--rouge-f); color: var(--rouge-t); border-radius: 10px; padding: 12px; margin-bottom: 14px; font-size: 14px; }
.ok { color: var(--vert-c-t); margin-bottom: 12px; }
.vide { text-align: center; color: var(--doux); padding: 36px 16px; }
.retour { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 600; }
.interrupteur { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.interrupteur input { width: 22px; height: 22px; accent-color: var(--vert); }
.menu { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.menu .ico { font-size: 26px; }
.menu .t { font-weight: 700; }
.centre { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.logo { font-size: 30px; font-weight: 800; color: var(--vert); }
.sous { color: var(--doux); margin: 4px 0 26px; }
.chargement { text-align: center; padding: 40px; color: var(--doux); }
