/* WT14 desktop editor space allocation; WT15 adds one scoped calculator input fix.
   Use the bounded workspace's remaining height, not a fixed textarea/viewport height.
   Existing controllers own hidden/result states. Mobile flow is in the later responsive layer.
   Scope excludes Office; tool algorithms, image dimensions and output themes are unchanged. */
@media (min-width:992px){
  /* Shared text, code, HTML and OCR pages: connect every flexible height in the chain. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main:has(>.wt-text-grid),
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main:has(>.wt-code-area),
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main:has(>.wt-hce-grid),
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main:has(>.wt-oc-grid){display:flex;flex-direction:column;min-height:0;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main>.wt-text-grid,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main>.wt-hce-grid,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main>.wt-oc-grid{flex:1 1 0;min-height:0;grid-template-rows:none;grid-auto-rows:minmax(180px,1fr);overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(.wt-text-grid,.wt-hce-grid,.wt-oc-grid)>.wt-text-pane{min-height:0;min-width:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(.wt-text-grid,.wt-hce-grid,.wt-oc-grid) .wt-text-area{flex:1 1 0;min-height:0;max-height:none;height:auto;resize:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-grid :is(.wt-doc,.wt-stats){flex:1 1 0;min-height:0;max-height:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-grid :is(.wt-text-info,.wt-text-error,.wt-code-trunc){flex:0 0 auto;max-height:30%;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-code-area{flex:1 1 0;min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-code-area .wt-code{flex:1 1 0;min-height:160px;max-height:none;height:auto;resize:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-code-area>:not(.wt-code){flex:0 0 auto;}

  /* Compare tools: both input panes stretch; result panels stay independently reachable. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool.wt-diff-tool .its-main{min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool.wt-diff-tool .wt-diff-inputs{flex:1 1 0;min-height:180px;grid-auto-rows:minmax(140px,1fr);overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool.wt-diff-tool .wt-diff-inputs>.wt-text-pane{min-height:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool.wt-diff-tool .wt-diff-inputs .wt-text-area{flex:1 1 0;min-height:0;max-height:none;height:auto;resize:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root .sm-result{flex:0 0 auto;min-height:0;padding:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root:has(#sm-result:not([hidden])) .wt-diff-inputs{flex:.9 1 0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root:has(#sm-result:not([hidden])) .sm-result{display:flex;flex-direction:column;flex:1.1 1 0;min-height:220px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root #sm-result:not([hidden]){display:flex;flex-direction:column;flex:1 1 0;min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root #sm-result>*{flex-shrink:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root .sm-diff{flex:1 0 120px;min-height:120px;max-height:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root .sm-meta{max-height:140px;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root #sm-error{flex:0 0 auto;max-height:112px;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sm-root #sm-empty{margin:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#df-root .wt-diff-result{flex:1.1 1 0;min-height:200px;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#df-root .wt-diff-view{flex:1 1 0;min-height:0;max-height:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#df-root .wt-diff-empty{min-height:0;}
  /* Only the controller's initial empty view is compact. 'Identical' is a real result. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#df-root:has(#df-view>.wt-diff-empty:not(.is-same)) .wt-diff-result{flex:0 0 auto;min-height:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#df-root:has(#df-view>.wt-diff-empty:not(.is-same)) .wt-diff-view{flex:0 0 auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#df-root:has(#df-view>.wt-diff-empty:not(.is-same)) .wt-diff-empty{flex-direction:row;flex-wrap:wrap;gap:6px 12px;padding:10px 16px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#df-root:has(#df-view>.wt-diff-empty:not(.is-same)) .wt-diff-empty i{font-size:22px;}

  /* HTML's selected stacked mode and OCR's image/text view share available height. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-grid.is-stack{grid-template-rows:repeat(2,minmax(180px,1fr));}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-preview{min-height:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-stage{flex:1 1 0;min-height:80px;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-stage iframe{min-height:0;height:100%;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-console{display:flex;flex-direction:column;flex:0 1 auto;min-height:0;max-height:40%;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-console-head{flex:0 0 auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-console-body{flex:1 1 auto;min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-oc-stage{flex:1 1 0;min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-oc-progress{flex:0 0 auto;}

  /* Schema input fills the empty workspace, then gives the report its own scroll area. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sg-root .sg-content{display:flex;flex-direction:column;gap:12px;min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sg-root #sg-local{display:flex;flex-direction:column;flex:1 1 0;min-height:180px;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sg-root #sg-input{flex:1 1 0;min-height:0;max-height:none;height:auto;resize:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sg-root:has(#sg-results:not([hidden])) #sg-local{flex:.8 1 0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sg-root #sg-results:not([hidden]){flex:1.2 1 0;min-height:220px;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool#sg-root :is(#sg-empty,#sg-error,#sg-url-section){flex:0 0 auto;margin:0;}

  /* Local typography/code-image tools: editor and real preview remain concurrently usable. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(#sp-highlighter,#sp-handwriting)>.sp-main{display:flex;flex-direction:column;gap:12px;min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(#sp-highlighter,#sp-handwriting)>.sp-main>.sp-field{flex:.9 1 0;min-height:160px;margin:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(#sp-highlighter,#sp-handwriting)>.sp-main>.sp-field>textarea{flex:1 1 0;min-height:0;max-height:none;height:auto;resize:none;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(#sp-highlighter,#sp-handwriting)>.sp-main>:is(.sp-actions,.sp-status,.sp-pagination){flex:0 0 auto;margin:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(#sp-highlighter,#sp-handwriting)>.sp-main>:is(.sp-code-stage,.sp-preview){flex:1.1 1 0;min-height:180px;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #sp-handwriting:has(#hw-preview:empty)>.sp-main>.sp-field{flex:1 1 0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #sp-handwriting #hw-preview:empty{flex:0 0 auto;min-height:0;padding:0;border-width:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #sp-highlighter:has(#cs-code:empty)>.sp-main>.sp-field{flex:1 1 0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #sp-highlighter:has(#cs-code:empty) #cs-stage{flex:0 0 auto;min-height:0;}

  /* Existing file-conversion preview switches should not reserve a whole parent height twice. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-word-main{min-height:0;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #wd-result{flex:1 1 0;min-height:0;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(#wd-preview,#wd-code){flex:1 1 0;min-height:120px;height:auto;max-height:none;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #wd-warnings{flex:0 1 auto;min-height:0;max-height:25%;overflow:auto;}

  /* Secret/config generators keep dense account forms and output text in separate scroll areas. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool.b4-secret .its-main{display:flex;flex-direction:column;min-height:0;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-secret-main{flex:1 1 0;min-height:0;grid-template-rows:auto minmax(180px,1fr);overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-secret-main:has(#b4-sec-config){grid-template-rows:minmax(160px,1fr) minmax(160px,1fr) minmax(220px,1.35fr);}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-secret-main>.wt-text-pane{min-height:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-secret-fields{min-height:0;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool.b4-secret .wt-text-area{flex:1 1 0;min-height:0;height:auto;resize:none;overflow:auto;}

  /* Sitemap pasted XML and generated XML are the network family's full-text editors. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5n-main:has(#b5n-input-pane:not([hidden])) #b5n-input-pane,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5n-main:has(#b5n-xml-pane:not([hidden])) #b5n-xml-pane{display:flex;flex-direction:column;flex:1 1 0;min-height:180px;overflow:hidden;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5n-main:has(#b5n-input-pane:not([hidden])) #b5n-output,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5n-main:has(#b5n-xml-pane:not([hidden])) #b5n-output{flex:1 1 0;min-height:200px;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool :is(#b5n-input-pane,#b5n-xml-pane) .wt-text-area{flex:1 1 0;min-height:0;height:auto;resize:none;overflow:auto;}

  /* Column count still follows the existing content-width and viewport rules.
     The shared minmax rows above also apply when those rules stack the panes;
     a short desktop window scrolls within the grid instead of elongating the page. */
}

/* The desktop expression is an editable input, not a compact display label. */
@media (min-width:992px){
  html body[data-tool-slug="scientific-calculator"] .wt-tool #sc-input{
    --text-sm:20px;min-height:44px;font-size:20px;line-height:1.4;
  }
}
