.is-designer .designer-page {
  padding: 8px 0 28px;
}

.is-designer .designer-wrap {
  width: min(calc(100% - 32px), 1440px);
  margin-inline: auto;
}

.designer-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.designer-editor,
.designer-stage {
  border-radius: 30px;
  min-height: 0;
}

.designer-editor {
  padding: 18px 18px 16px;
}

.designer-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 0.84rem;
}

.designer-panel h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.designer-lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.designer-editor-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
}

.designer-upload {
  width: min(100%, 460px);
  flex: 0 0 auto;
}

.designer-upload label,
.designer-group label,
.designer-group .group-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.designer-group {
  margin: 0 0 12px;
}

.designer-group:last-child {
  margin-bottom: 0;
}

.designer-row {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.designer-value {
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
}

.designer-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.repeat-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin-top: 10px;
}

.repeat-options.is-off {
  visibility: hidden;
}

.repeat-check {
  width: auto;
  font-size: 0.88rem;
}

.repeat-check input:disabled + span {
  opacity: 0.45;
}

.knockout-group {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
}

.knockout-tolerance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.knockout-tolerance input[type="range"] {
  width: 84px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.knockout-tolerance-value {
  min-width: 1.25em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.designer-file {
  width: 100%;
  color: var(--muted);
  font-size: 0.88rem;
}

.designer-file::file-selector-button {
  margin-right: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}

.editor-stage {
  position: relative;
  margin-top: 0;
  padding: 17px 8px 8px;
}

.editor-stage.is-drop .editor-canvas-clip {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.editor-canvas-clip {
  position: relative;
  width: 100%;
  aspect-ratio: 22.2 / 9.6;
  overflow: hidden;
  border-radius: 0;
  border: 1px solid var(--line);
  background: #f4f1ec;
}

.editor-canvas-clip canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #fff;
}

.editor-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  color: #5c584f;
  font-size: 0.98rem;
  text-align: center;
  pointer-events: none;
}

.editor-empty[hidden] {
  display: none;
}

.editor-overlay {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  top: 17px;
  z-index: 2;
  overflow: hidden;
  touch-action: none;
}

.layer-frame {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  transform-origin: center center;
  cursor: grab;
  touch-action: none;
}

.editor-overlay.is-interacting .layer-frame {
  cursor: grabbing;
}

.handle-stem {
  position: absolute;
  left: 50%;
  top: -22px;
  width: 1.5px;
  height: 22px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  pointer-events: none;
}

.handle {
  position: absolute;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  touch-action: none;
}

.handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1.5px solid #1a1a1c;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
}

.handle.nw { left: 0; top: 0; cursor: nwse-resize; }
.handle.ne { left: 100%; top: 0; cursor: nesw-resize; }
.handle.se { left: 100%; top: 100%; cursor: nwse-resize; }
.handle.sw { left: 0; top: 100%; cursor: nesw-resize; }

.handle.rotate {
  left: 50%;
  top: -22px;
  cursor: grab;
}

.handle.rotate::before {
  border-radius: 50%;
}

