/* ===========================================================================
   Maquettiste Adhésif — habillage épuré, inspiré des interfaces Apple.

   Principes tenus d'un bout à l'autre :
   - l'AIR d'abord : on espace au lieu d'encadrer ; presque plus de bordures ;
   - la HIÉRARCHIE par la taille et la couleur du texte, pas par des traits ;
   - des GROUPES arrondis façon Réglages iOS, posés sur un fond gris doux ;
   - des BOUTONS en gélule, une seule couleur d'accent, employée avec parcimonie ;
   - des ombres très basses, jamais de contour marqué.

   Aucune police distante : la connexion de l'atelier est lente et l'app doit
   s'ouvrir hors ligne. San Francisco est déjà là sur Mac.
   =========================================================================== */

:root {
  --bg:        #f5f5f7;   /* le gris clair caractéristique */
  --surface:   #ffffff;
  --surface-2: #f0f0f3;
  --champ:     #f5f5f7;

  --bord:      rgba(0,0,0,.07);
  --bord-fort: rgba(0,0,0,.13);
  --separateur: rgba(0,0,0,.055);

  --texte:  #1d1d1f;
  --doux:   #6e6e73;
  --tenu:   #707075;

  --accent:      #d2006e;
  --accent-fort: #b00059;
  --accent-doux: #fdeaf3;
  --sur-accent:  #ffffff;

  --ok:   #147e5f;  --ok-doux:   #e7f6ef;
  --warn: #9a6300;  --warn-doux: #fdf2e2;
  --ko:   #c42121;  --ko-doux:   #fdeceb;

  --r-groupe: 18px;
  --r-carte:  14px;
  --r-champ:  11px;
  --r-gelule: 980px;

  --ombre-1: 0 1px 2px rgba(0,0,0,.04);
  --ombre-2: 0 2px 6px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.06);
  --t: .22s cubic-bezier(.32,.72,.34,1);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #000000;
    --surface:   #1c1c1e;
    --surface-2: #2c2c2e;
    --champ:     #2c2c2e;

    --bord:      rgba(255,255,255,.09);
    --bord-fort: rgba(255,255,255,.18);
    --separateur: rgba(255,255,255,.08);

    --texte: #f5f5f7;
    --doux:  #a1a1a6;
    --tenu:  #8e8e93;

    --accent:      #ff5fa8;
    --accent-fort: #ff8bc2;
    --accent-doux: #331020;
    --sur-accent:  #1a0710;

    --ok:   #3ddc9a;  --ok-doux:   #0f2a20;
    --warn: #f0b23f;  --warn-doux: #2e2412;
    --ko:   #ff8080;  --ko-doux:   #331616;

    --ombre-1: 0 1px 2px rgba(0,0,0,.5);
    --ombre-2: 0 2px 6px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; background: var(--bg); color: var(--texte);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
        system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.006em;
  font-feature-settings: "tnum" 1;
}
.hidden { display: none !important; }
.muted { color: var(--doux); }
::selection { background: var(--accent-doux); color: var(--accent-fort); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- colonne d'étapes ---------- */
.rail {
  width: 250px; flex: 0 0 250px; background: transparent;
  display: flex; flex-direction: column; padding: 26px 14px 20px; gap: 30px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px; }
.brand .dot {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px;
  background: var(--accent);
}
.brand b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.brand small { color: var(--tenu); font-size: 12px; }

.stepper { display: flex; flex-direction: column; gap: 2px; }
.step {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border-radius: var(--r-champ); background: none; border: 0; text-align: left;
  cursor: pointer; color: var(--doux); font: inherit; font-size: 14px;
  letter-spacing: -.01em; transition: background var(--t), color var(--t);
}
.step:hover:not(.locked) { background: var(--surface-2); color: var(--texte); }
.step .num {
  width: 25px; height: 25px; flex: 0 0 25px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2);
  color: var(--doux); font-size: 12px; font-weight: 600; transition: all var(--t);
}
.step.on { background: var(--surface); color: var(--texte); font-weight: 600; box-shadow: var(--ombre-1); }
.step.on .num { background: var(--accent); color: var(--sur-accent); }
.step.done .num { background: var(--ok-doux); color: var(--ok); }
.step.locked { opacity: .35; cursor: default; }
.step .lbl { flex: 1; }
.step .etat { font-size: 12px; color: var(--tenu); font-weight: 400; }

