/* The full photograph stays visible while its square selection moves. */
.product-image-cleanup { margin-top: 10px; }
.product-image-cleanup button { min-height: 44px; padding: 9px 12px; }
.product-image-cleanup p { max-width: 66ch; margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.crop-overlay { z-index: 140; padding: 16px; }
.crop-overlay .crop-modal { width: min(1040px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; }
.crop-modal .catalog-editor-head { align-items: flex-start; gap: 16px; }
.crop-modal .catalog-editor-head h2 { margin: 4px 0 8px; font-size: 22px; line-height: 1.35; }
.crop-modal .catalog-editor-head p { max-width: 58ch; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.crop-modal button { min-width: 44px; min-height: 44px; font-size: 14px; line-height: 1.35; }
.crop-modal button:focus-visible, .crop-modal input:focus-visible, #productCropCanvas:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.product-crop-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; align-items: start; gap: 24px; margin: 20px 0; }
.product-crop-stage { position: relative; min-width: 0; width: 100%; aspect-ratio: 4 / 3; border-radius: 14px; background-color: var(--cream); background-image: linear-gradient(45deg, #d8d2cc 25%, transparent 25%), linear-gradient(-45deg, #d8d2cc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d8d2cc 75%), linear-gradient(-45deg, transparent 75%, #d8d2cc 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; box-shadow: inset 0 0 0 1px var(--line); }
.product-crop-stage #productCropCanvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; border: 0; border-radius: 14px; background: transparent; cursor: crosshair; touch-action: none; user-select: none; }
.product-crop-stage #productCropCanvas.dragging { cursor: grabbing; }
.product-crop-handle { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; min-width: 48px !important; min-height: 48px !important; padding: 0 !important; transform: translate(-50%, -50%); border: 0 !important; border-radius: 8px; background: transparent !important; box-shadow: none !important; touch-action: none; }
.product-crop-handle::after { content: ''; display: block; width: 15px; height: 15px; border: 2px solid #fff; border-radius: 4px; background: var(--accent); box-shadow: 0 1px 4px #0006; }
.product-crop-handle[data-crop-handle="nw"], .product-crop-handle[data-crop-handle="se"] { cursor: nwse-resize; }
.product-crop-handle[data-crop-handle="ne"], .product-crop-handle[data-crop-handle="sw"] { cursor: nesw-resize; }
.product-crop-handle:hover::after { box-shadow: 0 0 0 4px #fff8, 0 1px 4px #0006; }
.product-crop-sidebar { display: grid; gap: 16px; min-width: 0; }
.product-crop-preview { display: grid; justify-items: center; gap: 8px; }
.product-crop-preview > span { font-size: 13px; color: var(--muted); }
.product-crop-help { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.product-crop-sidebar #productCropLivePreview { display: block; width: 180px; height: 180px; max-width: 100%; margin-inline: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.product-crop-sidebar h3, .product-crop-sidebar strong, .product-crop-size label { margin: 0; font-size: 14px; color: var(--ink); }
.product-crop-size { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.product-crop-size label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.product-crop-size input[type="range"] { width: 100%; min-height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.product-crop-size output { font-variant-numeric: tabular-nums; font-weight: 600; }
.product-crop-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.product-crop-presets button, .product-crop-nudge button { min-height: 48px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--cream); }
.product-crop-presets button:active, .product-crop-nudge button:active { background: var(--accent-soft); border-color: var(--accent); }
.product-crop-nudge { display: grid; grid-template-columns: repeat(3, minmax(44px, 1fr)); gap: 8px; }
.product-crop-nudge .crop-nudge-up { grid-area: 1 / 2; }
.product-crop-nudge .crop-nudge-left { grid-area: 2 / 1; }
.product-crop-nudge .crop-nudge-right { grid-area: 2 / 3; }
.product-crop-nudge .crop-nudge-down { grid-area: 3 / 2; }
.product-crop-nudge .crop-size-minus { grid-area: 3 / 1; }
.product-crop-nudge .crop-size-plus { grid-area: 3 / 3; }
.product-crop-status { color: var(--muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.product-crop-status { display: grid; gap: 6px; margin: 0; }
.product-crop-status > div { display: flex; justify-content: space-between; gap: 12px; }
.product-crop-status dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.product-crop-quality { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.product-crop-quality.is-warning { color: var(--red); }
.product-crop-status p { margin: 4px 0; }
.product-crop-status [data-quality-warning], #productCropError { color: var(--red); }
#productCropError { margin: 8px 0 0; font-size: 14px; line-height: 1.5; }
.crop-modal .modal-actions { position: sticky; bottom: -24px; z-index: 2; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin: 16px -24px -24px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--paper); }
.crop-modal .modal-actions button { min-height: 48px; padding: 12px 20px; }
.crop-modal button:disabled, .crop-modal input:disabled { cursor: wait; opacity: .55; }
@media (max-width: 740px) {
  .crop-overlay { padding: 10px; }
  .crop-overlay .crop-modal { max-height: calc(100dvh - 20px); padding: 16px; }
  .product-crop-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .product-crop-sidebar { grid-template-columns: minmax(112px, .85fr) minmax(150px, 1.15fr); gap: 12px 16px; align-items: start; }
  .product-crop-sidebar #productCropLivePreview { width: 150px; height: auto; aspect-ratio: 1; }
  .product-crop-size { border: 0; padding: 0; }
  .product-crop-sidebar .product-crop-preview { grid-column: 1; grid-row: 1; }
  .product-crop-sidebar .product-crop-nudge { grid-column: 2; grid-row: 1; }
  .product-crop-sidebar .product-crop-status, .product-crop-sidebar .product-crop-quality { grid-column: 1 / -1; }
  .crop-modal .modal-actions { bottom: -16px; margin: 16px -16px -16px; padding: 12px 16px; }
}
@media (max-width: 340px) {
  .product-crop-sidebar { grid-template-columns: minmax(0, 1fr); }
  .product-crop-size, .product-crop-presets, .product-crop-nudge { grid-column: 1; }
  .product-crop-sidebar .product-crop-preview, .product-crop-sidebar .product-crop-nudge { grid-column: 1; grid-row: auto; }
  .crop-modal .modal-actions button { flex: 1; }
}
