/* ─── Bandeau démo (injection Léon RH, hors design system d'origine) ─── */
.demo-banner {
  background: #FEF3C7;
  border-bottom: 1px solid #FCD34D;
  color: #78350F;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.demo-banner strong { color: #78350F; font-weight: 700; }
.demo-banner__back {
  color: #92400E;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}
.demo-banner__back:hover { color: #78350F; }

/* ─── SurveyScorm — Dashboard snapshot ─────────────────────────────────────
 * Tokens et composants partagés par toutes les pages statiques.
 * Reprend fidèlement public/results/src/index.css + Layout.jsx + composants ui/*.
 * ───────────────────────────────────────────────────────────────────────── */

:root {
  --background:        212 70% 94%;
  --foreground:        165 38% 8%;
  --card:              0 0% 100%;
  --muted:             212 30% 95%;
  --muted-foreground:  215 18% 38%;
  --subtle:            212 40% 92%;
  --border:            212 26% 87%;

  --primary:           165 42% 12%;
  --primary-foreground:45 30% 97%;
  --primary-soft:      158 32% 94%;
  --accent:            158 64% 42%;
  --accent-foreground: 165 38% 8%;
  --accent-soft:       158 55% 92%;

  --destructive:       4 70% 50%;
  --destructive-foreground: 45 30% 97%;

  --score-good:        158 58% 38%;
  --score-good-soft:   158 50% 93%;
  --score-mid:         32 92% 46%;
  --score-mid-soft:    36 94% 94%;
  --score-bad:         4 70% 50%;
  --score-bad-soft:    4 75% 95%;

  --dim-intensite:     22 92% 54%;
  --dim-emotion:       336 78% 56%;
  --dim-autonomie:     158 64% 42%;
  --dim-soutien:       186 72% 42%;
  --dim-reconnaissance:42 92% 50%;
  --dim-valeurs:       262 62% 60%;
  --dim-securite:      4 74% 54%;
  --dim-violences:     350 62% 38%;
  --dim-sens:          145 58% 32%;
  --dim-equilibre:     228 68% 60%;
  --dim-expression:    198 78% 48%;
  --dim-sante:         215 16% 48%;

  --radius:    0.625rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px 0 hsl(165 30% 12% / 0.04);
  --shadow-sm: 0 2px 6px -1px hsl(165 30% 12% / 0.06), 0 1px 2px -1px hsl(165 30% 12% / 0.04);
  --shadow-md: 0 8px 20px -6px hsl(165 30% 12% / 0.10), 0 3px 6px -3px hsl(165 30% 12% / 0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; border-color: hsl(var(--border)); }
html { font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif; font-feature-settings: 'cv11','ss01','ss03'; }
body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  line-height: 1.55;
  background-image:
    radial-gradient(1100px 520px at 88% -20%, hsl(158 60% 88% / 0.45), transparent 60%),
    radial-gradient(900px 420px at -10% 110%, hsl(212 80% 92% / 0.55), transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, select { font-family: inherit; font-size: inherit; }

/* ─── Typography utilities ────────────────────────────────── */
.tabular-nums { font-variant-numeric: tabular-nums; }
.text-display   { font-size: 2.25rem;  line-height: 1.1;  font-weight: 700; letter-spacing: -0.02em; }
.text-h1        { font-size: 1.5rem;   line-height: 1.2;  font-weight: 700; letter-spacing: -0.01em; }
.text-h2        { font-size: 1.125rem; line-height: 1.3;  font-weight: 600; }
.text-h3        { font-size: 0.9375rem;line-height: 1.4;  font-weight: 600; }
.text-overline  { font-size: 0.6875rem; line-height: 1.3; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.text-mute { color: hsl(var(--muted-foreground)); }
.text-fg   { color: hsl(var(--foreground)); }
.italic { font-style: italic; }
.font-semibold { font-weight: 600; }

/* ─── Topbar (Layout.jsx) ─────────────────────────────────── */
.topbar-wrap { padding: 20px 24px 0; position: sticky; top: 0; z-index: 30; }
.topbar {
  background: hsl(var(--card) / 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.brand-logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand-logo .square {
  width: 28px; height: 28px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; letter-spacing: -0.02em;
}
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand-name .dot-fr { color: hsl(var(--accent)); }
.brand-sep { width: 1px; height: 20px; background: hsl(var(--border)); }
.breadcrumb { font-size: 14px; color: hsl(var(--muted-foreground)); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-pills {
  display: flex; gap: 2px;
  padding: 4px;
  background: hsl(var(--muted) / 0.7);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-pill);
}
.nav-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: background 150ms, color 150ms;
}
.nav-pill svg { width: 14px; height: 14px; }
.nav-pill:hover { background: hsl(var(--card)); color: hsl(var(--foreground)); }
.nav-pill.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

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

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 500;
  border-radius: var(--radius-md);
  transition: background 150ms, border-color 150ms;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-outline { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); }
.btn-outline:hover { background: hsl(var(--subtle)); }
.btn-ghost { padding: 7px 10px; }
.btn-ghost:hover { background: hsl(var(--subtle)); }
.btn-primary {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-weight: 600;
}
.btn-primary:hover { background: hsl(165 42% 18%); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn .badge-count {
  margin-left: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: hsl(var(--accent)); color: hsl(var(--accent-foreground));
  border-radius: var(--radius-pill);
  font-size: 10px; font-weight: 700;
  padding: 0 6px; min-width: 18px; height: 18px;
}

/* ─── Active filter chips ─────────────────────────────────── */
.chips-row { padding: 12px 24px 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; max-width: 1400px; margin: 0 auto; }
.chips-row .label { font-size: 12px; color: hsl(var(--muted-foreground)); margin-right: 4px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em;
}
.pill-accent {
  border: 1px solid hsl(var(--accent) / 0.4);
  background: hsl(var(--accent-soft));
  color: hsl(var(--foreground));
}
.pill-accent .field { color: hsl(var(--muted-foreground)); font-weight: 500; }
.pill-accent .close { opacity: 0.6; }
.pill-ghost { color: hsl(var(--muted-foreground)); }
.pill-ghost:hover { background: hsl(var(--subtle)); }
.pill-link { color: hsl(var(--primary)); margin-left: auto; }
.pill-link:hover { background: hsl(var(--primary-soft)); }

/* ─── Layout ───────────────────────────────────────────────── */
main { padding: 16px 24px 40px; max-width: 1400px; margin: 0 auto; }
main.narrow { max-width: 1100px; }
main.medium { max-width: 1200px; }
.stack > * + * { margin-top: 24px; }
.stack-sm > * + * { margin-top: 16px; }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-dims { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-dims { grid-template-columns: repeat(2, 1fr); }
  .nav-pills { order: 3; width: 100%; justify-content: center; }
}
@media (max-width: 700px) {
  .grid-4, .grid-dims, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ─── Card primitive (ui/card.tsx) ────────────────────────── */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head { padding: 20px 24px 12px; }
.card-body { padding: 0 24px 24px; }
.card-body-flush { padding: 0; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card-desc { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 4px; line-height: 1.55; }

.surface-dark {
  background: linear-gradient(145deg, hsl(165 42% 12%) 0%, hsl(165 38% 18%) 100%);
  color: hsl(45 30% 97%);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

/* ─── Hero card (Overview) ─────────────────────────────────── */
.hero {
  position: relative;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hero-halo {
  position: absolute; right: -80px; top: -80px;
  width: 288px; height: 288px; border-radius: 50%;
  background: radial-gradient(closest-side, hsl(var(--accent) / 0.18), transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; padding: 28px; }
.hero-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.overline-icon { display: flex; align-items: center; gap: 8px; color: hsl(var(--muted-foreground)); }
.overline-icon svg { width: 12px; height: 12px; }

/* ─── HierarchyPicker (chip) ──────────────────────────────── */
.picker-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-pill);
  padding: 6px 10px 6px 12px;
  font-size: 13px;
  transition: background 150ms, border-color 150ms;
}
.picker-chip:hover { background: hsl(var(--subtle)); border-color: hsl(var(--foreground) / 0.25); }
.picker-chip svg { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); flex-shrink: 0; }
.picker-chip .seg { color: hsl(var(--muted-foreground)); }
.picker-chip .seg.current { font-weight: 600; color: hsl(var(--foreground)); }

/* ─── Status pill ──────────────────────────────────────────── */
.pill-status {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-pill);
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  border: 1px solid;
}
.pill-closed { background: hsl(var(--muted)); border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); }
.pill-closed .dot { width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--muted-foreground) / 0.6); }
.pill-open { background: hsl(var(--accent-soft)); border-color: hsl(var(--accent) / 0.4); color: hsl(var(--foreground)); }
.pill-open .live-dot {
  position: relative; display: inline-block;
  width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--accent));
}
.pill-open .live-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid hsl(var(--accent) / 0.45);
  animation: pulse-soft 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse-soft { 0%, 100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 0.2; transform: scale(1.5); } }

/* ─── Progress bar ─────────────────────────────────────────── */
.progress-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 12px; }
.progress-row .strong { font-weight: 700; color: hsl(var(--foreground)); }
.progress-track { height: 8px; background: hsl(var(--muted)); border-radius: var(--radius-pill); overflow: hidden; }
.progress-fill { height: 100%; background: hsl(var(--accent)); border-radius: var(--radius-pill); transition: width 700ms ease-out; }

/* ─── KPI ─────────────────────────────────────────────────── */
.kpi { position: relative; border-radius: var(--radius-xl); padding: 20px; overflow: hidden; }
.kpi-light { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow-sm); transition: box-shadow 200ms; }
.kpi-light:hover { box-shadow: var(--shadow-md); }
.kpi-accent-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: hsl(var(--accent)); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-actions { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; }
.kpi-icon-btn {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  color: hsl(var(--muted-foreground)); border-radius: var(--radius-sm);
  transition: background 150ms, color 150ms;
}
.kpi-icon-btn:hover { background: hsl(var(--subtle)); color: hsl(var(--foreground)); }
.surface-dark .kpi-icon-btn { color: hsl(45 30% 97% / 0.55); }
.surface-dark .kpi-icon-btn:hover { color: hsl(45 30% 97%); background: hsl(45 30% 97% / 0.1); }
.kpi-icon-btn svg { width: 12px; height: 12px; }
.kpi-icon-wrap { border-radius: var(--radius-pill); padding: 6px; display: inline-flex; margin-left: 2px; }
.kpi-icon-wrap svg { width: 14px; height: 14px; }
.kpi-light .kpi-icon-wrap { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.surface-dark .kpi-icon-wrap { background: hsl(var(--accent) / 0.2); color: hsl(var(--accent)); }
.kpi-value-row { margin-top: 10px; display: flex; align-items: baseline; gap: 6px; }
.kpi-value { font-size: 2.25rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.kpi-suffix { font-size: 14px; }
.surface-dark .kpi-suffix { color: hsl(45 30% 97% / 0.55); }
.kpi-light .kpi-suffix { color: hsl(var(--muted-foreground)); }
.kpi-hint { margin-top: 6px; font-size: 12px; }
.surface-dark .kpi-hint { color: hsl(45 30% 97% / 0.55); }
.kpi-light .kpi-hint { color: hsl(var(--muted-foreground)); }
.surface-dark .kpi-overline { color: hsl(45 30% 97% / 0.65); }
.kpi-light .kpi-overline { color: hsl(var(--muted-foreground)); }

.tone-good { color: hsl(var(--score-good)); }
.tone-mid  { color: hsl(var(--score-mid)); }
.tone-bad  { color: hsl(var(--score-bad)); }

/* ─── Dimension cards (Overview) ──────────────────────────── */
.dim-card {
  position: relative; background: hsl(var(--card));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius-lg);
  overflow: hidden; transition: transform 200ms, box-shadow 200ms, border-color 200ms;
  cursor: pointer; text-align: left; width: 100%;
}
.dim-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: hsl(var(--foreground) / 0.1); }
.dim-bandeau { position: absolute; inset: 0 0 auto 0; height: 4px; }
.dim-card-inner { padding: 18px 16px 16px; }
.dim-overline { display: flex; align-items: center; gap: 6px; color: hsl(var(--muted-foreground)); }
.dim-overline .dot { width: 6px; height: 6px; border-radius: 50%; }
.dim-label { margin-top: 6px; font-size: 14px; font-weight: 600; line-height: 1.35; min-height: 38px; }
.dim-score-row { margin-top: 14px; display: flex; align-items: baseline; gap: 6px; }
.dim-score { font-size: 1.625rem; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.dim-score-suffix { font-size: 11px; color: hsl(var(--muted-foreground)); }
.dim-delta { margin-left: auto; font-size: 12px; font-weight: 600; }
.dim-bar { margin-top: 12px; height: 6px; background: hsl(var(--muted)); border-radius: var(--radius-pill); overflow: hidden; }
.dim-bar > div { height: 100%; border-radius: var(--radius-pill); transition: width 500ms ease-out; }
.dim-arrow {
  position: absolute; top: 16px; right: 16px;
  color: hsl(var(--muted-foreground) / 0.3);
  width: 16px; height: 16px;
  transition: color 150ms;
}
.dim-card:hover .dim-arrow { color: hsl(var(--foreground)); }

/* ─── Legend (radar, history) ─────────────────────────────── */
.legend { display: flex; gap: 18px; align-items: center; font-size: 12px; color: hsl(var(--muted-foreground)); flex-wrap: wrap; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.legend-line { display: inline-block; width: 16px; height: 2px; background: currentColor; margin-right: 6px; vertical-align: middle; }
.legend-line.dashed { background: transparent; background-image: repeating-linear-gradient(to right, currentColor 0 4px, transparent 4px 8px); }

.footer { text-align: center; color: hsl(var(--muted-foreground)); font-size: 11px; margin-top: 32px; opacity: 0.7; }

/* ─── Select (ui/select.tsx) ──────────────────────────────── */
.select {
  display: inline-flex; align-items: center; justify-content: space-between;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  padding: 7px 12px;
  font-size: 13px;
  min-width: 240px;
  gap: 8px;
}
.select:hover { background: hsl(var(--subtle)); }
.select svg { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); }

/* ─── Input (ui/input.tsx) ────────────────────────────────── */
.input {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md); padding: 8px 12px; font-size: 13px;
  width: 100%; transition: border-color 150ms;
}
.input:focus { outline: none; border-color: hsl(var(--accent)); }

