  table.sortable td,
  table.sortable th {
    font-size: 1rem;
  }

  table.sortable td {
    padding-left: 5px;
    overflow-wrap: anywhere;
  }
  
  table.sortable th {
    font-weight: bold;
    border-bottom: thin solid #888;
    position: relative;
    text-align: left;
    padding: 2px 0;
    padding-right: 20px;
  }

  .buttonContent {
    display: inline-flex;
    align-items: center;
  }
  
  table.sortable th.no-sort {
    padding-top: 0.35em;
  }
  
  table.sortable th:nth-child(7) {
    width: 9em;
  }
  
  table.sortable th button {
    padding: 4px;
    margin: 1px;
    font-size: 100%;
    font-weight: bold;
    background: transparent;
    border: none;
    display: inline;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    text-align: left;
    outline: none;
    cursor: pointer;
    vertical-align: middle;
    box-shadow: none;
  }
  
  table.sortable th button span {
    position: relative;
    margin-left: 2px;
  }

  table.sortable th :hover {
    cursor: pointer;
  }

  table.sortable th[aria-sort="none"] span::before,
  table.sortable th[aria-sort="descending"] span::before,
  table.sortable th[aria-sort="ascending"] span::before {
    content: "";
    display: block;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    margin-top: 2px;
    border-bottom: 7px solid #b1b4b6;
    width: 0;
  }

  table.sortable th[aria-sort="none"] span::after,
  table.sortable th[aria-sort="descending"] span::after,
  table.sortable th[aria-sort="ascending"] span::after {
    content: "";
    display: block;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    margin-top: 2px;
    border-top: 7px solid #b1b4b6;
    width: 0;
  }
  
  table.sortable th[aria-sort="descending"] span::after {
    border-top: 7px solid black;
  }

  table.sortable th[aria-sort="ascending"] span::before {
    border-bottom: 7px solid black;
  }

  table.show-unsorted-icon th:not([aria-sort]) button span::after {
    content: "♢";
    color: currentcolor;
    font-size: 100%;
    position: relative;
    top: -3px;
    left: -4px;
  }
  
  /* Focus and hover styling */
  .sortedText {
    width: min-content;
    padding: 2px;
    min-width: fit-content;
  }

  table.sortable .govuk-button--secondary:hover {
    background-color: transparent !important;
  }

  table.sortable .govuk-button--secondary:hover .sortedText {
    background-color: #dbdad9 !important;
  }
  
  table.sortable .govuk-button:focus, table.sortable .govuk-button:focus:not(:active):not(:hover) {
    border-color: transparent;
    background-color: transparent;
    box-shadow: none;
  }

  table.sortable .govuk-button:focus:not(:active):not(:hover) .sortedText {
    border-color: #fd0;
    background-color: #fd0;
    box-shadow: 0 2px 0 #0b0c0c;
  }

  table.sortable .govuk-button:focus:not(:active) {
    border-color: transparent;
    background-color: transparent;
    box-shadow: none;
  }

  
@media (max-width: 40.0525em) {
  /*  Turn table in blocks */
  .sortable tr,
  .sortable th,
  .sortable td {
      display: block;
  }

  .sortable th {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      margin: 0 !important;
      padding: 0 !important;
      overflow: hidden !important;
      clip: rect(0 0 0 0) !important;
      -webkit-clip-path: inset(50%) !important;
      clip-path: inset(50%) !important;
      border: 0 !important;
      white-space: nowrap !important;
  }

  .sortable tr:nth-child(even) {
      background-color: #f3f2f1;
  }

  .sortable tr:last-child {
      border-bottom: none;
  }

  .sortable tr:first-child {
      border-top: none;
  }

  .sortable tr {
      border-bottom: 1px #b1b4b6 solid;
  }

  /* border for all mobile tables*/
  .sortable.mobile-table-border {
      border: solid 1px #b1b4b6;
  }

  .sortable .govuk-table__cell {
      border: none;
  }
}

@media (min-width: 40.0625em) {
  .govuk-visually-hidden--mobile {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      margin: 0 !important;
      padding: 0 !important;
      overflow: hidden !important;
      clip: rect(0 0 0 0) !important;
      -webkit-clip-path: inset(50%) !important;
      clip-path: inset(50%) !important;
      border: 0 !important;
      white-space: nowrap !important;
  }
}

.table-sort-select {
  display: inline-block;
  padding-right: 10px;
}

.govuk-select{
  min-width: 11.5em;
}

@media (min-width: 40.0625em) {
  .table-sort-select {
      display: none;
  }
}
