/* =====================================================
   Entretiens RH : feuille de style
   ===================================================== */
:root {
  --primary: #5b47b8;
  --primary-dark: #45348f;
  --accent: #e06040;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1c1f2a;
  --muted: #6b7280;
  --border: #e3e7ef;
  --success: #1e9e6a;
  --warning: #d97706;
  --danger: #c2410c;
  --shadow: 0 1px 3px rgba(20,30,60,.06), 0 4px 16px rgba(20,30,60,.04);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 2px 32px;
  background: white;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  font-size: 17px;
}
.brand .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  letter-spacing: -.5px;
}
.brand .logo-img {
  display: block;
  height: 88px;
  width: auto;
  max-width: 320px;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  margin: 0;
}
.topbar nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.topbar nav a:not(.btn) { color: #333; font-size: 16px; font-weight: 500; }
.topbar nav a:not(.btn):hover { color: var(--primary); }
.topbar nav a.btn-primary { color: #fff; font-size: 16px; }
.topbar nav a.btn-outline { color: var(--primary); font-size: 16px; }
.user-chip {
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

/* ---- Layout ---- */
.container {
  max-width: 1200px;
  margin: 0 auto 28px;
  padding: 0 24px;
}
.footer {
  margin-top: 60px;
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.footer .legal { margin-top: 6px; font-style: italic; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: transform .04s ease, box-shadow .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: white; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: #f1edfa; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font: inherit; padding: 0;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.card-narrow {
  max-width: 480px;
  margin: 40px auto;
}
.card h2 { margin-top: 0; }
.card h3.cat {
  margin-top: 22px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

/* ---- Forms ---- */
.form label {
  display: block;
  margin-bottom: 14px;
  font-size: 14px;
  color: #333;
}
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=date], .form input[type=tel], .form input[type=number],
.form input[type=url], .form select, .form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-top: 4px;
  font-family: inherit;
  background: white;
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,89,195,.15);
}
.form .row { display: flex; gap: 14px; }
.form .row > label { flex: 1; }
.form fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.form legend { font-weight: 600; padding: 0 6px; color: var(--primary); }
.form .checkbox, .form .radio {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.form .checkbox input, .form .radio input { width: auto; margin: 0; }
.form .req { color: var(--danger); }

.form-inline {
  display: flex; gap: 8px; align-items: center; margin-top: 14px;
}
.form-inline input, .form-inline select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
}

.inline { display: inline; }

/* ---- Flash messages ---- */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-success { background: #e8f8f0; color: #0a6c46; }
.flash-error   { background: #fdecea; color: #8a1c1c; }
.flash-info    { background: #eaf2ff; color: #163a8a; }

/* ---- Hero / landing ---- */
.hero {
  text-align: center;
  padding: 20px 20px 40px;
}
.hero h1 {
  font-size: 36px; margin: 0 0 14px; line-height: 1.15;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead {
  font-size: 18px;
  color: #444;
  max-width: 720px;
  margin: 0 auto 28px;
}
.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---- Offers ---- */
.offers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 40px 0;
}
.offer {
  background: white;
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
  position: relative;
}
.offer-accent { border-top-color: var(--accent); }
.offer-badge {
  position: absolute;
  top: -12px; left: 28px;
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
}
.offer-accent .offer-badge { background: var(--accent); }
.offer ul { padding-left: 18px; margin: 14px 0 20px; }
.offer li { margin: 6px 0; }

/* ---- Features ---- */
.features { margin: 50px 0; }
.features h2 { text-align: center; margin-bottom: 24px; }
.features .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.features article {
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.features h3 { margin-top: 0; }

.legal-box {
  background: #fffbe6;
  border-left: 4px solid var(--warning);
  padding: 18px 22px;
  border-radius: 8px;
  margin: 30px 0;
}
.legal-box h3 { margin-top: 0; color: var(--warning); }

/* ---- KPIs ---- */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.kpi, .kpi-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--text);
  transition: transform .08s ease;
}
.kpi:hover { transform: translateY(-1px); text-decoration: none; }
.kpi-num { font-size: 28px; font-weight: 800; color: var(--primary); }
.kpi-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }

/* ---- Tables ---- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  background: #fafbfd;
}
.table tbody tr:hover { background: #f8faff; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #eef0f4;
  color: #444;
}
.badge-planifie               { background:#eef2ff; color:#3949ab; }
.badge-questionnaire_envoye   { background:#fff4e5; color:#a35200; }
.badge-questionnaire_complete { background:#e8f8f0; color:#0a6c46; }
.badge-realise                { background:#e6f1ff; color:#1e3a8a; }
.badge-annule                 { background:#fdecea; color:#8a1c1c; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eef0f4;
  font-size: 11px;
  margin-right: 4px;
  color: #444;
}
.tag-haute { background: #fde2cf; color: #8a3a00; }
.tag-moyenne { background: #eef2ff; color: #3949ab; }
.tag-faible { background: #f0f0f0; color: #555; }

/* ---- Filters ---- */
.filters {
  display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap;
}
.filters a {
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #555;
  font-size: 13px;
}
.filters a.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ---- Page head ---- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; }
.back { color: var(--muted); font-size: 13px; display: inline-block; margin-bottom: 6px; }

/* ---- Q/A view ---- */
.qa { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.qa .q { font-weight: 600; margin-bottom: 4px; }
.qa .a { color: #333; padding-left: 12px; border-left: 3px solid var(--primary); }

/* ---- Key/value ---- */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-size: 14px; }

/* ---- Grids ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }

/* ---- Question list ---- */
.question-list { list-style: decimal; padding-left: 20px; }
.question-list li {
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ---- Formations ---- */
.formations { list-style: none; padding: 0; margin: 0 0 10px; }
.formations li { padding: 8px 0; border-bottom: 1px dashed var(--border); }

/* ---- Stats : parité ---- */
.parite-bar {
  display: flex;
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.parite-bar > div {
  color: white;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.seg-h { background: #4f7ed6; }
.seg-f { background: #e07cbb; }
.seg-a { background: #888; }

/* ---- Pyramide des âges ---- */
.pyramide { width: 100%; border-collapse: collapse; }
.pyramide td { padding: 3px 2px; width: 45%; }
.pyramide th { width: 10%; text-align: center; font-size: 12px; color: var(--muted); }
.pyramide .b-h { text-align: right; }
.pyramide .b-f { text-align: left; }
.bar-h, .bar-f {
  height: 18px;
  font-size: 11px;
  color: white;
  padding: 0 4px;
  border-radius: 3px;
  line-height: 18px;
}
.bar-h { background: #4f7ed6; margin-left: auto; text-align: right; }
.bar-f { background: #e07cbb; text-align: left; }
.legend { font-size: 12px; color: var(--muted); margin-top: 8px; }
.dot-h, .dot-f { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.dot-h { background: #4f7ed6; }
.dot-f { background: #e07cbb; }

/* ---- Bar charts (listes) ---- */
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.b-bar { height: 14px; background: #eef0f4; border-radius: 4px; overflow: hidden; }
.b-bar > span { display: block; height: 100%; background: var(--primary); }
.b-orange { background: var(--accent) !important; }
.b-val { text-align: right; font-weight: 600; }

/* ---- Mini bar for taux ---- */
.mini-bar { display: inline-block; width: 80px; height: 8px; background: #eef0f4; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--success); }

.alert { border-left: 4px solid var(--warning); }

.muted { color: var(--muted); }
.center { text-align: center; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .offers, .grid-2, .grid-3, .features .grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .form .row { flex-direction: column; gap: 0; }
  .topbar { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* =====================================================================
   Responsive mobile / tablette : V1.20 Phase 7
   ===================================================================== */
@media (max-width: 1024px) {
  .container { padding: 0 16px; }
  .table { font-size: .9rem; }
  .kpis { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  /* Topbar : logo plus petit, menu pliable */
  .topbar { padding: 4px 12px; flex-wrap: wrap; gap: 8px; }
  .brand .logo-img { height: 48px; max-width: 160px; }
  .topbar nav { gap: 12px; flex-wrap: wrap; font-size: .85rem; }
  .topbar nav a:not(.btn) { font-size: .9rem; }
  .user-chip { display: none; }  /* trop large sur mobile */

  /* Tables : scroll horizontal au lieu de casser */
  .card { overflow-x: auto; }
  .table { font-size: .82rem; min-width: 0; }
  .table th, .table td { padding: 6px 8px; }

  /* KPIs : 1 colonne mobile */
  .kpis { grid-template-columns: 1fr !important; }
  .kpi-num { font-size: 1.4rem !important; }

  /* Formulaires : row → colonne */
  .form .row { flex-direction: column; gap: 0; }
  .form-inline { flex-direction: column; align-items: stretch; gap: 8px; }

  /* Page head : titre + actions empilés */
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .actions-row { flex-wrap: wrap; gap: 6px; }
  .btn { font-size: .9rem; padding: 8px 14px; }

  /* Hero landing */
  .hero h1 { font-size: 24px !important; }
  .hero .lead { font-size: 15px; }

  /* Questionnaire salarié : champs plus larges, plus de marge */
  .form label { display: block; margin-bottom: 10px; }
  .form textarea, .form input[type="text"], .form input[type="email"], .form input[type="tel"], .form input[type="number"], .form input[type="date"], .form select { font-size: 16px; }  /* évite zoom iOS */
}

@media (max-width: 480px) {
  .topbar nav { font-size: .8rem; }
  .table thead { display: none; }
  .table tbody tr { display: block; margin-bottom: 12px; border: 1px solid #eee; border-radius: 6px; padding: 8px; }
  .table tbody td { display: block; padding: 4px 0; border: 0; }
  .table tbody td::before {
    content: attr(data-label) ":\00a0";
    font-weight: 600;
    color: #666;
  }
}

/* === V1.34 : Aide contextuelle légale (tooltips accessibles) === */
.aide-legale {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 50%;
  background: #eef2ff;
  color: #5b47b8;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
  border: 1px solid #c7d2fe;
  user-select: none;
}
.aide-legale:hover, .aide-legale:focus {
  background: #5b47b8;
  color: #fff;
  outline: 2px solid #c7d2fe;
  outline-offset: 1px;
}
/* Tooltip riche (au survol uniquement : fallback title="" pour les autres cas) */
.aide-legale::after {
  content: attr(data-aide-titre) " : " attr(data-aide-texte) " (" attr(data-aide-ref) ")";
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  width: 320px;
  text-align: left;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .15s, visibility .15s;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.aide-legale::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
}
.aide-legale:hover::after, .aide-legale:focus::after,
.aide-legale:hover::before, .aide-legale:focus::before {
  opacity: 1;
  visibility: visible;
}
/* Aide en bloc (encart) */
.aide-bloc {
  background: #f8fafc;
  border-left: 3px solid #5b47b8;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 14px;
  color: #444;
}
.aide-bloc strong { color: #5b47b8; }

@media (max-width: 480px) {
  /* Sur mobile : pas de tooltip CSS : l'attribut title="" du navigateur fait le job */
  .aide-legale::after, .aide-legale::before { display: none; }
}

/* === V1.35 : Accessibilité WCAG 2.1 AA === */

/* Skip-link : invisible jusqu'au focus clavier */
.skip-link {
  position: absolute;
  left: -10000px;
  top: 6px;
  padding: 10px 16px;
  background: #1f2937;
  color: white !important;
  font-weight: 700;
  border-radius: 6px;
  z-index: 10000;
  text-decoration: none;
}
.skip-link:focus {
  left: 16px;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Focus visible cohérent sur tous les éléments interactifs */
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid #5b47b8;
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #5b47b8;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(91, 71, 184, .2);
}

/* Cible <main> tabindex pour que le skip-link fonctionne */
main[tabindex="-1"]:focus { outline: none; }

/* Renforcement des contrastes (.muted était limite sur fond clair) */
.muted, small.muted { color: #4b5563; }  /* 7:1 sur bg blanc : AAA */
.flash-info { color: #1e3a8a; }          /* WCAG AA sur fond clair */

/* Indication explicite des champs requis (au-delà de l'astérisque) */
label.required::after, label[for]:has(+ input[required])::after { content: ""; }
input:required, select:required, textarea:required {
  background-image: linear-gradient(to right, transparent calc(100% - 6px), #c2410c calc(100% - 6px));
}

/* État disabled lisible */
button:disabled, input:disabled, select:disabled, textarea:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Liens dans le contenu : underline pour les distinguer du texte */
.container a:not(.btn):not(.brand):not(.aide-legale):not(.cal-event) {
  text-decoration: underline;
  text-decoration-color: rgba(91, 71, 184, .35);
  text-underline-offset: 2px;
}
.container a:not(.btn):not(.brand):hover { text-decoration-color: currentColor; }

/* Tailles minimales tactiles (WCAG 2.5.5) : 44x44 css px */
.btn, button, .topbar nav a, .table a {
  min-height: 36px;
}

/* Reduced motion : respecte la préférence système */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Forme/icône en plus de la couleur pour les statuts (daltonisme) */
.badge::before {
  display: inline-block;
  margin-right: 4px;
  font-weight: 700;
}
.badge-realise::before, .badge-finalise::before { content: "✓"; }
.badge-annule::before { content: "✕"; }
.badge-en_cosignature::before, .badge-questionnaire_envoye::before, .badge-questionnaire_complete::before, .badge-planifie::before { content: "•"; }

/* === V1.41 : Polish UI (empty states, page 404, helpers) === */

/* État vide cohérent (à utiliser : <div class="empty-state">...</div>) */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}
.empty-state .icon { font-size: 3em; opacity: .6; margin-bottom: 12px; }
.empty-state h3 { margin: 0 0 6px; color: #4b5563; }
.empty-state p { margin: 0 0 14px; font-size: .95em; }

/* Bouton petit (utilisé dans les listes d'actions) */
.btn-sm { padding: 4px 10px; font-size: .85em; min-height: 30px; }

/* Loader inline pour requêtes asynchrones */
.loader {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid #c7d2fe;
  border-top-color: #5b47b8;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loader { animation: none; border-top-color: #5b47b8; } }

/* Card en hover (pour cartes cliquables) */
.card-hover {
  transition: box-shadow .15s, transform .15s;
  cursor: pointer;
}
.card-hover:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

/* Code inline harmonisé */
code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #5b47b8;
}
pre code { background: transparent; padding: 0; color: inherit; }

/* === V1.42 : Navigation refactor (dropdowns groupés + mobile) === */

/* Reset et amélioration de la topbar nav */
.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar nav > a,
.topbar nav > details > summary {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.topbar nav > a:hover,
.topbar nav > details > summary:hover {
  background: #eef2ff;
  color: #5b47b8;
}
.topbar nav > a.active,
.topbar nav > a[aria-current="page"] {
  background: #5b47b8;
  color: #fff;
  font-weight: 600;
}

/* Dropdown groups */
.nav-group {
  position: relative;
}
.nav-group > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
  content: "▾";
  font-size: 10px;
  color: #9ca3af;
  margin-left: 2px;
  transition: transform .15s;
}
.nav-group[open] > summary {
  background: #eef2ff;
  color: #5b47b8;
}
.nav-group[open] > summary::after {
  transform: rotate(180deg);
  color: #5b47b8;
}
.nav-group > ul {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 250px;
  background: #fff;
  border: 1px solid #e3e7ef;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(20,30,60,.12), 0 2px 6px rgba(20,30,60,.06);
  padding: 6px;
  margin: 0;
  list-style: none;
  z-index: 1000;
}
.nav-group > ul > li {
  margin: 0;
}
.nav-group > ul > li > a {
  display: block;
  padding: 9px 14px;
  border-radius: 6px;
  color: #374151;
  font-size: 14px;
  text-decoration: none;
  transition: background .1s;
  font-weight: 400;
}
.nav-group > ul > li > a:hover,
.nav-group > ul > li > a:focus-visible {
  background: #eef2ff;
  color: #5b47b8;
}
.nav-group > ul > li.divider {
  height: 1px;
  margin: 6px 4px;
  background: #e3e7ef;
}
.nav-group > ul > li.user-context {
  padding: 8px 14px;
  font-size: 12px;
  color: #6b7280;
  font-style: normal;
}

/* User menu (compact, à droite) */
.nav-user {
  margin-left: auto;
}
.nav-user > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
}
.nav-user > summary:hover { background: #eef2ff; }
.nav-user .user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #5b47b8;
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.nav-user .user-email {
  font-size: 13px;
  color: #374151;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-user > ul {
  left: auto;
  right: 0;
  min-width: 260px;
}

/* Sélecteur entreprise (superadmin) */
.ent-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}
.ent-switcher select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e3e7ef;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  max-width: 200px;
}

/* Bouton hamburger (mobile) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #374151;
  margin: 4px 0;
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Utilitaire screen-reader only */
.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;
}

/* ---- Mobile / tablette ≤ 900px ---- */
@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    padding: 8px 16px;
    align-items: center;
  }
  .nav-toggle {
    display: block;
    order: 2;
  }
  #primary-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 12px;
    border-top: 1px solid #e3e7ef;
    margin-top: 8px;
    order: 3;
  }
  #primary-nav.open { display: flex; }
  .topbar nav > a,
  .topbar nav > details > summary {
    width: 100%;
    padding: 12px 14px;
    border-radius: 6px;
  }
  .nav-group > ul {
    position: static;
    box-shadow: none;
    border: none;
    background: #f8fafc;
    margin-top: 4px;
    padding: 4px 0 4px 8px;
    width: 100%;
  }
  .nav-user {
    margin-left: 0;
    margin-top: 8px;
    border-top: 1px solid #e3e7ef;
    padding-top: 8px;
  }
  .nav-user > summary {
    background: transparent;
    border-radius: 0;
    padding: 8px 0;
  }
  .nav-user .user-email { max-width: none; }
  .ent-switcher { width: 100%; margin: 0 0 8px; }
  .ent-switcher select { max-width: none; width: 100%; }
}

/* Override des anciennes règles qui forçaient les liens (gardé pour compat ascendante) */
.topbar nav a:not(.btn) { color: inherit; font-size: inherit; font-weight: inherit; }
.topbar nav a:not(.btn):hover { color: inherit; }
.topbar nav a.btn-primary { color: #fff !important; font-size: 14px; padding: 8px 16px; }
.topbar nav a.btn-outline { color: var(--primary); font-size: 14px; }

/* === Offer card désactivée (formule temporairement inactive) === */
.offer-disabled {
  position: relative;
  opacity: .55;
  filter: grayscale(.4);
  pointer-events: none;
  user-select: none;
}
.offer-disabled .btn { cursor: not-allowed; }
.offer-disabled .offer-status {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #fff;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  letter-spacing: .02em;
  pointer-events: auto;
}
.offer-disabled .offer-badge {
  background: #9ca3af !important;
  color: #fff;
}

/* === Cartes légales (section "Pourquoi c'est important") === */
.legal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.legal-card {
  background: #fff;
  border: 1px solid #e3e7ef;
  border-left: 4px solid #5b47b8;
  border-radius: 10px;
  padding: 16px 20px;
}
.legal-card h4 {
  margin: 0 0 12px;
  font-size: 15px;
  color: #5b47b8;
}
.legal-card ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}
.legal-card ul li { margin-bottom: 8px; }
.legal-card ul li:last-child { margin-bottom: 0; }

/* === Bandeau "date pivot" (échéance de mise en conformité) === */
.legal-pivot {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-left: 5px solid #d97706;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 20px 0;
  color: #78350f;
}
.legal-pivot-icon { font-size: 2em; line-height: 1; flex: 0 0 auto; }
.legal-pivot strong { color: #92400e; font-size: 1.1em; }

/* === Radio désactivé (formule temporairement indisponible) === */
.radio-disabled {
  opacity: .55;
  cursor: not-allowed;
}
.radio-disabled input { cursor: not-allowed; }
.radio-disabled .offer-status {
  display: inline-block;
  margin-left: 8px;
  background: #fff;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  vertical-align: middle;
}

/* === Recherche SIRET (autocomplete inscription) === */
.siret-search { position: relative; margin-bottom: 14px; }
.siret-results {
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  z-index: 50;
  background: #fff;
  border: 1px solid #e3e7ef;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(20,30,60,.14);
  max-height: 320px;
  overflow-y: auto;
  margin-top: 4px;
}
.siret-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid #f0f2f7;
  padding: 10px 14px;
  cursor: pointer;
}
.siret-item:hover, .siret-item:focus-visible { background: #eef2ff; }
.siret-item:last-child { border-bottom: 0; }
.siret-nom { display: block; font-weight: 600; color: #1c1f2a; font-size: 14px; }
.siret-meta { display: block; font-size: 12px; color: #6b7280; margin-top: 2px; }
.siret-ferme { color: #c2410c; font-weight: 400; font-size: 12px; }
.siret-empty { padding: 12px 14px; color: #6b7280; font-size: 13px; }

/* === Curseur de notation 0–10 (questions type "note") === */
.note-range { padding: 4px 2px 0; }
.note-range input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  height: 28px;
  cursor: pointer;
}
.note-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}
.note-end { font-size: 12px; color: #9ca3af; font-weight: 600; }
.note-bubble {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 3px 12px;
  border-radius: 999px;
  min-width: 64px;
  text-align: center;
}

/* === Indication de barème (1 = …, 10 = …) en orange === */
.echelle-hint { color: var(--warning); font-weight: 500; }

/* === V1.57 : Onboarding interactif === */
/* Overlay coachmarks */
.ob-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(17,24,39,.55); }
.ob-spot {
  position: fixed; border-radius: 8px; display: none;
  box-shadow: 0 0 0 9999px rgba(17,24,39,.55);
  border: 2px solid #5b47b8; transition: all .25s ease; pointer-events: none;
}
.ob-pop {
  position: fixed; background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 18px 50px rgba(0,0,0,.30); width: 340px; max-width: calc(100vw - 24px); z-index: 10000;
}
.ob-pop .ob-step { font-size: 12px; color: #9ca3af; font-weight: 600; margin-bottom: 4px; }
.ob-pop h3 { margin: 0 0 8px; font-size: 1.1em; color: #1c1f2a; }
.ob-pop p { margin: 0 0 16px; font-size: .92em; color: #4b5563; line-height: 1.5; }
.ob-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ob-actions .ob-nav { display: inline-flex; gap: 8px; }
.ob-actions button { cursor: pointer; border-radius: 7px; padding: 7px 12px; font-size: .85em; border: 1px solid transparent; }
.ob-skip { background: none; color: #6b7280; }
.ob-skip:hover { color: #c2410c; }
.ob-prev { background: #f3f4f6; color: #374151; }
.ob-next { background: #5b47b8; color: #fff; font-weight: 600; }
.ob-next:hover { background: #45348f; }

/* Checklist « Premiers pas » */
.onb-card { border-left: 4px solid #5b47b8; }
.onb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.onb-progress { flex: 1; min-width: 180px; height: 10px; background: #eef0f5; border-radius: 6px; overflow: hidden; }
.onb-progress > span { display: block; height: 100%; background: linear-gradient(90deg,#5b47b8,#7c5fc7); transition: width .4s; }
.onb-steps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.onb-step { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid #eef0f5; border-radius: 10px; text-decoration: none; color: inherit; transition: background .12s, border-color .12s; }
.onb-step:hover { background: #f8fafc; border-color: #d3c9f1; }
.onb-step.done { opacity: .62; }
.onb-step .onb-ic { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex: 0 0 auto; background: #eef2ff; }
.onb-step.done .onb-ic { background: #e8f8f0; }
.onb-step .onb-txt { flex: 1; }
.onb-step .onb-txt strong { display: block; font-size: .95em; }
.onb-step .onb-txt small { color: #6b7280; }
.onb-step .onb-state { font-weight: 700; font-size: 1.1em; }
.onb-step.done .onb-state { color: #1e9e6a; }
.onb-step .onb-state.todo { color: #9ca3af; font-size: .85em; font-weight: 500; }

/* === V1.58 : Dictée vocale (Web Speech API) === */
.dictee-bar { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; }
.dictee-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef2ff; color: #5b47b8; border: 1px solid #d3c9f1;
  border-radius: 999px; padding: 5px 12px; font-size: .85em; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.dictee-btn:hover { background: #e0e4fb; }
.dictee-btn.rec {
  background: #c2410c; color: #fff; border-color: #c2410c;
  animation: dictee-pulse 1.2s infinite;
}
@keyframes dictee-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(194,65,12,.45); }
  50%     { box-shadow: 0 0 0 6px rgba(194,65,12,0); }
}
@media (prefers-reduced-motion: reduce) { .dictee-btn.rec { animation: none; } }
.dictee-status { font-size: .82em; }
.dictee-unsupported { margin: 4px 0 8px; opacity: .8; }
