/* LBA Collab — « le relevé » : papier clair, encre vert bouteille, montants en
   chasse fixe façon reçu. Aucune ressource externe. */

:root {
  --papier: #f3f2ec;
  --carte: #ffffff;
  --encre: #1d2b23;
  --encre-2: #5a655c;
  --ligne: #dfdfd4;
  --sceau: #1e4632;
  --sceau-actif: #173a28;
  --sceau-texte: #eef3ea;
  --kola: #b4540a;
  --ok: #1d7a46;
  --ok-fond: #e3f1e8;
  --attente: #815a00;
  --attente-fond: #f5ecd4;
  --verif: #3d5a80;
  --verif-fond: #e5ebf4;
  --annule: #a33326;
  --annule-fond: #f6e4e1;
  --muet: #6b7069;
  --muet-fond: #ecebe4;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, sans-serif;
  --rayon: 12px;
  --ombre: 0 1px 2px rgba(29, 43, 35, 0.07), 0 4px 16px rgba(29, 43, 35, 0.05);
}

* { box-sizing: border-box; }

/* l'attribut hidden doit gagner sur tout display posé par une classe */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100dvh;
}

/* ---------- accessibilité ---------- */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lien-evitement {
  position: absolute;
  left: 0.75rem; top: -3rem;
  z-index: 10;
  background: var(--sceau);
  color: var(--sceau-texte);
  padding: 0.5rem 0.9rem;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.15s ease-out;
}
.lien-evitement:focus { top: 0; }

