/* --- LAYOUT & SECTIONS --- */
.page { padding: 22px 24px 80px; display: flex; flex-direction: column; gap: var(--section-gap); }
.section {
  background: linear-gradient(180deg, rgba(255,255,255,.01), rgba(255,255,255,0));
  border: 1px solid var(--border); border-radius: 14px; padding: 22px; box-shadow: var(--shadow);
}
.section-title { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--accent); }
.section-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* --- CONTROL BAR --- */
#control-bar {
  position: sticky; top: var(--nav-h); z-index: 105; min-height: var(--bar-h); display: grid; 
  grid-template-columns: 1fr auto; gap: 12px; padding: 12px 24px; background: rgba(10,11,12,.94); 
  border-bottom: 1px solid var(--border); backdrop-filter: blur(10px);
}
.ctl-group {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); min-height: 40px;
}
.ctl-label { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; }
input[type="search"], input[type="date"], select {
  appearance: none; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); 
  outline: none; min-height: 34px; padding: 7px 10px; border-radius: 6px; font-family: var(--mono); 
  font-size: 11px; color-scheme: dark; transition: 0.14s; 
}

input[type="search"] { width: 200px; }
input[type="date"] { width: 140px; }
select { width: 160px; }

input[type="search"]:focus, input[type="date"]:focus, select:focus { 
  border-color: var(--accent); 
  background: var(--surface-3); 
}
/* --- TABLEAUX --- */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
thead tr { background: var(--surface-2); border-bottom: 1px solid var(--border-2); }
th {
  padding: 12px 14px; text-align: left; font-family: var(--mono); font-size: 9px; 
  color: var(--muted); text-transform: uppercase; letter-spacing: .1em;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
.r { text-align: right; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* --- ACTIONS & MODALS --- */
.btn-icon {
  background: transparent; border: 1px solid transparent; color: var(--muted-2); cursor: pointer;
  width: 32px; height: 32px; border-radius: 6px; display: inline-flex; align-items: center; 
  justify-content: center; font-size: 18px; transition: 0.2s; margin-left: 4px;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-icon.danger:hover { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,.65); 
  backdrop-filter: blur(4px); align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px;
  width: min(480px, 92vw); box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.dm-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; 
  padding: 20px 22px 16px; border-bottom: 1px solid var(--border);
}
.dm-title { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text); }
.dm-subtitle { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.dm-close {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border-2); 
  background: transparent; color: var(--muted); cursor: pointer; display: flex; 
  align-items: center; justify-content: center; transition: 0.14s;
}
.dm-close:hover { border-color: var(--text); color: var(--text); }
.dm-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-input {
  width: 100%; appearance: none; border: 1px solid var(--border-2); background: var(--surface-2); 
  color: var(--text); padding: 10px; border-radius: 6px; font-family: var(--sans); font-size: 14px;
}
.dm-action-box { padding: 12px 14px; border-radius: 8px; border: 1px solid rgba(200,255,0,.2); background: rgba(200,255,0,.04); }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

.nav-user-mail {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    margin-right: 10px;
}

.btn-logout {
    min-height: 28px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Bouton de confirmation en mode suppression */
.btn-danger-action {
    background: var(--red) !important;
    color: white !important;
    border: none !important;
}

/* Bouton de confirmation en mode désactivation (Orange) */
.btn-warning-action {
    background: var(--orange) !important;
    color: white !important;
    border: none !important;
}

/* On s'assure que le texte dans la modal est propre */
#confirmMessage {
    color: var(--text);
    padding: 10px 0;
}

/* --- INPUTS DANS LES MODALS --- */
.dm-body input[type="email"],
.dm-body input[type="text"],
.dm-body input[type="password"],
.dm-body select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: 0.14s;
  color-scheme: dark;
}

.dm-body input[type="email"]:focus,
.dm-body input[type="text"]:focus,
.dm-body input[type="password"]:focus,
.dm-body select:focus {
  border-color: var(--accent);
  background: var(--surface-3);
}

.dm-body label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  display: block;
  margin-bottom: 6px;
}

.dm-body .form-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Lien d'invitation généré */
#invite-link-box input[type="text"] {
  font-size: 11px;
  color: var(--muted-2);
  cursor: default;
}

#invite-link-box {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(200,255,0,.2);
  background: rgba(200,255,0,.04);
}