/* Finance : mobile d'abord. Onglets en bas sur téléphone, en haut sur PC (≥ 900 px). */
:root {
  --fond: #F5F6F8; --carte: #fff; --encre: #14161A; --doux: #5B6270; --bord: #E3E6EB;
  --champ: #D6DAE1; --accent: #1D4ED8; --accent-fonce: #1E3A8A; --accent-pale: #E3E8F7;
  --alerte: #B45309; --danger: #B91C1C; --ok: #15803D;
  --bleu: #1D4ED8; --bleu-pale: #EEF2FD; --orange: #EA8A2E; --orange-texte: #9A4A07; --orange-pale: #FDF1E4;
  --vert: #15803D; --vert-pale: #E8F5EC; --violet: #7C3AED; --violet-pale: #F1EAFD;
  --rayon: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.4 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
a:hover { color: var(--accent-fonce); }
h1 { font-size: 24px; margin: 0; }
h2.titre-section {
  margin: 20px 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--doux); display: flex; justify-content: space-between;
}
h2.titre-section span { text-transform: none; letter-spacing: 0; color: var(--encre); font-size: 15px; }
.cache { position: absolute; left: -9999px; }
.doux { color: var(--doux); }
.petit { font-size: 13px; }
.alerte { color: var(--alerte); }
.danger { color: var(--danger); }
.ok { color: var(--ok); }
.fort { font-weight: 700; }

/* --- Structure --------------------------------------------------------------------------- */
.conteneur { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.conteneur.large { max-width: 1160px; }
.entete { display: flex; align-items: center; gap: 8px; padding: 16px 0 12px; }
.entete h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.retour {
  width: 44px; height: 44px; margin-left: -10px; display: flex; align-items: center;
  justify-content: center; color: var(--encre); border-radius: 22px;
}
.colonnes { display: flex; flex-direction: column; gap: 16px; }

.barre-haut { display: none; }
.onglets-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: #fff; border-top: 1px solid var(--bord); padding-bottom: env(safe-area-inset-bottom);
}
.onglets-bas a {
  flex: 1; height: 64px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; text-decoration: none; color: var(--doux); font-size: 12px; font-weight: 500;
}
.onglets-bas a.actif { color: var(--accent); font-weight: 600; }

