/* ch.588 — FACTURES : liste en cartes fines (une pastille + des puces) et fenêtre d'aperçu élargie.
   Charte claire, ⛔ aucune variable CSS. Les adaptations d'écran vivent ICI, en @media uniquement. */

/* ── Liste : une carte par facture, zones fixes ── */
.fc588-liste { display: flex; flex-direction: column; gap: 6px; padding: 6px 2px; }
/* ch.592 — colonnes FIXES, identiques sur toutes les cartes (seul l'objet est flexible) ⇒ l'objet et les pastilles partent du MÊME X. */
.fc588-carte { display: grid; grid-template-columns: 260px minmax(0, 1fr) 230px 130px 112px;   /* actions : « PDF » ⊕ « ⋮ » ≈ 108 px mesurés (ch.592) */
  align-items: center; column-gap: 14px; min-height: 64px; max-height: 72px; box-sizing: border-box; padding: 8px 12px;
  background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 12px; cursor: pointer; transition: background .15s, box-shadow .15s; }
.fc588-carte:hover { background: #F8FAFC; box-shadow: 0 2px 10px rgba(15, 23, 42, .06); }
.fc588-ident { min-width: 0; }
.fc588-num { font-size: 12px; font-weight: 400; color: #64748B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }   /* ch.592 — n° SOUS le client */
.fc588-ico { margin-right: 5px; font-size: 12px; }
.fc588-client { font-size: 13px; font-weight: 700; color: #1E293B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* ch.592 — client EN GRAS, en premier */
.fc588-objet { min-width: 0; font-size: 12px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; justify-self: stretch; }
.fc588-etat { display: flex; align-items: center; justify-content: flex-start; gap: 6px; flex-wrap: nowrap; white-space: nowrap; min-width: 0; overflow: hidden; }
.fc588-pastille { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.fc588-puces { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.fc588-puce { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 8px;
  font-size: 12px; line-height: 1; cursor: help; flex: 0 0 auto; }
.fc588-puce:focus-visible { outline: 2px solid #22D3EE; outline-offset: 1px; }
.fc588-montants { text-align: right; white-space: nowrap; min-width: 0; }
.fc588-ttc { font-size: 13px; font-weight: 700; color: #1E293B; }
.fc588-reste { font-size: 11px; color: #B45309; font-weight: 600; }
.fc588-echeance { font-size: 11px; }
.fc588-actions { display: flex; gap: 5px; align-items: center; justify-content: flex-end; }
.fc588-bulle { position: fixed; z-index: 2000; background: #1E293B; color: #FFFFFF; font-size: 12px; line-height: 1.4;
  padding: 6px 10px; border-radius: 8px; box-shadow: 0 6px 20px rgba(15, 23, 42, .25); }

/* ── Fenêtre d'aperçu ── */
.fc588-boite { background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 16px; width: min(1100px, 96vw); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(15, 23, 42, .22); box-sizing: border-box; }
.fc588-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid #E2E8F0; background: #F8FAFC; flex-shrink: 0; }
.fc588-x { min-width: 40px; min-height: 40px; background: none; border: none; font-size: 20px; cursor: pointer; color: #64748B; border-radius: 8px; }
.fc588-x:hover { background: #F1F5F9; }
.fc588-corps { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 14px 18px; background: #FFFFFF; }
.fc588-grille { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.fc588-gauche { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fc588-bloc { background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 12px; padding: 12px 14px; min-width: 0; box-sizing: border-box; }
.fc588-titre { font-size: 10px; color: #94A3B8; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.fc588-bandeau { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .8fr); gap: 0;
  background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 12px; }
.fc588-case { padding: 12px 14px; min-width: 0; }
.fc588-case + .fc588-case { border-left: 1px solid #E2E8F0; }
.fc588-duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.fc588-duo > :only-child { grid-column: 1 / -1; }
.fc588-lignes { border: 1px solid #F1F5F9; border-radius: 8px; }
.fc588-lignes-defile { max-height: 248px; overflow-y: auto; }
.fc588-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fc588-table thead th { position: sticky; top: 0; z-index: 1; background: #F8FAFC; color: #64748B; font-weight: 600;
  padding: 6px 8px; border-bottom: 1px solid #E2E8F0; }
.fc588-table td { padding: 6px 8px; color: #475569; border-bottom: 1px solid #F8FAFC; }
.fc588-c-desc { text-align: left; color: #1E293B; overflow-wrap: anywhere; }
.fc588-c-qte { text-align: center; width: 44px; }
.fc588-c-mt { text-align: right; width: 88px; white-space: nowrap; }
.fc588-section td { background: #F1F5F9; color: #1E293B; font-weight: 700; font-size: 12px; }
.fc588-soustotal td { text-align: right; color: #64748B; font-size: 11px; font-weight: 600; }
.fc588-timeline { max-height: 420px; overflow-y: auto; padding-right: 4px; }
.fc588-barre { flex-shrink: 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px;
  border-top: 1px solid #E2E8F0; background: #F8FAFC; }
.fc588-action { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 9px;
  font-size: 13px; font-weight: 600; cursor: pointer; }

/* ── ~768 px : fenêtre en UNE colonne, Historique sous le contenu ── */
@media (max-width: 900px) {
  .fc588-grille { grid-template-columns: minmax(0, 1fr); }
  .fc588-timeline { max-height: 260px; }
  .fc588-carte { grid-template-columns: 190px minmax(0, 1fr) 200px 120px; grid-template-areas: "ident objet etat montants" "ident objet etat actions"; max-height: none; row-gap: 4px; }
  .fc588-ident { grid-area: ident; } .fc588-objet { grid-area: objet; } .fc588-etat { grid-area: etat; }
  .fc588-montants { grid-area: montants; } .fc588-actions { grid-area: actions; }
}

/* ── ~375 px : carte sur 3 lignes, puces en ligne, zones tactiles ≥ 44 px ── */
@media (max-width: 600px) {
  .fc588-carte { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ident actions" "objet objet" "etat montants";
    column-gap: 8px; row-gap: 4px; padding: 8px 10px; max-height: none; }
  .fc588-puce { width: 44px; height: 44px; font-size: 16px; border-radius: 10px; }
  .fc588-etat { flex-wrap: wrap; row-gap: 4px; white-space: normal; }
  .fc588-puces { flex-wrap: nowrap; }
  .fc588-actions .fc-btn3d, .fc588-actions button { min-height: 44px; min-width: 44px; }
  #fc-inv-modal.fc588-overlay { padding: 6px !important; }
  .fc588-boite { width: 100%; max-height: 96vh; border-radius: 14px; }
  .fc588-tete, .fc588-corps, .fc588-barre { padding-left: 12px; padding-right: 12px; }
  .fc588-bandeau { grid-template-columns: minmax(0, 1fr); }
  .fc588-case + .fc588-case { border-left: none; border-top: 1px solid #E2E8F0; }
  .fc588-duo { grid-template-columns: minmax(0, 1fr); }
  .fc588-action { min-height: 44px; }
  .fc588-x { min-width: 44px; min-height: 44px; }
  .fc588-c-mt { width: 74px; }
}
