/* Editor layout: tool navigation / working surface / output controls. */
:root{--accent:#6552e5;--line:#e3e6ef;background:#f6f7fb;color:#24283d}
.app-shell{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100dvh}.app-content{min-width:0}.app-sidebar{position:sticky;top:0;height:100dvh;padding:28px 18px;background:#fff;border-inline-end:1px solid var(--line);overflow:auto;scrollbar-width:thin;z-index:2}
.side-brand{margin:0 8px 40px;gap:11px;font-size:22px;letter-spacing:-.9px;color:#222641}.side-brand .brand-icon{width:40px;height:40px;flex:none}.brand-muted{color:#797d94;font-weight:500}.brand-icon{object-fit:contain}.mobile-brand{display:none}
.mobile-menu-summary{display:none}.side-navigation{display:flex;flex-direction:column;gap:26px}.app-sidebar .tool-tabs{display:flex;flex-direction:column;gap:6px;width:100%;padding:0;margin:0;background:none;border:0;border-radius:0}
.app-sidebar .side-link,.app-sidebar .tool-tabs button{position:relative;display:flex;align-items:center;justify-content:flex-start;gap:12px;width:100%;min-height:48px;padding:12px 14px;background:transparent;border:1px solid transparent;border-radius:10px;color:#656c84;font-size:14px;text-align:start;text-decoration:none;box-shadow:none;line-height:1.55;font-weight:500;flex:none}
.app-sidebar .side-link svg{width:21px;height:21px;margin:0;color:inherit;flex:none}.app-sidebar .side-link .nav-label{font-size:14px;font-weight:500;margin:0;padding:0;background:transparent;color:inherit;min-width:0}
.app-sidebar .side-link:hover:not(:disabled){background:#f5f6fa;color:#33384e;border-color:transparent;box-shadow:none}.app-sidebar .side-link.active,.app-sidebar .tool-tabs button.active{background:#efedfe;color:#5d4bd7;border-color:#e9e4fc;box-shadow:none}.app-sidebar .side-link.active .nav-label{font-weight:650}.app-sidebar .side-link.active:before{content:"";position:absolute;inset-inline-start:-1px;top:14px;bottom:14px;width:3px;border-radius:3px;background:var(--accent)}
.side-group h2{font-size:12px;line-height:1.5;font-weight:600;color:#9095aa;margin:0 14px 10px}.app-sidebar .more-tools-grid{display:flex;flex-direction:column;gap:6px}.app-sidebar .more-tool-card>strong{display:block;margin:0}.app-sidebar .more-tool-card{align-items:center}
.app-content>.header{max-width:none;min-height:68px;margin:0 34px;padding:10px 0;border-bottom:1px solid var(--line);justify-content:flex-end}.app-content>.header .header-right{margin-inline-start:auto}.app-content>main{max-width:1320px;margin:0 auto;padding:26px 34px 0}.app-content>footer{max-width:1320px;margin:0 auto;padding:22px 34px 30px}.page-heading{margin-bottom:22px}h1{font-size:30px;letter-spacing:-1px;font-weight:700}
.workbench,.tool-workbench{grid-template-columns:minmax(0,1fr) 310px;gap:20px}.canvas-panel,.settings,.tool-source,.tool-settings,.tool-result,.scan-pages{border-radius:16px;box-shadow:0 3px 12px #262d4503}.canvas-toolbar,.tool-panel-heading{min-height:60px}.dropzone,.tool-drop{background:#fbfcfe;border-color:#d2d7e6;border-radius:12px}.dropzone,.empty-state{min-height:400px}.paste-icon,.tool-mark{background:#f0edff;color:var(--accent);border-radius:16px}.primary-button{background:var(--accent);border-radius:9px}.primary-button:hover:not(:disabled){background:#5542d1}.segments button.selected{color:#5c47d4}.local-pill{background:#fff;color:#727b92;border-color:var(--line);font-size:12px;gap:0}.local-pill:before{content:none}.under-workbench{margin-top:16px}.tool-help{margin-top:18px}
.workbench,.tool-workbench{align-items:start}.tool-source{display:flex;flex-direction:column}.tool-source .tool-drop{display:flex;flex-direction:column;justify-content:center}.tool-settings #tool-process{margin-top:6px}
@media(min-width:1081px) and (max-width:1280px){.app-shell{grid-template-columns:228px minmax(0,1fr)}.app-sidebar{padding:28px 14px}.side-brand{font-size:20px;gap:9px}.side-brand .brand-icon{width:36px;height:36px}.app-content>main{padding:28px 24px 0}.app-content>.header{margin:0 24px}.app-content>footer{padding-inline:24px}.workbench,.tool-workbench{grid-template-columns:minmax(0,1fr) 290px;gap:16px}.settings,.tool-settings{padding:20px}}
@media(max-width:1080px){.app-shell{grid-template-columns:minmax(0,1fr);min-height:100dvh;align-content:start}.app-content{display:contents}.app-content>.header{grid-row:1;margin:0;padding:16px 24px;min-height:76px;justify-content:space-between}.mobile-brand{display:flex}.app-sidebar{grid-row:2;position:relative;top:auto;height:auto;margin:0 24px;padding:14px 0 0;background:transparent;border:0;overflow:visible;z-index:auto}.side-brand{display:none}.mobile-menu-summary{display:flex;align-items:center;gap:11px;min-height:48px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:#fff;color:#424961;font-size:14px;font-weight:600;cursor:pointer;list-style:none}.mobile-menu-summary::-webkit-details-marker{display:none}.mobile-menu-summary>svg{width:20px;height:20px;color:var(--accent)}.mobile-menu-label{flex:1;min-width:0}.menu-chevron{width:7px;height:7px;border-inline-end:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg);margin-inline-end:4px}.tool-menu[open] .menu-chevron{transform:rotate(225deg)}.tool-menu[open] .mobile-menu-summary{border-end-start-radius:0;border-end-end-radius:0;border-bottom:0}.side-navigation{padding:12px;background:#fff;border:1px solid var(--line);border-top:0;border-radius:0 0 10px 10px;gap:16px}.app-sidebar .more-tools-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px}.side-group h2{margin-bottom:8px}.app-content>main{grid-row:3;padding:24px 24px 0;width:100%}.app-content>footer{grid-row:4;width:100%;padding:20px 24px 28px}.workbench,.tool-workbench{grid-template-columns:minmax(0,1fr) 310px;gap:18px}.dropzone,.empty-state{min-height:350px}h1{font-size:28px}}
@media(max-width:760px){.app-content>.header{padding:16px 18px;min-height:70px;flex-wrap:nowrap;gap:10px}.app-sidebar{margin:0 18px;padding-top:12px}.app-content>main{padding:22px 18px 0}.app-content>footer{padding:18px 18px 24px}.workbench,.tool-workbench{grid-template-columns:1fr;gap:16px}.page-heading{margin-bottom:20px;gap:10px}h1{font-size:25px;letter-spacing:-.6px}.dropzone,.empty-state,.tool-drop,#tool-empty{min-height:300px}.app-sidebar .more-tools-grid{grid-template-columns:1fr}.app-sidebar .side-link{min-height:46px;padding:11px 12px}.mobile-menu-summary{min-height:46px}.local-pill{font-size:12px}.app-content>.header .header-right{width:auto;margin-inline-start:auto}.app-content>.header .brand{font-size:20px;gap:8px}.app-content>.header .brand-icon{width:32px;height:32px}}
@media(max-width:350px){.app-content>.header .brand{font-size:19px;gap:7px}.app-content>.header .brand-icon{width:30px;height:30px}.app-content>.header{gap:8px}.image-grid{grid-template-columns:1fr}}
@media print{.app-shell{display:block}.app-sidebar{display:none!important}.app-content{display:block}}

/* Let the file occupy the working surface; controls keep their natural height. */
.side-group h2{color:#68718a}
.field-note,.file-hint,.output-summary,.image-meta,.tool-settings p,#source-details{color:#59677f}
.settings-heading{margin-bottom:18px}.settings .field{margin-bottom:16px}.settings .advanced{margin-bottom:14px}.download-area{margin-top:4px}
.dropzone,.empty-state{min-height:340px}
.tool-drop,#tool-empty{min-height:340px}
.has-files .dropzone{min-height:0;border:0;background:transparent}
.image-grid{padding:0;gap:16px;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));scrollbar-width:thin}
.image-preview{height:190px;background:#f0f3f8;padding:16px}
.image-grid.single-image{grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible}
.single-image .image-card{border:0;background:transparent;border-radius:10px}
.single-image .image-preview{height:clamp(300px,30vw,390px);border:1px solid var(--line);border-radius:10px;padding:20px}
.single-image .image-info{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:16px;row-gap:4px;padding:14px 4px 0;align-items:center}
.single-image .image-info>:not(.image-actions){grid-column:1}
.single-image .image-meta{justify-content:flex-start;gap:14px;margin:0}
.single-image .image-actions{grid-column:2;grid-row:1/span 2;margin:0;padding:0;border:0;gap:8px}
.single-image [data-move],.single-image [data-pdf-move]{display:none}
.single-image .pdf-page-label{margin:0}
.single-image .pdf-thumb[data-rotation="90"],.single-image .pdf-thumb[data-rotation="270"]{max-width:75%;max-height:75%}
.icon-button{width:40px;height:40px;border-radius:8px}
.has-files:has(.single-image) #canvas-status,.has-files:has(.single-image) #pdf-canvas-status{display:none}
.has-files:has(.single-image) .canvas-bottom{justify-content:flex-end}
.tool-drop:has(#source-view:not([hidden])){border-style:solid;background:#f0f3f8;min-height:0}
#source-image{max-height:460px;display:block;margin:auto}
.result-actions{display:flex;flex-direction:column;gap:12px;grid-column:2}

@media(max-width:760px){
  .app-content>main{padding-top:18px}.page-heading{margin-bottom:18px}
  .canvas-toolbar,.tool-panel-heading{min-height:54px;padding:8px 14px;gap:6px}
  .workspace-label{gap:6px}.canvas-toolbar .small-icon{display:none}
  .dropzone,.empty-state,.tool-drop,#tool-empty{min-height:250px}
  .empty-state{padding:22px 12px}.dropzone,.tool-drop{margin:12px}
  .image-grid{grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible}
  .image-preview{height:200px}
  .single-image .image-preview{height:clamp(200px,34dvh,280px);padding:14px}
  .single-image .image-info{column-gap:10px;padding-top:12px}
  .canvas-bottom{padding:8px 14px;align-items:center}
  .canvas-bottom .text-button{flex-shrink:0;white-space:nowrap}
  .has-files .download-area,#tool-result:not([hidden]) .result-actions{
    position:fixed;inset-inline:0;bottom:0;z-index:4;margin:0;
    padding:12px 18px max(12px,env(safe-area-inset-bottom));
    background:#fff;border-top:1px solid #dce1ed;box-shadow:0 -6px 24px #2026410d;
  }
  .has-files .download-area .output-summary{margin-bottom:8px}
  #tool-result:not([hidden]) .result-actions{flex-direction:row;gap:10px}
  .result-actions>button{flex:1;min-width:0;white-space:normal}
  body:has(.workbench.has-files:not([hidden])) .app-content>footer,
  body:has(#tool-result:not([hidden])) .app-content>footer{padding-bottom:140px}
  html:has(.workbench.has-files:not([hidden])),html:has(#tool-result:not([hidden])){scroll-padding-bottom:140px}
  input,select,summary,button{scroll-margin-bottom:140px}
  .result-actions{grid-column:1}
  #source-image{max-height:360px}
}
@media print{.download-area,.result-actions{position:static!important;box-shadow:none}}
.javascript-notice{position:relative;z-index:5;margin:0;padding:16px 22px;background:#fff1ed;border-bottom:2px solid #c49989;color:#783d2c;text-align:center;font-size:14px;line-height:1.6}
.error-page{display:grid;place-items:center;min-height:100dvh;padding:24px}
.error-panel{max-width:560px;width:100%;padding:42px;border:2px solid #625b6b;background:#faf8f0;box-shadow:5px 5px 0 #b4aab8;text-align:center}
.error-panel .brand{justify-content:center;gap:12px}
.error-panel .error-number{font-size:72px;line-height:1;font-weight:750;letter-spacing:-4px;color:#625b6b;margin:34px 0 20px}
.error-panel h1{font-size:28px;line-height:1.3;margin:0 0 12px;color:#34313f}
.error-panel p:not(.error-number){color:#716a7e;line-height:1.7;margin:0 0 26px}
.error-home{display:inline-flex;justify-content:center;align-items:center;text-decoration:none}
@media(max-width:540px){.error-panel{padding:32px 20px}.error-panel h1{font-size:24px}}
