:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --ink: #16201c;
  --ink-2: #4a5550;
  --ink-3: #848d88;
  --line: #e2e5df;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0eb;
  --warn: #a5650b;  --warn-soft: #fbf0dc;
  --danger: #b3261e; --danger-soft: #fbe5e3;
  --info: #2f55a4;  --info-soft: #e6ecf8;
  --ok: #1f6f5c;    --ok-soft: #e3f0eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22,32,28,.04), 0 8px 24px rgba(22,32,28,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412; --surface: #171d1a; --surface-2: #1d2420;
    --ink: #eef1ee; --ink-2: #b4bdb8; --ink-3: #7c8781; --line: #29312d;
    --accent: #4fbf9f; --accent-ink: #0b1a14; --accent-soft: #1b3129;
    --warn: #e8a94a; --warn-soft: #33281a; --danger: #f07a70; --danger-soft: #3a1f1d;
    --info: #86a6ea; --info-soft: #1d2638; --ok: #4fbf9f; --ok-soft: #1b3129;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- Champs ---------- */
label { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; border-radius: 10px; padding: 11px 18px; cursor: pointer;
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink);
  transition: transform .05s, opacity .15s, background .15s; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.warn { background: var(--warn); color: #fff; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }

.alert { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.en_attente { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.badge.soumis { background: var(--info-soft); color: var(--info); }
.badge.a_completer { background: var(--warn-soft); color: var(--warn); }
.badge.approuve { background: var(--ok-soft); color: var(--ok); }
.badge.rejete { background: var(--danger-soft); color: var(--danger); }
.badge.expire { background: var(--surface-2); color: var(--danger); border: 1px solid var(--line); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Page client ---------- */
.client-wrap { max-width: 680px; margin: 0 auto; padding: 28px 16px 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; margin-bottom: 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
}
.hero h1 { font-size: 26px; margin-bottom: 6px; }
.hero p { color: var(--ink-2); margin: 0 0 22px; }

.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps .s { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.steps .s.on { background: var(--accent); }
.step-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 4px; }

.section { padding: 24px; margin-bottom: 16px; }
.section h2 { font-size: 19px; margin-bottom: 4px; }
.section > p.muted { margin: 0 0 20px; font-size: 14px; }

.doc-types { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.doc-type { position: relative; display: block; margin: 0; }
.doc-type input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
html, body { overflow-x: hidden; }
.doc-type span {
  display: block; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-weight: 600; font-size: 14px; cursor: pointer; transition: all .15s; background: var(--surface);
}
.doc-type input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.doc-type input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .uploads { grid-template-columns: 1fr; } }
.drop {
  position: relative; border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px 14px;
  text-align: center; cursor: pointer; background: var(--surface-2); min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: border-color .15s, background .15s; overflow: hidden;
}
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ico { width: 34px; height: 34px; color: var(--accent); }
.drop strong { font-size: 14px; }
.drop .hint { font-size: 12px; color: var(--ink-3); }
.drop.filled { border-style: solid; border-color: var(--accent); padding: 0; }
.drop.filled img { width: 100%; height: 150px; object-fit: cover; display: block; }
.drop .fname {
  position: absolute; left: 0; right: 0; bottom: 0; background: rgba(15,20,18,.72); color: #fff;
  font-size: 12px; padding: 6px 10px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drop .pdf { font-weight: 800; color: var(--accent); font-size: 22px; padding: 40px 0; }
.drop.full { grid-column: 1 / -1; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }

.nav-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }

.done { text-align: center; padding: 48px 24px; }
.done .big-ico {
  width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin: 0 auto 18px;
}
.done h2 { font-size: 22px; margin-bottom: 8px; }
.done p { color: var(--ink-2); margin: 0; }

.secure-note { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--ink-3); font-size: 12px; margin-top: 18px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 30px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card p { margin: 0 0 22px; }

/* ---------- Admin ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; gap: 12px;
}
.topbar .brand { margin: 0; }
.topbar .actions { display: flex; gap: 8px; }
.admin-main { max-width: 1240px; margin: 0 auto; padding: 24px; }
@media (max-width: 640px) { .admin-main { padding: 16px; } .topbar { padding: 12px 16px; } }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 16px 18px; cursor: pointer; transition: border-color .15s; text-align: left; font: inherit; color: inherit; }
.stat:hover, .stat.active { border-color: var(--accent); }
.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--ink-3); font-weight: 600; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar input { max-width: 340px; }

.table-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .06em; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tr.unseen td:first-child { box-shadow: inset 3px 0 0 var(--info); }
.who strong { display: block; }
.who span { font-size: 13px; color: var(--ink-3); }
.empty { padding: 50px 20px; text-align: center; color: var(--ink-3); }
@media (max-width: 720px) { .hide-sm { display: none; } }

/* Modale / panneau */
.overlay { position: fixed; inset: 0; background: rgba(10,14,12,.45); z-index: 40; display: flex; justify-content: flex-end; }
.overlay.center { align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 460px; padding: 26px; }
.modal h2 { font-size: 20px; margin-bottom: 18px; }
.drawer {
  width: 100%; max-width: 760px; height: 100%; background: var(--bg); overflow-y: auto;
  box-shadow: -20px 0 40px rgba(0,0,0,.15); animation: slide .2s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 16px 22px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.drawer-body { padding: 22px; }
.drawer .block { padding: 20px; margin-bottom: 14px; }
.drawer .block h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } }
.kv div span { display: block; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.kv div strong { font-weight: 600; word-break: break-word; }
.docs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .docs { grid-template-columns: 1fr; } }
.doc { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.doc .thumb { position: relative; height: 170px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); cursor: zoom-in; }
.doc .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.doc .thumb .pdf { font-weight: 800; color: var(--accent); font-size: 24px; }
.doc .cap { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; font-size: 13px; font-weight: 600; background: var(--surface); }
.link-box { display: flex; gap: 8px; }
.link-box input { font-size: 13px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; font-size: 13px; padding: 6px 0; }
.timeline li time { color: var(--ink-3); min-width: 130px; font-variant-numeric: tabular-nums; }
.decision-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 60; display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); animation: pop .2s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Choix de la pièce (3 options) ---------- */
.doc-types.three { grid-template-columns: repeat(3, 1fr); }
.doc-types.three .doc-type span { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 16px 8px; }
.doc-types.three .doc-type svg { width: 30px; height: 30px; }
@media (max-width: 420px) { .doc-types.three .doc-type span { font-size: 13px; padding: 14px 4px; } }

.tips { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }

/* ---------- Emplacement de document ---------- */
.slot-list { display: grid; gap: 12px; }
.slot {
  display: flex; gap: 14px; align-items: center; padding: 12px; border: 1.5px dashed var(--line);
  border-radius: 12px; background: var(--surface-2); transition: border-color .15s, background .15s;
}
.slot.filled, .slot.received { border-style: solid; border-color: var(--accent); background: var(--surface); }
.slot.missing { border-color: var(--danger); background: var(--danger-soft); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.slot-preview {
  flex: none; width: 92px; height: 68px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; color: var(--ink-3);
}
.slot-preview svg { width: 30px; height: 30px; }
.slot-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot-preview .pdf { font-weight: 800; color: var(--accent); }
.slot.received .slot-preview { color: var(--accent); background: var(--accent-soft); }
.slot-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.slot-title { font-size: 14px; }
.slot-hint { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.filled .slot-hint, .slot.received .slot-hint { color: var(--accent); }
.slot-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.slot-actions .btn svg { width: 15px; height: 15px; }
@media (max-width: 420px) { .slot { align-items: flex-start; } .slot-preview { width: 70px; height: 56px; } }

/* ---------- Admin : documents demandés ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip.on::before { content: '✓ '; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; }
.req-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.req-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: var(--surface);
}
.req-list li .x { border: none; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.req-list li .x:hover { color: var(--danger); background: var(--danger-soft); }
.doc .thumb.pending { cursor: default; color: var(--ink-3); font-size: 13px; font-weight: 600; flex-direction: column; gap: 6px; display: flex; align-items: center; justify-content: center; border-bottom: 1px dashed var(--line); }
.doc .thumb.pending svg { width: 26px; height: 26px; }
.doc .cap .x { border: none; background: none; color: var(--ink-3); cursor: pointer; font-size: 12px; font-weight: 600; padding: 0; }
.doc .cap .x:hover { color: var(--danger); }
.doc .cap .acts { display: flex; gap: 12px; align-items: center; }
.modal { max-height: calc(100vh - 32px); overflow-y: auto; }

/* =========================================================
   THÈME DES PAGES CLIENT — couleurs de la marque
   Bleu marine #00008f · Rouge #ff1721 · Fond #f9ffd4 · Lavande #f5f5fb
   (toujours en clair, pour respecter les couleurs)
   ========================================================= */
body.client {
  color-scheme: light;
  --bg: #f9ffd4;
  --surface: #ffffff;
  --surface-2: #f5f5fb;
  --ink: #0d0d3b;
  --ink-2: #3f3f6b;
  --ink-3: #75759a;
  --line: #e1e1ef;
  --accent: #00008f;
  --accent-ink: #ffffff;
  --accent-soft: #e9e9f6;
  --brand-red: #ff1721;
  --danger: #ff1721; --danger-soft: #ffe5e6;
  --warn: #a5650b;   --warn-soft: #fdf2dc;
  --ok: #00008f;     --ok-soft: #e9e9f6;
  --shadow: 0 1px 2px rgba(0,0,143,.05), 0 10px 28px rgba(0,0,143,.07);
  background: var(--bg);
  color: var(--ink);
}
body.client .brand-mark {
  background: #fff; color: var(--brand-red);
  border: 2px solid var(--brand-red); border-radius: 50%;
}
body.client .step-label { color: var(--brand-red); }
body.client .steps .s { background: var(--accent-soft); height: 6px; border-radius: 6px; }
body.client .steps .s.on { background: var(--accent); }
body.client .btn { border-radius: 999px; }
body.client .btn.ghost { border-color: #cfd0ea; color: var(--accent); background: #fff; }
body.client .btn.ghost:hover { background: var(--surface-2); }
body.client .card { border-color: #ececf6; }
body.client input:focus, body.client select:focus, body.client textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,0,143,.12); }
body.client .doc-type input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
body.client .check input { accent-color: var(--accent); }
body.client .slot { background: var(--surface-2); border-color: #d6d7ec; }
body.client .slot.filled, body.client .slot.received { background: #fff; border-color: var(--accent); }
body.client .slot.missing { border-color: var(--brand-red); background: var(--danger-soft); }
body.client .tips { background: #fff; border-left: 3px solid var(--brand-red); }
body.client .done .big-ico { background: var(--accent-soft); color: var(--accent); }
body.client .alert.error { background: var(--danger-soft); color: #a3233b; }

/* ---------- Passage sur téléphone (QR code) ---------- */
.handoff { display: flex; gap: 26px; align-items: center; padding: 26px; margin-bottom: 16px; }
.handoff-qr { flex: none; width: 200px; height: 200px; background: #fff; border-radius: 14px; padding: 8px; border: 1px solid var(--line); }
.handoff-qr svg { width: 100%; height: 100%; display: block; }
.handoff-qr svg rect[fill="black"], .handoff-qr svg path { fill: #00008f; }
.handoff-text h2 { font-size: 21px; margin-bottom: 6px; }
.handoff-text p { margin: 0 0 12px; font-size: 14px; }
.handoff-steps { margin: 0 0 18px; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.handoff-steps li { margin-bottom: 3px; }
@media (max-width: 600px) { .handoff { flex-direction: column; text-align: center; } .handoff-steps { text-align: left; } }

.received-box { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 10px 12px; border-radius: 10px; }

/* ---------- Admin : lien documents manquants ---------- */
.badge.docs_manquants { background: var(--danger-soft); color: var(--danger); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.missing-card { border-color: var(--danger) !important; }

/* =========================================================
   PAGES CLIENT — AFFICHAGE MOBILE
   ========================================================= */
body.client { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body.client button, body.client .btn, body.client label { touch-action: manipulation; }
body.client .client-wrap {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}
body.client .slot-list > * { min-width: 0; }
body.client .hero h1 { overflow-wrap: anywhere; }

/* Cases à cocher : grande zone de toucher */
body.client .check {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  align-items: flex-start; line-height: 1.45;
}
body.client .check input { width: 22px; height: 22px; margin: 0; }
body.client .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

@media (max-width: 560px) {
  body.client { font-size: 15px; }
  body.client .client-wrap { padding-top: 18px; }
  body.client .brand { margin-bottom: 18px; font-size: 14px; }
  body.client .hero h1 { font-size: clamp(21px, 6.2vw, 25px); line-height: 1.2; margin-bottom: 8px; }
  body.client .hero p { font-size: 14.5px; margin-bottom: 18px; }
  body.client .steps { margin-bottom: 14px; }
  body.client .section { padding: 20px 16px 0; border-radius: 18px; }
  body.client .section h2 { font-size: 18px; }
  body.client .section > p.muted { margin-bottom: 16px; }
  body.client .tips { font-size: 13px; padding: 10px 12px; }

  /* Choix de la pièce : grandes lignes empilées */
  body.client .doc-types.three { grid-template-columns: 1fr; gap: 8px; }
  body.client .doc-types.three .doc-type span {
    flex-direction: row; justify-content: flex-start; text-align: left; gap: 14px;
    padding: 0 16px; min-height: 56px; font-size: 15px; position: relative; border-radius: 14px;
  }
  body.client .doc-types.three .doc-type svg { width: 26px; height: 26px; flex: none; }
  body.client .doc-types.three .doc-type span::after {
    content: ''; margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid #c9cae3; flex: none; box-sizing: border-box;
  }
  body.client .doc-types.three .doc-type input:checked + span::after {
    border: 6px solid var(--accent); background: #fff;
  }

  /* Emplacement photo : vignette + titre, puis 2 gros boutons pleine largeur */
  body.client .slot {
    display: grid; grid-template-columns: 76px 1fr; column-gap: 12px; row-gap: 2px;
    align-items: center; padding: 12px; border-radius: 14px;
  }
  body.client .slot-body { display: contents; }
  body.client .slot-preview { grid-row: 1 / span 2; width: 76px; height: 56px; }
  body.client .slot-title { grid-column: 2; align-self: end; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
  body.client .slot-hint { grid-column: 2; align-self: start; }
  body.client .slot-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  body.client .slot-actions:has(> :only-child) { grid-template-columns: 1fr; }
  body.client .slot-actions .btn { min-height: 48px; padding: 0 10px; font-size: 14px; white-space: normal; line-height: 1.2; }
  body.client .slot.filled .slot-preview { width: 76px; height: 56px; }

  body.client .slot-list { gap: 10px; }
  body.client #selfie-title { font-size: 18px; }

  /* Barre d'action fixée en bas de l'écran */
  body.client .nav-row {
    position: sticky; bottom: 0; z-index: 5;
    margin: 18px -16px 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--line); border-radius: 0 0 18px 18px;
  }
  body.client .nav-row > span:empty { display: none; }
  body.client .nav-row .btn { min-height: 50px; font-size: 16px; white-space: normal; }
  body.client .nav-row .btn:not(.ghost) { flex: 1; }
  body.client .nav-row .btn.ghost { flex: none; padding: 0 16px; }

  body.client #error { margin: 14px 0 0; }
  body.client .done { padding: 36px 20px; }
  body.client .done h2 { font-size: 20px; }
  body.client .secure-note { margin-top: 16px; padding: 0 8px; text-align: center; line-height: 1.4; }

  /* Page documents manquants */
  body.client #submit.block { min-height: 52px; font-size: 16px; margin-bottom: 18px; }
  body.client .section #submit.block { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); box-shadow: 0 6px 20px rgba(0,0,143,.25); }
}

/* Très petits écrans (320 px) */
@media (max-width: 360px) {
  body.client .client-wrap { padding-left: 12px; padding-right: 12px; }
  body.client .section { padding: 18px 14px 0; }
  body.client .nav-row { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  body.client .slot { grid-template-columns: 64px 1fr; }
  body.client .slot-preview, body.client .slot.filled .slot-preview { width: 64px; height: 48px; }
  body.client .slot-actions .btn svg { display: none; }
}

/* Paysage sur téléphone : moins d'espace vertical perdu */
@media (max-height: 500px) and (orientation: landscape) {
  body.client .client-wrap { padding-top: 12px; }
  body.client .hero h1 { font-size: 22px; }
  body.client .nav-row { position: static; }
}

/* Écrans tactiles (y compris paysage et tablettes) : boutons assez grands pour le doigt */
html.touch body.client .slot-actions .btn { min-height: 46px; padding-left: 16px; padding-right: 16px; }
html.touch body.client .nav-row .btn, html.touch body.client #submit { min-height: 50px; }
html.touch body.client .btn.ghost.sm { min-height: 44px; }

@media (max-width: 560px) {
  body.client .slot-actions .btn { white-space: nowrap; }
  body.client .nav-row .btn { font-size: 15.5px; padding: 0 14px; }
  body.client .nav-row .btn:not(.ghost) { white-space: nowrap; }
}
@media (max-width: 360px) {
  body.client .nav-row .btn:not(.ghost) { white-space: normal; }
  body.client .slot-actions .btn { font-size: 13.5px; padding: 0 6px; }
}

/* ---------- Caméra intégrée (selfie) ---------- */
.cam-overlay {
  position: fixed; inset: 0; z-index: 100; background: #0b0b23;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.cam-stage { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; }
.cam-video { width: 100%; height: 100%; object-fit: cover; background: #0b0b23; }
.cam-video.mirror { transform: scaleX(-1); }
.cam-frame {
  position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%);
  width: min(70vw, 260px); height: min(88vw, 330px);
  border: 3px solid rgba(255,255,255,.9); border-radius: 50% / 42%;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none;
}
.cam-status { position: absolute; color: #fff; font-size: 15px; font-weight: 600; }
.cam-hint { color: #fff; text-align: center; font-size: 14px; padding: 12px 20px 0; }
.cam-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px calc(18px + env(safe-area-inset-bottom)); gap: 16px;
}
.cam-shutter {
  width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: transparent;
  cursor: pointer; flex: none; padding: 0; display: grid; place-items: center;
}
.cam-shutter span { width: 56px; height: 56px; border-radius: 50%; background: #fff; display: block; transition: transform .1s; }
.cam-shutter:active span { transform: scale(.88); }
.cam-side {
  min-width: 72px; min-height: 44px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; border: none; font: inherit; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.cam-side svg { width: 22px; height: 22px; }
.cam-flip { padding: 0; }

/* ---------- Admin : client en ligne (suivi en direct) ---------- */
.live {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 12px; font-weight: 700; color: #1f8f46; white-space: normal;
}
.live::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex: none;
  box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.8s infinite;
}
tr .live { display: flex; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.alert.live-banner {
  display: flex; align-items: center; gap: 10px; background: #e7f8ee; color: #15703a;
  font-weight: 600; border: 1px solid #b7e6c8;
}
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #22c55e; flex: none;
  box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.8s infinite;
}
@media (prefers-color-scheme: dark) {
  .alert.live-banner { background: #10301d; color: #6ee7a0; border-color: #1c4f30; }
  .live { color: #6ee7a0; }
}

/* ---------- Super admin (panneau caché) ---------- */
.super-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.super-stats > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 8px; text-align: center; }
.super-stats b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.super-stats span { font-size: 12px; color: var(--ink-3); }
@media (max-width: 560px) { .super-stats { grid-template-columns: repeat(2, 1fr); } }
.super-log { max-height: 50vh; overflow-y: auto; }
.super-log li { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.super-log li:last-child { border-bottom: none; }
.super-log time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
#super-btn { border-color: var(--accent); color: var(--accent); }
@media (max-width: 560px) { .super-log li { grid-template-columns: 1fr auto; } .super-log time { grid-column: 1 / -1; } }
