/* ==========================================================================
   cours.mlav.land — feuille de style
   Inspirée de shadcn/ui : jetons CSS (tokens), palette HSL, rayon et espacements
   cohérents, anneaux de focus visibles, thème clair/sombre automatique.
   Écrite à la main (aucun framework), mobile d’abord.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Jetons de thème
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces */
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;

  /* Couleurs d’action */
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --destructive: 0 72% 45%;
  --destructive-foreground: 0 0% 98%;
  --success: 142 62% 28%;
  --success-foreground: 0 0% 98%;
  --warning: 32 90% 38%;
  --warning-foreground: 0 0% 100%;

  /* Contours */
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;

  /* Échelle du barème (du plus autonome au plus fragile) */
  --level-3: 142 62% 30%;
  --level-2: 142 45% 50%;
  --level-1: 38 92% 50%;
  --level-0: 0 72% 55%;

  --radius: 0.65rem;
  --radius-sm: calc(var(--radius) - 0.25rem);
  --radius-lg: calc(var(--radius) + 0.25rem);

  --shadow-xs: 0 1px 2px 0 hsl(240 6% 10% / 0.05);
  --shadow-sm: 0 1px 3px 0 hsl(240 6% 10% / 0.08), 0 1px 2px -1px hsl(240 6% 10% / 0.08);
  --shadow-md: 0 4px 14px -4px hsl(240 6% 10% / 0.12);

  --tap: 2.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 6%;
    --card-foreground: 0 0% 98%;
    --muted: 240 3.7% 15%;
    --muted-foreground: 240 5% 68%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;

    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --destructive: 0 63% 50%;
    --destructive-foreground: 0 0% 98%;
    --success: 142 55% 55%;
    --success-foreground: 144 60% 8%;
    --warning: 38 92% 55%;
    --warning-foreground: 40 90% 10%;

    --border: 240 3.7% 18%;
    --input: 240 3.7% 20%;
    --ring: 240 4.9% 83.9%;

    --level-3: 142 55% 55%;
    --level-2: 142 40% 62%;
    --level-1: 38 90% 60%;
    --level-0: 0 70% 62%;

    --shadow-xs: none;
    --shadow-sm: none;
    --shadow-md: none;
  }
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

* { border-color: hsl(var(--border)); }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  font-variant-ligatures: contextual;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
  text-wrap: balance;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-top: 1.75rem; }
h3 { font-size: 1rem; margin-top: 1.25rem; }
h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }

p { margin: 0 0 0.85rem; }
p:last-child { margin-bottom: 0; }

a {
  color: hsl(var(--foreground));
  text-decoration: underline;
  text-decoration-color: hsl(var(--muted-foreground) / 0.5);
  text-underline-offset: 3px;
  border-radius: 3px;
}
a:hover { text-decoration-color: currentColor; }

ul, ol { padding-left: 1.25rem; }
li { margin-bottom: 0.25rem; }

hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: 1.5rem 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: hsl(var(--muted));
  padding: 0.15em 0.4em;
  border-radius: 0.3em;
}

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* Conteneur */
.wrap {
  width: 100%;
  max-width: 60rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

main.wrap { padding-block: 1.75rem; flex: 1 1 auto; }

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.75rem; }

/* --------------------------------------------------------------------------
   3. En-tête / pied de page
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: hsl(var(--background) / 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding-block: 0.5rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: hsl(var(--foreground));
}
.brand:hover { text-decoration: none; }
.admin-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.admin-nav a {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
}
.admin-nav a:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
}

/* --------------------------------------------------------------------------
   4. Boutons (variantes shadcn)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: nowrap;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  line-height: 1;
  min-height: var(--tap);
  padding: 0 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--foreground));
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:hover { text-decoration: none; }

/* Variante par défaut du bouton nu = « outline » */
.btn {
  border-color: hsl(var(--input));
  background: hsl(var(--background));
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: transparent;
}
.btn-primary:hover { background: hsl(var(--primary) / 0.9); color: hsl(var(--primary-foreground)); }

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: transparent;
}
.btn-secondary:hover { background: hsl(var(--secondary) / 0.8); }

.btn-danger {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: transparent;
}
.btn-danger:hover { background: hsl(var(--destructive) / 0.9); color: hsl(var(--destructive-foreground)); }

