:root {
  --o: #7b4bc4; --o-clair: #f1eafb;      /* Ophélie : violet */
  --z: #00897b; --z-clair: #e0f2f1;      /* Zoé : sarcelle */
  --c: #e08a00; --c-clair: #fff4e0;      /* Logoph (à deux) : orange doré */
  --i: #1e6fb8; --i-clair: #e6f0fa;      /* Immo : bleu */
  --t: #c2185b; --t-clair: #fce4ec;      /* À traiter : framboise */
  --ok: #2e7d32; --ok-clair: #e8f5e9; --moyen: #b26a00; --moyen-clair: #fff4e0; --ko: #c62828; --ko-clair: #ffebee;
  --texte: #2b2b33; --gris: #777; --fond: #fbf9fc; --carte: #fff; --trait: #e7e2ec;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Lato", "DejaVu Sans", system-ui, sans-serif; color: var(--texte); background: var(--fond); font-size: 15px; }
a { color: inherit; }
button, .bouton { font: inherit; font-size: 13px; padding: 5px 10px; border: 1px solid var(--trait); border-radius: 8px; background: #fff; cursor: pointer; text-decoration: none; color: inherit; }
button:hover { background: #f6f2f8; }

/* ---------- barre du haut */
header { background: var(--carte); border-bottom: 1px solid var(--trait); position: sticky; top: 0; z-index: 5; }
.barre { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 18px; max-width: 1200px; margin: 0 auto; }
.logo { font-weight: 800; color: var(--t); font-size: 18px; text-decoration: none; margin-right: 6px; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a { text-decoration: none; padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--gris); }
nav a:hover { background: #f3eff6; }
nav a.actif { color: #fff; }
nav a.a_traiter.actif { background: var(--t); } nav a.ophelie.actif { background: var(--o); } nav a.zoe.actif { background: var(--z); }
nav a.commun.actif { background: var(--c); } nav a.immo.actif { background: var(--i); }
.pastille { background: var(--t); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
nav a.actif .pastille { background: #fff; color: var(--t); }
.outils { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.outils form { margin: 0; }

main { max-width: 1200px; margin: 0 auto; padding: 18px 18px 60px; }
h1 { margin: 4px 0 4px; font-size: 26px; }
.aide { color: var(--gris); font-size: 14px; margin: 0 0 14px; }
.flash { background: var(--ok-clair); border: 1px solid #c8e6c9; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }

/* ---------- mois */
.mois { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mois a { text-decoration: none; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--trait); background: #fff; font-size: 14px; }
.mois a.actif { background: var(--t); color: #fff; border-color: var(--t); font-weight: 700; }
.mois a small { opacity: .75; margin-left: 3px; }
.outils-page { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.outils-page input[type=search] { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--trait); border-radius: 8px; flex: 1; min-width: 220px; }

/* ---------- la liste des sorties */
table.sorties { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--trait); border-radius: 12px; overflow: hidden; font-size: 14px; }
.sorties th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--gris); padding: 8px 10px; border-bottom: 1px solid var(--trait); background: #faf8fb; }
.sorties td { padding: 8px 10px; border-bottom: 1px solid #f2eef5; vertical-align: top; }
.sorties tr:last-child td { border-bottom: none; }
.sorties td.d { white-space: nowrap; color: var(--gris); width: 52px; }
.sorties td.m, .sorties th.m { text-align: right; white-space: nowrap; font-weight: 700; }
.sorties .detail { color: var(--gris); font-size: 12px; margin-top: 2px; }
.sorties tr.parti { opacity: 0; transition: opacity .25s; }
.sorties tr.mois-tete td { background: #faf8fb; font-weight: 800; color: #555; }

.compte { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.compte.commun { background: var(--c-clair); color: #8a5500; } .compte.ophelie { background: var(--o-clair); color: var(--o); }
.compte.zoe { background: var(--z-clair); color: var(--z); } .compte.epargne { background: #eee; color: #555; }

/* preuve Clearfacts */
.preuve { font-size: 12.5px; line-height: 1.35; max-width: 270px; }
.preuve .etat { font-weight: 800; }
.preuve.ok .etat { color: var(--ok); } .preuve.moyen .etat { color: var(--moyen); } .preuve.ko .etat { color: var(--ko); } .preuve.neutre .etat { color: var(--gris); }
.preuve button { font-size: 11.5px; padding: 1px 7px; margin-top: 3px; }

/* proposition + choix */
.choix { white-space: nowrap; }
.choix .src { display: block; font-size: 11px; color: var(--gris); margin-top: 3px; white-space: normal; }
.choix button { font-weight: 700; font-size: 12px; padding: 4px 9px; border-radius: 999px; }
.choix button.ophelie { color: var(--o); border-color: var(--o); } .choix button.zoe { color: var(--z); border-color: var(--z); }
.choix button.commun { color: var(--c); border-color: var(--c); } .choix button.immo { color: var(--i); border-color: var(--i); }
.choix button.ok { color: #fff; font-size: 13px; padding: 5px 12px; margin-right: 6px; }
.choix button.ok.ophelie { background: var(--o); } .choix button.ok.zoe { background: var(--z); }
.choix button.ok.commun { background: var(--c); } .choix button.ok.immo { background: var(--i); }
.choix .autres button { opacity: .55; } .choix .autres button:hover { opacity: 1; }
.choix .autres { display: inline-flex; gap: 3px; }
.choix button.mesure { border-color: #bbb; color: #666; }

.fini { text-align: center; padding: 40px; background: #fff; border: 1px dashed var(--trait); border-radius: 14px; color: var(--gris); font-size: 17px; }
.fini b { color: var(--ok); }

/* ---------- tiroirs */
h1.ophelie { color: var(--o); } h1.zoe { color: var(--z); } h1.commun { color: var(--c); } h1.immo { color: var(--i); }
.renvoyer { opacity: .25; } tr:hover .renvoyer { opacity: 1; }

/* ---------- fenêtre « relier une facture » */
dialog { border: 1px solid var(--trait); border-radius: 14px; padding: 16px 18px; width: min(720px, 94vw); }
dialog::backdrop { background: rgba(40, 20, 50, .25); }
dialog h3 { margin: 0 0 8px; }
dialog input[type=search] { font: inherit; width: 100%; padding: 7px 10px; border: 1px solid var(--trait); border-radius: 8px; margin-bottom: 8px; }
dialog table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
dialog td { padding: 5px 6px; border-bottom: 1px solid #f2eef5; }
dialog td.m { text-align: right; white-space: nowrap; }
dialog tr.prise { color: #aaa; }

/* ---------- filtres */
.filtres { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; background: #fff; border: 1px solid var(--trait); border-radius: 12px; padding: 10px 12px; }
.filtres input[type=search] { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--trait); border-radius: 8px; margin-top: 2px; }
.filtre { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.filtre .f-titre { width: 74px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--gris); }
.filtre a { cursor: pointer; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--trait); font-size: 13px; user-select: none; }
.filtre a:hover { background: #f6f2f8; }
.filtre a.actif { background: #555; color: #fff; border-color: #555; }
.filtre a.ophelie.actif { background: var(--o); border-color: var(--o); } .filtre a.zoe.actif { background: var(--z); border-color: var(--z); }
.filtre a.commun.actif { background: var(--c); border-color: var(--c); } .filtre a.immo.actif { background: var(--i); border-color: var(--i); }

/* ---------- tiroirs */
h2.section { font-size: 18px; margin: 22px 0 8px; color: #555; }
.deplacer { font-size: 15px; padding: 3px 9px; opacity: .35; } tr:hover .deplacer { opacity: 1; }
.mesure-info { color: var(--c) !important; font-weight: 700; }
.totaux-vers { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.totaux-vers .compte { font-size: 13px; padding: 5px 12px; font-weight: 600; }

/* ---------- l'encart « pour qui ? » */
#encart { width: min(480px, 94vw); }
#encart h3 { margin: 0; } #encart .detail { color: var(--gris); margin-bottom: 12px; }
.enc-tiroirs { display: flex; gap: 6px; flex-wrap: wrap; white-space: normal; }
.enc-tiroirs button.ok { flex: 1; margin: 0; padding: 8px 10px; }
.enc-partage { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--trait); }
.enc-lib { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--gris); margin-bottom: 8px; }
#enc-r { width: 100%; -webkit-appearance: none; appearance: none; height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--o) var(--p, 50%), var(--z) var(--p, 50%)); }
#enc-r::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #555; cursor: grab; }
#enc-r::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #555; }
.enc-parts { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }
.enc-parts label { font-weight: 700; font-size: 14px; } .enc-parts .o { color: var(--o); } .enc-parts .z { color: var(--z); }
.enc-parts input { font: inherit; width: 90px; text-align: right; padding: 5px 8px; border: 1px solid var(--trait); border-radius: 8px; }
#enc-pct { font-size: 12px; color: var(--gris); }
button.plein { background: var(--c); color: #fff; border-color: var(--c); font-weight: 700; padding: 7px 14px; }
.enc-bas { display: flex; justify-content: space-between; margin: 14px 0 0; }

/* ---------- résumé */
nav a.resume.actif { background: var(--t); }
.entete-resume { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.arrete { display: flex; gap: 8px; align-items: center; color: var(--gris); font-size: 14px; }
.arrete select { font: inherit; padding: 5px 8px; border: 1px solid var(--trait); border-radius: 8px; background: #fff; }
.encart { background: var(--carte); border: 1px solid var(--trait); border-radius: 16px; padding: 18px 22px; margin-bottom: 18px; }
.encart h2 { margin: 0 0 12px; font-size: 20px; } .encart h2 small { font-weight: 400; color: var(--gris); font-size: 14px; margin-left: 6px; }
.encart.annuel { border: 2px solid #f8d7e6; }
.total-annuel { text-align: center; margin: 4px 0 16px; }
.total-annuel span { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; color: var(--gris); }
.total-annuel b { display: block; font-size: 40px; color: var(--t); line-height: 1.15; }
.total-annuel small { color: var(--gris); font-size: 12px; }
.equation { display: flex; align-items: stretch; justify-content: center; gap: 8px; flex-wrap: wrap; }
.equation .case { flex: 1; min-width: 150px; text-align: center; background: #faf8fb; border: 1px solid var(--trait); border-radius: 12px; padding: 10px; }
.equation .case span { display: block; font-size: 13px; color: var(--gris); font-weight: 700; }
.equation .case b { display: block; font-size: 22px; margin: 2px 0; }
.equation .case small { font-size: 11.5px; color: var(--gris); }
.equation .case.fort { border-color: #555; } .equation .case.ok { background: var(--ok-clair); border-color: #c8e6c9; } .equation .case.ok b { color: var(--ok); }
.equation .case.ko { background: var(--ko-clair); border-color: #ffcdd2; } .equation .case.ko b { color: var(--ko); }
.equation .op { align-self: center; font-size: 20px; color: var(--gris); font-weight: 700; }
.verdict { margin: 14px 0 6px; padding: 12px; border-radius: 12px; text-align: center; font-weight: 700; }
.verdict.ok { background: var(--ok-clair); color: var(--ok); } .verdict.ko { background: var(--ko-clair); color: var(--ko); }
.detail-frais { margin: 10px 0 4px; } .detail-frais summary { cursor: pointer; color: var(--gris); font-size: 14px; }
.detail-frais table { margin-top: 8px; }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { padding: 6px 8px; border-bottom: 1px solid var(--trait); text-align: left; }
table.simple th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--gris); }
table.simple .m { text-align: right; white-space: nowrap; }
table.simple .o { color: var(--o); } table.simple .z { color: var(--z); }
table.simple tr.tot td { font-weight: 800; border-top: 2px solid var(--trait); }
.voyant { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; } .voyant.vert { background: #43a047; } .voyant.rouge { background: #e53935; }

.barres-titre { margin: 20px 0 8px; font-size: 16px; color: #555; }
.barre-perso { display: grid; grid-template-columns: 150px 1fr 200px; gap: 14px; align-items: center; margin: 10px 0; }
.barre-perso .nom { font-weight: 800; font-size: 16px; } .barre-perso .nom small { display: block; font-weight: 400; font-size: 12px; color: var(--gris); }
.barre-perso.ophelie .nom { color: var(--o); } .barre-perso.zoe .nom { color: var(--z); }
.barre-perso .tube { position: relative; height: 26px; background: #f2eef5; border-radius: 999px; overflow: hidden; }
.barre-perso .plein { height: 100%; border-radius: 999px; }
.barre-perso.ophelie .plein { background: linear-gradient(90deg, #b39ddb, var(--o)); } .barre-perso.zoe .plein { background: linear-gradient(90deg, #80cbc4, var(--z)); }
.barre-perso .repere { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #333; border-radius: 2px; }
.barre-perso .tube span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 800; color: #222; text-shadow: 0 0 4px #fff, 0 0 4px #fff; }
.barre-perso .chiffres { font-size: 13px; } .barre-perso .chiffres small { color: var(--gris); }
.vert { color: var(--ok); } .rouge { color: var(--ko); }

.deux-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.encart.perso h2 { color: #fff; margin: -18px -22px 14px; padding: 10px 22px; border-radius: 15px 15px 0 0; }
.encart.perso.ophelie h2 { background: var(--o); } .encart.perso.zoe h2 { background: var(--z); }
details.chiffre { border-bottom: 1px solid #f2eef5; }
details.chiffre summary { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; cursor: pointer; list-style: none; }
details.chiffre summary::-webkit-details-marker { display: none; }
details.chiffre[data-sans-detail] summary { cursor: default; }
details.chiffre summary .t { font-weight: 700; } details.chiffre summary .t small { display: block; font-weight: 400; font-size: 12px; color: var(--gris); }
details.chiffre summary b { white-space: nowrap; font-size: 16px; }
details.chiffre.plus summary b::before { content: "+ "; color: var(--ok); } details.chiffre.moins summary b::before { content: "− "; color: var(--ko); }
details.chiffre.info summary .t, details.chiffre.info summary b { color: var(--gris); font-weight: 600; }
details.chiffre:not([data-sans-detail]) summary b::after { content: " ▾"; color: #bbb; font-size: 11px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 0 0 8px; background: #faf8fb; border-radius: 8px; }
table.mini td { padding: 3px 8px; } table.mini .d { color: var(--gris); width: 48px; } table.mini .m { text-align: right; white-space: nowrap; }
.difference { margin: 14px 0 6px; padding: 12px; border-radius: 12px; text-align: center; font-size: 16px; }
.difference b { font-size: 22px; } .difference small { display: block; font-size: 12px; margin-top: 2px; }
.difference.ok { background: var(--ok-clair); color: var(--ok); } .difference.ko { background: var(--ko-clair); color: var(--ko); }
.infos { margin-top: 10px; }
.pied { text-align: right; font-size: 12px; } .pied a { color: #bbb; text-decoration: none; } .pied a:hover { color: var(--gris); }

/* ---------- pilotage */
.ligne-champs { display: flex; gap: 30px; flex-wrap: wrap; } .ligne-champs label { font-weight: 700; }
.ligne-champs .o { color: var(--o); } .ligne-champs .z { color: var(--z); }
.encart input, .encart select { font: inherit; font-size: 13.5px; padding: 4px 7px; border: 1px solid var(--trait); border-radius: 7px; width: 120px; }
.encart input.large { width: 100%; min-width: 200px; } .encart input.court { width: 85px; text-align: right; }
.encart input[type=checkbox] { width: auto; }
.ligne-champs input { width: 100px; text-align: right; }

@media (max-width: 800px) { .deux-col { grid-template-columns: 1fr; } .barre-perso { grid-template-columns: 1fr; } }
@media print {
  header, .arrete, .pied, .detail-frais summary { display: none; }
  body { background: #fff; } main { padding: 0; } .encart { break-inside: avoid; }
  details.chiffre summary .t::after { content: ""; }
}
/* verdict « le compte devrait avoir » */
.verdict { text-align: left; font-weight: 400; color: #333 !important; line-height: 1.5; }
.verdict p { margin: 4px 0; } .verdict small { color: var(--gris); }
.verdict .qui { margin: 8px 0 2px; padding-left: 20px; }
.verdict .qui li.ophelie::marker { color: var(--o); } .verdict .qui li.zoe::marker { color: var(--z); }
.verdict.ok { border-left: 5px solid var(--ok); } .verdict.ko { border-left: 5px solid var(--ko); }
.barre-perso .chiffres .vert { color: var(--ok); font-weight: 700; } .barre-perso .chiffres .rouge { color: var(--ko); font-weight: 700; }
.barre-perso { grid-template-columns: 150px 1fr 240px; }
/* factures sans extrait */
.fact { background: #fff; border: 1px solid #eee6f0; border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.fact-tete { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fact-tete .m { margin-left: auto; white-space: nowrap; }
.fact .mini { margin-top: 8px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #eee; color: #555; margin-right: 4px; }
.badge.ok { background: var(--ok-clair); color: var(--ok); }
button.petit, a.petit { font-size: 12px; padding: 2px 8px; }
a.petit { color: var(--gris); }
tr.neutre td { color: #aaa; text-decoration: line-through; } tr.neutre td:last-child { text-decoration: none; }
.entre h3 { font-size: 14px; margin: 10px 0 4px; color: var(--gris); }

/* ------------------------------------------------------------ connexion */
main.connexion, .connexion { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.connexion form { display: flex; flex-direction: column; gap: 14px; }
.connexion h1 { margin: 0 0 4px; color: var(--t); text-align: center; }
.connexion label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--gris); }
.connexion input { width: 100%; box-sizing: border-box; font-size: 16px; padding: 9px 10px; border: 1px solid var(--trait); border-radius: 8px; }
.connexion button { font-size: 16px; padding: 10px; }
