/* =============================================
   ADMINISTRATION — SPLIT LAYOUT
   ============================================= */

.admin-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--sp-2) var(--sp-4);
  align-items: start;
}

.admin-panel {
  /* background: var(--clr-surface); */
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

/* ── Mode fill : les colonnes scrollent, pas la page ── */
.content--fill {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--sp-5);
}

.split-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.content--fill .admin-split {
  flex: 1;
  min-height: 0;
  grid-template-rows: 1fr;
  align-items: stretch;
}

.content--fill .admin-split__list {
  position: static;
  margin-top: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: none;
}
.content--fill .admin-split__list::-webkit-scrollbar { display: none; }

.content--fill .admin-split__detail {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.content--fill .admin-split__detail::-webkit-scrollbar { display: none; }

/* ── admin-split avec bouton toggle au-dessus de la liste ── */
.admin-split--with-toggle .admin-split__toggle {
  grid-column: 1;
  grid-row: 1;
}
.admin-split--with-toggle .admin-split__list {
  grid-column: 1;
  grid-row: 2;
}
.admin-split--with-toggle .admin-split__detail {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.content--fill .admin-split--with-toggle {
  grid-template-rows: auto 1fr;
}

/* ── Toolbar recherche + action ── */
.search-count {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--clr-text-muted);
  background: var(--clr-surface-2);
  border-radius: var(--radius-sm);
  padding: 2px var(--sp-2);
  flex-shrink: 0;
}

.admin-search {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--clr-border);
  position: sticky;
  top: 0;
  background: var(--clr-surface);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.search-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 0;
  color: var(--clr-text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--clr-text);
  font-size: 16px;
  font-family: inherit;
  padding: var(--sp-1) 0 var(--sp-1) calc(15px + var(--sp-3));
}
@media (min-width: 1024px) {
  .search-input { font-size: var(--text-sm); }
}
.search-input::placeholder { color: var(--clr-text-muted); }

/* ── Sections par rôle ── */
.role-section { border-bottom: 1px solid var(--clr-border); }
.role-section:last-child { border-bottom: none; }

.role-section__header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  background: var(--clr-surface-2);
  width: 100%;
  border: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: background .15s;
}
.role-section__header:hover { background: var(--clr-border); }

.role-section__count {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  font-weight: 600;
  margin-left: auto;
}

.cat-list-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.cat-list-thumb {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  object-fit: cover;
  display: block;
}

.role-chevron {
  flex-shrink: 0;
  color: var(--clr-text-muted);
  transition: transform .2s;
}
.role-chevron.open { transform: rotate(180deg); }

/* ── Item membre ── */
.member-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  text-decoration: none;
  color: var(--clr-text);
  background-color: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  transition: background .15s;
}
.member-item:last-child { border-bottom: none; }
.member-item:hover { background: var(--clr-surface-2); }

.member-item__info { min-width: 0; }
.member-item__name  { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-item__email { font-size: var(--text-xs); color: var(--clr-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Avatar ── */
.member-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--clr-accent-soft);
  color: var(--clr-accent-text);
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.member-avatar--lg {
  width: 56px; height: 56px;
  font-size: var(--text-lg);
}

/* ── Badges de rôle ── */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.role-badge--super_admin { background: var(--clr-role-super_admin-bg); color: var(--clr-role-super_admin-text); }
.role-badge--admin       { background: var(--clr-role-admin-bg);       color: var(--clr-role-admin-text); }
.role-badge--moderator          { background: var(--clr-role-moderator-bg);          color: var(--clr-role-moderator-text); }
.role-badge--moderateur_barman  { background: var(--clr-role-moderateur_barman-bg);  color: var(--clr-role-moderateur_barman-text); }
.role-badge--barman             { background: var(--clr-role-barman-bg);             color: var(--clr-role-barman-text); }
.role-badge--client      { background: var(--clr-role-client-bg);      color: var(--clr-role-client-text); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}

.modal {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--clr-border);
  position: sticky;
  top: 0;
  background: var(--clr-surface);
  z-index: 1;
}

.modal-title {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0;
}

.modal-body {
  padding: var(--sp-5);
}

/* ── Empty state (panneau droit vide) ── */
.content--fill #membre-detail {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12);
  color: var(--clr-text-muted);
  text-align: center;
}

