/* ═══════════════════════════════════════════════════════════
   DTISoft — PermMatrix (pm-) — matrice d'autorisations partagée
   (éditeur de modèles + fiche utilisateur). Reprend le visuel
   historique ga-grid à l'identique.
   ═══════════════════════════════════════════════════════════ */

.pm-grid-wrap {
    flex: 1; overflow: auto;
    border: 1px solid var(--gray-300); border-radius: 3px;
}
.pm-grid {
    width: 100%; border-collapse: collapse; font-size: 12px;
}
.pm-grid thead th {
    background: var(--gray-100); padding: 5px 8px;
    text-align: left; font-weight: 600; color: var(--gray-600);
    border-bottom: 1px solid var(--gray-300);
    position: sticky; top: 0; z-index: 1;
}
.pm-grid thead th:first-child { width: 60%; }
.pm-grid thead th:last-child  { width: 40%; }

.pm-grid td {
    padding: 3px 8px; border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.pm-grid tbody tr:hover td { background: #f0f5ff; }

/* Ligne d'en-tête de section */
.pm-section td {
    font-weight: 700; color: var(--gray-600);
    background: var(--gray-50) !important;
    padding: 6px 8px 4px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 12px;
}

/* Sous-élément indenté (DocsCli sous JousCli, etc.) */
.pm-res.pm-indent { padding-left: 24px !important; }

/* Cellule ressource : libellé + badge de comparaison */
.pm-res {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Badge « ≠ modèle » (diff avec le modèle d'origine) */
.pm-badge {
    display: inline-block; margin-left: 8px;
    padding: 0 6px; border-radius: 8px;
    background: #fef3c7; color: #b45309;
    border: 1px solid #fcd34d;
    font-size: 10px; font-weight: 700; line-height: 15px;
    vertical-align: middle; white-space: nowrap;
    cursor: help;
}

/* Select de niveau */
.pm-sel {
    width: 100%; font-size: 12px; padding: 2px 4px; height: 24px;
    border: 1px solid var(--gray-200); border-radius: 2px;
    background: var(--white); color: var(--gray-700); font-family: inherit;
}
.pm-sel:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary);
}
.pm-sel:disabled {
    background: var(--gray-50); color: var(--gray-500); cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════
   v2 — grand popup Autorisations (PermMatrix.openPopup)
   z-index 8200 : au-dessus des fiches user/modèle (8000) et de
   leurs sous-popups (8100) ; popovers ⓘ à 8300.
   ═══════════════════════════════════════════════════════════ */
.pm-popup-overlay {
    position: fixed; inset: 0; z-index: 8200;
    background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center;
}
.pm-popup-panel {
    width: min(1100px, 94vw); height: min(90vh, 920px);
    background: var(--white); border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
    display: flex; flex-direction: column; overflow: hidden;
}
.pm-popup-head {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 14px; border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50); flex: 0 0 auto;
}
.pm-popup-titles { min-width: 0; }
.pm-popup-title {
    font-weight: 700; font-size: 14px; color: var(--gray-800);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-popup-sub {
    font-size: 11px; color: var(--gray-500);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-popup-search { flex: 1; display: flex; justify-content: flex-end; }
.pm-popup-search input {
    width: min(340px, 40vw); font-size: 12px; padding: 5px 8px;
    border: 1px solid var(--gray-300); border-radius: 4px;
    background: var(--white); color: var(--gray-700); font-family: inherit;
}
.pm-popup-search input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary);
}
.pm-popup-close {
    border: 0; background: none; cursor: pointer; font-size: 15px;
    color: var(--gray-500); padding: 4px 6px; flex: 0 0 auto;
}
.pm-popup-close:hover { color: var(--gray-800); }
.pm-popup-note {
    padding: 6px 14px; font-size: 12px; color: #92400e;
    background: #fffbeb; border-bottom: 1px solid #fde68a; flex: 0 0 auto;
}
.pm-popup-body {
    flex: 1; min-height: 0; overflow: auto;
    padding: 10px 14px; display: flex;
}
.pm-popup-body > * { flex: 1; min-width: 0; }
.pm-popup-foot {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-top: 1px solid var(--gray-200);
    background: var(--gray-50); flex: 0 0 auto;
}
.pm-popup-count { cursor: default; }
.pm-popup-status { font-size: 12px; }
.pm-popup-spacer { flex: 1; }
.pm-popup-btn {
    padding: 6px 14px; border: 1px solid var(--gray-300);
    background: var(--white); color: var(--gray-700);
    border-radius: 4px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.pm-popup-btn-primary {
    background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600;
}
.pm-popup-btn:disabled { opacity: .6; cursor: default; }

/* Badge « désactivé » (journal Disabled=1) */
.pm-off {
    display: inline-block; margin-left: 8px;
    padding: 0 6px; border-radius: 8px;
    background: var(--gray-100); color: var(--gray-500);
    border: 1px solid var(--gray-300);
    font-size: 10px; font-weight: 600; line-height: 15px;
    vertical-align: middle; white-space: nowrap; cursor: help;
}

/* Bouton ⓘ + popover explicatif (un seul ouvert, z 8300) */
.pm-info {
    border: 0; background: none; cursor: pointer;
    margin-left: 6px; padding: 0 4px;
    color: var(--gray-400); font-size: 12px; vertical-align: middle;
}
.pm-info:hover, .pm-info[aria-expanded="true"] { color: var(--primary); }
.pm-pop {
    position: fixed; z-index: 8300;
    width: 348px; max-width: 90vw; max-height: 55vh; overflow: auto;
    background: var(--white); border: 1px solid var(--gray-300);
    border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    padding: 10px 12px; font-size: 12px; color: var(--gray-700);
}
.pm-pop-title { font-weight: 700; color: var(--gray-800); margin-bottom: 1px; }
.pm-pop-code  { font-size: 10px; color: var(--gray-400); margin-bottom: 6px; }
.pm-pop-txt   { margin: 0 0 8px; line-height: 1.45; }
.pm-pop-ou-t  { font-weight: 600; color: var(--gray-600); margin-bottom: 2px; }
.pm-pop ul    { margin: 0; padding-left: 16px; }
.pm-pop li    { margin: 2px 0; line-height: 1.4; }
