/* La page du client de l'artisan, « épurée à la Stripe » (4 octobre 2026) :
   le résumé de la pièce, la pièce dépliable, puis l'action. La teinte de la
   marque en aplat (--plein) n'est posée que sur le bouton principal et la
   pastille ; page.js l'écrit depuis le guichet, qui calcule aussi le texte
   posé dessus (--sur-accent) et la couleur quand elle sert de texte.

   LE FOND DU PORTAIL WEB (8 octobre 2026) : clair ou sombre, choisi par
   l'artisan dans Marque (`data-fond`, posé par page.js). La pièce dépliée,
   elle, reste du papier blanc : elle s'imprime ainsi. */
/* Les fonds par défaut (21 octobre 2026) : blanc pur et noir pur, cartes
   « E », ceux de l'app. Une couleur choisie dans Marque, ou le thème du
   visiteur, les remplace en ligne (`vetir`, logique.js : --page, --surface). */
:root {
  --page: #ffffff; --surface: #f8f8fa; --champ: #ffffff; --encre: #1d1d24; --muet: #6b6b75; --pale: #8d8c96;
  --trait: #e9e7ee; --trait-fort: #d5d2dc; --ombre: 0 1px 2px rgba(20, 18, 40, .04), 0 8px 24px rgba(20, 18, 40, .06);
  --ombre-barre: 0 -8px 24px rgba(20, 18, 40, .06); --plaque: #1f1f24;
  --alerte: #be4a65; --favorable: #2f7d5b;
  --accent: #E8961F; --plein: #E8961F; --sur-accent: #1f1f1f; --encre-accent: #a26916;
  /* Les teintes légères : l'accent sur le clair, l'encre sur le sombre. */
  --teinte: var(--accent);
  color-scheme: light;
}
/* Les teintes sombres de la page de demande, mesurées sur la carte ; un
   liseré intérieur à la place des ombres. */
:root[data-fond="sombre"] {
  --page: #000000; --surface: #121216; --champ: #16161b; --encre: #ececf1; --muet: #a3a2ad; --pale: #85848f;
  --trait: #2e2d35; --trait-fort: #45444e; --ombre: inset 0 0 0 1px rgba(255, 255, 255, .06);
  --ombre-barre: none; --plaque: #ededed;
  --alerte: #e5728b; --favorable: #5cc08f;
  --teinte: var(--encre-accent);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--encre);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.page { max-width: 1040px; margin: 0 auto;
  padding: 28px max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left)); }
.attente { color: var(--muet); }

.entete { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; min-height: 40px; }
.logo { max-height: 44px; max-width: 180px; object-fit: contain; }
/* Un logo qui se perdrait sur le fond : la plaque de l'app et de la pièce. */
.logo.plaque { background: var(--plaque); padding: 6px 9px; border-radius: 10px; max-height: 52px; max-width: 196px; }
.monogramme { width: 40px; height: 40px; border-radius: 10px; background: var(--plein); color: var(--sur-accent);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .2px; flex: none; }
.societe { font-weight: 600; font-size: 16px; }

.grille { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 880px) { .grille { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; } }
.carte { background: var(--surface); border-radius: 16px; box-shadow: var(--ombre); padding: 24px; scroll-margin-top: 16px; }

.sur-titre { color: var(--muet); font-size: 14px; margin: 0 0 6px; }
.montant { font-size: 40px; line-height: 1.1; font-weight: 650; letter-spacing: -.5px; margin: 0;
  font-variant-numeric: tabular-nums; }
.sous-montant { color: var(--muet); margin: 8px 0 0; }
.echeance { display: inline-flex; align-items: center; margin-top: 14px; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--teinte) 12%, var(--surface)); color: var(--encre-accent); font-size: 13px; font-weight: 600; }
dl { margin: 22px 0 0; display: grid; grid-template-columns: auto 1fr; border-top: 1px solid var(--trait); }
dt, dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--trait); }
dt { color: var(--muet); padding-right: 16px; }
dd { text-align: right; font-variant-numeric: tabular-nums; }

.ligne-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.ligne-actions .bouton { flex: 1 1 200px; justify-content: center; }
.bouton { font: inherit; font-weight: 600; border-radius: 10px; padding: 11px 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; line-height: 1.2; }
.bouton.discret { background: var(--surface); color: var(--encre); border: 1px solid var(--trait); }
.bouton.discret:hover { border-color: var(--trait-fort); }
.bouton.plein { width: 100%; justify-content: center; background: var(--plein); color: var(--sur-accent); border: 0;
  padding: 14px 16px; font-size: 16px; }
.bouton:disabled { opacity: .5; cursor: default; }
/* La signature en cours : un anneau dans l'encre du bouton, et le bouton
   presque plein — une attente doit se lire comme un travail, pas comme un
   bouton éteint. */
.bouton.en-cours:disabled { opacity: .85; cursor: progress; }
.bouton.en-cours::before { content: ""; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .bouton.en-cours::before { animation: none; border-right-color: currentColor; opacity: .55; }
}
/* Le contour de focus prend l'encre de la marque (8 octobre 2026). */
.bouton:focus-visible, input:focus-visible { outline: 3px solid var(--encre-accent); outline-offset: 2px; }
.chevron { transition: transform .2s ease; }
[aria-expanded="true"] .chevron { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .chevron { transition: none; } }

/* La pièce reste du papier blanc, quel que soit le fond de la page. */
.apercu { position: relative; margin-top: 14px; border: 1px solid var(--trait); border-radius: 12px; overflow: hidden; background: #fff;
  color-scheme: light; }
