:root {
  /* Couleurs relevées sur le logo : orange #E46026, gris anthracite #333333 */
  --fond: #f5f5f4;
  --carte: #ffffff;
  --encre: #333333;
  --doux: #6f6f6f;
  --orange: #e46026;
  --orange-fonce: #c94f1b;
  --orange-clair: #fdeee6;
  --vert: #333333;
  --vert-clair: #ececec;
  --trait: #dcdcdc;
  --rouge: #a3271a;
  --rayon: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
h1, h2, h3 { font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif; font-weight: 700; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.6rem; margin: 0 0 .6em; }
h2 { font-size: 1.15rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1rem; margin: 1.4em 0 .4em; }
a { color: var(--vert); }

.bandeau {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: #fff; border-bottom: 4px solid var(--orange);
}
.marque { display: block; line-height: 0; }
.marque img { height: 92px; width: auto; display: block; }
.bandeau.centre { justify-content: center; }
.deconnexion { display: flex; align-items: center; gap: 12px; font-size: .85rem; flex-wrap: wrap; justify-content: flex-end; }
.deconnexion .qui { color: var(--doux); }

main { max-width: 860px; margin: 0 auto; padding: 24px 16px 40px; }
body.large main { max-width: 1040px; padding-top: 0; }
.pied { text-align: center; color: var(--doux); font-size: .8rem; padding: 0 16px 28px; }

.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 22px 20px; margin-bottom: 18px; }
.carte > :first-child { margin-top: 0; }
.etroit { max-width: 620px; margin-left: auto; margin-right: auto; }
.entete-page { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.entete-page h1, .entete-page h2 { margin: 0; }
.surtitre { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--orange-fonce); font-weight: 700; margin: 0 0 .5em; }

