/* A3RT — diagnostic comptable
   Chargée après site.css. Fond dégradé doux, carte centrale blanche, stepper,
   grandes options cliquables, rapport imprimable. */

.diag {
  --blue: #3B3FDB;
  --blue-ink: #2F32B8;
  --blue-50: #EEF0FD;
  --rouge: #E0675A;
  --rouge-50: #FCECEA;
  --orange: #C9771F;
  --orange-50: #FCF1E3;
  --vert: #1F8A55;
  --vert-50: #E3F4EA;
  --n-50: #F6F7F9;
  --n-100: #ECEEF1;
  --n-200: #DFE2E7;
  --n-ink: #101217;
  --n-muted: #565C6B;
  --accent: var(--blue);
  --ombre: 0 1px 2px rgba(16, 18, 23, 0.04), 0 24px 48px -24px rgba(16, 18, 23, 0.18);
  min-height: 100dvh; display: flex; flex-direction: column;
  color: var(--n-ink);
  background:
    radial-gradient(60% 50% at 10% 0%, #E9EBFD 0%, transparent 70%),
    radial-gradient(50% 40% at 95% 10%, #FDEFE6 0%, transparent 70%),
    linear-gradient(180deg, #F7F8FC, #FFFFFF 60%);
}
.diag :focus-visible { outline-color: var(--blue); }
.diag h1, .diag h2, .diag h3 { font-family: var(--sans); font-weight: 500; color: var(--n-ink); }
.diag .btn { border-radius: 999px; min-height: 46px; padding-inline: 22px; }
.diag .btn-primary { background: var(--blue); }
.diag .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.diag .btn-contour { background: #fff; color: var(--n-ink); box-shadow: inset 0 0 0 1px var(--n-200); }
.diag .btn-grand { min-height: 52px; padding-inline: 28px; font-size: 16px; }
.diag [hidden] { display: none !important; }

/* ---------- En-tête et pied ---------- */
.diag-entete { display: flex; align-items: center; justify-content: space-between; height: 68px; padding-inline: var(--frame-x); }
.diag-logo img { width: 84px; height: 38px; }
.diag-retour { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; color: var(--n-muted); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .diag-retour:hover { color: var(--n-ink); } }
.diag-pied { margin-top: auto; padding: 32px var(--pad); text-align: center; font-size: 13px; color: var(--n-muted); }
.diag-pied a { color: inherit; text-underline-offset: 3px; }

/* ---------- Introduction ---------- */
.diag-main { width: 100%; max-width: 760px; margin-inline: auto; padding: clamp(24px, 5vw, 56px) var(--pad) 24px; }
.diag-intro { text-align: center; margin-bottom: 36px; }
.diag-intro h1 { font-size: clamp(32px, 2.4vw + 20px, 48px); line-height: 1.06; letter-spacing: -0.04em; }
.diag-intro > p { max-width: 56ch; margin: 18px auto 0; font-size: 17px; color: var(--n-muted); }
.diag-pastilles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.diag-pastilles li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px var(--n-100); font-size: 14px; }
.diag-pastilles svg { color: var(--blue); }

/* ---------- Carte et stepper ---------- */
.diag-carte { max-width: 720px; margin-inline: auto; padding: clamp(20px, 4vw, 40px); border-radius: 24px; background: #fff; box-shadow: var(--ombre); scroll-margin-top: 16px; }
.stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: clamp(28px, 4vw, 40px); }
.pas { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 12px; align-items: center; color: var(--n-muted); }
.pas-icone { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--n-100); transition: background-color 200ms ease, color 200ms ease; }
.pas-texte { display: grid; min-width: 0; }
.pas-titre { font-size: 14px; font-weight: 500; line-height: 1.3; }
.pas-sous { font-size: 12.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pas-barre { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: var(--n-100); overflow: hidden; }
.pas-barre span { display: block; height: 100%; border-radius: inherit; background: var(--blue); transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform 320ms var(--ease-out); }
.pas.is-actuel { color: var(--n-ink); }
.pas.is-actuel .pas-icone { background: var(--blue); color: #fff; }
.pas.is-fait .pas-icone { background: var(--blue-50); color: var(--blue); }

/* ---------- Étapes ---------- */
.etape h2 { font-size: clamp(24px, 1vw + 18px, 30px); letter-spacing: -0.03em; }
.etape-sous { margin-top: 8px; font-size: 15.5px; color: var(--n-muted); }
.champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.champ { display: grid; gap: 6px; }
.champ--large { grid-column: 1 / -1; }
.champ label { font-size: 14px; font-weight: 500; }
.champ input, .champ select {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--n-200); border-radius: 12px;
  background: #fff; color: var(--n-ink); font: inherit; font-size: 16px;
}
.champ input:focus-visible, .champ select:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.etape[data-submitted] .champ input:invalid { border-color: var(--rouge); }
.consentement { display: flex; align-items: flex-start; gap: 12px; margin-top: 24px; font-size: 14px; line-height: 1.5; color: var(--n-muted); }
.consentement input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--blue); }
.consentement a { color: var(--n-ink); text-underline-offset: 3px; }
.erreur { margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: var(--rouge-50); color: #9B3226; font-size: 14px; }
.etape-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 32px; }

/* Questions */
.q-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.q-compteur { font-size: 14px; font-weight: 500; color: var(--n-muted); }
.q-axe { font-size: 12.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue); }
.q-barre { height: 6px; margin-top: 12px; border-radius: 999px; background: var(--n-100); overflow: hidden; }
.q-barre span { display: block; height: 100%; background: var(--blue); border-radius: inherit; transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform 320ms var(--ease-out); }
.q { border: 0; margin-top: 28px; }
.q legend { font-size: clamp(21px, 0.8vw + 17px, 26px); font-weight: 500; line-height: 1.25; letter-spacing: -0.02em; text-wrap: balance; }
.options { display: grid; gap: 10px; margin-top: 24px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 14px 18px;
  border: 1px solid var(--n-200); border-radius: 14px; font-size: 16px; cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-rond { width: 20px; height: 20px; flex: none; border: 1.5px solid var(--n-200); border-radius: 50%; transition: border-color 160ms ease, box-shadow 160ms ease; }
@media (hover: hover) and (pointer: fine) { .opt:hover { border-color: #C3C7D0; background: var(--n-50); } }
.opt:has(input:checked) { border-color: var(--blue); background: var(--blue-50); color: var(--blue-ink); }
.opt:has(input:checked) .opt-rond { border-color: var(--blue); box-shadow: inset 0 0 0 5px var(--blue); }
.opt:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.opt:active { transform: scale(0.99); }

/* ---------- Rapport ---------- */
.rapport { outline: none; }
.rapport h3 { font-size: 22px; letter-spacing: -0.02em; }
.rapport-tete { padding-bottom: 24px; border-bottom: 1px solid var(--n-100); }
.rapport-sur, .sur-titre { font-size: 12.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--n-muted); }
.rapport-tete h2 { margin-top: 6px; }
.rapport-date { margin-top: 4px; font-size: 14px; color: var(--n-muted); }
.rapport > div + div { margin-top: 40px; }
.note { margin-top: 14px; font-size: 13.5px; color: var(--n-muted); }

.bloc-score { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; align-items: center; margin-top: 32px !important; }
.bloc-score h3 { margin-top: 6px; font-size: 28px; }
.badge-niveau { display: inline-block; margin-top: 12px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.badge--faible { background: var(--rouge-50); color: #B4473A; }
.badge--moyen { background: var(--orange-50); color: #9A5A12; }
.badge--bon { background: var(--vert-50); color: var(--vert); }
.avec-a3rt { margin-top: 16px; font-size: 16px; }
.avec-a3rt strong { color: var(--blue); font-weight: 500; }
.jauge { width: 200px; height: 200px; }
.jauge circle { fill: none; stroke-width: 14; stroke-linecap: round; }
.jauge-fond { stroke: var(--n-100); }
.jauge--faible { stroke: var(--rouge); }
.jauge--moyen { stroke: #E39A3B; }
.jauge--bon { stroke: var(--vert); }
.jauge-score { font-family: var(--sans); font-size: 48px; font-weight: 500; letter-spacing: -0.04em; fill: var(--n-ink); }
.jauge-unite { font-family: var(--sans); font-size: 14px; fill: var(--n-muted); }

.radar-cadre { margin-top: 20px; padding: 20px; border-radius: 18px; background: var(--n-50); }
.radar { display: block; width: 100%; max-width: 440px; margin-inline: auto; overflow: visible; }
.radar-grille { fill: none; stroke: var(--n-200); stroke-width: 1; }
.radar-rayon { stroke: var(--n-200); stroke-width: 1; }
.radar-label { font-family: var(--sans); font-size: 13px; fill: var(--n-ink); }
.radar-actuel { fill: rgba(224, 103, 90, 0.18); stroke: var(--rouge); stroke-width: 2; stroke-linejoin: round; }
.radar-a3rt { fill: rgba(59, 63, 219, 0.12); stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; }
.legende { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-top: 12px; font-size: 14px; }
.legende li { display: inline-flex; align-items: center; gap: 8px; }
.puce { width: 12px; height: 12px; border-radius: 50%; }
.puce--actuel { background: var(--rouge); }
.puce--a3rt { background: var(--blue); }

.barres { display: grid; gap: 22px; margin-top: 28px; }
.barre-tete { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.barre-nom { font-weight: 500; }
.barre-valeurs { color: var(--n-muted); font-variant-numeric: tabular-nums; }
.barre { position: relative; height: 8px; margin: 10px 7px 0; border-radius: 999px; background: var(--n-100); }
.barre-ecart { position: absolute; top: 0; bottom: 0; background: #C9CBF6; border-radius: 999px; }
.point { position: absolute; top: 50%; width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 1px 3px rgba(16, 18, 23, 0.2); }
.point--actuel { background: var(--rouge); }
.point--a3rt { background: var(--blue); }
.barres p { margin-top: 10px; font-size: 14px; color: var(--n-muted); }

.bloc-pistes ol { display: grid; gap: 12px; margin-top: 20px; }
.bloc-pistes li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 20px; border-radius: 16px; background: var(--n-50); }
.piste-num { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; color: var(--blue); }
.piste-titre { font-weight: 500; }
.bloc-pistes li p:not(.piste-titre) { margin-top: 4px; font-size: 15px; color: var(--n-muted); }

.bloc-cta { padding: clamp(24px, 4vw, 36px); border-radius: 20px; background: var(--blue-50); }
.pastille { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #fff; font-size: 13px; font-weight: 500; color: var(--blue-ink); }
.bloc-cta h3 { margin-top: 14px; font-size: clamp(22px, 1vw + 17px, 28px); }
.bloc-cta > p:not(.pastille) { margin-top: 10px; font-size: 16px; color: #3A3F4B; }
.bloc-cta .btn { margin-top: 22px; }
.rapport-actions { display: flex; flex-wrap: wrap; gap: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .etape:not([hidden]) { animation: etape-in 280ms var(--ease-out) both; }
  @keyframes etape-in { from { opacity: 0; transform: translateY(6px); } }
}
@media (prefers-reduced-motion: reduce) {
  .pas-barre span, .q-barre span { transition: none; }
}

.envoi-statut { margin-top: 24px; padding: 12px 16px; border-radius: 12px; background: var(--vert-50); color: var(--vert); font-size: 14.5px; }
.envoi-statut--echec { background: var(--n-50); color: var(--n-muted); }
.envoi-statut a { color: inherit; text-underline-offset: 3px; }
.rapport > .envoi-statut + .rapport-actions { margin-top: 16px; }

/* ---------- Mobile ---------- */
@media (max-width: 599px) {
  .stepper { gap: 8px; }
  .pas { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .pas-texte { display: none; }
  .champs { grid-template-columns: minmax(0, 1fr); }
  .etape-actions .btn-contour { flex: 0 0 auto; }
  .etape-actions .btn-primary { flex: 1 1 0; min-width: 0; padding-inline: 16px; }
  .radar-label { font-size: 17px; }
  .etape-actions > span:empty { display: none; }
  .bloc-score { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .bloc-score > div { order: 2; }
  .radar-cadre { padding: 12px 4px; }
  .rapport-actions .btn { flex: 1; }
}

/* ---------- Impression : le rapport seul ---------- */
@media print {
  .diag { background: #fff; }
  .diag-entete, .diag-pied, .diag-intro, .stepper, .rapport-actions, .envoi-statut, .bloc-cta .btn, .skip-link { display: none !important; }
  .diag-main { max-width: none; padding: 0; }
  .diag-carte { max-width: none; padding: 0; box-shadow: none; }
  .bloc-score, .radar-cadre, .barres li, .bloc-pistes li, .bloc-cta, .bloc-axes h3, .bloc-pistes h3 { break-inside: avoid; break-after: auto; }
  .bloc-axes h3, .bloc-pistes h3 { break-after: avoid; }
  .radar-cadre, .bloc-pistes li, .bloc-cta { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .jauge, .barre, .point, .badge-niveau, .barre-ecart { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
