:root {
  --fond: #f5f3ef;
  --carte: #ffffff;
  --texte: #23222a;
  --doux: #6d6a74;
  --ligne: #e3dfd8;
  --accent: #3f4a8a;
  --accent-fonce: #2f3870;
  --ok: #2f7a4f;
  --attente: #8a6d1f;
  --erreur: #a3342c;
  --rayon: 12px;
}
* { box-sizing: border-box; }
/* L'attribut hidden doit gagner sur les display des classes (.bouton, .actions...). */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.entete {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1600px; margin: 0 auto; padding: 18px 16px;
}
.marque { font-weight: 650; font-size: 1.1rem; color: var(--texte); text-decoration: none; letter-spacing: .01em; }
main { max-width: 1600px; margin: 0 auto; padding: 0 16px 48px; }
h1 { font-size: 1.4rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
a { color: var(--accent); }
.discret { color: var(--doux); text-decoration: none; font-size: .95rem; }
.discret:hover { color: var(--texte); }
.carte {
  background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 22px; margin-bottom: 20px;
}
.aide { color: var(--doux); margin: 0 0 14px; }
.meta { color: var(--doux); font-size: .92rem; margin: 4px 0; }
.alerte { background: #fbeceb; color: var(--erreur); border-radius: 8px; padding: 10px 12px; }
label { display: block; font-weight: 550; margin: 14px 0 6px; }
input[type=password], textarea, select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--ligne);
  border-radius: 8px; background: #fff; color: var(--texte);
}
.case { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.bouton {
  display: inline-block; border: 0; border-radius: 8px; padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none;
}
.bouton:hover { background: var(--accent-fonce); }
.bouton:disabled { opacity: .5; cursor: default; }
.bouton.secondaire { background: #ecebf3; color: var(--accent); }
.bouton.danger { background: #f6e3e1; color: var(--erreur); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.connexion { max-width: 380px; margin: 40px auto; }
.connexion .bouton { margin-top: 14px; width: 100%; }

.depot {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 170px; border: 2px dashed #cfc9bf; border-radius: var(--rayon);
  cursor: pointer; color: var(--doux); padding: 20px; transition: background .15s, border-color .15s;
  font-weight: 400;
}
.depot:hover, .depot.survol { background: #f0eee9; border-color: var(--accent); }
.depot strong { color: var(--texte); }

.apercu { position: relative; display: inline-block; max-width: 100%; margin-top: 6px; user-select: none; touch-action: none; }
.apercu img { display: block; max-width: 100%; max-height: 60vh; border-radius: 6px; }
.cadre {
  position: absolute; border: 2px dashed #fff; outline: 1px dashed #222;
  background: rgba(63, 74, 138, .18); cursor: move;
}
.cadre .poignee {
  position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px;
  background: #fff; border: 2px solid var(--accent); border-radius: 3px; cursor: nwse-resize;
}
.apercu.sans-cadre .cadre { display: none; }
.estimation { margin: 16px 0 0; font-weight: 550; }
.estimation small { font-weight: 400; color: var(--doux); }

.barre { height: 10px; background: #ece9e3; border-radius: 99px; overflow: hidden; margin: 14px 0 6px; }
.barre span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.phase { margin: 6px 0 0; font-weight: 550; }

.liste { list-style: none; margin: 0; padding: 0; }
.liste li + li { border-top: 1px solid var(--ligne); }
.ligne { display: flex; align-items: center; gap: 14px; padding: 10px 4px; color: inherit; text-decoration: none; }
.ligne:hover { background: #faf9f6; }
.vignette { width: 120px; height: 44px; object-fit: cover; border-radius: 5px; flex: none; background: #ece9e3; }
.infos { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nom { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nom-fichier { overflow-wrap: anywhere; }
.statut { font-size: .82rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.s-en_attente { background: #f6efd9; color: var(--attente); }
.s-en_cours { background: #e6e8f5; color: var(--accent); }
.s-termine { background: #e1f1e7; color: var(--ok); }
.s-erreur { background: #f6e3e1; color: var(--erreur); }
.s-annule { background: #ecebe8; color: var(--doux); }
.titre-ligne { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }

.impression-reglages { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.impression-reglages label { margin: 0; }
.impression-reglages input, .impression-reglages select { width: 100%; font: inherit; padding: 9px 10px;
  border: 1px solid var(--ligne); border-radius: 8px; background: #fff; margin-top: 6px; }

/* ---- editeur plein ecran de la retouche par zones */
.ed-ia { font-size: 11px; font-weight: 700; color: #fff; background: #6b4fd8; border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
body.ed-ouvert { overflow: hidden; }
.editeur { position: fixed; inset: 0; z-index: 1000; background: #111; display: flex; flex-direction: column; }
.editeur[hidden] { display: none; }
.ed-barre { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #1d1d22; color: #eee; flex-wrap: wrap; }
.ed-aide { color: #aaa; font-size: .82rem; flex: 1; min-width: 220px; }
.ed-niveau { font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.ed-barre .bouton { padding: 6px 12px; }
.ed-fermer { border: 0; background: #d63a3a; color: #fff; font-size: 1.25rem; line-height: 1; width: 40px; height: 36px;
             border-radius: 8px; cursor: pointer; margin-left: 4px; }
.ed-fermer:hover { background: #b52c2c; }
.editeur.sans-panneau .ed-panneau { display: none; }
.editeur:fullscreen { width: 100vw; height: 100vh; }
.ed-corps { flex: 1; display: flex; min-height: 0; }
.ed-vue { flex: 1; position: relative; overflow: hidden; cursor: crosshair; touch-action: none; user-select: none;
          background: repeating-conic-gradient(#1a1a1a 0 25%, #232323 0 50%) 0 0 / 24px 24px; }
.ed-vue.main { cursor: grab; }
.ed-vue.glisse { cursor: grabbing; }
.ed-plateau { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ed-plateau img { display: block; max-width: none; }
.ed-chargement { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #ccc; margin: 0; }
/* zones : traces point par point (SVG a la taille de l'image), numeros, apercus des versions */
#retouche-zones, #ed-apercus { position: absolute; inset: 0; pointer-events: none; }
#retouche-zones svg { position: absolute; left: 0; top: 0; overflow: visible; }
#retouche-zones polygon, #retouche-zones polyline { stroke-width: var(--ep, 2px); stroke-linejoin: round; }
#retouche-zones polygon.z { fill: rgba(255, 77, 77, .12); stroke: #ff4d4d; }
#retouche-zones polygon.z.active { fill: rgba(255, 77, 77, .32); }
#retouche-zones polygon.z.en-cours { fill: rgba(255, 77, 77, .08); stroke-dasharray: calc(var(--ep, 2px) * 3); }
#retouche-zones polyline.trace { fill: none; stroke: #ffd24d; stroke-dasharray: calc(var(--ep, 2px) * 3); }
#retouche-zones circle { r: calc(var(--ep, 2px) * 2.2); fill: #ffd24d; stroke: #111; stroke-width: calc(var(--ep, 2px) * .6); }
#retouche-zones circle.premier { fill: #fff; r: calc(var(--ep, 2px) * 3); }
#retouche-zones circle.premier.fermable { fill: #3ddc84; r: calc(var(--ep, 2px) * 4.5); }
#retouche-zones polygon.v { fill: none; stroke: #3fa9f5; stroke-dasharray: calc(var(--ep, 2px) * 4) calc(var(--ep, 2px) * 2); }
#retouche-zones polygon.v.active { stroke: #fff; fill: rgba(63, 169, 245, .08); }
.z-num { position: absolute; transform: translateY(-100%); color: #fff; white-space: nowrap;
         font: 700 var(--fs, 14px)/1.35 system-ui, sans-serif; padding: 0 calc(var(--fs, 14px) * .45);
         border-radius: calc(var(--fs, 14px) * .3) calc(var(--fs, 14px) * .3) 0 0; }
.z-num.z { background: #ff4d4d; }
.z-num.v { background: #1f7fc4; }
.z-num.active { outline: calc(var(--ep, 2px) * .8) solid #fff; }
.ed-plateau.sans-contours #retouche-zones { display: none; }
#ed-apercus img { position: absolute; display: block; max-width: none; }
.ed-nb { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; margin: 6px 0 0; }
.ed-nb select { padding: 3px 6px; font-weight: 600; }
.versions-bloc { border-color: #3fa9f5; }
.versions-bloc li.active { border-color: #3fa9f5; }
.v-texte { flex: 1; min-width: 0; margin: 0 8px; color: var(--texte-doux, #666); font-size: .85rem;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choix-versions { display: flex; flex-wrap: wrap; gap: 6px; }
.v-choix { border: 1px solid var(--ligne); background: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer;
           font: 600 .9rem system-ui, sans-serif; }
.v-choix.choisi { background: #1f7fc4; border-color: #1f7fc4; color: #fff; }
.v-choix:disabled { opacity: .55; cursor: default; }
.v-plus { border: 1px dashed #1f7fc4; background: transparent; color: #1f7fc4; border-radius: 6px; padding: 5px 10px;
          cursor: pointer; font: 600 .85rem system-ui, sans-serif; }
.v-plus:disabled { opacity: .5; cursor: default; }
.ed-panneau { width: 360px; flex: none; background: var(--fond); padding: 14px; overflow: auto;
              display: flex; flex-direction: column; gap: 8px; }
.ed-panneau ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.ed-panneau li { background: #fff; border: 1px solid var(--ligne); border-radius: 8px; padding: 8px 10px; }
.ed-panneau li.active { border-color: #ff4d4d; }
.ed-zone-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ed-zone-tete strong { color: #d63a3a; }
.ed-suppr { border: 0; background: transparent; cursor: pointer; color: var(--erreur); font-size: 1rem; padding: 2px 6px; }
.ed-panneau textarea { font-size: .95rem; margin-top: 6px; }
.ed-outil { font-size: .9rem; padding: 6px 8px; }
.ed-defaut { margin: 4px 0 2px; font-size: .92rem; }
.ed-defaut select { margin-top: 4px; font-weight: 600; }
@media (max-width: 800px) {
  .ed-corps { flex-direction: column; }
  .ed-panneau { width: auto; max-height: 45vh; }
  .ed-aide { display: none; }
}

@media (max-width: 640px) {
  .carte { padding: 16px; }
  .vignette { width: 72px; }
}

/* ---- avancement de la correction automatique */


/* ================================================================ accueil */
.depot { min-height: 220px; }
.depot-icone { display: block; font-size: 2.4rem; margin-bottom: 6px; }
.depart { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 1fr); gap: 28px; align-items: start; }
.depart-image { text-align: center; }
.depart-image .apercu img { max-height: 62vh; }
.depart-choix h2 { margin-bottom: 14px; }
.choix { display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; font: inherit; color: inherit;
         background: #fff; border: 1.5px solid var(--ligne); border-radius: 12px; padding: 14px 16px;
         margin-bottom: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .05s; }
.choix:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(63, 74, 138, .12); }
.choix:active { transform: translateY(1px); }
.choix:disabled { opacity: .5; cursor: default; box-shadow: none; }
.choix.principal { border-color: var(--accent); background: #f3f4fb; }
.choix-icone { font-size: 1.7rem; line-height: 1.2; flex: none; }
.choix-texte { display: flex; flex-direction: column; gap: 2px; }
.choix-texte strong { font-size: 1.05rem; }
.choix-texte span { color: var(--doux); font-size: .93rem; }
.choix-texte small { color: var(--accent); font-weight: 600; font-size: .85rem; margin-top: 2px; }
.choix.principal .choix-texte strong::after { content: "recommandé"; margin-left: 8px; font-size: .72rem; font-weight: 700;
  color: #fff; background: var(--accent); border-radius: 99px; padding: 2px 8px; vertical-align: middle; }
.options { margin-top: 6px; border-top: 1px solid var(--ligne); padding-top: 10px; }
.options summary { cursor: pointer; color: var(--doux); font-weight: 600; }
.options[open] summary { margin-bottom: 4px; }
.petite { font-size: .88rem; margin: 2px 0 8px; }
.lien { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 6px; margin-top: 6px; }
.lien:hover { text-decoration: underline; }
.lien.danger { color: var(--erreur); font-size: .9rem; margin-top: 18px; }
@media (max-width: 860px) { .depart { grid-template-columns: 1fr; } }

/* =================================================== page d'une image */
.fil { margin: 0 0 10px; }
.page-titre { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.page-titre h1 { margin: 0; }
.page-grille { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.page-vue { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 12px; min-height: 240px; }
.vue { position: relative; cursor: zoom-in; line-height: 0; }
.vue img { display: block; width: 100%; max-height: 78vh; object-fit: contain; border-radius: 8px; background: #ece9e3; }
.vue-indice { position: absolute; right: 10px; bottom: 10px; line-height: 1.4; background: rgba(0, 0, 0, .6); color: #fff;
              font-size: .85rem; padding: 4px 10px; border-radius: 99px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.vue:hover .vue-indice { opacity: 1; }
.suivi { padding: 30px 20px; }
.suivi .phase { font-size: 1.05rem; }
.page-actions { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 16px;
                position: sticky; top: 12px; }
.groupe { display: flex; flex-direction: column; gap: 10px; }
.groupe + .groupe { margin-top: 10px; }
.groupe:empty { display: none; }
.action { display: flex; align-items: center; gap: 10px; width: 100%; font: inherit; font-weight: 600; text-align: left;
          border: 1.5px solid var(--ligne); background: #fff; color: var(--texte); border-radius: 10px;
          padding: 12px 14px; cursor: pointer; text-decoration: none; }
.action span { font-size: 1.2rem; width: 1.5em; text-align: center; }
.action:hover { border-color: var(--accent); }
.action:disabled { opacity: .5; cursor: default; }
.action.principale { background: var(--accent); border-color: var(--accent); color: #fff; }
.action.principale:hover { background: var(--accent-fonce); }
.action.telecharger { background: #e1f1e7; border-color: #c6e3d1; color: var(--ok); }
.action.discrete { font-weight: 500; color: var(--doux); padding: 9px 14px; }
.etat-ia:not(:empty) { font-weight: 600; padding: 10px 12px; border-radius: 8px; background: #efeafd; color: #2d1f6b;
                       border: 1px solid #d6ccf7; margin: 0 0 12px; }
.etat-ia:empty { display: none; }
.details { margin-top: 16px; border-top: 1px solid var(--ligne); padding-top: 10px; }
.details summary { cursor: pointer; color: var(--doux); font-weight: 600; }
@media (max-width: 900px) {
  .page-grille { grid-template-columns: 1fr; }
  .page-actions { position: static; }
}

/* ======================================== page unique d'une image (2026-09-19) */
main:has(.page-une) { max-width: none; padding: 0 16px 16px; }
.une-tete { display: flex; align-items: center; gap: 14px; margin: 0 0 10px; flex-wrap: wrap; }
.une-tete h1 { margin: 0; font-size: 1.1rem; flex: 1; min-width: 0; }
.editeur.integre { position: relative; inset: auto; z-index: auto; height: calc(100vh - 130px); min-height: 560px;
                   border-radius: 12px; overflow: hidden; border: 1px solid var(--ligne); }
.editeur.integre:fullscreen { height: 100vh; border-radius: 0; }
.editeur.integre .ed-corps { height: 100%; }
.ed-colonne-vue { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.editeur.integre .ed-panneau { width: 390px; gap: 0; }
.une-bloc { background: #fff; border: 1px solid var(--ligne); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.une-bloc h2 { font-size: 1rem; margin: 0 0 8px; }
.une-bloc .action + .aide, .une-bloc .action + .meta { margin-top: 8px; }
.une-bloc .action.telecharger { margin-top: 10px; }
.une-annuler { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.suivi-panneau { background: #fff; border: 1px solid var(--ligne); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
@media (max-width: 900px) {
  .editeur.integre { height: auto; }
  .editeur.integre .ed-corps { flex-direction: column; }
  .ed-colonne-vue { height: 62vh; }
  .editeur.integre .ed-panneau { width: auto; max-height: none; }
}
.depot.occupe { opacity: .6; pointer-events: none; }

/* ---- avancement bien visible (2026-09-19) */
.progression { position: sticky; top: 0; z-index: 5; background: #fff; border: 2px solid #3fa9f5; border-radius: 10px;
               padding: 12px; margin-bottom: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .10); }
.progression.fini.ok { border-color: #2fb36a; }
.progression.fini.ko { border-color: #e0a100; }
.prog-tete { display: flex; align-items: center; gap: 10px; }
.prog-tete strong { flex: 1; font-size: 1.05rem; }
.prog-temps { font-variant-numeric: tabular-nums; color: #555; font-weight: 600; }
.prog-rond { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #3fa9f5; border-top-color: transparent;
             animation: prog-tourne .9s linear infinite; flex: none; }
.progression.fini .prog-rond { display: none; }
@keyframes prog-tourne { to { transform: rotate(360deg); } }
.prog-etapes { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: .95rem; }
.prog-etapes li { color: #9a9a9a; }
.prog-etapes li::before { display: inline-block; width: 1.3em; }
.prog-etapes li.fait { color: #2a8a4a; }
.prog-etapes li.fait::before { content: "✓"; }
.prog-etapes li.encours { color: #111; font-weight: 700; }
.prog-etapes li.encours::before { content: "▶"; color: #3fa9f5; }
.prog-etapes li.avenir::before { content: "○"; }
.prog-barre { height: 12px; background: #e6edf5; border-radius: 7px; overflow: hidden; }
.prog-barre span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3fa9f5, #1f7fc4);
                   transition: width .8s ease; }
.progression.fini.ok .prog-barre span { background: #2fb36a; }
.progression.fini.ko .prog-barre span { background: #e0a100; }
.prog-detail { margin: 8px 0 0; font-size: .9rem; color: #333; }
.ed-badge { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4; pointer-events: none;
            background: rgba(18, 18, 24, .88); color: #fff; padding: 8px 16px; border-radius: 999px; white-space: nowrap;
            font: 600 .95rem system-ui, sans-serif; box-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
.ed-badge.fini { background: rgba(28, 140, 72, .94); }
#retouche-zones polygon.v.en-cours { stroke: #ffd24d; fill: rgba(255, 210, 77, .18); animation: zone-pulse 1.1s ease-in-out infinite; }
.z-num.v.en-cours { background: #b08a00; animation: zone-pulse 1.1s ease-in-out infinite; }
@keyframes zone-pulse { 50% { opacity: .35; } }
.versions-bloc.eclat { animation: bloc-eclat 1s ease 3; }
@keyframes bloc-eclat { 50% { box-shadow: 0 0 0 5px rgba(63, 169, 245, .45); } }
.ed-panneau .prog-etapes li { background: none; border: 0; border-radius: 0; padding: 0; }

/* ---- contour d'une zone masque le temps de regarder (2026-09-19) */
.z-num.v { pointer-events: auto; cursor: pointer; }
.z-num.v.cache { opacity: .6; }
.ed-oeil { border: 1px solid var(--ligne); background: #fff; border-radius: 6px; cursor: pointer; font-size: .95rem;
           padding: 1px 7px; margin-right: 4px; }
.ed-oeil.cache { background: #1f7fc4; border-color: #1f7fc4; }
