/* Staff and admin panel layout for phones and small tablets. */
@media (max-width: 960px) {
  html,
  body {
    overflow-x: hidden;
  }

  #container {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
  }

  #header {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  #header > * {
    min-width: 0;
    max-width: 100%;
  }

  #logo {
    order: 1;
    float: none;
    max-width: 100%;
    height: auto;
    text-align: center;
    padding: 8px 8px 0;
    box-sizing: border-box;
  }

  #logo img {
    max-width: calc(100vw - 16px);
    max-height: 52px;
  }

  #header p,
  #info {
    order: 2;
    float: none !important;
    display: block !important;
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    margin: 8px auto;
    line-height: 1.45;
    box-sizing: border-box;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  #nav,
  #sub_nav,
  .jb-overflowmenu {
    height: auto;
    white-space: normal;
    width: auto;
    max-width: 100%;
  }

  #nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    box-sizing: border-box;
  }

  #nav > li,
  #nav .active,
  #nav .inactive {
    display: block;
    flex: 1 1 100%;
    min-width: 0;
    width: auto;
    height: auto !important;
    margin: 0 !important;
    padding: 0;
    position: relative;
    box-sizing: border-box;
    float: none;
    overflow: visible;
  }

  #nav > li > a {
    display: block;
    min-height: 40px;
    height: auto;
    line-height: 1.25;
    padding: 8px 10px;
    box-sizing: border-box;
    white-space: normal !important;
  }

  #nav li.inactive:hover > ul {
    visibility: hidden;
    opacity: 0;
  }

  #nav li.inactive.open > ul {
    visibility: visible;
    opacity: 1;
    position: static;
    display: block;
    width: 100%;
    left: auto;
    margin-top: 4px;
    box-shadow: none;
    transition: none;
  }

  #nav .inactive li a {
    display: block;
    min-height: 40px;
    line-height: 40px;
    padding-top: 0;
    padding-bottom: 0;
  }

  #sub_nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    box-sizing: border-box;
    line-height: 1.3;
  }

  #sub_nav > li {
    display: block;
    flex: 1 1 100%;
    margin: 0;
    min-width: 0;
  }

  #sub_nav > li > a,
  #sub_nav > li + li > a {
    display: block;
    margin: 0 !important;
    min-height: 36px;
    line-height: 1.3;
    padding: 8px 8px 8px 22px;
    box-sizing: border-box;
    background-position: 4px 50%;
  }

  #content {
    padding: 10px 8px 20px;
    overflow-wrap: anywhere;
  }

  #content img,
  .thread-body img,
  .redactor-editor img {
    max-width: 100%;
    height: auto;
  }

  table.list.is-stacked {
    display: block;
    width: 100% !important;
    max-width: 100%;
    background: transparent;
    border: none;
  }

  table.list.is-stacked caption {
    display: block;
  }

  table.list.is-stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  table.list.is-stacked tbody,
  table.list.is-stacked tr,
  table.list.is-stacked td {
    display: block;
    width: auto !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  table.list.is-stacked tbody tr {
    border: 1px solid #ccc;
    margin: 0 0 10px;
    padding: 6px 8px;
    background: #fff;
  }

  table.list.is-stacked td {
    border: none;
    padding: 4px 0;
    background: transparent !important;
  }

  table.list.is-stacked td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: #666;
  }

  table.list.is-stacked td[data-label=""]::before {
    display: none;
  }

  table.list.is-stacked .truncate,
  table.list.is-stacked td div {
    max-width: 100% !important;
    white-space: normal;
  }

  table.form_table,
  table.ticket_info,
  table.custom-data,
  table[width="940"],
  table.fixed {
    width: 100% !important;
    max-width: 100%;
    table-layout: auto;
  }

  table.form_table > tbody > tr,
  table.ticket_info > tbody > tr,
  table.grid.form > tbody > tr {
    display: flex;
    flex-direction: column;
  }

  table.form_table > tbody > tr > td,
  table.form_table > tbody > tr > th,
  table.ticket_info > tbody > tr > td,
  table.ticket_info > tbody > tr > th,
  table.grid.form > tbody > tr > td,
  table.grid.form > tbody > tr > th,
  table.fixed > tbody > tr > td,
  table.fixed > thead > tr > th {
    display: block;
    width: 100% !important;
    height: auto !important;
    box-sizing: border-box;
  }

  table.ticket_info table,
  table.custom-data {
    width: 100% !important;
  }

  table.ticket_info table th,
  table.custom-data th {
    width: 38%;
  }

  table.ticket_info th,
  table.ticket_info td,
  table.custom-data th,
  table.custom-data td,
  table.form_table td,
  table.form_table th {
    overflow-wrap: anywhere;
  }

  #content input[type="text"],
  #content input[type="password"],
  #content input[type="email"],
  #content input[type="search"],
  #content input[type="tel"],
  #content input[type="number"],
  #content input[type="file"],
  #content select,
  #content textarea,
  .dialog input[type="text"],
  .dialog input[type="password"],
  .dialog select,
  .dialog textarea {
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  table.form_table input[type="text"],
  table.form_table input[type="password"],
  table.form_table input[type="email"],
  table.form_table select,
  table.form_table textarea,
  .dialog input[type="text"],
  .dialog select,
  .dialog textarea {
    width: 100% !important;
  }

  #content input[type="checkbox"],
  #content input[type="radio"] {
    width: auto !important;
  }

  #content input[type="submit"],
  #content input[type="button"],
  #content input[type="reset"],
  #content .button,
  #content .action-button {
    height: auto;
    min-height: 36px;
    line-height: 1.3;
    padding: 6px 10px;
    margin: 4px 4px 0 0;
  }

  .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .redactor-box,
  .redactor-toolbar,
  .redactor-editor,
  .redactor-box textarea {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .redactor-toolbar {
    white-space: normal;
    height: auto;
  }

  ul.tabs {
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
  }

  ul.tabs li {
    flex: 1 1 auto;
    min-width: 0;
    height: auto;
    bottom: 0;
  }

  ul.tabs.vertical,
  ul.tabs.vertical.left {
    width: 100% !important;
    float: none !important;
  }

  .sticky.bar .content,
  .sticky.bar .pull-right,
  .sticky.bar .flush-right {
    float: none;
    width: auto;
    max-width: 100%;
  }

  .sticky.bar .content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .sticky.bar.fixed {
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .dialog,
  .dialog#popup,
  .dialog.size-normal,
  .dialog.size-large,
  .dialog.size-xl,
  .dialog#advanced-search {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    left: 8px !important;
    margin-left: 0 !important;
    box-sizing: border-box;
  }

  .pull-right {
    float: none;
  }

  #footer {
    padding: 12px 8px 20px;
  }

  #loginBox {
    position: relative;
    left: auto;
    top: auto;
    width: calc(100% - 24px) !important;
    max-width: 400px;
    margin: 24px auto !important;
  }

  #loginBox form {
    width: 100%;
  }

  #loginBox input[type="text"],
  #loginBox input[type="password"],
  #loginBox input[type="email"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  #loginBox .button,
  #loginBox button {
    float: none !important;
    display: block;
    width: 100%;
    height: auto;
    min-height: 42px;
    margin: 8px 0 0;
    box-sizing: border-box;
  }

  #company {
    position: static;
    left: auto;
    bottom: auto;
    width: auto;
    margin: 16px 0 0;
  }

  #poweredBy {
    position: static;
    right: auto;
    bottom: auto;
    display: block;
    width: fit-content;
    margin: 16px auto 0;
  }
}