.layer-remove,
.layer-flip,
.layer-crop {
  position: absolute;
  top: 10px;
  z-index: 3;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.layer-remove {
  right: 10px;
  background: #e11d48;
}

.layer-flip {
  right: 48px;
  background: rgba(17, 17, 20, 0.88);
}

.layer-crop {
  right: 86px;
  background: rgba(17, 17, 20, 0.88);
}

.layer-crop.is-on {
  background: var(--accent);
  color: #102027;
}

.layer-flip.is-on {
  background: var(--accent);
}

.layer-remove:hover,
.layer-remove:focus-visible {
  background: #be123c;
}

.layer-flip:hover,
.layer-flip:focus-visible,
.layer-crop:hover,
.layer-crop:focus-visible {
  background: #2a2a32;
}

.layer-flip.is-on:hover,
.layer-flip.is-on:focus-visible,
.layer-crop.is-on:hover,
.layer-crop.is-on:focus-visible {
  background: var(--accent);
}

.layer-remove svg,
.layer-flip svg,
.layer-crop svg {
  width: 16px;
  height: 16px;
  display: block;
}

.layer-frame.is-cropping > .handle,
.layer-frame.is-cropping > .handle-stem {
  display: none;
}

.crop-dim {
  position: absolute;
  background: rgba(8, 9, 13, 0.55);
  pointer-events: none;
  z-index: 1;
}

.crop-dim-top { left: 0; right: 0; top: 0; }
.crop-dim-bottom { left: 0; right: 0; bottom: 0; }
.crop-dim-left { left: 0; }
.crop-dim-right { right: 0; }

.crop-window {
  position: absolute;
  z-index: 2;
  box-sizing: border-box;
  border: 1.5px solid #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  cursor: move;
  touch-action: none;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.designer-actions {
  display: grid;
  gap: 10px;
}

.designer-actions .button {
  width: 100%;
}

.designer-order .form-actions .button {
  width: auto;
  min-width: 220px;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.designer-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.designer-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.designer-check a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.order-options {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.order-option-hint {
  margin: 0 0 6px 28px;
}

.legal-more {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.legal-panel {
  margin: 8px 0 0 28px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.legal-panel p {
  margin: 0;
}

.legal-panel p + p {
  margin-top: 0.75em;
}

.designer-stage {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 432px;
  height: auto;
  margin-top: 4px;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.10), transparent 46%),
    radial-gradient(circle at 80% 80%, rgba(139,92,246,0.14), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
}

#viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  transform: translateY(-10px);
}

.designer-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(8,9,13,0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.78rem;
  color: var(--muted);
  user-select: none;
}

.designer-qty {
  display: grid;
  justify-items: center;
  width: 100%;
  max-width: none;
  margin: 16px auto 0;
}

.designer-qty .form-input {
  width: min(100%, 160px);
  text-align: center;
}

.price-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
}

.price-row[hidden] {
  display: none;
}

.price-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.price-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.price-row strong {
  font-size: 1.02rem;
}

.price-row.total strong {
  color: var(--accent);
  font-size: 1.12rem;
}

.designer-order-block {
  margin-top: 12px;
  padding: 22px 26px;
  border-radius: 30px;
}

.designer-order-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.35fr);
  gap: 28px;
  align-items: stretch;
}

.designer-order-side,
.designer-order-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.designer-order {
  padding-top: 0;
  border-top: 0;
}

.designer-order h2 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
  letter-spacing: -0.03em;
}

.rights-vat-row {
  margin-top: 16px;
}

.rights-vat-row .order-option-hint {
  margin-bottom: 4px;
}

.rights-vat-row > .legal-panel {
  box-sizing: border-box;
  margin: 0 0 16px;
  padding-left: 28px;
}

.designer-order .vat-note {
  margin: 0 0 12px;
  padding-top: 0;
  text-align: right;
  font-size: 0.68rem;
  line-height: 1.3;
  white-space: nowrap;
}

@media (min-width: 981px) {
  .rights-vat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    column-gap: 28px;
    row-gap: 0;
    margin-top: auto;
  }

  .rights-vat-row .legal-confirm {
    flex: 1 1 0;
    min-width: 0;
    order: 1;
  }

  .rights-vat-row .vat-note {
    order: 2;
    flex: 0 0 auto;
    margin: 3px 0 0 auto;
  }

  .rights-vat-row > .legal-panel {
    flex: 0 0 100%;
    order: 3;
    width: 100%;
  }
}

.designer-order .form-actions {
  margin-top: 10px;
  padding-top: 0;
}

.designer-order .form-status {
  margin: 12px 0 0;
}

.is-designer .form-help {
  margin-top: 8px;
}

.service-action {
  margin-top: 14px;
}

@media (max-width: 980px) {
  .designer-editor-bar,
  .designer-order-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .designer-upload {
    width: 100%;
  }

  .designer-stage {
    min-height: 312px;
    height: 384px;
  }
}
