/* ================================================================
   WEDOM — Design System
   ================================================================ */

:root {
  --primary:        #C9A84C;
  --primary-dark:   #A8893D;
  --primary-light:  #E8D5A3;
  --primary-faint:  #FAF5E8;

  --sidebar-bg:     #1A1625;
  --sidebar-hover:  #251F33;
  --sidebar-active: rgba(201, 168, 76, 0.12);
  --sidebar-text:   #C0BAD2;
  --sidebar-border: rgba(255,255,255,0.07);

  --bg:             #F5F3EE;
  --bg-card:        #FFFFFF;

  --text:           #1A1625;
  --text-mid:       #4A4560;
  --text-muted:     #8A8699;
  --text-white:     #FFFFFF;

  --border:         #E4E0D8;
  --border-light:   #F0EDE6;

  --success:        #22C55E;
  --success-bg:     #F0FDF4;
  --warning:        #F59E0B;
  --warning-bg:     #FFFBEB;
  --danger:         #EF4444;
  --danger-bg:      #FEF2F2;
  --info:           #3B82F6;
  --info-bg:        #EFF6FF;

  --sidebar-w:      228px;
  --topbar-h:       60px;

  --r-sm:  6px;
  --r:     10px;
  --r-lg:  16px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
  --shadow:    0 2px 10px rgba(0,0,0,0.09);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.13);
  --shadow-lg: 0 8px 36px rgba(0,0,0,0.18);

  --t: all 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; transition: var(--t); }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.sidebar-logo svg { width: 20px; height: 20px; }

.sidebar-name  { font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: 0.2px; }
.sidebar-sub   { font-size: 0.62rem; color: var(--sidebar-text); text-transform: uppercase; letter-spacing: 1.1px; margin-top: 1px; opacity: 0.7; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--sidebar-text);
  opacity: 0.4;
  padding: 0 8px;
  margin-bottom: 4px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: var(--t);
  margin-bottom: 1px;
  cursor: pointer;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: var(--primary); }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.6; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }
.nav-item span.label { flex: 1; }

