/* ============================================================
   ALICE Design System — Les Erudits / SmartFormation
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- CSS Variables --- */
:root {
  /* Colors — Primary */
  --violet-deep: #251A4D;
  --violet-vif: #6D5AE6;
  --violet-hover: #5B48D4;
  --violet-light: #EDE8FF;
  --violet-subtle: #F5F3FF;

  /* Colors — Backgrounds */
  --papier: #FAF8F4;
  --white: #FFFFFF;
  --bg-card: #FFFFFF;

  /* Colors — Semantic */
  --safran: #D99A2B;
  --safran-light: #FFF8EB;
  --safran-border: #F0D9A0;
  --vert: #4C8F6E;
  --vert-light: #E8F5EE;
  --vert-border: #A8D5BD;
  --rouge: #C4553B;
  --rouge-light: #FDEEE9;
  --rouge-border: #E8A99A;
  --bleu: #3B82C4;
  --bleu-light: #EBF3FD;
  --orange: #E68E2A;
  --orange-light: #FFF3E0;

  /* Colors — Neutrals */
  --gray-50: #FAFAF9;
  --gray-100: #F5F4F1;
  --gray-200: #E8E6E1;
  --gray-300: #D4D1CA;
  --gray-400: #A8A49C;
  --gray-500: #7C7870;
  --gray-600: #5C5850;
  --gray-700: #3D3A34;
  --gray-800: #2A2824;
  --gray-900: #1A1816;

  /* Typography */
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font sizes */
  --text-xs: 0.6875rem;    /* 11px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 0.9375rem;  /* 15px */
  --text-md: 1rem;         /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.3125rem;    /* 21px */
  --text-2xl: 1.625rem;    /* 26px */
  --text-3xl: 2rem;        /* 32px */
  --text-4xl: 2.5rem;      /* 40px */

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(37, 26, 77, 0.04);
  --shadow-sm: 0 1px 3px rgba(37, 26, 77, 0.06), 0 1px 2px rgba(37, 26, 77, 0.04);
  --shadow-md: 0 4px 12px rgba(37, 26, 77, 0.07), 0 1px 3px rgba(37, 26, 77, 0.04);
  --shadow-lg: 0 8px 24px rgba(37, 26, 77, 0.09), 0 2px 6px rgba(37, 26, 77, 0.04);
  --shadow-xl: 0 16px 48px rgba(37, 26, 77, 0.12), 0 4px 12px rgba(37, 26, 77, 0.06);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: var(--papier);
  line-height: 1.6;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  color: var(--violet-deep);
}

h1 { font-size: var(--text-4xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-3xl); letter-spacing: -0.015em; }
h3 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }

code, .mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

a {
  color: var(--violet-vif);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--violet-hover); }

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-8);
  min-height: 100vh;
  background: var(--papier);
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--violet-deep);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: var(--space-6) var(--space-6) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--violet-vif);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-logo .logo-text {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  color: white;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.65);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: var(--violet-vif);
  color: white;
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  min-width: 22px;
  text-align: center;
}

.nav-item.active .nav-badge {
  background: rgba(255,255,255,0.25);
  color: white;
}

.sidebar-user {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

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

.sidebar-user .user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
}

.sidebar-user .user-menu {
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 18px;
}

/* --- Avatar --- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
  color: white;
}
.avatar.sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar.lg { width: 44px; height: 44px; font-size: var(--text-md); }
.avatar.xl { width: 56px; height: 56px; font-size: var(--text-lg); }

.avatar-violet { background: var(--violet-vif); }
.avatar-vert { background: var(--vert); }
.avatar-safran { background: var(--safran); }
.avatar-rouge { background: var(--rouge); }
.avatar-bleu { background: var(--bleu); }
.avatar-gray { background: var(--gray-400); }

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.avatar-group {
  display: flex;
}
.avatar-group .avatar {
  border: 2px solid var(--white);
  margin-left: -8px;
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* --- Page Header --- */
.page-header {
  margin-bottom: var(--space-8);
}

.page-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--gray-500);
  margin-bottom: var(--space-3);
}