.rail-foot { margin-top: auto; }
.rail-projet {
  font-size: 13px; padding: 12px 14px; border-radius: var(--r-carte);
  background: var(--surface); color: var(--doux); box-shadow: var(--ombre-1);
}
.rail-projet b { color: var(--texte); display: block; font-weight: 600; }

/* ---------- scène ---------- */
.stage { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.stage-head { padding: 34px 40px 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.stage-head h1 { margin: 0 0 4px; font-size: 30px; line-height: 1.15; letter-spacing: -.028em; font-weight: 600; }
.stage-head p { margin: 0; font-size: 15px; color: var(--doux); }
.stage-body { flex: 1; overflow-y: auto; padding: 0 40px 48px; }
.panel { max-width: 760px; display: flex; flex-direction: column; gap: 26px; animation: entree .3s ease both; }
@keyframes entree { from { opacity: 0; transform: translateY(8px); } }

.stage-foot {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--separateur);
  padding: 15px 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.stage-foot .muted { font-size: 13px; color: var(--tenu); }

/* ---------- champs, groupés façon Réglages ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--doux); letter-spacing: -.005em; }
.field-btn { justify-content: flex-end; }
.hint { font-size: 13px; color: var(--tenu); line-height: 1.5; }
.opt-tag { font-weight: 400; color: var(--tenu); font-size: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }

input, select, textarea {
  font: inherit; font-size: 15px; color: var(--texte); background: var(--champ);
  border: 1px solid transparent; border-radius: var(--r-champ);
  padding: 11px 13px; width: 100%;
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}
input::placeholder, textarea::placeholder { color: var(--tenu); }
input:hover, select:hover, textarea:hover { background: var(--surface-2); }
input:focus, select:focus, textarea:focus {
  outline: none; background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-doux);
}
textarea { resize: vertical; line-height: 1.6; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- boutons en gélule ---------- */
button {
  font: inherit; font-weight: 500; font-size: 14px; letter-spacing: -.01em;
  border: 1px solid transparent; border-radius: var(--r-gelule);
  padding: 10px 20px; cursor: pointer; background: var(--surface-2); color: var(--texte);
  transition: background var(--t), color var(--t), box-shadow var(--t), transform var(--t), opacity var(--t);
}
button:hover { opacity: .82; }
button:active { transform: scale(.97); opacity: 1; }
button.primary { background: var(--accent); color: var(--sur-accent); font-weight: 600; }
button.primary:hover { background: var(--accent-fort); opacity: 1; }
button.ghost { background: var(--surface); box-shadow: var(--ombre-1); }
button.ghost:hover { background: var(--surface-2); opacity: 1; }
button:disabled { opacity: .35; cursor: default; transform: none; }

.tools { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.chip { padding: 7px 15px; font-size: 13px; background: var(--surface-2); border-radius: var(--r-gelule); }
.chip.on { background: var(--accent); color: var(--sur-accent); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--doux); }
.check input { width: auto; accent-color: var(--accent); }

/* ---------- choix en cartes ---------- */
.choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.opt {
  text-align: left; padding: 16px 18px; border: 0; background: var(--surface);
  border-radius: var(--r-carte); box-shadow: var(--ombre-1);
  display: flex; flex-direction: column; gap: 5px;
}
.opt b { font-size: 15px; font-weight: 600; letter-spacing: -.012em; }
.opt small { color: var(--doux); font-weight: 400; font-size: 13px; line-height: 1.5; }
.opt:hover { opacity: 1; box-shadow: var(--ombre-2); }
.opt.on { background: var(--accent); }
.opt.on b, .opt.on small { color: var(--sur-accent); }
.opt.on small { opacity: .82; }

/* ---------- dépôt de fichier ---------- */
.drop {
  border: 1.5px dashed var(--bord-fort); border-radius: var(--r-carte); padding: 36px 22px;
  text-align: center; color: var(--doux); cursor: pointer; background: var(--surface);
  font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 11px;
  transition: all var(--t);
}
.drop.mini { padding: 18px; flex-direction: row; justify-content: center; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-doux); }
.drop .ico { width: 27px; height: 27px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.apercu { max-width: 100%; border-radius: var(--r-carte); display: block; box-shadow: var(--ombre-1); }

.canvas-box { background: var(--surface); border-radius: var(--r-carte); padding: 12px; overflow: auto; box-shadow: var(--ombre-1); }
canvas { display: block; max-width: 100%; border-radius: var(--r-champ); cursor: crosshair; }
canvas.survol { cursor: grab; }
canvas.saisi  { cursor: grabbing; }

.note {
  margin: 0; font-size: 14px; color: var(--doux); background: var(--surface);
  border: 0; border-radius: var(--r-carte); padding: 14px 17px; line-height: 1.55;
  box-shadow: var(--ombre-1);
}
.note b { color: var(--texte); font-weight: 600; }

/* ---------- références ---------- */
.refs { display: flex; gap: 11px; flex-wrap: wrap; }
.ref {
  position: relative; width: 100px; padding: 8px; border: 0; border-radius: var(--r-carte);
  background: var(--surface); cursor: pointer; text-align: center;
  box-shadow: var(--ombre-1); transition: all var(--t);
}
.ref.on { background: var(--accent); }
.ref.on span { color: var(--sur-accent); }
.ref img { width: 100%; height: 56px; object-fit: contain; }
.ref span { display: block; font-size: 11px; color: var(--tenu); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref .x {
  position: absolute; top: -6px; right: -6px; width: 21px; height: 21px; padding: 0;
  border-radius: 50%; background: var(--tenu); color: #fff; font-size: 13px;
  line-height: 1; display: grid; place-items: center; box-shadow: var(--ombre-1);
}
.checks { display: flex; flex-wrap: wrap; gap: 9px; }
.checks .check { background: var(--surface); border-radius: var(--r-gelule); padding: 9px 15px; cursor: pointer; box-shadow: var(--ombre-1); }

/* ---------- cartes ---------- */
.props, .hist, .surfs, .projets { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 16px; }
.props:empty, .hist:empty, .surfs:empty, .projets:empty { display: none; }
.card2, .projet {
  border: 0; border-radius: var(--r-carte); background: var(--surface);
  overflow: hidden; display: flex; flex-direction: column; padding: 0; text-align: left;
  box-shadow: var(--ombre-1); transition: all var(--t);
}
.card2:hover, .projet:hover { box-shadow: var(--ombre-2); transform: translateY(-3px); opacity: 1; }
.card2.val { box-shadow: 0 0 0 2px var(--ok), var(--ombre-1); }
.card2.sel { box-shadow: 0 0 0 2px var(--accent), var(--ombre-1); }
.card2 img, .projet img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--surface-2); display: block; }
.card2 .corps, .projet .corps { padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card2 .titre, .projet .titre { font-size: 14px; font-weight: 600; letter-spacing: -.012em; }
.card2 small, .projet small { font-size: 12.5px; color: var(--doux); line-height: 1.45; }
.card2 .actions { display: flex; gap: 7px; padding: 0 14px 14px; }
.card2 .actions button { flex: 1; padding: 8px 10px; font-size: 13px; }
.card2.err { box-shadow: 0 0 0 2px var(--ko), var(--ombre-1); }
.card2.err .corps { color: var(--ko); }
.projet .vide { aspect-ratio: 4/3; display: grid; place-items: center; background: var(--surface-2); color: var(--tenu); font-size: 12.5px; }
.tag { font-size: 12px; font-weight: 600; }
.tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); } .tag.ko { color: var(--ko); }

