/* Rôles, permissions, accès refusé, journal d'audit. Variables du thème : voir app.css. */

/* Éléments masqués par les droits (navigation, boutons). Le serveur reste l'autorité : ceci n'est que de l'ergonomie. */
#sidebar .perm-hidden, .perm-hidden { display: none !important; }

.access-denied { max-width: 460px; margin: 12vh auto 0; text-align: center; padding: 0 16px; }
.access-denied-code { font-family: var(--font-mono); font-size: 44px; font-weight: 600; color: var(--danger); letter-spacing: -.02em; }
.access-denied h2 { margin: 6px 0 10px; font-size: 20px; font-weight: 600; }
.access-denied p { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; }
.access-denied .btn { margin-top: 14px; display: inline-flex; }

/* Barre d'onglets sur plusieurs lignes (Paramètres) */
.tabs-bar.tabs-wrap { flex-wrap: wrap; overflow-x: visible; }

/* ── Rôles ── */
.rl-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.rl-list { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 8px; }
.rl-new { align-self: stretch; justify-content: center; margin-bottom: 4px; }
.rl-item { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  color: var(--fg); cursor: pointer; display: flex; flex-direction: column; gap: 3px; font: inherit; }
.rl-item:hover { border-color: var(--accent); }
.rl-item.active { border-color: var(--accent); background: var(--accent-d); }
.rl-item-name { font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rl-item-sub { font-size: 11.5px; color: var(--muted); }

.rl-edit { min-width: 0; scroll-margin-top: calc(var(--topbar-h, 64px) + var(--s-3)); }
.rl-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.rl-head .sp { flex: 1; }
.rl-title { font-size: 18px; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rl-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.rl-block { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.rl-block-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px; }
.rl-block-h .sp { flex: 1; }
.rl-block > :not(.rl-block-h) { padding: 12px 14px; }
.rl-block > .rl-grid-wrap { padding: 0; overflow-x: auto; }

.rl-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.rl-grid th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rl-grid th.rl-col { text-align: center; width: 104px; }
.rl-grid td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.rl-grid tr:last-child td { border-bottom: 0; }
.rl-group td { background: var(--surface2); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 5px 12px; }
.rl-mod { font-weight: 500; white-space: nowrap; }
.rl-cell { text-align: center; }
.rl-cell input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }
.rl-cell input:disabled { cursor: not-allowed; opacity: .7; }
.rl-cell.on { background: color-mix(in oklch, var(--accent) 9%, transparent); }
.rl-cell.exact { background: color-mix(in oklch, var(--accent) 20%, transparent); }

.rl-assigne { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; margin-bottom: 12px; }
.rl-assigne input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.rl-peri-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.rl-peri-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--bg); }
.rl-peri-title { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.rl-peri-count { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.rl-filter { width: 100%; margin-bottom: 6px; }
.rl-checks { max-height: 168px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.rl-check { display: flex; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 2px; cursor: pointer; }
.rl-check input { accent-color: var(--accent); }

.rl-prev-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.rl-prev-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.rl-prev-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.rl-prev-p { margin: 0 0 6px; font-size: 12.5px; }
.rl-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rl-chip { border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12px; background: var(--bg); }

.rl-save-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 10px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* ── Journal d'audit ── */
.rl-audit-bar .rl-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.rl-detail { font-size: 12px; color: var(--muted); display: inline-block; max-width: 520px; overflow-wrap: anywhere; }
.rl-more { padding: 12px 0; text-align: center; }

@media (max-width: 900px) {
  .rl-wrap { grid-template-columns: 1fr; }
  .rl-list { position: static; flex-direction: row; flex-wrap: wrap; }
  .rl-item { flex: 1 1 180px; }
  .rl-grid th.rl-col { width: auto; }
}


/* ── Accès en arborescence (Paramètres > Utilisateurs > Accès) ── */
.ac-wrap { display: flex; flex-direction: column; gap: 10px; }
.ac-bar { display: flex; gap: 8px; align-items: center; }
.ac-bar .ac-search { flex: 1; min-width: 0; }
.ac-tree { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); max-height: 46vh; overflow: auto; padding: 4px 0; }
.ac-row { display: flex; align-items: center; gap: 4px; padding: 2px 10px; }
.ac-row:hover { background: var(--surface2); }
.ac-n1 { padding-left: 30px; }
.ac-n2 { padding-left: 52px; }
.ac-tog { width: 22px; height: 22px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; flex: none; border-radius: 4px; }
.ac-tog:hover:not(:disabled) { background: var(--surface2); color: var(--fg); }
.ac-tog.ac-vide { cursor: default; }
.ac-lab { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 4px 0; cursor: pointer; font-size: 13px; }
.ac-lab input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.ac-n0 > .ac-lab .ac-nom { font-weight: 600; }
.ac-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-sous { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.ac-impl { cursor: default; color: var(--muted); }
.ac-hint { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; margin-left: auto; flex: none; }
.ac-sansclient { color: var(--muted); font-size: 12px; font-style: italic; padding: 6px 10px; }
.ac-apercu { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--surface); padding: 9px 12px; font-size: 13px; min-height: 20px; }
.ac-note { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.rl-cell.rl-verrou { opacity: .35; background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--border) 5px 6px); cursor: not-allowed; }
