/* =============================================================================
   Aide intégrée (lot Q) : sommaire, pages, recherche, guide imprimable A4.
   ============================================================================= */

/* Recherche ----------------------------------------------------------------------- */
.aide-cherche { display: flex; gap: 8px; margin: 0; }
.aide-cherche input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 7px; background: var(--surface); font: 400 14px var(--font); color: var(--ink); }
.aide-cherche input:focus { border-color: var(--primary); background: #F2FBF4; outline: none; }
.aide-accueil { display: flex; flex-direction: column; gap: 10px; }
.aide-accueil p { margin: 0; }

/* Sommaire ------------------------------------------------------------------------ */
.aide-section { display: flex; flex-direction: column; gap: 10px; }
.aide-section-t { margin: 4px 0 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.aide-tile .badge { vertical-align: 1px; }

/* Page d'un sujet : colonne de navigation + texte ------------------------------------- */
.aide-cadre { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.aide-cote { flex: 1 1 240px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; }
.aide-texte { flex: 999 1 520px; min-width: 0; }
.aide-cote .aide-cherche { flex-direction: column; }
.aide-cote .aide-cherche .btn { justify-content: center; }
.aide-toc { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.aide-toc-t { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.aide-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.aide-toc a { display: block; padding: 5px 0; font-size: 13.5px; text-decoration: none; }
.aide-toc a:hover { text-decoration: underline; }
.aide-toc-pied { margin: 0; font-size: 13px; }
.aide-badge { font-size: 13px; vertical-align: 4px; }
.aide-suite { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.aide-suivant { text-align: right; }

/* Texte de l'aide ------------------------------------------------------------------ */
.aide-texte { font-size: 15px; line-height: 1.6; }
.aide-texte > :first-child { margin-top: 0; }
.aide-texte h2 { margin: 28px 0 8px; font-size: 19px; font-weight: 600; letter-spacing: -0.005em; scroll-margin-top: 16px; }
.aide-texte h3 { margin: 20px 0 6px; font-size: 16px; font-weight: 600; }
.aide-texte h4 { margin: 16px 0 4px; font-size: 15px; font-weight: 600; }
.aide-texte p, .aide-texte ul, .aide-texte ol, .aide-texte dl { margin: 0 0 12px; max-width: 78ch; }
.aide-texte ul, .aide-texte ol { padding-left: 22px; }
.aide-texte li { margin: 3px 0; }
.aide-texte li > ul, .aide-texte li > ol { margin: 4px 0; }
.aide-texte dt { font-weight: 600; margin-top: 8px; }
.aide-texte dd { margin: 2px 0 0 0; }
.aide-texte .kbd { font-size: 12px; line-height: 18px; padding: 0 6px; white-space: nowrap; }
.aide-texte .scroll-x { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 8px; }
.aide-texte .tbl { font-size: 14px; }
.aide-texte .tbl td { white-space: normal; vertical-align: top; }
.aide-texte .tbl td:first-child { min-width: 9em; }   /* libellé lisible à 390 px, le tableau défile au besoin */
.aide-btn { display: inline-block; padding: 0 7px; border: 1px solid var(--field); border-radius: 5px; background: var(--surface-2); font-size: 13.5px; font-weight: 500; line-height: 21px; white-space: nowrap; }

/* Pas-à-pas numérotés */
.aide-etapes { counter-reset: etape; list-style: none; padding-left: 0 !important; }
.aide-etapes > li { counter-increment: etape; position: relative; padding-left: 34px; margin: 8px 0; }
.aide-etapes > li::before { content: counter(etape); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; background: var(--blue-bg); color: var(--blue-ink); font: 600 13px/24px var(--font); text-align: center; }

/* Encadrés : règle à connaître, ancien programme, à confirmer, nouveau */
.aide-encadre { margin: 0 0 14px; max-width: 78ch; padding: 10px 14px; border-left: 4px solid var(--line); border-radius: 0 8px 8px 0; background: var(--surface-2); }
.aide-encadre > :last-child { margin-bottom: 0; }
.aide-encadre-t { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.aide-regle { border-left-color: #D9A400; background: var(--amber-bg); }
.aide-regle .aide-encadre-t { color: var(--amber-ink); }
.aide-ancien { border-left-color: var(--primary); background: var(--blue-bg); }
.aide-ancien .aide-encadre-t { color: var(--blue-ink); }
.aide-confirmer { border-left-color: var(--muted); background: var(--gray-bg); }
.aide-confirmer .aide-encadre-t { color: var(--gray-ink); }
.aide-attention { border-left-color: var(--red-ink); background: var(--red-bg); }
.aide-attention .aide-encadre-t { color: var(--red-ink); }

/* Résultats de recherche ------------------------------------------------------------ */
.aide-resultats { list-style: none; margin: 0; padding: 0; }
.aide-resultats li { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.aide-resultats li:last-child { border-bottom: 0; }
.aide-resultat-t { font-size: 16px; font-weight: 600; }
.aide-extrait { margin: 4px 0 0; color: var(--ink-2); }

/* Guide imprimable --------------------------------------------------------------------- */
.aide-garde { padding: 24px 0 8px; }
.aide-garde p { margin: 0 0 8px; }
.aide-garde-marque { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.aide-garde-titre { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
.aide-guide-sommaire h2 { margin: 20px 0 6px; font-size: 19px; }
.aide-guide-section { margin: 12px 0 2px; font-weight: 600; }
.aide-guide-sommaire ol { margin: 0; padding-left: 22px; }
.aide-chapitre { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.aide-chapitre > .crumb { margin: 0; }
.aide-chapitre > h2 { margin-top: 2px; font-size: 22px; }

/* Petits écrans ------------------------------------------------------------------------ */
@media (min-width: 900px) {
  .aide-cote { order: -1; }   /* à gauche sur grand écran ; sous le texte sur mobile */
}
@media (max-width: 899px) {
  .aide-cote { position: static; }
  .aide-texte { font-size: 14.5px; }
}
@media (max-width: 599px) {
  .aide-cherche { flex-direction: column; }
  .aide-cherche .btn { justify-content: center; }
  .aide-suivant { text-align: left; }
}

/* Impression A4 : le texte seul, chaque chapitre du guide sur une nouvelle page -------------- */
@page { size: A4; margin: 16mm 15mm; }
@media print {
  .aide-cote, .aide-suite, .aide-cherche, .pagehead .actions { display: none !important; }
  .aide-cadre { display: block; }
  .aide-texte, .aide-guide { padding: 0; border: 0; font-size: 10.5pt; line-height: 1.45; }
  .aide-texte p, .aide-texte ul, .aide-texte ol, .aide-encadre { max-width: none; }
  .aide-texte h2, .aide-texte h3, .aide-texte h4 { break-after: avoid; }
  .aide-etapes > li, .aide-encadre, .aide-texte tr { break-inside: avoid; }
  .aide-encadre, .aide-etapes > li::before, .badge, .kbd, .aide-btn { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .aide-texte a { color: inherit; text-decoration: none; }
  .aide-garde { padding-top: 60mm; }
  .aide-guide-sommaire { break-after: page; }
  .aide-chapitre { break-before: page; margin-top: 0; padding-top: 0; border-top: 0; }
}