/* ---------- messages de l'assistant ---------- */
.constats { display: grid; gap: 10px; }
.constats:not(:empty) { margin-top: 10px; }
.constat {
  display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r-carte);
  border: 0; background: var(--surface); box-shadow: var(--ombre-1);
}
.constat b { font-weight: 600; font-size: 14px; letter-spacing: -.012em; }
.constat small { color: var(--doux); line-height: 1.55; font-size: 13px; }
.constat.ok     { background: var(--ok-doux); }
.constat.info   { background: var(--surface); }
.constat.avert  { background: var(--warn-doux); }
.constat.bloque { background: var(--ko-doux); }

.options { display: grid; gap: 8px; margin-top: 10px; }
.option { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--r-champ); background: var(--surface); }
.option > b { font-size: 13.5px; font-weight: 600; }
.option small { color: var(--doux); font-size: 12.5px; }
.cout { display: inline-block; padding: 2px 9px; border-radius: var(--r-gelule); font-size: 11.5px; font-weight: 600; background: var(--accent-doux); color: var(--accent-fort); }

/* ---------- livrables ---------- */
.livrables { padding: 8px; border-radius: var(--r-groupe); background: var(--surface); box-shadow: var(--ombre-1); }
.livrables b { display: block; padding: 8px 12px 10px; font-size: 13px; color: var(--doux); font-weight: 600; }
.livrable {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 14px; border-radius: var(--r-champ); text-decoration: none;
  color: var(--texte); transition: background var(--t);
}
.livrable + .livrable { box-shadow: inset 0 1px 0 var(--separateur); }
.livrable::after { content: "↓"; color: var(--accent); font-weight: 600; font-size: 16px; }
.livrable:hover { background: var(--surface-2); }
.livrable .nom { font-weight: 500; font-size: 14px; flex: 1; }
.livrable small { color: var(--tenu); font-size: 12.5px; }

