@media (max-width: 760px) {
  /* Keep the staff / vehicle master usable on narrow phones, including the
     default large-text mode. Desktop layout stays unchanged. */
  .record-master-settings,
  .record-master-grid,
  .record-master-card,
  .record-master-heading > div,
  .record-master-form,
  .record-master-list,
  .vehicle-master-list {
    min-width: 0;
    width: 100%;
  }

  .record-master-card {
    padding: 16px 14px !important;
    overflow: hidden;
  }

  .record-master-heading {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }

  .record-master-heading > span {
    width: 36px;
    height: 36px;
  }

  .record-master-heading h3,
  .record-master-heading p,
  .record-master-vehicle-note,
  .record-master-manage-link,
  .vehicle-master-copy strong,
  .vehicle-master-copy small {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .record-master-heading h3 {
    line-height: 1.35;
  }

  .record-master-heading p {
    line-height: 1.55;
  }

  .record-master-form.staff-master-form,
  .record-master-form.vehicle-master-form {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch;
    gap: 12px;
  }

  .record-master-form label,
  .vehicle-master-expiry {
    min-width: 0;
    width: 100%;
  }

  .record-master-form input,
  .vehicle-master-expiry input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 44px;
  }

  html[data-text-size='large'] .record-master-settings .record-master-form input,
  html[data-text-size='large'] .record-master-settings .vehicle-master-expiry input {
    font-size: 17px !important;
  }

  .record-master-driver-check {
    display: flex !important;
    width: 100%;
    min-height: 44px;
    padding: 6px 2px;
    white-space: normal;
  }

  .record-master-driver-check input {
    flex: 0 0 auto;
    width: 20px !important;
    height: 20px !important;
  }

  .record-master-driver-check span {
    min-width: 0;
    white-space: normal !important;
  }

  .record-master-form .primary-button,
  .staff-master-form .primary-button {
    width: 100%;
    min-height: 46px;
    justify-self: stretch;
  }

  .record-master-list > div:not(.vehicle-master-row) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    padding: 10px 2px 10px 4px;
  }

  .record-master-list > div:not(.vehicle-master-row) strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .record-master-staff-role {
    flex: 0 0 auto;
    margin-left: 0;
    white-space: nowrap;
  }

  .record-master-manage-link {
    justify-content: flex-start;
    min-height: 44px;
    padding: 10px 2px 2px;
    text-align: left;
    line-height: 1.55;
    white-space: normal;
  }

  .record-master-manage-link svg {
    flex: 0 0 auto;
  }

  .record-master-vehicle-note {
    margin: 12px 0 8px;
    line-height: 1.7;
  }

  .record-master-list > .vehicle-master-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    justify-content: initial !important;
    gap: 11px !important;
    width: 100%;
    min-width: 0;
    padding: 15px 0 !important;
  }

  .vehicle-master-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
    width: 100%;
    padding: 0 2px 4px;
  }

  .vehicle-master-copy strong {
    display: block;
    min-width: 0;
    line-height: 1.45;
  }

  .vehicle-master-copy small {
    display: block;
    min-width: 0;
    line-height: 1.55;
  }

  .vehicle-master-expiry {
    display: grid;
    gap: 6px;
  }

  .vehicle-master-expiry > span {
    line-height: 1.45;
  }

  .vehicle-master-row > button {
    justify-self: end;
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
  }
}

@media (max-width: 390px) {
  .record-master-card {
    padding-inline: 12px !important;
  }

  .record-master-heading > span {
    width: 34px;
    height: 34px;
  }

  html[data-text-size='large'] .record-master-settings .record-master-form input,
  html[data-text-size='large'] .record-master-settings .vehicle-master-expiry input {
    font-size: 16px !important;
  }
}
