/* --- RBAC PERMISSION MATRIX STYLES --- */
    .rbac-module-card {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      margin-bottom: 1.5rem;
      box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
    }

    .rbac-module-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1.25rem;
      padding-bottom: 0.75rem;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .rbac-module-title {
      font-size: 1.1rem;
      font-weight: 700;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .rbac-module-desc {
      font-size: 0.78rem;
      color: var(--text-dim);
    }

    .rbac-table {
      width: 100%;
      border-collapse: collapse;
    }

    .rbac-table th {
      text-align: left;
      padding: 0.75rem 1rem;
      font-size: 0.75rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-dim);
      border-bottom: 1px solid var(--border-color);
    }

    .rbac-table th.center {
      text-align: center;
      width: 140px;
    }

    .rbac-table td {
      padding: 0.9rem 1rem;
      border-bottom: 1px solid rgba(255,255,255,0.04);
      font-size: 0.85rem;
      vertical-align: middle;
    }

    .rbac-table tr:hover td {
      background: rgba(255,255,255,0.02);
    }

    .rbac-perm-label {
      font-weight: 600;
      color: #f1f5f9;
      margin-bottom: 0.2rem;
    }

    .rbac-perm-desc {
      font-size: 0.75rem;
      color: var(--text-dim);
    }

    .rbac-perm-key {
      font-family: var(--font-mono);
      font-size: 0.68rem;
      color: #38bdf8;
      background: rgba(56, 189, 248, 0.1);
      padding: 1px 6px;
      border-radius: 4px;
      display: inline-block;
      margin-top: 0.25rem;
    }

    /* Custom Toggle Switch */
    .rbac-switch {
      position: relative;
      display: inline-block;
      width: 44px;
      height: 24px;
    }

    .rbac-switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .rbac-slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(255,255,255,0.12);
      transition: .25s;
      border-radius: 24px;
      border: 1px solid rgba(255,255,255,0.15);
    }

    .rbac-slider:before {
      position: absolute;
      content: "";
      height: 16px;
      width: 16px;
      left: 3px;
      bottom: 3px;
      background-color: white;
      transition: .25s;
      border-radius: 50%;
    }

    .rbac-switch input:checked + .rbac-slider {
      background: linear-gradient(135deg, #10b981, #059669);
      border-color: #34d399;
      box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
    }

    .rbac-switch input:checked + .rbac-slider:before {
      transform: translateX(20px);
    }

    .rbac-switch input:disabled + .rbac-slider {
      opacity: 0.6;
      cursor: not-allowed;
    }

  
    /* --- USERS & ACCESS MANAGEMENT STYLES --- */
    .dinia-users-sync-banner {
      background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(16, 185, 129, 0.05));
      border: 1px solid rgba(99, 102, 241, 0.25);
      border-radius: 12px;
      padding: 1rem 1.25rem;
      margin-bottom: 1.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      flex-wrap: wrap;
    }
    .dinia-sync-left {
      display: flex;
      align-items: center;
      gap: 0.85rem;
    }
    .dinia-sync-icon-box {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      background: rgba(99, 102, 241, 0.18);
      border: 1px solid rgba(99, 102, 241, 0.35);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.25rem;
      color: #818cf8;
      flex-shrink: 0;
    }
    .dinia-sync-icon-box svg {
      width: 22px;
      height: 22px;
    }
    .dinia-sync-content {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .dinia-sync-title {
      font-size: 0.95rem;
      font-weight: 700;
      color: #f8fafc;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .dinia-sync-status-badge {
      font-size: 0.68rem;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 999px;
      background: rgba(16, 185, 129, 0.15);
      color: #34d399;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }
    .dinia-sync-desc {
      font-size: 0.8rem;
      color: #94a3b8;
      line-height: 1.4;
    }
    .dinia-sync-cta {
      background: rgba(99, 102, 241, 0.15);
      border: 1px solid rgba(99, 102, 241, 0.4);
      color: #c7d2fe;
      padding: 0.55rem 0.95rem;
      border-radius: 8px;
      font-weight: 600;
      font-size: 0.82rem;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      text-decoration: none;
      transition: all 0.2s;
    }
    .dinia-sync-cta:hover {
      background: rgba(99, 102, 241, 0.28);
      color: #ffffff;
    }
    .dinia-sync-cta svg {
      width: 14px;
      height: 14px;
    }
    .users-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 1.25rem;
      margin-bottom: 1.75rem;
    }

    .filter-tabs-pills {
      display: flex;
      align-items: center;
      gap: 0.65rem;
      flex-wrap: wrap;
    }

    .user-filter-pill {
      background: rgba(15, 23, 42, 0.7);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 12px;
      padding: 0.55rem 1.1rem;
      color: #94a3b8;
      font-size: 0.85rem;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.6rem;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      user-select: none;
    }

    .user-filter-pill:hover {
      transform: translateY(-2px);
      color: #fff;
    }

    .user-filter-pill .pill-counter {
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-family: var(--font-mono);
      font-weight: 700;
      background: rgba(255, 255, 255, 0.08);
      color: inherit;
      transition: all 0.2s;
    }

    /* 1. TOUS (Indigo / Violet Cosmos) */
    .user-filter-pill.pill-all:hover {
      border-color: rgba(99, 102, 241, 0.4);
      background: rgba(99, 102, 241, 0.12);
      color: #c7d2fe;
    }
    .user-filter-pill.pill-all.active {
      background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(79, 70, 229, 0.18));
      border-color: #818cf8;
      color: #e0e7ff;
      box-shadow: 0 0 20px rgba(99, 102, 241, 0.35), inset 0 0 10px rgba(99, 102, 241, 0.15);
    }
    .user-filter-pill.pill-all.active .pill-counter {
      background: rgba(99, 102, 241, 0.45);
      color: #fff;
      border: 1px solid rgba(129, 140, 248, 0.6);
    }

    /* 2. SUPERADMINS (Gold / Ambre Royal) */
    .user-filter-pill.pill-superadmin:hover {
      border-color: rgba(245, 158, 11, 0.4);
      background: rgba(245, 158, 11, 0.12);
      color: #fde68a;
    }
    .user-filter-pill.pill-superadmin.active {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.18));
      border-color: #fbbf24;
      color: #fef3c7;
      box-shadow: 0 0 20px rgba(245, 158, 11, 0.35), inset 0 0 10px rgba(245, 158, 11, 0.15);
    }
    .user-filter-pill.pill-superadmin.active .pill-counter {
      background: rgba(245, 158, 11, 0.45);
      color: #fff;
      border: 1px solid rgba(251, 191, 36, 0.6);
    }

    /* 3. USER-ADMINS (Bleu Royal / Sky Tech) */
    .user-filter-pill.pill-admin:hover {
      border-color: rgba(56, 189, 248, 0.4);
      background: rgba(56, 189, 248, 0.12);
      color: #bae6fd;
    }
    .user-filter-pill.pill-admin.active {
      background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(2, 132, 199, 0.18));
      border-color: #38bdf8;
      color: #e0f2fe;
      box-shadow: 0 0 20px rgba(56, 189, 248, 0.35), inset 0 0 10px rgba(56, 189, 248, 0.15);
    }
    .user-filter-pill.pill-admin.active .pill-counter {
      background: rgba(56, 189, 248, 0.45);
      color: #fff;
      border: 1px solid rgba(56, 189, 248, 0.6);
    }

    /* 3b. COLLABORATEURS / USERS (Violet / Indigo Élégant) */
    .user-filter-pill.pill-user:hover {
      border-color: rgba(168, 85, 247, 0.4);
      background: rgba(168, 85, 247, 0.12);
      color: #e9d5ff;
    }
    .user-filter-pill.pill-user.active {
      background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(126, 34, 206, 0.18));
      border-color: #c084fc;
      color: #f3e8ff;
      box-shadow: 0 0 20px rgba(168, 85, 247, 0.35), inset 0 0 10px rgba(168, 85, 247, 0.15);
    }
    .user-filter-pill.pill-user.active .pill-counter {
      background: rgba(168, 85, 247, 0.45);
      color: #fff;
      border: 1px solid rgba(192, 132, 252, 0.6);
    }

    /* 4. VIEWERS (Émeraude / Mint Sérénité) */
    .user-filter-pill.pill-viewer:hover {
      border-color: rgba(16, 185, 129, 0.4);
      background: rgba(16, 185, 129, 0.12);
      color: #a7f3d0;
    }
    .user-filter-pill.pill-viewer.active {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.18));
      border-color: #34d399;
      color: #d1fae5;
      box-shadow: 0 0 20px rgba(16, 185, 129, 0.35), inset 0 0 10px rgba(16, 185, 129, 0.15);
    }
    .user-filter-pill.pill-viewer.active .pill-counter {
      background: rgba(16, 185, 129, 0.45);
      color: #fff;
      border: 1px solid rgba(52, 211, 153, 0.6);
    }

    .users-search-box {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      background: rgba(15, 23, 42, 0.7);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 0.45rem 1rem;
      width: 360px;
      max-width: 100%;
      transition: all 0.25s;
    }

    .users-search-box:focus-within {
      border-color: #818cf8;
      box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
      background: rgba(15, 23, 42, 0.95);
    }

    .users-search-box input {
      background: transparent;
      border: none;
      outline: none;
      color: #fff;
      font-size: 0.85rem;
      width: 100%;
      font-family: inherit;
    }

    .users-search-box input::placeholder {
      color: var(--text-dim);
    }
    .user-card {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 1rem;
      margin-bottom: 1.5rem;
    }

    .user-card {
      background: var(--bg-card);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      position: relative;
      overflow: hidden;
    }

    .user-card:hover {
      transform: translateY(-3px);
      border-color: rgba(99, 102, 241, 0.35);
      box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.15);
    }

    .user-card-header {
      display: flex;
      align-items: flex-start;
      gap: 1rem;
      margin-bottom: 1.25rem;
    }

    .user-avatar-large {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      font-size: 1.1rem;
      color: #fff;
      flex-shrink: 0;
    }

    .user-avatar-large.superadmin {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.35));
      border: 2px solid #f59e0b;
      box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
    }

    .user-avatar-large.admin {
      background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(79, 70, 229, 0.35));
      border: 2px solid #818cf8;
      box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
    }

    .user-avatar-large.viewer {
      background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(14, 165, 233, 0.35));
      border: 2px solid #38bdf8;
      box-shadow: 0 0 15px rgba(6, 182, 212, 0.25);
    }

    .user-avatar-large.user {
      background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(100, 116, 139, 0.3));
      border: 2px solid #94a3b8;
    }

    .user-main-info {
      flex: 1;
      min-width: 0;
    }

    .user-card-name {
      font-size: 1.05rem;
      font-weight: 700;
      color: #fff;
      margin-bottom: 0.25rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .user-card-email {
      font-family: var(--font-mono);
      font-size: 0.78rem;
      color: var(--text-muted);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .user-badges-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 1.25rem;
    }

    .badge-role-tag {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 700;
      transition: all 0.2s;
    }
    .badge-role-tag:hover {
      filter: brightness(1.25);
      transform: translateY(-1px);
    }

    .badge-role-tag.superadmin {
      background: rgba(245, 158, 11, 0.15);
      color: #fbbf24;
      border: 1px solid rgba(245, 158, 11, 0.35);
    }

    .badge-role-tag.admin {
      background: rgba(99, 102, 241, 0.15);
      color: #a5b4fc;
      border: 1px solid rgba(99, 102, 241, 0.35);
    }

    .badge-role-tag.viewer {
      background: rgba(6, 182, 212, 0.15);
      color: #7dd3fc;
      border: 1px solid rgba(6, 182, 212, 0.35);
    }

    .badge-role-tag.badge-iam-tag {
      background: rgba(99, 102, 241, 0.12);
      color: #a5b4fc;
      border: 1px solid rgba(99, 102, 241, 0.3);
    }

    .badge-role-tag.badge-custom-perms {
      background: rgba(234, 179, 8, 0.15);
      color: #facc15;
      border: 1px solid rgba(234, 179, 8, 0.4);
    }

    .btn-card-action.btn-action-perms {
      color: #a5b4fc;
      border-color: rgba(99, 102, 241, 0.4);
      background: rgba(99, 102, 241, 0.12);
    }
    .btn-card-action.btn-action-perms:hover {
      background: rgba(99, 102, 241, 0.25);
      color: #ffffff;
      border-color: rgba(99, 102, 241, 0.6);
    }

    .badge-dept-tag {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      background: rgba(168, 85, 247, 0.15);
      color: #d8b4fe;
      border: 1px solid rgba(168, 85, 247, 0.35);
    }
    .badge-dept-selectable {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 5px 10px;
      border-radius: 7px;
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
      background: rgba(255, 255, 255, 0.04);
      color: #94a3b8;
      border: 1px solid rgba(255, 255, 255, 0.12);
      transition: all 0.2s ease;
      user-select: none;
    }
    .badge-dept-selectable:hover {
      background: rgba(255, 255, 255, 0.08);
      border-color: rgba(255, 255, 255, 0.25);
      color: #f1f5f9;
    }
    .badge-dept-selectable.active {
      background: rgba(99, 102, 241, 0.25);
      color: #c7d2fe;
      border-color: rgba(99, 102, 241, 0.6);
      box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
    }

    .badge-company-tag {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      background: rgba(255, 255, 255, 0.05);
      color: #cbd5e1;
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .badge-2fa-tag {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
    }

    .badge-2fa-tag.active {
      background: rgba(16, 185, 129, 0.15);
      color: #34d399;
      border: 1px solid rgba(16, 185, 129, 0.3);
    }

    .badge-2fa-tag.inactive {
      background: rgba(255, 255, 255, 0.03);
      color: var(--text-dim);
      border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .user-card-actions {
      display: flex;
      justify-content: flex-end;
      gap: 0.5rem;
      border-top: 1px solid rgba(255, 255, 255, 0.06);
      padding-top: 1rem;
    }

  
    /* Split-screen User Modal (Profil à gauche, Permissions à droite) */
    .modal-dialog.modal-user-split {
      max-width: 1120px !important;
      width: 95vw !important;
      max-height: 92vh !important;
      display: flex;
      flex-direction: column;
      transition: max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .user-modal-grid {
      display: grid;
      grid-template-columns: 370px 1fr;
      gap: 1.5rem;
      align-items: start;
      overflow-y: auto;
      max-height: calc(88vh - 135px);
      padding-right: 0.35rem;
    }

    @media (max-width: 960px) {
      .user-modal-grid {
        grid-template-columns: 1fr;
      }
    }

    .user-perms-panel {
      background: rgba(15, 23, 42, 0.7);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      padding: 1.15rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    .user-perms-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--border-color);
      padding-bottom: 0.65rem;
    }

    .user-perm-group-title {
      font-size: 0.82rem;
      font-weight: 700;
      color: #94a3b8;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 0.45rem;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .user-perm-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.5rem 0.75rem;
      background: rgba(0, 0, 0, 0.25);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--radius-md);
      margin-bottom: 0.4rem;
      transition: all 0.2s;
    }

    .user-perm-row:hover {
      background: rgba(255, 255, 255, 0.03);
      border-color: rgba(99, 102, 241, 0.3);
    }

    .user-perm-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding-right: 0.75rem;
    }

    .user-perm-name {
      font-size: 0.82rem;
      font-weight: 600;
      color: #f1f5f9;
    }

    .user-perm-desc {
      font-size: 0.7rem;
      color: var(--text-muted);
      line-height: 1.3;
    }

    .user-perm-actions {
      display: flex;
      align-items: center;
      gap: 0.65rem;
      flex-shrink: 0;
    }

    .badge-perm-status {
      font-size: 0.62rem;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .badge-perm-status.inherited {
      background: rgba(148, 163, 184, 0.12);
      color: #94a3b8;
      border: 1px solid rgba(148, 163, 184, 0.2);
    }

    .badge-perm-status.overridden {
      background: rgba(234, 179, 8, 0.2);
      color: #facc15;
      border: 1px solid rgba(234, 179, 8, 0.4);
    }
