/* ============================================================
   PILOT MANAGER — Design System
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Palette violette */
  --color-primary:        #6A0DAD;
  --color-primary-dark:   #4A0080;
  --color-primary-deeper: #36005C;
  --color-primary-hover:  #7B18C2;
  --color-primary-light:  #9B59B6;
  --color-primary-pale:   #D8B4FE;
  --color-primary-soft:   #EDE9FE;

  /* Fonds */
  --color-bg:             #F5F0FF;
  --color-bg-lavender:    #EDE9FE;
  --color-bg-card:        #FFFFFF;
  --color-bg-sidebar:     linear-gradient(180deg, #4A0080 0%, #6A0DAD 50%, #7B18C2 100%);

  /* Textes */
  --color-text:           #1E0A3C;
  --color-text-muted:     #6B5B95;
  --color-text-light:     #9B8EC4;
  --color-text-white:     #FFFFFF;

  /* Bordures */
  --color-border:         #E2D9F3;
  --color-border-focus:   #9B59B6;

  /* États */
  --color-success:        #059669;
  --color-success-bg:     #D1FAE5;
  --color-error:          #DC2626;
  --color-error-bg:       #FEE2E2;
  --color-warning:        #D97706;
  --color-warning-bg:     #FEF3C7;

  /* Danger */
  --color-danger:         #B91C1C;
  --color-danger-hover:   #991B1B;

  /* Ombres */
  --shadow-xs:   0 1px 2px rgba(106, 13, 173, 0.06);
  --shadow-sm:   0 2px 8px rgba(106, 13, 173, 0.1);
  --shadow-md:   0 4px 16px rgba(106, 13, 173, 0.12);
  --shadow-lg:   0 8px 32px rgba(106, 13, 173, 0.15);
  --shadow-xl:   0 16px 48px rgba(106, 13, 173, 0.2);

  /* Géométrie */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Sidebar */
  --sidebar-width: 248px;

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--color-bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(74, 0, 128, 0.25);
  transition: width var(--transition-slow);
}

/* ── Sidebar collapse toggle (desktop) ───────────────────────── */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 28px;
  right: -13px;
  width: 26px;
  height: 26px;
  background: #fff;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary-pale);
  border-radius: 50%;
  cursor: pointer;
  z-index: 101;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.sidebar-collapse-btn:hover {
  background: var(--color-primary-soft);
  transform: scale(1.08);
}
.sidebar-collapse-btn svg {
  transition: transform var(--transition);
}

html.sidebar-collapsed .sidebar {
  width: 76px;
}

html.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

html.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 24px 12px 20px;
}

html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .nav-item span,
html.sidebar-collapsed .user-details {
  display: none;
}

html.sidebar-collapsed .nav-item {
  justify-content: center;
}

html.sidebar-collapsed .nav-item.active::after {
  display: none;
}

html.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  gap: 10px;
}

html.sidebar-collapsed .sidebar ~ .main-content {
  margin-left: 76px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.brand-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand-sub {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
  margin-top: 1px;
}

/* Nav items */
.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity var(--transition);
}

.nav-item:hover::before { opacity: 1; }
.nav-item:hover { color: rgba(255,255,255,0.95); }

.nav-item.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: rgba(255,255,255,0.8);
  border-radius: 3px 0 0 3px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-details { min-width: 0; }
.user-name {
  display: block;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  display: block;
  color: rgba(255,255,255,0.55);
  font-size: 0.7rem;
}

.logout-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  padding: 8px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logout-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  /* Flex item : sans min-width 0, la largeur min-content des tableaux
     empêche le rétrécissement et fait déborder la page entière. */
  min-width: 0;
  padding: 32px 36px;
  min-height: 100vh;
  background: var(--color-bg);
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-title .highlight {
  color: var(--color-primary);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Mode badges ──────────────────────────────────────────── */
.mode-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-demo {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.badge-live {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Stats Grid ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-pale);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-bg-lavender));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.stat-card-icon svg { width: 22px; height: 22px; }

.stat-card-body {
  flex: 1;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.stat-card-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.stat-card-trend.up {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* ── Last Action Banner ───────────────────────────────────── */
.last-action-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--color-primary-soft), #F0E6FF);
  border: 1px solid var(--color-primary-pale);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.85rem;
  color: var(--color-primary);
  margin-bottom: 24px;
}

/* ── Section Card ─────────────────────────────────────────── */
.section-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(135deg, #FDFBFF, var(--color-bg));
}

