:root {
  --bmf-admin-green: #17AE7D;
  --bmf-admin-bg: #F5F5F5;
  --bmf-admin-border: #E5E7EB;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
}

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

.main-content {
  min-width: 0;
}

.pwa-install-prompt {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10050;
  border: 0;
  border-radius: 999px;
  background: var(--bmf-admin-green);
  color: #fff;
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(23, 174, 125, 0.28);
}

.pwa-install-prompt[hidden] {
  display: none !important;
}

.pwa-install-prompt img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
}

.table-container,
.table-scroll,
.table-responsive,
.dataTables_wrapper {
  max-width: 100%;
}

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

.table-container .table,
.table-scroll .table,
.table-responsive .table {
  margin-bottom: 0;
}

.custom-modal {
  padding: 16px;
}

.custom-modal-content {
  max-width: min(700px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-dialog {
  max-width: min(var(--bs-modal-width, 700px), calc(100vw - 24px));
  margin-left: auto;
  margin-right: auto;
}

.modal-content {
  max-height: calc(100dvh - 24px);
}

.modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.form-control,
.form-select,
button,
.btn,
.filter-button,
.search-input,
.search-box input,
.chat-filter-btn {
  touch-action: manipulation;
}

@media (max-width: 991.98px) {
  body {
    overflow-x: hidden;
  }

  .nxl-container {
    width: 100%;
    max-width: 100%;
  }

  .nxl-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .dashboard-navigation h4 {
    line-height: 1.25;
  }

  .header-bar,
  .search-filter,
  .filter-container,
  .d-flex.flex-wrap {
    gap: 10px;
  }

  .search-filter {
    flex-wrap: wrap;
  }

  .search-filter > *,
  .filter-container,
  .search-input,
  .search-box,
  .search-box input {
    min-width: min(100%, 220px);
  }

  .table-container {
    border-radius: 12px;
    overflow: hidden;
  }

  .table-scroll,
  .table-responsive {
    overflow-x: auto;
  }

  .table {
    min-width: 760px;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 4px;
  }

  .admin-shortcuts {
    max-width: calc(100vw - 32px);
  }
}

@media (max-width: 767.98px) {
  .mobile-menu-toggle {
    top: 10px;
    left: 12px;
    width: 42px;
    height: 42px;
  }

  .mobile-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
  }

  .sidebar {
    max-width: min(86vw, 300px);
  }

  .nxl-header {
    min-height: 64px;
  }

  .nxl-header .header-wrapper {
    min-height: 64px;
    align-items: center;
  }

  .nxl-container {
    margin-left: 0 !important;
    padding-top: 70px;
  }

  .nxl-content {
    padding: 0 10px 18px;
  }

  .main-content {
    width: 100%;
  }

  .dashboard-navigation h4 {
    max-width: calc(100vw - 128px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .row {
    --bs-gutter-x: 0.9rem;
  }

  .form-control,
  .form-select,
  .select2-container .select2-selection--single,
  .select2-container .select2-selection--multiple {
    min-height: 44px;
  }

  textarea.form-control {
    min-height: 96px;
  }

  .btn,
  .action-btn,
  .filter-button {
    min-height: 40px;
  }

  .action-btn {
    margin-left: 4px;
  }

  .custom-modal {
    align-items: flex-start;
    padding: 10px;
    overflow-y: auto;
  }

  .custom-modal-content {
    width: 100% !important;
    max-width: 100%;
    border-radius: 12px;
    padding: 18px 14px;
    margin: 8px 0;
  }

  .modal-dialog {
    width: calc(100vw - 20px);
    margin: 10px auto;
  }

  .modal-content {
    border-radius: 12px !important;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .table {
    min-width: 680px;
  }

  .table thead th,
  .table tbody td {
    padding: 10px 8px !important;
  }

  .admin-shortcuts {
    bottom: 74px;
    right: 12px;
  }

  .pwa-install-prompt {
    left: 12px;
    right: 12px;
    bottom: 14px;
    justify-content: center;
  }
}

@media (display-mode: standalone) {
  .pwa-install-prompt {
    display: none !important;
  }
}
