:root {
  --drawer-chevron-color: var(--color-icon-primary);
  --drawer-chevron-hover-color: var(--color-content-primary);

  --drawer-link-color: var(--color-content-secondary);
  --drawer-link-hover-color: var(--color-content-primary);

  --drawer-link-active-color: var(--color-action-primary);
  --drawer-link-active-bg-color: var(--color-action-secondary);

  --drawer-surface-color: var(--color-surface-subtle);

  --drawer-radius: var(--radius-md);
  --drawer-divider-color: var(--color-border-default);

  --drawer-width: var(--drawer-expanded-width);

  --menu-active-font-weight: var(--font-weight-semibold);
}

.drawer-container {
  display: flex;
  width: var(--drawer-width);
  min-width: var(--drawer-width);
  flex-shrink: 0;

  transition:
    width 0.25s ease,
    min-width 0.25s ease;
}

.drawer {
  width: 100%;
  background: var(--drawer-surface-color);
  border-right: 1px solid var(--drawer-divider-color);
  box-sizing: border-box;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
}

.drawer-list,
.drawer-submenu-list {
  margin: 0;
  padding: 7px;
  list-style: none;
  box-sizing: border-box;
}

.drawer-item {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.drawer-submenu-item {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.drawer-link {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--drawer-radius);
  color: var(--drawer-link-color);
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.drawer-link:hover {
  background-color: var(--color-neutral-200);
  color: var(--drawer-link-hover-color);
  text-decoration: none;
}

.drawer-icon {
  width: 24px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 7px;
  flex-shrink: 0;
  font-size: 15px;
}

.drawer-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--drawer-link-color);
}

.drawer-chevron {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.drawer-parent-link[aria-expanded='true'] .drawer-chevron {
  transform: rotate(180deg);
}

.drawer-submenu-container {
  display: none;
  position: relative;
}

.drawer-submenu-container[data-menu-state='open'] {
  display: block;
}

.drawer-submenu-list {
  padding-top: 2px;
  padding-bottom: 4px;
  padding-left: 22px;
}

.drawer-submenu-list .drawer-link {
  min-height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.drawer-submenu-list::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 7px;
  left: 18px;
  width: 1px;
  background-color: var(--drawer-divider-color);
}

.drawer-link.active-menu-item {
  background-color: var(--drawer-link-active-bg-color);
  color: var(--drawer-link-active-color);
  font-weight: var(--menu-active-font-weight);
}

.drawer-link.active-menu-item .drawer-label {
  color: var(--drawer-link-active-color);
}

.drawer-parent-link.submenu-parent-active {
  color: var(--drawer-link-active-color);
  font-weight: var(--menu-active-font-weight);
}

.drawer-divider {
  margin: 4px 5px;
  list-style: none;
}

.drawer-divider hr {
  margin: 5px 0;
  border: 0;
  border-top: 1px solid var(--drawer-divider-color);
}

.drawer-header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  box-sizing: border-box;
}

#mobile-side-menu-toggle,
.drawer-backdrop,
#drawer-menu,
#drawer-menu[data-drawer-state='closed'] {
  display: none;
}

@media (max-width: 1024px) {
  .drawer-container {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(85vw, 460px);
    min-width: 0;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .drawer-container[data-drawer-state='open'] {
    transform: translateX(0);
  }

  .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0 0 0;
    z-index: 55;
    display: block;
    border: 0;
    background: var(--color-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.drawer-open .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .drawer-container .drawer {
    height: 100%;
    box-shadow: var(--shadow-xl);
  }

  #mobile-side-menu-toggle,
  #drawer-menu {
    display: inline-flex;
  }
}
