:root {
  --portal-touch-target: 44px;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
  margin-bottom: 0;
}

.offcanvas-md.sidebar .offcanvas-body {
  display: block;
}

.portal-ajax-busy {
  opacity: .7;
  pointer-events: none;
}

.portal-ajax-loading body {
  cursor: progress;
}

.dns-record-list {
  display: grid;
  gap: .75rem;
}

.dns-record-item {
  padding: .9rem 1rem;
  border: 1px solid #dee2e6;
  border-radius: .55rem;
  background: #fff;
}

.dns-record-display {
  display: grid;
  grid-template-columns: minmax(8rem, 1.25fr) minmax(4rem, .45fr) minmax(12rem, 2.5fr) auto auto auto;
  gap: .75rem;
  align-items: center;
}

.dns-record-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dns-record-label {
  display: none;
  color: #6c757d;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.dns-record-actions {
  white-space: nowrap;
}

@media (max-width: 767.98px) {
  body {
    font-size: .95rem;
  }

  .navbar {
    min-height: 60px;
  }

  .navbar-brand {
    min-width: 0;
    font-size: 1rem;
  }

  .navbar-brand img {
    height: 26px !important;
    padding: 3px 6px !important;
  }

  .navbar-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main,
  .portal-content {
    width: 100%;
    min-width: 0;
    padding: 1rem .75rem !important;
  }

  main > .d-flex.justify-content-between,
  .portal-content > .d-flex.justify-content-between,
  .d-flex.justify-content-between,
  .card-header.d-flex.justify-content-between,
  .alert.d-flex.justify-content-between {
    align-items: stretch !important;
    flex-wrap: wrap;
    gap: .75rem;
  }

  main > .d-flex.justify-content-between > .d-flex,
  .portal-content > .d-flex.justify-content-between > .d-flex {
    width: 100%;
    flex-wrap: wrap;
  }

  h1,
  h2 {
    font-size: 1.45rem;
  }

  .card {
    border-radius: .65rem;
  }

  .card-body,
  .card-header {
    padding: .9rem;
  }

  input.form-control,
  select.form-select,
  textarea.form-control {
    min-height: var(--portal-touch-target);
    font-size: 16px !important;
  }

  textarea.form-control {
    min-height: 7rem;
  }

  .btn:not(.btn-sm) {
    min-height: var(--portal-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .form-check {
    min-height: var(--portal-touch-target);
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-left: 0 !important;
    padding: .55rem .75rem .55rem 2.25rem;
    border: 1px solid #dee2e6;
    border-radius: .5rem;
  }

  .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0;
  }

  .mobile-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    margin: 1rem -.9rem -.9rem;
    padding: .8rem .9rem calc(.8rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97);
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -.35rem 1rem rgba(0, 0, 0, .08);
  }

  .mobile-sticky-actions .btn-primary {
    width: 100%;
  }

  .table-responsive {
    margin-bottom: .25rem;
    border-radius: .4rem;
  }

  .table-responsive .table {
    min-width: 720px;
  }

  .mobile-cards .card + .card {
    margin-top: .75rem;
  }

  .mobile-kv {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .25rem .75rem;
  }

  .offcanvas-md.sidebar {
    width: min(86vw, 320px);
  }

  .dns-record-display {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem .75rem;
  }

  .dns-record-display > * {
    min-width: 0;
  }

  .dns-record-display .dns-record-actions {
    grid-column: 1 / -1;
  }

  .dns-record-label {
    display: block;
  }

  .dns-record-actions .btn {
    width: 100%;
  }
}

@media (min-width: 768px) {
  .offcanvas-md.sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: calc(100vh - 64px);
    overflow-y: auto;
  }
}
