:root {
  --purple-900: #2a1650;
  --purple-700: #4b2a8a;
  --purple-500: #6d45c4;
  --purple-100: #efe9fb;
  --ink: #1b1d2a;
  --muted: #5b6072;
  --line: #e3e4ea;
  --bg: #ffffff;
  --bg-soft: #f7f7fa;
  --ok: #0f6e56;
  --ok-bg: #e1f5ee;
  --err: #a32d2d;
  --err-bg: #fcebeb;
  --warn: #854f0b;
  --warn-bg: #faeeda;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.6; }
a { color: var(--purple-700); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.topbar { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.topbar__inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.15rem; color: var(--purple-900); text-decoration: none; }
.brand__mark { width: 22px; height: 22px; border-radius: 6px; background: var(--purple-500); display: inline-block; }
.nav { display: flex; gap: 20px; margin-right: auto; }
.nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--ink); }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang__item { padding: 4px 10px; font-size: .8rem; text-decoration: none; color: var(--muted); }
.lang__item.is-active { background: var(--purple-100); color: var(--purple-900); font-weight: 600; }

.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; font-weight: 500; text-decoration: none; font-size: .95rem; border: 1px solid transparent; }
.btn--primary { background: var(--purple-700); color: #fff; }
.btn--primary:hover { background: var(--purple-900); }
.btn--secondary { background: var(--bg); color: var(--purple-700); border-color: var(--purple-500); }
.btn--ghost { color: var(--ink); border-color: var(--line); padding: 6px 14px; }

.hero { background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 72px 0 64px; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--purple-500); font-weight: 600; margin: 0 0 12px; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.15; margin: 0 0 16px; max-width: 760px; color: var(--purple-900); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 720px; margin: 0 0 28px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; padding-top: 48px; padding-bottom: 24px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--bg); }
.card h2 { font-size: 1.1rem; margin: 0 0 8px; color: var(--purple-900); }
.card p { margin: 0; color: var(--muted); }
.card--accent { background: var(--purple-100); border-color: transparent; }

.status { padding-top: 24px; padding-bottom: 56px; }
.status h2 { font-size: 1.1rem; }
.status__grid { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.status__row { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; }
.status__row + .status__row { border-top: 1px solid var(--line); }
.status dt { color: var(--muted); }
.status dd { margin: 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; background: var(--bg-soft); color: var(--muted); }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--err { background: var(--err-bg); color: var(--err); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }

.footer { border-top: 1px solid var(--line); padding: 20px 0; font-size: .85rem; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.btn, .topbar__user { white-space: nowrap; }

@media (max-width: 960px) {
  .nav { display: none; }
  .topbar__actions { margin-left: auto; }
}
@media (max-width: 560px) {
  .topbar__inner { gap: 12px; }
  .topbar__user { display: none; }
}

/* Espace connecté (étape 3a) */
.inline-form { display: inline; margin: 0; }
button.btn { font: inherit; cursor: pointer; background: var(--bg); }
.btn:focus-visible, .topbar__user:focus-visible, .lang__item:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 2px; }
.topbar__user { color: var(--ink); text-decoration: none; font-size: .95rem; font-weight: 500; }
.page { padding-top: 48px; padding-bottom: 56px; }
.page h1 { font-size: clamp(1.5rem, 3vw, 2rem); color: var(--purple-900); margin: 0 0 24px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: var(--bg); }
.panel--narrow { max-width: 560px; }
.panel p:last-child { margin-bottom: 0; display: flex; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); margin-top: 24px; }
.status__row dd .badge + .badge { margin-left: 4px; }

