/* ============================================================
   VANTEX BANK — Feuille de styles principale
   Aesthetic : Luxury Banking — Navy · Gold · Slate
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --navy-dark:    #070F1E;
  --navy:         #0C1A32;
  --navy-mid:     #112244;
  --navy-light:   #1A3360;
  --gold:         #C9A84C;
  --gold-light:   #E2C97E;
  --gold-dim:     #8A6E2F;
  --slate:        #8899AA;
  --slate-light:  #C4D0DC;
  --white:        #F5F8FC;
  --surface:      #0F1E38;
  --surface-2:    #162540;
  --surface-3:    #1D2F50;
  --border:       rgba(201, 168, 76, 0.15);
  --border-light: rgba(255,255,255,0.07);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.5);
  --shadow-gold: 0 4px 20px rgba(201,168,76,0.2);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--white);
  background-color: var(--navy-dark);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
}

a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-light); }

/* ── Layout principal ──────────────────────────────────────── */
.app-wrapper {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.chat-page {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

body.chat-page .app-wrapper {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: clamp(280px, 24vw, 340px);
  min-width: clamp(280px, 24vw, 340px);
  background: var(--navy);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy) 100%);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-gold);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--white);
}

.logo-text span { color: var(--gold); }

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-light), var(--gold-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-light);
  border: 2px solid var(--border);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-sm { width: 36px; height: 36px; font-size: 14px; }

.user-info { flex: 1; min-width: 0; }
.user-name  { font-weight: 600; font-size: 14px; color: var(--white); truncate: true; }
.user-role  { font-size: 11px; color: var(--slate); text-transform: uppercase; letter-spacing: 0.08em; }
.user-num   { font-size: 11px; color: var(--gold); font-family: 'Courier New', monospace; }

.btn-logout {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--slate);
  font-size: 16px;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { background: rgba(255,255,255,0.06); color: var(--white); }

/* ── Sidebar Body ─────────────────────────────────────────── */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--navy-light); border-radius: 2px; }

.section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

/* ── Conversation item ────────────────────────────────────── */
.conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  margin-bottom: 4px;
  position: relative;
}

.conv-item:hover { background: var(--surface); }

.conv-item.active {
  background: var(--surface-2);
  border-color: var(--border);
}

.conv-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 60%;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  border-radius: 0 2px 2px 0;
}

.avatar-wrapper { position: relative; flex-shrink: 0; }

.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--navy);
  animation: pulse-green 2s infinite;
}

.online-dot.offline { background: var(--slate); animation: none; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

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

.conv-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-preview {
  font-size: 12px;
  color: var(--slate);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.conv-time { font-size: 10px; color: var(--slate); }
.badge-unread {
  min-width: 18px;
  height: 18px;
  background: var(--gold);
  color: var(--navy-dark);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Zone de chat principale ───────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--navy-dark);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--navy);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.chat-contact-info { flex: 1; min-width: 0; }
.chat-contact-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
}
.chat-contact-status { font-size: 12px; color: #22C55E; }
.chat-contact-status.offline { color: var(--slate); }

.chat-actions { display: flex; gap: 8px; }
.btn-icon {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--slate);
  font-size: 16px;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--surface-2); color: var(--gold); border-color: var(--gold); }

/* ── Zone de messages ────────────────────────────────────────── */
.messages-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.messages-area::-webkit-scrollbar { width: 6px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb { background: var(--navy-mid); border-radius: 3px; }

.date-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.date-separator span {
  font-size: 11px;
  color: var(--slate);
  white-space: nowrap;
  padding: 4px 10px;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

/* ── Bulles de message ─────────────────────────────────────── */
.msg-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  width: 100%;
  -webkit-user-select: none;
  user-select: none;
  animation: msg-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-row.me { justify-content: flex-end; }

.msg-avatar-wrap { flex-shrink: 0; }

.msg-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(68%, 720px);
  min-width: 0;
}

.msg-row.me .msg-content { align-items: flex-end; }

.msg-bubble {
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  overflow-wrap: anywhere;
  word-break: normal;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.msg-row:not(.me) .msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
  color: var(--white);
}

.msg-row.me .msg-bubble {
  background: linear-gradient(135deg, var(--gold-dim) 0%, #7A5E28 100%);
  border-bottom-right-radius: 4px;
  color: #FFF8E8;
  border: 1px solid rgba(201,168,76,0.3);
}

.msg-meta {
  font-size: 10px;
  color: var(--slate);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-row.me .msg-meta { justify-content: flex-end; }

.msg-read-icon { font-size: 12px; }
.msg-read-icon.read { color: var(--gold); }

/* Fichier joint */
.msg-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition);
}
.msg-file:hover { background: rgba(0,0,0,0.35); }
.msg-file-icon { font-size: 20px; }
.msg-file-info { min-width: 0; }
.msg-file-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file-size { font-size: 10px; opacity: 0.7; }

/* Image en message */
.msg-img {
  max-width: 240px;
  max-height: 200px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  cursor: pointer;
  transition: var(--transition);
  object-fit: cover;
}
.msg-img:hover { opacity: 0.9; transform: scale(1.02); }

/* ── Zone de saisie ────────────────────────────────────────── */
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--navy);
  flex-shrink: 0;
}

