/* ===========================================================================
 *  Cryptenov Signature - portail de demonstration
 * ===========================================================================
 *  Soigne, mais pas spectaculaire. Un portail de signature a a rendre
 *  lisible ce sur quoi la personne s engage : le document, son empreinte,
 *  le nom au nom duquel elle signe. La couleur - le violet de l accolade
 *  des cartouches - marque l ACTION, jamais un verdict : le vert et le
 *  rouge restent a la validation, qui seule en rend un.
 *
 *  Meme feuille pour le portail et la page du destinataire (/signer/...) :
 *  c est le meme service, et une page qui ne lui ressemblerait pas ferait
 *  douter du lien recu.
 * ======================================================================== */

/* La police cursive des cartouches - celle-la meme que le PDF embarque :
   l apercu montre ce que le document portera. Licence OFL (polices/). */
@font-face {
    font-family: "Great Vibes";
    src: url("polices/GreatVibes-Regular.ttf") format("truetype");
    font-display: swap;
}

:root {
    --encre: #1e1b3a;
    --gris: #5f6478;
    --gris-clair: #8a8fa3;
    --trait: #e6e4f0;
    --trait-fort: #d5d2e4;
    --fond: #f6f5fb;
    --surface: #ffffff;
    --surface-douce: #fafaff;

    --accent: #5b3fd9;
    --accent-fonce: #4730b6;
    --accent-pale: #efebfd;
    --accent-trait: #d9d1fa;

    --succes: #12693f;
    --succes-fond: #e8f6ee;
    --succes-trait: #bfe5cf;
    --echec: #a1261c;
    --echec-fond: #fdeceb;
    --echec-trait: #f3c4be;
    --alerte: #8a5300;
    --alerte-fond: #fff6e1;
    --alerte-trait: #f2dca8;
    --info: #2d4f8c;
    --info-fond: #eef3fc;
    --info-trait: #cddcf3;

    --rayon: 14px;
    --rayon-moyen: 10px;
    --rayon-petit: 7px;
    --ombre: 0 1px 2px rgba(30, 27, 58, .05), 0 10px 30px -12px rgba(30, 27, 58, .12);
    --ombre-legere: 0 1px 2px rgba(30, 27, 58, .06);
    --anneau: 0 0 0 3px rgba(91, 63, 217, .18);

    --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --chasse-fixe: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
    --cursive: "Great Vibes", "Segoe Script", cursive;
}

* { box-sizing: border-box; }

/* L attribut hidden doit GAGNER : une regle « display » posee plus bas sur
   le meme element l emporterait sinon, et un element masque s afficherait -
   le badge d un utilisateur non connecte, par exemple. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: var(--police);
    font-size: 15px;
    line-height: 1.6;
    color: var(--encre);
    background:
        radial-gradient(1100px 380px at 50% -140px, #ece7ff 0%, rgba(236, 231, 255, 0) 70%),
        var(--fond);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-trait); }

/* Le bandeau n est pas decoratif : c est le garde-fou n 4 du MVP 7.
   Personne ne doit pouvoir croire que ces signatures engagent. */
#bandeau-demo {
    background: var(--alerte-fond);
    border-bottom: 1px solid var(--alerte-trait);
    color: var(--alerte);
    padding: .45rem 1.5rem;
    font-size: .85rem;
    text-align: center;
}

#bandeau-demo::before {
    content: "⚠";
    margin-right: .45rem;
}

header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .6rem 1rem;
    padding: .8rem max(1.5rem, calc((100% - 1040px) / 2));
    background: rgba(255, 255, 255, .86);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--trait);
}

/* La marque : l accolade des cartouches, dans un carre violet. */
header h1 {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.08rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: -.01em;
}

