.lw-stage-editor {
  width: min(1420px, 96vw);
  max-width: none;
  max-height: 96dvh;
  height: min(900px, 96dvh);
  padding: 0;
  border: 1px solid #d8e1d8;
  border-radius: 18px;
  color: #19362d;
  background: #f5f7f2;
  box-shadow: 0 32px 90px #10282055;
  overflow: hidden;
}
.lw-stage-editor::backdrop { background: #0c231ed1; backdrop-filter: blur(5px); }
.lw-stage-editor * { box-sizing: border-box; }
.lw-stage-editor button, .lw-stage-editor input { font: inherit; }
.lw-stage-editor button { cursor: pointer; }
.lw-stage-editor button:focus-visible, .lw-stage-editor input:focus-visible,
.lw-stage-editor__layer:focus-visible { outline: 3px solid #bb8554; outline-offset: 3px; }
.lw-stage-editor__shell { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.lw-stage-editor__head { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; padding: 22px 28px 17px; background: #fff; border-bottom: 1px solid #e0e7df; }
.lw-stage-editor__eyebrow { color: #9c7049; font-size: 11px; font-weight: 700; letter-spacing: .15em; }
.lw-stage-editor__head h2 { margin: 5px 0; font-size: clamp(21px, 2.2vw, 31px); line-height: 1.2; }
.lw-stage-editor__head p { margin: 0; color: #687a70; font-size: 13px; }
.lw-stage-editor__close { width: 38px; height: 38px; border: 1px solid #d9e2da; border-radius: 50%; background: #fff; color: #234238; font-size: 27px !important; line-height: 1; flex: none; }
.lw-stage-editor__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(400px, 1fr) minmax(285px, 355px); gap: 22px; padding: 20px 26px; overflow-y: auto; }
.lw-stage-editor__preview-wrap { min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lw-stage-editor__preview { position: relative; width: min(100%, 590px, calc((96dvh - 280px) * .75)); aspect-ratio: 3 / 4; flex: none; overflow: hidden; isolation: isolate; background: #f8faf6; box-shadow: 0 16px 40px #233b3024; user-select: none; -webkit-user-select: none; }
.lw-stage-editor__background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.lw-stage-editor__layer { position: absolute; display: block; transform: translate(-50%, -50%); cursor: grab; touch-action: none; user-select: none; border: 1px dashed transparent; border-radius: 3px; }
.lw-stage-editor__layer:active { cursor: grabbing; }
.lw-stage-editor__layer.is-selected { border: 2px dashed #ad7543; background: #f6d7ae16; }
.lw-stage-editor__layer img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; filter: drop-shadow(5px 9px 8px rgb(48 45 41 / 17%)); }
.lw-stage-editor[data-background-style="tech"] .lw-stage-editor__layer img { filter: drop-shadow(5px 9px 8px rgb(34 49 66 / 24%)); }
.lw-stage-editor[data-background-style="warm"] .lw-stage-editor__layer img { filter: drop-shadow(5px 9px 8px rgb(72 53 40 / 22%)); }
.lw-stage-editor__resize-handle { display: none; position: absolute; right: -9px; bottom: -9px; width: 22px; height: 22px; border: 2px solid #fff; border-radius: 50%; background: #b27b48; box-shadow: 0 2px 9px #173c3055; cursor: nwse-resize; touch-action: none; }
.lw-stage-editor__layer.is-selected .lw-stage-editor__resize-handle { display: block; }
.lw-stage-editor__preview-note { width: min(100%, 590px); color: #6f8075; font-size: 11px; line-height: 1.5; text-align: center; margin: 9px 0 0; }
.lw-stage-editor__controls { min-height: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid #e0e7df; border-radius: 12px; overflow: hidden; }
.lw-stage-editor__control-title { display: flex; align-items: center; justify-content: space-between; padding: 17px 17px 10px; }
.lw-stage-editor__control-title h3, .lw-stage-editor__adjustments h3 { margin: 0; font-size: 16px; }
.lw-stage-editor__control-title span { color: #6b8073; font-size: 12px; }
.lw-stage-editor__product-list { min-height: 80px; max-height: 34dvh; overflow-y: auto; padding: 0 12px 13px; display: grid; gap: 6px; }
.lw-stage-editor__product-list button { min-width: 0; display: grid; grid-template-columns: 45px minmax(0, 1fr); align-items: center; gap: 9px; text-align: left; border: 1px solid #e3eae3; border-radius: 8px; background: #fff; padding: 5px; color: #203c32; }
.lw-stage-editor__product-list button:hover, .lw-stage-editor__product-list button.is-selected { border-color: #a9784c; background: #fbf5ed; }
.lw-stage-editor__product-list img { width: 45px; height: 45px; object-fit: contain; }
.lw-stage-editor__product-list span { min-width: 0; }
.lw-stage-editor__product-list strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.lw-stage-editor__product-list small { display: block; color: #687b70; font-size: 10px; }
.lw-stage-editor__adjustments { margin-top: auto; border-top: 1px solid #e6ece6; padding: 16px 17px 18px; }
.lw-stage-editor__adjustments h3 { margin-bottom: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lw-stage-editor__adjustments label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #4d6858; }
.lw-stage-editor__adjustments output { font-weight: 700; color: #204b36; }
.lw-stage-editor__adjustments input[type="range"] { width: 100%; margin: 9px 0 10px; accent-color: #2c6145; }
.lw-stage-editor__scale-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.lw-stage-editor__scale-buttons button, .lw-stage-editor__move-buttons button, .lw-stage-editor__reset { border: 1px solid #d9e4da; background: #f8faf7; color: #1e4633; border-radius: 7px; min-height: 38px; }
.lw-stage-editor__move-head { display: flex; justify-content: space-between; gap: 8px; margin: 14px 0 7px; color: #4d6858; font-size: 12px; }
.lw-stage-editor__move-head small { color: #829086; font-size: 10px; }
.lw-stage-editor__move-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.lw-stage-editor__move-buttons button { font-size: 19px; }
.lw-stage-editor__reset { width: 100%; margin-top: 11px; font-size: 12px !important; }
.lw-stage-editor__foot { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 27px; background: #fff; border-top: 1px solid #e0e7df; }
.lw-stage-editor__foot > span { color: #526d5e; font-size: 12px; }
.lw-stage-editor__foot > div { display: flex; gap: 9px; margin-left: auto; }
.lw-stage-editor__foot button { min-height: 42px; padding: 0 18px; border: 1px solid #cdd8cf; border-radius: 7px; background: #fff; color: #214335; white-space: nowrap; }
.lw-stage-editor__foot .lw-stage-editor__save { border-color: #1e4a37; background: #1e4a37; color: #fff; font-weight: 700; }
.lw-stage-editor__foot button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 850px) {
  .lw-stage-editor { width: min(100vw, 650px); height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .lw-stage-editor__head { padding: 15px 17px; }
  .lw-stage-editor__head p { font-size: 11px; }
  .lw-stage-editor__body { display: flex; flex-direction: column; padding: 12px 14px; gap: 13px; }
  .lw-stage-editor__preview { width: min(100%, 420px, calc((100dvh - 470px) * .75)); min-width: min(100%, 230px); }
  .lw-stage-editor__preview-note { margin-top: 5px; }
  .lw-stage-editor__controls { flex: 1; }
  .lw-stage-editor__product-list { display: flex; max-height: none; overflow-x: auto; overflow-y: hidden; padding-bottom: 7px; }
  .lw-stage-editor__product-list button { flex: 0 0 155px; grid-template-columns: 37px minmax(0, 1fr); }
  .lw-stage-editor__product-list img { width: 37px; height: 37px; }
  .lw-stage-editor__adjustments { padding: 10px 13px; }
  .lw-stage-editor__adjustments h3 { margin-bottom: 8px; }
  .lw-stage-editor__foot { padding: 11px 14px; }
}

/* Shared read-only DOM preview. Export remains the server's 1200 x 1600 PNG. */
.lw-stage-preview {position:relative;width:100%;aspect-ratio:3/4;overflow:hidden;isolation:isolate;background:#f4f3ef}
.lw-stage-preview__background {position:absolute;inset:0;width:100%;height:100%;object-fit:fill!important}
.lw-stage-preview__layer {position:absolute;transform:translate(-50%,-50%)}
.lw-stage-preview__layer img {width:100%!important;height:100%!important;object-fit:contain!important;filter:drop-shadow(3px 5px 5px #302d292b)}
.stage-preview-actions {display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:8px 0 14px;font-size:12px;color:#526d5e}
.stage-preview-actions button {border:1px solid #cdd8cf;border-radius:6px;background:#fff;color:#214335;padding:8px 10px;cursor:pointer}
.stage-preview-actions button:disabled {opacity:.6;cursor:wait}
.stage-zoom-inner .lw-stage-preview {max-height:75dvh;width:min(100%,calc(75dvh * .75));margin:auto}