.page-header .breadcrumb a {
  color: var(--gray-500);
}
.page-header .breadcrumb a:hover {
  color: var(--violet-vif);
}

.page-header .breadcrumb .sep {
  color: var(--gray-300);
}

.page-header .page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: var(--space-6);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-flat {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: var(--space-6);
}

.card-elevated {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
}

/* --- KPI Cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-card .kpi-label {
  font-size: var(--text-sm);
  color: var(--gray-500);
  font-weight: 500;
}

.kpi-card .kpi-value {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1;
}

.kpi-card .kpi-trend {
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.kpi-card.kpi-vert .kpi-value { color: var(--vert); }
.kpi-card.kpi-vert { border-left: 3px solid var(--vert); }
.kpi-card.kpi-violet .kpi-value { color: var(--violet-vif); }
.kpi-card.kpi-violet { border-left: 3px solid var(--violet-vif); }
.kpi-card.kpi-bleu .kpi-value { color: var(--bleu); }
.kpi-card.kpi-bleu { border-left: 3px solid var(--bleu); }
.kpi-card.kpi-safran .kpi-value { color: var(--safran); }
.kpi-card.kpi-safran { border-left: 3px solid var(--safran); }
.kpi-card.kpi-rouge .kpi-value { color: var(--rouge); }
.kpi-card.kpi-rouge { border-left: 3px solid var(--rouge); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-violet { background: var(--violet-light); color: var(--violet-vif); }
.badge-vert { background: var(--vert-light); color: var(--vert); }
.badge-rouge { background: var(--rouge-light); color: var(--rouge); }
.badge-safran { background: var(--safran-light); color: var(--safran); }
.badge-bleu { background: var(--bleu-light); color: var(--bleu); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }
.badge-dark { background: var(--violet-deep); color: white; }

/* Qualiopi marker */
.badge-qualiopi {
  background: var(--safran-light);
  color: var(--safran);
  border: 1px solid var(--safran-border);
}
.badge-qualiopi::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--safran);
}

/* Status badges */
.status-planifie { background: var(--vert-light); color: var(--vert); }
.status-realise { background: var(--violet-light); color: var(--violet-vif); }
.status-en-cours { background: var(--bleu-light); color: var(--bleu); }
.status-termine { background: var(--vert-light); color: var(--vert); }
.status-brouillon { background: var(--gray-100); color: var(--gray-600); }
.status-retard { background: var(--rouge-light); color: var(--rouge); }
.status-attente { background: var(--safran-light); color: var(--safran); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--violet-vif);
  color: white;
}
.btn-primary:hover {
  background: var(--violet-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--violet-deep);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover {
  border-color: var(--violet-vif);
  color: var(--violet-vif);
  background: var(--violet-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}
.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

.btn-danger {
  background: var(--rouge-light);
  color: var(--rouge);
}
.btn-danger:hover {
  background: var(--rouge);
  color: white;
}

.btn-success {
  background: var(--vert);
  color: white;
}
.btn-success:hover {
  background: #3d7a5b;
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-md);
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}
.btn-icon.sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

/* --- Form Elements --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
}

.form-label .required {
  color: var(--rouge);
}

.form-input,
.form-select,
.form-textarea {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
  outline: none;
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--violet-vif);
  box-shadow: 0 0 0 3px rgba(109, 90, 230, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--gray-400);
}

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

.form-hint {
  font-size: var(--text-xs);
  color: var(--gray-500);
}

/* --- Search Bar --- */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  transition: border-color var(--duration-fast);
}

.search-bar:focus-within {
  border-color: var(--violet-vif);
  box-shadow: 0 0 0 3px rgba(109, 90, 230, 0.08);
}

.search-bar .search-icon {
  color: var(--gray-400);
  font-size: 16px;
  flex-shrink: 0;
}

.search-bar input {
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--gray-800);
  background: transparent;
  flex: 1;
}
.search-bar input::placeholder {
  color: var(--gray-400);
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  background: var(--white);
}

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

thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--gray-50);
}

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--violet-vif);
  transition: width var(--duration-slow) var(--ease-out);
}

