* { box-sizing: border-box; }
body { margin: 0; background: #f2f5f4; color: #18362e; font: 16px/1.6 system-ui, sans-serif; }
main { max-width: 1100px; margin: auto; padding: 24px 20px 80px; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.15; }
h2 { font-size: 1.25rem; line-height: 1.3; } h3 { font-size: 1rem; margin: 0; }
.eyebrow { letter-spacing: .1em; font-weight: 700; font-size: .8rem; }
section { background: white; border: 1px solid #c5d3cd; border-radius: 12px; padding: 24px; margin: 20px 0; }
label { display: block; font-weight: 600; }
input, select, button { font: inherit; max-width: 100%; }
input, select { display: block; width: 100%; margin: 8px 0; padding: 12px; border: 1px solid #67877a; border-radius: 6px; background: white; color: #18362e; }
.auto input { display: inline-block; width: auto; margin: 0 8px 0 0; padding: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: end; }
.actions { display: flex; gap: 12px; }
fieldset { border: 1px solid #c5d3cd; border-radius: 8px; padding: 12px 16px; margin: 12px 0; }
legend { font-weight: 600; padding: 0 4px; }
.contract { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0 16px; padding: 8px 0 12px; border-bottom: 1px solid #c5d3cd; }
.contract:last-child { border-bottom: 0; }
.contract h3, .contract > .options, .contract > button { grid-column: 1 / -1; }
.contract > button { justify-self: start; }
.option { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0 16px; }
button { background: #175342; color: white; border: 0; border-radius: 6px; padding: 12px 18px; margin: 8px 0; cursor: pointer; }
button:disabled { background: #d3ddd8; color: #465b52; cursor: default; }
:focus-visible { outline: 3px solid #ad6610; outline-offset: 4px; }
.invoice { background: white; border: 1px solid #8ea69b; border-radius: 8px; padding: 24px; margin: 20px 0; }
.invoice-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.invoice-head p { margin: 2px 0; }
.table-wrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; min-width: 28rem; }
th, td { border: 1px solid #8ea69b; padding: 6px 8px; text-align: left; vertical-align: top; }
dl > div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid #c5d3cd; padding: 4px 0; }
dt { font-weight: 600; } dd { margin: 0; text-align: right; }
.totals { max-width: 26rem; margin-left: auto; }
.totals > div:last-child { font-weight: 700; border-bottom: 2px solid #18362e; }
.notice { font-size: .9rem; color: #533d12; background: #fff4d8; padding: 8px; }
.plan { background: #eef5f1; border: 1px solid #175342; border-radius: 12px; padding: 16px 24px; margin: 20px 0; }
.plan h2 { margin: 0 0 4px; } .plan p { margin: 4px 0; }
.plan.blocked { background: #fbeae7; border-color: #822e23; }
.plan-done { font-weight: 700; color: #175342; } .plan-alert { font-weight: 700; color: #822e23; }
.current { background: #eef5f1; border-left: 4px solid #175342; padding: 8px 16px; margin: 12px 0; }
.current h3 { margin: 4px 0; }
.pay { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; border-top: 1px solid #c5d3cd; margin-top: 12px; padding-top: 8px; }
.pay p { flex: 1 1 100%; margin: 0; font-weight: 600; }
/* Préfixe #invoices : la règle .notice du socle (systeme.css) ne doit pas réafficher la mention hors conflit. */
#invoices .pay .etat-a-verifier, #invoices.registre-a-verifier .pay > :not(.etat-a-verifier):not(.garder-en-conflit) { display: none; }
#invoices.registre-a-verifier .pay .etat-a-verifier { display: block; }
/* Conflit d’onglet : aucun geste d’écriture proposé jusqu’au rechargement ; exports et impression restent. */
body.ecriture-suspendue [data-ecriture], body.ecriture-suspendue #invoices .regularisation button { display: none; }
.regularisation { border-left: 4px solid #175342; background: #eef5f1; margin: 0 0 1rem; padding: .75rem 1rem; scroll-margin-top: 5rem; }
.regularisation p { margin: 0; }
#status, #export-status:not(:empty) { padding: 12px; background: #18362e; color: white; border-radius: 6px; }
#status.error { background: #822e23; }
/* Échec d’une sortie pendant une erreur signalée : affiché à part, dans la même couleur d’erreur. */
#export-status.error:not(:empty) { background: #822e23; }
.mx #messages #export-status.error:not(:empty) { background: var(--rouge-pale); color: var(--rouge); border-color: var(--rouge); }
/* Le statut signalé et la confirmation éventuelle restent ensemble au-dessus de la navigation. */
#messages:has(> #status.signale) { position: sticky; bottom: 0; z-index: 30; }
@media screen and (max-width: 1023px) { .mx #messages:has(> #status.signale) { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); } }
@page { size: A4; margin: 15mm; }
@media print {
  html, body { background: white; color: black; font-size: 10pt; }
  main { max-width: none; margin: 0; padding: 0; }
  .controls { display: none !important; }
  body.print-reminder #invoices { display: none !important; }
  body:not(.print-reminder) #reminder-sheet { display: none !important; }
  .invoice { border: 0; border-radius: 0; padding: 0; margin: 0; break-after: page; page-break-after: always; }
  .invoice:last-child { break-after: auto; page-break-after: auto; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; }
  th, td { border-color: black; }
  thead { display: table-header-group; } tr, dl > div { break-inside: avoid; page-break-inside: avoid; }
}

[data-edition="reel"] #status:empty { display: none; }
[data-edition="reel"] .invoice { overflow-wrap: anywhere; }
[data-edition="reel"] .invoice h2 { margin: 0 0 1rem; }
[data-edition="reel"] .invoice-head { margin-bottom: 1rem; }
[data-edition="reel"] .plan a { display: inline-block; margin: .2rem .8rem .4rem 0; }
@media screen { [data-edition="reel"] #reminder-sheet { display: none; } }
.invoice .arrondi { font-size: .875rem; margin: .25rem 0 0; }
.invoice .corrections { margin: .75rem 0; padding-left: 1.25rem; }

@media screen {
  h1 { font-size: var(--t-page); }
  h2 { font-size: var(--t-carte); }
  .eyebrow, .notice, .invoice .arrondi { font-size: var(--t-meta); }
}