.section-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.section-card-count {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Data Table ───────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead tr {
  background: linear-gradient(135deg, #F8F4FF, var(--color-bg-lavender));
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.table-row:last-child td {
  border-bottom: none;
}

.table-row:hover {
  background: linear-gradient(135deg, #FDFBFF, var(--color-primary-soft));
}

.table-row:nth-child(even) {
  background: #FDFBFF;
}
.table-row:nth-child(even):hover {
  background: linear-gradient(135deg, #FDFBFF, var(--color-primary-soft));
}

.table-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ── Cell types ───────────────────────────────────────────── */
.cell-date-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.date-badge {
  font-size: 0.78rem;
  color: var(--color-text);
  font-weight: 500;
}

.time-text {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.cell-muted { color: var(--color-text-muted); }

/* ── User pill ────────────────────────────────────────────── */
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Action badges ────────────────────────────────────────── */
.action-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.action-move_member   { background: #EDE9FE; color: #5B21B6; }
.action-rename_group  { background: #DBEAFE; color: #1D4ED8; }
.action-create_group  { background: #D1FAE5; color: #065F46; }
.action-delete_group  { background: #FEE2E2; color: #991B1B; }
.action-assign_leader { background: #FEF3C7; color: #92400E; }

/* ── Role badges ──────────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.role-admin  { background: #EDE9FE; color: #5B21B6; }
.role-pilot  { background: #DBEAFE; color: #1D4ED8; }
.role-leader { background: #FEF3C7; color: #92400E; }
.role-member { background: var(--color-bg-lavender); color: var(--color-text-muted); }

/* ── Member name cell ─────────────────────────────────────── */
.member-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.member-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-primary-soft), var(--color-bg-lavender));
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
  border: 1.5px solid var(--color-primary-pale);
}

/* ── Group chip ───────────────────────────────────────────── */
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── Count badge ──────────────────────────────────────────── */
.count-badge {
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* ── Checkbox ─────────────────────────────────────────────── */
.checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ── Toast notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 300ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  max-width: 380px;
}

.toast-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.toast-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg-lavender);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: blobFloat 8s ease-in-out infinite;
}

.blob-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #8B2FC9, #6A0DAD);
  top: -100px; left: -100px;
  animation-delay: 0s;
}

.blob-2 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #CE93D8, #9B59B6);
  bottom: -80px; right: -80px;
  animation-delay: -3s;
}

.blob-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, #D8B4FE, #A78BFA);
  top: 50%; left: 60%;
  animation-delay: -6s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.login-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 40px;
  border: 1px solid rgba(155, 89, 182, 0.15);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.5) inset;
  animation: cardFadeIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  animation: logoSpin 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 100ms both;
}

@keyframes logoSpin {
  from { transform: rotate(-20deg) scale(0.6); opacity: 0; }
  to   { transform: rotate(0) scale(1); opacity: 1; }
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.03em;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.login-alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 16px;
  font-weight: 500;
}

.login-alert-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.login-alert-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.login-footer-links {
  text-align: center;
  margin-top: 16px;
}

.forgot-link {
  color: var(--color-primary-light);
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}
.forgot-link:hover { color: var(--color-primary); text-decoration: underline; }

.login-demo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding: 8px 14px;
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.required { color: var(--color-error); }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--color-text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-bg-card);
  transition: all var(--transition);
  outline: none;
  appearance: none;
}

.input-wrapper .form-input {
  padding-left: 42px;
}

.form-input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15);
}

.form-input::placeholder { color: var(--color-text-light); }

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

.form-select {
  padding-right: 32px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B5B95' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.toggle-password:hover { color: var(--color-primary); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary-hover), var(--color-primary));
  color: #fff;
  box-shadow: 0 2px 8px rgba(106, 13, 173, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  box-shadow: 0 4px 16px rgba(106, 13, 173, 0.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary-pale);
}
.btn-outline:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-light);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--color-bg-lavender);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover {
  background: var(--color-danger-hover);
  transform: translateY(-1px);
}

.btn-danger-outline {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.btn-danger-outline:hover {
  background: var(--color-danger);
  color: #fff;
}

.btn-sm  { padding: 6px 13px; font-size: 0.82rem; }
.btn-xs  { padding: 4px 10px; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-login {
  padding: 12px 18px;
  font-size: 0.95rem;
  margin-top: 4px;
  box-shadow: 0 4px 16px rgba(106, 13, 173, 0.4);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Split Layout (Groups page) ───────────────────────────── */
.split-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

.split-panel {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(135deg, #FDFBFF, var(--color-bg));
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ── Groups List ──────────────────────────────────────────── */
.groups-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
}

.group-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition);
  border: 1.5px solid transparent;
  position: relative;
}

.group-card:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-pale);
}