.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.btn-tiny {
  min-height: 2rem;
  padding: 0 0.6rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Boutons icône (gain de place) */
.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-sm);
  position: relative;
}
.btn-icon svg, .icon { width: 1.05rem; height: 1.05rem; display: block; }
.btn-danger-ghost {
  background: transparent;
  color: hsl(var(--destructive));
  border-color: transparent;
  box-shadow: none;
}
.btn-danger-ghost:hover {
  background: hsl(var(--destructive) / 0.12);
  color: hsl(var(--destructive));
}
.btn-icon-warn {
  color: hsl(var(--warning));
  border-color: hsl(var(--warning) / 0.45);
}
.btn-icon-warn:hover {
  background: hsl(var(--warning) / 0.12);
  color: hsl(var(--warning));
}
.btn-count {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: hsl(var(--warning));
  color: hsl(var(--warning-foreground));
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}
.btn-large { min-height: 3rem; padding: 0 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; flex: 1 1 100%; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.linklike {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 500;
  color: hsl(var(--foreground));
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   5. Cartes
   -------------------------------------------------------------------------- */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 40rem) { .card { padding: 1.6rem; } }

.card-narrow { max-width: 26rem; margin-inline: auto; }
.card-wide { max-width: none; }

/* Centrage plein écran (page d’accueil) : la carte est centrée verticalement
   et horizontalement, et reste étroite. */
main.wrap.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
main.wrap.center > * {
  width: 100%;
  max-width: 26rem;
}
main.wrap.center > .card { margin-bottom: 0; }

.card > h1 { font-size: 1.4rem; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.page-head h1 { margin: 0; }

.kicker {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 0.5rem;
}
.kicker a { color: inherit; }
.step {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin: 1.25rem 0 0.5rem;
}
.lead { font-size: 1.05rem; color: hsl(var(--foreground)); }
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 0.83rem; }
.nowrap { white-space: nowrap; }

.edition-block {
  border-top: 1px solid hsl(var(--border));
  margin-top: 1.25rem;
  padding-top: 0.75rem;
}

/* Tableau de bord admin */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.exam-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-top: 0.9rem;
  background: hsl(var(--muted) / 0.35);
}
.edition-title { font-size: 1.15rem; }
.exam-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.exam-slug {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}
.exam-title { margin: 0 0 0.1rem; font-weight: 650; }
.exam-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.25rem;
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}
.exam-stats strong { color: hsl(var(--foreground)); }
.exam-card .toolbar { margin-top: 0.8rem; }

/* --------------------------------------------------------------------------
   6. Formulaires
   -------------------------------------------------------------------------- */
.field { margin-bottom: 1.15rem; }
.field > label,
.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 550;
  margin-bottom: 0.4rem;
}
.req { font-weight: 400; color: hsl(var(--muted-foreground)); font-size: 0.8rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="date"], input[type="datetime-local"], input[type="file"],
select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.6; }

input::placeholder, textarea::placeholder { color: hsl(var(--muted-foreground) / 0.8); }

input:hover, select:hover, textarea:hover { border-color: hsl(var(--muted-foreground) / 0.6); }

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}

input[type="number"] { max-width: 9rem; }
.field input[type="number"] { max-width: 100%; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.25rem;
}

.hint {
  color: hsl(var(--muted-foreground));
  font-size: 0.82rem;
  margin: 0.4rem 0 0;
}
.counter { font-variant-numeric: tabular-nums; font-weight: 600; color: hsl(var(--foreground)); }

.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.inline { display: inline; }
.inline-field { display: inline-block; margin: 0 0.6rem 0.6rem 0; vertical-align: bottom; }
.inline-search {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.inline-search input { flex: 1 1 14rem; }
.inline-search label { flex-basis: 100%; font-size: 0.875rem; font-weight: 550; }

/* Autocomplétion : menu déroulant ancré sous le champ */
.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 17rem;
  overflow-y: auto;
}
.autocomplete-list[hidden] { display: none; }
.autocomplete-list li {
  padding: 0.6rem 0.7rem;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin: 0;
}
.autocomplete-list li:hover,
.autocomplete-list li[aria-selected="true"] {
  background: hsl(var(--accent));
}

/* --------------------------------------------------------------------------
   7. Notices / alertes / badges
   -------------------------------------------------------------------------- */
.notice {
  border: 1px solid hsl(var(--border));
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 1.1rem 0;
  font-size: 0.92rem;
  background: hsl(var(--card));
}
.notice p { margin: 0.15rem 0; }
.notice-info {
  border-left-color: hsl(var(--primary));
  background: hsl(var(--muted) / 0.6);
}
.notice-warn {
  border-left-color: hsl(var(--warning));
  background: hsl(var(--warning) / 0.08);
  color: hsl(var(--foreground));
}
.notice-error {
  border-left-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.08);
  color: hsl(var(--foreground));
}

