:root {
  --fond: #EEF3F8;
  --encre: #1B2733;
  --discret: #5A6672;
  --accent: #0B6E8A;
  --accent-fonce: #095C73;
  --accent-clair: #E1EEF3;
  --sur-accent: #D6E9F0;
  --bord: #C9D6E0;
  --champ: #F3F7FA;
  --ligne: #E6EDF2;
  --vert: #1A6B43;
  --vert-fond: #E3F3EA;
  --ambre: #8A4B00;
  --ambre-fond: #FFF0D9;
  --rouge: #A3271E;
  --texte: 'Nunito Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--fond); color: var(--encre); font-family: var(--texte); font-size: 17px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); }
a:hover { color: var(--encre); }
:focus-visible { outline: 3px solid #F2A900; outline-offset: 3px; }
input::placeholder, textarea::placeholder { color: var(--discret); }
.icone { display: inline-flex; flex: none; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.discret { color: var(--discret); }
.petit { font-size: 15px; }
.sans-js { padding: 24px; }

/* Boutons */
.bouton { min-height: 48px; padding: 0 22px; border: 1px solid var(--bord); border-radius: 999px; background: #FFFFFF; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--encre); touch-action: manipulation; }
.bouton.plein { border-color: var(--accent); background: var(--accent); color: #FFFFFF; font-weight: 800; }
.bouton.plein:hover { background: var(--accent-fonce); }
.bouton.grand { min-height: 64px; padding: 0 44px; font-size: 21px; }
.bouton.large { width: 100%; min-height: 56px; font-size: 18px; }
.bouton.ambre { border-color: var(--ambre); background: var(--ambre); color: #FFFFFF; min-height: 44px; padding: 0 16px; }
.bouton.ambre-contour { border-color: var(--ambre); background: transparent; color: var(--ambre); min-height: 44px; padding: 0 14px; }
.bouton.sur-accent { border: 0; background: #FFFFFF; color: var(--accent); font-weight: 800; min-height: 52px; }
.bouton.sur-accent-contour { border-color: #9CC9D8; background: transparent; color: #FFFFFF; min-height: 52px; }
.lien { min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; display: inline-flex; align-items: center; gap: 6px; }
.lien-discret { color: var(--discret); font-weight: 600; }

/* Écrans pleins (connexion, chargement, erreur) */
.ecran-plein { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.boite { width: min(100%, 440px); background: #FFFFFF; border-radius: 24px; padding: 36px 32px; display: flex; flex-direction: column; gap: 16px; }
.boite h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.etiquette { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.champ { width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid transparent; border-radius: 14px; background: var(--champ); font-weight: 400; }
textarea.champ { padding: 14px 16px; line-height: 1.6; resize: vertical; }
.champ:focus { border-color: var(--accent); background: #FFFFFF; }
.erreur { color: var(--rouge); font-weight: 700; }

/* Accueil */
.entete, .principal { max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.entete { padding-top: 44px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.entete h1 { font-size: 42px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.entete-droite { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.pastille-quota { padding: 8px 16px; border-radius: 999px; background: #FFFFFF; color: var(--discret); font-size: 15px; font-weight: 600; }
.principal { padding-top: 32px; padding-bottom: 72px; display: flex; flex-direction: column; gap: 44px; }

.banniere { background: #FFFFFF; border-radius: 20px; padding: 18px 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; border: 2px solid var(--accent-clair); }
.banniere strong { display: block; }
.banniere .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.carte-carnet { background: var(--accent); color: #FFFFFF; border-radius: 24px; padding: 28px 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; }
.carte-carnet .gauche { flex: 1 1 440px; min-width: 0; display: flex; align-items: flex-start; gap: 20px; }
.carte-carnet h2 { font-size: 16px; font-weight: 700; color: var(--sur-accent); }
.carte-carnet .titre-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.carte-carnet .grand-nombre { font-size: 40px; font-weight: 300; line-height: 1.1; letter-spacing: -0.01em; }
.carte-carnet .detail { color: var(--sur-accent); }
.carte-carnet .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pastille-drive { padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--accent-fonce); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.rond { flex: none; width: 56px; height: 56px; border-radius: 28px; display: flex; align-items: center; justify-content: center; }
.carte-carnet .rond { background: var(--accent-fonce); }

.section-envoi { display: flex; flex-direction: column; gap: 20px; }
.section-envoi h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
.cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.carte { background: #FFFFFF; border-radius: 24px; padding: 28px; min-height: 280px; display: flex; flex-direction: column; gap: 10px; }
.carte .haut { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.carte .rond { width: 52px; height: 52px; background: var(--accent-clair); color: var(--accent); }
.carte h3 { font-size: 16px; font-weight: 700; color: var(--discret); }
.carte .valeur { font-size: 36px; font-weight: 300; line-height: 1.1; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.carte .valeur.texte { font-size: 22px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.carte .detail { color: var(--discret); overflow-wrap: anywhere; }
.carte .bouton { margin-top: auto; align-self: flex-start; }
.statut { padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.statut.pret { background: var(--vert-fond); color: var(--vert); }
.statut.verifier { background: var(--ambre-fond); color: var(--ambre); }
.statut.vide { background: var(--fond); color: var(--discret); }

.zone-envoi { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.zone-envoi .note { max-width: 640px; color: var(--discret); }
.zone-envoi .question { font-size: 26px; font-weight: 700; }
.zone-envoi .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.zone-envoi .info { min-height: 26px; color: var(--accent); font-weight: 600; }
.barre { width: min(420px, 100%); height: 8px; border-radius: 4px; background: #D5E2EA; overflow: hidden; }
.barre > span { display: block; height: 8px; border-radius: 4px; background: var(--accent); transition: width .3s; }
.coche-ronde { width: 64px; height: 64px; border-radius: 32px; background: var(--vert-fond); color: var(--vert); display: flex; align-items: center; justify-content: center; }
.coche-ronde.attente { background: var(--accent-clair); color: var(--accent); }

/* Volet latéral */
.voile { position: fixed; inset: 0; z-index: 10; display: flex; justify-content: flex-end; background: rgba(27, 39, 51, 0.32); }
.volet { width: 100%; max-width: 600px; height: 100%; background: #FFFFFF; padding: 32px 32px 24px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; overscroll-behavior: contain; }
/* Le volet défile en entier : ses blocs gardent leur hauteur au lieu de rétrécir. */
.volet > * { flex-shrink: 0; }
.volet-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.volet-tete h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
.volet-tete h2:focus { outline: none; }
.fermer { flex: none; width: 48px; height: 48px; border: 0; border-radius: 24px; background: var(--fond); display: inline-flex; align-items: center; justify-content: center; }
.volet .pied { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.resultats { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--ligne); }
.resultats .total { font-size: 20px; font-weight: 700; }
.puces { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; max-height: 200px; overflow-y: auto; }
.puce { display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; padding-left: 14px; border-radius: 22px; background: var(--fond); font-size: 15px; }
.puce span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puce button, .retirer-x { flex: none; width: 44px; height: 44px; border: 0; background: transparent; color: var(--discret); display: inline-flex; align-items: center; justify-content: center; }
.a-verifier { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.a-verifier li { padding: 12px 14px; border-radius: 16px; background: var(--ambre-fond); color: var(--ambre); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.a-verifier .quoi { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.a-verifier strong { overflow-wrap: anywhere; }
.alerte { padding: 12px 14px; border-radius: 14px; background: var(--ambre-fond); color: var(--ambre); font-weight: 700; }
.encadre { padding: 14px 16px; border-radius: 16px; background: var(--champ); }
.succes { padding: 28px 0 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.succes .titre { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }

.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.filtre { min-height: 40px; padding: 0 8px 0 14px; border: 1px solid var(--bord); border-radius: 999px; background: #FFFFFF; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.filtre .nombre { min-width: 26px; padding: 0 7px; border-radius: 999px; background: var(--fond); font-size: 13px; }
.filtre[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #FFFFFF; }
.filtre[aria-pressed="true"] .nombre { background: var(--accent-fonce); }
.lignes { list-style: none; margin: 0; padding: 0; }
.lignes li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--ligne); }
.lignes .qui { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.lignes .qui strong, .lignes .qui span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lignes .qui span { font-size: 14px; color: var(--discret); }
.lignes .grise strong { color: var(--discret); }
.badge-neplus { padding: 2px 10px; border-radius: 999px; background: var(--ambre-fond); color: var(--ambre); font-size: 13px; font-weight: 700; }

.sources { display: flex; flex-direction: column; gap: 10px; }
.source { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: 18px; border: 2px solid var(--ligne); background: #FFFFFF; cursor: pointer; }
.source.choisie { border-color: var(--accent); background: #F3F9FB; }
.source input, .case input { flex: none; width: 22px; height: 22px; margin: 3px 0 0; accent-color: var(--accent); }
.source .texte { display: flex; flex-direction: column; }
.source strong { font-size: 18px; }
.choix-liste { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow-y: auto; border-top: 1px solid var(--ligne); }
.choix-liste li { border-bottom: 1px solid var(--ligne); }
.case { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 6px 4px; cursor: pointer; }
.case input { margin: 0; }
.case.bloquee { cursor: default; }
.case .qui { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.case .qui strong, .case .qui span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case .qui span { font-size: 14px; color: var(--discret); }
.case.bloquee strong { color: var(--discret); }
.case-simple { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.case-simple input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.entre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }

.depot { padding: 36px 20px; border: 2px dashed #B7C7D3; border-radius: 20px; background: #F7FAFC; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.depot.survol { border-color: var(--accent); background: var(--accent-clair); }
.choisir-fichiers { position: relative; }
.choisir-fichiers input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.choisir-fichiers:focus-within { outline: 3px solid #F2A900; outline-offset: 3px; }
.fichiers { list-style: none; margin: 0; padding: 0; }
.fichiers li { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--ligne); }
.fichiers .nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

@media (max-width: 640px) {
  .entete { padding-top: 28px; }
  .entete h1 { font-size: 34px; }
  .carte-carnet { padding: 24px; }
  .carte-carnet .gauche > .rond { display: none; }
  .carte-carnet .grand-nombre { font-size: 34px; }
  .bouton.grand { padding: 0 28px; font-size: 19px; }
  .volet { padding: 24px 18px 18px; }
}
