:root {
  color-scheme: light;
  --marine: #12305C;
  --marine-fonce: #0B2044;
  --marine-pale: #E8EDF5;
  --rouge: #C8102E;
  --rouge-fonce: #A00D25;
  --rouge-pale: #FCEBEE;
  --encre: #14233B;
  --gris: #55647B;
  --fond: #F3F5F9;
  --carte: #FFFFFF;
  --ligne: #DCE2EC;
  --vert: #157347;
  --attente-fond: #FFF6DF;
  --attente-encre: #6F4B00;
  --attente-ligne: #E9C46A;
  --rayon: 16px;
  --ombre: 0 1px 2px rgba(18, 48, 92, .06), 0 6px 18px rgba(18, 48, 92, .06);
  --haut-onglets: 64px;
  --marge: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--haut-onglets) + env(safe-area-inset-bottom));
}

main { display: block; outline: none; max-width: 720px; margin: 0 auto; }

h1, h2, h3 { line-height: 1.2; margin: 0; color: var(--marine); }
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.125rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--marine); }

:focus-visible { outline: 3px solid var(--rouge); outline-offset: 2px; border-radius: 6px; }

.evitement {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--marine); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.evitement:focus { top: 8px; }

.icone { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Barre du haut */
.barre {
  position: sticky; top: 0; z-index: 20;
  background: var(--marine); color: #fff;
  padding-top: env(safe-area-inset-top);
}
.barre-interne {
  display: flex; align-items: center; gap: 4px;
  max-width: 720px; margin: 0 auto; min-height: 56px; padding: 0 8px;
}
.barre h1 { color: #fff; font-size: 1.125rem; font-weight: 700; }
.retour {
  display: grid; place-items: center; width: 44px; height: 44px; color: #fff; border-radius: 12px;
}
.retour:hover { background: rgba(255, 255, 255, .12); }

/* Onglets du bas */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--carte); border-top: 1px solid var(--ligne);
  padding-bottom: env(safe-area-inset-bottom);
}
.onglet {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--haut-onglets); padding: 4px 2px; text-decoration: none;
  color: var(--gris); font-size: .72rem; font-weight: 600;
}
.onglet[aria-current="page"] { color: var(--rouge); }
.onglet[aria-current="page"] .icone { stroke-width: 2.4; }

/* Accueil */
.heros { background: #fff; padding: calc(20px + env(safe-area-inset-top)) var(--marge) 0; text-align: center; overflow: hidden; }
.heros img { display: block; width: min(100%, 400px); height: auto; margin: 0 auto; }
.heros-texte { margin: 10px auto 18px; max-width: 34ch; color: var(--gris); }
.page { padding: 16px var(--marge) 24px; display: grid; gap: 16px; }
.page > * { min-width: 0; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; text-align: center; cursor: pointer;
  background: var(--marine); color: #fff;
}
.bouton:hover { background: var(--marine-fonce); }
.bouton-rouge { background: var(--rouge); }
.bouton-rouge:hover { background: var(--rouge-fonce); }
.bouton-clair { background: #fff; color: var(--marine); border-color: var(--ligne); }
.bouton-clair:hover { background: var(--marine-pale); }
.bouton-large { width: 100%; }
.bouton-lien {
  background: none; border: 0; padding: 8px 0; min-height: 44px; font: inherit; font-weight: 600;
  color: var(--marine); text-decoration: underline; cursor: pointer;
}
.lien-fleche { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--rouge); text-decoration: none; min-height: 44px; }
.lien-fleche:hover { text-decoration: underline; }
.lien-fleche .icone { width: 18px; height: 18px; }

.carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px; }
.carte > * + * { margin-top: 10px; }
.discret { color: var(--gris); font-size: .9rem; }

