/* ═══════════════════════════════════════════════════════════════════════════
   OUTIL RH – DESIGN SYSTEM MODERNE
   Inspiration : Linear, Vercel, Notion, Stripe Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ─── Palette principale ─── */
  --primary-50:  #EEF2FF;
  --primary-100: #E0E7FF;
  --primary-200: #C7D2FE;
  --primary-300: #A5B4FC;
  --primary-400: #818CF8;
  --primary-500: #6366F1;
  --primary-600: #4F46E5;
  --primary-700: #4338CA;
  --primary-800: #3730A3;
  --primary-900: #312E81;

  /* ─── Accents ─── */
  --emerald:    #10B981;
  --emerald-50: #ECFDF5;
  --emerald-100:#D1FAE5;
  --amber:      #F59E0B;
  --amber-50:   #FFFBEB;
  --amber-100:  #FEF3C7;
  --rose:       #F43F5E;
  --rose-50:    #FFF1F2;
  --rose-100:   #FFE4E6;
  --violet:     #8B5CF6;
  --violet-50:  #F5F3FF;
  --cyan:       #06B6D4;
  --cyan-50:    #ECFEFF;

  /* ─── Neutrals (slate) ─── */
  --slate-50:  #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;
  --slate-950: #020617;

  /* ─── Surfaces ─── */
  --bg:           #F8FAFC;
  --bg-elevated:  #FFFFFF;
  --border:       #E2E8F0;
  --border-strong:#CBD5E1;

  /* ─── Texte ─── */
  --text:         #0F172A;
  --text-muted:   #64748B;
  --text-subtle:  #94A3B8;

  /* ─── Ombres (raffinées) ─── */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow:    0 4px 12px -2px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-md: 0 8px 24px -4px rgb(0 0 0 / 0.08), 0 4px 8px -4px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 20px 40px -8px rgb(0 0 0 / 0.12), 0 8px 16px -8px rgb(0 0 0 / 0.06);
  --shadow-xl: 0 32px 64px -12px rgb(0 0 0 / 0.18);
  --shadow-glow: 0 0 0 4px rgb(99 102 241 / 0.10);

  /* ─── Radius ─── */
  --r-xs: 4px;
  --r-sm: 6px;
  --r:    10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl:24px;
  --r-full: 9999px;

  /* ─── Transitions ─── */
  --t-fast:   100ms cubic-bezier(0.4, 0, 0.2, 1);
  --t:        180ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow:   320ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-bounce: 480ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ─── Layout ─── */
  --sidebar-w: 264px;
  --header-h:  68px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESET
   ═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

code, .mono { font-family: 'JetBrains Mono', monospace; font-size: 0.9em; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; color: var(--text); }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* Background subtil avec dégradé */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 800px 600px at 0% 0%, rgb(99 102 241 / 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 600px 400px at 100% 100%, rgb(139 92 246 / 0.03) 0%, transparent 50%);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
.app {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
}

.logo {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--violet) 100%);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 4px 14px -4px rgb(99 102 241 / 0.5);
  letter-spacing: -0.04em;
}
.logo-text h1 { font-size: 15px; font-weight: 700; line-height: 1.2; }
.logo-text p { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

.nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-section-label {
  padding: 14px 12px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: var(--slate-600);
  text-decoration: none;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t-fast);
  position: relative;
}
.nav-item:hover {
  background: var(--slate-100);
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-50);
  color: var(--primary-700);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--primary-600);
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nav-item .nav-icon svg { width: 18px; height: 18px; stroke-width: 2; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.status-dot {
  width: 8px; height: 8px;
  background: var(--emerald);
  border-radius: 50%;
  position: relative;
}
.status-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--emerald);
  opacity: 0.3;
  animation: pulse 2s infinite;
}
.status-dot.offline { background: var(--rose); }
.status-dot.offline::after { background: var(--rose); }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.6); opacity: 0; }
}

