/* Only Scan & Print's new editing controls and requested plain readable font. */
body,button,input,select,textarea{font-family:Arial,Helvetica,sans-serif!important}
.sp-upload-modes{display:flex;gap:8px;margin:0 0 16px}
.sp-mode{flex:1;min-width:0;border:1px solid #cfdeea;border-radius:10px;background:#fff;color:#173252;padding:11px 8px;font-size:13px;font-weight:600;cursor:pointer}
.sp-mode.active{background:#e6f7f5;border-color:#00878b;color:#006c72}
.sp-mode i{margin-right:4px}
.sp-helper{font-size:12px;color:#53677e;line-height:1.6;margin:7px 0 12px}
.sp-edit-btn{margin-top:10px;width:100%;min-height:42px}
.sp-id-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.sp-id-side{border:1px solid #cfdeea;background:#f8fbfe;border-radius:12px;padding:12px;min-width:0}
.sp-id-side label{display:block}
.sp-id-side input{font-size:12px;padding:10px}
.sp-thumb{width:100%;height:140px;object-fit:contain;background:white;border:1px solid #d6e2ec;border-radius:8px;margin:9px 0 0}
.sp-id-side button:disabled{opacity:.5;cursor:not-allowed}
.sp-success-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin:14px 0}
.sp-success-actions button{min-height:44px}
.sp-success-actions .danger{color:#b91c1c;border-color:#fecaca}
.sp-my-uploads{text-align:left;margin-top:20px;padding:16px;border:1px solid #c8dce9;border-radius:14px;background:#f8fbff}
.sp-my-uploads h2{font-size:17px;margin:0 0 6px}
.sp-upload-row{padding:12px 0;border-bottom:1px solid #dce7ee}
.sp-upload-row:last-child{border-bottom:0}
.sp-upload-row strong{display:block;font-size:13px}
.sp-upload-row small{display:block;color:#5d7088;margin-top:5px}
.sp-upload-row .btn-row{margin-top:8px}
.sp-upload-row .btn-row button{flex:1 1 auto;min-height:40px}
.sp-upload-row button.danger{color:#b91c1c;border-color:#fecaca}
.sp-editor-modal{position:fixed;inset:0;z-index:99990;background:rgba(9,19,35,.77);display:flex;align-items:center;justify-content:center;padding:12px;overflow:auto;font-family:Arial,Helvetica,sans-serif}
.sp-editor-panel{width:min(1100px,100%);max-height:calc(100dvh - 24px);overflow:auto;background:#fff;border-radius:16px;padding:18px;box-shadow:0 18px 70px #0007;color:#132842}
.sp-editor-head{display:flex;align-items:start;justify-content:space-between;gap:10px;margin-bottom:14px}
.sp-editor-head h2{margin:0 0 5px;font-size:22px}
.sp-editor-head p{margin:0;font-size:13px;color:#52647c;line-height:1.5}
.sp-icon-btn{border:1px solid #d7e1ed;border-radius:9px;background:#fff;min-width:40px;min-height:40px;cursor:pointer}
.sp-editor-layout{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(270px,1fr);gap:18px;align-items:start}
.sp-editor-crop-scroll{overflow:auto;background:#14243b;border-radius:10px;padding:8px;max-height:540px;min-height:180px;touch-action:pan-x pan-y}
#spCornerCanvas{display:block;max-width:none;width:100%;height:auto;touch-action:none;cursor:crosshair;user-select:none}
.sp-editor-tools{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}
.sp-editor-tools button{font-size:12px;padding:9px;min-height:38px}
.sp-editor-label{display:block;font-size:13px;font-weight:700;margin:0 0 5px}
.sp-editor-right select{width:100%;border:1px solid #d1ddea;border-radius:9px;background:#fff;padding:10px;margin-bottom:11px;font-size:14px;min-height:42px}
.sp-editor-slider{margin-bottom:11px}
.sp-editor-slider label{display:flex;justify-content:space-between;font-size:13px;font-weight:600;margin-bottom:4px}
.sp-editor-slider input{width:100%;accent-color:#00878b;min-height:28px}
.sp-editor-preview{background:#f2f6fa;border:1px solid #d7e1ed;border-radius:10px;padding:10px;text-align:center}
.sp-editor-preview strong{display:block;text-align:left;font-size:12px;margin-bottom:8px}
#spResultCanvas{display:block;max-width:100%;max-height:240px;width:auto;height:auto;margin:auto;background:#fff}
.sp-editor-footer{border-top:1px solid #e0e8f1;margin-top:15px;padding-top:13px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
#spEditorStatus{font-size:12px;color:#52647c}
.sp-editor-footer-actions{display:flex;flex-wrap:wrap;gap:8px}
.sp-editor-footer-actions button{min-height:42px;font-size:13px}
.sp-modal-open{overflow:hidden}
@media(max-width:740px){.sp-editor-panel{padding:12px;max-height:calc(100dvh - 12px)}.sp-editor-layout{grid-template-columns:1fr;gap:10px}.sp-editor-crop-scroll{max-height:36vh}.sp-editor-head h2{font-size:18px}.sp-editor-footer-actions{width:100%}.sp-editor-footer-actions button{flex:1 1 43%}.sp-editor-tools button{flex:1 1 27%}}
@media(max-width:430px){.sp-id-fields{grid-template-columns:1fr}.sp-upload-modes{flex-direction:column}.sp-thumb{height:130px}.sp-editor-modal{padding:6px}}

/* Crop usability on touch devices: scroll/pan, pinch zoom, bottom-edge access. */
.sp-editor-crop-scroll{height:min(54vh,540px);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
#spCornerCanvas{touch-action:none;user-select:none;-webkit-user-select:none}
.sp-editor-tools button{min-height:44px}
.sp-pdf-modal{z-index:99980}
.sp-pdf-panel{width:min(900px,100%)}
.sp-pdf-nav{display:flex;align-items:center;justify-content:center;gap:12px;margin-bottom:12px}
.sp-pdf-nav span{font-size:14px;font-weight:700}
.sp-pdf-stage{background:#e2e8f0;max-height:52vh;overflow:auto;display:flex;align-items:flex-start;justify-content:center;border-radius:12px;padding:10px}
#spPdfCanvas{display:block;max-width:100%;height:auto;box-shadow:0 2px 14px #0003;background:white}
.sp-pdf-actions{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}
.sp-pdf-actions button{min-height:44px;flex:1 1 150px}
@media(max-width:740px){.sp-editor-crop-scroll{height:43dvh;max-height:none;min-height:245px}.sp-editor-tools button{flex:1 1 27%}.sp-pdf-stage{max-height:50dvh}.sp-pdf-actions button{flex:1 1 42%}}

/* Original single-image rectangle crop: explicit mobile zoom and bottom navigation. */
.image-editor .canvas-holder canvas{max-width:none;width:100%;height:auto}
.sp-simple-nav button{flex:1 1 80px;min-height:42px}
.sp-simple-nav button.active{background:#e6f7f5;border-color:#00878b;color:#006c72}

/* Crop fix: keep 4-corner handles inside a padded scrollable viewport. */
.sp-editor-crop-scroll{padding:24px!important;overflow:auto!important;overscroll-behavior:contain;scrollbar-width:thin}
#spCornerCanvas{width:auto;max-width:none;max-height:none;height:auto;display:block;margin:0 auto;touch-action:none;user-select:none;-webkit-user-select:none}
.sp-editor-tools button[data-sp^="corner"]{flex:1 1 22%;min-width:78px}
@media(max-width:740px){.sp-editor-crop-scroll{height:47dvh;min-height:260px}.sp-editor-tools button[data-sp^="corner"]{flex:1 1 21%}}

/* One large editable preview. Full screen on mobile and desktop, touch-sized crop handles. */
#spPhotoModal.sp-editor-modal{padding:0;align-items:stretch;justify-content:stretch}
#spPhotoModal .sp-editor-panel{width:100vw;max-width:none;height:100dvh;max-height:100dvh;border-radius:0;padding:clamp(10px,2vw,22px);display:flex;flex-direction:column;overflow:auto}
#spPhotoModal .sp-editor-head{flex:none;margin-bottom:10px}
#spPhotoModal .sp-editor-head p{max-width:800px}
#spPhotoModal .sp-editor-layout{flex:1;min-height:0;grid-template-columns:minmax(0,1fr) minmax(240px,300px);gap:16px}
#spPhotoModal .sp-editor-left{min-width:0;display:flex;flex-direction:column;min-height:0}
#spPhotoModal .sp-editor-crop-scroll{height:auto;max-height:none;min-height:260px;flex:1;background:#0b1626;padding:28px!important}
#spPhotoModal .sp-editor-right{min-width:0;overflow-y:auto}
#spPhotoModal .sp-editor-footer{flex:none;background:white;position:sticky;bottom:0;z-index:2;padding:12px 0 0}
#spPhotoModal .sp-editor-tools{max-height:128px;overflow-y:auto}
#spPhotoModal .sp-editor-tools button{min-height:48px;touch-action:manipulation}
#spPhotoModal .sp-editor-slider input{min-height:38px}
#spPhotoModal #spEditorSave{min-height:50px}
@media(max-width:740px){
 #spPhotoModal .sp-editor-panel{padding:10px;overflow:auto}
 #spPhotoModal .sp-editor-head h2{font-size:19px}
 #spPhotoModal .sp-editor-head p{font-size:11px}
 #spPhotoModal .sp-editor-layout{display:flex;flex-direction:column;overflow:visible;flex:1;gap:8px}
 #spPhotoModal .sp-editor-left{flex:none;min-height:0}
 #spPhotoModal .sp-editor-crop-scroll{height:46dvh;max-height:none;min-height:245px;flex:none;padding:26px!important}
 #spPhotoModal .sp-editor-tools{max-height:110px;overflow:auto;flex:none}
 #spPhotoModal .sp-editor-tools button{min-height:48px;flex:1 1 28%}
 #spPhotoModal .sp-editor-right{display:grid;grid-template-columns:1fr 1fr;gap:5px 10px;overflow:visible}
 #spPhotoModal .sp-editor-right .sp-editor-slider{grid-column:1 / -1;margin:0}
 #spPhotoModal .sp-editor-right select{margin:0;min-height:46px}
 #spPhotoModal .sp-editor-footer{position:sticky;bottom:0;margin-top:10px;box-shadow:0 -8px 14px #fff}
 #spPhotoModal .sp-editor-footer-actions{width:100%}
 #spPhotoModal .sp-editor-footer-actions button{flex:1 1 40%;min-height:49px}
}

/* One large, unmissable primary action immediately after enhancement options. */
#spPhotoModal .sp-editor-main-action{margin:13px 0 15px;padding:10px;border:2px solid #0c777f;border-radius:14px;background:#eafbf7;display:flex;flex-direction:column;gap:5px}
#spPhotoModal .sp-editor-main-action button{width:100%;min-height:62px;font-size:17px;font-weight:800;border:2px solid #074b54;border-radius:11px;box-shadow:0 4px 0 #074b54;touch-action:manipulation}
#spPhotoModal .sp-editor-main-action span{font-size:12px;color:#235969;text-align:center}
#spPhotoModal .sp-editor-footer-actions #spEditorSave{display:none!important}
@media(max-width:740px){#spPhotoModal .sp-editor-main-action{position:sticky;top:0;z-index:8}#spPhotoModal .sp-editor-main-action button{min-height:58px}}
/* All edit effects already redraw on the main crop canvas: suppress the old duplicate. */
#spPhotoModal .sp-editor-preview{display:none!important}

/* 2026-11 Scan & Print: crop overlay and actions must stay within the viewport. */
#spPhotoModal.sp-editor-modal{align-items:flex-start!important;justify-content:center!important;overflow:hidden!important;padding:0!important;min-height:0!important}
#spPhotoModal .sp-editor-panel{height:min(100dvh,780px)!important;max-height:min(100dvh,780px)!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;margin:0 auto!important;box-sizing:border-box!important}
#spPhotoModal .sp-editor-layout{flex:1 1 auto!important;min-height:0!important;overflow:hidden!important}
#spPhotoModal .sp-editor-left{overflow:hidden!important;min-height:0!important}
#spPhotoModal .sp-editor-crop-scroll{min-height:0!important;flex:1 1 auto!important;overflow:auto!important;overscroll-behavior:contain}
#spPhotoModal .sp-editor-right{overflow-y:auto!important;overscroll-behavior:contain}
#spPhotoModal .sp-editor-footer{flex:none!important;position:static!important;bottom:auto!important;order:3;display:flex!important;align-items:center!important;gap:10px!important;border-top:1px solid #d7e5ed!important;margin-top:8px!important;padding:10px 0 0!important;box-shadow:none!important;z-index:4;background:#fff!important;flex-wrap:wrap!important}
#spPhotoModal .sp-editor-main-action{order:2;position:static!important;margin:0!important;flex:0 0 auto;min-width:215px;max-width:330px;padding:5px!important;border:2px solid #067d80!important;background:#eafbf7!important;border-radius:12px!important}
#spPhotoModal .sp-editor-main-action button{min-height:49px!important;border:1px solid #09565e!important;border-radius:8px!important;box-shadow:none!important;font-size:15px!important}
#spPhotoModal .sp-editor-main-action span{font-size:10px!important}
#spPhotoModal #spEditorStatus{flex:1 1 155px;order:1}
#spPhotoModal .sp-editor-footer-actions{order:3;margin-left:auto;align-items:center}
#spPhotoModal .sp-editor-footer-actions button{min-height:45px!important}
#spPhotoModal .sp-editor-tools{flex:0 1 auto!important;max-height:100px!important;overflow:auto!important}
@media(max-width:740px){
 #spPhotoModal .sp-editor-panel{height:min(100dvh,740px)!important;max-height:min(100dvh,740px)!important;padding:9px!important}
 #spPhotoModal .sp-editor-layout{display:flex!important;flex-direction:column!important;overflow:hidden!important;gap:5px!important}
 #spPhotoModal .sp-editor-left{flex:1 1 56%!important;min-height:125px!important}
 #spPhotoModal .sp-editor-crop-scroll{height:auto!important;min-height:100px!important}
 #spPhotoModal .sp-editor-tools{max-height:62px!important;overflow-x:auto!important;overflow-y:hidden!important;flex-wrap:nowrap!important;scrollbar-width:thin}
 #spPhotoModal .sp-editor-tools button{flex:0 0 auto!important;min-width:90px;min-height:44px!important}
 #spPhotoModal .sp-editor-right{flex:1 1 40%!important;display:grid!important;grid-template-columns:1fr 1fr!important;overflow-y:auto!important;min-height:100px!important;align-content:start}
 #spPhotoModal .sp-editor-right .sp-editor-slider{grid-column:1 / -1}
 #spPhotoModal .sp-editor-footer{padding-top:8px!important;display:grid!important;grid-template-columns:1fr 1.5fr!important;gap:7px!important}
 #spPhotoModal #spEditorStatus{grid-column:1 / -1;order:1;font-size:11px}
 #spPhotoModal .sp-editor-main-action{grid-column:2;order:3;min-width:0;max-width:none;width:100%;padding:3px!important}
 #spPhotoModal .sp-editor-main-action button{min-height:50px!important;font-size:13px!important}
 #spPhotoModal .sp-editor-main-action span{display:none}
 #spPhotoModal .sp-editor-footer-actions{grid-column:1;grid-row:2;order:2;width:100%;margin:0}
 #spPhotoModal .sp-editor-footer-actions button{min-height:49px!important;width:100%;flex:1 1 100%!important}
}
/* Critical: prevent horizontal toolbars from inflating the mobile editor to >100vw. */
#spPhotoModal .sp-editor-layout,#spPhotoModal .sp-editor-left,#spPhotoModal .sp-editor-right,#spPhotoModal .sp-editor-crop-scroll,#spPhotoModal .sp-editor-tools{width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important}
#spPhotoModal .sp-editor-tools{display:flex!important;min-width:0!important}
#spPhotoModal .sp-editor-crop-scroll{display:block!important;}