/* Mon dossier */
.dossier { background: var(--marine); color: #fff; border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); }
.dossier h2 { color: #fff; }
.dossier-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.chiffre {
  display: block; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .1);
  color: #fff; text-decoration: none; min-width: 0;
}
.chiffre:hover { background: rgba(255, 255, 255, .17); }
.chiffre strong { display: block; font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.chiffre span { display: block; font-size: .85rem; color: #D5DEEC; }

/* Tuiles */
.tuiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tuile {
  display: flex; flex-direction: column; gap: 10px; min-height: 124px; padding: 14px;
  background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre);
  color: var(--encre); text-decoration: none;
}
.tuile:hover { box-shadow: 0 2px 4px rgba(18, 48, 92, .1), 0 10px 24px rgba(18, 48, 92, .12); }
.tuile strong { display: block; color: var(--marine); line-height: 1.25; }
.tuile small { display: block; color: var(--gris); font-size: .84rem; line-height: 1.35; margin-top: 3px; }
.pastille { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--marine-pale); color: var(--marine); flex: none; }
.pastille-rouge { background: var(--rouge-pale); color: var(--rouge); }

.titre-section { margin-top: 4px; }

.contacts-rapides { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.contacts-rapides .bouton { flex-direction: column; gap: 4px; padding: 10px 4px; font-size: .84rem; }

/* Badge à compléter */
.a-completer {
  border: 1px dashed var(--attente-ligne); background: var(--attente-fond); color: var(--attente-encre);
  border-radius: 12px; padding: 12px; font-size: .92rem;
}
.a-completer b {
  display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 99px;
  background: #fff; border: 1px solid var(--attente-ligne); font-size: .75rem; letter-spacing: .02em; text-transform: uppercase;
}

/* Documents */
.progression { height: 10px; background: var(--marine-pale); border-radius: 99px; overflow: hidden; }
.progression > span { display: block; height: 100%; background: var(--rouge); border-radius: 99px; transition: width .25s ease; }
.progression-texte { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.progression-texte strong { font-size: 1.25rem; color: var(--marine); font-variant-numeric: tabular-nums; }

.rubrique { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); overflow: hidden; }
.rubrique summary {
  display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; list-style: none; min-height: 60px;
}
.rubrique summary::-webkit-details-marker { display: none; }
.numero {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--marine); color: #fff; font-size: .85rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.rubrique.finie .numero { background: var(--vert); }
.rubrique-titre { flex: 1; min-width: 0; font-weight: 700; color: var(--marine); line-height: 1.25; }
.compte { font-size: .85rem; color: var(--gris); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chevron { color: var(--gris); transition: transform .15s ease; }
.rubrique[open] .chevron { transform: rotate(90deg); }
.rubrique-corps { padding: 0 14px 12px; border-top: 1px solid var(--ligne); }
.rubrique-note { margin-top: 12px; padding: 10px 12px; font-size: .9rem; background: var(--marine-pale); border-radius: 10px; }
.piece { padding: 10px 0; border-bottom: 1px solid var(--ligne); }
.piece:last-child { border-bottom: 0; padding-bottom: 2px; }
.case { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; min-height: 32px; }
.case input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--rouge); }
.piece.exclue .case { color: var(--gris); text-decoration: line-through; }
.piece-option {
  margin: 4px 0 0 34px; padding: 4px 10px; min-height: 32px; background: none; cursor: pointer;
  border: 1px solid var(--ligne); border-radius: 99px; color: var(--gris); font: inherit; font-size: .82rem;
}
.piece-option[aria-pressed="true"] { background: var(--marine-pale); color: var(--marine); border-color: var(--marine); font-weight: 600; }
.liste-retenir { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.liste-retenir li { display: flex; gap: 10px; font-size: .94rem; }
.liste-retenir .icone { color: var(--rouge); width: 20px; height: 20px; margin-top: 2px; }

/* Formulaires */
.groupe { border: 0; margin: 0; background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px; display: grid; gap: 14px; min-width: 0; }
.groupe legend { float: left; width: 100%; padding: 0; margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--marine); }
.groupe legend + * { clear: both; }
.champ { display: grid; gap: 5px; min-width: 0; }
.champ label, .etiquette { font-weight: 600; font-size: .93rem; }
.aide { color: var(--gris); font-size: .84rem; }
input[type="text"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; color: var(--encre);
  background: #fff; border: 1px solid #B8C3D3; border-radius: 10px;
}
textarea { min-height: 96px; resize: vertical; }
input.erreur, select.erreur { border-color: var(--rouge); box-shadow: 0 0 0 1px var(--rouge); }
.message-erreur { color: var(--rouge-fonce); font-size: .88rem; font-weight: 600; }
.grille-langue { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grille-langue .champ { grid-template-rows: 1fr auto; }
.bascule { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: .95rem; }
.bascule input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--rouge); }

