/* =================================================================
   HUBADVISER — LAYOUT CSS PARTAGÉ
   Utilisé par Admin, Advisers et Clients
   ================================================================= */

:root {
  --color-primary:      #b0556b;
  --color-secondary:    #394665;
  --color-error:        #e74c3c;
  --color-success:      #27ae60;
  --color-warning:      #f39c12;
  --color-warning-text: #9c6404; /* version sombre pour texte sur fond clair — ratio 5.2:1 */
  --color-text:         #1a1f36;
  --color-text-muted:   #6b7280;
  --color-text-light:   #94a3b8;
  --color-bg:           #f8f9fb;
  --color-bg-alt:       #f1f5f9;
  --color-border:       #e5e7eb;
}

/* ---- TOAST (unifié avec notif-toast-container) ---- */
/* L'ancien #toast-container n'est plus utilisé — showToast() utilise notif-toast-container */

/* ---- RESET + BASE ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--color-bg);
  min-height: 100vh;
}

/* ---- FOCUS-VISIBLE (accessibilité clavier) ---- */
/* Masquer le ring sur clic souris, le garder pour la navigation clavier */
:focus:not(:focus-visible) { outline: none; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Inputs/selects/textareas : box-shadow cohérent avec le design existant */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(176,85,107,0.15) !important;
}

/* ================================================================
   HEADER
   ================================================================ */

.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--color-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  gap: 16px;
}

.header-logo { flex-shrink: 0; }
.header-logo a { display: flex; align-items: center; }
.header-logo img { height: 24px; width: auto; }

.header-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 7px 14px;
  width: 300px;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.header-search:focus-within {
  background: rgba(255,255,255,0.11);
  border-color: rgba(255,255,255,0.2);
  width: 360px;
}

.header-search i { color: rgba(255,255,255,0.35); font-size: 0.8rem; }

.header-search input {
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.82rem;
  width: 100%;
}

.header-search input::placeholder { color: rgba(255,255,255,0.35); }

.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.notif-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s ease;
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem; text-decoration: none;
  flex-shrink: 0;
}

.notif-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); color: white; }

.notif-count {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--color-primary);
  border-radius: 8px;
  font-size: 0.6rem; font-weight: 700; color: white;
  display: none; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; padding: 0 3px;
}

.notif-count.visible { display: flex; }

/* ---- NOTIFICATION DROPDOWN ---- */
.notif-btn-wrap { position: relative; flex-shrink: 0; }
.notif-btn-wrap > .notif-btn { background: none; border: none; }

