.responsive-table-control-label {
  display: none;
}

/* Keep the original table structure for printing. On screen, records stack only
   when their columns exceed the space measured by responsive-table. */
@media screen {
  table.responsive-table.is-stacked,
  table.responsive-table.is-stacked > :is(thead, tbody, tfoot) {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  table.responsive-table.is-stacked > :is(thead, tbody, tfoot) > tr {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  table.responsive-table.is-stacked > :is(thead, tbody, tfoot) > tr > :is(th, td) {
    display: block;
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding: 4px 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left !important;
  }

  table.responsive-table.is-stacked [data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 600;
  }

  table.responsive-table.is-stacked :is(.nowrap, .row-inline, .row-actions, .btn, .badge, .quick-pick) {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    flex-wrap: wrap;
  }

  table.responsive-table.is-stacked :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, .combobox, .affix) {
    min-width: 0;
    max-width: 100%;
  }

  /* Sorting and Select all remain the original working controls. The other
     column headings stay available to assistive technology. */
  table.responsive-table.is-stacked > thead > tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
  }

  table.responsive-table.is-stacked > thead > tr > th:not(:has(a, button, input, select)),
  table.responsive-table.is-stacked > thead:not(:has(a, button, input, select)) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
  }

  table.responsive-table.is-stacked .dt-sort {
    white-space: normal;
    flex-wrap: wrap;
  }

  table.responsive-table.is-stacked .dt-sort::before {
    content: "Sort by ";
  }

  table.responsive-table.is-stacked .responsive-table-control-label {
    display: inline;
    margin-left: 6px;
  }
}
