/* StroyKalk · Executive documentation mobile hardening v582 */
@media (max-width: 860px){
  html,body{max-width:100%;overflow-x:hidden}
  body.id-page{overflow-x:clip}
  body.id-page *,body.id-page *::before,body.id-page *::after{box-sizing:border-box}
  body.id-page main,body.id-page section,body.id-page article,body.id-page .wrap,
  body.id-page [class*="-grid"],body.id-page [class*="workspace"],body.id-page [class*="editor"],
  body.id-page [class*="panel"],body.id-page [class*="card"],body.id-page [class*="toolbar"]{min-width:0}

  /* Breadcrumbs must never clip long current-page names. */
  body.id-page .id-breadcrumbs{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px 8px;margin-bottom:18px;line-height:1.35;max-width:100%}
  body.id-page .id-breadcrumbs>*{min-width:0;max-width:100%}
  body.id-page .id-breadcrumbs a,body.id-page .id-breadcrumbs b{overflow-wrap:anywhere;word-break:normal}
  body.id-page .id-breadcrumbs>span{flex:0 0 auto}

  /* Typography and content width. */
  body.id-page .wrap{width:min(calc(100% - 24px),1180px)}
  body.id-page .id-hero h1{font-size:clamp(30px,9.2vw,44px);line-height:1.04;letter-spacing:-.035em;overflow-wrap:anywhere}
  body.id-page .id-hero-lead{font-size:16px;line-height:1.55}
  body.id-page .id-section h2{font-size:clamp(27px,7.6vw,34px);line-height:1.08;overflow-wrap:anywhere}
  body.id-page h3{overflow-wrap:anywhere}
  body.id-page p,body.id-page li,body.id-page td,body.id-page th{overflow-wrap:anywhere}

  /* iOS/Safari: prevent focus zoom and make fields genuinely touch-friendly. */
  body.id-page input:not([type="checkbox"]):not([type="radio"]),
  body.id-page select,body.id-page textarea{font-size:16px!important;max-width:100%!important;min-width:0!important}
  body.id-page input:not([type="checkbox"]):not([type="radio"]),body.id-page select{min-height:44px}
  body.id-page textarea{min-height:84px}

  /* Hidden custom radios inherited width:100% from form rules and could enlarge the page. */
  body.id-page .hat-method-v561 input[type="radio"],body.id-page .hat-result-v561 input[type="radio"],
  body.id-page .pipeline-method-v573 input[type="radio"],body.id-page .pipeline-result-v573 input[type="radio"],
  body.id-page .strength-result-v575 input[type="radio"],body.id-page .thermal-result-v581 input[type="radio"]{
    width:1px!important;height:1px!important;min-height:0!important;max-width:1px!important;margin:0!important;padding:0!important;
  }

  /* All data tables scroll inside their own card instead of widening the viewport. */
  body.id-page [class*="table-wrap"],body.id-page .id-stage2-table-wrap-v524,
  body.id-page .idc-table-edit-v528,body.id-page .thermal-table-wrap-v581{
    display:block;max-width:100%;width:100%;overflow-x:auto!important;overflow-y:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain;scrollbar-width:thin
  }
  body.id-page .id-stage2-table-wrap-v524>.id-pro-table{min-width:620px;width:100%;max-width:none}

  /* Work bars and multi-action rows remain operable without pushing the body. */
  body.id-page .hat-toolbar-v561,body.id-page .hat-export-v561,body.id-page .hat-nav-v561,
  body.id-page .wap-toolbar-v563,body.id-page .wap-export-v563,body.id-page .wap-nav-v563,
  body.id-page .cbj-tools-v556,body.id-page .cbj-export-v556,
  body.id-page .wsj-tools-v554,body.id-page .wsj-export-v554,
  body.id-page .cbk-tools-v558,body.id-page .cbk-export-v558,
  body.id-page .ojr-tools-v549,body.id-page .ojr-export-v549,
  body.id-page .idr-toolbar-v530,body.id-page .idr-dialog-actions-v530,body.id-page .idr-drawer-actions-v530{
    max-width:100%;flex-wrap:wrap
  }

  /* Preview stays within the card; A4 is scaled by page JS, never by body scrolling. */
  body.id-page .hat-preview-v561,body.id-page [class*="preview-stage"],body.id-page [class*="preview-frame"]{max-width:100%;min-width:0}
  body.id-page .hat-preview-stage-v561,body.id-page .wap-preview-stage-v563,
  body.id-page .cbj-preview-stage-v556,body.id-page .wsj-preview-stage-v554,
  body.id-page .cbk-preview-stage-v558,body.id-page .ojr-preview-stage-v549{overflow:hidden}
  body.id-page .hat-preview-toolbar-v561 button,body.id-page [class*="preview-toolbar"] button{min-width:40px;min-height:40px}

  /* Dialogs / side panels. */
  body.id-page dialog{max-width:calc(100vw - 20px)!important;max-height:calc(100dvh - 20px)!important;margin:auto}
  body.id-page .idr-drawer-v530{width:min(520px,100vw);max-width:100vw}
  body.id-page .idr-drawer-body-v530{overscroll-behavior:contain}

  /* Horizontal step/toc controls get local scrolling, not page scrolling. */
  body.id-page .idc-step-list-v528,body.id-page .idc-toolbar-v528,
  body.id-page .idr-nav-v530,body.id-page .id-stage3-trace-v526{
    max-width:100%;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch
  }

  /* Ad containers cannot dictate page width before/after ad rendering. */
  body.id-page .site-ad-v259,body.id-page [id^="yandex_rtb_"],body.id-page [class*="ad-shell"],body.id-page [class*="ad-main"]{max-width:100%;min-width:0;overflow:hidden}
}

