/* Configurateur de maison (/configurateur) — ce que site.css ne porte pas.
 * Les jetons (couleurs, rayons, ombres) sont ceux du site, thème clair compris : rien n'est
 * redéfini ici. Tout est préfixé `cfg-`. */

.cfg [hidden] { display: none !important; }
/* Les étapes sont rangées dans #cfg-app, pas directement sous <main> : l'écart entre sections
   (28 px, comme sur les autres pages) est à redonner ici. */
.cfg #cfg-app { display: grid; gap: 28px; }
/* Une colonne qui ne dépasse jamais l'écran : sans cela, le plus large des contenus (un tableau,
   un menu déroulant aux noms longs) élargit la colonne et la page défile de côté sur téléphone. */
.cfg, .cfg #cfg-app { grid-template-columns: minmax(0, 1fr); }
.cfg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cfg-dim { color: var(--muted); }
.cfg-small { font-size: .85rem; font-weight: 400; }
.cfg-warn { color: var(--amber); }
.cfg-price { color: var(--teal); font-weight: 700; }
.cfg-big { font-family: "Bricolage Grotesque", "Plus Jakarta Sans", sans-serif; font-size: clamp(1.4rem, 3.4vw, 2rem); line-height: 1.1; }
.cfg-n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.cfg-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
            padding: 16px 18px; box-shadow: var(--shadow); }
.cfg-unavailable p { margin: 0 0 14px; }

.cfg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cfg-link { color: var(--teal); font-size: .82rem; font-weight: 500; text-decoration: none; }
.cfg-link:hover { text-decoration: underline; }
.cfg-note { background: var(--teal-dim); border: 1px solid var(--teal-glow); border-radius: var(--radius-md);
            padding: 10px 14px; font-size: .88rem; margin: 0 0 12px; }
.cfg-note p { margin: 0 0 4px; }
.cfg-note ul { margin: 0; padding-left: 1.2em; }
.cfg-status { min-height: 1.4em; margin: 0 0 8px; font-size: .85rem; color: var(--muted); }
.cfg-status.is-warn { color: var(--amber); }

/* le total, en haut de la page (la réponse d'abord) */
.cfg-topbar { margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
              font-weight: 600; font-size: 1.05rem; }
.cfg-topbar span { color: var(--teal); }
/* des montants qui ne répondent plus aux choix (erreur, calcul refusé) : grisés, la ligne d'état le dit */
.cfg-stale { opacity: .55; }
.cfg-check { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .9rem; cursor: pointer; }
.cfg-check input { width: 18px; height: 18px; accent-color: var(--teal); }
#cfg-out:focus { outline: none; }
.cfg-packs-box .cfg-small { margin: 10px 0 0; }

/* champs */
.cfg-field { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); max-width: 22rem; margin-bottom: 12px; }
.cfg .cfg-card select, .cfg .cfg-card input[type="text"] {
  font: inherit; color: var(--ink); background: var(--surface2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 10px; min-height: 40px; max-width: 100%;
  font-size: 1rem;     /* 16 px : en dessous, Safari sur iPhone zoome la page au focus */
}
.cfg select option { background: var(--bg2); color: var(--ink); }
.cfg select:focus-visible, .cfg input:focus-visible, .cfg button:focus-visible, .cfg a:focus-visible,
.cfg summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.cfg-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* tableaux */
.cfg-tablewrap { overflow-x: auto; }
.cfg table { width: 100%; border-collapse: collapse; }
.cfg th { text-align: left; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
          padding: 6px 8px; font-weight: 500; }
.cfg th.cfg-n { text-align: right; }
.cfg td { padding: 9px 8px; border-top: 1px solid var(--border); vertical-align: middle; }
.cfg-rooms { table-layout: fixed; }
.cfg-rooms th:nth-child(3), .cfg-rooms td:nth-child(3) { width: 52px; }
.cfg-rooms input, .cfg-rooms select { width: 100%; min-width: 0; }
.cfg-cat { font-weight: 600; color: var(--ink-strong, var(--ink)); }
.cfg-model { width: 100%; max-width: 0; }
.cfg-prod { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cfg-prod img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; flex: 0 0 auto; }
.cfg-prod-body { min-width: 0; flex: 1 1 auto; }
.cfg-prod select { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; }

.cfg-x { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface2);
         color: var(--ink); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.cfg-x:hover { border-color: var(--amber); color: var(--amber); }

.cfg-removed { margin: 10px 0 0; }
.cfg-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--amber-dim);
            color: var(--amber); font-size: .8rem; margin: 4px 6px 0 0; }