/* ─── MAIN ─── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
}

.main-header {
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.main-header h2 { font-size: 19px; font-weight: 700; }
.header-actions {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-actions::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-500);
}

.content {
  padding: 28px 32px 60px;
  max-width: 1600px;
  animation: fadeIn 320ms ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.loader {
  padding: 80px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loader::before {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-elevated);
  padding: 20px 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  transition: all var(--t);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary-500);
  opacity: 0;
  transition: opacity var(--t);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.kpi-card:hover::before { opacity: 1; }

.kpi-card.green::before  { background: linear-gradient(90deg, var(--emerald), var(--cyan)); }
.kpi-card.amber::before  { background: linear-gradient(90deg, var(--amber), var(--rose)); }
.kpi-card.red::before    { background: linear-gradient(90deg, var(--rose), var(--violet)); }
.kpi-card.violet::before { background: linear-gradient(90deg, var(--violet), var(--primary-500)); }

.kpi-card.green  { border-top: 3px solid var(--emerald); }
.kpi-card.amber  { border-top: 3px solid var(--amber); }
.kpi-card.red    { border-top: 3px solid var(--rose); }
.kpi-card.violet { border-top: 3px solid var(--violet); }
.kpi-card        { border-top: 3px solid var(--primary-500); }
.kpi-card::before { display: none; }

.kpi-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--primary-50);
  color: var(--primary-600);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}
.kpi-icon svg { width: 18px; height: 18px; stroke-width: 2; }
.kpi-card.green .kpi-icon  { background: var(--emerald-50); color: var(--emerald); }
.kpi-card.amber .kpi-icon  { background: var(--amber-50);   color: var(--amber); }
.kpi-card.red .kpi-icon    { background: var(--rose-50);    color: var(--rose); }
.kpi-card.violet .kpi-icon { background: var(--violet-50);  color: var(--violet); }

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.kpi-value .unit {
  font-size: 13px;
  color: var(--text-subtle);
  font-weight: 500;
  margin-left: 4px;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 6px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS / CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.section {
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
  transition: box-shadow var(--t);
}
.section:hover { box-shadow: var(--shadow-sm); }

.section-header {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--slate-50) 0%, var(--bg-elevated) 100%);
}
.section-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.section-header h3 .icon-wrap {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  background: var(--primary-50);
  color: var(--primary-600);
  display: grid;
  place-items: center;
}
.section-header h3 .icon-wrap svg { width: 14px; height: 14px; stroke-width: 2.2; }

.section-header.tech h3 .icon-wrap { background: var(--primary-50);  color: var(--primary-600); }
.section-header.comp h3 .icon-wrap { background: var(--emerald-50);  color: var(--emerald); }
.section-header.red h3 .icon-wrap  { background: var(--rose-50);     color: var(--rose); }

.section-body { padding: 20px 22px; }
.section-body.flush { padding: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLEAUX
   ═══════════════════════════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--slate-50);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
thead th.tech { background: var(--primary-50);  color: var(--primary-700); }
thead th.comp { background: var(--emerald-50);  color: #047857; }
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--text);
  vertical-align: middle;
}
tbody tr {
  transition: background var(--t-fast);
}
tbody tr:hover {
  background: var(--slate-50);
}
tbody tr:last-child td { border-bottom: none; }
td.center, th.center { text-align: center; }

/* ─── Cellules de score (notation 1-5) ─── */
.score-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t-fast);
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.score-cell:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-sm);
}
.score-1, .score-2 {
  background: var(--rose-50);
  color: var(--rose);
  border-color: rgb(244 63 94 / 0.15);
}
.score-3 {
  background: var(--amber-50);
  color: #B45309;
  border-color: rgb(245 158 11 / 0.18);
}
.score-4, .score-5 {
  background: var(--emerald-50);
  color: #047857;
  border-color: rgb(16 185 129 / 0.18);
}
.score-null {
  background: var(--slate-100);
  color: var(--slate-400);
  border-color: var(--slate-200);
}