.nav-badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.nav-unread-badge {
  margin-left: auto;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 0.62rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-item.active .nav-unread-badge {
  background: rgba(201,168,76,0.35);
  color: var(--primary);
}

.nav-item.soon { opacity: 0.6; cursor: default; pointer-events: none; }

/* Sidebar footer */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
}
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(201,168,76,0.25);
  border: 1px solid rgba(201,168,76,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: var(--primary);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name  { font-size: 0.8125rem; font-weight: 600; color: rgba(255,255,255,0.88); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 0.63rem; color: var(--sidebar-text); opacity: 0.65; margin-top: 1px; }

.btn-logout {
  background: none; border: none;
  color: var(--sidebar-text);
  opacity: 0.55;
  cursor: pointer; padding: 5px;
  border-radius: var(--r-sm);
  transition: var(--t);
  display: flex; align-items: center;
  flex-shrink: 0;
}
.btn-logout:hover { opacity: 1; color: var(--danger); background: rgba(239,68,68,0.12); }
.btn-logout svg { width: 15px; height: 15px; }

/* ── Main content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;    /* empêche l'expansion hors du flex parent */
  overflow-x: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-toggle {
  display: none;
  background: none; border: none;
  cursor: pointer; padding: 6px;
  border-radius: var(--r-sm);
  color: var(--text-mid);
}
.topbar-toggle:hover { background: var(--border-light); }
.topbar-toggle svg { width: 20px; height: 20px; }
.topbar-title { flex: 1; font-size: 0.9375rem; font-weight: 600; color: var(--text); }

/* ── Page content ── */
.page-content { flex: 1; padding: 28px 26px; }

/* ── Welcome banner ── */
.welcome-banner {
  background: linear-gradient(135deg, #1A1625 0%, #2D2145 100%);
  border-radius: var(--r-lg);
  padding: 28px 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(201,168,76,0.08);
  pointer-events: none;
}
.welcome-banner::before {
  content: '';
  position: absolute;
  right: 60px; bottom: -80px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(201,168,76,0.05);
  pointer-events: none;
}
.welcome-greet { font-size: 0.8125rem; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
.welcome-name  { font-size: 1.625rem; font-weight: 700; color: #fff; margin-bottom: 10px; line-height: 1.2; }
.welcome-name .accent { color: var(--primary); }
.welcome-text  { font-size: 0.875rem; color: rgba(255,255,255,0.45); max-width: 480px; }

/* Role badges — light background (tables, forms) */
.role-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  vertical-align: middle;
}
.role-super-admin { background: rgba(201,168,76,0.12); color: #92700D; border: 1px solid rgba(201,168,76,0.28); }
.role-admin       { background: rgba(109,40,217,0.08); color: #6D28D9; border: 1px solid rgba(109,40,217,0.2); }
.role-editor      { background: rgba(21,128,61,0.08);  color: #15803D; border: 1px solid rgba(21,128,61,0.2); }
.role-guest       { background: rgba(107,114,128,0.1); color: #6B7280; border: 1px solid rgba(107,114,128,0.2); }

/* Override for dark backgrounds (welcome banner) */
.welcome-banner .role-badge { margin-left: 8px; }
.welcome-banner .role-super-admin { background: rgba(201,168,76,0.22); color: var(--primary); border-color: rgba(201,168,76,0.4); }
.welcome-banner .role-admin       { background: rgba(167,139,250,0.2); color: #C4B5FD; border-color: rgba(167,139,250,0.35); }
.welcome-banner .role-editor      { background: rgba(74,222,128,0.2);  color: #86EFAC; border-color: rgba(74,222,128,0.3); }
.welcome-banner .role-guest       { background: rgba(203,213,225,0.15); color: #CBD5E1; border-color: rgba(203,213,225,0.25); }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.si-gold   { background: var(--primary-faint); color: var(--primary); }
.si-teal   { background: #F0FDFA; color: #0D9488; }
.si-violet { background: #F5F3FF; color: #7C3AED; }
.si-blue   { background: var(--info-bg); color: var(--info); }
.stat-card > div:not(.stat-icon) { min-width: 0; flex: 1; overflow: hidden; }
.stat-card.filterable { cursor: pointer; user-select: none; transition: var(--t); }
.stat-card.filterable:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card.filterable.filter-active { box-shadow: 0 0 0 2px var(--primary); }
.stat-val  { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-lbl  { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.stat-sub  { font-size: 0.72rem; color: var(--text-muted); opacity: 0.6; margin-top: 1px; }

/* ── Section title ── */
.section-title {
  font-size: 1rem; font-weight: 600; color: var(--text);
  margin-bottom: 16px;
}

/* ── Module cards ── */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.module-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--t);
  position: relative; overflow: hidden;
}
.module-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.module-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary); opacity: 0; transition: var(--t);
}
.module-card:hover::after { opacity: 1; }

.module-icon {
  width: 48px; height: 48px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.module-icon svg { width: 24px; height: 24px; }
.mi-gold   { background: var(--primary-faint); color: var(--primary); }
.mi-teal   { background: #F0FDFA; color: #0D9488; }
.mi-violet { background: #F5F3FF; color: #7C3AED; }
.mi-rose   { background: #FFF1F2; color: #E11D48; }

.module-title       { font-size: 0.9375rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.module-desc        { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.55; }
.module-soon {
  display: inline-block; margin-top: 14px;
  font-size: 0.65rem; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
  background: var(--border-light); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 0.875rem; font-weight: 500;
  border: none; cursor: pointer;
  transition: var(--t);
  line-height: 1; white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-lg   { padding: 12px 24px; font-size: 1rem; border-radius: var(--r); }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.875rem; font-weight: 500; color: var(--text);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.875rem; color: var(--text);
  background: #fff;
  transition: var(--t);
  outline: none;
  font-family: inherit;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}
.form-input::placeholder { color: var(--text-muted); }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 42px; }
.toggle-pw {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  display: flex; align-items: center;
  transition: var(--t);
}
.toggle-pw:hover { color: var(--text); }
.toggle-pw svg { width: 16px; height: 16px; }

.form-checkbox {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 0.875rem; color: var(--text-mid);
}
.form-checkbox input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary); cursor: pointer;
}

.form-error {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  background: var(--danger-bg);
  border: 1px solid #FECACA;
  border-radius: var(--r-sm);
  color: #991B1B;
  font-size: 0.875rem;
  margin-bottom: 20px;
}
.form-error svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Flash messages ── */
.flash-container {
  position: fixed; top: 20px; right: 20px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 380px; pointer-events: none;
}
.flash-msg {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  pointer-events: all;
  animation: flashIn 0.3s ease;
}
@keyframes flashIn  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes flashOut { from { transform: translateX(0);    opacity: 1; } to { transform: translateX(110%); opacity: 0; } }
.flash-msg.success { background: var(--success-bg); border: 1px solid #BBF7D0; color: #166534; }
.flash-msg.error   { background: var(--danger-bg);  border: 1px solid #FECACA; color: #991B1B; }
.flash-msg.warning { background: var(--warning-bg); border: 1px solid #FDE68A; color: #92400E; }
.flash-msg.info    { background: var(--info-bg);    border: 1px solid #BFDBFE; color: #1E40AF; }
.flash-icon  { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.flash-text  { flex: 1; line-height: 1.4; }
.flash-close {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: 0.55; padding: 0;
  display: flex; align-items: center; transition: var(--t);
  flex-shrink: 0;
}
.flash-close:hover { opacity: 1; }
.flash-close svg { width: 15px; height: 15px; }

/* ── Login page ── */
.login-page { min-height: 100vh; display: flex; }

.login-left {
  flex: 1;
  background: var(--sidebar-bg);
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
  position: relative; overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 25% 50%, rgba(201,168,76,0.18) 0%, transparent 55%),
    radial-gradient(circle at 80% 15%, rgba(201,168,76,0.09) 0%, transparent 45%);
}
.login-branding { position: relative; z-index: 1; text-align: center; }
.login-logo {
  width: 76px; height: 76px;
  background: var(--primary);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 10px 36px rgba(201,168,76,0.38);
}
.login-logo svg { width: 42px; height: 42px; color: #fff; }
.login-brand-name    { font-size: 2.75rem; font-weight: 800; color: #fff; letter-spacing: -0.5px; margin-bottom: 10px; }
.login-brand-tagline { font-size: 0.9375rem; color: rgba(255,255,255,0.45); max-width: 280px; line-height: 1.65; }

.login-dots {
  display: flex; gap: 8px; justify-content: center; margin-top: 36px;
}
.login-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.login-dots span:first-child { background: var(--primary); }

.login-right {
  width: 460px; flex-shrink: 0;
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 52px;
}
.login-form-wrap { width: 100%; }
.login-form-title    { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.login-form-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 30px; }

/* ── Select styling ── */
select.form-input {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8699' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Page toolbar (search + actions) ── */
.page-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-box { position: relative; flex: 1; min-width: 160px; max-width: 300px; }
.search-box .form-input { padding-left: 36px; height: 38px; }
.search-box-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-box-icon svg { width: 15px; height: 15px; }

/* ── Data table ── */
.table-wrap {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table thead { background: var(--bg); border-bottom: 1px solid var(--border); }
.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.7px;
  white-space: nowrap;
}
.data-table td {
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #FAFAF8; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-name  { font-weight: 500; color: var(--text); line-height: 1.2; }
.user-cell-email { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.avatar-sm { width: 32px !important; height: 32px !important; font-size: 0.7rem !important; flex-shrink: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 0.72rem; font-weight: 500;
  padding: 2px 8px; border-radius: 20px;
  background: var(--primary-faint); color: var(--primary-dark);
  border: 1px solid var(--primary-light); white-space: nowrap;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-pill.active   { background: var(--success-bg); color: #166534; }
.status-pill.active::before   { background: var(--success); }
.status-pill.inactive { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.status-pill.inactive::before { background: var(--text-muted); }

.action-btns { display: flex; align-items: center; gap: 3px; }
.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); border: none; cursor: pointer;
  transition: var(--t); background: none; color: var(--text-muted);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.edit:hover   { background: var(--info-bg);    color: var(--info); }
.icon-btn.delete:hover { background: var(--danger-bg);  color: var(--danger); }

/* ── Empty state ── */
.empty-state { padding: 52px 24px; text-align: center; }
.empty-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; color: var(--text-muted);
}
.empty-icon svg { width: 22px; height: 22px; }
.empty-title { font-size: 0.9375rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-desc  { font-size: 0.875rem; color: var(--text-muted); }

/* ── Form pages ── */
.page-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.875rem; color: var(--text-mid);
  margin-bottom: 18px; transition: var(--t);
}
.page-back:hover { color: var(--text); }
.page-back svg { width: 16px; height: 16px; }

.form-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 26px 30px;
}
.form-card-title {
  font-size: 0.9375rem; font-weight: 600; color: var(--text);
  padding-bottom: 16px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 8px;
}
.form-card-title svg { width: 18px; height: 18px; color: var(--primary); }

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px;
}
.form-grid .full { grid-column: 1 / -1; }

.form-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border-light);
}
.btn-outline {
  background: none; border: 1.5px solid var(--border);
  color: var(--text-mid); display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--r-sm);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: var(--t); text-decoration: none;
}
.btn-outline:hover { background: var(--bg); border-color: var(--text-muted); color: var(--text); }

/* ── Groups grid ── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.group-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: var(--t); display: flex; flex-direction: column;
}
.group-card:hover { box-shadow: var(--shadow); }
.group-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 12px;
}
.group-card-icon {
  width: 42px; height: 42px; border-radius: var(--r);
  background: var(--primary-faint); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.group-card-icon svg { width: 20px; height: 20px; }
.group-card-actions { display: flex; gap: 2px; }
.group-card-name { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.group-card-desc { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.5; flex: 1; }
.group-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border-light);
}
.member-count-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.avatar-stack { display: flex; }
.avatar-stack .user-avatar {
  width: 26px !important; height: 26px !important;
  font-size: 0.62rem !important;
  border: 2px solid #fff; margin-left: -6px;
}
.avatar-stack .user-avatar:first-child { margin-left: 0; }
.avatar-more {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg); border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700; color: var(--text-muted); margin-left: -6px;
}

/* ── Group edit split layout ── */
.admin-split {
  display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start;
}
@media (max-width: 900px) { .admin-split { grid-template-columns: 1fr; } }

.section-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}
.section-card-title {
  font-size: 0.9375rem; font-weight: 600; color: var(--text);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.section-card-count {
  font-size: 0.78rem; font-weight: 400; color: var(--text-muted);
  background: var(--bg); padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--border);
}
.members-list { display: flex; flex-direction: column; gap: 6px; }
.member-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--border-light);
  transition: var(--t);
}
.member-item:hover { background: var(--border-light); }
.member-item .user-info { flex: 1; min-width: 0; }
.member-name-sm { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.member-role-sm { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.btn-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 5px; border-radius: var(--r-sm);
  display: flex; align-items: center; transition: var(--t); flex-shrink: 0;
}
.btn-remove:hover { color: var(--danger); background: var(--danger-bg); }
.btn-remove svg { width: 14px; height: 14px; }

.add-member-row {
  display: flex; gap: 8px; align-items: flex-end; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--border-light);
}
.add-member-row .form-group { flex: 1; margin-bottom: 0; }

/* ── Select avec recherche ── */
.select-search { position: relative; }
.select-search-trigger {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; cursor: pointer; user-select: none;
  padding: 0 12px; height: 40px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: 0.875rem; color: var(--text);
  transition: border-color 0.15s;
}
.select-search-trigger:hover,
.select-search.open .select-search-trigger { border-color: var(--primary); }
.select-search-trigger svg { flex-shrink: 0; opacity: 0.5;
  transition: transform 0.15s; }
.select-search.open .select-search-trigger svg { transform: rotate(180deg); }
.select-search-trigger-label { flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

.select-search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  display: none; flex-direction: column;
}
.select-search.open .select-search-dropdown { display: flex; }

.select-search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--border-light);
}
.select-search-input-wrap svg { flex-shrink: 0; opacity: 0.4; }
.select-search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 0.875rem; color: var(--text);
}
.select-search-list {
  list-style: none; margin: 0; padding: 4px 0;
  max-height: 200px; overflow-y: auto;
}
.select-search-option {
  padding: 8px 12px; font-size: 0.875rem; cursor: pointer;
  color: var(--text); transition: background 0.1s;
}
.select-search-option:hover,
.select-search-option.focused { background: var(--border-light); }
.select-search-option .opt-email { color: var(--text-muted); font-size: 0.8rem; }
.select-search-empty {
  padding: 10px 12px; font-size: 0.875rem;
  color: var(--text-muted); text-align: center;
}
.members-empty {
  padding: 20px; text-align: center; color: var(--text-muted);
  font-size: 0.875rem; background: var(--bg);
  border-radius: var(--r); border: 1px dashed var(--border);
}

/* ── Overlay (mobile) ── */
.overlay {
  display: none;
  position: fixed;
  top: var(--topbar-h); left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.18);
  z-index: 199;
  backdrop-filter: blur(1px);
}
.overlay.show { display: block; }

/* ══════════════════════════════════════════════════════════════
   DISCUSSIONS / CHAT
   ══════════════════════════════════════════════════════════════ */

.page-content.no-pad {
  padding: 0;
  overflow: hidden;
}

/* Chat 3-panel layout */
.chat-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ── Channel sidebar ── */
.chat-sidebar {
  width: 196px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-hd {
  padding: 11px 12px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-sidebar-mgmt {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: var(--t);
}
.chat-sidebar-mgmt:hover { background: var(--border); color: var(--text); }
.chat-sidebar-mgmt svg { width: 14px; height: 14px; }

.channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 5px;
}

.channel-group-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  opacity: 0.6;
  padding: 4px 8px 2px;
  font-weight: 600;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  font-size: 0.8125rem;
  transition: var(--t);
  margin-bottom: 1px;
  overflow: hidden;
}
.channel-item:hover { background: var(--border-light); color: var(--text); }
.channel-item.active { background: var(--primary-faint); color: var(--primary-dark); font-weight: 600; }
.channel-prefix    { flex-shrink: 0; font-size: 0.85rem; opacity: 0.55; }
.channel-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Unread indicator */
.channel-item.unread .channel-item-name { font-weight: 700; color: var(--text); }
.unread-badge {
  flex-shrink: 0;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 0.63rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.channel-item.active .unread-badge { display: none; }

.chat-sidebar-ft {
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.btn-new-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: var(--t);
  width: 100%;
}
.btn-new-channel:hover { background: var(--border-light); color: var(--primary); }

/* ── Chat main area ── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.chat-header {
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chat-header-left { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.chat-channel-name { font-size: 0.9375rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.chat-channel-desc {
  font-size: 0.8rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-left: 10px; border-left: 1px solid var(--border);
}
.chat-header-right { display: flex; gap: 8px; flex-shrink: 0; }

.btn-todo-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: none;
  color: var(--text-mid);
  font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; transition: var(--t);
  font-family: inherit;
}
.btn-todo-toggle:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-todo-toggle.active { border-color: var(--primary); background: var(--primary-faint); color: var(--primary-dark); }
.btn-todo-toggle svg { width: 15px; height: 15px; }

.todo-toggle-count {
  font-size: 0.7rem; font-weight: 700;
  background: var(--bg); color: var(--text-muted);
  padding: 1px 6px; border-radius: 20px;
  border: 1px solid var(--border);
}
.btn-todo-toggle.active .todo-toggle-count {
  background: var(--primary-faint); color: var(--primary-dark);
  border-color: var(--primary-light);
}

/* ── Messages area ── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.date-sep {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0 10px;
  color: var(--text-muted);
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.date-sep::before, .date-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.date-sep span { white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════
   BULLES DE CHAT
   ══════════════════════════════════════════════════════════════ */

.bubble-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}
/* Mes messages : avatar à droite, bulles à droite */
.bubble-group.own { flex-direction: row-reverse; margin-bottom: 2px; }

/* Avatar */
.bubble-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #fff;
  align-self: flex-end;
  margin-bottom: 2px;
}

/* Colonne de bulles */
.bubble-messages-col {
  display: flex; flex-direction: column; gap: 3px;
  max-width: 65%; min-width: 0;
}
.bubble-group.own .bubble-messages-col { align-items: flex-end; }

.bubble-sender-name {
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
  padding: 0 12px 4px;
}

/* Ligne bulle + actions + heure */
.bubble-wrap {
  display: flex; align-items: flex-end; gap: 4px;
  position: relative;
}
.bubble-group.own .bubble-wrap { flex-direction: row-reverse; }

/* La bulle elle-même */
.bubble {
  padding: 7px 12px 5px;
  font-size: 0.875rem; line-height: 1.55;
  border-radius: 18px;
  min-width: 0;
}
/* pre-wrap uniquement sur le texte — pas sur la bulle entière
   (évite que le whitespace Jinja2 soit rendu comme du contenu) */
.bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Bulle des autres : blanc/gris */
.bubble-group:not(.own) .bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text);
}
.bubble-group:not(.own) .bubble-wrap.last .bubble {
  border-bottom-left-radius: 4px;
}

/* Ma bulle : dorée */
.bubble-group.own .bubble {
  background: var(--primary);
  color: #fff;
}
.bubble-group.own .bubble-wrap.last .bubble {
  border-bottom-right-radius: 4px;
}

/* Images et liens dans les bulles */
.bubble-group.own .msg-img { border-color: rgba(255,255,255,0.3); }
.bubble-group.own .msg-link { color: rgba(255,255,255,0.85); text-decoration-color: rgba(255,255,255,0.5); }

/* Nom de l'auteur dans la bulle */
.bubble-sender-name {
  font-size: 0.72rem; font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 2px;
}

/* Heure intégrée dans la bulle */
.bubble-time-tag {
  font-size: 0.6rem;
  text-align: right;
  margin-top: 3px;
  opacity: 0.55;
  white-space: nowrap;
}
.bubble-group.own .bubble-time-tag { color: rgba(255,255,255,0.7); }
.bubble-group:not(.own) .bubble-time-tag { color: var(--text-muted); }

/* Mention "modifié" */
.bubble-edited {
  font-size: 0.68rem; font-style: italic;
  color: var(--text-muted); padding-left: 4px;
}
.bubble-group.own .bubble-edited { color: rgba(255,255,255,0.6); }

/* Actions (modifier / supprimer) */
.bubble-actions {
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; transition: opacity 0.15s;
  flex-shrink: 0;
}
.bubble-wrap:hover .bubble-actions { opacity: 1; }
.bubble-actions .icon-btn { width: 26px; height: 26px; background: var(--bg-card); }
.bubble-actions .icon-btn svg { width: 12px; height: 12px; }

/* msg-group conservé (compatibilité) */
.msg-group { display: flex; gap: 10px; padding: 4px 6px;
  border-radius: var(--r-sm); align-items: flex-start; position: relative; }
.msg-group.grouped { padding-top: 1px; }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: white;
  margin-top: 1px;
}
.msg-avatar-space {
  width: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.msg-hover-time {
  font-size: 0.65rem; color: var(--text-muted);
  opacity: 0; transition: opacity 0.15s;
  white-space: nowrap;
}
.msg-group:hover .msg-hover-time { opacity: 1; }

.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author { font-size: 0.875rem; font-weight: 700; color: var(--text); }
.msg-time   { font-size: 0.71rem; color: var(--text-muted); }

.msg-content {
  font-size: 0.875rem; color: var(--text-mid);
  line-height: 1.55; word-break: break-word;
  white-space: pre-wrap;
}

/* Images inline dans les messages */
.msg-img-link {
  display: block;
  width: fit-content;
  margin-top: 6px;
}
.msg-img {
  display: block;
  max-width: 360px;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--r);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.msg-img:hover {
  opacity: 0.92;
  box-shadow: var(--shadow-md);
}
.msg-link {
  color: var(--primary);
  text-decoration: underline;
  word-break: break-all;
}
.msg-link:hover { color: var(--primary-dark); }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0, 0, 0, 0.88);
  align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: lbFadeIn 0.18s ease;
}
.lightbox.open { display: flex; }

@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--r-lg);
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.7);
  cursor: default;
  animation: lbZoom 0.2s ease;
}

@keyframes lbZoom {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.lightbox-close {
  position: absolute; top: 18px; right: 18px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  backdrop-filter: blur(4px);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-close svg { width: 17px; height: 17px; }

.msg-deleted-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  font-size: 0.8125rem; color: var(--text-muted);
  font-style: italic;
}
.msg-deleted-row svg { width: 14px; height: 14px; flex-shrink: 0; }

.msg-actions {
  opacity: 0; transition: opacity 0.15s;
  display: flex; gap: 2px; flex-shrink: 0;
}
.msg-group:hover .msg-actions { opacity: 1; }
.msg-actions .icon-btn { width: 26px; height: 26px; }
.msg-actions .icon-btn svg { width: 13px; height: 13px; }

.msg-edited {
  display: block;
  font-size: 0.7rem; color: var(--text-muted);
  font-style: italic; margin-top: 1px;
}

.msg-edit-form { margin-top: 6px; }
.msg-edit-ta {
  width: 100%; box-sizing: border-box;
  padding: 7px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-size: 0.875rem; line-height: 1.55;
  resize: none; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  white-space: pre-wrap; word-break: break-word;
}
.msg-edit-ta:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.msg-edit-btns {
  display: flex; gap: 6px; margin-top: 5px;
}
.btn-edit-save, .btn-edit-cancel {
  padding: 4px 12px;
  border-radius: var(--r); border: none;
  font-size: 0.8rem; cursor: pointer;
  transition: var(--t);
}
.btn-edit-save {
  background: var(--primary); color: #fff;
}
.btn-edit-save:hover { background: var(--primary-dark); }
.btn-edit-cancel {
  background: var(--bg); color: var(--text-mid);
  border: 1px solid var(--border);
}
.btn-edit-cancel:hover { background: var(--bg); }

.messages-empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}
.messages-empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%; background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.messages-empty-icon svg { width: 26px; height: 26px; }
.messages-empty p { font-size: 0.875rem; line-height: 1.6; }

/* ── Chat input ── */
.chat-input-area {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.chat-input-box {
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
  transition: var(--t);
}
.chat-input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
  background: var(--bg-card);
}
.chat-textarea {
  flex: 1; resize: none; border: none; background: none; outline: none;
  font-family: inherit; font-size: 0.875rem; color: var(--text);
  line-height: 1.5; max-height: 120px; min-height: 22px; overflow-y: auto;
}
.chat-textarea::placeholder { color: var(--text-muted); }
.btn-send {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--primary); color: white;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--t);
}
.btn-send:hover { background: var(--primary-dark); }
.btn-send svg { width: 14px; height: 14px; }