/* ---------- générations précédentes ---------- */
.runs { display: grid; gap: 14px; }
.run { border-radius: var(--r-groupe); background: var(--surface); overflow: hidden; box-shadow: var(--ombre-1); }
.run-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 13px 16px 0; }
.run-tete b { font-size: 14px; font-weight: 600; }
.run-tete small { color: var(--tenu); font-size: 12.5px; }
.run-brief { flex: 1 0 100%; color: var(--doux); font-size: 12.5px; font-style: italic; margin-top: 2px; }
.run-corps { display: flex; gap: 12px; flex-wrap: wrap; padding: 14px 16px 16px; }
.vignette {
  display: grid; gap: 7px; padding: 0; width: 150px; cursor: pointer; background: none;
  border: 0; border-radius: var(--r-champ); font: inherit; color: var(--texte);
}
.vignette img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--r-champ); display: block; box-shadow: var(--ombre-1); }
.vignette span { font-size: 12.5px; color: var(--doux); text-align: left; }
.vignette:hover { opacity: 1; transform: translateY(-3px); }
.vignette:hover img { box-shadow: var(--ombre-2); }

/* ---------- plan de découpe ---------- */
.schema:empty { display: none; }
.schema { padding: 20px; border-radius: var(--r-groupe); background: var(--surface); box-shadow: var(--ombre-1); }
.plan { width: 100%; height: auto; display: block; overflow: visible; }
.plan .vitre { fill: var(--surface-2); stroke: none; }
.plan .montant { fill: var(--tenu); opacity: .22; }
.plan .recouvrement { fill: var(--texte); opacity: .1; }
.plan .num  { font: 600 15px -apple-system, system-ui, sans-serif; fill: var(--accent); }
.plan .cote { font: 400 11px -apple-system, system-ui, sans-serif; fill: var(--tenu); }
.plan .cote-vitre { font: 500 11px -apple-system, system-ui, sans-serif; fill: var(--tenu); }
.plan .cote-totale { font: 500 12px -apple-system, system-ui, sans-serif; fill: var(--doux); }
.plan .ligne-cote { stroke: var(--bord-fort); stroke-width: 1; }
.plan .le { transition: opacity var(--t); }
.plan:hover .le { opacity: .3; }
.plan .le:hover { opacity: 1; }

.metre { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.chiffre { flex: 1 1 108px; display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--r-carte); background: var(--surface-2); }
.chiffre b { font-size: 22px; font-weight: 600; letter-spacing: -.028em; line-height: 1.15; }
.chiffre small { color: var(--tenu); font-size: 12px; }
.chiffre.attention { background: var(--warn-doux); }
.chiffre.attention b { color: var(--warn); }

