.sections-menu {
  width: min(340px, calc(100vw - 24px));
  max-height: calc(100vh - var(--topbar-h) - var(--safe-top) - var(--safe-bottom) - 24px);
  max-height: calc(100dvh - var(--topbar-h) - var(--safe-top) - var(--safe-bottom) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--coffee) transparent;
  padding: 7px;
  background: #120e09;
}

.sections-menu[hidden],
.section-branches[hidden] {
  display: none;
}

.sections-list,
.section-branches {
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-group + .section-group {
  margin-top: 5px;
}

.section-toggle,
.section-link {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.section-toggle {
  background: rgba(255, 237, 206, .035);
  font-weight: 700;
}

.section-name,
.section-link > span {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.section-name[dir="auto"],
.section-link > span[dir="auto"] {
  text-align: right;
}

.section-count {
  display: grid;
  min-width: 24px;
  height: 24px;
  padding-inline: 5px;
  place-items: center;
  border-radius: 7px;
  background: rgba(241, 201, 136, .08);
  color: var(--cream);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.section-chevron,
.section-link svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--cream);
}

.section-chevron {
  transition: transform 180ms ease;
}

.section-toggle[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: rgba(184, 110, 52, .13);
}

.section-toggle[aria-expanded="true"] .section-chevron {
  transform: rotate(180deg);
}

.section-branches {
  margin: 5px 12px 9px;
  padding-inline-start: 9px;
  border-inline-start: 1px solid var(--line-strong);
}

.section-link {
  min-height: 44px;
  padding: 9px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.section-link:hover,
.section-toggle:hover {
  color: var(--paper);
  background: rgba(241, 201, 136, .08);
}

.section-link:focus-visible,
.section-toggle:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: -2px;
  color: var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  .sections-menu,
  .section-toggle,
  .section-link,
  .section-chevron {
    transition: none;
  }
}
