/* ═══════════════════════════════════════════════════════════
   DTISoft — Réappro fournisseurs (création auto des COF)
   Préfixe : rf-
   Fenêtre outil plein écran (Outils → Commandes fournisseurs auto) :
   sidebar fournisseurs redimensionnable + grille articles candidats.
   z-index 7500 = SOUS les fiches document (8000) → les COF créés
   s'ouvrent PAR-DESSUS l'outil.
   ═══════════════════════════════════════════════════════════ */

.rf-overlay {
    position: fixed; inset: 0; z-index: 7500;
    background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center;
}
.rf-panel {
    background: #fff; border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .3);
    width: 96vw; height: 95vh;
    display: flex; flex-direction: column; overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────── */
.rf-header {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px; background: #1e3a8a; color: #fff;
    flex: 0 0 auto; flex-wrap: wrap;
}
.rf-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.rf-header label { font-size: 11px; opacity: .85; }
.rf-hdr-fld { display: flex; align-items: center; gap: 5px; }
.rf-header select, .rf-header input[type=text] {
    padding: 4px 8px; border: 1px solid rgba(255,255,255,.35); border-radius: 4px;
    background: rgba(255,255,255,.12); color: #fff; font-size: 12px;
}
.rf-header select option { color: #111; }
.rf-header input[type=text] { width: 110px; text-transform: uppercase; }
.rf-header input[type=text]::placeholder { color: rgba(255,255,255,.5); text-transform: none; }
.rf-modes { display: flex; gap: 2px; background: rgba(255,255,255,.12); border-radius: 4px; padding: 2px; }
.rf-mode-btn {
    border: 0; background: transparent; color: rgba(255,255,255,.75);
    padding: 4px 10px; font-size: 11.5px; border-radius: 3px; cursor: pointer; font-weight: 600;
}
.rf-mode-btn.rf-mode-active { background: #fff; color: #1e3a8a; }
.rf-refresh-btn {
    border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.15); color: #fff;
    padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px;
}
.rf-refresh-btn:hover { background: rgba(255,255,255,.28); }
.rf-winctrls { margin-left: auto; display: flex; gap: 6px; }
.rf-winbtn {
    width: 28px; height: 26px; border: 0; border-radius: 4px; cursor: pointer;
    background: rgba(255,255,255,.15); color: #fff; font-size: 12px;
}
.rf-winbtn:hover { background: rgba(255,255,255,.3); }

/* ── Corps : sidebar + splitter + main ──────────────────── */
.rf-body { flex: 1; display: flex; min-height: 0; }

.rf-side {
    width: 280px; min-width: 180px; max-width: 560px;
    flex: 0 0 auto; display: flex; flex-direction: column;
    border-right: 1px solid #e5e7eb; background: #f8fafc; min-height: 0;
}
.rf-side-tools { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid #e5e7eb; }
.rf-side-search {
    width: 100%; box-sizing: border-box; padding: 5px 9px;
    border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px;
}
.rf-side-hint { font-size: 10.5px; color: #94a3b8; }
.rf-side-list { flex: 1; overflow-y: auto; min-height: 0; }
.rf-fou-row {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 8px; cursor: pointer; border-bottom: 1px solid #eef2f7;
    font-size: 12px;
}
.rf-fou-row:hover { background: #eff6ff; }
.rf-fou-row.rf-fou-active { background: #dbeafe; }
.rf-fou-row input[type=checkbox] { cursor: pointer; flex: 0 0 auto; }
.rf-fou-alias { font-weight: 700; color: #1e3a8a; white-space: nowrap; }
.rf-fou-nom { flex: 1; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-fou-badge {
    flex: 0 0 auto; min-width: 20px; text-align: center;
    background: #dc2626; color: #fff; border-radius: 9px;
    font-size: 10px; font-weight: 700; padding: 1px 6px;
}
.rf-fou-badge.rf-badge-sel { background: #16a34a; }
.rf-fou-mincde { flex: 0 0 auto; font-size: 9.5px; color: #b45309; background: #fef3c7; border-radius: 3px; padding: 0 4px; }
.rf-fou-spin { flex: 0 0 auto; color: #64748b; font-size: 11px; }
.rf-side-loading, .rf-side-empty { padding: 18px 12px; text-align: center; color: #94a3b8; font-size: 12px; }

.rf-splitter {
    flex: 0 0 5px; cursor: col-resize; background: #e5e7eb;
    transition: background .12s ease;
}
.rf-splitter:hover, .rf-splitter.rf-dragging { background: #3498db; }

/* ── Panneau principal ──────────────────────────────────── */
.rf-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.rf-main-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 8px 12px; border-bottom: 1px solid #e5e7eb; background: #fff;
    font-size: 12.5px; min-height: 24px;
}
.rf-main-title { font-weight: 700; color: #1e3a8a; }
.rf-main-info { color: #64748b; }
.rf-main-warn {
    color: #92400e; background: #fef3c7; border: 1px solid #fde68a;
    border-radius: 4px; padding: 2px 8px; font-size: 11.5px;
}

/* Franco de port (Tiers.FouMontantMinCde — fiche fournisseur « Franco de port ») */
.rf-franco-ok {
    display: inline-flex; align-items: center; gap: 6px;
    color: #14532d; background: #dcfce7; border: 1px solid #86efac;
    border-radius: 4px; padding: 2px 10px; font-size: 11.5px; font-weight: 700;
}
.rf-franco-ok i { color: #16a34a; }
.rf-franco-prog {
    display: inline-flex; align-items: center; gap: 7px;
    color: #92400e; background: #fef3c7; border: 1px solid #fde68a;
    border-radius: 4px; padding: 2px 10px; font-size: 11.5px;
}
.rf-franco-prog i { color: #d97706; }
.rf-franco-bar {
    display: inline-block; width: 90px; height: 7px;
    background: #fde68a; border-radius: 4px; overflow: hidden;
}
.rf-franco-fill { display: block; height: 100%; background: #16a34a; transition: width .25s ease; }
.rf-fou-franco-ok { color: #14532d !important; background: #dcfce7 !important; }
.rf-fou-franco-ok i { color: #16a34a; }
.rf-franco-none {
    display: inline-flex; align-items: center; gap: 6px;
    color: #94a3b8; border: 1px dashed #cbd5e1; border-radius: 4px;
    padding: 2px 10px; font-size: 11px; font-style: italic;
}

/* ── Colonnes : drag & drop + resize ────────────────────── */
.rf-th-drag { cursor: grab; }
.rf-th-dragging { opacity: .45; }
.rf-th-drop { border-left: 3px solid #2563eb !important; background: #dbeafe !important; }
/* NB : les th sont déjà position:sticky (règle .rf-table thead th) → contexte
   de positionnement valide pour la poignée absolute ci-dessous. */
.rf-col-resize {
    position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
    cursor: col-resize; z-index: 2;
}
.rf-col-resize:hover { background: rgba(37, 99, 235, .35); }
.rf-grid-wrap { flex: 1; overflow: auto; min-height: 0; }
.rf-placeholder { padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 13px; }
.rf-placeholder i { font-size: 26px; display: block; margin-bottom: 10px; color: #cbd5e1; }

.rf-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.rf-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: #f1f5f9; color: #475569; font-size: 10px;
    text-transform: uppercase; letter-spacing: .02em;
    padding: 5px 6px; text-align: left; border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.rf-table td {
    padding: 3px 6px; border-bottom: 1px solid #f1f5f9; white-space: nowrap;
}
.rf-table tbody tr:hover td { background: #f8fafc; }
.rf-table tr.rf-row-off td { opacity: .45; }
.rf-table th.num, .rf-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rf-ref { font-family: monospace; font-weight: 600; color: #0f172a; }
.rf-reffou { font-family: monospace; color: #64748b; }
.rf-lib { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.rf-neg { color: #dc2626; font-weight: 700; }
.rf-pos { color: #16a34a; }
.rf-qty-inp {
    width: 62px; padding: 2px 5px; text-align: right;
    border: 1px solid #cbd5e1; border-radius: 3px; font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}
.rf-qty-inp:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.rf-qty-inp.rf-qty-mod { background: #fef9c3; border-color: #f59e0b; }
.rf-warn-ico { color: #d97706; margin-left: 3px; }

/* Paliers de prix (ArtPrixFou — onglet Prix d'achat de la fiche article) */
.rf-tier-ico { color: #7c3aed; margin-left: 4px; font-size: 9px; vertical-align: 1px; }
.rf-tier-hint {
    display: block; font-size: 10px; line-height: 1.3;
    color: #7c3aed; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.rf-tier-hint:hover { text-decoration: underline; color: #5b21b6; }

/* ── Footer ─────────────────────────────────────────────── */
.rf-footer {
    flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
    padding: 9px 14px; border-top: 1px solid #e5e7eb; background: #fafafa;
    font-size: 12.5px; flex-wrap: wrap;
}
.rf-foot-sum { color: #334155; }
.rf-foot-sum b { color: #1e3a8a; }
.rf-create-btn {
    margin-left: auto;
    border: 1px solid #16a34a; background: #16a34a; color: #fff;
    padding: 8px 18px; border-radius: 4px; cursor: pointer;
    font-size: 13px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 8px;
}
.rf-create-btn:hover:not(:disabled) { background: #15803d; }
.rf-create-btn:disabled { opacity: .45; cursor: default; }

/* ── Mode minimisé (DTIMinimizer) ───────────────────────── */
/* Le chip 40px ne garde que titre + boutons réduire/fermer :
   les contrôles du header (PDV, modes, plage, Actualiser) sont masqués. */
.dti-minimized .rf-hdr-fld,
.dti-minimized .rf-modes,
.dti-minimized .rf-refresh-btn { display: none !important; }
.dti-minimized .rf-header { padding: 6px 8px !important; flex-wrap: nowrap !important; }
.dti-minimized .rf-title {
    flex: 1 1 auto; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; font-size: 12px;
}

/* ── Résultats de création ──────────────────────────────── */
.rf-result-overlay {
    position: fixed; inset: 0; z-index: 7600;
    background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center;
}
.rf-result-panel {
    background: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
    width: min(640px, 92vw); max-height: 80vh; display: flex; flex-direction: column; overflow: hidden;
}
.rf-result-head {
    padding: 12px 16px; background: #1e3a8a; color: #fff; font-weight: 700; font-size: 14px;
    display: flex; justify-content: space-between; align-items: center;
}
.rf-result-close { background: none; border: 0; color: #fff; font-size: 17px; cursor: pointer; opacity: .85; }
.rf-result-body { padding: 14px 16px; overflow-y: auto; font-size: 13px; }
.rf-result-line {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px;
    border-radius: 4px; margin-bottom: 6px;
}
.rf-result-line.ok  { background: #dcfce7; color: #14532d; }
.rf-result-line.err { background: #fee2e2; color: #7f1d1d; }
.rf-result-open {
    margin-left: auto; border: 1px solid #16a34a; background: #fff; color: #15803d;
    border-radius: 4px; padding: 3px 10px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.rf-result-open:hover { background: #f0fdf4; }
.rf-result-foot { padding: 10px 16px; border-top: 1px solid #e5e7eb; text-align: right; }
.rf-result-okbtn {
    border: 0; background: #3498db; color: #fff; border-radius: 4px;
    padding: 7px 16px; cursor: pointer; font-size: 13px;
}