/* ---------- journal d'export ---------- */
.log {
  background: var(--surface-2); color: var(--doux); border-radius: var(--r-carte); padding: 16px;
  font: 12.5px/1.65 var(--mono); white-space: pre-wrap; overflow-x: auto; max-height: 300px; margin: 0;
}

/* ---------- attente ---------- */
.overlay {
  position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(24px); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; z-index: 50;
}
.loader { display: flex; gap: 8px; }
.loader i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.15s infinite ease-in-out; }
.loader i:nth-child(2) { animation-delay: .16s; }
.loader i:nth-child(3) { animation-delay: .32s; }
@keyframes pulse { 0%, 75%, 100% { transform: scale(.55); opacity: .35; } 32% { transform: scale(1); opacity: 1; } }
.overlay p { font-size: 15px; color: var(--doux); }

/* ---------- notifications ---------- */
.toasts { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--r-carte); padding: 14px 18px; font-size: 14px; max-width: 380px;
  box-shadow: var(--ombre-2); animation: glisse .26s cubic-bezier(.32,.72,.34,1);
  border-left: 3px solid var(--accent);
}
.toast.ok { border-left-color: var(--ok); }
.toast.ko { border-left-color: var(--ko); }
@keyframes glisse { from { opacity: 0; transform: translateY(10px) scale(.97); } }

.badge { font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: var(--r-gelule); background: var(--surface); color: var(--doux); white-space: nowrap; box-shadow: var(--ombre-1); }

/* ---------- compact ---------- */
@media (max-width: 860px) {
  body { flex-direction: column; }
  .rail { width: auto; flex: none; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; overflow-x: auto; }
  .brand small, .rail-foot, .step .etat, .step .lbl { display: none; }
  .stepper { flex-direction: row; }
  .stage-head { padding: 16px 20px 14px; }
  .stage-head h1 { font-size: 24px; }
  .stage-body { padding: 0 20px 40px; }
  .stage-foot { padding: 13px 20px; }
}

/* ---------- blocs et volets de l'étape Impression ----------
   La page posait vingt réglages d'un bloc. Elle suit maintenant la question
   principale, et range le reste dans des volets repliés déjà réglés. */

.bloc {
  background: var(--surface); border-radius: var(--r-groupe);
  padding: 22px 24px; box-shadow: var(--ombre-1);
  display: flex; flex-direction: column; gap: 16px;
}
.bloc > h2 {
  margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.022em;
}
.bloc > .sous { margin: -10px 0 0; font-size: 14px; color: var(--doux); line-height: 1.5; }
.bloc .schema { padding: 0; box-shadow: none; background: none; border-radius: 0; }
.ligne-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ligne-actions.discret { justify-content: center; }

.bloc.final { align-items: center; gap: 14px; background: none; box-shadow: none; padding: 4px 0; }
button.grand {
  font-size: 16px; font-weight: 600; padding: 15px 34px; width: 100%; max-width: 420px;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 28%, transparent);
}
button.grand:hover { box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 36%, transparent); }