label { display: block; font-weight: 600; font-size: .92rem; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=number], input[type=search], input:not([type]), textarea, input[type=file] {
  width: 100%; padding: 11px 12px; font: inherit; color: inherit;
  background: #fff; border: 1px solid #bdb5a8; border-radius: 7px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #f2a37f; outline-offset: 2px; }
.court { max-width: 120px; }
.deux { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .deux { grid-template-columns: 1fr 1fr; } }
.aide { color: var(--doux); font-size: .86rem; }

.bouton {
  display: inline-block; margin-top: 18px; padding: 13px 20px; border: 0; border-radius: 7px;
  background: var(--orange); color: #fff; font: 700 1.05rem/1.2 inherit; font-family: inherit;
  text-decoration: none; cursor: pointer;
}
.bouton:hover { background: var(--orange-fonce); }
.bouton[disabled] { opacity: .55; cursor: default; }
.bouton.secondaire { background: var(--vert-clair); color: var(--vert); }
.bouton.secondaire:hover { background: #dedede; }
.bouton.danger { background: #f6e3df; color: var(--rouge); }
.bouton.danger:hover { background: #efd0ca; }
.entete-page .bouton { margin-top: 0; }
.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--vert); text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.actions .bouton { margin-top: 14px; font-size: .92rem; padding: 11px 15px; }

.info { background: var(--orange-clair); border-radius: 7px; padding: 12px 14px; }
.erreur { background: #f6e3df; color: var(--rouge); border-radius: 7px; padding: 12px 14px; font-weight: 600; }

.liste { list-style: none; margin: 0; padding: 0; }
.liste li { margin-bottom: 10px; }
.liste a { display: block; background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px 16px; text-decoration: none; color: inherit; }
.liste a:hover { border-color: var(--orange); }
.ligne1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ligne2 { display: block; color: var(--doux); font-size: .88rem; overflow-wrap: anywhere; }
.etat { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #ece7df; color: #5a544b; white-space: nowrap; }
.etat-signe { background: #e3f1e6; color: #1f6b34; }
.etat-envoye { background: #fbefd0; color: #7a5a06; }
.etat-expire, .etat-revoque { background: #f6e3df; color: var(--rouge); }

.fiche { display: grid; grid-template-columns: 1fr; gap: 2px 18px; margin: 0; }
.fiche dt { color: var(--doux); font-size: .85rem; margin-top: 10px; }
.fiche dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 640px) { .fiche { grid-template-columns: 190px 1fr; } .fiche dt, .fiche dd { margin-top: 8px; } }
.petit { font-size: .8rem; color: var(--doux); }

.clause { background: var(--fond); border-left: 4px solid var(--orange); border-radius: 0 7px 7px 0; padding: 14px 16px; margin: 0; }
.a-recopier { font-weight: 700; font-size: 1.08rem; margin: .2em 0 .4em; -webkit-user-select: none; user-select: none; }
.saisie { font-size: 1.05rem; }
.saisie.juste { border-color: #1f6b34; background: #f3faf4; }
.citation { background: var(--fond); border-radius: 7px; padding: 12px 14px; margin: 0; font-style: italic; }
.trace { display: block; max-width: 100%; border: 1px solid var(--trait); border-radius: 7px; background: #fff; }
.trace.signature { max-width: 420px; }

.pad { position: relative; border: 2px dashed #a79f92; border-radius: var(--rayon); background: #fff; height: 190px; touch-action: none; }
.pad canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; border-radius: var(--rayon); }
.pad .effacer { position: absolute; top: 8px; right: 8px; background: #fff; border: 1px solid #bdb5a8; border-radius: 6px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.pad.rempli { border-style: solid; border-color: var(--orange); }
.case { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; margin-top: 22px; }
.case input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--orange); }

.progression { margin-top: 18px; }
.barre { height: 10px; background: #e6e0d6; border-radius: 99px; overflow: hidden; }
.barre span { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s; }

.journal { width: 100%; border-collapse: collapse; font-size: .88rem; }
.journal th, .journal td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--trait); vertical-align: top; }
.journal th { color: var(--doux); font-weight: 600; }

/* Visionneuse client */
.rappel { position: sticky; top: 0; z-index: 5; background: var(--encre); color: #fff; padding: 10px 14px; font-size: .85rem; text-align: center; margin: 0 -16px; }
.rappel strong { color: #ff9a6b; }
.titre-doc { margin: 20px 0 14px; font-size: 1.3rem; overflow-wrap: anywhere; }
.pages canvas { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--trait); margin-bottom: 14px; }
.pages { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.fin-doc { text-align: center; color: var(--doux); font-size: .88rem; }
body.large { -webkit-user-select: none; user-select: none; }

@media print {
  body.large > * { display: none !important; }
  body.large::before { content: "Document confidentiel : impression non autorisée."; display: block; padding: 40px; font-size: 20px; }
  .sans-impression, .bandeau, .pied { display: none !important; }
  body { background: #fff; }
  .carte { border: 0; padding: 0; break-inside: avoid; }
  section.carte:last-of-type { break-inside: auto; }
}
#envoyer { display: block; }

/* Liste des envois : filtres et recherche */
.filtres { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.filtres input[type=search] { max-width: 320px; }
.onglets { display: flex; gap: 6px; }
.onglets a { padding: 8px 14px; border-radius: 99px; text-decoration: none; font-weight: 600; font-size: .9rem; background: #fff; border: 1px solid var(--trait); }
.onglets a.actif { background: var(--encre); color: #fff; border-color: var(--encre); }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Nouvel envoi : type de client et documents */
.choix { border: 0; padding: 0; margin: 0 0 4px; display: flex; gap: 8px 20px; flex-wrap: wrap; }
.choix legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: 6px; }
.choix label { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; }
.choix input { width: 20px; height: 20px; accent-color: var(--orange); }
.documents { list-style: none; padding: 0; margin: 12px 0 0; }
.documents li { display: grid; gap: 8px; grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--trait); border-radius: 7px; margin-bottom: 8px; background: var(--fond); }
.documents li .fichier { font-size: .82rem; color: var(--doux); overflow-wrap: anywhere; }
.documents select { width: 100%; padding: 11px 12px; font: inherit; border: 1px solid #bdb5a8; border-radius: 7px; background: #fff; }
@media (min-width: 640px) { .documents li { grid-template-columns: 2fr 1fr auto; align-items: center; } .documents li .fichier { grid-column: 1 / -1; } }
.documents.lecture li { grid-template-columns: 1fr; background: #fff; }
@media (min-width: 640px) { .documents.lecture li { grid-template-columns: 1fr auto; } }
.en-ligne { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.en-ligne label { margin: 0; }
.en-ligne .bouton { margin-top: 0; }

/* Visionneuse : plusieurs documents */
.sommaire { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }
.sommaire a { padding: 8px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--trait); text-decoration: none; font-weight: 600; font-size: .9rem; }
.document { scroll-margin-top: 60px; }
.type-doc { display: block; font: 400 .85rem/1.4 -apple-system, "Segoe UI", Arial, sans-serif; color: var(--doux); margin-top: 4px; }

/* Pages d'information */
.legal h2 { margin-top: 1.4em; }
.legal dl { margin: 0; }
.legal dt { color: var(--doux); font-size: .85rem; margin-top: 10px; }
.legal dd { margin: 0; }
.pied a { color: var(--doux); }

/* Classement des envois : en cours, archivés, supprimés */
.classement { display: flex; gap: 4px; border-bottom: 2px solid var(--trait); margin-bottom: 14px; flex-wrap: wrap; }
.classement a { padding: 10px 14px; text-decoration: none; font-weight: 600; color: var(--doux); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.classement a.actif { color: var(--encre); border-bottom-color: var(--orange); }
.classement a span { font-weight: 400; font-size: .85rem; background: #e9e9e9; border-radius: 99px; padding: 1px 8px; margin-left: 4px; }
.etat-supprime { background: #f6e3df; color: var(--rouge); }
.aide.reconnue { color: #1f6b34; font-weight: 600; }
.zone-danger { border: 1.5px solid #e2b4ac; background: #fdf6f4; border-radius: 8px; padding: 14px 16px; margin: 16px 0 10px; }
.zone-danger h3 { margin-top: 0; color: var(--rouge); }
.zone-danger .bouton { margin-top: 6px; background: var(--rouge); color: #fff; }
.zone-danger .bouton:hover { background: #861d12; }