.progress-bar .progress-fill.fill-vert { background: var(--vert); }
.progress-bar .progress-fill.fill-safran { background: var(--safran); }
.progress-bar .progress-fill.fill-rouge { background: var(--rouge); }

.progress-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  font-weight: 500;
  margin-top: var(--space-1);
}

/* --- Tabs --- */
.tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: var(--space-6);
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--duration-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tab:hover {
  color: var(--gray-800);
}

.tab.active {
  color: var(--violet-vif);
  border-bottom-color: var(--violet-vif);
  font-weight: 600;
}

.tab .tab-count {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.tab.active .tab-count {
  background: var(--violet-light);
  color: var(--violet-vif);
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
}

.empty-state .empty-illustration {
  width: 160px;
  height: 120px;
  background: var(--gray-100);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--gray-300);
}

.empty-state .empty-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.empty-state .empty-text {
  font-size: var(--text-sm);
  color: var(--gray-500);
  max-width: 360px;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37, 26, 77, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h4 {
  font-family: var(--font-serif);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background var(--duration-fast);
}
.modal-close:hover {
  background: var(--gray-200);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--gray-200);
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.filter-chip:hover {
  border-color: var(--violet-vif);
  color: var(--violet-vif);
}

.filter-chip.active {
  background: var(--violet-light);
  border-color: var(--violet-vif);
  color: var(--violet-vif);
  font-weight: 600;
}

/* --- Donut / Chart placeholders --- */
.chart-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: var(--text-sm);
  border: 1px dashed var(--gray-200);
}

.donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-label {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--gray-800);
}

/* --- Kanban --- */
.kanban-board {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-700);
}

.kanban-column-header .count {
  background: var(--gray-200);
  color: var(--gray-600);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}

.kanban-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: grab;
  transition: box-shadow var(--duration-fast);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
}

.kanban-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--gray-500);
}

/* --- AI Feature Markers --- */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: linear-gradient(135deg, #EDE8FF 0%, #E8F5EE 100%);
  color: var(--violet-vif);
  border: 1px solid rgba(109, 90, 230, 0.15);
}

.ai-badge::before {
  content: '\2728';
  font-size: 10px;
}

.ai-panel {
  background: linear-gradient(180deg, #F9F7FF 0%, #F5F3FF 100%);
  border: 1px solid rgba(109, 90, 230, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.ai-panel .ai-panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--violet-vif);
}

.ai-suggestion {
  background: var(--white);
  border: 1px solid rgba(109, 90, 230, 0.1);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.ai-suggestion:last-child {
  margin-bottom: 0;
}

.ai-suggestion .suggestion-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--gray-800);
  margin-bottom: var(--space-1);
}

.ai-suggestion .suggestion-desc {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-bottom: var(--space-3);
}

.ai-suggestion .suggestion-actions {
  display: flex;
  gap: var(--space-2);
}

/* --- Master-Detail Layout --- */
.master-detail {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: var(--space-4);
  min-height: 600px;
}

.master-list {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  overflow-y: auto;
  max-height: 75vh;
}

.master-list-item {
  padding: var(--space-4);
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.master-list-item:hover {
  background: var(--gray-50);
}

.master-list-item.active {
  background: var(--violet-subtle);
  border-left: 3px solid var(--violet-vif);
}

.detail-panel {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  padding: var(--space-6);
  overflow-y: auto;
  max-height: 75vh;
}

/* --- Tooltip --- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.tooltip:hover::after {
  opacity: 1;
}

/* --- Utility Classes --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-serif { font-family: var(--font-serif); }
.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-violet { color: var(--violet-vif); }
.text-vert { color: var(--vert); }
.text-rouge { color: var(--rouge); }
.text-safran { color: var(--safran); }
.bg-papier { background: var(--papier); }
.bg-white { background: var(--white); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.w-full { width: 100%; }
.hidden { display: none; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; top: 0; z-index: 10; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .main-content {
    margin-left: 0;
    padding: var(--space-4);
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .master-detail {
    grid-template-columns: 1fr;
  }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kanban-board {
    flex-direction: column;
  }
  .kanban-column {
    min-width: unset;
    max-width: unset;
  }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