.notif-dropdown {
  position: absolute; top: calc(100% + 14px); right: -8px;
  width: 360px; background: white; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18); border: 1px solid rgba(0,0,0,0.07);
  z-index: 2000; opacity: 0; visibility: hidden;
  transform: translateY(-8px); transition: all 0.2s ease;
  overflow: hidden;
}
.notif-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.notif-drop-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--color-bg-alt);
}
.notif-drop-title { font-family: 'Poppins', sans-serif; font-size: 0.9rem; font-weight: 700; color: var(--color-text); }
.notif-drop-see-all {
  font-family: 'Poppins', sans-serif; font-size: 0.73rem; font-weight: 600;
  color: var(--color-primary); text-decoration: none; transition: opacity 0.15s;
}
.notif-drop-see-all:hover { opacity: 0.75; }
.notif-drop-list { max-height: 340px; overflow-y: auto; }
.notif-drop-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--color-bg);
  cursor: pointer; transition: background 0.15s; text-decoration: none;
}
.notif-drop-item:last-child { border-bottom: none; }
.notif-drop-item:hover { background: var(--color-bg); }
.notif-drop-item.unread { border-left: 3px solid var(--color-primary); background: rgba(176,85,107,0.02); }
.notif-drop-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; flex-shrink: 0;
}
.notif-drop-icon.consultation { background: rgba(57,70,101,0.1); color: var(--color-secondary); }
.notif-drop-icon.facture { background: rgba(39,174,96,0.1); color: var(--color-success); }
.notif-drop-icon.system { background: rgba(52,152,219,0.1); color: #3498db; }
.notif-drop-icon.default { background: rgba(0,0,0,0.05); color: var(--color-text-muted); }
.notif-drop-body { flex: 1; min-width: 0; }
.notif-drop-name {
  font-family: 'Poppins', sans-serif; font-size: 0.78rem; font-weight: 600;
  color: var(--color-text); margin-bottom: 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.notif-drop-msg {
  font-family: 'Montserrat', sans-serif; font-size: 0.71rem; color: var(--color-text-muted);
  line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.notif-drop-time { font-family: 'Montserrat', sans-serif; font-size: 0.67rem; color: #9ca3af; white-space: nowrap; margin-top: 4px; }
.notif-drop-empty { padding: 28px 18px; text-align: center; font-family: 'Montserrat', sans-serif; font-size: 0.8rem; color: #9ca3af; }
.notif-drop-footer {
  padding: 10px 18px; border-top: 1px solid var(--color-bg-alt); text-align: center;
}
.notif-drop-footer a {
  font-family: 'Poppins', sans-serif; font-size: 0.78rem; font-weight: 600;
  color: var(--color-secondary); text-decoration: none;
}
.notif-drop-footer a:hover { color: var(--color-primary); }

/* ---- NOTIFICATION TOAST (realtime popup) ---- */
#notif-toast-container {
  position: fixed; bottom: 24px; left: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.notif-toast {
  pointer-events: all; background: white; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14); border: 1px solid rgba(0,0,0,0.06);
  border-left: 4px solid var(--color-secondary); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px; width: 320px;
  transform: translateX(-120%); transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  cursor: pointer;
}
.notif-toast.show { transform: translateX(0); }
.notif-toast-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(57,70,101,0.08); display: flex; align-items: center;
  justify-content: center; color: var(--color-secondary); font-size: 0.9rem; flex-shrink: 0;
}
.notif-toast-body { flex: 1; min-width: 0; }
.notif-toast-title {
  font-family: 'Poppins', sans-serif; font-size: 0.82rem;
  font-weight: 700; color: var(--color-text); margin-bottom: 3px;
}
.notif-toast-msg {
  font-family: 'Montserrat', sans-serif; font-size: 0.73rem;
  color: var(--color-text-muted); line-height: 1.4;
}
.notif-toast-close {
  color: #9ca3af; font-size: 0.75rem; cursor: pointer;
  background: none; border: none; padding: 0; flex-shrink: 0;
  line-height: 1;
}
.notif-toast-close:hover { color: var(--color-error); }
@media (max-width: 640px) {
  .notif-dropdown { width: calc(100vw - 32px); right: -80px; }
  #notif-toast-container { left: 16px; right: 16px; bottom: 16px; }
  .notif-toast { width: 100%; }
}

.header-sep {
  width: 1px; height: 24px;
  background: rgba(255,255,255,0.12);
  margin: 0 4px;
  flex-shrink: 0;
}

.dropdown { position: relative; }

.header-profile {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; padding: 5px 10px;
  border-radius: 6px; border: 1px solid transparent;
  transition: all 0.2s ease;
}

.header-profile:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); }

.header-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-family: 'Poppins', sans-serif;
  font-weight: 700; font-size: 0.72rem; flex-shrink: 0;
  overflow: hidden;
}

.header-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.header-profile-text { display: flex; flex-direction: column; line-height: 1.2; }
.header-profile-text strong { font-family: 'Poppins', sans-serif; font-size: 0.78rem; font-weight: 600; color: white; }
.header-profile-text span { font-size: 0.68rem; color: rgba(255,255,255,0.45); }
.header-profile i.fa-chevron-down { color: rgba(255,255,255,0.4); font-size: 0.7rem; margin-left: 2px; }

.dropdown-menu {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  background: white; border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  min-width: 190px; overflow: hidden;
  z-index: 1001; border: 1px solid rgba(0,0,0,0.06);
}

.dropdown-menu.show { display: block; }

.dropdown-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 0.82rem;
  color: #2d3748; text-decoration: none;
  transition: background 0.15s; font-family: 'Montserrat', sans-serif;
}

.dropdown-menu a i { width: 16px; color: var(--color-text-light); font-size: 0.8rem; }
.dropdown-menu a:hover { background: var(--color-bg); }
.dropdown-divider { height: 1px; background: var(--color-bg-alt); }
.dropdown-menu .logout { color: var(--color-error); }
.dropdown-menu .logout i { color: var(--color-error); }