/* Volets repliables — balise <details> native, sans JavaScript. */
.volet {
  background: var(--surface); border-radius: var(--r-groupe);
  box-shadow: var(--ombre-1); overflow: hidden;
}
.volet > summary {
  display: flex; align-items: center; gap: 12px; padding: 17px 22px;
  cursor: pointer; list-style: none; user-select: none;
  transition: background var(--t);
}
.volet > summary::-webkit-details-marker { display: none; }
.volet > summary:hover { background: var(--surface-2); }
.volet .v-titre { font-size: 16px; font-weight: 600; letter-spacing: -.018em; }
.volet .v-resume { flex: 1; text-align: right; font-size: 13.5px; color: var(--tenu); }
/* Le chevron, dessiné en CSS pour ne charger aucune image. */
.volet > summary::after {
  content: ""; width: 8px; height: 8px; flex: 0 0 8px; margin-left: 4px;
  border-right: 2px solid var(--tenu); border-bottom: 2px solid var(--tenu);
  border-radius: 1px; transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t);
}
.volet[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.volet[open] > summary { background: var(--surface-2); }
.v-corps {
  padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 18px;
  border-top: 1px solid var(--separateur); animation: deplier .24s ease both;
}
@keyframes deplier { from { opacity: 0; transform: translateY(-4px); } }
/* La raison pour laquelle le bouton principal est inerte, dans le pied de page. */
.stage-foot .muted.avertit { color: var(--warn); font-weight: 500; }

/* ---------- visionneuse plein écran ---------- */
.visionneuse {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center;
  justify-content: center; gap: 12px; padding: 32px;
  background: color-mix(in srgb, #000 72%, transparent);
  backdrop-filter: saturate(140%) blur(18px);
  animation: apparait .2s ease;
}
@keyframes apparait { from { opacity: 0; } }
.v-scene { margin: 0; display: flex; flex-direction: column; gap: 14px; align-items: center;
           max-width: 100%; max-height: 100%; min-width: 0; }
.v-scene img {
  max-width: 100%; max-height: calc(100vh - 170px); object-fit: contain;
  border-radius: var(--r-carte); background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.5);
}
.v-pied {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center;
  padding: 10px 16px; border-radius: var(--r-gelule);
  background: color-mix(in srgb, #fff 14%, transparent); color: #fff; font-size: 14px;
}
.v-compteur { color: rgba(255,255,255,.6); font-size: 13px; }
.v-pied .primary { padding: 8px 20px; }
.v-fermer {
  position: absolute; top: 20px; right: 24px; width: 42px; height: 42px; padding: 0;
  border-radius: 50%; font-size: 26px; line-height: 1; color: #fff;
  background: color-mix(in srgb, #fff 14%, transparent);
}
.v-nav {
  width: 46px; height: 46px; flex: 0 0 46px; padding: 0; border-radius: 50%;
  font-size: 26px; line-height: 1; color: #fff;
  background: color-mix(in srgb, #fff 14%, transparent);
}
.v-fermer:hover, .v-nav:hover { background: color-mix(in srgb, #fff 26%, transparent); opacity: 1; }

/* La vignette cliquable qui ouvre la visionneuse. */
.loupe {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  border-radius: 0; background: none; cursor: zoom-in; overflow: hidden;
}
.loupe img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--surface-2); }
.loupe-ind {
  position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px; font-size: 12px;
  font-weight: 500; color: #fff; text-align: left; opacity: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.62)); transition: opacity var(--t);
}
.loupe:hover { opacity: 1; }
.loupe:hover .loupe-ind, .loupe:focus-visible .loupe-ind { opacity: 1; }

/* ---------- fichier prêt ---------- */
.pret { display: flex; flex-direction: column; gap: 14px; padding: 6px; }
.pret-tete { display: flex; align-items: flex-start; gap: 13px; padding: 8px 8px 0; }
.pret-coche {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid;
  place-items: center; background: var(--ok-doux); color: var(--ok); font-weight: 700;
}
.pret-tete b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.pret-tete small { color: var(--doux); font-size: 13px; }
a.telecharger {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; text-align: center; max-width: none;
}
a.telecharger .poids { font-weight: 400; opacity: .75; font-size: 13px; }
/* Les deux flèches encadrent l'image ; sur écran étroit elles se superposent
   aux bords plutôt que de voler de la largeur au visuel. */
.v-prec { order: 0; }
.v-suiv { order: 2; }
.v-scene { order: 1; }
@media (max-width: 700px) {
  .visionneuse { padding: 16px; }
  .v-nav { position: absolute; top: 50%; transform: translateY(-50%); }
  .v-prec { left: 10px; }
  .v-suiv { right: 10px; }
  .v-scene img { max-height: calc(100vh - 200px); }
}

/* ---------- page de connexion ---------- */
.page-connexion { display: grid; place-items: center; padding: 24px; }
.carte-connexion {
  width: 100%; max-width: 380px; background: var(--surface);
  border-radius: var(--r-groupe); padding: 32px; box-shadow: var(--ombre-2);
  display: flex; flex-direction: column; gap: 18px;
}
.carte-connexion .brand { padding: 0; }
.carte-connexion h1 { margin: 6px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.025em; }
.carte-connexion .sous { margin: -14px 0 0; color: var(--doux); font-size: 14px; }
.carte-connexion form { display: flex; flex-direction: column; gap: 16px; }
.carte-connexion .grand { max-width: none; margin-top: 4px; }

/* ---------- compte connecté ---------- */
.compte {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding: 0 14px; font-size: 13px; color: var(--doux);
}
.compte span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lien-quitter { color: var(--tenu); text-decoration: none; font-size: 12.5px; flex: 0 0 auto; }
.lien-quitter:hover { color: var(--accent); }

/* ---------- barre de navigation magnétique ----------
   Les icônes grossissent d'autant plus que le curseur en est proche. Le facteur
   d'agrandissement est calculé en JavaScript et posé dans --s ; le CSS ne fait
   que l'appliquer, ce qui garde l'animation sur le compositeur. */
.dock {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  z-index: 45; display: flex; align-items: flex-end; gap: 6px;
  padding: 9px 12px; border-radius: var(--r-gelule);
}
.dock-fond {
  position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--ombre-2), inset 0 0 0 1px var(--separateur);
}
.dock-item {
  --s: 1;
  position: relative; width: 44px; height: 44px; flex: 0 0 44px; padding: 0;
  border: 0; border-radius: 13px; background: transparent; color: var(--doux);
  display: grid; place-items: center; cursor: pointer;
  transform: scale(var(--s)) translateY(calc((var(--s) - 1) * -13px));
  transform-origin: bottom center;
  transition: transform .4s cubic-bezier(.18,1.4,.42,1), background var(--t), color var(--t);
}
.dock-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor;
                 stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock-item:hover { background: var(--surface-2); color: var(--texte); opacity: 1; }
.dock-item.actif { color: var(--accent); background: var(--accent-doux); }
.dock-item.actif::after {
  content: ""; position: absolute; bottom: -6px; left: 50%; width: 4px; height: 4px;
  border-radius: 50%; background: var(--accent); transform: translateX(-50%);
}
.dock-quitter:hover { color: var(--ko); background: var(--ko-doux); }
.dock-separateur { width: 1px; height: 26px; margin: 0 4px 9px; background: var(--separateur); }

.dock-bulle {
  position: absolute; bottom: calc(100% + 12px); left: 50%; translate: -50% 0;
  padding: 5px 11px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  font-size: 12.5px; font-weight: 500; color: var(--surface); background: var(--texte);
  opacity: 0; transition: opacity var(--t);
}
.dock-item:hover .dock-bulle, .dock-item:focus-visible .dock-bulle { opacity: 1; }

.dock-pastille {
  position: absolute; top: 5px; right: 5px; min-width: 8px; height: 8px;
  border-radius: 20px; background: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 80%, transparent);
}

/* Le contenu ne doit pas passer sous la barre. */
.stage-body { padding-bottom: 130px; }

@media (max-width: 860px) {
  .dock { bottom: 74px; gap: 3px; padding: 7px 9px; }
  .dock-item { width: 40px; height: 40px; flex: 0 0 40px; }
  .dock-bulle { display: none; }
}

/* ---------- fenêtre modale (compte) ---------- */
.modale {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  padding: 24px; background: color-mix(in srgb, #000 46%, transparent);
  backdrop-filter: blur(10px); animation: apparait .2s ease;
}
.modale-carte {
  position: relative; width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--r-groupe); padding: 28px;
  box-shadow: var(--ombre-2); display: flex; flex-direction: column; gap: 20px;
  animation: monte .26s cubic-bezier(.32,.72,.34,1);
}
@keyframes monte { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modale-carte h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.024em; }
.modale-carte h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--doux); }
.modale-fermer {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; padding: 0;
  border-radius: 50%; font-size: 21px; line-height: 1; background: var(--surface-2);
}
.fiche-compte {
  margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 9px 18px;
  padding: 16px 18px; border-radius: var(--r-carte); background: var(--surface-2);
  font-size: 14px;
}
.fiche-compte dt { color: var(--doux); }
.fiche-compte dd { margin: 0; font-weight: 500; text-align: right; }
#form-mdp { display: flex; flex-direction: column; gap: 14px; }