/* Espace expert (étape 3b) */
:root { --info: #1d4f91; --info-bg: #e6effb; }
.badge--info { background: var(--info-bg); color: var(--info); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.lead-small { color: var(--muted); max-width: 720px; margin: -12px 0 24px; }
.section-title { font-size: 1.15rem; color: var(--purple-900); margin: 36px 0 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th { font-weight: 600; color: var(--muted); font-size: .85rem; background: var(--bg-soft); }
.table .num { text-align: right; white-space: nowrap; }
.btn--small { padding: 5px 12px; font-size: .85rem; }
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.panel__title { font-size: 1.05rem; margin: 0 0 12px; color: var(--purple-900); }
.panel__head .panel__title { margin: 0; }
.task-content { white-space: pre-wrap; background: var(--bg-soft); border-radius: 8px; padding: 16px; margin: 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.criterion { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0; }
.criterion legend { font-weight: 600; padding: 0; float: left; width: 100%; margin-bottom: 8px; }
.criterion .hint, .criterion .scale { clear: both; }
.scale { display: flex; gap: 8px; flex-wrap: wrap; }
.scale__item { position: relative; }
.scale__item input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.scale__item span { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; color: var(--muted); }
.scale__item input:checked + span { background: var(--purple-700); border-color: var(--purple-700); color: #fff; }
.scale__item input:focus-visible + span { outline: 2px solid var(--purple-500); outline-offset: 2px; }
.scale__item:hover span { border-color: var(--purple-500); }
.field { display: block; font-weight: 600; margin: 16px 0 6px; }
textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
textarea:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 1px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.notice { padding: 10px 14px; border-radius: 8px; margin: 0 0 12px; font-size: .95rem; }
.notice--ok { background: var(--ok-bg); color: var(--ok); }
.notice--err { background: var(--err-bg); color: var(--err); }
.notice--warn { background: var(--warn-bg); color: var(--warn); }
.scores { margin: 0; }
.scores__row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.scores dd { margin: 0; font-weight: 600; }
.next { margin: 20px 0 0; font-size: .95rem; }
@media (max-width: 860px) {
  .task-layout { grid-template-columns: 1fr; }
}

/* Espace administrateur (étape 3c) */
.flash { margin: 20px 0 0; }
.panel--form { margin-top: 32px; max-width: 720px; }
input[type="text"], select { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
input[type="text"]:focus-visible, select:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 1px; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.form-inline .field-group { flex: 1 1 240px; }
.form-inline .field { margin-top: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.status-form { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 0 0 24px; }
.stats__item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.stats dt { color: var(--muted); font-size: .85rem; }
.stats dd { margin: 4px 0 0; font-size: 1.5rem; font-weight: 600; color: var(--purple-900); }
.two-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.plain-list li:first-child { border-top: 0; }
.criteria-list { margin: 0; padding-left: 20px; }
.criteria-list li { padding: 3px 0; }
.progress { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.progress__track { flex: 1; height: 8px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress__fill { height: 100%; background: var(--purple-500); }
.progress__label { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.progress__fill--0 { width: 0%; }
.progress__fill--10 { width: 10%; }
.progress__fill--20 { width: 20%; }
.progress__fill--30 { width: 30%; }
.progress__fill--40 { width: 40%; }
.progress__fill--50 { width: 50%; }
.progress__fill--60 { width: 60%; }
.progress__fill--70 { width: 70%; }
.progress__fill--80 { width: 80%; }
.progress__fill--90 { width: 90%; }
.progress__fill--100 { width: 100%; }
.page-head { margin-bottom: 16px; }
.page-head h1 { margin-bottom: 0; }
.page-head + .lead-small { margin-top: 0; }

/* Habilitations (étape 3d) */
.cards--compact { padding: 8px 0 0; grid-template-columns: repeat(auto-fit, minmax(240px, 320px)); }
.card--link { text-decoration: none; color: inherit; display: block; }
.card--link:hover { border-color: var(--purple-500); }
.card--link:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 2px; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 0; }
.checkbox input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--purple-700); }

/* Accessibilité (étape 3d) */
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 20; background: var(--purple-900); color: #fff; padding: 8px 14px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 12px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--purple-500); outline-offset: 2px; }
main:focus { outline: none; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Pages publiques et formulaires (branche purple-v3) */
.nav a.is-active { color: var(--purple-700); font-weight: 600; }
.btn--sm { padding: 6px 14px; }
.hero--compact { padding: 48px 0 40px; }
.hero--compact .kicker a { color: inherit; text-decoration: none; }
.section { padding-top: 40px; padding-bottom: 8px; }
.section__title { font-size: 1.25rem; color: var(--purple-900); margin: 0 0 16px; }
.cards--4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding-top: 0; }
.section .cards { padding-top: 0; }
.card h3 { font-size: 1.05rem; margin: 0 0 8px; color: var(--purple-900); }
.card--link { text-decoration: none; color: inherit; transition: border-color .15s; }
.card--link:hover { border-color: var(--purple-500); }
.card__link { display: inline-block; margin-top: 12px; font-weight: 500; text-decoration: none; }
.card--wide { max-width: none; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.narrow { max-width: 720px; }
.checklist, .steps { margin: 0; padding-left: 1.2em; }
.checklist li, .steps li { margin-bottom: 8px; }
.note { color: var(--muted); font-size: .9rem; }
.form { display: grid; gap: 16px; margin-top: 16px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: .95rem; }
.form input, .form select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.form input:focus, .form select:focus { outline: 2px solid var(--purple-500); outline-offset: 1px; border-color: transparent; }
.form .checkbox { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.form .checkbox input { margin-top: 4px; }
.form button { justify-self: start; cursor: pointer; }
.form--inline { grid-template-columns: 1fr auto; align-items: end; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.alert { border: 1px solid var(--err); background: var(--err-bg); color: var(--err); border-radius: var(--radius); padding: 12px 16px; }
.alert p, .alert ul { margin: 0; }
.commitments { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.commitments li { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 20px; }
.commitments li + li { border-top: 1px solid var(--line); }
.commitments .badge { white-space: nowrap; }
@media (max-width: 720px) {
  .two-cols, .form--inline { grid-template-columns: 1fr; }
  .topbar__actions > .btn--ghost { display: none; }  /* « Se connecter » seulement, pas « Se déconnecter » */
}
.btn { white-space: nowrap; }
.narrow h1 { color: var(--purple-900); }
@media (max-width: 420px) {
  .topbar__inner { gap: 12px; }
  .topbar .btn--sm { padding: 6px 10px; font-size: .85rem; }
}
