.wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
  min-height: calc(100vh - 56px);
}

.wrapper.wrapper--tabs {
  flex-grow: 1;
  margin-bottom: 0;
  min-height: 0;
}

#sidebar {
  background: #e9edf8;
  color: #233056;
  flex: 0 0 250px;
}

/* all items have an equal height and are separated by clear lines */
#sidebar .list-group-item {
  align-items: center;
  background: transparent;
  border: none;
  border-bottom: 1px solid #c9d2ea;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  min-height: 3rem;
  padding: 0.5rem 1rem;
}

#sidebar .list-group-item a,
#sidebar a.list-group-item {
  color: inherit;
  text-decoration: none;
}

#sidebar a.list-group-item:hover {
  background: #dbe2f4;
  cursor: pointer;
}

#sidebar .list-group-item.active,
#sidebar .list-group-item.active a {
  background: #cfd9f1;
  box-shadow: inset 3px 0 0 #7386d5;
  color: #101d45;
  font-weight: 600;
}

/* items with children are non-clickable section headers, always expanded */
#sidebar .list-group-item.header {
  background: #dde3f4;
  color: #1c2a55;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#sidebar .list-group-item.child {
  padding-left: 2rem;
}

#sidebar .list-group-item.back {
  font-size: 0.875rem;
}

#sidebar .list-group-item.title {
  background: #dde3f4;
  font-size: 1.25rem;
  font-weight: 600;
}

#sidebar .badge {
  background-color: #7386d5;
  color: #fff;
  margin-left: auto;
}

#sidebar .badges {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

#sidebar a.blocked {
  text-decoration: line-through;
}

/*
 * The account pages turn their sidebar into a horizontally scrolling tab bar on narrow screens,
 * so the forms keep the full width. This works without JavaScript.
 */
@media (max-width: 767px) {
  .wrapper.wrapper--tabs {
    flex-direction: column;
  }

  .wrapper--tabs #sidebar {
    flex: none;
    flex-direction: row;
    overflow-x: auto;
    width: 100%;
  }

  .wrapper--tabs #sidebar .list-group-item {
    border-bottom: none;
    flex: 0 0 auto;
    min-height: 2.75rem;
    white-space: nowrap;
  }

  .wrapper--tabs #sidebar .list-group-item.title {
    display: none;
  }

  .wrapper--tabs #sidebar .list-group-item.active {
    box-shadow: inset 0 -3px 0 #7386d5;
  }
}

.pb-10rem {
  padding-bottom: 10rem;
}

.badge-large {
  font-size: 0.93rem;
}

/*
 * Dark variant used by the back office and the account pages when the front-end theme is dark.
 * The navbar and footer use bg-dark, which matches the dark body background, so they get a darker shade and a border.
 */
html[data-bs-theme="dark"] .navbar.bg-dark,
html[data-bs-theme="dark"] .legal-footer.bg-dark {
  background-color: #111315 !important;
}

html[data-bs-theme="dark"] .navbar.bg-dark {
  border-bottom: 1px solid var(--bs-border-color);
}

html[data-bs-theme="dark"] .legal-footer.bg-dark {
  border-top: 1px solid var(--bs-border-color);
}

html[data-bs-theme="dark"] #sidebar,
html[data-bs-theme="dark"] #sidebar .list-group-item,
html[data-bs-theme="dark"] #sidebar .list-group-item a {
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
}

html[data-bs-theme="dark"] #sidebar .list-group-item.child,
html[data-bs-theme="dark"] #sidebar .list-group-item.child a {
  background: var(--bs-secondary-bg);
}

html[data-bs-theme="dark"] #sidebar .list-group-item {
  border-bottom-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] #sidebar a.list-group-item:hover,
html[data-bs-theme="dark"] #sidebar .list-group-item a:hover,
html[data-bs-theme="dark"] #sidebar .list-group-item:hover a {
  background: var(--bs-secondary-bg);
  color: var(--bs-emphasis-color);
}

/* the active item keeps its background and bar, the general dark rule above would override them */
html[data-bs-theme="dark"] #sidebar .list-group-item.active,
html[data-bs-theme="dark"] #sidebar .list-group-item.active a {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
}
