/* WT14: the 293 non-Office tools use document scrolling on narrow screens.
   Desktop workspaces are deliberately outside this stylesheet's media scope.
   Only layout containers are released; image/canvas pixels, coordinates,
   hidden states and processing behaviour remain owned by the existing tools. */
@media (max-width:991px) {
  html body[data-tool-slug]:not([data-tool-slug="office"]) > .main-wrapper {
    height:auto;min-height:0;max-height:none;overflow:visible;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) > .main-wrapper > .page-wrapper,
  html body[data-tool-slug]:not([data-tool-slug="office"]) > .main-wrapper > .page-wrapper > .p-4 {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool.its {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool > .its-body,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool > #b4-sec-form {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-work,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-work,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .sp-layout,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-layout,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-word-layout {
    display:flex;flex-direction:column;flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;overscroll-behavior:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-main,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-preview,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .sp-main,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .sp-time-main,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-main,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-word-main {
    order:0;flex:0 0 auto;width:100%;min-width:0;height:auto;min-height:0;max-height:none;overflow:visible;overscroll-behavior:auto;scrollbar-gutter:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-panel,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-panel,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .sp-panel,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-panel,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-word-panel {
    order:1;flex:0 0 auto;width:100%;max-width:none;height:auto;min-height:0;max-height:none;overflow:visible;border-left:0;border-top:1px solid var(--wt-line,var(--its-border));
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-panel-body,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b45-panel-scroll {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;overscroll-behavior:auto;scrollbar-gutter:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-panel-foot,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b45-panel-foot {
    position:static;flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;margin-top:0;z-index:auto;overscroll-behavior:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-panel-foot::before {display:none;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-footer-stack {gap:10px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-footer-stack > .its-btn,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-footer-stack > .its-primary {
    min-height:44px;height:auto;max-width:100%;white-space:normal;overflow-wrap:anywhere;
  }

  /* Uploads and accepted-file queues grow with their content. No queue row or
     "add more" control is trapped behind a fixed-height list or footer. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-welcome {
    flex:0 0 auto;height:auto;min-height:clamp(320px,52vh,520px);max-height:none;overflow:visible;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-upload-box {min-width:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-view,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-card,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-list,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-ex-list,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-qrd-body,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-qrd-list,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-media-list,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-results {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;overscroll-behavior:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-card {width:100%;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-item-actions {flex-wrap:wrap;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-item-name,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-item-meta,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .ix-batch-settings-row b {
    white-space:normal;overflow-wrap:anywhere;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) #qd-root:has(#qd-list:empty):has(#qd-cam-box[hidden]) .its-main {
    flex:0 0 auto;min-height:0;overflow:visible;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) #qd-root .wt-qrd-body {flex:0 0 auto;}

  /* Text remains an actual editor with its own readable initial height and
     resize handle; the surrounding input/result sections use document flow. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-grid,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-diff-inputs,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-grid,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-grid.is-stack,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-oc-grid {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-auto-rows:auto;overflow:visible;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-pane {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-area,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-grid .wt-text-area,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-code-area .wt-code,
  html body[data-tool-slug]:not([data-tool-slug="office"]) #sg-root .wt-text-area {
    flex:0 0 auto;height:clamp(240px,42vh,400px);min-height:220px;max-height:none;resize:vertical;overflow:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-code-area {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-grid .wt-doc,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-grid .wt-stats,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-diff-result,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-secret-main,
  html body[data-tool-slug]:not([data-tool-slug="office"]) #sg-root .sg-content,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #wd-result {
    flex:0 0 auto;height:auto;min-height:0;max-height:none;overflow:visible;
  }
  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:0 0 auto;height:360px;min-height:280px;max-width:100%;overflow:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-hce-stage iframe {height:100%;min-height:280px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #wd-preview,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #wd-code {
    flex:0 0 auto;height:420px;min-height:300px;max-height:none;resize:vertical;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #wd-warnings,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool #wd-error,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-message,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-sc-history,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5n-tree,
  html body[data-tool-slug]:not([data-tool-slug="office"]) #sm-root .sm-diff {
    max-height:none;overflow:visible;
  }

  /* Preserve local horizontal navigation for wide tables, diagrams and raw
     code. Their natural height must not form a second vertical workspace. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-calc-table-scroll,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .nt-table-wrap,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .sp-table-scroll,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b5-table,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-diff-view,
  html body[data-tool-slug]:not([data-tool-slug="office"]) #sg-root .sg-table {
    flex:0 0 auto;min-width:0;max-width:100%;height:auto;min-height:0;max-height:none;overflow:auto;overscroll-behavior:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) #sg-root .sg-graph {max-width:100%;overflow:auto;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-grid .wt-doc {
    min-width:0;max-width:100%;overflow:auto;overscroll-behavior:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .jt-kids {margin-left:4px;padding-left:8px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .jt-key {overflow-wrap:anywhere;}

  /* Image editing/preview containers keep room to work. Actual image, canvas,
     mask and video dimensions are intentionally not overridden here. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-canvas-area,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-media-stage,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-rec-stage,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-oc-stage {
    flex:0 0 auto;height:auto;min-height:260px;max-height:none;max-width:100%;overflow:auto;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-crop-view,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-crop-result,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-edit-view,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-ic-result {
    height:auto;min-height:240px;max-height:none;
  }
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-preview {min-height:260px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-bar-right,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-text-actions,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-stage-actions,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .sp-pagination {
    max-width:100%;min-width:0;flex-wrap:wrap;
  }
  /* The global base layer sets native font-size:var(--text-sm)!important.
     Override that token on these fields only, preserving other small labels
     and specialised larger calculator/unit inputs. */
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input):not([type]),
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="text"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="number"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="search"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="url"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="email"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="tel"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="password"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="date"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="time"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input:not(.wt-sc-input):not(.wt-unit-input)[type="datetime-local"],
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool textarea,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool textarea.wt-text-area,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool textarea.wt-code,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool textarea.sp-input,
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .b4-panel textarea {--text-sm:16px;font-size:16px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool input.wt-sc-input {--text-sm:16px;font-size:16px;min-height:44px;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-url input {min-height:44px;min-width:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-url .its-btn {min-height:44px;flex-shrink:0;white-space:normal;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-inline-2 {grid-template-columns:repeat(2,minmax(0,1fr));min-width:0;}
  html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-inline-2 > div {min-width:0;max-width:100%;}
  @media (max-width:640px) {
    html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-url input {flex:none;height:auto;width:100%;}
    html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .its-url .its-btn {height:auto;width:100%;}
  }
  @media (max-width:480px) {
    html body[data-tool-slug]:not([data-tool-slug="office"]) .wt-tool .wt-inline-2 {grid-template-columns:minmax(0,1fr);}
  }
}