header h1::before {
    content: "";
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background:
        linear-gradient(#fff, #fff) 11px 8px / 2.4px 14px no-repeat,
        linear-gradient(#fff, #fff) 11px 8px / 7px 2.4px no-repeat,
        linear-gradient(#fff, #fff) 11px 19.6px / 7px 2.4px no-repeat,
        linear-gradient(135deg, #6d4ff0, #4730b6);
    box-shadow: 0 4px 12px -4px rgba(91, 63, 217, .6);
}

header h1 span { color: var(--accent); }

#identite {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem .65rem;
    margin-left: auto;
}

#utilisateur {
    color: var(--encre);
    font-size: .88rem;
    font-weight: 500;
    padding: .25rem .7rem .25rem .3rem;
    background: var(--surface-douce);
    border: 1px solid var(--trait);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

#utilisateur::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8f7cf4, #5b3fd9);
}

/* Age de l authentification : present, jamais criard. Il informe ; il
   n alarme pas, puisqu il n y a rien d anormal a ce que le temps passe. */
#fraicheur {
    color: var(--gris-clair);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
}

main {
    max-width: 1040px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3.5rem;
}

h2 { font-size: 1.35rem; margin: 0 0 .7rem; letter-spacing: -.015em; line-height: 1.3; }
h3 { font-size: 1.02rem; margin: 0 0 .55rem; font-weight: 650; letter-spacing: -.005em; }
h4 { font-size: .95rem; margin: 0 0 .45rem; font-weight: 650; }

p { margin: .35rem 0 .85rem; }

a { color: var(--accent); }

.note {
    color: var(--gris);
    font-size: .875rem;
}

code {
    font-family: var(--chasse-fixe);
    background: var(--accent-pale);
    color: var(--accent-fonce);
    padding: .1em .4em;
    border-radius: 5px;
    font-size: .86em;
}

/* ------------------------------------------------------------- controles */

button {
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    padding: .58rem 1.15rem;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: var(--rayon-moyen);
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
    box-shadow: 0 1px 2px rgba(71, 48, 182, .25);
}

button:hover:not(:disabled) {
    background: var(--accent-fonce);
    border-color: var(--accent-fonce);
}

button:active:not(:disabled) { transform: translateY(1px); }

button:focus-visible { outline: none; box-shadow: var(--anneau); }

button:disabled {
    background: #c9c6d8;
    border-color: #c9c6d8;
    box-shadow: none;
    cursor: not-allowed;
}

/* Un bouton SECONDAIRE ne propose pas la meme chose qu'un bouton principal.
   « Retirer », « Annuler », « Journal » ne sont pas l'action qu'on attend de
   l'ecran : les peindre comme elle ferait cliquer par habitude. */
#deconnexion,
button.secondaire {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--trait-fort);
    box-shadow: var(--ombre-legere);
}

#deconnexion:hover:not(:disabled),
button.secondaire:hover:not(:disabled) {
    background: var(--accent-pale);
    border-color: var(--accent-trait);
    color: var(--accent-fonce);
}

button.secondaire:disabled {
    background: #f4f3f8;
    color: #a3a6b7;
    border-color: var(--trait);
}

/* Une action qui ARRETE quelque chose - annuler un envoi : rouge, pour
   qu'on ne la prenne pas pour la suite naturelle de l'ecran. */
button.danger {
    background: var(--echec);
    border-color: var(--echec);
    color: #fff;
}

button.danger:hover:not(:disabled) {
    background: #851d15;
    border-color: #851d15;
}

/* Le formulaire d'annulation, deplie dans la carte ou dans le resultat. */
.annulation {
    margin-top: .9rem;
    padding: .9rem 1rem;
    border: 1px solid var(--echec-trait);
    border-radius: var(--rayon-moyen);
    background: var(--echec-fond);
    color: var(--encre);
}

.annulation p { margin-top: 0; }

.annulation textarea {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
}

input[type=file],
input[type=text],
input[type=email],
input[type=number],
input[type=datetime-local],
select,
textarea {
    font: inherit;
    font-size: .93rem;
    color: var(--encre);
    padding: .55rem .75rem;
    border: 1px solid var(--trait-fort);
    border-radius: var(--rayon-moyen);
    background: var(--surface);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--anneau);
}

input[readonly] {
    background: var(--surface-douce);
    color: var(--encre);
    border-style: dashed;
}

input[type=file] {
    padding: .45rem;
    background: var(--surface-douce);
    cursor: pointer;
}

input[type=file]::file-selector-button {
    font: inherit;
    font-weight: 600;
    font-size: .85rem;
    margin-right: .75rem;
    padding: .4rem .85rem;
    border: 1px solid var(--accent-trait);
    border-radius: var(--rayon-petit);
    background: var(--accent-pale);
    color: var(--accent-fonce);
    cursor: pointer;
}

