/* « Encaissements » (décision de Kenji du 09/11/2026) : téléphone d'abord, palette et verre du Bureau.
   Couleurs de la charte : orange retard, bleu à faire, violet (discret) argent, vert payé. Un seul geste principal par
   facture : « Noter le paiement reçu ». Les durées et courbes viennent de mouvement.css (aucune en dur). */
#encaissements {
  --enc-bleu: #0a5fc2; --enc-bleu-bg: #e9f1fc; --enc-orange: #9a4f00; --enc-orange-bg: #fff2df;
  --enc-vert: #1f7a3c; --enc-vert-bg: #e7f4ea; --enc-violet: #5a3d99; --enc-violet-bg: #f2edfb; --enc-rouge: #b3261e;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
:root[data-theme=dark] #encaissements {
  --enc-bleu: #8cbcff; --enc-bleu-bg: #1d2a3d; --enc-orange: #ffc27a; --enc-orange-bg: #3a2b14;
  --enc-vert: #8fe0a8; --enc-vert-bg: #1f3326; --enc-violet: #c7b2ff; --enc-violet-bg: #2c2540; --enc-rouge: #ff9c96;
}
body.avec-encaissements main > section:not(#encaissements) { display: none !important; }
body.avec-encaissements main { display: block; }
#encaissements h1, #encaissements h2, #encaissements h3, #encaissements p { margin: 0; }
#encaissements button, #encaissements input, #encaissements textarea { font: inherit; }
.enc-racine { width: min(980px, 100%); margin: 0 auto; padding: 8px 0 48px; display: grid; gap: 16px; }

/* En-tête */
.enc-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 12px; }
.enc-titres { display: grid; gap: 6px; min-width: 0; }
.enc-titre { font-size: clamp(28px, 4vw, 40px); line-height: 1.05; letter-spacing: -.04em; font-weight: 750; outline: none; }
.enc-sous-titre { color: var(--muted); font-size: 15px; }
.enc-rond { flex-shrink: 0; width: 44px; height: 44px; min-height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.enc-rond .v2-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.enc-rond.tourne .v2-icon { animation: enc-tourne .9s linear infinite; }
@keyframes enc-tourne { to { transform: rotate(360deg); } }
.enc-statut:empty { display: none; }
.enc-statut { font-size: 14px; color: var(--muted); }

/* Trois chiffres */
.enc-tuiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.enc-tuile { min-height: 112px; display: grid; align-content: start; gap: 4px; padding: 16px; text-align: left; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); box-shadow: 0 1px 2px #191e2808;
  transition: transform var(--duree-courte) var(--courbe), border-color var(--duree-courte) var(--courbe); }