.cfg-chip button { all: unset; cursor: pointer; text-decoration: underline; min-height: 24px; display: inline-flex; align-items: center; }
.cfg-chip button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.cfg-sum { margin: 14px 0 0; text-align: right; }

/* niveaux et plans */
.cfg-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.cfg-choice { display: flex; flex-direction: column; align-items: flex-start; text-align: left; font: inherit; color: var(--ink);
              cursor: pointer; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
              padding: 14px 16px; transition: border-color .18s, background .18s, transform .18s; }
.cfg-choice:hover { transform: translateY(-2px); }
.cfg-choice[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-dim); box-shadow: 0 0 0 1px var(--teal) inset; }
.cfg-choice strong { font-family: "Bricolage Grotesque", "Plus Jakarta Sans", sans-serif; font-size: 1.05rem; color: var(--ink-strong, var(--ink)); }
.cfg-choice small { display: block; color: var(--muted); margin-top: 4px; font-size: .85rem; line-height: 1.45; }

/* packs */
.cfg-packs-box { margin-top: 14px; }
.cfg-packs-box summary { cursor: pointer; color: var(--teal); font-size: .88rem; font-weight: 600; }
.cfg-packs-box > p { margin: 8px 0 0; font-size: .85rem; }
.cfg-packs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.cfg-pack { font: inherit; font-size: .78rem; line-height: 1; padding: 7px 11px; border-radius: 999px; cursor: pointer; color: var(--muted);
            background: transparent; border: 1px solid var(--border-strong); transition: border-color .18s, color .18s, background .18s; }
.cfg-pack:hover { border-color: var(--teal); color: var(--ink); }
.cfg-pack[aria-pressed="true"] { color: var(--ink); background: var(--teal-dim); border-color: var(--teal-glow); }
.cfg-pack[data-tier="enhanced"] { border-color: var(--teal); }
.cfg-pack small { color: var(--teal); margin-left: 5px; font-size: .7rem; }
.cfg-reset { all: unset; cursor: pointer; color: var(--teal); font-size: .78rem; margin-left: 4px; min-height: 24px; display: inline-flex; align-items: center; }
.cfg-reset:hover { text-decoration: underline; }
.cfg-reset:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* pièce par pièce */
.cfg-zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.cfg-zone-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }

/* résumé */
.cfg-recap { margin-top: 12px; }
.cfg-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--border); align-items: baseline; }
.cfg-row:first-child { border-top: 0; }
.cfg-row small { display: block; color: var(--muted); }
.cfg-sumval { font-weight: 700; font-size: 1.05rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cfg-total { border-top: 2px solid var(--teal); }
.cfg-total .cfg-sumval { color: var(--teal); }
.cfg-foot { margin: 14px 0 0; color: var(--muted); font-size: .82rem; }
.cfg-cta { margin-top: 22px; }
.cfg-cta p { margin: 0 0 12px; max-width: 62ch; }

@media (max-width: 640px) {
  .cfg-hide-sm { display: none; }
  .cfg th, .cfg td { padding: 8px 4px; }
  /* La liste du matériel devient une pile de lignes : article et retrait, modèle sur toute la
     largeur, puis quantité et sous-total. Six colonnes ne tiennent pas sur 375 px. */
  .cfg-lines thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cfg-lines, .cfg-lines tbody { display: block; }
  .cfg-lines tr { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
  .cfg-lines tr:first-child { border-top: 0; }
  .cfg-lines td { display: block; border: 0; padding: 0; }
  .cfg-lines td.cfg-hide-sm { display: none; }
  .cfg-lines td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .cfg-lines td:nth-child(6) { grid-column: 2; grid-row: 1; }
  .cfg-lines td.cfg-model { grid-column: 1 / -1; grid-row: 2; width: auto; max-width: none; }
  .cfg-lines td:nth-child(3) { grid-column: 1; grid-row: 3; text-align: left; }
  .cfg-lines td:nth-child(5) { grid-column: 2; grid-row: 3; }
  .cfg-lines td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 400; }
  .cfg-card { padding: 14px; }
  .cfg-row { flex-direction: column; gap: 2px; }
  .cfg-sumval { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .cfg-choice, .cfg-pack { transition: none; }
  .cfg-choice:hover { transform: none; }
}
