/* Signaclap — piste « Moniteur » : le moniteur de retour du plateau. Fond profond, repères de cadre,
   gros compteurs lisibles à bout de bras, et le rouge du voyant de la caméra pour ce qui attend encore
   une signature. Version claire pour le plein soleil (réglages, ou le thème du téléphone). */

@font-face { font-family: "Apfel Grotezk"; font-weight: 700; font-display: swap; src: url(fonts/apfel-grotezk-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 400; font-display: swap; src: url(fonts/hanken-grotesk-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 500; font-display: swap; src: url(fonts/hanken-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 600; font-display: swap; src: url(fonts/hanken-grotesk-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-weight: 700; font-display: swap; src: url(fonts/hanken-grotesk-latin-700-normal.woff2) format("woff2"); }

:root {
  --fond: #0c0c0b; --carte: #171715; --carte-2: #222120; --encre: #efece4; --gris: #8d897e; --filet: #2c2b27;
  --rouge: #ff4b36; --sur-rouge: #fff; --papier: #fbfaf6; --ombre: none;
  --titre: "Apfel Grotezk", system-ui, sans-serif; --texte: "Hanken Grotesk", system-ui, sans-serif;
  color-scheme: dark;
}
/* Clair : le même moniteur, en papier. Le rouge foncit pour garder son contraste sur fond clair. */
:root[data-theme="clair"] {
  --fond: #f1eee6; --carte: #fffdf8; --carte-2: #e6e2d7; --encre: #151412; --gris: #6b675e; --filet: #dcd7ca;
  --rouge: #d9361f; --ombre: 0 1px 0 rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --fond: #f1eee6; --carte: #fffdf8; --carte-2: #e6e2d7; --encre: #151412; --gris: #6b675e; --filet: #dcd7ca;
    --rouge: #d9361f; --ombre: 0 1px 0 rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .06);
    color-scheme: light;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--fond); }
body {
  font: 400 16px/1.45 var(--texte); color: var(--encre); background: var(--fond); min-height: 100dvh;
  font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
.cache { display: none !important; }

main { max-width: 560px; margin: 0 auto; padding: 14px 20px 140px; }
h1 { font: 700 32px/1.02 var(--titre); letter-spacing: -0.02em; }
h2 { font: 700 22px/1.1 var(--titre); letter-spacing: -0.01em; margin: 26px 0 10px; }
.sous { color: var(--gris); font-size: 14.5px; margin-top: 6px; }
.tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 6px 0 18px; min-height: 44px; }
.marque { font: 700 26px var(--titre); letter-spacing: -0.03em; }
.marque em { font-style: normal; color: var(--rouge); }
.retour { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--gris); padding: 10px 0; font-size: 15px; text-decoration: none; }
.retour::before { content: "‹"; font-size: 24px; line-height: 0; margin-top: -2px; }
.rond { width: 42px; height: 42px; border-radius: 50%; background: var(--carte); box-shadow: var(--ombre); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 700; flex: 0 0 auto; }
.rond img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

/* Repères de cadre, comme dans le viseur */
.cadre { position: relative; padding: 18px 18px 16px; }
.cadre::before, .cadre::after, .cadre > .c1, .cadre > .c2 { content: ""; position: absolute; width: 16px; height: 16px; border-color: var(--encre); border-style: solid; }
.cadre::before { top: 0; left: 0; border-width: 2px 0 0 2px; }
.cadre::after { top: 0; right: 0; border-width: 2px 2px 0 0; }
.cadre > .c1 { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.cadre > .c2 { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.carte { display: block; width: 100%; text-align: left; background: var(--carte); border-radius: 20px; padding: 16px 16px 15px; margin-bottom: 10px; box-shadow: var(--ombre); }
.carte .h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.carte .t { font: 700 19px/1.15 var(--titre); }
.carte .m { color: var(--gris); font-size: 13.5px; margin-top: 4px; }
.compteur { font: 700 30px/1 var(--titre); letter-spacing: -0.02em; text-align: right; white-space: nowrap; }
.compteur small { font: 500 15px var(--texte); color: var(--gris); }
.points { display: flex; gap: 3px; margin-top: 14px; }
.points i { flex: 1; height: 6px; border-radius: 2px; background: var(--encre); }
.points i.r { background: var(--rouge); }
.points i.p { background: linear-gradient(90deg, var(--encre) 50%, var(--rouge) 50%); }
.points i.v { background: var(--filet); }
.tally { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--rouge); margin-top: 10px; }
.tally::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rouge); animation: rec 1.6s steps(1) infinite; }
@keyframes rec { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .tally::before { animation: none; } }
.fini { color: var(--gris); font-size: 12.5px; font-weight: 600; margin-top: 10px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border-radius: 16px; font: 700 17px var(--texte); width: 100%; padding: 0 18px; text-decoration: none; }
.btn.plein { background: var(--encre); color: var(--fond); }
.btn.rouge { background: var(--rouge); color: var(--sur-rouge); }
.btn.gris { background: var(--carte-2); color: var(--encre); font-size: 15px; min-height: 50px; }
.btn.lien { color: var(--gris); font-weight: 600; font-size: 15px; min-height: 44px; }
.btn.danger { color: var(--rouge); font-weight: 600; font-size: 15px; min-height: 44px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn + .btn { margin-top: 8px; }
.ligne-btn { display: flex; gap: 8px; }
.ligne-btn .btn + .btn { margin-top: 0; }

.barre { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--fond) 28%); }
.barre > div { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: 1fr 68px 68px; gap: 8px; }
.barre .outil { min-height: 56px; border-radius: 16px; background: var(--carte-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font: 600 12px var(--texte); gap: 2px; }
.barre .outil b { font: 700 16px var(--titre); }
.barre.simple > div { grid-template-columns: 1fr; }

.etiq { display: block; font-size: 13px; color: var(--gris); font-weight: 600; margin: 18px 0 8px; }
.saisie { display: block; width: 100%; background: var(--carte); border: 0; border-radius: 14px; padding: 14px 16px; font-size: 18px; font-weight: 500; outline: none; box-shadow: var(--ombre); }
.saisie:focus { box-shadow: inset 0 0 0 2px var(--encre); caret-color: var(--rouge); }
textarea.saisie { min-height: 150px; resize: vertical; font-size: 17px; line-height: 1.5; }
.saisie.code { font: 700 30px var(--titre); letter-spacing: .12em; text-align: center; text-transform: uppercase; }
.aide { font-size: 13px; color: var(--gris); margin-top: 6px; line-height: 1.4; }
select.saisie { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gris) 50%), linear-gradient(135deg, var(--gris) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }

