/* Isolated, compact work areas: preview first on phones, settings beside it on desktop. */
.nt-tool {position:relative;min-width:0;}
.nt-tool [hidden] {display:none!important;}
.nt-tool .nt-row {display:flex;align-items:end;gap:8px;min-width:0;}
.nt-tool .nt-row .field {flex:1;min-width:0;}
.nt-tool .nt-row .btn {flex:0 0 auto;}
.nt-tool .nt-row .fitem__meta {flex:1;}
.nt-tool .field {margin:0;min-width:0;}
.nt-tool .field label,.nt-tool label {font-size:12px;line-height:1.3;}
.nt-tool .input,.nt-tool .select {min-height:40px;padding:8px 10px;font-size:14px;width:100%;box-sizing:border-box;}
.nt-tool .btn {font-size:14px;min-height:42px;padding:9px 14px;white-space:normal;}
.nt-tool .btn--primary {font-weight:700;}
.nt-tool .fitem {display:flex;flex-direction:row;gap:8px;padding:8px;margin:0 0 10px;}
.nt-tool .fitem__thumb {width:38px;height:40px;flex:0 0 38px;font-size:11px;}
.nt-tool .fitem__name {font-size:12px;}
.nt-tool .fitem__body {min-width:0;overflow:hidden;}
.nt-tool .fitem__meta {font-size:11px;}
.nt-text-work,.nt-text-result {display:flex;flex-direction:column;gap:10px;min-height:0;}
.nt-tool #extractedText {width:100%;box-sizing:border-box;min-height:100px;max-height:none;height:35dvh;resize:none;overflow:auto;font-size:15px;line-height:1.6;padding:12px;}
.nt-tool .nt-notice {font-size:12px;line-height:1.5;padding:8px 10px;border-radius:8px;background:var(--bg);margin:0;}
.nt-image-work {display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:20px;align-items:center;min-height:0;}
.nt-preview {display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;background:repeating-conic-gradient(#f0f0ed 0% 25%,#fff 0% 50%) 0/18px 18px;border-radius:12px;overflow:hidden;height:min(52dvh,530px);}
.nt-preview canvas {display:block;max-width:100%;max-height:100%;object-fit:contain;width:auto;height:auto;}
.nt-settings {display:flex;flex-direction:column;gap:10px;min-width:0;}
.nt-pair {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:center;}
.nt-type-row {display:grid;grid-template-columns:100px minmax(0,1fr);gap:8px;align-items:center;}
.nt-tool .nt-check {display:flex;align-items:center;gap:8px;min-height:42px;}
.nt-tool input[type=file] {max-width:100%;font-size:12px;}
.nt-tool input[type=range] {width:100%;margin:8px 0;accent-color:var(--brand);}
.nt-tool input[type=color] {padding:4px;}
.nt-tool [aria-pressed=true] {background:var(--brand);border-color:var(--brand);color:#fff;}
.nt-busy {position:absolute;inset:0;z-index:20;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:14px;background:rgba(255,255,255,.94);border-radius:12px;text-align:center;padding:20px;}
.nt-spinner {width:36px;height:36px;border:3px solid #e3ebe5;border-top-color:var(--brand);border-radius:50%;animation:nt-spin .8s linear infinite;}
@keyframes nt-spin {to {transform:rotate(360deg);}}
@media(prefers-reduced-motion:reduce){.nt-spinner{animation:none;border-style:dotted;}}
.document-page.document-active:has(.nt-tool) .workspace {overflow:visible;max-height:none;padding-bottom:0;}
@media(max-width:879px){
 .document-page.document-active:has(.nt-tool) {padding-bottom:env(safe-area-inset-bottom);}
 .document-page.document-active:has(.nt-tool) .workspace {display:flex;flex-direction:column;overflow:hidden;padding:6px 0;}
 .document-page.document-active:has(.nt-tool) .nt-tool {display:flex;flex-direction:column;flex:1;min-height:0;}
 .nt-tool .fitem {flex-direction:row!important;flex:0 0 auto;}
 .nt-tool .fitem__thumb {width:30px;height:34px;flex-basis:30px;}
 .nt-tool .fitem .btn {min-height:36px;font-size:11px;padding:6px 8px;}
 .nt-tool .fitem__body {width:auto!important;flex:1;}
 .nt-image-work {display:flex;flex-direction:column;align-items:stretch;gap:8px;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;}
 .nt-preview {flex:1 0 130px;min-height:130px;max-height:30dvh;height:25dvh;}
 .nt-settings {flex:0 0 auto;gap:6px;}
 .nt-settings .nt-row .btn {flex:1;}
 .nt-tool .btn {font-size:12px;min-height:38px;padding:7px 9px;}
 .nt-tool #btnWatermarkDownload {font-size:15px;min-height:46px;position:sticky;bottom:0;z-index:2;box-shadow:0 0 0 5px var(--surface,#fff);}
 .nt-tool .input,.nt-tool .select {min-height:36px;font-size:13px;padding:6px 8px;}
 .nt-tool .field label {font-size:11px;}
 .nt-tool input[type=range] {margin:5px 0;}
 .nt-tool #watermarkDimensions {margin:0;text-align:center;}
 .nt-text-work {flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;}
 .nt-text-work > .nt-row {flex:0 0 auto;}
 .nt-text-result {flex:1 0 140px;min-height:140px;}
 .document-page .workspace #extractedText {flex:1;min-height:60px;max-height:none;height:auto;}
 .nt-tool .nt-text-result .nt-row {flex:0 0 auto;position:sticky;bottom:0;background:var(--surface,#fff);padding-top:4px;}
 .nt-tool #ocrLink {font-size:12px;line-height:1.4;flex:0 0 auto;}
 /* The shared editor-fit rule already reserves the actual ad below the page. */
 .document-page.document-active:has(.nt-tool) .document-stage {padding-bottom:0;}
 .document-page.document-active:has(.nt-tool) .document-stage > .ad {max-height:120px;}
}
