/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   DTISoft — Prévisions (Dashboard → Prévisions, chantier « Pilotage », lot 7, 2026-10-27)
   Préfixe prev- (écran, fenêtres .prev-fen-overlay, messages .prev-msg-overlay). S'appuie sur css/pilotage.css (pil-, stat-,
   kpi-, chart-) et sur les onglets stk- de css/pil-stock.css, sans les modifier.
   §7.16 : défilement INTERNE (.pil-contenu, .prev-corps, zones de tableaux) ; §7.41 : [hidden] repassé en (0,2,0) dans chaque
   conteneur. Empilement (z-index en ligne) : fenêtres 7800 (SOUS le détail des statistiques 7900 et les fiches document 8000+
   qu'on ouvre depuis elles) ; messages 10600 (comme la confirmation).
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */
.prev-wrap [hidden], .prev-fen-overlay [hidden], .prev-msg-overlay [hidden] { display: none; }

/* ── En-tête, onglets, barre, fil ── */
.prev-tete-droite { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; }
.prev-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.prev-onglets { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--pil-bord); margin: 4px 0 8px; }
.prev-barre .stat-input { max-width: 200px; }
.prev-barre .prev-art { max-width: 160px; }
.prev-barre .prev-creer { margin-left: auto; }
.prev-fil { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 8px; font-size: 12.5px; }
.prev-fil-lien { border: none; background: none; padding: 1px 2px; color: var(--blue-mid, #1e5bb5); cursor: pointer; font: inherit; text-decoration: underline; }
.prev-fil-sep { color: var(--gray-400); }
.prev-fil-courant { font-weight: 700; color: var(--gray-700); }

/* ── Contenu ── */
.prev-vue { display: flex; flex-direction: column; gap: 12px; }
.prev-tuiles { margin-bottom: 0; }
.prev-carte { min-width: 0; }
.prev-graphe { width: 100%; min-height: 160px; }
.prev-graphe--petit { min-height: 120px; max-width: 640px; }
.prev-note { margin: 6px 0 0; font-size: 12px; color: var(--gray-500); line-height: 1.4; }
.prev-note--alerte { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 6px 10px; }
.prev-explication { margin: 4px 0 8px 18px; padding: 0; font-size: 13px; color: var(--gray-700); line-height: 1.5; }
.prev-table-zone { background: var(--white); border: 1px solid var(--pil-bord); border-radius: 8px; overflow: auto; max-height: calc(100vh - 300px); min-height: 60px; }
.prev-table { table-layout: auto; }
.prev-table thead th { position: sticky; top: 0; z-index: 1; }
.prev-table th.stat-num, .prev-table td.stat-num { width: 1%; white-space: nowrap; }
.prev-ligne--clic { cursor: pointer; }
.prev-ligne--clic:hover td, .prev-ligne--clic:focus td { background: var(--gray-50); }
.prev-negatif { color: #b91c1c; }
.prev-total { font-weight: 700; }
.prev-inactif td { color: var(--gray-400); }

/* ── Réassort ── */
.prev-reassort { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; }
.prev-fou-liste { display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 300px); overflow-y: auto; min-width: 0; }
.prev-fou { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 6px 9px; border: 1px solid var(--pil-bord);
            border-radius: 6px; background: var(--white); cursor: pointer; font: inherit; min-width: 0; }
.prev-fou--actif { outline: 2px solid var(--blue-light, #93c5fd); background: #eff6ff; }
.prev-fou-nom { font-size: 12.5px; font-weight: 700; color: var(--gray-700); overflow-wrap: anywhere; }
.prev-fou-det { font-size: 11.5px; color: var(--gray-500); }
.prev-fou-sel { font-size: 11px; color: #166534; font-weight: 700; }
.prev-fou-detail { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.prev-fou-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.prev-fou-total { font-size: 12.5px; color: var(--gray-700); margin-left: auto; }
.prev-table--reassort .prev-col-art { width: 100%; max-width: 0; min-width: 200px; }
.prev-art-ref { font-weight: 700; font-size: 12px; overflow-wrap: anywhere; }
.prev-art-lib { font-size: 11px; color: var(--gray-500); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prev-qu { width: 86px; text-align: right; font-variant-numeric: tabular-nums; }
.prev-ligne--sans td { color: var(--gray-400); }
.prev-repli { color: #92400e; font-weight: 700; }

/* ── Trésorerie ── */
.prev-table--treso th.prev-poste { text-align: left; font-weight: 600; white-space: nowrap; position: sticky; left: 0; background: var(--white); z-index: 1; }
.prev-ligne-solde td, .prev-ligne-solde th { background: var(--gray-50); font-weight: 700; }
.prev-ligne-fin td, .prev-ligne-fin th { border-top: 2px solid var(--gray-300, #cbd5e1); }
.prev-ligne-enc .prev-poste { color: #166534; }
.prev-ligne-dec .prev-poste { color: #991b1b; }
.prev-case[tabindex] { cursor: pointer; text-decoration: underline dotted; }
.prev-case[tabindex]:hover, .prev-case[tabindex]:focus { background: #eff6ff; outline: none; }

/* ── Fenêtres ── */
.prev-fen-overlay, .prev-msg-overlay {
    position: fixed; inset: 0; z-index: 7800; background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.prev-panel { display: flex; flex-direction: column; width: min(1080px, 100%); max-height: 92vh; min-height: 0;
              background: var(--white); border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.prev-panel--etroit { width: min(720px, 100%); }
.prev-tete { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #1e3a8a; color: #fff; }
.prev-tete-titre { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prev-tete .stat-btn--icone { color: #fff; background: transparent; border-color: rgba(255, 255, 255, .4); }
.prev-corps { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 16px; }
.prev-pied { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--pil-bord); }
.prev-pied-info { flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: var(--gray-500); }
.prev-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
.prev-champ { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.prev-champ > span { font-size: 11px; font-weight: 600; color: var(--gray-500); }
.prev-champ .stat-input { max-width: none; width: 100%; }
.prev-champ--large { grid-column: 1 / -1; }
.prev-case { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.prev-montant, .prev-num { text-align: right; font-variant-numeric: tabular-nums; }
.prev-section { margin: 4px 0 14px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
.prev-section:first-child { border-top: none; padding-top: 0; }
.prev-section-titre { font-size: 13px; font-weight: 700; color: var(--blue-dark, #1e3a8a); margin-bottom: 6px; }
.prev-sous-titre { font-size: 12px; font-weight: 600; color: var(--gray-700); margin: 6px 0 4px; }
.prev-delais-fou { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.prev-delai-fou { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.prev-delai-fou .prev-num { width: 70px; }
.prev-propositions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.prev-liste { margin: 6px 0 0 18px; padding: 0; font-size: 13px; line-height: 1.6; }
.prev-liste .prev-ouvrir { margin-left: 8px; padding: 1px 8px; font-size: 11.5px; }
.prev-ko { color: #b91c1c; }
.prev-msg-texte { white-space: normal; }

/* ── Écran étroit ── */
@media (max-width: 760px) {
    .prev-reassort { grid-template-columns: minmax(0, 1fr); }
    .prev-fou-liste { max-height: 220px; }
    .prev-tete-droite { align-items: flex-start; }
}
@media print {
    .prev-barre, .prev-actions, .prev-onglets { display: none; }
    .prev-table-zone, .prev-fou-liste { max-height: none; overflow: visible; }
}