/* ---- Hamburger (visible sur mobile/tablette) ---- */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s ease;
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.hamburger:hover { background: rgba(255,255,255,0.08); color: white; }

/* ================================================================
   SIDEBAR
   ================================================================ */

/* Overlay sombre quand sidebar ouverte sur mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 899;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

.sidebar {
  position: fixed;
  top: 56px; left: 0; bottom: 0;
  width: 230px; background: #2d3a54;
  z-index: 900; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-section { padding: 20px 0 8px; }

.sidebar-section-label {
  padding: 0 20px 8px;
  font-size: 0.65rem; font-weight: 700;
  color: rgba(255,255,255,0.25); text-transform: uppercase;
  letter-spacing: 1px; font-family: 'Poppins', sans-serif;
}

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; color: rgba(255,255,255,0.55);
  text-decoration: none; font-family: 'Poppins', sans-serif;
  font-size: 0.82rem; font-weight: 500;
  transition: all 0.2s ease; border-left: 3px solid transparent;
}

.sidebar-link i { width: 18px; font-size: 0.85rem; text-align: center; }
.sidebar-link:hover { color: white; background: rgba(255,255,255,0.06); border-left-color: rgba(176,85,107,0.5); }
.sidebar-link.active { color: white; background: rgba(255,255,255,0.08); border-left-color: var(--color-primary); }

.sidebar-link-inner { display: flex; align-items: center; gap: 12px; flex: 1; }
.sidebar-msg-badge {
  margin-left: auto; min-width: 18px; height: 18px;
  background: var(--color-primary); color: white; border-radius: 20px;
  font-size: 0.62rem; font-weight: 700; font-family: 'Poppins', sans-serif;
  display: none; align-items: center; justify-content: center; padding: 0 5px;
}
.sidebar-msg-badge.visible { display: flex; }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 20px; }
.sidebar-bottom { margin-top: auto; padding: 16px 0; border-top: 1px solid rgba(255,255,255,0.06); }

/* ================================================================
   MAIN CONTENT
   ================================================================ */

.main {
  margin-top: 56px;
  margin-left: 230px;
  padding: 32px;
  min-height: calc(100vh - 56px);
}

/* ================================================================
   COMPOSANTS COMMUNS
   ================================================================ */

/* ---- Page top ---- */
.page-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}

.page-top h1 { font-family: 'Poppins', sans-serif; font-size: 1.4rem; font-weight: 700; color: #1a1a2e; }
.page-top p { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 2px; }

/* ---- Boutons d'action principal ---- */
.btn-ajouter,
.btn-inviter,
.btn-envoyer,
.btn-action-primary {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  background: var(--color-primary); color: white; border: none; border-radius: 8px;
  font-family: 'Poppins', sans-serif; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; white-space: nowrap; text-decoration: none;
}

.btn-ajouter:hover,
.btn-inviter:hover,
.btn-envoyer:hover,
.btn-action-primary:hover {
  background: #C83C5E;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(176,85,107,0.3);
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}

.toolbar-search {
  display: flex; align-items: center; gap: 10px; background: white;
  border: 1px solid var(--color-border); border-radius: 8px; padding: 9px 16px;
  width: 280px; transition: all 0.2s ease;
}

.toolbar-search:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(176,85,107,0.08); }
.toolbar-search i { color: var(--color-text-light); font-size: 0.85rem; }

.toolbar-search input {
  background: transparent; border: none; outline: none;
  font-family: 'Montserrat', sans-serif; font-size: 0.85rem; color: #1a1a2e; width: 100%;
}

.toolbar-search input::placeholder { color: var(--color-text-light); }
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-btn {
  padding: 8px 16px; border-radius: 20px; border: 1px solid var(--color-border); background: white;
  font-family: 'Poppins', sans-serif; font-size: 0.78rem; font-weight: 500;
  color: var(--color-text-muted); cursor: pointer; transition: all 0.2s ease;
}

.filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: rgba(176,85,107,0.05); }
.filter-btn.active { background: var(--color-secondary); color: white; border-color: var(--color-secondary); }

.results-count { font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 12px; }

/* ---- Table card ---- */
.table-card {
  background: white; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.04); overflow: hidden;
}