/* ─── % compatibilité ─── */
.pct-high, .pct-mid, .pct-low {
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pct-high { background: var(--emerald-50); color: #047857; }
.pct-mid  { background: var(--amber-50);   color: #B45309; }
.pct-low  { background: var(--rose-50);    color: #B91C1C; }

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.tech       { background: var(--primary-50);  color: var(--primary-700);  border-color: var(--primary-100); }
.badge.comp       { background: var(--emerald-50);  color: #047857;             border-color: var(--emerald-100); }
.badge.deficit    { background: var(--rose-50);     color: #B91C1C;             border-color: rgb(244 63 94 / 0.2); }
.badge.conforme   { background: var(--amber-50);    color: #B45309;             border-color: rgb(245 158 11 / 0.2); }
.badge.surplus    { background: var(--emerald-50);  color: #047857;             border-color: var(--emerald-100); }
.badge.critique   { background: var(--rose);        color: white; }
.badge.haute      { background: var(--amber);       color: white; }
.badge.moyenne    { background: var(--amber-50);    color: #B45309;             border-color: rgb(245 158 11 / 0.2); }
.badge.basse      { background: var(--slate-100);   color: var(--slate-600); }
.badge.planifiée  { background: var(--primary-50);  color: var(--primary-700);  border-color: var(--primary-100); }
.badge.en_cours   { background: var(--amber-50);    color: #B45309;             border-color: rgb(245 158 11 / 0.2); }
.badge.terminée   { background: var(--emerald-50);  color: #047857;             border-color: var(--emerald-100); }
.badge.annulée    { background: var(--slate-100);   color: var(--slate-500); }

/* Badge "POSTE ACTUEL" */
.badge.current {
  background: linear-gradient(135deg, var(--primary-500), var(--violet));
  color: white;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ─── Potentiel ─── */
.potentiel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}
.potentiel.haut_potentiel     { background: var(--emerald-50);  color: #047857;          border-color: var(--emerald-100); }
.potentiel.potentiel_confirme { background: var(--primary-50);  color: var(--primary-700); border-color: var(--primary-100); }
.potentiel.a_developper       { background: var(--amber-50);    color: #B45309;          border-color: rgb(245 158 11 / 0.2); }
.potentiel.plan_urgence       { background: var(--rose-50);     color: #B91C1C;          border-color: rgb(244 63 94 / 0.2); }

/* ═══════════════════════════════════════════════════════════════════════════
   BOUTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; stroke-width: 2; }

.btn-primary {
  background: var(--primary-600);
  color: white;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), inset 0 1px 0 rgb(255 255 255 / 0.15);
}
.btn-primary:hover {
  background: var(--primary-700);
  box-shadow: var(--shadow-glow), 0 4px 12px -2px rgb(99 102 241 / 0.3);
}

.btn-success {
  background: var(--emerald);
  color: white;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: white;
  color: var(--rose);
  border-color: var(--border);
}
.btn-danger:hover {
  background: var(--rose-50);
  border-color: rgb(244 63 94 / 0.3);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--text);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  gap: 4px;
}
.btn-sm svg { width: 12px; height: 12px; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMULAIRES
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.form-group label.optional::after {
  content: ' (optionnel)';
  color: var(--text-subtle);
  font-weight: 400;
}

.form-control {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--text);
  transition: all var(--t-fast);
  font-family: inherit;
}
.form-control:hover { border-color: var(--slate-400); }
.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: var(--shadow-glow);
}
.form-control::placeholder { color: var(--text-subtle); }

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  appearance: none;
}

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

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

/* ═══════════════════════════════════════════════════════════════════════════
   GRID HELPERS
   ═══════════════════════════════════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════════════════════════
   GRAPHIQUES
   ═══════════════════════════════════════════════════════════════════════════ */
.chart-container {
  position: relative;
  height: 360px;
  padding: 4px;
}
.chart-container.small { height: 280px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SELECTOR BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.selector-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg-elevated);
  padding: 12px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.selector-bar label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12.5px;
}
.selector-bar select {
  min-width: 320px;
}
.selector-bar .spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalIn var(--t-slow) cubic-bezier(0.16, 1, 0.3, 1);
}
.modal[hidden] { display: none; }
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-box {
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--r-xl);
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: modalSlide var(--t-bounce);
}
.modal-box.size-sm { max-width: 480px; }
.modal-box.size-md { max-width: 680px; }
.modal-box.size-lg { max-width: 960px; max-height: 92vh; }
.modal-box.size-xl { max-width: 1200px; max-height: 94vh; }
@keyframes modalSlide {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  background: transparent;
  border: none;
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: all var(--t-fast);
}
.modal-close:hover {
  background: var(--slate-100);
  color: var(--text);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-elevated);
  padding: 12px 18px 12px 14px;
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary-500);
  min-width: 280px;
  max-width: 380px;
  font-size: 13px;
  font-weight: 500;
  animation: toastSlide var(--t-bounce);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.toast.success { border-left-color: var(--emerald); }
.toast.error   { border-left-color: var(--rose); }
.toast.warning { border-left-color: var(--amber); }
@keyframes toastSlide {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTES
   ═══════════════════════════════════════════════════════════════════════════ */
.alert-card {
  padding: 14px 16px;
  border-radius: var(--r);
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  background: var(--bg-elevated);
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 14px;
  transition: all var(--t);
}
.alert-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}
.alert-card.critique {
  border-left-color: var(--rose);
  background: linear-gradient(90deg, var(--rose-50) 0%, var(--bg-elevated) 70%);
}
.alert-card.elevee {
  border-left-color: var(--amber);
  background: linear-gradient(90deg, var(--amber-50) 0%, var(--bg-elevated) 70%);
}
.alert-card.retention {
  border-left-color: var(--violet);
  background: linear-gradient(90deg, var(--violet-50) 0%, var(--bg-elevated) 70%);
}
.alert-card.info {
  border-left-color: var(--slate-400);
}
.alert-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 15px;
}
.alert-card.critique .alert-icon  { background: var(--rose-50);   color: var(--rose); }
.alert-card.elevee .alert-icon    { background: var(--amber-50);  color: var(--amber); }
.alert-card.retention .alert-icon { background: var(--violet-50); color: var(--violet); }
.alert-card.info .alert-icon      { background: var(--slate-100); color: var(--slate-500); }
.alert-icon svg { width: 18px; height: 18px; stroke-width: 2; }

.alert-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 2px;
}
.alert-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEGEND
   ═══════════════════════════════════════════════════════════════════════════ */
.legend {
  display: flex;
  gap: 18px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  align-items: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
}
.legend-box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AVATAR (initiales colorées)
   ═══════════════════════════════════════════════════════════════════════════ */
.avatar {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary-700);
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.avatar.lg { width: 44px; height: 44px; font-size: 14px; }

.cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cell-user-info { line-height: 1.3; }
.cell-user-name { font-weight: 600; color: var(--text); font-size: 13px; }
.cell-user-meta { font-size: 11.5px; color: var(--text-subtle); font-family: 'JetBrains Mono', monospace; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITAIRES
   ═══════════════════════════════════════════════════════════════════════════ */
.text-muted   { color: var(--text-muted); }
.text-subtle  { color: var(--text-subtle); }
.text-small   { font-size: 12px; }
.text-xs      { font-size: 11px; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.font-mono    { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flex-1 { flex: 1; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 18px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 5px;
  border: 2px solid var(--bg);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
  background-clip: padding-box;
  border: 2px solid var(--bg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar-w: 70px; }
  .logo-text, .nav-item span:not(.nav-icon),
  .sidebar-footer span, .nav-section-label { display: none; }
  .main-header { padding: 0 18px; }
  .content { padding: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .selector-bar select { min-width: 0; flex: 1; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .main-header h2 { font-size: 16px; }
}

/* ─── Onglets fiche profil ───────────────────────────────────── */
.profil-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  margin-bottom: -1px;
}
.profil-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}
.profil-tab.active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-500);
  background: transparent;
}
.profil-tab svg { stroke: currentColor; }

/* Sections + cellules d'info dans la fiche profil */
.profil-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.profil-section-title svg { stroke: currentColor; }

.profil-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.profil-info-card {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.profil-info-card:hover { background: var(--surface-3, var(--surface-2)); }
.profil-info-card.center { text-align: center; }

.profil-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profil-list li {
  display: flex;
  align-items: center;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}

/* Bouton de génération automatique */
.btn-ai-gen {
  appearance: none;
  border: 1px solid rgba(139, 92, 246, 0.25);
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.10));
  color: var(--violet);
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.btn-ai-gen:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.20), rgba(139,92,246,0.25));
  border-color: var(--violet);
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}
.btn-ai-gen:active { transform: scale(0.96); }
.btn-ai-gen svg { stroke: currentColor; }
.btn-ai-gen:hover svg { animation: aiSparkle 0.6s ease; }
@keyframes aiSparkle {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(180deg) scale(1.2); }
}

/* Toast info (chargement) */
.toast.info {
  border-left: 3px solid var(--violet);
  color: var(--text);
}
.toast.info svg { stroke: var(--violet); animation: aiSparkle 1.4s ease infinite; }

/* Bouton d'analyse approfondie */
.btn-ai {
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
.btn-ai:hover {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
  transform: translateY(-1px);
}
.btn-ai svg { stroke: #fff; }
.btn-ai:hover svg { animation: aiSparkle 0.7s ease; }

/* Cartes de candidat (analyse approfondie) */
.candidats-ia-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.candidat-ia-card {
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-subtle);
  border-radius: var(--r-md);
  transition: all var(--t-fast);
}
.candidat-ia-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.candidat-ia-card.fortement_recommande { border-left-color: var(--emerald); background: linear-gradient(90deg, rgba(16,185,129,0.04), transparent 60%); }
.candidat-ia-card.recommande           { border-left-color: var(--primary-500); background: linear-gradient(90deg, rgba(99,102,241,0.04), transparent 60%); }
.candidat-ia-card.envisageable         { border-left-color: var(--amber); }
.candidat-ia-card.deconseille          { border-left-color: var(--rose); opacity: 0.85; }

.candidat-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.candidat-ia-card.fortement_recommande .candidat-rank {
  background: var(--emerald);
  color: #fff;
}

/* En-têtes étroits de la matrice de compétences */
.matrix-h {
  min-width: 42px !important;
  max-width: 80px;
  font-size: 9.5px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 6px 4px !important;
  white-space: normal;
  line-height: 1.15;
  vertical-align: bottom;
}

/* Cartes de suggestions (preview + profil) */
.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.suggestion-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-subtle);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
}
.suggestion-card:hover { box-shadow: var(--shadow-sm); }
.suggestion-card.priorite-critique { border-left-color: var(--rose); }
.suggestion-card.priorite-haute    { border-left-color: var(--amber); }
.suggestion-card.priorite-moyenne  { border-left-color: var(--primary-500); }
.suggestion-card.priorite-basse    { border-left-color: var(--text-subtle); }

.suggestion-check {
  margin-top: 3px;
  flex-shrink: 0;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--violet);
}

/* ─── Authentification (footer sidebar + modal) ──────────── */
#connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.btn-login {
  appearance: none;
  background: linear-gradient(135deg, var(--primary-500), var(--violet));
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
  transition: all var(--t-fast);
}
.btn-login:hover {
  filter: brightness(1.1);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}
.btn-login svg { stroke: #fff; }

.user-info {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}
.user-info .user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-logout {
  appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.btn-logout:hover {
  border-color: var(--rose);
  color: var(--rose);
  background: rgba(244, 63, 94, 0.06);
}
.btn-logout svg { transform: rotate(-90deg); stroke: currentColor; }

.login-form .form-group { margin-bottom: 14px; }