:focus-visible {
  outline: 2px solid var(--kola);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- en-tête ---------- */

.entete {
  background: var(--sceau);
  color: var(--sceau-texte);
}

.entete-int {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.lockup { margin: 0; display: flex; flex-direction: column; line-height: 1.2; }

.lockup-mere {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.85;
}

.lockup-produit { font-weight: 750; font-size: 1.02rem; letter-spacing: 0.01em; }

.entete-droite {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.entete-nom {
  font-size: 0.85rem;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9rem;
}

.bandeau-apercu {
  margin: 0;
  padding: 0.45rem 1rem;
  background: #f5ecd4;
  color: #6d4c00;
  border-bottom: 1px solid #e7d9ae;
  font-size: 0.82rem;
  text-align: center;
}

/* ---------- structure des vues ---------- */

.vue { padding: 1rem; max-width: 1060px; margin: 0 auto; }

.vue-tableau {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 2.5rem;
}

.colonne { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

@media (min-width: 900px) {
  .vue-tableau {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem;
    padding-top: 1.5rem;
  }
  .colonne-solde { position: sticky; top: 1.25rem; }
}

/* ---------- cartes ---------- */

.carte {
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 1.1rem 1.15rem;
}

@media (prefers-reduced-motion: no-preference) {
  .vue-tableau .carte {
    animation: lever 0.3s ease-out both;
  }
  .vue-tableau .carte:nth-child(2) { animation-delay: 0.06s; }
  .vue-tableau .carte:nth-child(3) { animation-delay: 0.12s; }
}

@keyframes lever {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.titre-section {
  margin: 0 0 0.7rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--encre-2);
}

.titre-section-clair { color: var(--sceau-texte); margin: 0; }

/* ---------- relevé (carte héro) ---------- */

.carte-releve { padding: 0; overflow: hidden; }

.releve-bande {
  background: var(--sceau);
  color: var(--sceau-texte);
  padding: 0.7rem 1.15rem;
}

.releve-corps { padding: 1rem 1.15rem 1.15rem; }

.montant-hero {
  margin: 0;
  font-family: var(--mono);
  font-weight: 650;
  font-size: clamp(2rem, 8.5vw, 2.9rem);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.sous-hero {
  margin: 0.35rem 0 1.3rem;
  color: var(--encre-2);
  font-size: 0.88rem;
}

/* bande de flux : en attente → disponible → payé */

.flux {
  display: flex;
  gap: 3px;
  height: 12px;
  border-radius: 6px;
  background: var(--muet-fond);
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.flux-seg { min-width: 0; border-radius: 3px; transition: flex-basis 0.4s ease-out; }
.flux-attente { background: #d9b64a; }
.flux-dispo { background: var(--ok); }
.flux-paye { background: #9fb8a8; }

@media (prefers-reduced-motion: reduce) {
  .flux-seg { transition: none; }
}

/* lignes de relevé à pointillés (signature reçu) */

.legende { list-style: none; margin: 0; padding: 0; }

.ligne-releve {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.32rem 0;
  font-size: 0.92rem;
}

.puce {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
  align-self: center;
}
.puce-attente { background: #d9b64a; }
.puce-dispo { background: var(--ok); }
.puce-paye { background: #9fb8a8; }

.ligne-etiquette { color: var(--encre-2); flex: none; }

.pointille {
  flex: 1;
  border-bottom: 2px dotted var(--ligne);
  transform: translateY(-4px);
  min-width: 1.5rem;
}

.ligne-montant {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- textes, jauge ---------- */

.texte { margin: 0 0 0.6rem; font-size: 0.93rem; }
.texte-secondaire { color: var(--encre-2); font-size: 0.86rem; }
.texte strong { font-variant-numeric: tabular-nums; }

.jauge {
  height: 10px;
  border-radius: 5px;
  background: var(--muet-fond);
  overflow: hidden;
}

.jauge-remplie {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 5px;
  background: var(--ok);
  transition: width 0.4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .jauge-remplie { transition: none; }
}

.jauge[data-etat="atteint"] .jauge-remplie { background: var(--ok); }

/* ---------- outils de partage ---------- */

.outil { padding: 0.55rem 0; }
.outil + .outil { border-top: 1px solid var(--ligne); }

.outil-etiquette {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  color: var(--encre-2);
}

.outil-ligne { display: flex; gap: 0.5rem; align-items: center; }

.outil-valeur {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--papier);
  border: 1px solid var(--ligne);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outil-note { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--encre-2); }

/* ---------- boutons ---------- */

.btn {
  font: inherit;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  padding: 0.65rem 1rem;
  font-weight: 600;
  min-height: 44px;
}

.btn-principal {
  width: 100%;
  background: var(--sceau);
  color: var(--sceau-texte);
}
.btn-principal:hover { background: var(--sceau-actif); }
.btn-principal:disabled { opacity: 0.6; cursor: default; }

.btn-secondaire {
  width: 100%;
  margin-top: 0.6rem;
  background: transparent;
  border: 1px solid var(--ligne);
  color: var(--encre);
}
.btn-secondaire:hover { border-color: var(--encre-2); }
.btn-secondaire:disabled { opacity: 0.6; cursor: default; }

.btn-discret {
  background: transparent;
  border: 1px solid rgba(238, 243, 234, 0.4);
  color: var(--sceau-texte);
  padding: 0.35rem 0.7rem;
  min-height: 0;
  font-size: 0.82rem;
  border-radius: 8px;
}
.btn-discret:hover { border-color: var(--sceau-texte); }

.btn-copier {
  flex: none;
  background: transparent;
  border: 1px solid var(--ligne);
  color: var(--kola);
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
  min-height: 0;
  border-radius: 8px;
}
.btn-copier:hover { border-color: var(--kola); }
.btn-copier[data-copie="oui"] { color: var(--ok); border-color: var(--ok); }

/* ---------- ventes ---------- */

.liste-ventes { list-style: none; margin: 0; padding: 0; }

.vente {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--ligne);
}
.vente:last-child { border-bottom: none; }

.vente-ref {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 600;
}

.vente-montant {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: right;
  white-space: nowrap;
}

.vente-montant[data-nul="oui"] { color: var(--muet); font-weight: 500; }

.vente-detail {
  color: var(--encre-2);
  font-size: 0.8rem;
}

.vente-etat { text-align: right; align-self: center; }

.chip {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 99px;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
}
.chip-pending { background: var(--attente-fond); color: var(--attente); }
.chip-available { background: var(--ok-fond); color: var(--ok); }
.chip-under_review { background: var(--verif-fond); color: var(--verif); }
.chip-reversed { background: var(--annule-fond); color: var(--annule); }
.chip-no_commission { background: var(--muet-fond); color: var(--muet); }

.etat-vide { padding: 0.4rem 0 0.2rem; }

/* ---------- règles ---------- */

.regles {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.regles li::marker { color: var(--kola); font-weight: 650; }

/* ---------- pied ---------- */

.pied { padding: 0 0.25rem; }
.pied p { margin: 0; font-size: 0.78rem; color: var(--encre-2); }

/* ---------- connexion / indisponible ---------- */

.vue-connexion {
  max-width: 26rem;
  padding-top: clamp(1.5rem, 9dvh, 5rem);
}

.carte-connexion { padding: 1.6rem 1.4rem; }

.eyebrow {
  margin: 0;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--encre-2);
}

.titre-produit {
  margin: 0.1rem 0 0;
  font-size: 2rem;
  font-weight: 780;
  letter-spacing: -0.01em;
  color: var(--sceau);
}

.titre-produit-petit {
  margin: 0.1rem 0 0;
  font-size: 1.35rem;
  font-weight: 720;
  color: var(--sceau);
}

.regle-pointillee {
  margin: 0.8rem 0;
  border-bottom: 2px dotted var(--ligne);
}

.intro { margin: 0 0 1.1rem; font-size: 0.93rem; color: var(--encre-2); }

.etiquette {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--encre-2);
  margin-bottom: 0.35rem;
}

.champ {
  width: 100%;
  font-family: var(--mono);
  font-size: 1rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--ligne);
  border-radius: 9px;
  background: var(--papier);
  color: var(--encre);
}
.champ:focus-visible { outline-offset: 0; border-color: var(--kola); }

.aide { margin: 0.4rem 0 1rem; font-size: 0.8rem; color: var(--encre-2); }

.message-erreur {
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
  color: var(--annule);
}

.pied-connexion {
  text-align: center;
  font-size: 0.78rem;
  color: var(--encre-2);
  margin-top: 1rem;
}

/* ---------- squelette de chargement ---------- */

.squelette { max-width: 26rem; margin: 0 auto; }

.sq {
  background: var(--muet-fond);
  border-radius: 7px;
  margin-bottom: 0.7rem;
}
.sq-etiquette { height: 0.8rem; width: 45%; }
.sq-montant { height: 2.6rem; width: 70%; }
.sq-bande { height: 12px; }
.sq-ligne { height: 0.9rem; }

@media (prefers-reduced-motion: no-preference) {
  .sq { animation: pulser 1.4s ease-in-out infinite; }
}

@keyframes pulser {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