@media (max-width: 560px){
  body.id-page .wrap{width:min(calc(100% - 18px),1180px)}
  body.id-page .id-hero{padding-top:22px;padding-bottom:30px}
  body.id-page .id-hero h1{font-size:clamp(29px,9.4vw,39px)}
  body.id-page .id-hero-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  body.id-page .id-hero-actions .id-btn{width:100%;min-width:0;min-height:46px;padding:9px 11px;text-align:center;line-height:1.25}
  body.id-page .id-badge-row{gap:6px}
  body.id-page .id-badge-row span{max-width:100%;font-size:11px;white-space:normal}
  body.id-page .id-section{padding-top:38px;padding-bottom:38px}
  body.id-page .id-toc-v523 .wrap{align-items:stretch}
  body.id-page .id-toc-v523 a{min-height:40px;justify-content:center;text-align:center}
  body.id-page .tac-status-grid-v569,body.id-page .tac-steps-v569{grid-template-columns:1fr}
  body.id-page .idr-dashboard-v530{grid-template-columns:1fr 1fr}
  body.id-page .idr-drawer-docs-v530{grid-template-columns:1fr}
  body.id-page .idr-drawer-actions-v530 button{min-height:44px}
  body.id-page .idr-dialog-actions-v530{display:grid;grid-template-columns:1fr;width:100%}
  body.id-page .idr-dialog-actions-v530 button{width:100%;min-height:44px}
}

@media (max-width: 380px){
  body.id-page .id-hero-actions{grid-template-columns:1fr}
  body.id-page .id-hero h1{font-size:30px}
  body.id-page .id-section h2{font-size:27px}
  body.id-page .hat-tabs-v561{grid-template-columns:1fr}
  body.id-page .idr-dashboard-v530{grid-template-columns:1fr}
}

@media print{
  /* Mobile support sheet must never alter A4 print/export geometry. */
  body.id-page .hat-sheet-v561,body.id-page .aosr-sheet,body.id-page .wap-sheet-v563,
  body.id-page .cbj-sheet-v556,body.id-page .wsj-sheet-v554,body.id-page .cbk-sheet-v558,
  body.id-page .ivc-sheet-v552,body.id-page .ojr-sheet-v549{max-width:none!important}
}
@media (max-width: 860px){
  /* Every radio/checkbox inside generator editors uses intrinsic control width; custom cards style the sibling, not the input itself. */
  body.id-page .hat-editor-v561 input[type="radio"],body.id-page .hat-editor-v561 input[type="checkbox"]{
    width:auto!important;max-width:none!important;min-width:0!important;min-height:0!important
  }
}