.chat-readonly {
  padding: 12px 20px; text-align: center;
  font-size: 0.8125rem; color: var(--text-muted);
  border-top: 1px solid var(--border); background: var(--bg);
  flex-shrink: 0;
}

/* ── Todo panel ── */
.todo-panel {
  width: 264px; flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease, border 0.25s ease;
}
.todo-panel.hidden { width: 0; border-left: none; }

.todo-panel-hd {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.todo-panel-title {
  font-size: 0.875rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn-close-panel {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: var(--r-sm); display: flex;
  align-items: center; transition: var(--t);
}
.btn-close-panel:hover { color: var(--text); background: var(--bg); }
.btn-close-panel svg { width: 15px; height: 15px; }

.todo-list {
  flex: 1; overflow-y: auto; padding: 8px 10px;
}
.todo-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 8px; border-radius: var(--r-sm);
  transition: background 0.15s;
}
.todo-item:hover { background: var(--bg); }
.todo-check {
  width: 15px; height: 15px; margin-top: 2px;
  flex-shrink: 0; accent-color: var(--primary); cursor: pointer;
}
.todo-text {
  flex: 1; font-size: 0.8125rem; color: var(--text); line-height: 1.45;
}
.todo-text.done { text-decoration: line-through; color: var(--text-muted); }
.btn-todo-delete {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 3px;
  border-radius: 4px; display: flex; align-items: center;
  opacity: 0; transition: var(--t); flex-shrink: 0;
}
.todo-item:hover .btn-todo-delete { opacity: 1; }
.btn-todo-delete:hover { color: var(--danger); background: var(--danger-bg); }
.btn-todo-delete svg { width: 12px; height: 12px; }

.todo-empty {
  padding: 28px 16px; text-align: center; color: var(--text-muted);
}
.todo-empty svg { width: 28px; height: 28px; margin-bottom: 8px; opacity: 0.4; }
.todo-empty p { font-size: 0.8125rem; line-height: 1.5; }

.todo-add-form {
  padding: 8px 10px 12px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}
.todo-add-row { display: flex; gap: 6px; align-items: center; }
.todo-add-input {
  flex: 1; padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 0.8125rem; font-family: inherit;
  outline: none; transition: var(--t); color: var(--text);
}
.todo-add-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.12);
}
.btn-todo-add {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--primary-faint); color: var(--primary);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t); flex-shrink: 0;
}
.btn-todo-add:hover { background: var(--primary); color: white; }
.btn-todo-add svg { width: 15px; height: 15px; }

