html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > .container {
  flex: 1 0 auto;
  min-width: 0;
}

main, .bp-table-region {
  min-width: 0;
  max-width: 100%;
}

main {
  overflow-wrap: anywhere;
}

.navbar-brand {
  min-width: 0;
  max-width: calc(100% - 4rem);
  white-space: normal;
  overflow-wrap: anywhere;
}

.navbar-collapse,
.navbar-nav {
  min-width: 0;
  flex-wrap: wrap;
}

.navbar-nav,
.navbar-nav .nav-item {
  max-width: 100%;
}

.navbar-nav .nav-link {
  overflow-wrap: anywhere;
}

.layout-selector .form-select {
  max-width: 100%;
}

.bp-responsive-table,
.bp-summary-table {
  min-width: 44rem;
}

.bp-readings-overview {
  display: none;
  min-width: 0;
  max-width: 100%;
}

body[data-layout="cards"] .bp-readings-overview,
body[data-layout="grid"] .bp-readings-overview {
  display: block;
}

.bp-overview-table {
  font-size: .875rem;
  margin-bottom: 0;
}

.bp-overview-table th,
.bp-overview-table td {
  white-space: nowrap;
}

.js-reading-overview-row {
  cursor: pointer;
}

.js-reading-overview-row:hover {
  background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.bp-reading-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
}

.bp-responsive-table[data-testid="readings"] {
  --bp-card-columns: 3;
}

.bp-responsive-table .bp-reading-image {
  grid-column: 1 / -1;
}

.bp-responsive-table th,
.bp-responsive-table td {
  overflow-wrap: anywhere;
}

.bp-responsive-table .js-reading-preview {
  max-width: min(100%, 180px);
  max-height: 48px;
  cursor: pointer;
}

.bp-responsive-table .badge {
  white-space: normal;
  text-align: start;
}

.js-card-save,
.js-card-confirm {
  display: none;
}

.bp-responsive-table .bp-card-save-cell,
.bp-responsive-table .bp-card-save-column {
  display: none;
}

.bp-card-save-cell {
  text-align: end;
}

.bp-responsive-table input,
.bp-responsive-table select,
.bp-responsive-table button {
  min-height: 2.75rem;
  max-width: 100%;
}

.bp-responsive-table td::before {
  content: attr(data-label);
  display: none;
  font-weight: 600;
  margin-bottom: .25rem;
}

/* Keep one semantic table and one set of correction inputs in every layout. */
body[data-layout="cards"] .bp-responsive-table,
body[data-layout="grid"] .bp-responsive-table {
  display: block;
  min-width: 0;
}

body[data-layout="cards"] .bp-responsive-table thead,
body[data-layout="grid"] .bp-responsive-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

body[data-layout="cards"] .bp-responsive-table tbody,
body[data-layout="grid"] .bp-responsive-table tbody {
  display: grid;
  gap: 1rem;
}

body[data-layout="grid"] .bp-responsive-table tbody {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

body[data-layout="cards"] .bp-responsive-table tr,
body[data-layout="grid"] .bp-responsive-table tr {
  display: grid;
  grid-template-columns: repeat(var(--bp-card-columns, 2), minmax(0, 1fr));
  min-width: 0;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: .5rem;
  padding: .5rem;
}

body[data-layout="cards"] .bp-responsive-table td,
body[data-layout="grid"] .bp-responsive-table td {
  display: block;
  min-width: 0;
  padding: .5rem;
  border: 0;
}

body[data-layout="cards"] .bp-responsive-table td::before,
body[data-layout="grid"] .bp-responsive-table td::before {
  display: block;
}

body[data-layout="cards"] .bp-responsive-table td:last-child,
body[data-layout="grid"] .bp-responsive-table td:last-child {
  grid-column: 1 / -1;
}

body[data-layout="cards"] .js-card-save.is-visible,
body[data-layout="grid"] .js-card-save.is-visible,
body[data-layout="cards"] .js-card-confirm.is-visible,
body[data-layout="grid"] .js-card-confirm.is-visible {
  display: inline-block;
}

body[data-layout="cards"] .bp-responsive-table .bp-card-save-cell,
body[data-layout="grid"] .bp-responsive-table .bp-card-save-cell {
  display: block;
}

@media (max-width: 767.98px) {
  body[data-layout="auto"] .bp-readings-overview {
    display: block;
  }

  body[data-layout="auto"] .bp-responsive-table {
    display: block;
    min-width: 0;
  }

  body[data-layout="auto"] .bp-responsive-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  body[data-layout="auto"] .bp-responsive-table tbody {
    display: grid;
    gap: 1rem;
  }

  body[data-layout="auto"] .bp-responsive-table tr {
    display: grid;
    grid-template-columns: repeat(var(--bp-card-columns, 2), minmax(0, 1fr));
    min-width: 0;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .5rem;
    padding: .5rem;
  }

  body[data-layout="auto"] .bp-responsive-table td {
    display: block;
    min-width: 0;
    padding: .5rem;
    border: 0;
  }

  body[data-layout="auto"] .bp-responsive-table td::before {
    display: block;
  }

  body[data-layout="auto"] .bp-responsive-table td:last-child {
    grid-column: 1 / -1;
  }

  body[data-layout="auto"] .js-card-save.is-visible {
    display: inline-block;
  }

  body[data-layout="auto"] .js-card-confirm.is-visible {
    display: inline-block;
  }

  body[data-layout="auto"] .bp-responsive-table .bp-card-save-cell {
    display: block;
  }
}

body[data-layout] .bp-analysis-history {
  display: table;
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

body[data-layout] .bp-analysis-history thead {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
}

body[data-layout] .bp-analysis-history tbody {
  display: table-row-group;
  gap: 0;
  grid-template-columns: none;
}

body[data-layout] .bp-analysis-history tr {
  display: table-row;
  border: 0;
  border-radius: 0;
  padding: 0;
}

body[data-layout] .bp-analysis-history td {
  display: table-cell;
  padding: .3rem;
  border-bottom: var(--bs-border-width, 1px) solid var(--bs-border-color, #dee2e6);
}

body[data-layout] .bp-analysis-history td::before {
  display: none;
}

body[data-layout] .bp-analysis-history td:last-child {
  grid-column: auto;
}

@media (max-width: 767.98px) {
  body[data-layout] .bp-analysis-history th.bp-history-expiry,
  body[data-layout] .bp-analysis-history td.bp-history-expiry {
    display: none;
  }
}

.bp-autocorrect-attention {
  background-color: #ffe1b3 !important;
  color: #7a3e00;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}