/* ============================================================================
   FICHE D'UNE COMMANDE FOURNISSEUR (/app/achats/commandes?doc=) — .fca-*
   Composant Shared/Achat/FicheCommandeAchat.razor, maquette « Documents d'achat », Fiche.

   Sa propre feuille, son propre <link> dans App.razor, après modele-erp.css et
   easypurchase.css. Le fil d'Ariane, les boutons, les pastilles, les onglets (.mx-vues), la
   bande de chiffres (.mx-faits), les bandeaux (.mx-blocage) et la bande du cycle (.ap-etapes)
   viennent du gabarit et de la feuille du module. Ne vivent ici que l'en-tête de la page, ses
   deux colonnes — la pièce à gauche, le fournisseur et l'activité à droite — et les tableaux.

   PAS DE CLASSE .dev-* : ce sont celles de la fiche de vente, et un écran ne dépend pas de la
   feuille d'un autre écran.
   ============================================================================ */

.fca { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ----- En-tête ----- */
.fca-tete { background: var(--et-surface); border-bottom: 1px solid var(--et-hairline); padding: 12px 16px 14px; }
.fca-tete .mx-fil { margin-bottom: 8px; }
.fca-tete-rang { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.fca-retour { width: 36px; padding: 0; justify-content: center; flex: 0 0 auto; }
.fca-tete-txt { flex: 1 1 320px; min-width: 0; }
.fca-surtitre { font-size: 12px; color: var(--et-muted); }
.fca-tete-ligne { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.fca-numero { margin: 0; font-size: 24px; font-weight: 700; color: var(--et-ink); }
.fca-sous { margin-top: 4px; font-size: 13px; color: var(--et-muted); }
.fca-sous strong { color: var(--et-ink); font-weight: 600; }
.fca-source { display: block; margin-bottom: 2px; }
.fca-source .bi { margin-right: 4px; }
.fca-actions { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; }
.fca-mono { font-family: var(--et-font-mono); }
.fca-fort { font-weight: 600; }

/* Le menu « Plus » : un panneau flottant sous son bouton. */
.fca-plus { position: relative; }
.fca-menu {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 260px;
    display: flex; flex-direction: column; padding: 4px 0;
    background: var(--et-surface); border: 1px solid var(--et-hairline); box-shadow: var(--et-ombre-flottant);
}
.fca-menu button {
    display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
    border: 0; background: transparent; color: var(--et-ink); font-size: 13px; text-align: left; cursor: pointer;
}
.fca-menu button:hover { background: var(--et-rang); }
.fca-menu button.est-danger { color: var(--et-danger-ink); }

/* ----- Corps : la pièce, puis le fournisseur et l'activité ----- */
.fca-corps { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.fca-principal { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.fca-cote { flex: 1 1 300px; max-width: 400px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.fca-onglets { margin: 0; }
.fca-onglet-n {
    margin-left: 6px; padding: 0 6px; font-size: 12px; font-weight: 600;
    background: var(--et-surface-2); color: var(--et-muted);
}
.fca-faits { margin: 0; }

.fca-carte { padding: 0; min-width: 0; }
.fca-carte-tete {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 14px; border-bottom: 1px solid var(--et-hairline);
    font-size: 14px; font-weight: 600; color: var(--et-ink);
}
.fca-lien { border: 0; background: transparent; padding: 0; color: var(--et-lien); font-size: 13px; cursor: pointer; }
.fca-lien:hover { text-decoration: underline; }
.fca-pad { padding: 12px 14px; }
.fca-discret { font-size: 12px; color: var(--et-muted); }
.fca-echu { font-size: 12px; color: var(--et-danger-ink); }
.fca-coupe { overflow-wrap: anywhere; }
.fca-texte { white-space: pre-line; }
.fca-vide {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 18px 14px; font-size: 13px; color: var(--et-muted);
}

/* ----- Tableaux ----- */
.fca-table-boite { overflow-x: auto; }
.fca-table { width: 100%; border-collapse: collapse; font-size: var(--et-fs-cell); }
.fca-table th {
    padding: var(--et-cellule-tete-y) 12px; text-align: left; white-space: nowrap;
    background: var(--et-table-head); color: var(--et-sur-ardoise-plein); font-size: 12px; font-weight: 600;
}
.fca-table td { padding: var(--et-cellule-y) 12px; border-bottom: 1px solid var(--et-hairline); vertical-align: middle; color: var(--et-ink); }
.fca-table .num { text-align: right; white-space: nowrap; }
.fca-art { font-weight: 600; }
.fca-ref { font-size: 12px; color: var(--et-muted); }
.fca-commentaire td { font-style: italic; color: var(--et-muted); }

/* La jauge reçu / facturé : une barre et la quantité. La barre est une marque, pas une encre. */
.fca-jauge { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.fca-barre { flex: 1 1 auto; height: 6px; background: var(--et-surface-2); overflow: hidden; }
.fca-barre > span { display: block; height: 100%; background: var(--et-form-blue); }
.fca-barre > span.est-complet { background: var(--et-succes-ink); }

.fca-totaux {
    display: grid; grid-template-columns: auto 160px; justify-content: end; gap: 4px 16px;
    margin: 0; padding: 10px 14px 14px; font-size: 13px;
}
.fca-totaux dt { color: var(--et-muted); font-weight: 400; text-align: right; }
.fca-totaux dd { margin: 0; text-align: right; color: var(--et-ink); }
.fca-totaux .fca-fort { color: var(--et-ink); font-weight: 700; }

/* ----- Listes de définitions (fournisseur, conditions) ----- */
.fca-dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; margin: 0; padding: 12px 14px; font-size: 13px; }
.fca-dl-large { grid-template-columns: 200px minmax(0, 1fr); }
.fca-dl dt { color: var(--et-muted); font-weight: 400; }
.fca-dl dd { margin: 0; color: var(--et-ink); min-width: 0; }

/* ----- Fil d'activité ----- */
.fca-fil { list-style: none; margin: 0; padding: 4px 14px 10px; }
.fca-evt { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--et-hairline); font-size: 13px; }
.fca-evt:last-child { border-bottom: 0; }
.fca-evt > .bi { flex: 0 0 auto; margin-top: 2px; color: var(--et-muted); }
.fca-evt.est-echec > .bi, .fca-evt.est-ecart > .bi { color: var(--et-danger-ink); }
.fca-evt-quoi { color: var(--et-ink); overflow-wrap: anywhere; }
.fca-evt-quand { font-size: 12px; color: var(--et-muted); }

/* ----- Largeurs -----
   LE PANNEAU FOURNISSEUR PASSE SOUS LA PIÈCE AVANT QUE LE TABLEAU NE SE COUPE : à côté, à
   1280 px, il laissait 670 px aux sept colonnes des lignes et la colonne « Rapproch. »
   sortait du cadre (mesuré au banc). Dessous, ses deux cartes se rangent côte à côte. */
@media (max-width: 1439px) {
    .fca-cote { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
    .fca-cote > .fca-carte { flex: 1 1 320px; }
}
@media (max-width: 1024px) {
    /* La jauge cède sa barre, la quantité reste : sept colonnes tiennent ainsi à 768 px. */
    .fca-jauge { min-width: 0; }
    .fca-barre { display: none; }
    .fca-table th, .fca-table td { padding-left: 8px; padding-right: 8px; }
    .fca-actions .mx-btn, .fca-menu button, .fca-retour, .fca-lien { min-height: 44px; }
    .fca-retour { width: 44px; }
}
@media (max-width: 720px) {
    .fca-dl-large { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
    .fca-dl-large dd { margin-bottom: 8px; }
    .fca-actions { justify-content: flex-start; }
    .fca-numero { font-size: 20px; }
}

/* ----- Fenêtres « Réceptionner » et « Justifier un écart » (lot 2) ----- */
.fca-saisie-tete { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; margin-bottom: 8px; }
.fca-qte { width: 110px; text-align: right; font-family: var(--et-font-mono); }
.fca-qte.est-erreur { border-color: var(--et-danger); }
.fca-motifs { margin: 12px 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 6px; }
.fca-motifs legend { margin-bottom: 6px; }
.fca-motif {
    display: flex; align-items: flex-start; gap: var(--et-coche-gap); padding: var(--et-option-py) var(--et-option-px); cursor: pointer;
    border: 1px solid var(--et-hairline); background: var(--et-surface); font-size: 13px; color: var(--et-ink);
}
.fca-motif.est-actif { border-color: var(--et-form-blue); background: var(--et-tint); }
.fca-motif input { margin-top: 3px; }
.fca-motif > span { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 1024px) {
    .fca-motif, .fca-qte { min-height: 44px; }
}

/* Le pied de la fenêtre « Saisir la facture » : le verdict du rapprochement et le total. */
.fca-facture-pied { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--et-ink); }