.flashes { margin-bottom: 1rem; display: grid; gap: 0.5rem; }
.flash {
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  border-left-width: 4px;
  padding: 0.7rem 0.9rem;
  margin: 0;
  font-size: 0.9rem;
}
.flash-info { border-left-color: hsl(var(--primary)); background: hsl(var(--muted) / 0.6); }
.flash-warn { border-left-color: hsl(var(--warning)); background: hsl(var(--warning) / 0.1); }
.flash-error { border-left-color: hsl(var(--destructive)); background: hsl(var(--destructive) / 0.1); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 550;
  line-height: 1.6;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  white-space: nowrap;
}
.pill-draft { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.pill-open, .pill-match-auto, .pill-match-confirmed {
  background: hsl(var(--success) / 0.12);
  border-color: hsl(var(--success) / 0.35);
  color: hsl(var(--success));
}
.pill-closed {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}
.pill-match-unmatched, .pill-match-ambiguous {
  background: hsl(var(--warning) / 0.14);
  border-color: hsl(var(--warning) / 0.35);
  color: hsl(var(--warning));
}

.badge-warn {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  background: hsl(var(--warning) / 0.15);
  color: hsl(var(--warning));
  border: 1px solid hsl(var(--warning) / 0.35);
}
.badge-warn:hover { text-decoration: none; background: hsl(var(--warning) / 0.25); }

.badge-missing {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: hsl(var(--destructive) / 0.12);
  color: hsl(var(--destructive));
  margin-left: 0.35rem;
  vertical-align: middle;
}

.row-warn { background: hsl(var(--warning) / 0.06); }

/* --------------------------------------------------------------------------
   8. Tableaux
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  margin: 1rem 0;
}
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
thead th {
  background: hsl(var(--muted) / 0.7);
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: hsl(var(--accent) / 0.5); }
td.justif { max-width: 18rem; }
thead th a { color: inherit; text-decoration: none; }
thead th a:hover { color: hsl(var(--foreground)); text-decoration: underline; }

.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.plain-list { list-style: none; padding: 0; }
.plain-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid hsl(var(--border));
}
.plain-list li:last-child { border-bottom: 0; }

/* Résultats : lignes colorées selon l’état (rempli / non rempli) */
.results-table td { padding: 0.8rem; }
.row-name { display: block; font-weight: 600; }
.row-email { display: block; }
.results-table th.state, .results-table td.state { width: 5rem; text-align: center; }
.state-badge { display: inline-flex; align-items: center; justify-content: center; }
.state-badge svg { width: 1.15rem; height: 1.15rem; }
tbody tr.row-filled { background: hsl(var(--success) / 0.08); }
tbody tr.row-filled td.state { color: hsl(var(--success)); }
tbody tr.row-empty, tbody tr.row-progress { background: hsl(var(--warning) / 0.09); }
tbody tr.row-empty td.state, tbody tr.row-progress td.state { color: hsl(var(--warning)); }
tbody tr.row-filled:hover { background: hsl(var(--success) / 0.14); }
tbody tr.row-empty:hover, tbody tr.row-progress:hover { background: hsl(var(--warning) / 0.15); }

/* --------------------------------------------------------------------------
   9. Parcours étudiant·e — questionnaire
   -------------------------------------------------------------------------- */
.intro { color: hsl(var(--muted-foreground)); margin-bottom: 1rem; }

.q-section { margin-top: 2rem; }
.q-section-title {
  font-size: 0.95rem;
  font-weight: 650;
  color: hsl(var(--foreground));
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

.question {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  padding: 1rem;
  margin: 0 0 1rem;
  min-inline-size: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.question:hover { box-shadow: var(--shadow-sm); }
.question legend {
  font-weight: 650;
  font-size: 1.1rem;
  line-height: 1.4;
  padding-inline: 0.4rem;
  max-width: 100%;
  color: hsl(var(--foreground));
}
.question-missing {
  border-color: hsl(var(--destructive) / 0.6);
  background: hsl(var(--destructive) / 0.04);
}
/* Question répondue : le container entier passe en grisé */
.question:has(input[type="radio"]:checked) {
  background: hsl(var(--muted) / 0.75);
  border-color: hsl(var(--border));
}
.question:has(input[type="radio"]:checked) legend {
  color: hsl(var(--muted-foreground));
}
.q-num {
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-right: 0.15rem;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.8rem;
}
@media (min-width: 36rem) {
  .options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.7rem 0.65rem;
  min-height: var(--tap);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--background));
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.option:hover { background: hsl(var(--accent)); border-color: hsl(var(--muted-foreground) / 0.4); }
.option input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: hsl(var(--primary));
}
.option:has(input[type="radio"]:checked) {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.16);
  box-shadow: inset 0 0 0 1px hsl(var(--primary) / 0.55);
}
.option:has(input[type="radio"]:checked) .option-label { font-weight: 700; }
.option:has(input[type="radio"]:checked) input[type="radio"] { accent-color: hsl(var(--primary)); }
.option-body { display: flex; flex-direction: column; gap: 0.15rem; }
.option-label { font-weight: 550; font-size: 0.85rem; line-height: 1.35; }
.option-help { color: hsl(var(--muted-foreground)); font-size: 0.74rem; line-height: 1.3; }

