/* Charte Sonalia — identique au CRM */
:root {
  --nuit: #0C1A30;
  --marine: #17335F;
  --marine-clair: #1E4178;
  --creme: #FAF8F4;
  --orange: #FF6B1A;
  --orange-fonce: #B04800;
  --vert: #3DBE7B;
  --vert-fonce: #1E7A4C;
  --rouge: #E5484D;
  --radius: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Archivo', system-ui, sans-serif;
  background: var(--creme);
  color: var(--nuit);
  min-height: 100dvh;
}
.cache { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---- Connexion ---- */
#ecran-connexion {
  min-height: 100dvh;
  background: var(--nuit);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.connexion-boite { width: 100%; max-width: 360px; text-align: center; }
.connexion-logo { width: 180px; max-width: 60%; margin-bottom: 8px; }
.connexion-titre {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 22px; letter-spacing: .04em;
  color: var(--creme); text-transform: uppercase; margin-bottom: 28px;
}
#form-connexion { text-align: left; }
#form-connexion label {
  display: block; color: #B8C4D8; font-size: 13px; font-weight: 600;
  margin: 14px 0 6px;
}
#form-connexion input {
  width: 100%; padding: 14px; font-size: 16px;
  border-radius: var(--radius); border: 1px solid var(--marine-clair);
  background: var(--marine); color: var(--creme); font-family: inherit;
}
#form-connexion input:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
#btn-connexion {
  width: 100%; margin-top: 22px; padding: 15px;
  background: var(--orange); color: #fff; border: none;
  border-radius: var(--radius); font-size: 17px; font-weight: 700;
}
#btn-connexion:disabled { opacity: .6; }
.connexion-aide { color: #7D8CA6; font-size: 13px; margin-top: 20px; text-align: center; }
.erreur { color: var(--rouge); font-size: 14px; margin-top: 12px; font-weight: 600; }

/* ---- Structure app ---- */
.entete {
  background: var(--nuit);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  position: sticky; top: 0; z-index: 10;
}
.entete-logo { height: 24px; }
.entete-sortie {
  background: none; border: 1px solid var(--marine-clair); color: #B8C4D8;
  border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 600;
}
main {
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}
.barre-onglets {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: #fff; border-top: 1px solid #E8E3D9;
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.barre-onglets button {
  flex: 1; background: none; border: none; padding: 10px 4px 8px;
  font-size: 11.5px; font-weight: 600; color: #8A93A3;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.barre-onglets button .ico { width: 21px; height: 21px; }
.barre-onglets button.actif { color: var(--orange); }
.ico-boite { position: relative; display: block; line-height: 0; }
.pastille-onglet {
  position: absolute; top: -5px; left: 13px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
}
@media (max-width: 400px) {
  .barre-onglets button { font-size: 10.5px; padding: 10px 2px 8px; }
  .barre-onglets button .ico { width: 20px; height: 20px; }
}

/* ---- Cartes & titres ---- */
.carte {
  background: #fff; border: 1px solid #EDE8DE; border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.titre-section {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800; font-size: 20px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--marine);
  margin: 20px 0 10px;
}
.titre-section:first-child { margin-top: 4px; }

/* ---- Bandeau état ---- */
.bandeau-etat {
  border-radius: var(--radius); padding: 14px 16px;
  font-weight: 700; font-size: 16px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.bandeau-etat.ok { background: #E7F7EE; color: #1E7A4C; border: 1px solid #BDE8D1; }
.bandeau-etat.alerte { background: #FFF0E5; color: #B04800; border: 1px solid #FFD3B0; }
.bandeau-etat .point { width: 10px; height: 10px; border-radius: 50%; background: var(--vert); flex: none; }
.bandeau-etat.alerte .point { background: var(--orange); }
.bandeau-sous { font-weight: 500; font-size: 13px; opacity: .85; }

/* ---- Compteurs ---- */
.grille-compteurs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compteur { background: #fff; border: 1px solid #EDE8DE; border-radius: var(--radius); padding: 14px; }
.compteur .valeur {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800;
  font-size: 44px; line-height: 1; color: var(--nuit);
}
.compteur .libelle { font-size: 12.5px; font-weight: 600; color: #6B7686; margin-top: 4px; }
.carte-estimation {
  grid-column: 1 / -1;
  background: var(--nuit); border: none; border-radius: var(--radius);
  padding: 16px; color: var(--creme);
}
.carte-estimation .valeur {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800;
  font-size: 46px; line-height: 1; color: var(--orange);
}
.carte-estimation .libelle { font-size: 13px; font-weight: 600; color: #B8C4D8; margin-top: 4px; }

/* ---- Jauge minutes ---- */
.jauge-fond { background: #EDE8DE; border-radius: 99px; height: 12px; overflow: hidden; margin: 10px 0 8px; }
.jauge-barre { height: 100%; background: var(--vert); border-radius: 99px; transition: width .4s; }
.jauge-barre.haut { background: var(--orange); }
.jauge-barre.plein { background: var(--rouge); }
.jauge-chiffres { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: #6B7686; }
.jauge-chiffres strong { color: var(--nuit); font-size: 15px; }
.note-demarchage { font-size: 12px; color: #8A93A3; margin-top: 8px; }

/* ---- Fil d'activité / listes ---- */
.ligne {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #F1EDE4;
}
.ligne:last-child { border-bottom: none; }
.ligne-date { font-size: 12px; color: #8A93A3; font-weight: 600; white-space: nowrap; padding-top: 2px; min-width: 52px; }
.ligne-texte { font-size: 14.5px; line-height: 1.4; flex: 1; }
.ligne-montant { font-weight: 700; color: var(--marine); white-space: nowrap; }
.vide { color: #6B7686; font-size: 14px; padding: 8px 0; }

/* ---- Appels ---- */
.appel { padding: 14px 0; border-bottom: 1px solid #F1EDE4; }
.appel:last-child { border-bottom: none; }
.appel-haut { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.appel-qui { font-weight: 700; font-size: 15px; }
.appel-quand { font-size: 12px; color: #8A93A3; font-weight: 600; white-space: nowrap; }
.appel-resume { font-size: 14px; line-height: 1.45; color: #3D4657; margin-bottom: 8px; }
.appel-bas { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge { font-size: 12px; font-weight: 700; border-radius: 99px; padding: 4px 11px; }
.badge.rappel { background: #FFF0E5; color: #B04800; }
.badge.rdv_pris { background: #E7F7EE; color: #1E7A4C; }
.badge.info_donnee { background: #EDF1F8; color: var(--marine); }
.badge.demarchage_filtre { background: #F1EDE4; color: #8A93A3; }
.btn-rappeler {
  background: var(--orange); color: #fff; border: none; border-radius: 10px;
  padding: 9px 16px; font-size: 14px; font-weight: 700; text-decoration: none;
}

/* ---- À rappeler ---- */
.mode-emploi {
  background: #EDF1F8; border: 1px solid #D7E0F0; border-radius: var(--radius);
  padding: 13px 15px; font-size: 13.5px; line-height: 1.5;
  color: var(--marine); margin-bottom: 4px;
}
.mode-emploi + .titre-section, .alerte-lead + .titre-section { margin-top: 16px; }
.raccourci-rappels {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: #FFF0E5; border: 1px solid #FFD3B0; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; text-align: left; color: var(--orange-fonce);
}
.raccourci-nombre {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 30px;
  line-height: 1; color: var(--orange-fonce);
}
.raccourci-texte { font-size: 15px; font-weight: 700; flex: 1; }
.raccourci-fleche { font-size: 26px; line-height: 1; opacity: .7; }

.titre-compte { display: flex; align-items: center; gap: 9px; }
.compte-attente {
  font-family: 'Archivo', system-ui, sans-serif; font-weight: 700; font-size: 13px;
  background: var(--orange); color: #fff; border-radius: 99px;
  padding: 2px 10px; letter-spacing: 0;
}
.alerte-lead {
  background: #FDECEC; border: 1px solid #F5C2C4; color: #A32328;
  border-radius: var(--radius); padding: 12px 14px; margin: 12px 0 0;
  font-size: 14px; font-weight: 600; line-height: 1.45;
}
.alerte-lead:focus { outline: 2px solid #A32328; outline-offset: 2px; }

.lead { padding: 15px 0; border-bottom: 1px solid #F1EDE4; }
.lead:first-child { padding-top: 2px; }
.lead:last-child { border-bottom: none; padding-bottom: 2px; }
.lead-haut { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lead-qui { font-weight: 700; font-size: 15.5px; line-height: 1.3; overflow-wrap: anywhere; }
.lead-coche { color: var(--vert-fonce); margin-right: 6px; }
.lead-quand { font-size: 12px; color: #6B7686; font-weight: 600; white-space: nowrap; }
.lead-tel {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 9px;
  min-height: 44px; padding: 8px 14px;
  background: #F4F7FC; border: 1px solid #D7E0F0; border-radius: 10px;
  font-size: 17px; font-weight: 700; color: var(--marine);
  text-decoration: none; white-space: nowrap;
}
.lead-tel svg { width: 17px; height: 17px; flex: none; }
.lead-tel.absent {
  background: #F6F4EF; border-color: #E8E3D9; color: #8A93A3;
  font-size: 14px; font-weight: 600; min-height: 0; padding: 7px 12px;
}
.lead-besoin { font-size: 14.5px; line-height: 1.5; color: #3D4657; margin-top: 10px; overflow-wrap: anywhere; }
.lead-commentaire { font-size: 13.5px; line-height: 1.45; color: #6B7686; margin-top: 6px; overflow-wrap: anywhere; }
.lead-bas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 13px; }
.btn-rappele {
  background: var(--orange); color: #fff; border: none; border-radius: 10px;
  min-height: 44px; padding: 11px 22px; font-size: 15.5px; font-weight: 700;
}
.btn-sans-suite {
  background: none; border: none; color: #6B7686;
  font-size: 13.5px; font-weight: 600; text-decoration: underline;
  min-height: 44px; padding: 6px 2px;
}
.pastille-source {
  margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--marine);
  background: #EDF1F8; border-radius: 99px; padding: 4px 10px; white-space: nowrap;
}
.etat-ok { display: flex; align-items: flex-start; gap: 11px; padding: 4px 0; }
.etat-ok-coche {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: #E7F7EE; color: var(--vert-fonce);
  font-size: 15px; font-weight: 700; line-height: 26px; text-align: center;
}
.etat-ok strong { font-size: 15px; }
.etat-ok .vide { padding: 2px 0 0; }

/* Traités — le fait accompli, en vert et replié */
.bloc-traites { margin-top: 20px; }
.bloc-traites > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 20px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--vert-fonce);
  padding: 6px 0 10px;
}
.bloc-traites > summary::-webkit-details-marker { display: none; }
.bloc-traites .chevron { display: inline-block; font-size: 22px; line-height: .8; transition: transform .2s; }
.bloc-traites[open] .chevron { transform: rotate(90deg); }
.compte-traites {
  font-family: 'Archivo', system-ui, sans-serif; font-weight: 700; font-size: 12.5px;
  background: #E7F7EE; color: var(--vert-fonce); border-radius: 99px;
  padding: 2px 9px; letter-spacing: 0;
}
.lead-fait .lead-qui { color: #3D4657; }
.lead-fait .lead-tel { font-size: 15px; background: #FBFAF7; border-color: #E8E3D9; color: #4A5567; }
.lead-fait-quand { font-size: 12.5px; font-weight: 600; color: var(--vert-fonce); }
.btn-remettre {
  background: none; border: 1px solid #D8D2C6; color: var(--marine);
  border-radius: 10px; min-height: 40px; padding: 9px 14px;
  font-size: 13.5px; font-weight: 700;
}
@media (prefers-reduced-motion: reduce) { .bloc-traites .chevron { transition: none; } }

/* ---- Installation ---- */
.brique { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #F1EDE4; }
.brique:last-child { border-bottom: none; }
.brique-pastille { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.brique-pastille.active { background: var(--vert); }
.brique-pastille.suspendue { background: var(--orange); }
.brique-pastille.dispo { background: #D8D2C6; }
.brique-nom { font-weight: 600; font-size: 14.5px; flex: 1; line-height: 1.35; }
.brique.grisee .brique-nom { color: #9AA1AE; font-weight: 500; }
.brique-etiquette { font-size: 11.5px; font-weight: 700; color: #8A93A3; border: 1px solid #E3DDD0; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.brique-etiquette.susp { color: #B04800; border-color: #FFD3B0; }
.config-texte { font-size: 14.5px; line-height: 1.55; white-space: pre-line; }
.btn-ajustement {
  width: 100%; padding: 14px; background: var(--marine); color: #fff;
  border: none; border-radius: var(--radius); font-size: 15px; font-weight: 700;
}
#form-ajustement textarea {
  width: 100%; min-height: 110px; padding: 12px; font-family: inherit; font-size: 15px;
  border: 1px solid #D8D2C6; border-radius: var(--radius); resize: vertical; background:#fff;
}
#form-ajustement textarea:focus { outline: 2px solid var(--orange); }
.confirmation { background: #E7F7EE; color: #1E7A4C; border-radius: var(--radius); padding: 13px 15px; font-weight: 600; font-size: 14px; }

/* ---- Rapports ---- */
.rapport-mois { margin-bottom: 6px; }
.rapport-titre {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 19px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--marine); margin-bottom: 8px;
}
.rapport-grille { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.rapport-item .v { font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 30px; line-height: 1; }
.rapport-item .l { font-size: 12px; font-weight: 600; color: #6B7686; }
.rapport-item.euros .v { color: var(--orange); }

/* ---- Chargement ---- */
#chargement {
  position: fixed; inset: 0; background: var(--nuit);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.rond {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid var(--marine-clair); border-top-color: var(--orange);
  animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rond { animation: none; } .jauge-barre { transition: none; } }
