/* Shared image crop dialog. Only the viewport is touch-managed; page zoom stays available. */
#cropDialog{width:min(760px,calc(100% - 16px));max-width:calc(100% - 16px);max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);margin:auto;padding:20px;overscroll-behavior:contain}
#cropDialog .crop-heading{gap:12px}#cropDialog .crop-heading h2{font-size:20px}#cropDialog .help{margin:10px 0;font-size:13px}
.crop-controls{display:flex;align-items:end;gap:12px}.crop-controls .field{flex:1;min-width:0}.crop-controls button{min-height:44px}
#cropDialog .crop-controls .field{margin:0}#cropSurface{width:100%;max-width:none;height:clamp(100px,44vh,420px);height:clamp(100px,44dvh,420px);aspect-ratio:auto!important;margin:12px 0;background-color:#e4eaf3;background-image:conic-gradient(#f4f7fc 25%,transparent 0 50%,#f4f7fc 0 75%,transparent 0);background-size:16px 16px;border-radius:8px;overflow:hidden;touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab}
#cropCanvas{width:100%;height:100%;pointer-events:none}#cropBox{min-width:0;min-height:0;touch-action:none;box-sizing:border-box;box-shadow:0 0 0 2000px #17233b80}
#cropBox button{width:28px;height:28px;min-height:0;min-width:0;border:2px solid #fff;border-radius:6px;box-shadow:0 0 0 1px #075bc9;z-index:1;margin:0}
#cropBox [data-corner=nw]{left:0;top:0}#cropBox [data-corner=ne]{right:0;top:0}#cropBox [data-corner=sw]{left:0;bottom:0}#cropBox [data-corner=se]{right:0;bottom:0}
#cropBox [data-corner=n]{left:calc(50% - 14px);top:0;cursor:ns-resize}#cropBox [data-corner=s]{left:calc(50% - 14px);bottom:0;cursor:ns-resize}#cropBox [data-corner=w]{left:0;top:calc(50% - 14px);cursor:ew-resize}#cropBox [data-corner=e]{right:0;top:calc(50% - 14px);cursor:ew-resize}
.crop-panning #cropBox,.crop-panning #cropBox button{cursor:grab}
.crop-zoom{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.crop-zoom button{min-width:40px;min-height:40px;padding:6px 10px}.crop-zoom label{font-size:12px}.crop-zoom input{flex:1;min-width:65px;width:100px;margin:0}.crop-zoom output{display:inline-block;min-width:38px}
.crop-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.crop-fields .field{min-width:0}#cropDialog .crop-fields input{width:100%;min-width:0;font-size:16px}.crop-exact{margin:8px 0}.crop-exact summary{cursor:pointer;font-size:13px;font-weight:600}
#cropSize{min-height:20px}#cropDialog .crop-actions{position:sticky;bottom:-20px;background:#fff;margin:10px -4px -4px;padding:12px 4px 4px;z-index:2;flex-wrap:wrap;gap:8px;border-top:1px solid #e0e7f0}#cropDialog .crop-actions button{min-height:44px;margin:0;font-size:13px}#cropDialog .crop-actions .primary{min-width:110px;flex:1}
#cropDialog [aria-pressed=true]{background:#edf4ff;color:#075bc9;border-color:#075bc9}
@media(pointer:coarse){#cropBox button{width:36px;height:36px}#cropBox [data-corner=n],#cropBox [data-corner=s]{left:calc(50% - 18px)}#cropBox [data-corner=w],#cropBox [data-corner=e]{top:calc(50% - 18px)}}
@media(max-width:480px){#cropDialog{padding:12px}#cropDialog .crop-actions{bottom:-12px}.crop-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.crop-zoom{gap:6px}.crop-zoom label{font-size:11px}#cropDialog .crop-actions button{font-size:12px;padding:8px 10px}}
@media(max-height:500px){#cropSurface{height:160px}#cropDialog{padding-block:12px}#cropDialog .help{margin:6px 0}}