.group-card-active {
  background: linear-gradient(135deg, var(--color-primary-soft), #F0E6FF);
  border-color: var(--color-primary-pale);
}

.group-card-body {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.group-card-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.group-card-info { min-width: 0; }

.group-card-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-card-count {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 1px;
}

.group-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.group-card:hover .group-card-actions { opacity: 1; }

.icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.icon-btn-edit {
  background: var(--color-bg-lavender);
  color: var(--color-primary);
}
.icon-btn-edit:hover {
  background: var(--color-primary);
  color: #fff;
}

.icon-btn-delete {
  background: var(--color-error-bg);
  color: var(--color-error);
}
.icon-btn-delete:hover {
  background: var(--color-error);
  color: #fff;
}

/* ── Detail Header ────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

.detail-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.detail-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Leader Card ──────────────────────────────────────────── */
.leader-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #FDFBFF, var(--color-primary-soft));
  border-bottom: 1px solid var(--color-border);
}

.leader-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  color: #D97706;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.leader-info { flex: 1; }

.leader-label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.leader-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2px;
}

/* ── Toolbar (Pilots page) ────────────────────────────────── */
.toolbar {
  margin-bottom: 20px;
}

.toolbar-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-bg-card);
  transition: all var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
}

.filter-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-select {
  min-width: 200px;
}

/* ── Actions cell ─────────────────────────────────────────── */
.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 40px;
  color: var(--color-text-muted);
  text-align: center;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 300px;
}

.empty-state-sm {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 10, 60, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: overlayFadeIn 200ms ease forwards;
}

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

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 300ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  overflow: hidden;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(135deg, #FDFBFF, var(--color-bg));
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.danger-title { color: var(--color-danger); }

.modal-close {
  background: var(--color-bg-lavender);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.modal-form {
  padding: 24px;
}

.modal-body {
  padding: 20px 24px;
}

.modal-text {
  font-size: 0.875rem;
  color: var(--color-text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

/* Danger notice */
.danger-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--color-error-bg);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--color-error);
  font-size: 0.875rem;
}

.danger-notice svg { flex-shrink: 0; margin-top: 1px; }

/* ── Mobile topbar ────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--color-bg-sidebar);
  padding: 14px 16px;
  box-shadow: 0 2px 12px rgba(74, 0, 128, 0.2);
}

.mobile-menu-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-topbar-title {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-close-btn {
  display: none;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 6px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 5, 40, 0.5);
  z-index: 99;
}

.sidebar-backdrop.open {
  display: block;
  animation: overlayFadeIn 200ms ease forwards;
}

/* ── Scrollbar styling ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
  background: var(--color-primary-pale);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-primary-light); }

/* ============================================================
   RESPONSIVE — Mobile & tablette
   ============================================================ */
@media (max-width: 900px) {
  .mobile-topbar { display: flex; }

  .sidebar-close-btn { display: flex; }

  .sidebar-collapse-btn { display: none; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    z-index: 200;
    width: min(280px, 85vw) !important;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .main-content,
  html.sidebar-collapsed .sidebar ~ .main-content {
    margin-left: 0;
    padding: 20px 16px 32px;
  }

  html.sidebar-collapsed .sidebar-brand-text,
  html.sidebar-collapsed .nav-item span,
  html.sidebar-collapsed .user-details {
    display: revert;
  }

  html.sidebar-collapsed .sidebar-brand,
  html.sidebar-collapsed .nav-item,
  html.sidebar-collapsed .sidebar-footer {
    justify-content: initial;
    flex-direction: row;
    padding: revert;
  }

  .app-layout {
    flex-direction: column;
  }
}

@media (min-width: 901px) {
  .sidebar-backdrop { display: none !important; }
}

@media (max-width: 720px) {
  body { overflow-x: hidden; }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .btn { width: 100%; justify-content: center; }

  .section-card-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .section-card-header .btn {
    width: 100%;
    justify-content: center;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-title { font-size: 1.4rem; }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .groups-list {
    max-height: 320px;
  }

  .toolbar-form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrapper { min-width: 0; }

  .filter-wrapper { width: 100%; }
  .filter-select { width: 100%; min-width: 0; }

  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 10px 12px; }

  .actions-cell {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .modal {
    max-width: none;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
  }

  .modal-overlay { padding: 12px; align-items: flex-end; }

  .modal-form { padding: 18px; }

  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast { max-width: none; }

  .detail-header, .leader-card {
    flex-direction: column;
    align-items: stretch;
  }

  .login-card { padding: 28px 22px; }

  .member-attendance-row {
    padding: 14px 16px;
  }

  .status-toggle {
    flex-basis: 100%;
    justify-content: stretch;
  }

  .status-toggle label {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
  }

  .rate-cell {
    min-width: 90px;
  }
}

@media (max-width: 480px) {
  .btn { padding: 10px 14px; font-size: 0.85rem; }
  .btn-xs { padding: 7px 11px; font-size: 0.78rem; min-height: 32px; }

  .form-input { padding: 11px 14px; font-size: 0.9rem; }
  .input-wrapper .form-input { padding-left: 42px; }
}