.cadre { position: absolute; top: 0; left: 0; width: 794px; height: 1123px; border: 0; transform-origin: 0 0; background: #fff; }

h2 { font-size: 17px; margin: 0 0 16px; }
form { display: grid; gap: 0; }
label.champ { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input[type="text"] { font: inherit; padding: 12px 14px; border: 1px solid var(--trait); border-radius: 10px; background: var(--champ); color: var(--encre); }
select, textarea { font: inherit; font-weight: 400; padding: 12px 14px; border: 1px solid var(--trait); border-radius: 10px; background: var(--champ); color: var(--encre); }
textarea { resize: vertical; min-height: 84px; }
.repondre { margin-top: 18px; }
.repondre .autres { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: center; margin: 0; color: var(--muet); font-size: 13px; }
#reponse { gap: 14px; margin-top: 16px; }
#annuler-reponse { justify-self: center; }
label.accord { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 6px; }
.dessin { display: grid; gap: 6px; margin-top: 14px; font-weight: 600; font-size: 14px; }
.dessin-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.effacer { font: inherit; font-weight: 500; font-size: 13px; color: var(--teinte); background: none; border: 0; padding: 0; cursor: pointer; }
#dessin { width: 100%; aspect-ratio: 3 / 1; touch-action: none; border: 1px dashed var(--trait-fort); border-radius: 10px; background: var(--champ); color: var(--encre); cursor: crosshair; }
input[type="checkbox"] { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--plein); flex: none; }
.erreur { color: var(--alerte); min-height: 1.5em; margin: 0 0 6px; font-size: 14px; }
.mention { color: var(--pale); font-size: 12.5px; margin: 14px 0 0; }

.signe .coche { color: var(--favorable); margin-bottom: 6px; }
.signe h2 { margin-bottom: 6px; }
.signe p { margin: 0; color: var(--muet); }

.fin { max-width: 560px; margin: 40px auto 0; }
.fin h2 { margin-bottom: 8px; }
.fin p { margin: 0; color: var(--muet); }

.pied { color: var(--pale); font-size: 12.5px; text-align: center; margin-top: 36px; line-height: 1.7; }

/* ── La facture : « Payer par virement » (lot 4, 4 octobre 2026, la maquette
   validée le matin). Le QR se scanne avec un AUTRE appareil : inutile sur le
   téléphone qui l'affiche, il ne paraît qu'à partir d'un écran large. ── */
.reglement { display: grid; gap: 6px; }
.reglement dl { margin: 0; border-top: 0; }
.reglement dt { padding-top: 0; border: 0; font-size: 13px; padding-bottom: 2px; grid-column: 1 / -1; }
.reglement dd { text-align: left; border: 0; padding: 0 0 12px; grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  font-weight: 600; letter-spacing: .2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.copier { font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muet); background: var(--page); border: 1px solid var(--trait);
  border-radius: 7px; padding: 3px 8px; cursor: pointer; }
.copier.fait { color: var(--favorable); border-color: color-mix(in srgb, var(--favorable) 40%, var(--surface)); }
.qr { display: none; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--trait); border-radius: 12px; }
@media (min-width: 720px) { .qr { display: flex; } }
.qr svg { display: block; width: 112px; height: 112px; flex: none; }
.qr p { color: var(--muet); font-size: 13.5px; margin: 0; }
.qr strong { display: block; color: var(--encre); font-size: 14px; margin-bottom: 2px; }
.separe { border: 0; border-top: 1px solid var(--trait); margin: 20px 0; }
.bouton.contour { width: 100%; justify-content: center; background: var(--surface); color: var(--encre); border: 1.5px solid var(--encre);
  padding: 13px 16px; font-size: 16px; }

/* ── La barre du bas (A10, 5 octobre 2026) : le montant et « Signer le devis »,
   fixés en bas tant que le formulaire n'est pas à l'écran — il est sous le
   résumé sur un téléphone. Elle se replie quand il paraît : jamais deux fois
   le même bouton sous les yeux. Repliée, elle glisse d'abord, puis se cache. ── */
.barre { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface);
  border-top: 1px solid var(--trait); box-shadow: var(--ombre-barre);
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  transition: transform .25s ease, visibility 0s; }
.barre.repliee { transform: translateY(110%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
@media (prefers-reduced-motion: reduce) { .barre, .barre.repliee { transition: none; } }
.barre-dedans { max-width: 1008px; margin: 0 auto; display: flex; align-items: center; gap: 16px; }
.barre-montant { display: grid; margin: 0 auto 0 0; min-width: 0; }
.barre-chiffre { font-size: 20px; line-height: 1.2; font-weight: 650; letter-spacing: -.2px; font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.barre-libelle { color: var(--muet); font-size: 12.5px; }
.barre .bouton.plein { width: auto; flex: none; padding: 12px 20px; }
@media (max-width: 359px) {
  .barre-chiffre { font-size: 17px; }
  .barre .bouton.plein { padding: 11px 14px; font-size: 15px; }
}
/* Le pied de la page passe au-dessus de la barre : sa hauteur, pas plus. */
body.avec-barre .page { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ── Le style de la charte (le panneau « Habillage », 18 octobre 2026) : celui
   des pièces, posé par page.js (`data-style`). Cartes : des cartes blanches à
   l'ombre douce, la page d'avant. Bandeau : un liseré de la teinte en haut de
   la page et sur chaque carte — le logo reste sur le fond, jamais sur
   l'aplat, où il pourrait se perdre. Épuré : ni fond ni ombre de carte, des
   filets. La pièce dépliée garde son propre style. ── */
:root[data-style="bandeau"] body { border-top: 6px solid var(--plein); }
:root[data-style="bandeau"] .carte { border-top: 3px solid var(--plein); }
:root[data-style="epure"] .grille { gap: 8px; }
:root[data-style="epure"] .carte { background: transparent; box-shadow: none; border-radius: 0; padding: 4px 0 24px;
  border-bottom: 1px solid var(--trait); }