.seg { display: flex; background: var(--carte); border-radius: 14px; padding: 4px; box-shadow: var(--ombre); }
.seg button { flex: 1; text-align: center; padding: 11px 4px; border-radius: 10px; font-weight: 600; font-size: 14.5px; color: var(--gris); }
.seg button.on { background: var(--encre); color: var(--fond); }

.tuiles { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; }
.tuile { flex: 0 0 142px; background: var(--carte); border-radius: 16px; padding: 14px; min-height: 120px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; box-shadow: var(--ombre); }
.tuile.on { background: var(--encre); color: var(--fond); }
.tuile b { font: 700 18px var(--texte); }
.tuile span { font-size: 12.5px; line-height: 1.3; color: var(--gris); }
.tuile.on span { color: inherit; opacity: .7; }

.grand { font: 700 92px/0.85 var(--titre); letter-spacing: -0.04em; }
.grand small { font: 700 38px var(--titre); color: var(--gris); letter-spacing: -0.02em; }
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; font-weight: 600; font-size: 13px; color: var(--gris); }
.sec.r { color: var(--rouge); }

.pers { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 11px 14px; background: var(--carte); border-radius: 14px; margin-bottom: 6px; box-shadow: var(--ombre); min-height: 58px; }
.pers .n { font-weight: 600; font-size: 15.5px; }
.pers .r { font-size: 12.5px; color: var(--gris); margin-top: 2px; }
.pers .act { font-size: 13px; font-weight: 600; background: var(--rouge); color: var(--sur-rouge); padding: 8px 11px; border-radius: 10px; white-space: nowrap; }
.pers .act.contour { background: transparent; box-shadow: inset 0 0 0 1.5px var(--rouge); color: var(--rouge); }
.pers .ok { font-size: 13px; font-weight: 600; color: var(--gris); white-space: nowrap; }
.pers .ok::before { content: "✓ "; color: var(--encre); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--carte-2); color: var(--encre); margin-left: 6px; vertical-align: 1px; }
.badge.r { background: var(--rouge); color: var(--sur-rouge); }

.groupe { background: var(--carte); border-radius: 16px; overflow: hidden; box-shadow: var(--ombre); }
.champ-l { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border-top: 1px solid var(--filet); font-size: 15px; min-height: 52px; }
.champ-l:first-child { border-top: 0; }
.champ-l span { color: var(--gris); font-size: 13.5px; }
.champ-l b { font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%; }
.champ-l small { display: block; color: var(--gris); font-size: 12.5px; margin-top: 2px; font-weight: 400; }
.interr { width: 46px; height: 28px; border-radius: 14px; background: var(--carte-2); position: relative; flex: 0 0 auto; }
.interr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--gris); transition: left .15s; }
.interr.on { background: var(--encre); }
.interr.on::after { left: 21px; background: var(--fond); }

