/* ═══════════════════════════════════════════════════════════
   DTISoft — Préparations clients auto (création auto des PRP)
   Préfixe : pc-
   Fenêtre outil plein écran (Outils → Préparations clients auto) :
   sidebar CLIENTS redimensionnable + panneau des commandes CO1 (cartes).
   z-index 7500 = SOUS les fiches document (8000) → les PRP créés
   s'ouvrent PAR-DESSUS l'outil.
   ═══════════════════════════════════════════════════════════ */

.pc-overlay {
    position: fixed; inset: 0; z-index: 7500;
    background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center;
}
.pc-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 ─────────────────────────────────────────────── */
.pc-header {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 14px; background: #1e3a8a; color: #fff;
    flex: 0 0 auto; flex-wrap: wrap;
}
.pc-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pc-header label { font-size: 11px; opacity: .85; }
.pc-hdr-fld { display: flex; align-items: center; gap: 5px; }
.pc-hdr-check { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; opacity: .95; cursor: pointer; }
.pc-header select, .pc-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;
}
.pc-header select option { color: #111; }
.pc-header input[type=text] { width: 110px; text-transform: uppercase; }
.pc-header input[type=text]::placeholder { color: rgba(255,255,255,.5); text-transform: none; }
.pc-modes { display: flex; gap: 2px; background: rgba(255,255,255,.12); border-radius: 4px; padding: 2px; }
.pc-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;
}
.pc-mode-btn.pc-mode-active { background: #fff; color: #1e3a8a; }
/* Filtre type désactivé quand une plage de réfs est active */
.pc-modes.pc-modes-disabled { opacity: .4; }
.pc-mode-btn:disabled { cursor: not-allowed; }
.pc-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;
}
.pc-refresh-btn:hover { background: rgba(255,255,255,.28); }
.pc-winctrls { margin-left: auto; display: flex; gap: 6px; }
.pc-winbtn {
    width: 28px; height: 26px; border: 0; border-radius: 4px; cursor: pointer;
    background: rgba(255,255,255,.15); color: #fff; font-size: 12px;
}
.pc-winbtn:hover { background: rgba(255,255,255,.3); }

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