/* No channels empty state */
.chat-empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px;
  color: var(--text-muted);
}
.chat-empty-icon {
  width: 64px; height: 64px;
  border-radius: 50%; background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.chat-empty-icon svg { width: 30px; height: 30px; }
.chat-empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 6px; }
.chat-empty-state p  { font-size: 0.875rem; }

/* ── Channel admin: toggle switch ── */
.toggle-switch {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 0.875rem; color: var(--text-mid);
}
.toggle-switch input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 38px; height: 22px; border-radius: 22px;
  background: var(--border); cursor: pointer;
  transition: var(--t); position: relative; flex-shrink: 0;
}
.toggle-switch input[type="checkbox"]::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; top: 3px; left: 3px;
  transition: var(--t); box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input[type="checkbox"]:checked { background: var(--primary); }
.toggle-switch input[type="checkbox"]:checked::after { left: 19px; }

/* ── Visibility badge ── */
.visibility-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.visibility-badge.public  { background: var(--success-bg); color: #166534; border: 1px solid #BBF7D0; }
.visibility-badge.private { background: var(--warning-bg); color: #92400E; border: 1px solid #FDE68A; }

/* ── Module permissions matrix ── */
.perm-matrix .perm-col-hd {
  text-align: center; width: 100px; white-space: nowrap;
}
.perm-cell {
  text-align: center; vertical-align: middle;
}
.perm-cell input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer; accent-color: var(--primary);
  display: block; margin: auto;
}
.perm-section-row td {
  padding: 8px 16px 4px;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.perm-group-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-muted);
}
.perm-cell-inherited { cursor: help; }
.perm-cb-inherited {
  pointer-events: none;
  opacity: 0.28;
  accent-color: #9CA3AF;
  width: 16px; height: 16px;
  vertical-align: middle;
  display: block; margin: auto;
}
.perm-legend {
  display: flex; align-items: center; gap: 16px;
  margin-left: auto; font-size: 0.78rem; color: var(--text-muted);
}
.perm-legend-item {
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
}
.perm-legend-item input[type="checkbox"] { accent-color: var(--primary); }