.case { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; padding: 14px 16px; background: var(--carte); border-radius: 14px; margin-top: 8px; text-align: left; width: 100%; font-size: 15px; line-height: 1.45; box-shadow: var(--ombre); }
.case i { width: 28px; height: 28px; border-radius: 8px; box-shadow: inset 0 0 0 2px var(--gris); display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; }
.case.on i { background: var(--encre); color: var(--fond); box-shadow: none; }
.case.on i::after { content: "✓"; }

.texte-legal { background: var(--papier); color: #1b1a17; border-radius: 16px; padding: 18px 18px 6px; font: 400 15.5px/1.55 Georgia, "Times New Roman", serif; }
.texte-legal p { margin-bottom: 12px; }
.texte-legal .entete { font: 700 13px var(--texte); letter-spacing: .02em; color: #6b675e; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.texte-legal .entete img { height: 30px; width: auto; }

.pave { position: relative; background: #fff; border-radius: 16px; height: 200px; touch-action: none; box-shadow: var(--ombre); }
.pave canvas { width: 100%; height: 100%; display: block; border-radius: 16px; }
.pave .ligne { position: absolute; left: 22px; right: 22px; bottom: 46px; border-bottom: 1.5px dashed #c9c4b6; pointer-events: none; }
.pave .x { position: absolute; left: 22px; bottom: 50px; color: #b2ac9c; font: 700 18px var(--titre); pointer-events: none; }
.pave .eff { position: absolute; right: 10px; top: 8px; color: #6b675e; font-size: 13px; font-weight: 600; padding: 6px 8px; }

.qr { background: #fff; border-radius: 22px; padding: 18px; width: min(320px, 82vw); margin: 18px auto 10px; }
.qr svg { display: block; width: 100%; height: auto; }
.url { font-size: 12.5px; color: var(--gris); text-align: center; word-break: break-all; margin-top: 8px; }

.note { font-size: 13.5px; color: var(--gris); margin-top: 14px; line-height: 1.5; }
.note u { color: var(--encre); text-underline-offset: 3px; }
.vide { text-align: center; padding: 36px 10px; color: var(--gris); }
.vide b { display: block; color: var(--encre); font: 700 22px var(--titre); margin-bottom: 6px; }
.erreur-bloc { background: var(--carte); border-radius: 16px; padding: 18px; box-shadow: inset 0 0 0 1.5px var(--rouge); }

.feuille-fond { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.feuille { background: var(--fond); width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; }
.feuille::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--filet); margin: 0 auto 14px; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--encre); color: var(--fond); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; z-index: 40; max-width: calc(100% - 40px); text-align: center; }
.toast.erreur { background: var(--rouge); color: var(--sur-rouge); }
.chargement { display: flex; justify-content: center; padding: 60px 0; }
.chargement i { width: 10px; height: 10px; border-radius: 50%; background: var(--rouge); animation: rec 1s steps(1) infinite; }

.histo { padding: 12px 0; border-top: 1px solid var(--filet); display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 14.5px; }
.histo small { display: block; color: var(--gris); font-size: 12.5px; margin-top: 2px; }
.histo .annule { text-decoration: line-through; color: var(--gris); }
.histo button { font-size: 13px; font-weight: 600; color: var(--rouge); padding: 8px 4px; }
.support { color: var(--rouge); font-weight: 600; }

.bandeau-support { background: var(--rouge); color: var(--sur-rouge); font-weight: 600; font-size: 13.5px; text-align: center; padding: 8px 12px; }
.bandeau-support button { text-decoration: underline; font-weight: 700; margin-left: 6px; }

/* Compléments : liens en cartes, interrupteurs à gauche, lignes de champs */
a.carte, a.champ-l, a.btn { text-decoration: none; color: inherit; }
a.btn.plein { color: var(--fond); }
.champ-l b.libre { text-align: left; max-width: none; white-space: normal; font-weight: 600; }
.champ-l > div { min-width: 0; }
.ligne-btn > * { flex: 1; min-width: 0; }
details.note summary { cursor: pointer; list-style: none; padding: 6px 0; }
details.note summary::-webkit-details-marker { display: none; }
details.note[open] summary { margin-bottom: 4px; }
.feuille .btn + .ligne-btn, .feuille .ligne-btn + .btn { margin-top: 8px; }

/* Page de confidentialité (statique) */
.page-legale { max-width: 640px; margin: 0 auto; padding: 14px 20px 60px; }
.page-legale p { margin: 0 0 12px; line-height: 1.55; }
.page-legale h1 { margin: 6px 0 4px; }
.page-legale > .sous { margin-bottom: 18px; }
.page-legale a:not(.retour) { color: var(--encre); }
