/* Écran de la commande du repérage (fr/onboarding, branche reperage, étape 2).
   Écrit à la main. Tout est borné à section.step.th-commande ; le choix « Vous achetez » et le type
   de zone basculent la page par les attributs data-profil et data-zone que pose commande-reperage.js
   (sans :has(), absent de navigateurs encore en service). Sans ces attributs, rien n'est masqué :
   tous les blocs restent visibles. */

/* L'écran sort de la carte de 720 px des autres écrans : la carte passe à son formulaire intérieur. */
.df-onboarding form > section.step.th-commande {
  max-width: 1120px; margin-left: auto; margin-right: auto;
  background: none; border: 0; box-shadow: none; padding: 0;
}
.th-commande .th-tete { max-width: 720px; margin: 0 0 28px; }
.th-commande .th-tete h2 { margin: 0 0 10px; }
.step.th-commande .th-tete .lede { margin: 0; }

.th-commande .th-grille { display: grid; gap: 24px; align-items: start; grid-template-areas: "form" "compris" "envoi"; }
@media (min-width: 1001px) {
  .th-commande .th-grille { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "form compris" "envoi compris"; gap: 24px 32px; }
}
.th-commande .th-form { grid-area: form; min-width: 0; }
.th-commande .th-compris { grid-area: compris; }
.th-commande .th-envoi { grid-area: envoi; }

.th-commande .th-carte {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 4px 40px 32px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 18px 40px -28px rgba(17, 19, 23, 0.35);
}
.th-commande .th-bloc { padding: 28px 0; border-top: 1px solid var(--line); }
.th-commande .th-bloc:first-child { border-top: 0; }
.th-commande .th-bloc > :last-child { margin-bottom: 0; }
.th-commande .th-bloc > h3 { margin: 0 0 6px; font-size: 21px; font-weight: 620; letter-spacing: -0.022em; line-height: 1.25; }
.th-commande .th-bloc > .hint { margin: 0 0 18px; font-size: 14px; max-width: 62ch; color: var(--ink-2); }
.th-commande .th-facultatif { font-size: 13.5px; font-weight: 400; color: var(--ink-2); letter-spacing: -0.005em; }
.th-commande .th-sous-titre { margin: 24px 0 8px; font-size: 14.5px; font-weight: 560; letter-spacing: -0.01em; }
.th-commande .th-sous-titre + .hint { margin: -4px 0 12px; font-size: 14px; color: var(--ink-2); }
.th-commande .th-espace-haut { margin-top: 20px; }
.th-commande .th-apports { margin-top: 24px; margin-bottom: 0; }
.th-commande .th-court { max-width: 160px; }

/* Le profil : trois lignes, la description sur la même ligne que le choix */
.th-commande .checkbox-group.inline.th-profil { grid-template-columns: minmax(0, 1fr); margin: 0; }
.th-commande .th-profil > label { align-items: center; }
.th-commande .th-profil small { margin-left: auto; padding-left: 16px; font-size: 13.5px; color: var(--ink-2); text-align: right; }
@media (max-width: 640px) {
  .th-commande .th-profil > label { flex-wrap: wrap; }
  .th-commande .th-profil small { flex-basis: 100%; margin: 0; padding-left: 28px; text-align: left; }
}