/* Compteur flottant de questions restantes (amélioration progressive) */
.q-counter {
  position: fixed;
  z-index: 45;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.85rem;
  font-weight: 650;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  pointer-events: none;
}
.q-counter[hidden] { display: none; }
.q-counter.is-complete {
  background: hsl(var(--success));
  color: hsl(var(--success-foreground));
}

/* Page 3 — score et récapitulatif */
.score-line { font-size: 1.05rem; }
.score-line strong { font-size: 1.35rem; letter-spacing: -0.02em; }

.recap { margin: 1.25rem 0; }
.recap h3 { margin-bottom: 0.75rem; }
.bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 0.75rem;
  align-items: center;
  margin-bottom: 0.7rem;
}
.bar-label { grid-column: 1 / -1; font-size: 0.87rem; font-weight: 500; }
.bar {
  background: hsl(var(--secondary));
  border-radius: 999px;
  height: 0.55rem;
  overflow: hidden;
}
.bar-fill { display: block; height: 100%; background: hsl(var(--primary)); border-radius: 999px; transition: width 0.3s ease; }
.bar-value { font-variant-numeric: tabular-nums; font-size: 0.82rem; color: hsl(var(--muted-foreground)); }

/* Barres empilées (vue par question) */
.stacked {
  display: flex;
  height: 0.75rem;
  border-radius: 999px;
  overflow: hidden;
  background: hsl(var(--secondary));
}
.seg { display: block; height: 100%; transition: width 0.3s ease; }
.seg-3 { background: hsl(var(--level-3)); }
.seg-2 { background: hsl(var(--level-2)); }
.seg-1 { background: hsl(var(--level-1)); }
.seg-0 { background: hsl(var(--level-0)); }
.bq-question { margin-bottom: 1.35rem; }
.bq-text { margin: 0 0 0.35rem; font-size: 0.92rem; }
.bq-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
}
.legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.dot { width: 0.65rem; height: 0.65rem; border-radius: 3px; display: inline-block; }

/* Citations (retours, justifications) */
blockquote {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.5);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: hsl(var(--foreground));
}
.justif-block { border-left-color: hsl(var(--primary)); }
.feedback-item { border-left-color: hsl(var(--muted-foreground)); }

/* --------------------------------------------------------------------------
   10. Spécifique admin
   -------------------------------------------------------------------------- */
.admin-question {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: start;
  padding: 0.6rem 0;
  border-bottom: 1px solid hsl(var(--border));
}
.admin-question.inactive { opacity: 0.55; }
.aq-actions { display: flex; gap: 0.2rem; }
.aq-form { display: grid; grid-template-columns: 1fr; gap: 0.4rem; }
.aq-active { font-size: 0.82rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.35rem; }
.aq-active input { width: 1rem; height: 1rem; accent-color: hsl(var(--primary)); }
.aq-section { font-size: 0.85rem; }
@media (min-width: 48rem) {
  .admin-question { grid-template-columns: auto 1fr; align-items: center; }
  .aq-form { grid-template-columns: 11rem 1fr auto auto; align-items: center; }
}

.match-item {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
  background: hsl(var(--card));
}
.match-item h2 { font-size: 1rem; margin-bottom: 0.3rem; }
.candidate-list { list-style: none; padding: 0; }
.candidate-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid hsl(var(--border));
}
.candidate-list li:last-child { border-bottom: 0; }

/* Confirmation « Est-ce bien toi ? » */
.candidate {
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0.5rem 0;
}

.debug {
  white-space: pre-wrap;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

/* --------------------------------------------------------------------------
   11. Divers
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Largeurs de champs (remplacent les styles en ligne) */
.input-sm { max-width: 6rem; }
.input-md { max-width: 8rem; }

.text-center { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