/* ─── Tabs (Verbatims) ─────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid hsl(var(--border));
  padding: 0 24px;
  margin-bottom: -1px;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  color: hsl(var(--muted-foreground));
  transition: color 150ms, border-color 150ms;
}
.tab svg { width: 14px; height: 14px; }
.tab:hover { color: hsl(var(--foreground)); border-bottom-color: hsl(var(--border)); }
.tab.active {
  color: hsl(var(--primary));
  font-weight: 600;
  border-bottom-color: hsl(var(--primary));
}
.tab.active.tone-good svg { color: hsl(var(--score-good)); }
.tab.active.tone-bad  svg { color: hsl(var(--score-bad)); }

/* ─── HierarchyFilter (carte repliable arbre) ─────────────── */
.hf-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.hf-toggle {
  width: 100%; padding: 12px 16px;
  display: flex; align-items: center; gap: 8px;
  text-align: left; font-size: 13px;
}
.hf-toggle svg { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); flex-shrink: 0; }
.hf-toggle .overline { color: hsl(var(--muted-foreground)); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; flex-shrink: 0; }
.hf-toggle .path { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hf-toggle .path .seg { color: hsl(var(--muted-foreground)); }
.hf-toggle .path .seg.last { color: hsl(var(--foreground)); font-weight: 600; }
.hf-toggle .chev { color: hsl(var(--muted-foreground)); margin-left: auto; flex-shrink: 0; }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.animate-fade-in { animation: fade-in 240ms ease-out; }