.enc-tuile-nom { font-size: 13.5px; font-weight: 650; color: var(--muted); }
.enc-tuile-valeur { font-size: clamp(22px, 3.2vw, 32px); line-height: 1.1; letter-spacing: -.03em; font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enc-tuile-note { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.enc-tuile.est-a-encaisser .enc-tuile-valeur { color: var(--enc-violet); }
.enc-tuile.est-retard .enc-tuile-valeur { color: var(--enc-orange); }
.enc-tuile.est-retard.est-zero .enc-tuile-valeur { color: var(--muted); }
.enc-tuile.est-recu .enc-tuile-valeur { color: var(--enc-vert); }
.enc-tuile.est-choisie { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Filtres : contrôle segmenté */
.enc-filtres { display: inline-flex; justify-self: start; gap: 2px; padding: 3px; border-radius: 13px; background: var(--inset); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.enc-filtre { min-height: 40px; padding: 0 14px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.enc-filtre[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px #0000001f; }
.enc-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.enc-recherche { flex: 1 1 260px; width: auto; max-width: 420px; min-height: 46px; padding: 0 16px; border-radius: 13px; font-size: 15px; }
.enc-recherche-compte { margin: -4px 2px 0; color: var(--muted); font-size: 13px; }
.enc-recherche-vide { flex-wrap: wrap; }

/* Liste */
.enc-liste { display: grid; gap: 10px; }
.enc-ligne { display: grid; gap: 10px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); min-width: 0; outline: none;
  transition: box-shadow var(--duree-normale) var(--courbe); }
.enc-ligne.est-retard { border-left: 4px solid var(--enc-orange); padding-left: 13px; }
.enc-ligne.etat-payee { background: color-mix(in srgb, var(--surface) 70%, var(--inset)); }
.enc-ligne.enc-surligne, .enc-ligne.notification-cible { box-shadow: 0 0 0 3px var(--accent); }
.enc-ligne > *, .enc-liste > *, .enc-racine > * { min-width: 0; }
.enc-ligne-haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.enc-qui { min-width: 0; display: grid; gap: 3px; }
.enc-client { font-size: 17px; line-height: 1.25; font-weight: 680; letter-spacing: -.2px; overflow-wrap: anywhere; }
.enc-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 13.5px; }
.enc-meta span + span::before { content: "·"; margin-right: 10px; }
.enc-acompte { color: var(--enc-violet); font-weight: 600; }
.enc-somme { display: grid; justify-items: end; text-align: right; flex-shrink: 0; }
.enc-ttc { font-size: 19px; font-weight: 720; letter-spacing: -.3px; white-space: nowrap; }
.enc-ttc-nom { font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: .6px; }
.enc-reste { font-size: 13px; font-weight: 650; color: var(--enc-violet); white-space: nowrap; }
.enc-pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
.enc-pastille { font-size: 13px; font-weight: 650; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.enc-pastille.orange { background: var(--enc-orange-bg); color: var(--enc-orange); }
.enc-pastille.bleu { background: var(--enc-bleu-bg); color: var(--enc-bleu); }
.enc-pastille.violet { background: var(--enc-violet-bg); color: var(--enc-violet); }
.enc-pastille.violet.discret { background: transparent; box-shadow: inset 0 0 0 1px var(--enc-violet-bg); }
.enc-pastille.vert { background: var(--enc-vert-bg); color: var(--enc-vert); }
.enc-partiel, .enc-paye-le { font-size: 14px; color: var(--muted); }
.enc-annonce-note { font-size: 14px; color: var(--enc-violet); font-style: italic; overflow-wrap: anywhere; }
.enc-ligne-bas { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.enc-dossier { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 8px; border-radius: 12px; background: var(--inset);
  color: var(--ink); font-size: 14px; font-weight: 600; max-width: 100%; min-width: 0; text-align: left; }
.enc-dossier .v2-icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; }
.enc-dossier span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.enc-dossier small { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.enc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.enc-bouton-principal, .enc-bouton-secondaire, .enc-bouton-danger { min-height: 44px; padding: 0 16px; border-radius: 12px; font-size: 15px; font-weight: 650; }
.enc-bouton-principal { background: var(--accent-action, var(--button)); color: var(--accent-action-texte, #fff); border: 1px solid var(--accent-action, var(--button)); box-shadow: var(--ombre-bouton, none); }
.enc-bouton-principal:active { background: var(--accent-action-presse, var(--button)); transform: scale(.97); }
.enc-bouton-secondaire { background: var(--inset); color: var(--ink); border: 1px solid var(--line); }
.enc-bouton-danger { background: var(--enc-rouge); color: #fff; border: 1px solid var(--enc-rouge); }
:root[data-theme=dark] .enc-bouton-danger { color: #2a0d0b; }
.enc-historique { border-top: 1px solid var(--line); padding-top: 8px; }
.enc-historique summary { min-height: 36px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.enc-historique ol { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.enc-historique li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 8px 10px; border-radius: 12px; background: var(--inset); }
.enc-op { display: grid; gap: 1px; min-width: 0; }
.enc-op-texte { font-size: 14px; font-weight: 600; }
.enc-op-par, .enc-op-annule { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.enc-historique li.est-annulee .enc-op-texte { text-decoration: line-through; color: var(--muted); }
.enc-op-annule { flex-basis: 100%; color: var(--enc-orange); }
.enc-lien-annuler { min-height: 44px; padding: 0 6px; background: none; border: 0; color: var(--enc-rouge); font-weight: 650; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.enc-vide-bloc { display: flex; align-items: center; gap: 12px; padding: 22px 18px; border-radius: 20px; background: var(--surface); border: 1px dashed var(--line); }
.enc-vide { color: var(--muted); font-size: 15px; }
.enc-erreur { display: grid; gap: 12px; padding: 18px; border-radius: 18px; background: var(--error-bg); color: var(--error); }
.enc-pied { display: grid; gap: 6px; }
.enc-aide { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* Fenêtres (feuille sur téléphone) */
.enc-fenetre { width: min(520px, calc(100vw - 28px)); max-height: min(760px, calc(100dvh - 28px)); padding: 22px; border: 1px solid var(--line); border-radius: 24px;
  background: var(--surface); color: var(--ink); box-shadow: 0 26px 80px #00000035; overflow: auto; font-variant-numeric: tabular-nums; }
.enc-fenetre button, .enc-fenetre input, .enc-fenetre textarea { font: inherit; }
.enc-fenetre::backdrop { background: #00000040; }
.enc-fenetre .bureau-fenetre-tete { margin-bottom: 4px; }
.enc-fenetre-sous-titre { color: var(--muted); font-size: 14.5px; margin: 0 0 14px; overflow-wrap: anywhere; }
.enc-fenetre form { display: grid; gap: 14px; }
.enc-resume { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--enc-violet-bg, #f2edfb); color: var(--enc-violet, #5a3d99); }
.enc-resume span { font-size: 14px; font-weight: 600; }
.enc-resume strong { font-size: 22px; letter-spacing: -.4px; }
.enc-champ { display: grid; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; }
.enc-champ-nom { color: var(--ink); }
.enc-saisie { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 12px; background: var(--inset); color: var(--ink); padding: 12px 14px; font-size: 17px; }
.enc-note { font-family: inherit; min-height: 64px; resize: vertical; font-size: 16px; line-height: 1.4; }
.enc-champ-aide { font-weight: 500; font-size: 13px; color: var(--muted); min-height: 1em; }
.enc-champ-aide.est-erreur { color: var(--error); font-weight: 600; }
.enc-moyens { display: flex; flex-wrap: wrap; gap: 6px; }
.enc-puce { min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--inset); border: 1px solid var(--line); color: var(--ink); font-size: 15px; font-weight: 600; }
.enc-puce[aria-checked=true] { background: var(--accent-action, var(--button)); border-color: var(--accent-action, var(--button)); color: var(--accent-action-texte, #fff); }
.enc-rappel { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.enc-erreur-champ { margin: 0; }
.enc-fenetre-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.enc-confirmation { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 18px 4px 6px; }
.enc-confirmation .sd-coche { margin-bottom: 8px; }
.enc-confirmation-titre { font-size: 22px; font-weight: 720; letter-spacing: -.4px; }
.enc-confirmation-texte { font-size: 15.5px; }
.enc-confirmation-dossier { font-size: 13.5px; color: var(--muted); }
.enc-confirmation-archives { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 4px; font-size: 14.5px; color: var(--muted);
  padding: 4px 12px; border-radius: 999px; background: var(--inset); }
.enc-lien-corriger { margin-top: 2px; min-height: 32px; padding: 2px 0; background: none; border: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); cursor: pointer; }
.enc-lien-corriger:hover { color: var(--accent); }
.enc-resume-correction { background: color-mix(in srgb, var(--muted) 12%, transparent); color: inherit; }
.enc-lien-defaire { min-height: 44px; padding: 0 6px; background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; }
.enc-erreur-texte { color: var(--error); flex-basis: 100%; }
.enc-ttc.est-inconnu { font-size: 15px; color: var(--enc-orange); }
.enc-resume.est-inconnu { background: var(--enc-orange-bg, #fff2df); color: var(--enc-orange, #9a4f00); }
.enc-relier { color: var(--enc-bleu); background: var(--enc-bleu-bg); }
.enc-confirmation .enc-bouton-principal { min-width: 180px; margin-top: 8px; }

@media (max-width: 700px) {
  .enc-racine { gap: 14px; padding-top: 0; }
  .enc-tuiles { grid-template-columns: 1fr 1fr; }
  .enc-tuile.est-a-encaisser { grid-column: 1 / -1; min-height: 0; }
  .enc-tuile { min-height: 96px; padding: 14px; }
  .enc-filtres { display: flex; justify-self: stretch; }
  .enc-barre { display: grid; }
  .enc-recherche { max-width: none; }
  .enc-filtre { flex: 1 1 0; padding: 0 8px; }
  .enc-ligne-bas { align-items: stretch; flex-direction: column; }
  .enc-dossier { align-self: flex-start; }
  .enc-actions { margin-left: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .enc-actions button { width: 100%; padding: 0 6px; font-size: 14px; line-height: 1.2; }
  .enc-meta { gap: 0 12px; }
  .enc-meta span + span::before { content: none; }
  .enc-ttc { font-size: 17px; }
  .enc-fenetre { width: 100%; max-width: none; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 92dvh;
    padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .enc-fenetre-actions { display: grid; grid-template-columns: 1fr 1.4fr; }
  .enc-fenetre-actions button { width: 100%; min-height: var(--bouton-hauteur, 54px); }
}
@media (prefers-reduced-motion: reduce) { .enc-rond.tourne .v2-icon { animation: none; } }
