/* ═══════════════════════════════════════════════════════════
   DTISoft — Popup Pièces Jointes partagé (js/pj-popup.js) — pj-*
   ═══════════════════════════════════════════════════════════ */

.pj-overlay {
    /* 10600 : au-dessus des fiches (ad/td 9600, dd 8000, tr 9500) d'où le popup PJ
       est ouvert, sous la visionneuse de fichiers (fx 11800). Était 9000 → les PJ
       s'ouvraient DERRIÈRE la fiche article. (Aligné sur l'audit .au-overlay.) */
    position: fixed; inset: 0; z-index: 10600;
    background: rgba(0,0,0,.35);
    display: flex; align-items: center; justify-content: center;
}
.pj-panel {
    background: var(--white); border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,.28);
    width: 760px; max-width: calc(100vw - 32px); max-height: 86vh;
    display: flex; flex-direction: column;
    font-size: 13px; outline: none;
}

/* Header */
.pj-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 14px;
    background: var(--gray-100); border-bottom: 1px solid var(--gray-300);
    border-radius: 6px 6px 0 0;
    font-weight: 700; font-size: 14px; color: var(--gray-700);
}
.pj-title i { color: var(--primary); margin-right: 6px; }
.pj-close { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--gray-500); padding: 2px 6px; }
.pj-close:hover { color: var(--gray-800); }

/* Toolbar */
.pj-toolbar {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-bottom: 1px solid var(--gray-200);
}
.pj-tb-btn {
    width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--gray-300); border-radius: 4px;
    background: var(--white); color: var(--gray-700); cursor: pointer; font-size: 13px;
    transition: background .12s, border-color .12s, color .12s;
}
.pj-tb-btn:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-400); }
.pj-add:hover:not(:disabled)    { background: #eef6ee; border-color: #86c98a; color: #15803d; }
.pj-del:hover:not(:disabled)    { background: #fdecec; border-color: #f0a6a6; color: #b91c1c; }
.pj-dl-btn:hover:not(:disabled) { background: #eef2fb; border-color: #a9c2f0; color: #1d4ed8; }
.pj-tb-btn:disabled { opacity: .4; cursor: default; }
.pj-busy { margin-left: auto; font-size: 12px; color: var(--primary); }
.pj-busy i { margin-right: 4px; }

/* Grille */
.pj-grid-wrap { flex: 1; overflow-y: auto; outline: none; }
.pj-grid { width: 100%; border-collapse: collapse; }
.pj-grid thead th {
    position: sticky; top: 0; z-index: 1;
    background: var(--gray-50); border-bottom: 1px solid var(--gray-300);
    padding: 6px 8px; text-align: left; font-size: 11px; font-weight: 600;
    color: var(--gray-600); text-transform: uppercase; letter-spacing: .02em;
    white-space: nowrap;
}
.pj-th[data-sort] { cursor: pointer; user-select: none; }
.pj-th[data-sort]:hover { background: var(--gray-100); color: var(--gray-800); }
.pj-th.pj-sorted::after {
    content: '\25B2'; font-size: 8px; margin-left: 5px; color: var(--primary);
}
.pj-th.pj-sorted[data-dir="desc"]::after { content: '\25BC'; }
.pj-th-act { width: 44px; }
.pj-r { text-align: right; }

.pj-grid tbody td {
    padding: 5px 8px; border-bottom: 1px solid var(--gray-100);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pj-nom { max-width: 320px; }
.pj-fic { color: var(--gray-400); margin-right: 5px; }
.pj-type { color: var(--gray-500); font-size: 11px; }
.pj-row { cursor: pointer; }
.pj-row:hover { background: var(--gray-50); }
.pj-row.pj-selected { background: var(--blue-pale); }
.pj-row.pj-selected td { color: var(--gray-800); }
.pj-dl { color: var(--gray-500); }
.pj-dl:hover { color: var(--primary); }
.pj-empty { text-align: center; color: var(--gray-400); padding: 18px; font-style: italic; }

/* Colonne Source (chaîne doc-suite) */
.pj-src { max-width: 150px; font-size: 12px; }
.pj-src-self { color: var(--gray-400); font-style: italic; }
.pj-src-link { color: var(--primary); cursor: pointer; text-decoration: none; }
.pj-src-link:hover { text-decoration: underline; }
/* Lignes héritées d'un autre document de la chaîne = lecture seule (grisées,
   accent à gauche). Le bleu de sélection reste prioritaire. */
.pj-row.pj-inherited:not(.pj-selected) { background: var(--gray-50); }
.pj-row.pj-inherited td { color: var(--gray-500); box-shadow: none; }
.pj-row.pj-inherited .pj-nom { border-left: 2px solid var(--gray-300); }

/* Footer */
.pj-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px;
    background: var(--gray-100); border-top: 1px solid var(--gray-300);
    border-radius: 0 0 6px 6px;
    font-size: 12px; color: var(--gray-500);
}
.pj-ok {
    padding: 4px 16px; font-size: 12px; font-weight: 600;
    border: 1px solid #1e1e1e; border-radius: 3px;
    background: #1e1e1e; color: var(--white); cursor: pointer;
}
.pj-ok:hover { background: #333; }
