* { box-sizing: border-box; }
/* Pas d’ancrage de défilement : redessiner le tracé ne doit jamais déplacer la page. */
html { overflow-anchor: none; }
body { margin: 0; color: #172a25; background: #edf2ef; font: 1rem/1.55 system-ui, sans-serif; }
main { max-width: 60rem; margin: auto; padding: 1rem; }
.controls, article { background: white; padding: 1.4rem; margin-bottom: 1.5rem; border: 1px solid #65786f; border-radius: .4rem; }
h1, h2, h3 { line-height: 1.25; }
.notice { padding: .6rem .9rem; background: #fdf3d6; border-left: .25rem solid #a45109; }
label { display: block; margin: .8rem 0; font-weight: 600; }
label.check { display: flex; align-items: flex-start; gap: .6rem; font-weight: normal; }
label.check input { flex: none; width: 1.4rem; height: 1.4rem; margin: .1rem 0 0; }
input:not([type=checkbox]) { display: block; width: 100%; margin-top: .3rem; padding: .6rem; font: inherit; border: 1px solid #586b62; border-radius: .3rem; }
button { padding: .75rem 1rem; font: inherit; color: white; background: #175c46; border: 0; border-radius: .35rem; cursor: pointer; }
button:disabled { color: #4b5c54; background: #dce4df; cursor: default; }
#next-steps a { display: inline-block; padding: .6rem .9rem; border: 1px solid currentColor; border-radius: .4rem; }
/* Lettre de voiture : un lien habillé comme les boutons en contour voisins (couleurs de la coquille si elle est posée). */
#to-lettre { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .6rem 1rem; background: white; color: var(--route, #175c46); border: 2px solid var(--route, #175c46); border-radius: var(--r-s, .35rem); font-family: var(--large, inherit); font-stretch: 85%; font-weight: 800; word-spacing: .08em; line-height: 1.15; text-align: center; text-decoration: none; }
#to-lettre:hover { background: var(--route-pale, #e6f1eb); }
/* Les trois fichiers à télécharger servent au bureau : des liens discrets sous l'impression et la lettre, pas trois gros boutons. */
#download, #response, #to-payments { flex: 1 1 100%; min-height: 44px; padding: .45rem .2rem; background: none; color: var(--route, #175c46); border: 0; border-top: 1px solid var(--trait, #dce4df); border-radius: 0; font-weight: 600; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
#download:hover:not(:disabled), #response:hover:not(:disabled), #to-payments:hover:not(:disabled) { background: var(--route-pale, #e6f1eb); }
#download:disabled, #response:disabled, #to-payments:disabled { background: none; color: #4b5c54; text-decoration: none; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: .5rem 0; }
:focus-visible { outline: 3px solid #a45109; outline-offset: 3px; }
fieldset { border: 1px solid #586b62; border-radius: .35rem; margin: 1rem 0; }
/* Cadre à taille fixée par le conteneur, quel que soit le tracé. */
.pad-frame { position: relative; width: 100%; aspect-ratio: 3 / 1; overflow-anchor: none; }
.signed-frame { position: relative; width: 100%; max-width: 24rem; aspect-ratio: 3 / 1; border-bottom: 1px solid #586b62; }
#pad, #signed-pad { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
#pad { background: #fbfcfb; border: 2px dashed #607d71; border-radius: .35rem; touch-action: none; cursor: crosshair; }
#pad .baseline { stroke: #b9c7bf; stroke-width: 2; }
#ink, #signed-ink { fill: none; stroke: #13306b; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.typed { font: italic 2rem/1.2 "Segoe Script", "Bradley Hand", cursive; color: #13306b; }
#missing { color: #7a2e0b; }
.status:not(:empty) { padding: .6rem .9rem; margin: 0 0 1.5rem; background: white; border: 1px solid #65786f; border-radius: .4rem; font-weight: 600; }
#link, #return-link { font-family: ui-monospace, monospace; font-size: .85rem; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #586b62; padding: .45rem; text-align: left; }
td.num, th.num { text-align: right; white-space: nowrap; }
th.room { background: #e6eeea; }
.grand-total { font-size: 1.15rem; font-weight: bold; }
dl > div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #c2d2ca; padding: .3rem 0; }
dt { font-weight: bold; } dd { margin: 0; }
.fingerprint { font-family: ui-monospace, monospace; font-size: .85rem; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
#suivi-note:empty { padding: 0; margin: 0; border: 0; background: none; }
#suivi-releve-note:empty { margin: 0; }
#sign-form { scroll-margin-block-start: 1rem; }
#suivi-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.suivi-entry { padding: .75rem .9rem; border: 1px solid #586b62; border-radius: .35rem; border-left: .35rem solid #a45109; }
.suivi-entry[data-status="signé"] { border-left-color: #175c46; }
.suivi-entry[data-status="à vérifier"] { border-left-color: #a11d1d; }
.suivi-entry h3, .suivi-entry p { margin: .15rem 0; }
.suivi-status { font-weight: 600; }
button.secondary { color: #175c46; background: white; border: 1px solid #175c46; }
#clear { color: #175c46; background: white; border: 1px solid #175c46; }
#return-block { margin-bottom: 1.2rem; padding: .9rem; background: #e6f1eb; border: 1px solid #175c46; border-radius: .35rem; }
#return-block h3 { margin-top: 0; }
#return-status:empty { margin: 0; }
#deposit-block { margin-bottom: 1.2rem; padding: .9rem; background: #fdf3d6; border: 1px solid #a45109; border-radius: .35rem; }
#deposit-block h3 { margin-top: 0; }
#deposit-block .notice { margin-bottom: 0; }
select { display: block; width: 100%; margin-top: .3rem; padding: .6rem; font: inherit; border: 1px solid #586b62; border-radius: .3rem; background: white; }
#return-status { font-weight: 600; }
/* Le client arrive par un lien : pas de retour vers la démo interne. */
body[data-mode="client"] .demo-home { display: none; }
@media screen and (max-width: 700px) {
  main { padding: .5rem; }
  .controls, article { padding: 1rem; margin-bottom: 1rem; }
  h1 { font-size: 1.6rem; margin: .4rem 0; }
  fieldset { padding: .5rem; margin-inline: 0; }
  th, td { padding: .4rem .35rem; }
}
@page { size: A4; margin: 15mm; @bottom-right { content: "Page " counter(page) " / " counter(pages); font-size: 8pt; color: #555; } }
@media print {
  body { background: white; color: black; font-size: 10pt; }
  main { max-width: none; padding: 0; }
  .controls, .controls-inline, .demo-home, .status { display: none !important; }
  article { border: 0; padding: 0; margin: 0; }
  thead { display: table-header-group; } tr, dl > div, .signature-box { break-inside: avoid; }
  /* Le devis d’abord, puis la signature, puis la preuve technique : une page pour un devis ordinaire, numérotées au-delà. */
  article { display: flex; flex-direction: column; }
  #signed-quote { order: 1; } .signature-box { order: 2; margin-top: .4rem; } #proof { order: 3; margin-top: .4rem; }
  /* Le contrôle de réception ne s’imprime que s’il alerte : un devis modifié garde son avertissement sur le document. */
  body[data-intact="true"] #received { display: none !important; }
  h2 { margin: 0 0 .3rem; } h3 { margin: .3rem 0; } article .notice { margin: 0 0 .3rem; padding: .25rem .6rem; }
  th, td { padding: .12rem .35rem; }
  dl { margin: .3rem 0; } dl > div { padding: .05rem 0; }
  .grand-total { font-size: 1.05rem; }
  .signature-box p { margin: .1rem 0; } .signed-frame { max-width: 13rem; }
  #proof dt, #proof dd { font-size: 8.5pt; }
  #proof dd.fingerprint { font-size: 7.5pt; }
  body:not([data-signed="true"]) #signed { display: none !important; }
}

/* Ce que le client voit de son déménageur. */
.terms-company { font-weight: 600; margin-top: 1rem; }
.terms-contact, .terms-valid { margin: 0.2rem 0; }
.terms-conditions { white-space: pre-line; font-size: 0.9rem; }
@media print { .terms-conditions { font-size: 8pt; } }

/* Remise : motif et détail à gauche, montant négatif à droite sur une ligne. */
dl > .remise { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: nowrap; }
.remise dt { min-width: 0; } .remise dt small { display: block; font-weight: 400; } .remise dd { white-space: nowrap; flex-shrink: 0; }
.quote-declaration-items { list-style: none; padding: 0; margin: .3rem 0 1rem; } .quote-declaration-items li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid #d6dfe9; } .quote-declaration-items strong { white-space: nowrap; }
dl.quote-declaration > div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: nowrap; } dl.quote-declaration dt { min-width: 0; } dl.quote-declaration dd { white-space: nowrap; flex-shrink: 0; font-weight: 700; }

/* Un retour refusé reste consultable, avec son refus toujours visible. */
body[data-intact="false"] #signed { border: 2px solid #9b2424; }
body[data-intact="false"] #received { color: #7c1717; font-weight: 700; }

/* Devis conforme : mentions de l’arrêté du 27 avril 2010. */
.edition-note { margin: .2rem 0; font-size: .85rem; color: #4b5c54; }
.help { font-size: .9rem; color: #33463e; margin: .3rem 0; }
.quote-state { font-weight: 600; }
.quote-final { font-weight: 600; margin: .4rem 0 1rem; }
dl.quote-mentions > div { display: block; } dl.quote-mentions dd { margin: 0 0 .2rem; }
.conformite { margin: 1rem 0; padding: .8rem 1rem; border: 2px solid #175c46; border-radius: .35rem; background: #e6f1eb; }
.conformite[data-ok="false"] { border-color: #9b2424; background: #fbeaea; }
.conformite p:first-child { margin-top: 0; font-weight: 700; }
#proof-details { margin: .6rem 0; } #proof-details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
@media print { .edition-note, #signature-info, #declared-help { display: none; } .quote-final { margin: .2rem 0 .4rem; } #proof-details summary { display: none; } #proof-details .actions { display: none; } }