/* ── Access table ── */
.access-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.access-table th {
  padding: 7px 10px; text-align: left;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.access-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.access-table tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════════════════════
   INVITÉS & BULLES
   ══════════════════════════════════════════════════════════════ */

.bulles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
  align-items: start;
}

/* Bulle card */
.bulle-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--t);
}
.bulle-card:hover { box-shadow: var(--shadow); }

.bulle-card-hd {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
}
.bulle-type-icon {
  width: 40px; height: 40px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bulle-card-meta { flex: 1; min-width: 0; }
.bulle-card-name { font-size: 0.9375rem; font-weight: 700; color: var(--text); }
.bulle-card-sub  {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-muted); margin-top: 3px;
}
.bulle-card-actions { display: flex; gap: 3px; flex-shrink: 0; }

/* Bulle type colors */
.bulle-couple  { background: #FFF1F2; color: #E11D48; }
.bulle-famille { background: #EFF6FF; color: #1D4ED8; }
.bulle-amis    { background: #F0FDF4; color: #166534; }
.bulle-solo    { background: var(--primary-faint); color: var(--primary-dark); }
.bulle-autre   { background: var(--bg); color: var(--text-muted); }

/* Bulle type badge (text) */
.bulle-type-badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 700;
}
.bulle-type-badge.bulle-couple  { background: #FFE4E8; color: #BE123C; }
.bulle-type-badge.bulle-famille { background: #DBEAFE; color: #1D4ED8; }
.bulle-type-badge.bulle-amis    { background: #DCFCE7; color: #166534; }
.bulle-type-badge.bulle-solo    { background: var(--primary-faint); color: var(--primary-dark); }
.bulle-type-badge.bulle-autre   { background: var(--border-light); color: var(--text-muted); }

/* Guest rows */
.bulle-guests { }
.guest-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
  position: relative;
}
.guest-row:last-child { border-bottom: none; }
.guest-row:hover { background: var(--bg); }
.guest-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: white;
  flex-shrink: 0;
}
.guest-name { flex: 1; font-size: 0.875rem; font-weight: 500; color: var(--text); min-width: 0; }
.guest-row-right {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.guest-actions {
  display: flex; align-items: center; gap: 2px;
  max-width: 0; opacity: 0; overflow: hidden;
  transition: max-width 0.2s ease, opacity 0.15s;
}
.guest-row:hover .guest-actions { max-width: 36px; opacity: 1; }
.guest-actions .icon-btn { width: 26px; height: 26px; }
.guest-actions .icon-btn svg { width: 13px; height: 13px; }

/* Empty and footer */
.bulle-empty {
  padding: 14px 18px;
  font-size: 0.8125rem; color: var(--text-muted);
  font-style: italic;
}
.bulle-card-ft {
  padding: 8px 14px;
  background: #FAFAF8;
  border-top: 1px solid var(--border-light);
}
.btn-add-guest {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8125rem; font-weight: 500;
  color: var(--text-muted); padding: 5px 8px;
  border-radius: var(--r-sm); transition: var(--t);
}
.btn-add-guest:hover { color: var(--primary); background: var(--primary-faint); }

/* RSVP badges */
.rsvp-badge {
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.rsvp-confirmed { background: var(--success-bg); color: #166534; }
.rsvp-pending   { background: #FFFBEB; color: #92400E; }
.rsvp-declined  { background: var(--danger-bg);  color: #991B1B; }
button.rsvp-toggle { border: none; cursor: pointer; transition: opacity 0.15s; }
button.rsvp-toggle:hover { opacity: 0.75; }

.rsvp-popover {
  display: none;
  position: fixed;
  z-index: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  padding: 4px;
  min-width: 148px;
}
.rsvp-pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background 0.1s;
}
.rsvp-pop-item:hover { background: var(--bg); }
.rsvp-pop-item .rsvp-badge { pointer-events: none; }
.rsvp-pop-check {
  width: 13px; height: 13px;
  margin-left: auto;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
}
.rsvp-pop-item.active .rsvp-pop-check { opacity: 1; }

/* Age badges */
.age-badge {
  padding: 2px 7px; border-radius: 20px;
  font-size: 0.68rem; font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.age-enfant { background: #EFF6FF; color: #1D4ED8; }
.age-bebe   { background: #FDF4FF; color: #7E22CE; }

/* Bulle autocomplete guest search */
.bulle-autocomplete-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.bulle-autocomplete-wrap .form-input {
  height: 34px; padding: 6px 10px; font-size: 0.8125rem;
}
.bulle-ac-dropdown {
  position: fixed;   /* attached to body — escapes any overflow:hidden ancestor */
  z-index: 1000;
  background: var(--bg-card);
  border: 1.5px solid var(--primary);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
}
.bulle-ac-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 12px;
  font-size: 0.875rem; color: var(--text);
  cursor: pointer; transition: background 0.1s;
}
.bulle-ac-item:hover { background: var(--primary-faint); }
.bulle-ac-item-sub {
  font-size: 0.75rem; color: var(--text-muted);
  white-space: nowrap; flex-shrink: 0;
}
.bulle-ac-submit:disabled {
  opacity: 0.45; cursor: not-allowed;
}

/* Inline add-member form inside bulle card */
.bulle-add-member {
  padding: 10px 14px;
  background: #FAFAF8;
  border-top: 1px solid var(--border-light);
}
.add-member-inline {
  display: flex; gap: 6px; align-items: center;
}
.add-member-inline .form-input {
  flex: 1; height: 34px; padding: 6px 10px; font-size: 0.8125rem;
}

/* Bulle type picker (radio buttons styled as cards) */
.bulle-type-picker {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.bulle-type-option { cursor: pointer; }
.bulle-type-option input[type="radio"] { display: none; }
.bulle-type-option-inner {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 16px;
  border-radius: var(--r);
  border: 2px solid var(--border);
  font-size: 0.78rem; font-weight: 600; color: var(--text-mid);
  transition: var(--t); min-width: 72px; text-align: center;
}
.bulle-type-option input:checked + .bulle-type-option-inner {
  border-color: var(--primary);
  background: var(--primary-faint);
  color: var(--primary-dark);
}
.bulle-type-option:hover .bulle-type-option-inner {
  border-color: var(--primary-light);
  background: var(--primary-faint);
}

/* ══════════════════════════════════════════════════════════════
   CHAMBRES
   ══════════════════════════════════════════════════════════════ */

/* Toolbar */
.rooms-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.rooms-toolbar-stats {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; color: var(--text-mid);
}
.rooms-toolbar-stats .sep { color: var(--border); }
.rooms-toolbar-actions { display: flex; gap: 8px; }

/* Layout */
.rooms-layout { display: flex; gap: 18px; align-items: flex-start; }
.rooms-main   { flex: 1; min-width: 0; }
.rooms-grid   {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* Room card */
.room-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.room-card.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.18);
}

.room-card-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px;
}
.room-meta   { flex: 1; min-width: 0; }
.room-name   { font-size: 0.9375rem; font-weight: 700; color: var(--text); }
.room-beds   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.room-occ-badge {
  display: flex; align-items: center;
  font-size: 0.8125rem; font-weight: 700; color: var(--text-mid);
  background: var(--bg); padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--border); white-space: nowrap; flex-shrink: 0;
}
.room-occ-badge.full { background: var(--danger-bg); color: var(--danger); border-color: #FECACA; }
.room-occ { color: var(--text); }
.room-cap-sep { margin: 0 2px; opacity: 0.5; }

/* Capacity bar */
.cap-bar { height: 3px; background: var(--border-light); }
.cap-bar-fill {
  height: 100%; background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 0 2px 2px 0;
}
.cap-bar-fill.high { background: var(--warning); }
.cap-bar-fill.full { background: var(--danger); }

/* Room body (drop zone) */
.room-body {
  min-height: 56px; padding: 8px 10px;
  display: flex; flex-wrap: wrap; gap: 5px;
  align-content: flex-start;
}
.room-empty-hint {
  width: 100%; padding: 8px;
  text-align: center; font-size: 0.78rem;
  color: var(--text-muted); opacity: 0.6;
  pointer-events: none;
}

/* Unassigned panel */
.unassigned-panel {
  width: 240px; flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 36px);
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.unassigned-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; font-size: 0.875rem; font-weight: 600;
  color: var(--text); border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.unassigned-count {
  background: var(--primary); color: white;
  font-size: 0.68rem; font-weight: 800;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.unassigned-pool {
  flex: 1; overflow-y: auto;
  padding: 8px;
  display: flex; flex-wrap: wrap; gap: 5px;
  align-content: flex-start;
  min-height: 60px;
  transition: background 0.15s;
}
.unassigned-pool.drag-over { background: var(--primary-faint); }

.pool-empty {
  width: 100%; padding: 20px 10px;
  text-align: center; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.pool-empty p { font-size: 0.8rem; }

/* Guest chips */
.guest-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 9px 3px 3px;
  cursor: grab; user-select: none;
  transition: box-shadow 0.15s, opacity 0.15s, border-color 0.15s;
  max-width: 100%;
}
.guest-chip:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.guest-chip.chip-dragging { opacity: 0.45; cursor: grabbing; }

.chip-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 800; color: white; flex-shrink: 0;
}
.chip-body  { display: flex; flex-direction: column; min-width: 0; }
.chip-name  { font-size: 0.78rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.chip-bulle { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }

/* ── Building / floor grouping in rooms index ── */
.building-section { margin-bottom: 28px; }

.building-section-hd {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9375rem; font-weight: 700; color: var(--text);
  padding: 10px 0 10px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 14px;
}
.building-section-hd svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.building-section-hd-muted { border-color: var(--border); color: var(--text-muted); }
.building-section-hd-muted svg { color: var(--text-muted); }

.floor-section-hd {
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 4px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.floor-section-hd::after {
  content: ''; flex: 1; height: 1px; background: var(--border-light);
}
.floor-section-hd-muted { color: var(--text-muted); opacity: 0.7; }

/* Floor pills on buildings page */
.floor-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 0.8rem; color: var(--text-mid);
}
.floor-pill strong { color: var(--text); font-weight: 600; }
.floor-pill-muted { opacity: 0.6; }

/* Bed counter buttons in room form */
.bed-counter-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 1.1rem; font-weight: 700; color: var(--text-mid);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--t); flex-shrink: 0;
}
.bed-counter-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-faint); }

.capacity-preview {
  padding: 10px 14px; margin-bottom: 16px;
  background: var(--primary-faint); border-radius: var(--r-sm);
  font-size: 0.875rem; color: var(--text-mid);
  border: 1px solid var(--primary-light);
}

/* ══════════════════════════════════════════════════════════════
   BUDGET
   ══════════════════════════════════════════════════════════════ */

/* Global budget card */
.budget-global-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.budget-global-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.budget-global-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); margin-bottom: 6px; }
.budget-global-numbers { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.budget-spent { font-size: 1.625rem; font-weight: 800; color: var(--text); }
.budget-sep   { font-size: 0.875rem; color: var(--text-muted); }
.budget-max   { font-size: 1.25rem; font-weight: 600; color: var(--text-mid); }
.budget-pct   { font-size: 0.9rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--success-bg); color: #166534; }
.budget-pct.pct-warning { background: var(--warning-bg); color: #92400E; }
.budget-pct.pct-danger  { background: var(--danger-bg);  color: #991B1B; }
.budget-reste { font-size: 0.8125rem; color: var(--text-muted); }
.budget-bar-wrap { margin-top: 14px; }
.budget-bar  { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.budget-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.budget-bar-fill.bar-ok      { background: var(--success); }
.budget-bar-fill.bar-warning { background: var(--warning); }
.budget-bar-fill.bar-danger  { background: var(--danger); }
.budget-edit-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-light); }

/* Section header */
.budget-section-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.filter-active-label { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); margin-left: 6px; }

/* Category cards grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.cat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 2px solid var(--border-light);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--t);
  box-shadow: var(--shadow-sm);
  position: relative;
}
.cat-card:hover { box-shadow: var(--shadow); border-color: var(--border); }
.cat-card.active { border-color: var(--cat-color, var(--primary)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color, var(--primary)) 15%, transparent); }
.cat-card-all.active { border-color: var(--primary); }
.cat-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cat-card-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-card-actions { display: flex; gap: 2px; }
.cat-card-name  { font-size: 0.875rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.cat-card-total { font-size: 1.125rem; font-weight: 800; color: var(--text); line-height: 1; }
.cat-card-max   { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.cat-bar { height: 4px; background: var(--border-light); border-radius: 2px; margin: 6px 0 3px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.cat-bar-fill.bar-ok      { background: var(--success); }
.cat-bar-fill.bar-warning { background: var(--warning); }
.cat-bar-fill.bar-danger  { background: var(--danger); }
.cat-bar-fill.bar-neutral { background: var(--primary); }
.cat-card-pct   { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }
.cat-card-pct.pct-warning { color: var(--warning); }
.cat-card-pct.pct-danger  { color: var(--danger); }
.cat-card-count { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }

/* Category badge in table */
.cat-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600;
  background: color-mix(in srgb, var(--cat-color, var(--primary)) 12%, transparent);
  color: color-mix(in srgb, var(--cat-color, var(--primary)) 70%, #000);
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--primary)) 25%, transparent);
}
.cat-badge-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Info date+statut visible uniquement sur mobile (masquée par défaut) */
.expense-mobile-meta { display: none; }

/* Expense status badges */
.expense-status {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.status-devis   { background: var(--info-bg);    color: #1E40AF; }
.status-acompte { background: var(--warning-bg); color: #92400E; }
.status-facture { background: var(--success-bg); color: #166534; }

/* Color swatch picker */
.color-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatch { cursor: pointer; }
.color-swatch input[type="radio"] { display: none; }
.swatch-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: block;
  border: 3px solid transparent;
  transition: var(--t);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.color-swatch input:checked + .swatch-dot { border-color: white; outline: 2px solid #1a1625; }
.color-swatch:hover .swatch-dot { transform: scale(1.15); }

/* ══════════════════════════════════════════════════════════════
   PERMISSIONS MATRIX
   ══════════════════════════════════════════════════════════════ */

.perm-legend {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.8125rem; color: var(--text-mid);
}
.perm-legend-item { display: flex; align-items: center; gap: 5px; }

.perm-matrix .perm-col-hd { text-align: center; min-width: 80px; }

.perm-section-row td {
  background: var(--bg); color: var(--text-muted);
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 8px 16px;
}

.perm-cell { text-align: center; }
.perm-cell-inherited { background: var(--primary-faint); }
.perm-cell-inherited input { accent-color: var(--primary-light); opacity: 0.7; }
.perm-cb-direct { accent-color: var(--primary); cursor: pointer; width: 15px; height: 15px; }
.perm-cb-inherited { accent-color: var(--primary-light); cursor: default; width: 15px; height: 15px; }

.perm-group-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-faint); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Dashboard stat sub-label ── */
.stat-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════
   REGISTRATIONS (admin page)
   ══════════════════════════════════════════════════════════════ */

.reg-settings-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-bottom: 28px;
}
.reg-settings-left { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.reg-settings-icon {
  width: 44px; height: 44px; border-radius: var(--r);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.reg-settings-icon svg { width: 22px; height: 22px; }
.reg-icon-open    { background: var(--success-bg); color: #166534; }
.reg-icon-closed  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.reg-settings-title {
  font-size: 0.9375rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.reg-settings-desc { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.5; }

.reg-status-badge {
  font-size: 0.68rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.reg-status-open   { background: var(--success-bg); color: #166534; border: 1px solid #BBF7D0; }
.reg-status-closed { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.reg-section-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}

.reg-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: var(--primary); color: #fff;
  font-size: 0.72rem; font-weight: 800; margin-left: 6px;
}

/* Approve / Reject buttons */
.btn-reg-approve {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--r-sm);
  border: none; cursor: pointer; font-size: 0.8125rem; font-weight: 600;
  background: var(--success-bg); color: #166534;
  transition: var(--t); font-family: inherit;
}
.btn-reg-approve:hover { background: #BBF7D0; }
.btn-reg-approve svg { width: 13px; height: 13px; }

.btn-reg-reject {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--r-sm);
  border: none; cursor: pointer; font-size: 0.8125rem; font-weight: 600;
  background: var(--danger-bg); color: #991B1B;
  transition: var(--t); font-family: inherit;
}
.btn-reg-reject:hover { background: #FECACA; }
.btn-reg-reject svg { width: 13px; height: 13px; }

/* Invite status badges */
.invite-status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.invite-active    { background: var(--success-bg); color: #166534; }
.invite-disabled  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.invite-expired   { background: var(--warning-bg); color: #92400E; }
.invite-exhausted { background: var(--info-bg); color: #1E40AF; }

/* Copy link button */
.btn-copy-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: none;
  color: var(--text-mid); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: var(--t); font-family: inherit;
}
.btn-copy-link:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-faint); }

/* Registration pending confirmation */
.pending-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 2px solid #BBF7D0;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  color: #166634;
}
.pending-icon svg { width: 36px; height: 36px; }

/* Registration invite banner */
.reg-invite-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 20px;
  background: var(--primary-faint);
  border: 1px solid var(--primary-light);
  border-radius: var(--r-sm);
  font-size: 0.875rem; color: var(--text-mid);
}
.reg-invite-banner svg { width: 16px; height: 16px; color: var(--primary); flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

/* ─ Sidebar collapse (tablette/mobile) ──────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .main-content  { margin-left: 0; }
  .topbar-toggle { display: flex; }
}

/* ─ Tablette paysage (≤ 900px) ───────────────────────────────── */
@media (max-width: 900px) {
  .rooms-layout      { flex-direction: column; }
  .unassigned-panel  { width: 100%; max-height: 200px; position: static; }

  .budget-global-top { flex-direction: column; align-items: flex-start; gap: 12px; }

  .reg-settings-card { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ─ Mobile (≤ 700px) ────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Login / register */
  .login-left  { display: none; }
  .login-right { width: 100%; padding: 36px 24px; }

  /* Layout général */
  .page-content { padding: 16px 14px; }
  .topbar       { padding: 0 14px; gap: 10px; }
  .topbar-title { font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Dashboard */
  .stats-grid   { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .modules-grid { grid-template-columns: 1fr; }
  .welcome-banner { padding: 20px; }
  .welcome-name { font-size: 1.25rem; }

  /* Toolbar recherche */
  .page-toolbar  { flex-wrap: wrap; gap: 8px; }
  .search-box    { max-width: none; flex: 1 1 100%; order: -1; }

  /* Tables */
  .data-table th,
  .data-table td { padding: 9px 10px; font-size: 0.8125rem; }

  /* Formulaires */
  .form-grid         { grid-template-columns: 1fr; }
  .form-grid .full   { grid-column: 1; }
  .form-card         { padding: 18px 16px; }
  .admin-split       { grid-template-columns: 1fr !important; }

  /* Grilles de cartes */
  .bulles-grid { grid-template-columns: 1fr; }
  .groups-grid { grid-template-columns: 1fr; }
  .rooms-grid  { grid-template-columns: 1fr; }

  /* Rooms toolbar */
  .rooms-toolbar         { flex-direction: column; align-items: flex-start; }
  .rooms-toolbar-actions { flex-wrap: wrap; }

  /* Budget */
  .cat-grid              { grid-template-columns: repeat(2, 1fr); }
  .budget-section-hd     { flex-wrap: wrap; }
  .budget-spent          { font-size: 1.25rem; }
  .budget-max            { font-size: 1rem; }

  /* Table dépenses : masquer Date et Statut, afficher l'info inline */
  .col-date, .col-status { display: none; }
  .expense-mobile-meta   { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

  /* Catégorie dans la table : badge plus compact */
  .col-cat .cat-badge    { font-size: 0.72rem; padding: 1px 6px; }

  /* ── Chat : barre de channels horizontale + plein écran ── */

  /* page-content devient le conteneur plein-hauteur */
  .page-content.no-pad {
    height: calc(100vh - var(--topbar-h));
    height: calc(100dvh - var(--topbar-h));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
  }

  /* chat-layout remplit l'espace restant (height:0 + flex:1 = remplit sans dépasser) */
  .chat-layout {
    flex: 1;
    height: 0;
    flex-direction: column;
    overflow: hidden;
  }

  /* Sidebar → barre de pills horizontale */
  .chat-sidebar {
    width: 100%;
    height: auto;
    flex-shrink: 0;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
  }
  .chat-sidebar-hd { display: none; }
  .chat-sidebar-ft { display: none; }

  .channel-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    gap: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .channel-list::-webkit-scrollbar { display: none; }
  .channel-group-label { display: none; }

  .channel-item {
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 5px 14px;
    margin-bottom: 0;
    font-size: 0.8125rem;
    background: var(--bg);
  }
  .channel-item.active {
    background: var(--primary-faint);
    border-color: var(--primary-light);
    color: var(--primary-dark);
  }

  /* Zone principale : flex:1 + min-height:0 → clé pour que les enfants ne débordent pas */
  .chat-main   { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

  /* Header compact */
  .chat-header       { padding: 8px 14px; flex-shrink: 0; }
  .chat-channel-desc { display: none; }
  .btn-todo-toggle   { display: none; }

  /* Messages : flex:1 déjà défini desktop, reset max-height */
  .messages-area { max-height: none; padding: 10px 14px; }

  /* Saisie */
  .chat-input-area { padding: 8px 12px 12px; flex-shrink: 0; }
  .chat-readonly   { padding: 10px 14px; flex-shrink: 0; }

  /* Todo panel masqué */
  .todo-panel { display: none; }

  /* Inscriptions */
  .reg-settings-card  { flex-direction: column; align-items: flex-start; gap: 14px; }
  .btn-reg-approve,
  .btn-reg-reject     { padding: 5px 8px; font-size: 0.75rem; }
}

/* ─ Petit mobile (≤ 480px) ──────────────────────────────────── */
@media (max-width: 480px) {
  .page-content  { padding: 12px 10px; }
  .topbar        { padding: 0 10px; }
  .login-right   { padding: 28px 18px; }

  .stats-grid    { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card     { padding: 14px; }
  .stat-val      { font-size: 1.4rem; }

  .cat-grid      { grid-template-columns: 1fr; }
  .form-card     { padding: 16px 14px; }

  .bulle-card-hd { flex-wrap: wrap; gap: 8px; }

  /* Rooms chips plus compactes */
  .chip-name  { font-size: 0.72rem; }
  .chip-bulle { display: none; }

  /* Action buttons */
  .action-btns { gap: 1px; }
  .icon-btn    { width: 28px; height: 28px; }
}