input[type=checkbox],
input[type=radio] {
    accent-color: var(--accent);
    width: 1.05rem;
    height: 1.05rem;
}

/* ---------------------------------------------------------------- onglets */

.onglets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .3rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--trait);
    border-radius: 999px;
    box-shadow: var(--ombre-legere);
}

.onglet {
    background: transparent;
    color: var(--gris);
    border: none;
    border-radius: 999px;
    padding: .45rem 1.05rem;
    box-shadow: none;
    font-weight: 600;
}

.onglet:hover:not(:disabled) {
    background: var(--accent-pale);
    color: var(--accent-fonce);
}

.onglet.actif,
.onglet.actif:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px -2px rgba(91, 63, 217, .55);
}

.vue,
section#accueil,
section#signature,
section#lien-invalide,
section#chargement {
    background: var(--surface);
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    padding: 1.6rem 1.8rem;
    box-shadow: var(--ombre);
}

/* ---------------------------------------------------------------- etapes */

.etapes {
    margin: 0;
    padding: 0;
    list-style: none;
}

.etapes > li {
    position: relative;
    padding: 1.25rem 0 1.35rem;
    border-bottom: 1px solid var(--trait);
}

.etapes > li:first-child { padding-top: .25rem; }
.etapes > li:last-child { border-bottom: none; padding-bottom: .25rem; }

.champs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .85rem 1rem;
}

.champs label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--gris);
}

.champs label select,
.champs label input { margin-top: .3rem; font-weight: 400; }

/* ---------------------------------------------------------------- apercu */

#apercu { margin-top: .9rem; }

#apercu-meta {
    font-size: .86rem;
    color: var(--gris);
    margin-bottom: .55rem;
}

#apercu-pdf,
#document {
    width: 100%;
    height: 460px;
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
}

/* L empreinte doit se COMPARER a l oeil : chasse fixe, groupee, lisible. */
.empreinte {
    font-family: var(--chasse-fixe);
    font-size: .84rem;
    letter-spacing: .03em;
    background: var(--surface-douce);
    border: 1px solid var(--trait);
    border-left: 3px solid var(--accent);
    border-radius: var(--rayon-petit);
    padding: .65rem .8rem;
    word-break: break-all;
    color: var(--encre);
}

/* --------------------------------------------------------- consentement */

.consentement {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin-bottom: .9rem;
    font-size: .94rem;
    cursor: pointer;
}

.consentement input { margin-top: .22rem; flex: none; }

/* -------------------------------------------------------------- resultat */

.resultat {
    margin-top: 1.25rem;
    padding: 1rem 1.15rem;
    border-radius: var(--rayon-moyen);
    border: 1px solid var(--trait);
    background: var(--surface-douce);
}

.resultat h4 { margin-top: 0; }

.resultat.succes {
    background: var(--succes-fond);
    border-color: var(--succes-trait);
    color: var(--succes);
}

.resultat.echec {
    background: var(--echec-fond);
    border-color: var(--echec-trait);
    color: var(--echec);
}

/* La confirmation par code : un encart neutre, le champ bien visible. */
.resultat.confirmation {
    background: var(--info-fond);
    border-color: var(--info-trait);
    color: var(--encre);
}

.resultat.confirmation .champ { max-width: 14rem; }

.code-otp {
    font-size: 1.5rem;
    letter-spacing: .35em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.avertissement {
    background: var(--alerte-fond);
    border: 1px solid var(--alerte-trait);
    border-left: 3px solid #e0a52c;
    color: var(--alerte);
    padding: .7rem .9rem;
    border-radius: var(--rayon-petit);
    font-size: .875rem;
}

.telecharger {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .5rem;
    padding: .5rem .95rem;
    border-radius: var(--rayon-moyen);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 8px -3px rgba(91, 63, 217, .6);
}

.telecharger::before { content: "↓"; }

.telecharger:hover { background: var(--accent-fonce); }

.resultat pre {
    max-height: 320px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--trait);
    border-radius: var(--rayon-petit);
    padding: .7rem;
    font-size: .78rem;
    color: var(--encre);
}