/* ── Détail membre ── */
.membre-detail { padding: var(--sp-6); }

.credit-form {
  border-top: 1px solid var(--clr-border);
  padding-top: var(--sp-3);
}

/* ── Fiche membre : une carte par usage (solde, compte, suppression, historique) ── */
.fiche { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 680px; }
.fiche-head { display: flex; align-items: center; gap: var(--sp-4); }
.fiche-head__info { flex: 1; min-width: 0; }
.fiche-head__name { font-size: var(--text-xl); font-weight: 700; line-height: 1.25; letter-spacing: -.015em; margin: 0 0 2px; }
.fiche-head__meta { font-size: var(--text-sm); line-height: 1.45; color: var(--clr-text-muted); overflow-wrap: anywhere; }
.fiche-head__close { align-self: flex-start; flex-shrink: 0; }

.detail-card { background: var(--clr-surface); border: 1px solid var(--clr-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }

/* Cibles tactiles : 44 px, 40 px pour les petits boutons */
.fiche .btn { min-height: 44px; }
.fiche .btn-sm { min-height: 40px; }

.fiche-balance { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); }
.fiche-balance__row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.fiche-balance__label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--clr-text-muted); }
.fiche-balance__amount { font-size: 1.75rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }

.fiche-group-label {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  margin: var(--sp-2) var(--sp-1) calc(-1 * var(--sp-2));
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--clr-text-muted);
}

.fiche-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 68px; padding: var(--sp-3) var(--sp-4); }
.fiche-row + .fiche-row { border-top: 1px solid var(--clr-border); }
.fiche-row--wrap { flex-wrap: wrap; }
.fiche-row__text { flex: 1 1 220px; min-width: 0; }
.fiche-row__title { display: flex; align-items: center; gap: var(--sp-2); font-size: .9375rem; font-weight: 600; line-height: 1.3; }
.fiche-row__sub { margin-top: 2px; font-size: .8125rem; line-height: 1.45; color: var(--clr-text-muted); }
.fiche-row__sub .badge { margin-right: var(--sp-1); }

.fiche-role-form { display: flex; align-items: center; gap: var(--sp-2); }
.fiche-role-form .form-input { width: auto; min-width: 150px; min-height: 44px; padding-block: 0; }

.fiche-danger { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); }
.fiche-danger__open { width: 100%; }

/* Fiche qui porte un formulaire (produit) : une carte de champs par usage, envoi pleine largeur */
.fiche-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.fiche-fields { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4); }
.fiche-fields__pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-4); align-items: start; }
.fiche-fields input.form-input:not([type="file"]),
.fiche-fields select.form-input { height: 48px; padding-block: 0; }
.fiche-fields .emoji-current { width: 48px; font-size: 1.35rem; }
.fiche-submit { width: 100%; }
.fiche-readonly {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2);
  margin: 0; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md); background: var(--clr-surface-2);
  font-size: var(--text-sm); color: var(--clr-text-muted);
}

/* Réglage qui se déplie sous sa ligne (Mon compte : profil, mot de passe) */
.fiche-item + .fiche-item { border-top: 1px solid var(--clr-border); }
.fiche-item__panel { padding: 0 var(--sp-4) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.fiche-item__panel form { display: flex; flex-direction: column; gap: var(--sp-3); }

.fiche-history { padding: 0 var(--sp-4); }
.fiche-history > .text-muted { padding: var(--sp-4) 0; }
.fiche-history .tx-pagination { padding-bottom: var(--sp-3); }



/* ── Formulaire nouveau membre ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.form-row--3 { grid-template-columns: 2fr 1fr 80px; }
.form-error { font-size: var(--text-xs); color: var(--clr-danger); margin-top: var(--sp-1); }
.form-input--error { border-color: var(--clr-danger); }