@media (min-width: 900px) {
  body { padding-bottom: 32px; }
  .onglets-bas { display: none; }
  .barre-haut { display: block; background: #fff; border-bottom: 1px solid var(--bord); }
  .barre-haut .conteneur { display: flex; align-items: center; gap: 28px; height: 60px; }
  .barre-haut .marque { font-weight: 700; font-size: 18px; }
  .barre-haut nav { display: flex; height: 100%; }
  .barre-haut nav a {
    display: flex; align-items: center; padding: 0 16px; text-decoration: none; color: var(--doux);
    font-weight: 500; border-bottom: 3px solid transparent;
  }
  .barre-haut nav a.actif { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
  .barre-haut .moi { margin-left: auto; }
  .entete .seulement-mobile { display: none; }
  .colonnes { flex-direction: row; align-items: flex-start; gap: 24px; }
  .colonnes > .gauche { flex: 0 0 380px; }
  .colonnes > .droite { flex: 1; min-width: 0; }
}

/* --- Éléments ---------------------------------------------------------------------------- */
.bloc { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; }
.liste { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); overflow: hidden; }
.liste > * + * { border-top: 1px solid #EEF0F3; }
.ligne {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-decoration: none; color: var(--encre);
}
a.ligne:hover { background: #FAFBFC; color: var(--encre); }
.ligne .milieu { flex: 1; min-width: 0; }
.ligne .titre { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ligne .sous { font-size: 12px; color: var(--doux); margin-top: 1px; }
.ligne .montant { font-weight: 600; white-space: nowrap; text-align: right; }
.empile { display: flex; flex-direction: column; gap: 10px; }

.pastille {
  width: 44px; height: 44px; border-radius: 10px; color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.pastille.petite { width: 32px; height: 32px; border-radius: 8px; font-size: 15px; }
.avatar {
  width: 34px; height: 34px; border-radius: 17px; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; text-decoration: none;
}
.avatar.grand { width: 44px; height: 44px; border-radius: 22px; font-size: 17px; }
.c-bleu { background: var(--bleu-pale); color: var(--bleu); }
.c-orange { background: var(--orange-pale); color: var(--orange-texte); }
.c-vert { background: var(--vert-pale); color: var(--vert); }
.c-violet { background: var(--violet-pale); color: var(--violet); }
.t-bleu { color: var(--bleu); } .t-orange { color: var(--orange-texte); }
.t-vert { color: var(--vert); } .t-violet { color: var(--violet); }
.b-bleu { background: var(--bleu); } .b-orange { background: var(--orange); }
.b-vert { background: var(--vert); } .b-violet { background: var(--violet); }

/* Boutons et champs : 44 px de haut au moins (doigt). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 0 16px; border-radius: 10px; border: 0; font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-fonce); color: #fff; }
.btn.plein { width: 100%; min-height: 50px; font-size: 16px; }
.btn.rond { border-radius: 22px; }
.btn.icone { width: 44px; padding: 0; border-radius: 22px; }
.btn.second { background: #EEF1F5; color: var(--encre); }
.btn.second:hover { background: #E2E6EC; }
.btn.contour { background: #fff; color: var(--encre); border: 1px solid var(--champ); }
.btn.contour-danger { background: #fff; color: var(--danger); border: 1px solid #F1C4C4; }
.btn.lien { background: none; color: var(--accent); padding: 0 4px; }
.rangee { display: flex; gap: 8px; }
.rangee > * { flex: 1; min-width: 0; }

label.etiquette { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.champ {
  width: 100%; min-height: 48px; border: 1px solid var(--champ); border-radius: 10px; padding: 0 12px;
  font: inherit; font-size: 16px; background: #fff; color: var(--encre);
}
.champ:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.champ.montant { font-weight: 600; text-align: right; }
.champ.gros { font-size: 22px; font-weight: 700; }
input[type=file].champ { padding: 10px 12px; }
.aide { font-size: 12px; color: var(--doux); margin-top: 4px; }
.champs { display: flex; flex-direction: column; gap: 14px; }
.erreur {
  background: #FEF2F2; border: 1px solid #F8C9C9; color: var(--danger); border-radius: 12px;
  padding: 10px 14px; font-size: 14px;
}

/* Interrupteur à segments (Il reste / J'ai payé, choix de la personne, filtres). */
.segments { display: flex; background: #E3E6EB; border-radius: 12px; padding: 4px; gap: 4px; }
.segments input { position: absolute; opacity: 0; pointer-events: none; }
.segments label, .segments a {
  flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: #4A515E; cursor: pointer; text-decoration: none; text-align: center;
}
.segments input:checked + label, .segments a.actif { background: #fff; color: var(--encre); }
.segments input:focus-visible + label { outline: 2px solid var(--accent); }
.segments.personnes input:checked + label { color: #fff; }
.segments.personnes input:checked + label.p-bleu { background: var(--bleu); }
.segments.personnes input:checked + label.p-orange { background: #B45309; }
.segments.personnes input:checked + label.p-vert { background: var(--vert); }
.segments.personnes input:checked + label.p-violet { background: var(--violet); }

.puces { display: flex; gap: 6px; }
.puces button {
  flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--champ); background: var(--fond);
  font: inherit; font-size: 14px; font-weight: 500; color: var(--encre); cursor: pointer;
}

/* Messages (toasts). */
.messages { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.message {
  border-radius: 12px; padding: 10px 14px; font-size: 14px; background: #14161A; color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.message.error { background: #FEF2F2; color: var(--danger); border: 1px solid #F8C9C9; }
.message form { margin: 0; }
.message .btn.lien { color: #9DB6FF; min-height: 32px; }

/* Cartes : image fixe de la carte telle qu'envoyée. */
.vignette {
  width: 96px; height: 60px; border-radius: 6px; object-fit: cover; background: #fff;
  box-shadow: 0 1px 4px rgba(20, 22, 26, .2); flex-shrink: 0;
}
.vignette.petite { width: 64px; height: 40px; border-radius: 5px; }
.image-carte {
  display: block; width: 100%; max-height: 62vh; object-fit: contain; border-radius: 12px; background: #fff;
  box-shadow: 0 2px 10px rgba(20, 22, 26, .18);
}
.plein-ecran {
  position: fixed; inset: 0; z-index: 50; background: #fff; display: none; align-items: center;
  justify-content: center; padding: 12px;
}
.plein-ecran.ouvert { display: flex; }
.plein-ecran img { max-width: 100%; max-height: 100%; object-fit: contain; }
.solde-grand { font-size: 34px; font-weight: 700; line-height: 1.1; }
.jauge { height: 6px; background: var(--bord); border-radius: 3px; margin: 10px 0 12px; overflow: hidden; }
.jauge > div { height: 100%; background: var(--accent); }
.carte-cadeau { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; }
.carte-cadeau .haut { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: var(--encre); }
.total-bas {
  display: flex; justify-content: space-between; align-items: center; margin-top: 16px;
}
.archives-lien {
  min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
  border-radius: 12px; border: 1px dashed #C4CAD3; text-decoration: none; color: var(--doux); font-size: 14px; margin-top: 16px;
}

/* Partage. */
.barre-parts { position: relative; display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bord); }
.barre-parts .cible { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--encre); }
.bilans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.bilan { padding: 12px; border-radius: 12px; }
.bilan .nom { font-size: 13px; font-weight: 600; }
.bilan .somme { font-size: 19px; font-weight: 700; margin-top: 4px; }
.rattrapage {
  margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: var(--encre); color: #fff;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.rattrapage b { font-size: 22px; white-space: nowrap; }
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th { font-size: 12px; font-weight: 500; color: var(--doux); text-align: left; padding: 8px 14px; }
.tableau td { padding: 9px 14px; border-top: 1px solid #EEF0F3; }
.tableau .nombre { text-align: right; white-space: nowrap; }
.tableau td:first-child { white-space: nowrap; }
.defile { overflow-x: auto; }
.avertissement {
  padding: 14px; border-radius: 14px; background: #FFF7ED; border: 1px solid #F5D3A8; font-size: 14px; line-height: 1.5;
}

/* Connexion. */
.connexion { max-width: 420px; margin: 0 auto; padding: 12vh 24px 24px; }
.logo {
  width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.case { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; }
.case input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.code-saisie { font-size: 28px; font-weight: 600; letter-spacing: .25em; text-align: center; min-height: 64px; }