details summary {
    cursor: pointer;
    font-size: .88rem;
    margin-top: .5rem;
}

footer {
    text-align: center;
    padding: 1.5rem 1.5rem 2.5rem;
    font-size: .85rem;
    color: var(--gris);
}

footer a { color: var(--accent); }

/* ===========================================================================
 *  Enrolement - MVP 6
 * ======================================================================== */

.barre-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
    margin-top: .7rem;
}

.dossier {
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    padding: .9rem 1rem;
    margin-top: .75rem;
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}

.dossier:hover {
    border-color: var(--trait-fort);
    box-shadow: var(--ombre-legere);
}

.dossier-entete {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .25rem;
}

/* L etat est colore, mais sobrement : un dossier approuve n est pas une
   bonne nouvelle a feter, c est une etape franchie. */
.etat {
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .03em;
    padding: .12rem .55rem;
    border-radius: 999px;
    border: 1px solid var(--trait);
    background: #f1f0f7;
    color: var(--gris);
}

.etat-APPROUVE { background: var(--succes-fond); color: var(--succes); border-color: var(--succes-trait); }
.etat-REJETE { background: var(--echec-fond); color: var(--echec); border-color: var(--echec-trait); }
.etat-CERTIFICAT_EMIS { background: var(--accent-pale); color: var(--accent-fonce); border-color: var(--accent-trait); }

/* Le journal du registre. Chasse fixe sur les identifiants : ce sont des
   valeurs qu on COMPARE, pas qu on lit. */
table.journal {
    width: 100%;
    border-collapse: collapse;
    margin-top: .6rem;
    font-size: .84rem;
}

table.journal th {
    text-align: left;
    border-bottom: 1px solid var(--trait-fort);
    padding: .4rem .45rem;
    color: var(--gris);
    font-weight: 650;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

table.journal td {
    padding: .4rem .45rem;
    border-bottom: 1px solid var(--trait);
    vertical-align: top;
}

table.journal td.tronque {
    font-family: var(--chasse-fixe);
    font-size: .78rem;
    max-width: 16ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

table.journal td.detail {
    color: var(--gris);
    font-size: .8rem;
    padding-top: 0;
}

#avertissement-donnees { margin-bottom: 1rem; }

/* ---------------------------------------------------------------- accueil */

/* Les trois parcours en colonnes : la page doit dire en un coup d oeil ce
   qu on peut faire ici. Un visiteur qui doit se connecter pour DECOUVRIR
   ce que le service propose ne se connecte pas. */
.parcours {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.1rem 0 1.4rem;
}

.parcours-etape {
    position: relative;
    background: var(--surface-douce);
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    padding: 1rem 1.1rem 1rem;
    border-top: 3px solid var(--accent);
}

.parcours-etape h3 { margin-bottom: .35rem; color: var(--accent-fonce); }

table.comptes {
    border-collapse: separate;
    border-spacing: 0;
    margin: .8rem 0;
    font-size: .88rem;
    background: #fff;
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    overflow: hidden;
}

table.comptes caption {
    text-align: left;
    color: var(--gris);
    font-size: .84rem;
    font-weight: 600;
    padding-bottom: .35rem;
}

table.comptes th,
table.comptes td {
    border-bottom: 1px solid var(--trait);
    padding: .5rem .8rem;
    text-align: left;
}

table.comptes tr:last-child td { border-bottom: none; }

table.comptes th {
    background: var(--surface-douce);
    font-weight: 650;
    font-size: .8rem;
    color: var(--gris);
}

/* ------------------------------------------------------- reglage fin
   Le placement manuel du cartouche et l'import de la racine sont des
   gestes RARES. Les replier evite qu'ils encombrent le parcours courant,
   sans les cacher : un <details> se voit, contrairement a une option
   qu'il faudrait deviner. */
.reglage-fin,
.racine {
    margin-top: .85rem;
    padding: .7rem .9rem;
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    background: var(--surface-douce);
}

.reglage-fin > summary,
.racine > summary {
    cursor: pointer;
    font-size: .88rem;
    font-weight: 600;
    color: var(--gris);
}

.reglage-fin[open] > summary,
.racine[open] > summary { color: var(--encre); }

.reglage-fin .champs,
.racine .barre-actions { margin-top: .7rem; }

/* ===========================================================================
 *  Circuit de signature - MVP 8
 * ======================================================================== */

/* Un champ isole - la grille .champs suppose des voisins. */
.champ {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--gris);
    margin-top: .7rem;
}

.champ > span { display: block; margin-bottom: .3rem; }
.champ input { width: 100%; box-sizing: border-box; font-weight: 400; }

#composition {
    margin-top: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    background: var(--surface-douce);
}

