/* Les affaires : un BI, ses relevés, ses pièces. */
.affaires, .affaire-detail { display: grid; gap: 16px; }
.affaire-detail section { display: grid; gap: 10px; }
.affaire-detail h2 { display: flex; align-items: center; gap: 8px; }

/* Lien de l'accueil vers la vue par affaire. */
.lien-affaires { display: inline-flex; align-items: center; gap: 8px; justify-self: start; font-weight: 650; color: var(--encre); text-decoration: none; padding: 8px 2px; border-bottom: 2px solid var(--accent); }
.lien-affaires svg, .feuille-choix svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Carte d'une affaire dans la liste. */
.carte.affaire { display: flex; justify-content: space-between; gap: 16px; padding: 14px 18px; text-decoration: none; color: inherit; transition: border-color 0.12s, translate 0.12s; }
.carte.affaire:hover { border-color: var(--encre); translate: 0 -1px; }
.carte.affaire > div:first-child { display: grid; gap: 4px; flex: 1; min-width: 0; }
.carte.affaire .lieu { color: var(--texte-doux); font-size: 14.5px; }
.totaux { font-weight: 650; font-size: 14.5px; }

/* Les pièces validées, en barre. */
.avancee { height: 6px; border-radius: 99px; background: var(--papier2); border: 1px solid var(--trait); overflow: hidden; max-width: 420px; }
.avancee span { display: block; height: 100%; background: var(--succes); }

.badge.affaire-en_cours { background: var(--papier2); color: var(--texte-doux); }
.badge.affaire-a_valider { background: var(--info-clair); color: var(--info); border-color: transparent; }
.badge.affaire-a_reprendre { background: var(--alerte-clair); color: var(--alerte); border-color: transparent; }
.badge.affaire-validee { background: var(--succes-clair); color: var(--succes); border-color: transparent; }

/* En-tête et totaux d'une affaire. */
.tete-affaire { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.tete-affaire .lieu { color: var(--texte-doux); }
.tuiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 560px; }
.tuile { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--papier); }
.tuile strong { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tuile span { font-size: 13px; color: var(--texte-doux); }
.repartition { display: flex; flex-wrap: wrap; gap: 6px; }
.actions-affaire { display: flex; flex-wrap: wrap; gap: 10px; }

.par-composant { border-collapse: collapse; max-width: 560px; width: 100%; }
.par-composant th, .par-composant td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--trait); font-size: 14.5px; }
.par-composant th { font-weight: 600; }
.par-composant td { color: var(--texte-doux); white-space: nowrap; }
.par-composant .nombre { text-align: right; color: var(--encre); font-weight: 650; font-variant-numeric: tabular-nums; }

/* Un relevé dans l'affaire : son numéro, sa quantité. */
.ligne-affaire { align-items: start; }
.ligne-affaire > div:nth-child(2) { flex: 1; min-width: 0; }
.ligne-affaire .numero { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 99px; background: var(--papier2); font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; }
.quantite { font-weight: 650; font-size: 13.5px; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.quantite.plusieurs { color: var(--encre); background: var(--papier2); border-radius: 5px; padding: 1px 7px; }

/* Dans la fiche : « Voir l'affaire » à côté du titre « Intervention ». */
.titre-intervention { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lien-affaire { font-size: 14px; font-weight: 600; color: var(--accent-sombre); display: inline-flex; align-items: center; min-height: 44px; }

/* PDF d'un composant, posé dans le coin de sa carte (comme « ⋯ » à l'accueil). */
.ligne-affaire.releve { padding-right: 76px; }
.pdf-composant { position: absolute; top: 8px; right: 8px; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; min-height: 48px; padding: 6px; border: 1px solid var(--trait); border-radius: 10px; background: var(--papier); color: var(--encre); font: inherit; font-size: 12px; font-weight: 650; }
.pdf-composant:hover, .pdf-composant:focus-visible { border-color: var(--encre); }
.pdf-composant svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.affaire-detail .bouton.geant { justify-self: stretch; }

/* Nouvelle affaire, et le nombre de pièces au choix du composant. */
.nouvelle-affaire { display: grid; gap: 14px; max-width: 560px; }
.formulaire-affaire { display: grid; gap: 14px; padding: 18px; }
.affaire-existe { color: var(--info); font-weight: 600; }
.ligne-quantite { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 650; }
.champ-quantite { width: 110px; font-size: 18px; font-weight: 650; text-align: center; }

.case-a-cocher { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.case-a-cocher input { width: 20px; height: 20px; accent-color: var(--accent); }
.meme-machine { border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--papier); padding: 10px 14px; max-width: 560px; }
.meme-machine summary { cursor: pointer; font-weight: 600; }
.meme-machine form { display: flex; gap: 8px; margin-top: 10px; }
.meme-machine input { flex: 1; min-width: 0; }

@media (max-width: 940px) {
  .carte.affaire { padding: 14px 16px; border-radius: 12px; }
  .tuile strong { font-size: 22px; }
}
