/* Identité du test alignée sur la landing (29/09/2026) : Montserrat, un seul vert, surligneur jaune. */
:root {
  --ink: #10231b;
  --muted: #56615b;
  --line: #e1e7e3;
  --line-strong: #b9c4be;
  --accent: #0e8541;
  --accent-dark: #0a6632;
  --accent-soft: #eef7f2;
  --control-radius: 10px;
  --marker: #ffe14d;
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
}
body, button, input, select, textarea { font-family: inherit; }
.site-header { font-family: inherit; }

/* Progression : même vert, barre arrondie, fond blanc */
.quiz-progress { border-bottom: 1px solid var(--line); background: #fff; }
.quiz-progress-copy strong { color: var(--ink); font-weight: 800; }
.quiz-progress-copy strong.complete { color: var(--accent); }
.quiz-progress-track { height: 8px; border-radius: 999px; background: #e3e8e5; }
.quiz-progress-track span { border-radius: 999px; background: var(--accent); }
.quiz-progress-track::after { display: none; }

/* Questions */
.step-panel > legend { color: var(--ink); font-weight: 800; letter-spacing: -.02em; }
.step-help, .estimate-note { color: #33403a; font-weight: 500; }
.field > span:first-child, .choice-field > legend { color: var(--ink); font-weight: 700; }
.person-position { color: var(--accent); }

/* Choix visibles : gros boutons à toucher */
.visible-choice {
  min-height: 58px;
  border: 2px solid var(--line-strong);
  font-weight: 700;
  transition: border-color .15s ease, background-color .15s ease;
}
.visible-choice input { accent-color: var(--accent); }
.visible-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.visible-choice:active { background: var(--accent-soft); }

/* Champs et sélecteurs */
.native-select,
.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.field-date select,
.input-affix { border-width: 2px; border-color: var(--line-strong); font-weight: 600; }
.input-affix input { border: 0 !important; }
.native-select:focus,
.field input:not([type="radio"]):not([type="checkbox"]):focus,
.field select:focus { border-color: var(--accent); }
.add-button, .text-button, .review-edit { color: var(--accent); font-weight: 700; }

/* Boutons d'action : comme la landing, sans ombre */
.next-button {
  min-height: 52px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--accent);
  font-size: .98rem;
  font-weight: 800;
}
.next-button:active { background: var(--accent-dark); }
.back-button { border: 2px solid var(--line-strong); font-weight: 700; }
* { -webkit-tap-highlight-color: transparent; }

/* Consentement */
.consent-checkbox input:checked { background-color: var(--accent); border-color: var(--accent); }
.consent-checkbox { color: #33403a; }

/* Récapitulatif */
.review-list { border-width: 2px; border-color: var(--line); }
.review-row-label { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.review-row strong { color: var(--ink); font-weight: 700; }

/* Calcul */
.spinner { border-color: #e3e8e5; border-top-color: var(--accent); }
.calculation-loading h2 { color: var(--ink); font-weight: 800; }
.calculation-steps { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; text-align: left; }
.calculation-steps li { position: relative; padding-left: 26px; color: var(--muted); font-weight: 600; opacity: 0; animation: calc-step .3s ease forwards; }
.calculation-steps li::before { position: absolute; left: 0; top: 0; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); content: "✓"; font-size: .7rem; font-weight: 800; }
.calculation-steps li:nth-child(1) { animation-delay: .5s; }
.calculation-steps li:nth-child(2) { animation-delay: 1.3s; }
.calculation-steps li:nth-child(3) { animation-delay: 2.1s; }
@keyframes calc-step { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Résultat */
.confirmation-panel h2 { color: var(--ink); font-size: clamp(1.45rem, 6.4vw, 1.8rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.confirmation-result { padding: 18px 14px; border: 2px solid var(--accent); border-radius: 12px; background: #fbfff9; }
.confirmation-result > p:first-child { color: var(--ink); font-size: .95rem; font-weight: 700; }
.confirmation-saving { color: var(--ink); font-weight: 900; letter-spacing: -.02em; }
.confirmation-saving mark { padding: 0 .12em; color: var(--ink); background: linear-gradient(transparent 12%, var(--marker) 12%, var(--marker) 92%, transparent 92%); }
.confirmation-saving sup { font-size: .3em; }
.confirmation-sub { margin: 2px 0 0 !important; color: #33403a; font-size: .88rem; font-weight: 600; }
.confirmation-copy { color: #1f2a26; font-size: .95rem; font-weight: 500; line-height: 1.45; }
.confirmation-copy a { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.callback-process h3 { color: var(--ink); font-weight: 800; }
.process-number { background: var(--accent) !important; color: #fff !important; border: 0 !important; }
.callback-process li strong { color: var(--ink); font-size: .92rem; }
.callback-process .process-copy { color: #33403a; font-size: .84rem; }

/* Le test tient dans l'écran, pied de page compris : sans marge de défilement, Safari ne peut plus
   rester décalé vers le bas après la fermeture du clavier (en-tête et progression à moitié cachés). */
body.quiz-active .page-shell { min-height: 0; }
body.quiz-active .site-footer {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
  font-size: .66rem;
}
body.quiz-active .site-footer nav { gap: 14px; }

/* Reste à rembourser calculé : tout le champ s'éclaire, unité comprise, sans angle droit. */
.input-affix.calculated b { background: transparent; }
.input-affix.just-calculated input { animation: none; }
.input-affix.just-calculated { animation: calculated-pulse 2.6s ease-out; }

/* ===== Esthétique du test (29/09/2026 soir) =====
   Squelette inchangé (mêmes écrans, mêmes cases, même ordre). Seules la taille, la largeur et la
   disposition changent : cases pleine largeur et égales, deux choix côte à côte, champs appariés
   à moitié-moitié, couleurs de la landing au lieu du noir. */
:root { --box-line: #c5d6cc; --box-radius: 12px; --box-h: 58px; }
#step-root { max-width: 520px; }
.step-panel > legend { font-size: clamp(1.35rem, 5.6vw, 1.6rem); line-height: 1.2; }
.step-help, .estimate-note { font-size: .92rem; line-height: 1.4; }

/* Choix : grandes cases égales, texte centré, sélection en vert */
.visible-choice-list { display: grid; grid-template-columns: 1fr; justify-items: stretch; gap: 12px; }
.visible-choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.visible-choice {
  position: relative;
  width: 100%;
  max-width: none;
  min-height: 64px;
  justify-content: center;
  padding: 12px 38px;
  border: 2px solid var(--box-line);
  border-radius: var(--box-radius);
  color: var(--ink);
  background: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}
.visible-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.visible-choice::before {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--box-line);
  border-radius: 50%;
  background: #fff;
  content: "";
  transform: translateY(-50%);
}
.visible-choice:has(input:checked) { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.visible-choice:has(input:checked)::before {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath d='M2 6l4 4 8-8' fill='none' stroke='white' stroke-width='2.4'/%3E%3C/svg%3E") center / 11px 9px no-repeat;
}
.visible-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-field > legend { margin-bottom: 8px; }

/* Champs et menus : pleine largeur, même hauteur, bordure verte claire */
.field { gap: 7px; }
.field > span:first-child, .choice-field > legend { font-size: .95rem; }
.native-select,
.field input:not([type="radio"]):not([type="checkbox"]),
.field select,
.field-date select,
.input-affix {
  --control-width: 100%;
  width: 100%;
  max-width: none;
  height: var(--box-h);
  border: 2px solid var(--box-line);
  border-radius: var(--box-radius);
  color: var(--ink);
  background-color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
}
.field > input, .field > .input-affix:not(.duration-number), .field > .input-affix:has([data-loan-field="rate"]) { width: 100%; }
.native-select, .field select, .field-date select {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0 44px 0 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%230e8541' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 16px center;
  background-repeat: no-repeat;
  background-size: 14px 9px;
}
.native-select:has(option[value=""]:checked), .field select:has(option[value=""]:checked) { color: var(--muted); font-weight: 600; }
.field input:not([type="radio"]):not([type="checkbox"]) { padding: 0 16px; }
.field input::placeholder { color: #8a948f; font-weight: 500; }
.input-affix { overflow: hidden; }
.input-affix input { height: 100% !important; padding: 0 16px !important; background: transparent !important; }
.input-affix b { min-width: 44px; border-left: 0; color: var(--accent-dark); background: transparent; font-weight: 800; }
.input-affix:focus-within,
.native-select:focus,
.field input:not([type="radio"]):not([type="checkbox"]):focus,
.field select:focus { border-color: var(--accent); outline: 3px solid rgba(14, 133, 65, .16); outline-offset: 0; }
.input-affix input:focus { outline: 0 !important; }

/* Première mensualité : année et mois à moitié-moitié */
.date-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.date-pair > select, .optional-month { width: 100%; flex: none; }
.optional-month small { font-size: .72rem; }

/* Durée : nombre à gauche, ans / mois à droite, même hauteur */
.duration-entry { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.duration-number { width: 100% !important; height: var(--box-h) !important; min-height: 0 !important; }
.duration-number input { text-align: center; }
.duration-unit-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; height: var(--box-h) !important; }
.duration-unit-choice {
  width: 100% !important;
  height: var(--box-h) !important;
  min-height: 0 !important;
  padding: 0 6px !important;
  border: 2px solid var(--box-line);
  border-radius: var(--box-radius);
  color: var(--ink);
  font-size: 1rem !important;
  font-weight: 700;
}
.duration-unit-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.duration-unit-choice:has(input:checked) { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }

/* Date de naissance : trois cases qui remplissent la largeur */
.birth-date { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.5fr) !important; width: 100% !important; gap: 8px; }
.birth-date input { text-align: center; padding: 0 6px !important; }
.birth-date i { color: var(--box-line); font-weight: 700; }

/* Identité et profil : une colonne, cases pleine largeur */
.identity-grid, .contact-grid, .field-grid { gap: 16px; }
.full-field { grid-column: 1 / -1; }

/* Consentement : case plus grande, verte */
.consent-checkbox { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; font-size: .8rem; }
.consent-checkbox input { width: 24px; height: 24px; margin: 0; border: 2px solid var(--box-line); border-radius: 6px; }
.consent-checkbox input:checked { background-size: 14px 11px; }

/* Récapitulatif : même bordure que les cases */
.review-list { border: 2px solid var(--box-line); border-radius: var(--box-radius); }
.review-row { border-bottom-color: #e3ece6; }

/* Boutons : Suivant prend toute la place, Retour reste discret */
.form-actions { gap: 10px; margin-top: 18px; }
.next-button { flex: 1; min-height: 58px; border-radius: var(--box-radius); font-size: 1.08rem; }
.back-button { flex: 0 0 auto; min-height: 58px; padding: 0 16px; border: 2px solid var(--box-line); border-radius: var(--box-radius); color: var(--ink); }

@media (max-width: 800px) {
  #magnolia-replica { padding-right: 16px; padding-left: 16px; }
  #step-root { padding-top: 24px; }
  .step-panel > legend { margin-bottom: 12px; }
  .step-help, .estimate-note { margin-bottom: 16px; font-size: .88rem; }
  .field-grid-3, .identity-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) and (max-height: 700px) {
  :root { --box-h: 52px; }
  #step-root { padding-top: 16px; }
  .step-panel > legend { font-size: 1.25rem; margin-bottom: 8px; }
  .step-help, .estimate-note { margin-bottom: 12px; font-size: .82rem; }
  .visible-choice { min-height: 56px; }
  .identity-grid, .contact-grid, .field-grid { gap: 12px; }
  .next-button, .back-button { min-height: 52px; }
  .form-actions { margin-top: 12px; }
}
@media (max-width: 800px) and (max-height: 600px) {
  :root { --box-h: 48px; }
  .visible-choice { min-height: 50px; }
  .identity-grid, .contact-grid, .field-grid { gap: 10px; }
}

/* Questions alignées en haut, bouton juste sous les cases : le titre reste à la même place d'un écran
   à l'autre et il n'y a plus de vide entre la dernière case et « Suivant ». */
#magnolia-replica { grid-template-rows: auto auto auto; align-content: start; }
#step-root.center-step { align-content: start; }
.review-row-label { font-size: .7rem; }
.review-row strong { font-size: .9rem; }
.review-row-detail { font-size: .74rem; }
.review-edit { font-size: .78rem; }
@media (max-width: 800px) and (max-height: 700px) {
  .review-row strong { font-size: .8rem; }
  .review-row-detail, .review-row-label { font-size: .66rem; }
}
.add-button { justify-content: flex-start; text-align: left; font-size: .9rem; }
.visible-choice-row .visible-choice { padding-right: 12px; padding-left: 36px; }
@media (max-width: 800px) and (max-height: 600px) {
  :root { --box-h: 46px; }
  #step-root { padding-top: 12px; }
  .step-panel > legend { font-size: 1.15rem; margin-bottom: 6px; }
  .step-help, .estimate-note { margin-bottom: 8px; font-size: .78rem; line-height: 1.3; }
  .field { gap: 4px; }
  .field > span:first-child, .choice-field > legend { font-size: .85rem; min-height: 0; }
  .choice-field > legend { margin-bottom: 4px; }
  .visible-choice { min-height: 48px; font-size: .98rem; }
  .identity-grid, .contact-grid, .field-grid { gap: 8px; }
  .borrower-card h2 { margin-bottom: 8px; font-size: .95rem; }
  .add-button { margin-top: 2px; padding: 4px 0; font-size: .82rem; }
  .next-button, .back-button { min-height: 48px; }
  .form-actions { margin-top: 10px; }
  .optional-month small { font-size: .64rem; }
}
/* Le titre (« Et sur la personne… », « Personne 2 sur 2 ») dit déjà de qui il s'agit. */
.borrower-card h2 { display: none; }
.contact-panel .contact-grid { gap: 12px; }
.contact-panel .step-help { margin-bottom: 12px; }
.consents { margin-top: 12px; }
@media (max-width: 800px) and (max-height: 700px) {
  .contact-panel .contact-grid { gap: 8px; }
  .consents { margin-top: 8px; }
  .consent-checkbox { padding: 2px 0; font-size: .74rem; line-height: 1.3; }
}
body.quiz-active .site-footer { padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
@media (max-width: 800px) and (max-height: 600px) {
  .contact-panel .contact-grid { gap: 5px; }
  .contact-panel .step-help { margin-bottom: 6px; font-size: .74rem; }
  .consent-checkbox { font-size: .7rem; line-height: 1.25; }
  body.quiz-active .site-footer { padding-top: 4px; font-size: .62rem; }
}
@media (max-width: 800px) { #magnolia-replica { padding-bottom: 2px; } .form-actions { margin-bottom: 0; } }
@media (max-width: 800px) and (max-height: 600px) { .contact-panel > legend { margin-bottom: 4px; } }
