.image-crop-dialog {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 22px;
  border: 1px solid #e3e8ec;
  border-radius: 15px;
  background: #fff;
  color: #31404b;
  box-shadow: 0 24px 80px #1b2b3a40;
  overflow: auto;
}
.image-crop-dialog::backdrop { background: #1c26398c; }
.image-crop-dialog h2 { margin: 0 0 6px; font-size: 19px; }
.image-crop-dialog p { margin: 0 0 12px; font-size: 13px; color: #536473; }
.image-crop-surface {
  display: grid;
  place-items: center;
  min-height: 110px;
  padding: 10px;
  border: 1px solid #dfe5e7;
  border-radius: 8px;
  background: #f3f5f6;
}
.image-crop-frame {
  position: relative;
  width: min(100%, calc(55dvh * var(--source-ratio, 1.5)));
  aspect-ratio: var(--source-ratio, 1.5);
  background: #fff;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}
.image-crop-frame canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.image-crop-selection {
  position: absolute;
  box-shadow: 0 0 0 150vmax rgb(17 28 35 / 48%), inset 0 0 0 2px rgb(20 38 40 / 80%);
}
.image-crop-selection::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px dashed #fff;
  pointer-events: none;
}
.image-crop-frame[data-mode="edit"] .image-crop-selection { cursor: move; }
.image-crop-selection [data-handle] { position: absolute; }
.image-crop-selection [data-handle="n"], .image-crop-selection [data-handle="s"] {
  left: 0; right: 0;
  height: min(13px, 24%);
  cursor: ns-resize;
}
.image-crop-selection [data-handle="w"], .image-crop-selection [data-handle="e"] {
  top: 0; bottom: 0;
  width: min(13px, 24%);
  cursor: ew-resize;
}
.image-crop-corner { width: min(26px, 30%); height: min(26px, 30%); }
.image-crop-corner::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  max-width: 100%; max-height: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 2px solid var(--project-action-green);
  border-radius: 2px;
}
.image-crop-selection [data-handle^="n"], .image-crop-corner[data-handle^="n"]::after { top: 0; }
.image-crop-selection [data-handle^="s"], .image-crop-corner[data-handle^="s"]::after { bottom: 0; }
.image-crop-selection [data-handle$="w"], .image-crop-corner[data-handle$="w"]::after { left: 0; }
.image-crop-selection [data-handle$="e"], .image-crop-corner[data-handle$="e"]::after { right: 0; }
.image-crop-corner:is([data-handle="nw"], [data-handle="se"]) { cursor: nwse-resize; }
.image-crop-corner:is([data-handle="ne"], [data-handle="sw"]) { cursor: nesw-resize; }
.image-crop-size { display: block; margin-top: 5px; text-align: right; color: #536473; font-size: 12px; font-variant-numeric: tabular-nums; }
.image-crop-size:empty { display: none; }
.image-crop-dialog .image-crop-status { margin-top: 6px; margin-bottom: 0; }
.image-crop-status:empty { display: none; }
.image-crop-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.image-crop-actions button, .adjust-project-cover {
  padding: 8px 13px;
  border: 1px solid #d9e1e7;
  border-radius: 8px;
  background: #fff;
  color: #355765;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.image-crop-actions [data-action="reset"] { margin-inline-end: auto; }
.image-crop-actions button:disabled { opacity: .5; cursor: default; }
.image-crop-actions button:focus-visible, .adjust-project-cover:focus-visible {
  outline: 2px solid var(--project-action-green);
  outline-offset: 3px;
}
.image-crop-frame:focus-visible { outline: none; }
.image-crop-frame:focus-visible .image-crop-corner::after {
  box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--project-action-green-hover);
}
.adjust-project-cover { display: block; margin: 10px auto 0; }
#manage .cover-upload { aspect-ratio: 4 / 3; }
@media (max-width: 480px) {
  .image-crop-dialog { padding: 14px; }
  .image-crop-surface { padding: 5px; }
  .image-crop-actions { gap: 6px; }
  .image-crop-actions button { padding-inline: 9px; }
}
