/* StroyKalk v872: PTO editors follow their available panel width. */
@media screen {
  /* Long project codes and organization names must wrap inside the scaled A4
     preview just as normal words do; the table keeps its existing columns. */
  body.id-page main :is([class*="sheet"], [class*="paper"]) :is(th, td) {
    overflow-wrap: anywhere;
    word-break: normal;
  }
  /* Equipment rows can live beside an A4 preview even on a wide monitor. */
  body.equipment-test-page-v579 .equipment-items-v579 {
    container-type: inline-size;
  }
  body.equipment-test-page-v579 .equipment-item-v579 > label {
    min-width: 0;
  }
  body.equipment-test-page-v579 .equipment-item-v579 input {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }
  @container (max-width: 1050px) {
    body.equipment-test-page-v579 .equipment-item-v579,
    body.individual-equipment-test-page-v584 .equipment-item-v579 {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.equipment-test-page-v579 .equipment-item-v579 > button {
      grid-column: 2;
      justify-self: end;
    }
  }
  @container (max-width: 380px) {
    body.equipment-test-page-v579 .equipment-item-v579,
    body.individual-equipment-test-page-v584 .equipment-item-v579 {
      grid-template-columns: minmax(0, 1fr);
    }
    body.equipment-test-page-v579 .equipment-item-v579 > button {
      grid-column: auto;
      justify-self: stretch;
    }
  }

  /* Date inputs must include their padding in the grid track width. */
  .complexact-page .ct-field > :is(input, select, textarea) {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100%;
  }
  .complexact-page .ct-panel {
    container-type: inline-size;
  }
  .complexact-page .ct-timeline {
    container-type: inline-size;
  }
  .complexact-page .ct-matrix {
    container-type: inline-size;
  }
  .complexact-page .ct-matrix-node {
    overflow: visible;
    overflow-wrap: anywhere;
  }
  @container (max-width: 640px) {
    .complexact-page .ct-matrix-row {
      grid-template-columns: minmax(0, 1fr);
      gap: 5px;
    }
    .complexact-page .ct-matrix-arrow {
      transform: rotate(90deg);
    }
    .complexact-page .ct-matrix-status {
      width: fit-content;
      max-width: 100%;
      text-align: left;
    }
  }
  .complexact-page .ct-timeline-row {
    grid-template-columns: 74px minmax(0, 1fr) auto;
    min-width: 0;
  }
  .complexact-page .ct-timeline-row > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  @container (max-width: 480px) {
    .complexact-page .ct-timeline-row {
      grid-template-columns: minmax(0, 1fr) auto;
    }
    .complexact-page .ct-timeline-row > div {
      grid-column: 1 / -1;
      grid-row: 2;
    }
  }
  @container (max-width: 640px) {
    .complexact-page :is(.ct-grid3, .ct-grid4) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  @container (max-width: 380px) {
    .complexact-page :is(.ct-grid2, .ct-grid3, .ct-grid4) {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  /* Editable test tables retain useful fields inside their existing scroller.
     The older mobile input rule removed their 90px minimum. */
  body.id-page.wst-page-v633 .wst-table-scroll-v633 input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 110px !important;
  }
  /* SPZ has long status labels and editable document codes in local tables.
     Preserve readable columns instead of squeezing controls to 25–60px. */
  body.id-page.fireid-page .ct-table-wrap input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 110px !important;
  }
  body.id-page.fireid-page .ct-table-wrap select {
    min-width: 130px !important;
  }
  body.id-page.fireid-page .ct-table-wrap input.fs-cell-wide {
    min-width: 180px !important;
  }
  body.id-page.mountj-page-v623 .mountj-table-wrap-v623 input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 110px !important;
  }
  body.id-page.mountj-page-v623 .mountj-table-wrap-v623 select {
    min-width: 130px !important;
  }
  body.id-page.earthj-page-v620 .earthj-table-wrap-v620 input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 110px !important;
  }
  body.id-page.earthj-page-v620 .earthj-table-wrap-v620 select {
    min-width: 130px !important;
  }
  body.id-page.complexact-page .ct-table-wrap input:not([type="checkbox"]):not([type="radio"]),
  body.id-page.flt-page-v630 .flt-table-wrap-v630 input:not([type="checkbox"]):not([type="radio"]),
  body.id-page.aosc-page .aosc-table-scroll :is(input, textarea):not([type="checkbox"]):not([type="radio"]) {
    min-width: 110px !important;
  }
  body.id-page.complexact-page .ct-table-wrap select,
  body.id-page.flt-page-v630 .flt-table-wrap-v630 select,
  body.id-page.aosc-page .aosc-table-scroll select {
    min-width: 130px !important;
  }
  body.cbk-page-v558 .cbk-form-v558 label:has(> input[type="checkbox"]) {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 9px;
  }
  body.cbk-page-v558 .cbk-form-v558 input[type="checkbox"] {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 2px 0 0;
    padding: 0;
  }

  .mountj-editor-v623,
  .pjr-editor-v590,
  .earthj-editor-v620,
  .akz-editor-v644,
  .geoj-editor-v642 {
    container-type: inline-size;
  }
  @container (max-width: 640px) {
    .mountj-page-v623 :is(.mountj-row-v623, .mountj-lab-v623),
    .pjr-page-v590 :is(.pjr-entry-grid-v590, .pjr-subrow-v590),
    .earthj-page-v620 .earthj-row-v620,
    .akz-page-v644 :is(.akz-row-v644, .akz-lab-v644),
    .geoj-page-v642 :is(.geoj-row-v642, .geoj-lab-v642) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  @container (max-width: 380px) {
    .mountj-page-v623 :is(.mountj-row-v623, .mountj-lab-v623),
    .pjr-page-v590 :is(.pjr-entry-grid-v590, .pjr-subrow-v590),
    .earthj-page-v620 .earthj-row-v620,
    .akz-page-v644 :is(.akz-row-v644, .akz-lab-v644),
    .geoj-page-v642 :is(.geoj-row-v642, .geoj-lab-v642) {
      grid-template-columns: minmax(0, 1fr);
    }
    .mountj-page-v623 :is(.mountj-row-v623, .mountj-lab-v623) .span2,
    .pjr-page-v590 .pjr-entry-grid-v590 .span2,
    .earthj-page-v620 .earthj-row-v620 .span2,
    .akz-page-v644 :is(.akz-row-v644, .akz-lab-v644) .span2,
    .geoj-page-v642 :is(.geoj-row-v642, .geoj-lab-v642) .span2 {
      grid-column: auto;
    }
  }
  .pjr-page-v590 .pjr-calendar-v590 {
    grid-template-columns: repeat(7, minmax(44px, 1fr));
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .strength-page-v575 .strength-dual-result-v575 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .strength-page-v575 .strength-dual-result-v575 > article {
    container-type: inline-size;
    min-width: 0;
  }
  @container (max-width: 360px) {
    .strength-page-v575 .strength-result-options-v575 {
      grid-template-columns: minmax(0, 1fr);
    }
  }
  .flt-page-v630 .flt-structure-head-v630 {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .flt-page-v630 .flt-structure-head-v630 > div {
    flex: 1 1 180px;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .flt-page-v630 .flt-structure-head-v630 > button {
    flex: 0 0 auto;
    max-width: 100%;
  }
  body.ks3c-page .ks3c-panel {
    container-type: inline-size;
  }
  body.ks3c-page .ks3c-adjust-form > label {
    min-width: 0;
  }
  body.ks3c-page .ks3c-adjust-form input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  body.pto-object-page .pto-import-filebox {
    flex-wrap: wrap;
  }
  body.pto-object-page .pto-import-filebox > div {
    flex: 1 1 240px;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body.pto-object-page .pto-import-filebox > button {
    flex: 0 0 auto;
    max-width: 100%;
  }
  @container (max-width: 1100px) {
    body.ks3c-page .ks3c-adjust-form {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
  @container (max-width: 600px) {
    body.ks3c-page .ks3c-adjust-form {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  @container (max-width: 380px) {
    body.ks3c-page .ks3c-adjust-form {
      grid-template-columns: minmax(0, 1fr);
    }
  }
}

@media screen and (max-width: 640px) {
  body.id-registry-page-v530 .idr-doc-toolbar-v530 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  body.id-registry-page-v530 .idr-doc-toolbar-v530 > :is(input, select) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Keep both A4 paging buttons on a complete row at the 44px touch size. */
  .aosc-page .aosrc-preview-card .aosrc-preview-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start;
  }
  .aosc-page .aosc-preview-tools-v652 {
    justify-content: flex-start;
    flex-wrap: wrap;
    max-width: 100%;
  }
}

@media screen and (max-width: 767px) {
  body.ks3c-page .ks3c-toolbar > select.grow,
  body.ks6a-page .ks6a-toolbar > select.grow {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  /* This four-column editor has no wrapper in its original HTML. Make the
     table itself a local scroller so values are editable at phone widths. */
  body.id-page.strength-page-v575 .strength-table-v575 {
    display: block !important;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.id-page.strength-page-v575 .strength-table-v575 input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 100px !important;
  }
  .strength-page-v575 .strength-dual-result-v575 {
    grid-template-columns: minmax(0, 1fr);
  }
}