#composition h3 { margin-top: 0; }

/* Une ligne par destinataire, dans l'ORDRE DE PASSAGE. Le numero est a
   gauche et ne se saisit pas : il decoule de la position, et deux sources
   pour un meme rang finiraient par se contredire. */
.destinataire-ligne {
    display: grid;
    grid-template-columns: 1.8rem repeat(4, 1fr) auto;
    gap: .6rem;
    align-items: end;
    padding: .65rem 0;
    border-bottom: 1px dashed var(--trait-fort);
}

.destinataire-ligne:last-child { border-bottom: none; }

.destinataire-ligne .rang {
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    margin-bottom: .45rem;
    border-radius: 50%;
    background: var(--accent-pale);
    color: var(--accent-fonce);
    font-weight: 700;
    font-size: .8rem;
}

.destinataire-ligne .champ { margin-top: 0; }

@media (max-width: 720px) {
    /* Quatre colonnes sur un telephone donnent quatre champs illisibles. */
    .destinataire-ligne { grid-template-columns: 1fr; }
    .destinataire-ligne .rang { margin-bottom: 0; }
}

/* Sobres, comme ceux de l'enrolement : « signee par tous » est une etape
   franchie, pas une bonne nouvelle a feter. Le refus et l'annulation, eux,
   demandent une lecture - ils portent un motif. */
