/* Finance, student and collaborator workflows on small screens. */
@media screen and (max-width: 800px) {
  .workflow-mobile :where(.form-grid, .card-heading, .toolbar > *, .toolbar form) {
    min-inline-size: 0;
  }
  .workflow-mobile :where(.card-heading, .form-actions) {
    flex-wrap: wrap;
  }
  .workflow-mobile :where(.card-heading h2, summary, dd) {
    overflow-wrap: anywhere;
  }
  .workflow-mobile fieldset {
    min-inline-size: 0;
    max-inline-size: 100%;
    margin-inline: 0;
  }
  .workflow-mobile fieldset legend {
    max-inline-size: 100%;
  }
  .workflow-mobile :where(input[type="date"], input[type="month"], input[type="file"], select) {
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  .workflow-mobile .table-wrap {
    max-inline-size: 100%;
    min-inline-size: 0;
    overscroll-behavior-x: contain;
  }
  .workflow-mobile .table-wrap > table:has(> thead > tr > th:nth-child(4)) {
    min-inline-size: 30rem;
  }
  .workflow-mobile .table-wrap > table:has(> thead > tr > th:nth-child(6)) {
    min-inline-size: 42rem;
  }
  .workflow-mobile .table-wrap > table:has(> thead > tr > th:nth-child(9)) {
    min-inline-size: 57rem;
  }
  .workflow-mobile .table-wrap > table:has(> thead > tr > th:nth-child(12)) {
    min-inline-size: 74rem;
  }
  .workflow-mobile .table-wrap > table:has(> thead > tr > th:nth-child(17)) {
    min-inline-size: 100rem;
  }
  .workflow-mobile .table-wrap :where(th, td):not(.amount) {
    overflow-wrap: anywhere;
  }
  .workflow-mobile :where(.statistics-charts, .statistics-reference, .student-summary-grid) {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media screen and (max-width: 600px) {
  .workflow-mobile :where(form.toolbar, .toolbar > form, .crm-period-filters) {
    align-items: end;
  }
  .workflow-mobile :where(form.toolbar, .toolbar > form, .crm-period-filters) > label {
    flex: 1 1 9rem;
  }
  .workflow-mobile form.toolbar > label:has(input[type="file"]) {
    flex-basis: 100%;
  }
  .workflow-mobile .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  }
  .workflow-mobile :where(.student-credit-metrics, .student-summary-metrics) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .workflow-mobile .crm-period-filters > .actions {
    flex-basis: 100%;
  }
  .workflow-mobile .form-actions > .button {
    max-inline-size: 100%;
    white-space: normal;
  }
  .workflow-mobile .stat-grid .metric-card > strong {
    max-inline-size: 100%;
    font-size: clamp(17px, 5.5vw, 24px);
    overflow-wrap: anywhere;
  }
  .workflow-mobile .card-heading > :where(.button, .badge) {
    max-inline-size: 100%;
    white-space: normal;
  }
}

@media screen and (max-width: 460px) {
  .workflow-mobile .crm-period-filters > label:has(select[name="period_basis"]) {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 360px) {
  .workflow-mobile :where(form.toolbar, .toolbar > form, .crm-period-filters) > label {
    flex-basis: 100%;
  }
  .workflow-mobile .student-credit-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}