/* Les métiers : des lignes séparées par un filet, jamais des cartes dans la carte */
.th-commande .th-ligne { padding: 16px 0; border-top: 1px solid var(--line); }
.th-commande .th-ligne:first-of-type { border-top: 0; padding-top: 0; }
.th-commande .th-ligne .form-label-block { margin: 0 0 12px; }
.th-commande .th-ligne .form-label-block:last-child { margin-bottom: 0; }
.th-commande .th-ligne-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; margin: -8px 0 4px; }
.th-commande .th-ligne-tete span { font-size: 14.5px; font-weight: 560; letter-spacing: -0.01em; }
.th-commande .th-retirer { min-height: 44px; padding: 0 2px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; cursor: pointer; }
.th-commande .th-retirer:hover { color: var(--ink); text-decoration-color: currentColor; }
.th-commande .th-ajouter { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px dashed var(--champ); border-radius: 8px; background: #fff; font: inherit; font-size: 14.5px; font-weight: 560; color: var(--ink); cursor: pointer; }
.th-commande .th-ajouter:hover { border-style: solid; }
.th-commande .th-ajouter:focus-visible,
.th-commande .th-retirer:focus-visible,
.th-commande .th-retirer-ligne:focus-visible,
.th-commande .th-etiquette button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.th-commande .th-plus { width: 12px; height: 12px; flex: none; }

/* Activités proches : nom, ce qui les distingue, et le sort qu'on leur fait */
.th-commande .th-proche { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 140px 44px; gap: 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.th-commande .th-proche:first-of-type { border-top: 0; padding-top: 0; }
.th-commande .th-proches-tete { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 140px 44px; gap: 10px; margin: 0 0 6px; font-size: 13.5px; color: var(--ink-2); }
/* Sans aucune ligne, l'en-tête de colonnes est le dernier enfant : il disparaît */
.th-commande .th-proches-tete:last-child { display: none; }
.th-commande .th-retirer-ligne { display: grid; place-items: center; width: 44px; height: 46px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer; }
.th-commande .th-retirer-ligne:hover { background: var(--fond); color: var(--ink); }
.th-commande .th-retirer-ligne svg { width: 11px; height: 11px; }
@media (max-width: 760px) {
  .th-commande .th-proches-tete { display: none; }
  .th-commande .th-proche { grid-template-columns: minmax(0, 1fr) 44px; }
  .th-commande .th-proche > input:first-child { grid-column: 1; }
  .th-commande .th-proche > input:nth-child(2),
  .th-commande .th-proche > select { grid-column: 1; }
  .th-commande .th-proche > .th-retirer-ligne { grid-column: 2; grid-row: 1; }
}

/* Étiquettes saisies : un groupe, pas un label (un label déclencherait le premier bouton) */
.th-commande .th-etiquettes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 54px; padding: 7px 8px; border: 1px solid var(--champ); border-radius: 8px; background: #fff; transition: border-color 150ms ease, box-shadow 150ms ease; }
.th-commande .th-etiquettes:hover { border-color: var(--ink-3); }
.th-commande .th-etiquettes:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 24, 29, 0.12); }
.th-commande .th-etiquette { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 2px 0 12px; border-radius: 6px; background: var(--fond); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 14.5px; color: var(--ink); }
.th-commande .th-etiquette .mono { font-size: 13.5px; color: var(--ink-2); }
.th-commande .th-etiquette button { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 4px; background: none; color: var(--ink-2); cursor: pointer; }
.th-commande .th-etiquette button::before { content: ""; position: absolute; inset: -6px; }
.th-commande .th-etiquette button:hover { background: #fff; color: var(--ink); }
.th-commande .th-etiquette svg { width: 10px; height: 10px; }
.df-onboarding .th-commande .th-etiquettes input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { flex: 1 1 160px; min-height: 36px; padding: 0 6px; border: 0; box-shadow: none; }
.df-onboarding .th-commande .th-etiquettes input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus { box-shadow: none; }

/* La zone : le type choisi montre son détail (sans data-zone, les trois restent visibles) */
.th-commande .th-modes { margin-bottom: 14px; }
.th-commande .th-modes > label { align-items: center; }
.th-commande .th-zone-ville { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 16px 20px; }
.th-commande[data-zone] .th-zone-dep,
.th-commande[data-zone] .th-zone-ville,
.th-commande[data-zone] .th-zone-france { display: none; }
.th-commande[data-zone="departements"] .th-zone-dep,
.th-commande[data-zone="france"] .th-zone-france { display: block; }
.th-commande[data-zone="ville"] .th-zone-ville { display: grid; }
.th-commande:not([data-zone]) .th-zone-ville,
.th-commande:not([data-zone]) .th-zone-france { margin-top: 16px; }
.th-commande .th-zone-ville .form-label-block { margin: 0; }
@media (max-width: 640px) { .th-commande .th-zone-ville { grid-template-columns: minmax(0, 1fr); } }
.th-commande .th-compte { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.th-commande .th-compte strong { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.th-commande .th-etranger { margin: 16px 0 0; font-size: 14px; color: var(--ink-2); }
.th-commande .th-etranger a,
.th-commande .th-compris a,
.th-commande .th-envoi a:not(.btn-primary):not(.btn-secondary) { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--champ); }

/* Bornes : l'unité dans la légende, deux champs courts « de » et « à » */
.th-commande .th-bornes { display: flex; flex-wrap: wrap; gap: 12px 40px; min-width: 0; margin: 0 0 4px; padding: 0; border: 0; }
.th-commande .th-borne { min-width: 0; margin: 0; padding: 0; border: 0; }
.th-commande .th-borne legend { float: left; width: 100%; margin: 0 0 7px; padding: 0; font-size: 14.5px; font-weight: 560; letter-spacing: -0.01em; }
.th-commande .th-borne-champs { display: flex; align-items: center; gap: 10px; clear: both; }
.th-commande .th-borne-champs span { font-size: 14.5px; color: var(--ink-2); }
.df-onboarding .th-commande .th-borne input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) { width: 120px; font-variant-numeric: tabular-nums; }

/* Repli : ce qui aide, sans être demandé */
.th-commande .th-repli { border-top: 1px solid var(--line); }
.th-commande .th-repli summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 20px 0; cursor: pointer; list-style: none; }
.th-commande .th-repli summary::-webkit-details-marker { display: none; }
.th-commande .th-repli summary h3 { margin: 0; font-size: 21px; font-weight: 620; letter-spacing: -0.022em; }
.th-commande .th-repli summary .th-chevron { width: 14px; height: 14px; flex: none; color: var(--ink-2); transition: transform 200ms var(--ease); }
.th-commande .th-repli[open] summary .th-chevron { transform: rotate(180deg); }
.th-commande .th-repli summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.th-commande .th-repli-corps { padding: 0 0 28px; }
@media (prefers-reduced-motion: reduce) { .th-commande .th-repli summary .th-chevron { transition: none; } }
.th-commande .th-exemple { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 0 0 10px; }
@media (max-width: 640px) { .th-commande .th-exemple { grid-template-columns: minmax(0, 1fr); } }
.th-commande .th-import-etat { display: block; margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }

/* Ce qui ne vaut que pour un profil (sans data-profil, tout reste visible). `revert` rend à chaque
   élément son affichage propre (bloc, ligne). */
.th-commande[data-profil] .seulement-entreprise,
.th-commande[data-profil] .seulement-fonds { display: none; }
.th-commande[data-profil="entreprise"] .seulement-entreprise,
.th-commande[data-profil="fonds"] .seulement-fonds { display: revert; }
.th-commande[data-profil="fonds"] .seulement-commande { display: none; }
.th-commande .th-pays { margin-bottom: 0; }

/* Ce que nous avons compris : une phrase, puis ce qui engage */
.th-commande .th-compris { position: sticky; top: 96px; max-height: calc(100vh - 112px); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--fond); }
.th-commande .th-compris h3 { margin: 0 0 4px; font-size: 16px; font-weight: 620; letter-spacing: -0.018em; }
.th-commande .th-compris .hint { margin: 0 0 16px; font-size: 13.5px; color: var(--ink-2); }
.th-commande .th-phrase { margin: 0 0 18px; font-size: 16px; line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.th-commande .th-phrase b { font-weight: 560; color: var(--ink); }
.th-commande .th-faits { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; padding: 16px 0 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.th-commande .th-faits dt { color: var(--ink-2); }
.th-commande .th-faits dd { margin: 0; color: var(--ink); }
.th-commande .th-manque { margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line-2); font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.th-commande .th-manque:empty { display: none; }
.th-commande .th-manque strong { color: var(--ink); font-weight: 600; }
@media (max-width: 1000px) { .th-commande .th-compris { position: static; max-height: none; } }

/* L'envoi : sous le formulaire, après le récapitulatif sur téléphone */
.th-commande .th-envoi { padding-top: 28px; }
.th-commande .th-envoi .step-nav { margin-top: 20px; padding-top: 0; border-top: 0; }
.th-commande .th-engagement { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); text-align: right; }
@media (max-width: 640px) {
  .th-commande .th-carte { padding: 4px 18px 22px; border-radius: 12px; }
  .th-commande .th-envoi { padding-top: 22px; }
  .th-commande .th-engagement { text-align: left; }
}
