/* Small-screen layout for the calculator. Desktop rules remain in main_page.css. */
@media (max-width: 767px) {
  html, body {
    height: auto !important;
    min-height: 100%;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    --header-height: 76px;
    --resultdiv-width: 100%;
    --resultdiv-col1-width: auto;
  }

  .header {
    position: relative;
    height: var(--header-height);
  }

  .logo {
    display: block;
    width: min(55vw, 210px);
    max-height: 56px;
    object-fit: contain;
    margin: 18px 0 0 14px;
  }

  #authlink {
    position: absolute;
    top: 16px;
    right: 8px;
    width: auto !important;
    height: auto;
    line-height: normal;
    padding: 8px;
  }

  #tabs {
    box-sizing: border-box;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 8px !important;
    left: auto;
  }

  #menudiv, #tabs > .ui-tabs-nav, #tabs ul {
    position: static !important;
    float: none !important;
    width: 100% !important;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 4px 0 !important;
    margin: 0 !important;
  }

  #menudiv > ul > li:first-child {
    display: none;
  }

  #tabs ul li, #tabs .normlink {
    float: none;
    border: 0;
    white-space: normal;
  }

  #tabs ul a { min-height: 44px; display: inline-flex; align-items: center; }

  #Calc, #Users, #ArtReg, .page {
    box-sizing: border-box;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  #pick_system {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 4px;
  }

  #heat_system, #heat_sections { width: 100%; min-width: 0; }

  #heat_sections > h3 {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    line-height: 1.35;
    padding: 12px 8px;
    margin: 6px 0;
  }

  #heat_sections > h3 a {
    display: inline;
    white-space: normal;
  }

  #heat_sections > h3 .ui-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
  }

  #div_watervolume, #div_expansion, #div_pressure, #div_choices {
    box-sizing: border-box;
    width: calc(100% - 12px);
    max-width: calc(100% - 12px);
    margin-left: 6px;
    padding: 8px !important;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  #div_watervolume > table, #div_expansion > table,
  #div_pressure > table, #div_choices > table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  #div_watervolume td, #div_expansion td,
  #div_pressure td, #div_choices td {
    max-width: 0;
    overflow-wrap: anywhere;
  }

  .ResultDiv {
    box-sizing: border-box;
    position: static;
    width: 100%;
    min-height: 0;
    padding: 16px 12px 24px;
    margin-top: 16px;
    display: none;
  }

  .ResultDiv .col-1-3 { display: none; }
  .ResultDiv .col-2-3 { float: none; width: 100%; }
  .ResultDiv center { text-align: left; }
  .ResInfoDiv { padding-top: 20px; }
  .ResultDivTblCss { table-layout: fixed; }
  .ResultDivTblCss td { overflow-wrap: anywhere; vertical-align: middle; }
  .ResTblDiv .ResultDivTblCss td:first-child { width: auto !important; }
  .ResTblDiv .ResultDivTblCss td:last-child { width: 118px; }

  input, select, button { max-width: 100%; }
  input[type="checkbox"], input[type="radio"] { min-width: 18px; min-height: 18px; }
  #print-dialog { max-width: calc(100vw - 32px); }
  .ui-dialog { max-width: calc(100vw - 16px) !important; }
}
