.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 120;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.sidebar-header {
  flex: 0 0 auto;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.server-info {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-info img {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.server-info h2 {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.sidebar-context {
  margin: 0 0 14px !important;
  padding: 10px !important;
  color: var(--text) !important;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.sidebar-context img {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: cover;
}

.sidebar-context span {
  min-width: 0;
  display: grid;
  flex: 1;
}

.sidebar-context small {
  color: var(--muted);
  font-size: 9px;
}

.sidebar-context strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  margin: 2px 0;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: color .18s ease, background .18s ease;
}

.sidebar a i {
  width: 18px;
  text-align: center;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--text);
  background: var(--accent-soft);
}

.sidebar a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-category {
  position: relative;
  margin: 18px 10px 7px;
  padding-right: 18px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

.sidebar nav > .sidebar-category:first-of-type {
  margin-top: 2px;
}

.sidebar-category::after {
  content: "›";
  position: absolute;
  right: 2px;
  font-size: 16px;
  transform: rotate(0deg);
  transition: transform .18s ease;
}

.sidebar-category.expanded::after { transform: rotate(90deg); }
.sidebar-category:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.sidebar-category-collapsed { display: none !important; }

.sidebar-unselected .sidebar-category {
  padding-right: 0;
  cursor: default;
}

.sidebar-unselected .sidebar-category::after {
  display: none;
}

.sidebar-footer {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.sidebar-footer .server-return {
  justify-content: center;
  min-height: 38px;
  color: var(--text);
  background: var(--surface-soft);
}

.server-return img {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
}

.sidebar-overlay,
.sidebar-edge {
  display: none;
}

.public-main,
body:has(.sidebar) > .bottom-links,
body:has(.sidebar) > .footer {
  margin-left: var(--sidebar-width);
}
