.patient-filter-toggle {
  display: none;
}

@media (max-width: 900px),
  (pointer: coarse) and (max-width: 1180px),
  (min-aspect-ratio: 4/5) and (max-aspect-ratio: 5/4) and (max-width: 1180px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  .centers-page,
  .devices-page,
  .dicom-log-page,
  .stats-page,
  .settings-page,
  .mwl-setting-page,
  .page-wrap,
  .page-patient,
  .nds-page,
  .rt-page,
  body.a-plus-patients-page .page,
  body.a-plus-users-page .page {
    width: 100% !important;
    max-width: none !important;
    min-height: 100dvh;
    padding: 10px !important;
    overflow: visible !important;
  }

  .centers-page > .d-flex:first-child,
  .devices-page > .d-flex:first-child,
  .page-wrap > .d-flex:first-child,
  .stats-page > .d-flex:first-child,
  .page-patient .topbar,
  .settings-page > .settings-header,
  .nds-topbar,
  .rt-topbar,
  body.a-plus-patients-page .topbar,
  body.a-plus-users-page .topbar {
    gap: 8px !important;
    align-items: center !important;
  }

  .page-patient .topbar {
    flex-wrap: wrap !important;
  }

  .centers-page h5,
  .devices-page h5,
  .dicom-log-page h5,
  .stats-page h5,
  .page-wrap h5,
  .page-patient .topbar .title,
  .nds-title,
  .rt-title,
  body.a-plus-patients-page .topbar .title,
  body.a-plus-users-page .topbar .title {
    font-size: clamp(17px, 4.4vw, 22px) !important;
    line-height: 1.18 !important;
    margin: 0 !important;
  }

  .centers-page .btn,
  .devices-page .btn,
  .dicom-log-page .btn,
  .stats-page .btn,
  .settings-page .btn,
  .mwl-setting-page .btn,
  .page-wrap .btn,
  .page-patient .btn,
  .nds-page .btn,
  .rt-page .btn,
  body.a-plus-patients-page .btn,
  body.a-plus-users-page .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.1;
  }

  .centers-page .form-control,
  .centers-page .form-select,
  .devices-page .form-control,
  .devices-page .form-select,
  .dicom-log-page .form-control,
  .dicom-log-page .form-select,
  .stats-page .form-control,
  .stats-page .form-select,
  .settings-page input,
  .settings-page select,
  .settings-page textarea,
  .mwl-setting-page input,
  .mwl-setting-page select,
  .mwl-setting-page textarea,
  .page-wrap .form-control,
  .page-wrap .form-select,
  .page-patient input,
  .page-patient select,
  .page-patient textarea,
  .nds-page input,
  .nds-page select,
  .nds-page textarea,
  .rt-page input,
  .rt-page select,
  .rt-page textarea,
  body.a-plus-patients-page input,
  body.a-plus-patients-page select,
  body.a-plus-patients-page textarea,
  body.a-plus-users-page input,
  body.a-plus-users-page select,
  body.a-plus-users-page textarea {
    min-height: 42px;
    font-size: 16px;
  }

  .settings-page input[type="checkbox"],
  .settings-page input[type="radio"],
  .mwl-setting-page input[type="checkbox"],
  .mwl-setting-page input[type="radio"],
  .page-patient input[type="checkbox"],
  .page-patient input[type="radio"],
  .nds-page input[type="checkbox"],
  .nds-page input[type="radio"],
  .rt-page input[type="checkbox"],
  .rt-page input[type="radio"],
  body.a-plus-patients-page input[type="checkbox"],
  body.a-plus-patients-page input[type="radio"],
  body.a-plus-users-page input[type="checkbox"],
  body.a-plus-users-page input[type="radio"] {
    width: auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    flex: 0 0 auto;
  }

  .dicom-log-filters,
  .stats-page .card,
  .settings-grid,
  .page-patient .filters,
  body.a-plus-patients-page .filter,
  body.a-plus-users-page .filter {
    border-radius: 14px !important;
  }

  .dicom-log-filters .row,
  .stats-page .filter-form,
  .page-wrap form .row,
  .settings-grid,
  .nds-grid,
  .rt-grid,
  .rt-page .form,
  .rt-panels,
  .form-grid.cols-2,
  .dest-edit-grid.cols-2,
  .image-size-grid,
  .page-patient .filters,
  .form-row,
  .user-form-row,
  body.a-plus-patients-page .filter .row,
  body.a-plus-users-page .filter .row {
    gap: 10px !important;
  }

  .settings-grid,
  .nds-grid,
  .rt-grid,
  .rt-page .form,
  .rt-panels,
  .form-grid.cols-2,
  .dest-edit-grid.cols-2,
  .image-size-grid {
    grid-template-columns: 1fr !important;
  }

  .form-grid .full,
  .dest-edit-grid .full,
  .image-size-grid .full {
    grid-column: 1 / -1 !important;
  }

  .dicom-log-filters .row > [class*="col-"],
  .stats-page .filter-form > [class*="col-"],
  .page-wrap form .row > [class*="col-"] {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }

  .dicom-log-filters .row > .col-12,
  .stats-page .filter-form > .col-12,
  .page-wrap form .row > .col-12 {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }

  body.a-plus-patients-page .filter .row,
  body.a-plus-users-page .filter .row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: end;
  }

  .page-patient .filters {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-patient .filter-item {
    min-width: 0;
  }

  .page-patient .filter-item[style*="align-self"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: 1 / -1;
    gap: 8px;
  }

  body.a-plus-patients-page .filter-btns,
  body.a-plus-users-page .filter-btns {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-column: 1 / -1;
    margin-left: 0 !important;
    gap: 8px;
  }

  body.a-plus-patients-page .filter-btns {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 124px !important;
    align-items: end;
    gap: 8px !important;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .patient-filter-primary {
    grid-column: 1 !important;
    min-width: 0 !important;
    width: 100%;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .patient-filter-primary input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .patient-filter-advanced {
    display: none !important;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .filter-btns {
    display: grid !important;
    grid-template-columns: 74px 44px !important;
    grid-column: 2 !important;
    width: 124px;
    min-width: 124px;
    max-width: 124px;
    gap: 6px;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .patient-filter-search {
    width: 100%;
    min-width: 74px;
    padding: 0 10px;
  }

  body.a-plus-patients-page .filter.patient-filter:not(.patient-filter-collapsed) .filter-btns {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-column: 1 / -1;
    gap: 8px;
  }

  body.a-plus-patients-page .filter.patient-filter:not(.patient-filter-collapsed) .patient-filter-search {
    order: 1;
  }

  body.a-plus-patients-page .filter.patient-filter:not(.patient-filter-collapsed) .patient-filter-toggle {
    order: 2;
    width: 100%;
    min-width: 0;
    font-size: 15px;
    font-weight: 800;
    gap: 8px;
  }

  body.a-plus-patients-page .filter.patient-filter:not(.patient-filter-collapsed) #btnAddPatient {
    order: 3;
  }

  body.a-plus-patients-page .filter.patient-filter:not(.patient-filter-collapsed) #btnReset {
    order: 4;
  }

  body.a-plus-patients-page .patient-filter-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    min-height: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #cadced;
    border-radius: 13px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    color: #12304d;
    font-size: 0;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .patient-filter-toggle span {
    display: none;
  }

  body.a-plus-patients-page .patient-filter-toggle i {
    margin: 0;
    font-size: 17px;
  }

  .dicom-log-table-container,
  .table-responsive,
  .column-table-wrap,
  .settings-page .table-wrap,
  .page-patient .table-wrap,
  .page-patient .grid-wrap,
  .page-patient > div[style*="overflow:auto"],
  body.a-plus-patients-page .grid-wrap,
  body.a-plus-users-page .grid-wrap,
  .centers-page .border.rounded,
  .devices-page .border.rounded {
    width: 100%;
    max-width: 100%;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .dicom-log-table-container,
  .centers-page .border.rounded,
  .devices-page .border.rounded,
  .page-patient > div[style*="overflow:auto"],
  body.a-plus-patients-page .grid-wrap,
  body.a-plus-users-page .grid-wrap {
    max-height: calc(100dvh - 210px) !important;
  }

  .centers-table,
  .devices-table,
  .dicom-log-table,
  .column-table,
  .page-wrap table,
  .page-patient table,
  #pt-grid,
  #ptOrderGrid,
  #user-grid {
    min-width: 760px;
  }

  .stats-page table {
    min-width: 680px;
  }

  .centers-table th,
  .centers-table td,
  .devices-table th,
  .devices-table td,
  .dicom-log-table th,
  .dicom-log-table td,
  .page-wrap table th,
  .page-wrap table td,
  .page-patient table th,
  .page-patient table td,
  #pt-grid th,
  #pt-grid td,
  #ptOrderGrid th,
  #ptOrderGrid td,
  #user-grid th,
  #user-grid td {
    font-size: 13px !important;
    padding: 7px 8px !important;
    vertical-align: middle;
  }

  .modal-dialog {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    margin: 8px auto !important;
  }

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

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

  .modal-backdrop {
    padding: 8px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .modal-backdrop .modal:not(.fade) {
    min-width: 0 !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
  }

  .modal-backdrop .modal-header,
  .modal-backdrop .modal-footer {
    flex: 0 0 auto;
  }

  .modal-backdrop .modal-body {
    flex: 1 1 auto;
  }

  .form-row,
  .user-form-row,
  .permission-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .form-field,
  .user-form-field {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .dicom-log-filters .row > [class*="col-"],
  .stats-page .filter-form > [class*="col-"],
  .page-wrap form .row > [class*="col-"] {
    flex-basis: 100% !important;
    max-width: 100% !important;
  }

  body.a-plus-patients-page .filter .row,
  body.a-plus-users-page .filter .row,
  body.a-plus-patients-page .filter-btns,
  body.a-plus-users-page .filter-btns,
  .page-patient .filters,
  .page-patient .filter-item[style*="align-self"] {
    grid-template-columns: 1fr !important;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .row {
    grid-template-columns: minmax(0, 1fr) 124px !important;
  }

  body.a-plus-patients-page .filter.patient-filter.patient-filter-collapsed .filter-btns {
    grid-template-columns: 74px 44px !important;
    grid-column: 2 !important;
    width: 124px;
    min-width: 124px;
    max-width: 124px;
  }

  body.a-plus-patients-page .filter.patient-filter:not(.patient-filter-collapsed) .filter-btns {
    grid-template-columns: 1fr !important;
  }

  .centers-page > .d-flex:first-child,
  .devices-page > .d-flex:first-child,
  .page-wrap > .d-flex:first-child,
  .stats-page > .d-flex:first-child {
    flex-wrap: wrap !important;
  }

  .centers-page > .d-flex:first-child .btn,
  .devices-page > .d-flex:first-child .btn,
  .page-wrap > .d-flex:first-child .btn,
  .stats-page > .d-flex:first-child .btn {
    flex: 1 1 auto;
  }
}