.table-card table { width: 100%; border-collapse: collapse; }
.table-card thead { background: var(--color-bg); }

.table-card th {
  padding: 12px 16px; text-align: left; font-family: 'Poppins', sans-serif;
  font-size: 0.72rem; font-weight: 600; color: var(--color-text-light);
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--color-bg-alt);
  white-space: nowrap;
}

.table-card td { padding: 14px 16px; border-bottom: 1px solid var(--color-bg); font-size: 0.85rem; color: #2d3748; }
.table-card tbody tr:last-child td { border-bottom: none; }
.table-card tbody tr { transition: background 0.15s; cursor: pointer; }
.table-card tbody tr:hover { background: #fafafa; }

/* ---- Empty state ---- */
.empty-table,
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--color-text-light);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.empty-table i, .empty-state i { font-size: 2.5rem; }
.empty-table p, .empty-state p { font-size: 0.9rem; }

/* ---- Badges statut ---- */
.badge-en_attente  { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(241,196,15,0.12);  color: var(--color-warning-text); }
.badge-confirmee   { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(46,204,113,0.12);   color: var(--color-success); }
.badge-terminee    { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(57,70,101,0.12);    color: var(--color-secondary); }
.badge-annulee     { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(231,76,60,0.12);   color: var(--color-error); }
.badge-actif       { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(46,204,113,0.12);   color: var(--color-success); }
.badge-valide      { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(46,204,113,0.12);   color: var(--color-success); }
.badge-payee       { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(46,204,113,0.12);   color: var(--color-success); }
.badge-envoyee     { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(241,196,15,0.12);  color: var(--color-warning-text); }
.badge-rejetee     { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(231,76,60,0.12);   color: var(--color-error); }
.badge-en_attente_paiement { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(241,196,15,0.12); color: var(--color-warning-text); }
.badge-date_proposee { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; font-family: 'Poppins', sans-serif; background: rgba(57,70,101,0.12); color: var(--color-secondary); }

/* ---- Action link ---- */
.action-link {
  color: var(--color-primary); text-decoration: none; font-family: 'Poppins', sans-serif;
  font-size: 0.8rem; font-weight: 600; transition: color 0.2s; margin-right: 10px;
}

.action-link:hover { color: #C83C5E; }

/* ---- Tabs ---- */
.tabs-container { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

.tab-btn {
  padding: 8px 18px; border-radius: 8px; border: 1.5px solid var(--color-border); background: white;
  font-family: 'Poppins', sans-serif; font-size: 0.82rem; font-weight: 500;
  color: var(--color-text-muted); cursor: pointer; transition: all 0.2s ease;
  display: flex; align-items: center; gap: 6px;
}

.tab-btn:hover { border-color: var(--color-secondary); color: var(--color-secondary); }
.tab-btn.active { background: var(--color-secondary); color: white; border-color: var(--color-secondary); }

.tab-count {
  background: rgba(255,255,255,0.2); border-radius: 20px;
  padding: 1px 7px; font-size: 0.7rem; font-weight: 700;
}

.tab-btn:not(.active) .tab-count { background: var(--color-bg-alt); color: var(--color-text-muted); }

/* ---- Modals ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 2000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  padding: 16px;
}

.modal-overlay.show { display: flex; }

.modal {
  background: white; border-radius: 16px; padding: 32px;
  width: 100%; max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto;
}

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

.modal-header h2 { font-family: 'Poppins', sans-serif; font-size: 1.1rem; font-weight: 700; color: #1a1a2e; }

.modal-close {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--color-bg-alt);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--color-text-light); font-size: 0.9rem; transition: all 0.2s; flex-shrink: 0;
}

.modal-close:hover { background: #e2e8f0; color: var(--color-secondary); }

.form-group { margin-bottom: 16px; }

.form-group label,
.modal-form label {
  display: block; font-family: 'Poppins', sans-serif; font-weight: 600;
  font-size: 0.8rem; color: var(--color-secondary); margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea,
.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--color-border); border-radius: 8px;
  font-family: 'Montserrat', sans-serif; font-size: 0.875rem; color: #1a1a2e;
  outline: none; transition: all 0.2s; background: white;
}

.form-group textarea,
.modal-form textarea { resize: vertical; min-height: 80px; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(176,85,107,0.08); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-footer { display: flex; gap: 10px; margin-top: 24px; }

.btn-cancel {
  flex: 1; padding: 11px; border-radius: 8px; border: 1.5px solid var(--color-border); background: white;
  font-family: 'Poppins', sans-serif; font-size: 0.85rem; font-weight: 600;
  color: var(--color-text-muted); cursor: pointer; transition: all 0.2s;
}

.btn-cancel:hover { border-color: var(--color-text-light); color: var(--color-secondary); }

.btn-send {
  flex: 2; padding: 11px; border-radius: 8px; border: none; background: var(--color-primary);
  font-family: 'Poppins', sans-serif; font-size: 0.85rem; font-weight: 600; color: white;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

.btn-send:hover { background: #C83C5E; }
.btn-send:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---- Feedback ---- */
.success-msg {
  display: none; background: rgba(46,204,113,0.1); border: 1px solid rgba(46,204,113,0.3);
  color: var(--color-success); padding: 12px 16px; border-radius: 8px; font-size: 0.85rem;
  margin-top: 16px; align-items: center; gap: 8px;
}

.success-msg.show { display: flex; }

.error-msg {
  display: none; background: rgba(231,76,60,0.1); border: 1px solid rgba(231,76,60,0.3);
  color: var(--color-error); padding: 12px 16px; border-radius: 8px; font-size: 0.85rem;
  margin-top: 16px; align-items: center; gap: 8px;
}

.error-msg.show { display: flex; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* ---- Tablette (≤ 1024px) — Sidebar en drawer ---- */
@media (max-width: 1024px) {
  .hamburger { display: flex; }
  .header-search { display: none; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.25);
  }

  .main {
    margin-left: 0;
  }
}

/* ---- Mobile (≤ 640px) ---- */
@media (max-width: 640px) {
  .header { padding: 0 16px; gap: 8px; }
  .header-sep { display: none; }
  .header-profile-text { display: none; }
  .header-profile { padding: 5px 6px; gap: 6px; }

  .main { padding: 20px 16px; }

  .page-top { margin-bottom: 20px; }
  .page-top h1 { font-size: 1.15rem; }
  .page-top p { font-size: 0.78rem; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-search { width: 100%; }
  .toolbar-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }

  .table-card { overflow-x: auto; }

  .form-row-2 { grid-template-columns: 1fr; }

  .modal { padding: 24px 18px; }
  .modal-footer { flex-direction: column; }
  .btn-cancel, .btn-send { flex: none; width: 100%; justify-content: center; }

  .tabs-container { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }
}

/* ---- Très petit (≤ 380px) ---- */
@media (max-width: 380px) {
  .header { padding: 0 12px; }
  .main { padding: 12px; }
}

/* ================================================================
   SEARCH DROPDOWN
   ================================================================ */

.header-search { position: relative; }

.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 360px; background: white; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18); border: 1px solid rgba(0,0,0,0.06);
  overflow: hidden; z-index: 9999;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.search-dropdown.show {
  opacity: 1; pointer-events: all; transform: translateY(0);
}

.search-drop-empty {
  padding: 20px; text-align: center;
  font-family: 'Montserrat', sans-serif; font-size: 0.78rem; color: var(--color-text-light);
}

.search-drop-section {
  padding: 8px 14px 4px;
  font-family: 'Poppins', sans-serif; font-size: 0.62rem;
  font-weight: 700; color: var(--color-text-light); text-transform: uppercase; letter-spacing: 1px;
}

.search-drop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; text-decoration: none;
  transition: background 0.12s; cursor: pointer;
  border: none; background: transparent; width: 100%; text-align: left;
}

.search-drop-item:hover { background: #f8fafc; }

.search-drop-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; flex-shrink: 0;
}

.search-drop-body { flex: 1; min-width: 0; }

.search-drop-name {
  font-family: 'Poppins', sans-serif; font-size: 0.78rem;
  font-weight: 600; color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.search-drop-sub {
  font-family: 'Montserrat', sans-serif; font-size: 0.68rem; color: var(--color-text-light);
}

.search-drop-arrow { color: #cbd5e1; font-size: 0.65rem; flex-shrink: 0; }

.search-drop-divider { height: 1px; background: var(--color-bg-alt); margin: 4px 0; }
