  
  .dropdown-toggle { outline: 0; }
  
  .btn-toggle {
    padding: .25rem .5rem;
    font-weight: 600;
    color: rgba(0, 0, 0, .65);
    background-color: transparent;
  }
  .btn-toggle:hover,
  .btn-toggle:focus {
    color: rgba(0, 0, 0, .85);
    background-color: #d2f4ea;
  }
  
  .btn-toggle::before {
    width: 1.25em;
    line-height: 0;
    content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
    transition: transform .35s ease;
    transform-origin: .5em 50%;
  }
  
  .btn-toggle[aria-expanded="true"] {
    color: rgba(0, 0, 0, .85);
  }
  .btn-toggle[aria-expanded="true"]::before {
    transform: rotate(90deg);
  }
  
  .btn-toggle-nav a {
    padding: .1875rem .5rem;
    margin-top: .125rem;
    margin-left: 1.25rem;
  }
  .btn-toggle-nav a:hover,
  .btn-toggle-nav a:focus {
    background-color: #d2f4ea;
  }
  
  .scrollarea {
    overflow-y: auto;
  }

/* Side menu */

:root {
  /* same palette as the pages: white surface, #f4f4f4 hover, #f5f5f5 cards, 8px corners */
  --menu-bg: #ffffff;
  --menu-surface: #ffffff;
  --menu-text: #212529;
  --menu-muted: #6c757d;
  --menu-hover: #f4f4f4;
  --menu-active-bg: #ebebeb;
  --menu-active-text: #000000;
  --menu-line: #dddddd;
  --menu-border: #dddddd;
  --menu-radius: 8px;
}

#sidebar {
  --sidebar-bg: var(--menu-bg);
  --sidebar-text: var(--menu-text);
  --sidebar-hover: var(--menu-hover);
  --sidebar-active-bg: var(--menu-active-bg);
  --sidebar-line: var(--menu-line);
  --sidebar-radius: var(--menu-radius);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--menu-border) !important;
}

#sidebar ul.components {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 16px;
  margin: 0;
}

/* the menu still scrolls (wheel, touch), the scrollbar is hidden */
#sidebar,
#sidebar ul.components {
  scrollbar-width: none;
}

#sidebar::-webkit-scrollbar,
#sidebar ul.components::-webkit-scrollbar {
  display: none;
}

#sidebar .nav-pills {
  padding: 0 6px;
  gap: 6px;
}

#sidebar .nav-item {
  margin: 0 !important;
}

/* items carry btn btn-success: border, background and colours come from the theme's buttons */
#sidebar .nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);
  text-align: left;
  transition: background-color .15s ease, color .15s ease;
}

#sidebar .nav-link > i {
  flex: 0 0 20px;
  min-width: 20px !important;
  margin: 0 !important;
  text-align: center;
  color: inherit !important;
}

#sidebar .nav-link > span:not(.submenu-indicator) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sidebar .nav-link.active,
#sidebar .nav-link.active:hover {
  background: var(--sidebar-active-bg) !important;
}

#sidebar .nav-link.active > i {
  color: inherit !important;
}

#sidebar .submenu-indicator {
  margin-left: auto;
  width: 14px;
  height: 14px;
  position: relative;
  flex: 0 0 14px;
}

/* "+" when closed, "−" when open */
#sidebar .submenu-indicator::before,
#sidebar .submenu-indicator::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 6px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform .2s ease;
}

#sidebar .submenu-indicator::after {
  transform: rotate(90deg);
}

#sidebar [aria-expanded="true"] .submenu-indicator::after,
#sidebar [aria-expanded="true"] > .submenu-indicator::after {
  transform: rotate(0deg);
}

#sidebar .submenu-toggle::after {
  display: none !important;
}

/* children: indented, with a guide line */
#sidebar .submenu {
  position: relative;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 6px 0 0 25px;
  padding: 0 0 0 14px;
}

#sidebar .submenu::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--sidebar-line);
}

#sidebar .submenu .nav-link,
#sidebar ul ul a {
  width: 100% !important;
}

/* collapsed sidebar: icons only, the same size as the collapse button above them (icon + button padding) */
#sidebar .nav-link {
  --sidebar-icon-width: calc(var(--bs-btn-font-size) + 2 * var(--bs-btn-padding-x) + 2 * var(--bs-btn-border-width));
  --sidebar-icon-height: calc(var(--bs-btn-font-size) + 2 * var(--bs-btn-padding-y) + 2 * var(--bs-btn-border-width));
}

#sidebar.active .nav-link {
  justify-content: center;
  width: var(--sidebar-icon-width) !important;
  height: var(--sidebar-icon-height);
  margin: 0 auto;
  padding: 0 !important;
}

#sidebar.active .nav-link > i {
  display: block;
}

#sidebar.active .submenu-indicator {
  display: none;
}

#sidebar.active .submenu {
  margin: 6px 0 0;
  padding: 0;
}

#sidebar.active .submenu::before {
  display: none;
}

@media (max-width: 768px) {
  #sidebar .nav-link {
    justify-content: center;
    width: var(--sidebar-icon-width) !important;
    height: var(--sidebar-icon-height);
    margin: 0 auto;
    padding: 0 !important;
  }

  #sidebar .submenu-indicator {
    display: none;
  }

  #sidebar .submenu {
    margin: 6px 0 0;
    padding: 0;
  }

  #sidebar .submenu::before {
    display: none;
  }
}