.choix { display: grid; gap: 8px; }
.choix label {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; cursor: pointer;
  border: 1px solid var(--ligne); border-radius: 12px; background: #fff;
}
.choix label:has(input:checked) { border-color: var(--marine); background: var(--marine-pale); }
.choix input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--rouge); }
.choix .prix { margin-left: auto; font-weight: 800; color: var(--marine); white-space: nowrap; padding-left: 8px; font-variant-numeric: tabular-nums; }

.compteur { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compteur-boutons { display: flex; align-items: center; gap: 8px; }
.compteur-boutons button {
  width: 44px; height: 44px; font: inherit; font-size: 1.25rem; font-weight: 700; cursor: pointer;
  background: #fff; border: 1px solid #B8C3D3; border-radius: 10px; color: var(--marine);
}
.compteur-boutons button:disabled { opacity: .4; cursor: default; }
.compteur-boutons output { min-width: 28px; text-align: center; font-weight: 800; font-size: 1.1rem; }

/* Score */
.score-fixe {
  position: sticky; bottom: calc(var(--haut-onglets) + env(safe-area-inset-bottom) + 8px); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--marine); color: #fff; border-radius: 14px; padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(11, 32, 68, .3);
}
.score-fixe span { font-size: .88rem; color: #D5DEEC; }
.score-fixe strong { font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }

.detail { width: 100%; border-collapse: collapse; font-size: .94rem; font-variant-numeric: tabular-nums; }
.detail th, .detail td { padding: 8px 0; border-bottom: 1px solid var(--ligne); text-align: left; font-weight: 400; vertical-align: top; }
.detail td { text-align: right; font-weight: 600; white-space: nowrap; padding-left: 12px; }
.detail tr.total th, .detail tr.total td { font-weight: 800; color: var(--marine); font-size: 1.05rem; border-bottom: 0; }

/* Honoraires */
.total-honoraires {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px;
  background: var(--marine); color: #fff; border-radius: 12px; padding: 12px 14px;
}
.total-honoraires strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.mentions { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: .9rem; color: var(--gris); }

/* Parcours */
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--marine-pale); border-radius: 12px; }
.segments a {
  display: grid; place-items: center; min-height: 42px; padding: 6px; border-radius: 9px; text-align: center;
  color: var(--marine); font-weight: 700; font-size: .93rem; text-decoration: none; line-height: 1.2;
}
.segments a[aria-current="page"] { background: #fff; box-shadow: 0 1px 3px rgba(18, 48, 92, .15); }
.etapes { list-style: none; margin: 0; padding: 0; }
.etape { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding-bottom: 20px; }
.etape:last-child { padding-bottom: 0; }
.etape::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px; background: var(--ligne); }
.etape:last-child::before { display: none; }
.etape h3 { margin-top: 6px; }
.etape p { margin-top: 4px; font-size: .95rem; color: #33435B; }

/* Contact */
.ligne-contact {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 60px;
  color: var(--encre); text-decoration: none; border-bottom: 1px solid var(--ligne); margin: 0 !important;
}
.ligne-contact:last-child { border-bottom: 0; }
.ligne-contact strong { display: block; color: var(--marine); overflow-wrap: anywhere; line-height: 1.3; }
.ligne-contact small { display: block; color: var(--gris); font-size: .85rem; }
.pile { display: grid; gap: 8px; }
.apercu { font-size: .9rem; }
.apercu summary { cursor: pointer; font-weight: 600; color: var(--marine); min-height: 32px; }
.apercu pre { margin: 8px 0 0; padding: 12px; background: var(--fond); border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }

.note-enregistre { color: var(--vert); font-weight: 600; font-size: .9rem; }

@media (min-width: 720px) {
  .heros { padding-top: 28px; }
  .tuiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .onglet { font-size: .78rem; }
  .onglets { justify-content: center; grid-template-columns: repeat(5, minmax(0, 144px)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