.typing-indicator {
  font-size: 11px;
  color: var(--slate);
  height: 16px;
  margin-bottom: 8px;
  font-style: italic;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 8px 8px 8px 16px;
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: rgba(201,168,76,0.4);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08);
}

#messageInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  line-height: 1.5;
}

#messageInput::placeholder { color: var(--slate); }

.input-actions { display: flex; gap: 6px; align-items: flex-end; flex-shrink: 0; }

.btn-attach {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--slate);
  font-size: 16px;
  transition: var(--transition);
}
.btn-attach:hover { color: var(--gold); border-color: var(--gold); }

.btn-send {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--navy-dark);
  font-size: 16px;
  transition: var(--transition);
  box-shadow: var(--shadow-gold);
}
.btn-send:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(201,168,76,0.35); }
.btn-send:active { transform: translateY(0); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 12px;
  animation: msg-in 0.2s ease;
}
.file-preview-remove {
  cursor: pointer;
  color: var(--slate);
  margin-left: auto;
  font-size: 16px;
  transition: var(--transition);
}
.file-preview-remove:hover { color: #F87171; }

/* ── Écran de bienvenue ────────────────────────────────────── */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--slate);
  padding: 40px;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 8px;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--white);
  text-align: center;
}

.welcome-text { font-size: 14px; text-align: center; max-width: 300px; line-height: 1.6; }

/* ── Page de login ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: radial-gradient(ellipse at 20% 30%, rgba(26,51,96,0.7) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 70%, rgba(201,168,76,0.08) 0%, transparent 50%),
              var(--navy-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  animation: card-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.register-card { max-width: 520px; }

@keyframes card-up {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  justify-content: center;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-gold);
}

.login-logo-text {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--white);
}
.login-logo-text span { color: var(--gold); }

.login-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 6px;
  text-align: center;
}

.login-subtitle {
  font-size: 13px;
  color: var(--slate);
  text-align: center;
  margin-bottom: 32px;
}

.auth-kicker {
  font-size: 10px;
  color: var(--slate);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 1px;
}

.register-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--slate);
}

.auth-switch a {
  color: var(--gold-light);
  font-weight: 600;
}

.auth-switch a:hover { color: var(--gold); }

/* ── Formulaires ─────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-control::placeholder { color: var(--slate); }

.form-control:focus {
  border-color: rgba(201,168,76,0.5);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
  background: var(--surface-2);
}

.form-control.is-invalid { border-color: #F87171; }
.form-error { font-size: 11px; color: #F87171; margin-top: 4px; }

.btn-primary {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: var(--navy-dark);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-gold);
  letter-spacing: 0.03em;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(201,168,76,0.35); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.demo-hints {
  margin-top: 24px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--slate);
}

.demo-hints strong { color: var(--gold-light); }
.demo-hint-row { display: flex; justify-content: space-between; margin-top: 6px; gap: 8px; }
.demo-hint-row button {
  flex: 1;
  padding: 6px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--slate-light);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}
.demo-hint-row button:hover { border-color: var(--gold); color: var(--gold); }

/* ── Alertes ──────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.25); color: #FCA5A5; }
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.25); color: #86EFAC; }

/* ── Notification ────────────────────────────────────────── */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-md);
  min-width: 280px;
  max-width: 340px;
  animation: notif-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

@keyframes notif-in {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}

.notification.fade-out {
  animation: notif-out 0.3s ease forwards;
}

@keyframes notif-out {
  to { opacity: 0; transform: translateX(60px); }
}

.notif-icon { font-size: 20px; flex-shrink: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--white); }
.notif-body  { font-size: 12px; color: var(--slate); margin-top: 2px; }

