/* Shared mobile corrections for page actions, report filters and portaled forms. */
@media (max-width: 767px) {
  .mw-dashboard-content,
  .mw-dashboard-content__inner,
  .teacher-experience,
  .teacher-workspace,
  .tw-workspace {
    min-width: 0;
    max-width: 100%;
  }

  .teacher-experience .ant-tabs,
  .teacher-experience .ant-tabs-content-holder,
  .teacher-experience .ant-tabs-content {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .teacher-experience .ant-tabs-nav-wrap {
    min-width: 0;
    max-width: 100%;
  }

  .mw-page-header > div {
    min-width: 0;
    max-width: 100%;
  }

  .mw-page-header > div:last-child:not(:first-child) {
    width: 100%;
  }

  .mw-page-header > div:last-child > .ant-space {
    display: flex;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
  }

  .mw-page-header > div:last-child > .ant-space > .ant-space-item {
    min-width: 0;
    max-width: 100%;
  }

  .mw-page-header .ant-select,
  .mw-page-header .ant-btn {
    max-width: 100%;
  }

  .mw-page-header .ant-btn {
    min-height: 44px;
    height: auto;
    white-space: normal;
  }

  .mw-page-header__title,
  .mw-page-header__subtitle {
    overflow-wrap: anywhere;
  }

  .student-reports-dashboard > .ant-card:first-child .ant-row > .ant-col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding-block: 8px;
  }

  .student-reports-dashboard > .ant-card:first-child .ant-card-body > .flex {
    flex-wrap: wrap;
    gap: 12px;
  }

  .student-reports-dashboard > .ant-card:nth-child(2) .ant-card-body > .flex > .ant-space {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .student-reports-dashboard > .ant-card:nth-child(2) .ant-card-body > .flex > .ant-space > .ant-space-item {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 100%;
  }

  .student-reports-dashboard > .ant-card:nth-child(2) .ant-input-affix-wrapper,
  .student-reports-dashboard > .ant-card:nth-child(2) .ant-select {
    width: 100% !important;
    max-width: 100%;
  }

  .mw-family-task-student-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    margin-inline-end: 0;
  }

  .mw-family-task-student-header > div {
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .mw-family-task-student-header .font-medium {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .mw-family-task-student-header .ant-avatar {
    flex-shrink: 0;
  }
}

@media (max-width: 1100px) {
  .mw-accommodation-toolbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .mw-accommodation-toolbar > .ant-space {
    display: flex;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    flex-wrap: wrap;
  }

  .mw-accommodation-toolbar > .ant-space > .ant-space-item {
    flex: 1 1 180px;
    min-width: 0;
    max-width: 100%;
  }

  .mw-accommodation-toolbar .ant-input-group-wrapper,
  .mw-accommodation-toolbar .ant-select {
    width: 100% !important;
    max-width: 100%;
  }
}

@media (max-width: 1023px) {
  .mw-animated-modal-viewport {
    top: var(--mw-visible-top, 0px) !important;
    bottom: auto !important;
    height: var(--mw-visible-height, 100dvh) !important;
    box-sizing: border-box;
  }

  .ant-modal-root .ant-modal {
    top: 0 !important;
    margin: 0 auto;
    padding-bottom: 0 !important;
  }

  .ant-modal-root .ant-modal-wrap {
    --mw-dialog-inset-top: max(8px, env(safe-area-inset-top, 0px));
    --mw-dialog-inset-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    top: var(--mw-visible-top, 0px);
    bottom: auto;
    height: var(--mw-visible-height, 100dvh);
    box-sizing: border-box;
    padding-inline: 8px;
    padding-block: var(--mw-dialog-inset-top) var(--mw-dialog-inset-bottom);
  }

  .ant-modal-root .ant-modal-wrap .ant-modal-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0 !important;
    max-height: calc(var(--mw-visible-height, 100dvh) - var(--mw-dialog-inset-top, 8px) - var(--mw-dialog-inset-bottom, 8px)) !important;
  }

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

  .ant-modal-root .ant-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .ant-modal-root .ant-modal-centered::before {
    display: none;
  }

  .ant-modal-root .ant-modal-centered .ant-modal {
    display: block;
  }

  .ant-drawer:not(.ant-drawer-inline) {
    top: var(--mw-visible-top, 0px);
    bottom: auto;
    height: var(--mw-visible-height, 100dvh);
  }

  .ant-drawer .ant-drawer-content-wrapper {
    max-height: var(--mw-visible-height, 100dvh) !important;
  }

  .ant-drawer:not(.ant-drawer-inline) .ant-drawer-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
}