.pc-side {
    width: 300px; 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;
}
.pc-side-tools { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid #e5e7eb; }
.pc-side-search {
    width: 100%; box-sizing: border-box; padding: 5px 9px;
    border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px;
}
.pc-side-hint { font-size: 10.5px; color: #94a3b8; }
.pc-side-list { flex: 1; overflow-y: auto; min-height: 0; }
.pc-cli-row {
    display: flex; align-items: center; gap: 7px;
    padding: 6px 8px; cursor: pointer; border-bottom: 1px solid #eef2f7;
    font-size: 12px;
}
.pc-cli-row:hover { background: #eff6ff; }
.pc-cli-row.pc-cli-active { background: #dbeafe; }
.pc-cli-row input[type=checkbox] { cursor: pointer; flex: 0 0 auto; }
.pc-cli-alias { font-weight: 700; color: #1e3a8a; white-space: nowrap; }
.pc-cli-nom { flex: 1; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-cli-badge {
    flex: 0 0 auto; min-width: 34px; text-align: center;
    color: #fff; border-radius: 9px; font-size: 10px; font-weight: 700; padding: 1px 6px;
}
.pc-cli-badge.pc-badge-ok   { background: #16a34a; }
.pc-cli-badge.pc-badge-none { background: #94a3b8; }
.pc-side-loading, .pc-side-empty { padding: 18px 12px; text-align: center; color: #94a3b8; font-size: 12px; }

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

/* ── Panneau principal ──────────────────────────────────── */
.pc-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pc-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;
}
.pc-main-title { font-weight: 700; color: #1e3a8a; }
.pc-main-info { color: #64748b; }
/* Case « Regrouper les CO1 » (en-tête du panneau client) */
.pc-group-chk {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600; color: #1e3a8a; cursor: pointer;
    border: 1px solid #93c5fd; background: #eff6ff; border-radius: 4px; padding: 2px 8px;
}
.pc-group-chk input { cursor: pointer; }
.pc-group-chk input:disabled { cursor: default; }
.pc-group-chk:has(input:disabled) { opacity: .45; }
/* Icône « regroupé » dans la sidebar */
.pc-cli-grouped { color: #1e3a8a; font-size: 11px; flex: 0 0 auto; }
.pc-main-body { flex: 1; overflow: auto; min-height: 0; padding: 10px 12px; background: #f8fafc; }
.pc-placeholder { padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 13px; }
.pc-placeholder i { font-size: 26px; display: block; margin-bottom: 10px; color: #cbd5e1; }

/* ── Carte commande ─────────────────────────────────────── */
.pc-order {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
    margin-bottom: 10px; overflow: hidden;
}
.pc-order.pc-order-off { opacity: .55; }
.pc-order-head {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px; background: #f1f5f9; border-bottom: 1px solid #e5e7eb;
    font-size: 12.5px;
}
.pc-order-head input[type=checkbox] { cursor: pointer; flex: 0 0 auto; }
.pc-order-title { font-weight: 700; color: #0f172a; }
.pc-order-date { font-weight: 400; color: #64748b; font-size: 11.5px; }
.pc-order-amt { color: #1e3a8a; font-weight: 700; }
.pc-satisf { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; border-radius: 4px; padding: 1px 7px; }
.pc-satisf-complete { background: #dcfce7; color: #14532d; }
.pc-satisf-partial  { background: #fef3c7; color: #92400e; }
.pc-satisf-none     { background: #e2e8f0; color: #64748b; }

.pc-lines { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.pc-lines thead th {
    background: #fff; color: #94a3b8; font-size: 9.5px; text-transform: uppercase;
    letter-spacing: .02em; padding: 4px 8px; text-align: left; border-bottom: 1px solid #eef2f7; white-space: nowrap;
}
.pc-lines td { padding: 3px 8px; border-bottom: 1px solid #f4f6f9; white-space: nowrap; }
.pc-lines tbody tr:last-child td { border-bottom: 0; }
.pc-lines th.num, .pc-lines td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pc-lines tr.pc-line-off td { color: #94a3b8; }
.pc-lines tr.pc-line-inactive td { background: #fafafa; font-style: italic; }
.pc-ref { font-family: monospace; font-weight: 600; color: #0f172a; }
.pc-lib { max-width: 340px; overflow: hidden; text-overflow: ellipsis; color: #475569; }
.pc-alloc { color: #16a34a; font-weight: 700; }
.pc-manque { color: #b45309; }
.pc-reappro { color: #2563eb; font-weight: 600; }   /* DTS entrant (transfert/réappro) */
.pc-cdefou  { color: #7c3aed; font-weight: 600; }   /* COF ouvert (commande fournisseur) */
.pc-unite { color: #64748b; }
.pc-ico-mut { color: #cbd5e1; margin-left: 3px; }

/* ── Footer ─────────────────────────────────────────────── */
.pc-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;
}
.pc-foot-sum { color: #334155; }
.pc-foot-sum b { color: #1e3a8a; }
.pc-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;
}
.pc-create-btn:hover:not(:disabled) { background: #15803d; }
.pc-create-btn:disabled { opacity: .45; cursor: default; }

/* Barre de progression pendant la création (temps réel, 1 PRP à la fois) */
.pc-progress { display: inline-flex; align-items: center; gap: 10px; }
.pc-progress-txt { color: #334155; font-size: 12.5px; }
.pc-progress-txt b { color: #1e3a8a; }
.pc-progress-track { display: inline-block; width: 220px; height: 8px; background: #e5e7eb; border-radius: 5px; overflow: hidden; }
.pc-progress-fill { display: block; height: 100%; background: #1e3a8a; transition: width .15s ease; }

/* ── Mode minimisé (DTIMinimizer) ───────────────────────── */
.dti-minimized .pc-hdr-fld,
.dti-minimized .pc-hdr-check,
.dti-minimized .pc-modes,
.dti-minimized .pc-refresh-btn { display: none !important; }
.dti-minimized .pc-header { padding: 6px 8px !important; flex-wrap: nowrap !important; }
.dti-minimized .pc-title {
    flex: 1 1 auto; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; font-size: 12px;
}

/* ── Résultats de création ──────────────────────────────── */
.pc-result-overlay {
    position: fixed; inset: 0; z-index: 7600;
    background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center;
}
.pc-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;
}
.pc-result-head {
    padding: 12px 16px; background: #1e3a8a; color: #fff; font-weight: 700; font-size: 14px;
    display: flex; justify-content: space-between; align-items: center;
}
.pc-result-close { background: none; border: 0; color: #fff; font-size: 17px; cursor: pointer; opacity: .85; }
.pc-result-body { padding: 14px 16px; overflow-y: auto; font-size: 13px; }
.pc-result-line { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 4px; margin-bottom: 6px; }
.pc-result-line.ok  { background: #dcfce7; color: #14532d; }
.pc-result-line.err { background: #fee2e2; color: #7f1d1d; }
.pc-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;
}
.pc-result-open:hover { background: #f0fdf4; }
/* Client refusé pour limite de crédit : « Autoriser » (popup du responsable, puis relance de CE client) — 2026-10-12 */
.pc-result-auth {
    margin-left: auto; border: 1px solid #b45309; background: #fff; color: #b45309;
    border-radius: 4px; padding: 3px 10px; cursor: pointer; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pc-result-auth:hover { background: #fffbeb; }
.pc-result-auth:disabled { opacity: .55; cursor: default; }
.pc-result-foot { padding: 10px 16px; border-top: 1px solid #e5e7eb; text-align: right; display: flex; justify-content: flex-end; gap: 8px; }
.pc-result-print {
    border: 1px solid #1e3a8a; background: #1e3a8a; color: #fff; border-radius: 4px;
    padding: 7px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px;
}
.pc-result-print:hover { background: #16306e; }
.pc-result-okbtn { border: 0; background: #3498db; color: #fff; border-radius: 4px; padding: 7px 16px; cursor: pointer; font-size: 13px; }