/* ── Page Admin ─────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--navy);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--slate-light);
  transition: var(--transition);
  border: 1px solid transparent;
}

.admin-nav-item:hover { background: var(--surface); color: var(--white); }
.admin-nav-item.active { background: var(--surface-2); border-color: var(--border); color: var(--gold); }

.admin-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 24px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}

.stat-card:hover { border-color: rgba(201,168,76,0.3); }
.stat-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--gold); }
.stat-label { font-size: 12px; color: var(--slate); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }

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

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--white);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--surface); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-client     { background: rgba(99,179,237,0.15); color: #63B3ED; border: 1px solid rgba(99,179,237,0.3); }
.badge-gestionnaire { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid var(--border); }
.badge-admin      { background: rgba(248,113,113,0.15); color: #F87171; border: 1px solid rgba(248,113,113,0.3); }
.badge-online     { background: rgba(34,197,94,0.15); color: #4ADE80; }
.badge-offline    { background: rgba(100,116,139,0.15); color: #94A3B8; }

.btn-danger {
  padding: 6px 12px;
  background: rgba(248,113,113,0.15);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius-sm);
  color: #F87171;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger:hover { background: rgba(248,113,113,0.25); }

.btn-secondary {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--slate-light);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--white); }

.message-action-modal { max-width: 420px; }
.message-edit-input {
  min-height: 118px;
  resize: vertical;
  line-height: 1.5;
}
.message-action-hint {
  margin: 10px 0 18px;
  color: var(--slate);
  font-size: 12px;
  line-height: 1.4;
}
.message-action-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.message-action-buttons .btn-primary,
.message-action-buttons .btn-danger,
.message-action-buttons .btn-secondary {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modal-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-up {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--slate);
  font-size: 18px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--white); }

/* ── Loader ──────────────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Vide/Placeholder ────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--slate);
  text-align: center;
}
.empty-state .empty-icon { font-size: 40px; opacity: 0.4; }
.empty-state .empty-title { font-size: 15px; color: var(--slate-light); }
.empty-state .empty-text { font-size: 13px; }
.empty-state .empty-text + .empty-text { display: none; }

/* ── Mobile responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .app-wrapper {
    height: 100vh;
    height: 100dvh;
  }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    width: min(86vw, 340px);
    min-width: 0;
    max-width: 340px;
  }

  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

  .btn-hamburger {
    display: flex !important;
    width: 36px;
    height: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--white);
    font-size: 18px;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }
  .sidebar-overlay.active { display: block; }

  .chat-area { width: 100%; }
  .chat-header {
    min-height: 64px;
    padding: 10px 12px;
    gap: 10px;
  }
  .chat-contact-name {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chat-contact-status { font-size: 11px; }
  .messages-area {
    padding: 14px 12px;
    gap: 6px;
  }
  .msg-content { max-width: min(84%, 520px); }
  .msg-avatar-wrap .avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
  .msg-bubble {
    padding: 9px 12px;
    font-size: 14px;
    line-height: 1.45;
  }
  .chat-input-area {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .typing-indicator {
    height: 12px;
    margin-bottom: 5px;
  }
  .input-wrapper {
    gap: 7px;
    border-radius: 22px;
    padding: 7px 7px 7px 12px;
  }
  #messageInput {
    min-height: 26px;
    max-height: 100px;
  }
  .btn-attach {
    width: 34px;
    height: 34px;
  }
  .btn-send {
    width: 38px;
    height: 38px;
  }
  .modal {
    width: min(94vw, 420px);
    max-height: 86dvh;
    overflow-y: auto;
    padding: 22px;
  }
  .message-action-buttons { grid-template-columns: 1fr; }
  .register-grid { grid-template-columns: 1fr; gap: 0; }

  .admin-sidebar { display: none; }
  .admin-content { padding: 16px; }

  .stat-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .sidebar {
    width: 92vw;
    max-width: none;
  }

  .sidebar-header { padding: 18px 14px 12px; }
  .sidebar-body { padding: 10px; }

  .chat-header {
    min-height: 58px;
    padding: 8px 10px;
  }

  .chat-header .avatar-sm {
    width: 32px;
    height: 32px;
  }

  .messages-area { padding: 12px 8px; }
  .msg-row { gap: 6px; }
  .msg-content { max-width: 86%; }
  .msg-bubble {
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 15px;
  }
  .msg-meta { font-size: 9px; }
  .msg-img {
    max-width: min(220px, 68vw);
    max-height: 180px;
  }

  .chat-input-area { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .input-wrapper { border-radius: 18px; }
  .input-actions { gap: 5px; }
  .btn-attach {
    width: 32px;
    height: 32px;
  }
  .btn-send {
    width: 36px;
    height: 36px;
  }

  .welcome-screen { padding: 24px 16px; }
  .welcome-icon {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }
  .welcome-title { font-size: 22px; }
  .welcome-text { font-size: 13px; }
}

@media (max-width: 360px) {
  .chat-contact-name { font-size: 16px; }
  .messages-area { padding-inline: 6px; }
  .msg-avatar-wrap { display: none; }
  .msg-content { max-width: 92%; }
  .msg-bubble { font-size: 13px; }
  .btn-attach {
    width: 30px;
    height: 30px;
  }
  .btn-send {
    width: 34px;
    height: 34px;
  }
}

.btn-hamburger { display: none; }

/* ── Scrollbar globale ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-light); }

/* ── Image lightbox ──────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