.etat-COMPLETE { background: var(--succes-fond); color: var(--succes); border-color: var(--succes-trait); }
.etat-REFUSEE  { background: var(--echec-fond);  color: var(--echec);  border-color: var(--echec-trait); }
.etat-BROUILLON { background: #f1f0f7; color: var(--gris); border-color: var(--trait); }
.etat-ANNULEE  { background: var(--echec-fond);  color: var(--echec);  border-color: var(--echec-trait); }
.etat-EXPIREE  { background: #f6f1e6; color: #7a6a3f; border-color: #e3d7b9; }
.etat-EN_COURS { background: var(--info-fond); color: var(--info); border-color: var(--info-trait); }

.historique {
    font-size: .88rem;
    line-height: 1.65;
    padding-left: 1.2rem;
}

.historique li { margin-bottom: .2rem; }

/* ===========================================================================
 *  La page du destinataire - servie sous /signer/<jeton>
 * ======================================================================== */

.destinataire {
    font-size: .98rem;
    margin-bottom: .8rem;
}

/* ===========================================================================
 *  Choisir sa signature - le cartouche
 * ===========================================================================
 *  Ce que le PDF portera, montre AVANT de signer : meme accolade, meme
 *  police cursive, meme nom - celui du certificat, qu on ne choisit pas.
 * ======================================================================== */

.interrupteur {
    padding: .75rem .9rem;
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    background: var(--surface-douce);
    margin-top: 1rem;
}

.signature-choix {
    margin-top: .8rem;
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    background: var(--surface);
    box-shadow: var(--ombre);
    overflow: hidden;
}

.signature-choix-tete { padding: 1.15rem 1.3rem .4rem; }

.signature-choix-tete h4 { font-size: 1.12rem; margin-bottom: .25rem; }

.signature-identite {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: .85rem;
    margin-top: .6rem;
}

.signature-identite label {
    font-size: .82rem;
    font-weight: 650;
    color: var(--encre);
}

.signature-identite input { margin-top: .3rem; font-weight: 400; }

.signature-onglets {
    display: flex;
    gap: 1.6rem;
    padding: 0 1.3rem;
    margin-top: .9rem;
    border-bottom: 1px solid var(--trait);
    overflow-x: auto;
}

.signature-onglet {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    box-shadow: none;
    padding: .85rem 0 .7rem;
    color: var(--gris);
    font-size: .8rem;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.signature-onglet:hover:not(:disabled) {
    background: none;
    color: var(--encre);
}

.signature-onglet.actif,
.signature-onglet.actif:hover {
    background: none;
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.signature-panneau { padding: 1.1rem 1.3rem; }

.cartes-style {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .75rem;
}

.carte-style {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: .35rem;
    min-height: 104px;
    padding: .85rem 1rem .75rem;
    border: 1.5px solid var(--trait);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}

.carte-style:hover { border-color: var(--accent-trait); }

.carte-style input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.carte-style.choisie,
.carte-style:has(input:checked) {
    border-color: var(--accent);
    box-shadow: var(--anneau);
}

.carte-style.choisie::after,
.carte-style:has(input:checked)::after {
    content: "✓";
    position: absolute;
    top: .55rem;
    right: .65rem;
    width: 1.25rem;
    height: 1.25rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
}

.carte-style:has(input:focus-visible) { box-shadow: var(--anneau); }

.specimen-cursive {
    font-family: var(--cursive);
    font-size: 2rem;
    line-height: 1.2;
    color: var(--encre);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1.4rem;
}

.specimen-texte {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--encre);
    padding-top: .55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.carte-style .legende {
    font-size: .76rem;
    color: var(--gris);
}

/* Le pavé de tracé. `touch-action: none` est INDISPENSABLE : sans lui, un
   doigt sur le cadre fait défiler la page au lieu de dessiner, et rien
   n'indique pourquoi. */
#trace {
    display: block;
    width: 100%;
    max-width: 640px;
    height: auto;
    aspect-ratio: 29 / 10;
    border: 1.5px dashed var(--trait-fort);
    border-radius: 12px;
    background:
        linear-gradient(var(--trait), var(--trait)) 6% 74% / 88% 1px no-repeat,
        #fff;
    touch-action: none;
    cursor: crosshair;
}

.depot-image {
    display: grid;
    place-items: center;
    gap: .5rem;
    min-height: 150px;
    padding: 1rem;
    border: 1.5px dashed var(--trait-fort);
    border-radius: 12px;
    background: var(--surface-douce);
    text-align: center;
    color: var(--gris);
    font-size: .88rem;
}

.depot-image img {
    max-width: 100%;
    max-height: 120px;
}

.depot-image input { max-width: 340px; }

.apercu-zone {
    padding: 1rem 1.3rem 1.1rem;
    background: var(--fond);
    border-top: 1px solid var(--trait);
}

.apercu-titre {
    font-size: .74rem;
    font-weight: 750;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--gris);
    margin-bottom: .55rem;
}

.apercu-cartouches {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.8rem;
    padding: 1.1rem 1.2rem;
    background: #fff;
    border: 1px solid var(--trait);
    border-radius: 12px;
    box-shadow: var(--ombre-legere);
}

/* Le cartouche, en HTML : l accolade est un bord gauche arrondi, comme le
   trait que DessinCartouche pose dans le PDF. */
.cartouche {
    position: relative;
    padding: .25rem 0 .3rem 1rem;
    min-width: min(230px, 100%);
    max-width: 380px;
    color: var(--encre);
    line-height: 1.3;
}

.cartouche::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: .6rem;
    border: 2.5px solid var(--accent);
    border-right: none;
    border-radius: 9px 0 0 9px;
}

.cartouche-etiquette {
    font-size: .74rem;
    font-weight: 700;
}

.cartouche-etiquette .nom-clair { font-weight: 400; margin-left: .3rem; }

.cartouche-dessin {
    display: flex;
    align-items: center;
    min-height: 3.1rem;
    margin: .1rem 0;
}

.cartouche-dessin .cursive {
    font-family: var(--cursive);
    font-size: 2.3rem;
    line-height: 1.15;
    white-space: nowrap;
}

.cartouche-dessin .droit {
    font-weight: 700;
    font-size: 1.1rem;
}

.cartouche-dessin img {
    max-height: 3.1rem;
    max-width: 100%;
}

.cartouche-dessin .vide {
    color: var(--gris-clair);
    font-size: .82rem;
    font-style: italic;
}

.cartouche-ligne {
    font-size: .68rem;
    color: var(--gris-clair);
}

.cartouche.paraphe { min-width: 0; padding-right: .5rem; }
.cartouche.paraphe .cartouche-dessin .cursive { font-size: 1.7rem; }

/* Sur quelles pages : un choix a trois, en boutons segmentes. */
.signature-pages {
    padding: 1rem 1.3rem 1.2rem;
    border-top: 1px solid var(--trait);
}

.choix-segmente {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .6rem;
    margin: .55rem 0 .7rem;
}

.choix-segmente label {
    position: relative;
    display: block;
    padding: .65rem .85rem;
    border: 1.5px solid var(--trait);
    border-radius: var(--rayon-moyen);
    background: var(--surface);
    cursor: pointer;
    font-size: .86rem;
    color: var(--gris);
    margin: 0;
    transition: border-color .15s, box-shadow .15s;
}

.choix-segmente label strong {
    display: block;
    color: var(--encre);
    font-size: .92rem;
}

.choix-segmente input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choix-segmente label:has(input:checked) {
    border-color: var(--accent);
    box-shadow: var(--anneau);
    background: var(--surface-douce);
}

.choix-segmente label:has(input:checked) strong { color: var(--accent-fonce); }

/* L ancien choix d allure, conserve pour la page du destinataire. */
.choix-style { margin: .6rem 0; }
.choix-style label { align-items: flex-start; margin-bottom: .45rem; }
.choix-style label span { font-size: .9rem; }

#pave-trace .barre-actions { margin-top: .6rem; }

/* ===========================================================================
 *  Dossiers de preuve
 * ======================================================================== */

/* Le temoignage de la plateforme n est ni un succes ni un echec : c est une
   information. Il a donc sa couleur propre, neutre - le vert et le rouge
   restent a la validation, qui seule rend un verdict. */
.resultat.preuves {
    background: var(--info-fond);
    border-color: var(--info-trait);
    color: var(--encre);
}

.preuve-consignee {
    margin-top: .8rem;
    padding: .7rem .85rem;
    background: #fff;
    border: 1px solid var(--trait);
    border-radius: var(--rayon-petit);
    color: var(--encre);
}

.preuve-consignee p { margin: .2rem 0; }

.preuve-consignee code,
.resultat.preuves code {
    font-size: .88rem;
}

.etat-DOCUMENT_RENDU { background: var(--succes-fond); color: var(--succes); border-color: var(--succes-trait); }
.etat-SIGNATURE_PRESENTE { background: var(--accent-pale); color: var(--accent-fonce); border-color: var(--accent-trait); }
.etat-DOCUMENT_AVANT_SIGNATURE { background: #f1f0f7; color: var(--gris); border-color: var(--trait); }

/* Pour qui le dossier est-il depose - visible des seuls agents. */
.pour-qui {
    border: 1px solid var(--trait);
    border-radius: var(--rayon-moyen);
    padding: .7rem 1rem .3rem;
    margin: 0 0 1rem;
    background: var(--surface-douce);
}

.pour-qui legend {
    font-weight: 650;
    padding: 0 .35rem;
}

/* ------------------------------------------------------------ telephone */

@media (max-width: 640px) {
    main { padding: 1.25rem 1rem 2.5rem; }
    header { padding: .7rem 1rem; }
    .vue,
    section#accueil,
    section#signature,
    section#lien-invalide,
    section#chargement { padding: 1.15rem 1.05rem; border-radius: 12px; }
    .onglets { display: flex; border-radius: 14px; }
    .onglet { flex: 1 1 auto; }
    .signature-identite { grid-template-columns: 1fr; }
    #apercu-pdf, #document { height: 360px; }
    #fraicheur { display: none; }
    .signature-onglets { gap: 1.1rem; padding: 0 1rem; }
    .signature-panneau, .apercu-zone, .signature-pages, .signature-choix-tete {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .apercu-cartouches { padding: .9rem; gap: 1.2rem; }
    .cartouche-dessin .cursive { white-space: normal; font-size: 1.9rem; }
    #utilisateur { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}

/* L apercu, sur la page du destinataire : un encart dans l etape. */
.apercu-tiers {
    border: 1px solid var(--trait);
    border-radius: 12px;
    margin: .3rem 0 1.1rem;
}
