:root {
  --gw-tap-size: 46px;
  --gw-mobile-gap: 0.75rem;
  --gw-mobile-radius: 12px;
  --gw-mobile-line: #e5e7eb;
  --gw-mobile-soft: #f8fafc;
  --gw-mobile-text-soft: #64748b;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

.table-responsive,
.qs-table-scroll {
  -webkit-overflow-scrolling: touch;
}

.qs-table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.qs-table-scroll > table {
  margin-bottom: 0;
}

.select2-container,
.select2-container .selection,
.select2-container .select2-selection {
  max-width: 100% !important;
}

.nav-tabs,
.nav-pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}

.nav-tabs .nav-link,
.nav-pills .nav-link {
  border-radius: 10px;
}

.dropdown-menu {
  max-width: calc(100vw - 16px);
  max-height: 70vh;
  overflow: auto;
}

.card,
.modal-content,
.small-box,
.info-box {
  overflow: hidden;
}

.form-control,
.custom-select,
.custom-file-label,
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple,
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  max-width: 100%;
}

.btn,
.btn-sm,
.btn-xs,
button,
input[type="submit"],
input[type="button"],
a.btn {
  touch-action: manipulation;
}

@media (max-width: 991.98px) {
  body {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
  }

  .wrapper,
  .content-wrapper,
  .content,
  .container-fluid,
  .container {
    max-width: 100%;
  }

  .row {
    margin-left: -0.4rem;
    margin-right: -0.4rem;
  }

  .row > [class*="col-"] {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .content-header {
    padding: 10px 8px 8px;
  }

  .content-header .row {
    display: block;
    margin: 0;
  }

  .content-header .col-sm-6 {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  .content-header .col-sm-6 + .col-sm-6 {
    margin-top: 8px;
  }

  .content-header h1,
  .content-header h2,
  .content-header h3 {
    font-size: 1.1rem;
    line-height: 1.3;
  }

  .breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0.45rem 0.65rem;
  }

  .breadcrumb-item {
    font-size: 12px;
  }

  .main-header .navbar-nav {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .main-header .navbar-nav .nav-item {
    margin-bottom: 0;
  }

  .main-header .btn,
  .main-header .nav-link,
  .main-header .dropdown-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .main-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    margin-left: 0 !important;
    width: min(88vw, 320px) !important;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    z-index: 1042;
  }

  body.sidebar-open .main-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.42);
    z-index: 1040;
  }

  .content-wrapper,
  .main-header,
  .main-footer {
    margin-left: 0 !important;
  }

  .main-footer {
    font-size: 12px;
    line-height: 1.45;
    padding: 0.8rem;
  }

  .main-footer .float-right {
    float: none !important;
    display: block !important;
    margin-top: 4px;
  }

  .card,
  .small-box,
  .info-box {
    border-radius: var(--gw-mobile-radius);
  }

  .card-header,
  .card-body,
  .card-footer {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .btn,
  .btn-sm,
  .btn-xs,
  a.btn,
  button,
  input[type="submit"],
  input[type="button"] {
    min-height: var(--gw-tap-size);
    border-radius: 11px;
    padding: 0.5rem 0.85rem;
    font-weight: 700;
  }

  .btn-group,
  .btn-toolbar,
  .input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .btn-group > .btn,
  .btn-toolbar > .btn,
  .input-group > .btn,
  .input-group > .form-control,
  .input-group > .custom-select {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
  }

  .form-group,
  .input-group,
  .custom-control,
  .form-check {
    margin-bottom: 0.75rem;
  }

  label,
  .col-form-label {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 0.35rem;
  }

  .form-control,
  .custom-select,
  .custom-file-label,
  .select2-container .select2-selection--single,
  .select2-container .select2-selection--multiple,
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  input[type="number"],
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    min-height: var(--gw-tap-size);
    font-size: 15px;
    border-radius: 11px;
  }

  .select2-container .select2-selection--single .select2-selection__rendered {
    line-height: 42px !important;
    padding-left: 12px !important;
  }

  .select2-container .select2-selection--single .select2-selection__arrow {
    height: 44px !important;
  }

  .table {
    font-size: 13px;
  }

  .table th,
  .table td {
    vertical-align: middle;
    white-space: nowrap;
  }

  .table td .btn,
  .table td .btn-sm,
  .table td .btn-xs {
    min-height: 40px;
    margin: 2px;
  }

  .table td .btn i,
  .table td .btn-sm i {
    margin-right: 2px;
  }

  .qs-mobile-card-table {
    border: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .qs-mobile-card-table thead {
    display: none !important;
  }

  .qs-mobile-card-table tbody,
  .qs-mobile-card-table tr,
  .qs-mobile-card-table td {
    display: block;
    width: 100% !important;
  }

  .qs-mobile-card-table tbody tr {
    background: #fff;
    border: 1px solid var(--gw-mobile-line);
    border-radius: 14px;
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.6rem;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.06);
  }

  .qs-mobile-card-table tbody tr:nth-child(even),
  .qs-mobile-card-table tbody tr:nth-child(odd) {
    background: #fff;
  }

  .qs-mobile-card-table tbody td {
    border: 0 !important;
    border-bottom: 1px dashed #e7edf5 !important;
    margin: 0;
    padding: 0.5rem 0 !important;
    white-space: normal !important;
  }

  .qs-mobile-card-table tbody td:last-child {
    border-bottom: 0 !important;
  }

  .qs-mobile-card-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    line-height: 1.2;
    color: var(--gw-mobile-text-soft);
    font-weight: 700;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  div.dataTables_wrapper div.dataTables_filter,
  div.dataTables_wrapper div.dataTables_length,
  div.dataTables_wrapper div.dataTables_info,
  div.dataTables_wrapper div.dataTables_paginate {
    float: none;
    text-align: left;
    width: 100%;
    margin-top: 0.45rem;
  }

  div.dataTables_wrapper div.dataTables_filter input,
  div.dataTables_wrapper div.dataTables_length select {
    width: 100% !important;
    margin-left: 0 !important;
    min-height: 42px;
  }

  .dataTables_paginate .pagination {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .pagination .page-link {
    min-height: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
  }

  .modal {
    padding-right: 0 !important;
  }

  .modal-dialog {
    margin: 0 !important;
    max-width: 100vw !important;
    min-height: 100vh;
  }

  .modal-content {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .modal-body {
    max-height: calc(100vh - 138px);
    overflow: auto;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
  }

  .modal-footer .btn {
    flex: 1 1 46%;
  }

  .alert,
  .callout,
  .small-box,
  .info-box {
    margin-bottom: 0.7rem;
  }

  .collapse:not(.show) {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .content {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
  }

  .container-fluid,
  .container {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .breadcrumb {
    border-radius: 10px;
  }

  .card-header h1,
  .card-header h2,
  .card-header h3,
  .card-title {
    font-size: 1rem;
  }

  .table td,
  .table th {
    font-size: 12px;
  }
}

html.gw-landscape .modal-body {
  max-height: calc(100vh - 120px);
}

html.gw-touch .btn,
html.gw-touch .nav-link,
html.gw-touch .dropdown-item,
html.gw-touch .page-link {
  min-height: 40px;
}
