#edit-modal{padding:12px}#edit-modal .dialog{width:min(98vw,1120px);max-height:96dvh;padding:20px;display:flex;flex-direction:column;gap:12px}#edit-modal .editor-heading{display:flex;justify-content:space-between;align-items:center;gap:10px}#edit-modal h2{margin:0;font-size:23px}#edit-close{width:42px;height:42px;padding:0;font-size:22px}#edit-modal .editor-tabs{display:flex;gap:5px;background:#eaf0f8;border-radius:10px;padding:4px;align-self:flex-start}#edit-modal .editor-tab{background:transparent;color:#193452;padding:10px 12px;font-size:14px;border-radius:8px}#edit-modal .editor-tab[aria-selected=true]{background:#175ec2;color:white}#edit-modal .editor-workspace{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.85fr);gap:18px;min-height:0;flex:1}#edit-modal .editor-preview-wrap{position:relative;min-width:0;min-height:0;display:flex;align-items:center;justify-content:center;background:#14253a;border-radius:12px;overflow:hidden}#edit-modal .edit-preview{width:100%;height:auto;max-height:53dvh;object-fit:contain;border-radius:0}#edit-modal .editor-preview-labels{position:absolute;top:10px;left:10px;right:10px;display:flex;justify-content:space-between;z-index:3;pointer-events:none}#edit-modal .editor-preview-labels span{background:#12243bdb;color:white;border-radius:7px;padding:5px 9px;font-size:12px}#edit-modal #edit-compare{position:absolute;bottom:10px;left:8%;width:84%;z-index:4;accent-color:#175ec2}#edit-modal .editor-before{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none;clip-path:inset(0 0 0 100%)}#edit-modal .editor-side{display:flex;flex-direction:column;gap:8px;min-width:0;overflow-y:auto}#edit-modal .editor-auto{margin:0;display:flex;flex-direction:column;align-items:stretch;gap:5px}#edit-modal #edit-auto{background:#e7f0ff;color:#1354ad;padding:12px}#edit-modal #edit-auto-status{font-size:12px;margin:0;min-height:0}#edit-modal .edit-tools{display:flex;flex-direction:column;gap:15px;margin:5px 0}#edit-modal .edit-tools label{font-weight:600;gap:9px}#edit-modal .edit-tools input[type=range]{accent-color:#175ec2;min-height:28px}#edit-modal .edit-tools select{min-height:44px;border-radius:9px;border:1px solid #a9bfd9;padding:8px}#edit-modal .editor-crop button{width:100%}#edit-modal .editor-footer{border-top:1px solid #dae5f0;padding-top:12px;gap:8px;justify-content:flex-end}#edit-modal .editor-footer button{min-height:44px}#edit-modal #edit-apply{min-width:130px}#edit-modal .editor-side [hidden]{display:none!important}#edit-modal .editor-tab:focus-visible{outline:3px solid #79b7ff}@media(max-width:700px){#edit-modal{padding:5px;align-items:stretch}#edit-modal .dialog{width:100%;max-height:99dvh;padding:12px;gap:9px}#edit-modal h2{font-size:18px}#edit-modal .editor-tabs{align-self:stretch;justify-content:space-between}#edit-modal .editor-tab{font-size:12px;padding:10px 7px;flex:1}#edit-modal .editor-workspace{display:flex;flex-direction:column;gap:9px;overflow-y:auto}#edit-modal .editor-preview-wrap{flex:none}#edit-modal .edit-preview{max-height:35dvh}#edit-modal .editor-side{overflow:visible;flex:none}#edit-modal .edit-tools{gap:9px;margin:2px 0}#edit-modal .editor-footer{flex:none;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}#edit-modal .editor-footer button{min-width:0;padding:9px 5px;font-size:12px}#edit-modal #edit-apply{grid-column:1/-1;min-width:0;font-size:16px}#edit-modal #edit-compare{bottom:6px}}
#edit-modal .editor-auto[hidden],#edit-modal .editor-adjust[hidden],#edit-modal .editor-crop[hidden],#edit-modal .editor-rotate[hidden],#edit-modal #edit-auto-status[hidden]{display:none!important}

