.top-nav-row {
  min-height: 4.5rem;
}

.min-w-0 {
  min-width: 0;
}

.sidebar {
  white-space: nowrap;
}

.sidebar .offcanvas-lg {
  --bs-offcanvas-width: 280px;
}

/* Sub navigation bar: the same height as a card header. Both already share 0.5rem padding and a 1px bottom
   border, so the row in between is one h4 line (1.25rem x 1.2 line height), and its buttons fill that height */
div:has(> .sub-nav-links) {
  height: calc(1.25rem * 1.2);
}

div:has(> .sub-nav-links) .btn {
  --bs-btn-padding-y: 0;
  display: inline-flex;
  align-items: center;
  column-gap: 0.25rem;
  height: 100%;
}

.sidebar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.sidebar-account-name {
  max-width: 16rem;
}

/* Keep the theme's input colours when the browser autofills a saved login */
.form-control:-webkit-autofill {
  -webkit-text-fill-color: var(--bs-body-color);
  transition: background-color 600000s 0s, color 600000s 0s;
}

/* Vertical lines between side-by-side columns, matching the sidebar's border */
@media (min-width: 768px) {
  .col-dividers-md > * + * {
    border-left: var(--bs-border-width) solid var(--bs-border-color);
  }
}

@media (min-width: 992px) {
  .sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: var(--bs-border-width) solid var(--bs-border-color);
    position: sticky;
    top: 0;
    /* Keeps the sidebar's menus, like the account menu, above the page beside it, and below Bootstrap's modals */
    z-index: 1030;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.2s ease;
  }

  .sidebar.collapsed {
    width: 4.5rem;
  }

  .sidebar-collapse i {
    transition: transform 0.2s ease;
  }

  .sidebar.collapsed .sidebar-collapse i {
    transform: rotate(180deg);
  }

  .sidebar.collapsed .sidebar-label,
  .sidebar.collapsed .sidebar-heading,
  .sidebar.collapsed .dropdown-toggle::after {
    display: none;
  }

  .sidebar.collapsed .nav-link,
  .sidebar.collapsed .dropdown-toggle {
    justify-content: center;
    padding-inline: 0;
  }

  .sub-nav-links {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    flex-wrap: nowrap;
  }
}
