*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

img,
video,
canvas {
  height: auto;
}

.signature-paper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(180px, 100%);
  min-height: 68px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  vertical-align: middle;
}

.signature-img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 58px;
  object-fit: contain;
}

.signature-pad-wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

.signature-pad {
  display: block;
  width: 100%;
  height: 250px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
}

#modalTtd {
  --bs-modal-width: min(92vw, 540px);
}

#modalTtd .modal-dialog {
  max-width: min(92vw, 540px);
}

#modalTtd .modal-body {
  overflow-x: hidden;
}

#modalTtd .signature-pad-wrap {
  max-width: 480px;
}

#modalTtd .signature-pad {
  height: 220px;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

.container,
.container-fluid {
  min-width: 0;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

.table {
  vertical-align: middle;
}

.ts-wrapper,
.ts-control,
.ts-dropdown {
  max-width: 100%;
}

@media (max-width: 767.98px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    font-size: .95rem;
  }

  .card,
  .modal-content,
  .dropdown-menu,
  .alert,
  .toast,
  .list-group-item,
  .accordion-item {
    overflow-wrap: anywhere;
  }

  .table th,
  .table td {
    overflow-wrap: anywhere;
  }

  .btn,
  .form-control,
  .form-select,
  .input-group-text {
    min-height: 42px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    white-space: normal;
  }

  .btn-group,
  .btn-toolbar,
  .input-group,
  .pagination {
    flex-wrap: wrap;
  }

  .dropdown-menu,
  .toast-container {
    max-width: calc(100vw - 1rem);
  }

  main,
  .container,
  .container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .row {
    --bs-gutter-x: 1rem;
  }

  .card,
  .surface-card,
  .hero-card,
  .request-row,
  .chart-card {
    border-radius: 8px !important;
  }

  .table:not(.no-mobile-scroll) {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .table:not(.no-mobile-scroll) thead,
  .table:not(.no-mobile-scroll) tbody,
  .table:not(.no-mobile-scroll) tfoot {
    width: max-content;
    min-width: 100%;
  }

  .table:not(.no-mobile-scroll) th,
  .table:not(.no-mobile-scroll) td {
    white-space: nowrap;
  }

  .table:not(.no-mobile-scroll) td .btn,
  .table:not(.no-mobile-scroll) td .badge {
    white-space: nowrap;
  }

  .signature-paper {
    width: 150px;
    min-height: 58px;
    padding: 5px 8px;
  }

  .signature-img {
    max-height: 48px;
  }

  .signature-pad {
    height: 220px;
  }

  .d-flex:has(> .btn),
  .d-flex:has(> form),
  .d-flex:has(> .input-group),
  .d-flex:has(> .form-control),
  .d-flex:has(> .form-select) {
    flex-wrap: wrap;
  }

  .justify-content-between:has(.btn),
  .align-items-center:has(.btn) {
    gap: .75rem;
  }
}

@media (max-width: 767.98px) {
  h1,
  .h1 {
    font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2rem);
  }

  h2,
  .h2 {
    font-size: clamp(1.35rem, 1.08rem + 1vw, 1.75rem);
  }

  h3,
  .h3 {
    font-size: clamp(1.18rem, 1rem + .75vw, 1.45rem);
  }

  .lead {
    font-size: 1rem;
  }

  .p-5 {
    padding: 1.5rem !important;
  }

  .p-4 {
    padding: 1rem !important;
  }

  .py-5 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  .py-4 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  .gap-4 {
    gap: 1rem !important;
  }

  .btn,
  .form-control,
  .form-select,
  .input-group-text {
    min-height: 44px;
  }

  .btn {
    width: auto;
  }

  .btn.w-100,
  form .btn[type="submit"] {
    width: 100%;
  }

  .input-group {
    width: 100% !important;
  }

  .input-group > .form-control,
  .input-group > .form-select {
    min-width: 0;
  }

  .nav-tabs,
  .nav-pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs .nav-link,
  .nav-pills .nav-link {
    white-space: nowrap;
  }

  .modal-footer,
  .modal-header {
    gap: .5rem;
  }

  .modal-footer > * {
    margin: 0;
  }

  .dropdown-menu {
    font-size: .95rem;
  }

  .pagination {
    justify-content: center;
    gap: .25rem;
  }

  .pagination .page-link {
    min-width: 38px;
    text-align: center;
  }

  .toast-container {
    left: .5rem !important;
    right: .5rem !important;
    bottom: .5rem !important;
    padding: 0 !important;
  }
}

@media (max-width: 575.98px) {
  main,
  .container,
  .container-fluid {
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }

  .row {
    --bs-gutter-x: .75rem;
    --bs-gutter-y: .75rem;
  }

  .card-body {
    padding: 1rem;
  }

  .card-header,
  .card-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .d-flex.align-items-center,
  .d-flex.justify-content-between,
  .d-flex.align-items-end {
    gap: .75rem;
  }

  .d-flex.align-items-center:has(.btn),
  .d-flex.justify-content-between:has(.btn),
  .d-flex.align-items-end:has(.btn) {
    align-items: stretch !important;
  }

  .d-flex.align-items-center:has(.btn) > .btn,
  .d-flex.justify-content-between:has(.btn) > .btn,
  .d-flex.align-items-end:has(.btn) > .btn {
    flex: 1 1 auto;
  }

  .form-label {
    margin-bottom: .35rem;
  }

  .table:not(.no-mobile-scroll) {
    font-size: .875rem;
  }

  [style*="width:300px"],
  [style*="width: 300px"],
  [style*="width:200px"],
  [style*="width: 200px"],
  [style*="max-width:200px"],
  [style*="max-width: 200px"],
  [style*="max-width:260px"],
  [style*="max-width: 260px"],
  [style*="max-width:500px"],
  [style*="max-width: 500px"] {
    width: 100% !important;
    max-width: 100% !important;
  }
}