/* Comparaison directe : séparation visible, sans barre horizontale */
#edit-modal .editor-preview-wrap{isolation:isolate}
#edit-modal .editor-before{z-index:2;object-fit:contain}
#edit-modal .editor-compare-handle{position:absolute;z-index:5;top:0;bottom:0;left:50%;width:2px;background:#fff;box-shadow:0 0 0 1px #12324d,0 0 9px #0008;pointer-events:none;transform:translateX(-50%)}
#edit-modal .editor-compare-handle span{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:#fff;color:#175ec2;border:2px solid #175ec2;box-shadow:0 2px 8px #0005;font-size:19px;font-weight:700}
#edit-modal #edit-compare{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:ew-resize;z-index:6;touch-action:pan-y}
#edit-modal .editor-preview-labels{z-index:7}
#edit-modal .editor-side{overflow-x:hidden;min-width:0}
#edit-modal .edit-tools{gap:12px}
#edit-modal .edit-tools label{display:flex;flex-direction:column;gap:5px;min-width:0}
#edit-modal .edit-tools input[type=range]{display:block;width:100%;min-width:0;max-width:100%;margin:0}
#edit-modal .editor-auto{max-width:100%}
#edit-modal .editor-footer{flex-wrap:wrap}
@media(max-width:700px){#edit-modal .editor-preview-wrap{min-height:180px}#edit-modal .editor-side{overflow-x:hidden}#edit-modal .editor-compare-handle span{width:34px;height:34px}}

/* Le recadrage doit apparaître au premier plan et ne jamais superposer la comparaison Avant/Après. */
#crop-modal:not([hidden]){z-index:10000!important;visibility:visible!important}
#edit-modal:has(.editor-tab[data-edit-tab="crop"][aria-selected="true"]) .editor-before,#edit-modal:has(.editor-tab[data-edit-tab="crop"][aria-selected="true"]) .editor-compare-handle,#edit-modal:has(.editor-tab[data-edit-tab="crop"][aria-selected="true"]) #edit-compare,#edit-modal:has(.editor-tab[data-edit-tab="crop"][aria-selected="true"]) .editor-preview-labels{display:none!important}

/* Interface de retouche compacte et responsive */
#edit-modal .dialog{width:min(96vw,1050px);gap:10px;padding:16px}
#edit-modal .editor-magic{color:#175ec2}
#edit-modal .editor-heading h2{font-size:21px;line-height:1.25}
#edit-modal .editor-tabs{width:100%;align-self:stretch;display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
#edit-modal .editor-tab{display:flex;justify-content:center;align-items:center;gap:7px;min-width:0}
#edit-modal .editor-workspace{grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr);gap:12px}
#edit-modal .editor-side{gap:5px}
#edit-modal .edit-tools{gap:10px}
#edit-modal .editor-control-label{display:flex;justify-content:space-between;align-items:center;gap:8px}
#edit-modal .editor-control-label output{font-size:12px;color:#526a83;font-weight:500}
#edit-modal .editor-auto #edit-auto{background:#e6f0ff;color:#175ec2;border:1px solid #c5dcfb}
#edit-modal .editor-footer{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;justify-content:stretch}
#edit-modal .editor-footer button{display:flex;align-items:center;justify-content:center;gap:6px;white-space:normal;text-align:center;min-width:0;padding:10px 7px;font-size:13px}
#edit-modal #edit-apply{min-width:0;background:#175ec2;color:white}
#edit-modal #edit-reset{background:#fff4e6;color:#855100;border:1px solid #efd6ac}
#edit-modal #edit-cancel{background:#edf1f6;color:#34455a}
#edit-modal #open-ai{background:#eaf1ff;color:#1456ae}
@media(max-width:700px){
 #edit-modal{padding:4px}
 #edit-modal .dialog{width:100%;max-height:99dvh;padding:10px;gap:8px}
 #edit-modal .editor-heading h2{font-size:17px}
 #edit-modal .editor-tab{font-size:12px;gap:4px;padding:9px 4px}
 #edit-modal .editor-workspace{display:flex;flex-direction:column;gap:8px;overflow-y:auto}
 #edit-modal .edit-preview{max-height:34dvh}
 #edit-modal .editor-footer{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 #edit-modal .editor-footer button{min-height:42px;font-size:12px;padding:8px 5px}
 #edit-modal #edit-apply{grid-column:auto;font-size:12px}
 #edit-modal .edit-tools{gap:8px}
}

/* Avant/Après réservé aux ajustements : une seule photo pour la rotation. */
#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-before,#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-compare-handle,#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) #edit-compare,#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-preview-labels{display:none!important}

/* Rotation tactile : la poignée agit directement sur la photo. */
#edit-modal .rotation-overlay{position:absolute;inset:0;z-index:8;pointer-events:none}
#edit-modal .rotation-overlay[hidden]{display:none!important}
#edit-modal .rotation-grid{position:absolute;inset:8%;border:1px dashed #fff9;background:linear-gradient(to right,transparent 32.9%,#fff8 33%,transparent 33.3%,transparent 66.2%,#fff8 66.5%,transparent 66.8%),linear-gradient(to bottom,transparent 32.9%,#fff8 33%,transparent 33.3%,transparent 66.2%,#fff8 66.5%,transparent 66.8%);opacity:.65}
#edit-modal .rotation-grip{position:absolute;top:13px;left:50%;transform:translateX(-50%);width:48px;height:48px;border-radius:50%;border:3px solid white;background:#175ec2;color:#fff;display:grid;place-items:center;font-size:24px;box-shadow:0 3px 12px #0008;pointer-events:auto;cursor:grab;touch-action:none;user-select:none}
#edit-modal .rotation-grip:active{cursor:grabbing}
#edit-modal .rotation-grip:focus-visible{outline:3px solid #ffb900;outline-offset:3px}
#edit-modal .rotation-heading{display:flex;justify-content:space-between;align-items:center;gap:8px}
#edit-modal #rotation-value{font-size:18px;font-weight:700;color:#175ec2;font-variant-numeric:tabular-nums}
#edit-modal .rotation-help{font-size:13px;color:#536c86;margin:5px 0 12px}
#edit-modal .rotation-controls{display:flex;justify-content:center;gap:7px;flex-wrap:wrap;margin-top:9px}
#edit-modal .rotation-controls button{min-height:44px;flex:1;padding:9px 7px;white-space:nowrap}
#edit-modal .editor-rotate{display:block}
#edit-modal .editor-preview-wrap:has(.rotation-overlay:not([hidden])) .editor-before,#edit-modal .editor-preview-wrap:has(.rotation-overlay:not([hidden])) .editor-compare-handle,#edit-modal .editor-preview-wrap:has(.rotation-overlay:not([hidden])) #edit-compare,#edit-modal .editor-preview-wrap:has(.rotation-overlay:not([hidden])) .editor-preview-labels{display:none!important}
@media(max-width:700px){#edit-modal .rotation-grip{width:52px;height:52px}#edit-modal .rotation-help{font-size:12px}}

/* Rotation en espace de travail agrandi : photo entière, aucun zoom ni recadrage imposé. */
#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]){padding:6px}
#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .dialog{width:calc(100vw - 12px);max-width:none;max-height:calc(100dvh - 12px);height:calc(100dvh - 12px)}
#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-workspace{min-height:0;flex:1;grid-template-columns:minmax(0,1fr) minmax(230px,290px)}
#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-preview-wrap{min-height:0;height:100%;overflow:hidden}
#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .edit-preview{width:100%;height:100%;max-height:none;object-fit:contain}
@media(max-width:700px){#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-workspace{display:flex;flex-direction:column;overflow:auto}#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-preview-wrap{height:auto;min-height:220px;flex:1}#edit-modal:has(.editor-tab[data-edit-tab="rotate"][aria-selected="true"]) .editor-side{flex:none}}
