:root {
  --tc-bg: #080a0f;
  --tc-panel: #12151d;
  --tc-panel-2: #181b24;
  --tc-line: rgba(255,255,255,.09);
  --tc-text: #f7f8fc;
  --tc-muted: #969cab;
  --tc-purple: #8b46f6;
  --tc-purple-2: #aa62ff;
  --tc-pink: #df447b;
  --tc-green: #57be5f;
  --tc-orange: #ff951f;
  --tc-blue: #429dff;
  --tc-danger: #ff5e70;
  --tc-sidebar: 245px;
}

* { box-sizing: border-box; }
body { background: var(--tc-bg); color: var(--tc-text); }

/* ===== PAGE ===== */
.corpsAdminMembre {
  min-height: 100vh;
  margin: 0; padding: 0;
  background:
    radial-gradient(circle at 26% 0%, rgba(139,70,246,.09), transparent 30%),
    radial-gradient(circle at 96% 12%, rgba(223,68,123,.06), transparent 26%),
    var(--tc-bg);
  color: var(--tc-text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
.corpsAdminMembre > .row { margin: 0; min-height: 100vh; }
.adminMembreDroit {
  width: calc(100% - var(--tc-sidebar));
  max-width: none;
  margin-left: var(--tc-sidebar);
  padding: 0; min-height: 100vh;
  background: transparent;
}
.admin-container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 24px 30px 70px; }

/* ===== SIDEBAR ===== */
.sidebarAdmin { position: fixed; inset: 0 auto 0 0; z-index: 1100; width: var(--tc-sidebar); height: 100vh; background: linear-gradient(180deg,#0e1118,#090b10); border-right: 1px solid rgba(0,0,0,.55); box-shadow: 14px 0 40px rgba(0,0,0,.35); }
.sidebarAdmin-inner { height: 100%; display: flex; flex-direction: column; padding: 18px 14px; }
.sidebarAdmin-brand { display: flex; align-items: center; gap: 11px; min-height: 48px; padding: 0 4px 18px; color: #fff; text-decoration: none; border-bottom: 1px solid var(--tc-line); }
.sidebarAdmin-logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, var(--tc-pink), #a75dff); font-weight: 800; font-size: 13px; }
.sidebarAdmin-brandText { font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.sidebarAdmin-brandText span { color: var(--tc-pink); }
.sidebarAdmin-profile { display: flex; align-items: center; gap: 11px; margin: 18px 2px 8px; padding: 12px; border: 1px solid var(--tc-line); border-radius: 14px; background: rgba(255,255,255,.025); }
.sidebarAdmin-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: rgba(139,70,246,.18); color: #c89cff; font-weight: 800; }
.sidebarAdmin-profile strong, .sidebarAdmin-profile span { display: block; }
.sidebarAdmin-profile strong { font-size: 13px; }
.sidebarAdmin-profile span { margin-top: 3px; color: var(--tc-muted); font-size: 11px; }
.sidebarAdmin-scroll { flex: 1; overflow-y: auto; padding: 4px 0 10px; scrollbar-width: thin; scrollbar-color: #343846 transparent; }
.sidebarAdmin-group { margin-top: 21px; }
.sidebarAdmin-group h2 { margin: 0 10px 8px; color: #747b8a; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebarAdmin-menu { list-style: none; margin: 0; padding: 0; }
.sidebarAdmin-menu li { margin: 3px 0; }
.sidebarAdmin-link { position: relative; display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 9px 11px; border: 1px solid transparent; border-radius: 10px; color: #aeb4c1; text-decoration: none; font-size: 13px; transition: .2s ease; }
.sidebarAdmin-link:hover { color: #fff; background: rgba(255,255,255,.045); border-color: rgba(255,255,255,.05); transform: translateX(2px); }
.sidebarAdmin-link.active { color: #fff; background: linear-gradient(90deg, rgba(139,70,246,.28), rgba(139,70,246,.10)); border-color: rgba(166,103,255,.22); box-shadow: inset 3px 0 0 var(--tc-purple-2); }
.sidebarAdmin-icon { display: grid; place-items: center; width: 21px; color: #b7bdca; font-size: 16px; }
.sidebarAdmin-link.active .sidebarAdmin-icon { color: #bd8dff; }
.sidebarAdmin-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 99px; background: var(--tc-danger); color: #fff; font-size: 11px; font-weight: 800; }
.sidebarAdmin-help { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 14px; border: 1px solid rgba(145,76,255,.32); border-radius: 14px; background: linear-gradient(145deg, rgba(139,70,246,.18), rgba(139,70,246,.06)); }
.sidebarAdmin-helpTop { display: flex; gap: 10px; align-items: flex-start; }
.sidebarAdmin-helpIcon { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(139,70,246,.28); color: #fff; font-weight: 800; }
.sidebarAdmin-help strong { font-size: 12px; }
.sidebarAdmin-help p { margin: 4px 0 0; color: #9b9fb0; font-size: 10px; line-height: 1.45; }
.sidebarAdmin-helpBtn { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; background: rgba(255,255,255,.05); color: #e7e3ff; font-size: 11px; font-weight: 700; text-decoration: none; }
.sidebarAdmin-helpBtn:hover { background: rgba(139,70,246,.2); color: #fff; }

/* ===== TOPBAR ===== */
.mb-topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding: 6px 2px; }
.mb-search { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 1px solid var(--tc-line); border-radius: 11px; background: rgba(18,21,29,.92); color: #7f8695; }
.mb-search:focus-within { border-color: rgba(161,93,255,.62); box-shadow: 0 0 0 4px rgba(139,70,246,.08); }
.mb-search input { width: 100%; border: 0; outline: 0; background: transparent; color: #fff; font-size: 13px; }
.mb-search input::placeholder { color: #737987; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-icon-btn { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--tc-line); border-radius: 12px; background: rgba(18,21,29,.85); color: #c9cdd6; font-size: 18px; cursor: pointer; }
.topbar-icon-btn:hover { color: #fff; border-color: rgba(139,70,246,.4); }
.topbar-icon-btn .dot { position: absolute; top: 11px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--tc-danger); box-shadow: 0 0 0 3px rgba(255,94,112,.18); }
.topbar-clock { min-width: 86px; text-align: center; font-variant-numeric: tabular-nums; color: #dfe2ea; font-size: 14px; font-weight: 700; letter-spacing: .6px; }
.topbar-member { display: flex; align-items: center; gap: 10px; padding: 5px 13px 5px 5px; border: 1px solid var(--tc-line); border-radius: 12px; background: rgba(18,21,29,.85); }
.topbar-member .avatar { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--tc-purple), var(--tc-pink)); color: #fff; font-weight: 800; font-size: 13px; }
.topbar-member strong { display: block; font-size: 12px; color: #fff; }
.topbar-member small { display: block; font-size: 11px; color: var(--tc-muted); }

/* ===== HEADER ===== */
.mb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.mb-eyebrow { color: var(--tc-purple-2); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.mb-title { margin: 5px 0 3px; color: #fff; font-size: clamp(26px, 2.6vw, 34px); line-height: 1.05; letter-spacing: -1px; }
.mb-subtitle { margin: 0; color: var(--tc-muted); font-size: 14px; }
.mb-add-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid rgba(177,111,255,.4); border-radius: 11px; background: linear-gradient(135deg, #7130dc, #9a49f5); color: #fff; box-shadow: 0 12px 30px rgba(124,49,226,.28); font-weight: 750; font-size: 14px; cursor: pointer; transition: .2s ease; white-space: nowrap; }
.mb-add-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }

/* ===== STATS ===== */
.mb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 14px; margin-bottom: 18px; }
.mb-stat { min-height: 92px; display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--tc-line); border-radius: 14px; background: linear-gradient(145deg, rgba(24,27,36,.95), rgba(14,17,24,.95)); box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.mb-stat-icon { flex: 0 0 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; font-size: 20px; }
.mb-stat.is-total .mb-stat-icon { background: rgba(139,70,246,.16); color: #b980ff; }
.mb-stat.is-admin .mb-stat-icon { background: rgba(226,65,121,.14); color: #f15a8e; }
.mb-stat.is-mod .mb-stat-icon { background: rgba(66,157,255,.14); color: #5fb0ff; }
.mb-stat.is-member .mb-stat-icon { background: rgba(87,190,95,.14); color: #71cf69; }
.mb-stat.is-invite .mb-stat-icon { background: rgba(255,149,31,.14); color: #ff9e2b; }
.mb-stat strong { display: block; font-size: 25px; line-height: 1; }
.mb-stat span { display: block; margin-top: 7px; color: var(--tc-muted); font-size: 11px; }

/* ===== TOOLBAR ===== */
.mb-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.mb-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.mb-chip { min-height: 38px; padding: 0 15px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--tc-line); border-radius: 10px; background: #14171f; color: #c2c7d1; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .15s; }
.mb-chip:hover { color: #fff; border-color: rgba(139,70,246,.35); }
.mb-chip.active { color: #fff; background: linear-gradient(90deg, rgba(139,70,246,.3), rgba(139,70,246,.12)); border-color: rgba(166,103,255,.4); }
.mb-chip .n { color: var(--tc-muted); font-weight: 800; }
.mb-chip.active .n { color: #e7dcff; }
.mb-count { color: var(--tc-muted); font-size: 12px; white-space: nowrap; }
.mb-count strong { color: #fff; }

/* ===== TABLE ===== */
.mb-table-wrap { border: 1px solid var(--tc-line); border-radius: 16px; overflow: hidden; background: linear-gradient(180deg,#161922,#10131a); box-shadow: 0 14px 36px rgba(0,0,0,.22); }
.mb-thead, .mb-row { display: grid; grid-template-columns: 2.4fr 1.1fr 1fr 1fr 1.3fr; align-items: center; gap: 14px; padding: 14px 20px; }
.mb-thead { background: rgba(255,255,255,.02); border-bottom: 1px solid var(--tc-line); color: #8f95a4; font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.mb-th-actions { text-align: right; }
.mb-row { border-bottom: 1px solid rgba(255,255,255,.05); transition: background .15s; }
.mb-row:last-child { border-bottom: 0; }
.mb-row:hover { background: rgba(139,70,246,.05); }
.mb-row[hidden] { display: none !important; }
.mb-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mb-uavatar { flex: 0 0 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.mb-uinfo { min-width: 0; }
.mb-uinfo strong { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-uinfo span { display: block; color: var(--tc-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-you { flex: 0 0 auto; padding: 2px 8px; border-radius: 6px; background: rgba(139,70,246,.18); color: #c6a6ff; font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.mb-date { color: #c8ccd5; font-size: 13px; }
.mb-date small { display: block; color: var(--tc-muted); font-size: 11px; margin-top: 2px; }
.mb-presence .mb-online { display: inline-flex; align-items: center; gap: 7px; color: #71cf69; font-size: 12px; font-weight: 600; }
.mb-presence .mb-online .dot { width: 8px; height: 8px; border-radius: 50%; background: #57be5f; box-shadow: 0 0 0 3px rgba(87,190,95,.16); }
.mb-presence .mb-offline { color: var(--tc-muted); font-size: 12px; }

/* Badges rôle */
.role-badge { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 12px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.role-badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.role-admin { background: rgba(226,65,121,.12); border-color: rgba(226,65,121,.4); color: #ff7aa7; }
.role-admin .dot { background: #ff7aa7; }
.role-mod { background: rgba(66,157,255,.12); border-color: rgba(66,157,255,.4); color: #6fb6ff; }
.role-mod .dot { background: #6fb6ff; }
.role-member { background: rgba(255,255,255,.05); border-color: var(--tc-line); color: #c2c7d1; }
.role-member .dot { background: #8f95a4; }

.mb-actions { display: flex; justify-content: flex-end; gap: 8px; }
.mb-btn { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--tc-line); border-radius: 10px; background: #11141b; color: #c9cdd6; font-size: 12px; font-weight: 700; cursor: pointer; transition: .15s; }
.mb-btn:hover { color: #fff; border-color: rgba(156,91,255,.45); background: rgba(139,70,246,.12); }
.mb-btn.is-locked { cursor: default; color: #8f95a4; background: rgba(255,255,255,.02); }
.mb-btn.is-locked:hover { color: #8f95a4; border-color: var(--tc-line); background: rgba(255,255,255,.02); }

.mb-empty, .mb-no-result { padding: 60px 20px; color: #9298a6; text-align: center; }
.mb-no-result { border: 1px dashed rgba(255,255,255,.12); border-radius: 14px; margin-top: 14px; }
.mb-no-result span { display: block; font-size: 32px; color: #a96cff; }
.mb-no-result h3 { margin: 10px 0 4px; color: #fff; }
.mb-no-result p { margin: 0; }

/* ===== MODALES (centrées) ===== */
.mb-modal { display: none; position: fixed; inset: 0; z-index: 99999; padding: 22px; overflow: auto; background: rgba(3,5,9,.78); backdrop-filter: blur(8px); }
.mb-modal.open { display: block; }
.mb-modal-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(93vw, 480px); max-height: calc(100vh - 44px); overflow-y: auto; padding: 26px; border: 1px solid rgba(169,91,255,.6); border-radius: 16px; background: linear-gradient(145deg, rgba(28,31,42,.98), rgba(15,18,26,.99)); box-shadow: 0 30px 90px rgba(0,0,0,.62), 0 0 0 1px rgba(139,70,246,.08); animation: mbIn .22s ease-out; }
@keyframes mbIn { from { opacity: 0; transform: translate(-50%,-47%) scale(.98); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }
.mb-modal-close { position: absolute; top: 15px; right: 16px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: #9da3b2; font-size: 22px; cursor: pointer; border: 0; background: transparent; }
.mb-modal-close:hover { color: #fff; background: rgba(255,255,255,.06); }
.mb-modal-icon { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 13px; background: rgba(139,70,246,.16); color: #b980ff; font-size: 22px; }
.mb-modal-user { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--tc-line); }
.mb-modal-user .mb-uavatar { flex: 0 0 46px; height: 46px; }
.mb-modal-user strong { display: block; color: #fff; font-size: 16px; }
.mb-modal-user span { display: block; color: var(--tc-muted); font-size: 12px; margin-top: 2px; }
.mb-modal h3 { margin: 0 0 4px; color: #fff; font-size: 17px; }
.mb-modal-desc { margin: 0 0 18px; color: var(--tc-muted); font-size: 12.5px; line-height: 1.55; }
.mb-modal-desc code { padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.06); color: #c6a6ff; font-size: 11.5px; }

/* Champ email d'invitation */
.mb-modal label { display: block; margin: 0 0 8px; color: #d8dbe3; font-size: 12px; font-weight: 700; }
.mb-input { width: 100%; min-height: 46px; margin: 0 0 4px; padding: 0 14px; border: 1px solid rgba(255,255,255,.11); border-radius: 10px; background: #131720; color: #fff; outline: 0; font-size: 14px; }
.mb-input::placeholder { color: #6e747f; }
.mb-input:focus { border-color: rgba(161,93,255,.72); box-shadow: 0 0 0 4px rgba(139,70,246,.09); }

/* Options de rôle */
.role-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.role-option { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--tc-line); border-radius: 12px; background: #131720; cursor: pointer; transition: .15s; }
.role-option:hover { border-color: rgba(139,70,246,.4); background: rgba(139,70,246,.06); }
.role-option.selected { border-color: rgba(166,103,255,.7); background: rgba(139,70,246,.12); box-shadow: 0 0 0 3px rgba(139,70,246,.1); }
.role-option .ro-icon { flex: 0 0 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; font-size: 18px; }
.role-option[data-role="3"] .ro-icon { background: rgba(226,65,121,.14); color: #ff7aa7; }
.role-option[data-role="2"] .ro-icon { background: rgba(66,157,255,.14); color: #6fb6ff; }
.role-option[data-role="1"] .ro-icon { background: rgba(87,190,95,.14); color: #71cf69; }
.role-option .ro-text { flex: 1; min-width: 0; }
.role-option .ro-text strong { display: block; color: #fff; font-size: 14px; }
.role-option .ro-text span { display: block; color: var(--tc-muted); font-size: 11.5px; margin-top: 2px; }
.role-option .ro-value { flex: 0 0 auto; font-size: 10px; font-weight: 800; color: #8f95a4; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.05); border: 1px solid var(--tc-line); }
.role-option .ro-check { flex: 0 0 22px; height: 22px; border-radius: 50%; border: 2px solid var(--tc-line); display: grid; place-items: center; color: transparent; font-size: 12px; }
.role-option.selected .ro-check { border-color: var(--tc-purple-2); background: var(--tc-purple); color: #fff; }

.mb-modal-error { margin: 4px 0 14px; padding: 10px 12px; border-radius: 8px; background: rgba(255,94,112,.08); border: 1px solid rgba(255,94,112,.3); color: #ff8494; font-size: 12px; }
.mb-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.mb-cancel { min-height: 42px; padding: 0 18px; border: 1px solid var(--tc-line); border-radius: 10px; background: #141821; color: #c6cad4; font-weight: 700; cursor: pointer; }
.mb-cancel:hover { color: #fff; }
.mb-confirm { min-height: 42px; padding: 0 20px; border: 0; border-radius: 10px; background: linear-gradient(135deg,#7130dc,#9848f4); color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 10px 24px rgba(115,44,220,.22); }
.mb-confirm:hover { filter: brightness(1.09); }
.mb-confirm:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* ===== TOAST ===== */
.mb-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(30px); z-index: 100000; display: flex; align-items: center; gap: 10px; padding: 13px 20px; border: 1px solid rgba(87,190,95,.4); border-radius: 12px; background: linear-gradient(145deg, rgba(24,40,28,.98), rgba(14,22,17,.99)); color: #c9f0cb; font-size: 13px; font-weight: 600; box-shadow: 0 20px 50px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: .3s; }
.mb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mb-toast .ic { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(87,190,95,.2); color: #71cf69; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  :root { --tc-sidebar: 215px; }
  .admin-container { padding: 22px 20px 60px; }
  .mb-thead, .mb-row { grid-template-columns: 2.2fr 1.1fr 1fr 1.3fr; }
  .mb-thead .mb-th-presence, .mb-presence { display: none; }
}
@media (max-width: 900px) {
  :root { --tc-sidebar: 0px; }
  .sidebarAdmin { position: relative; width: 100%; height: auto; }
  .sidebarAdmin-inner { padding: 12px; }
  .sidebarAdmin-profile, .sidebarAdmin-help, .sidebarAdmin-group h2 { display: none; }
  .sidebarAdmin-scroll { overflow: visible; }
  .sidebarAdmin-group { margin: 8px 0 0; }
  .sidebarAdmin-menu { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; }
  .sidebarAdmin-menu li { flex: 0 0 auto; }
  .sidebarAdmin-link { min-height: 38px; padding: 7px 10px; white-space: nowrap; }
  .adminMembreDroit { width: 100%; margin-left: 0; }
  .mb-topbar .topbar-clock, .mb-topbar .topbar-member small { display: none; }

  /* Table -> cartes empilées */
  .mb-thead { display: none; }
  .mb-row { grid-template-columns: 1fr; gap: 12px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
  .mb-role-cell, .mb-date, .mb-presence { display: block; }
  .mb-actions { justify-content: flex-start; }
  .mb-actions .mb-btn { width: 100%; justify-content: center; }
}
@media (max-width: 560px) {
  .admin-container { padding: 18px 14px 45px; }
  .mb-head { flex-direction: column; align-items: stretch; }
  .mb-add-btn { justify-content: center; }
  .mb-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mb-toolbar { flex-direction: column; align-items: stretch; }
  .mb-count { display: none; }
  .mb-modal { padding: 12px; }
  .mb-modal-content { width: calc(100vw - 24px); max-height: calc(100vh - 24px); padding: 22px 18px; }
  .role-option .ro-value { display: none; }
}