.server-titlebar {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: var(--header-height);
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.24);
  color: var(--text-header);
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-low);
}

.server-title,
.server-titlebar__title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-titlebar .server-subtitle {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
}

.server-titlebar .icon-button {
  width: 28px;
  height: 28px;
}

.channel-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px;
}

.channel-search-icon {
  position: absolute;
  z-index: 1;
  left: 18px;
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.channel-search {
  width: 100%;
  height: 32px;
  padding: 0 50px 0 31px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--bg-input);
  color: var(--text-normal);
  font-size: 13px;
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.channel-search::placeholder {
  color: var(--text-muted);
}

.channel-search:focus {
  border-color: rgba(0, 168, 252, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 168, 252, 0.18);
}

.search-shortcut {
  position: absolute;
  right: 16px;
  pointer-events: none;
}

.channel-search:focus + .search-shortcut,
.channel-search:not(:placeholder-shown) + .search-shortcut {
  opacity: 0;
}

.channel-list {
  min-height: 0;
  padding: 5px 8px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.channel-category,
.channel-section,
.category {
  margin: 13px 0 4px;
}

.channel-category:first-child,
.channel-section:first-child,
.category:first-child {
  margin-top: 3px;
}

.category-header,
.channel-category__header,
.category-title {
  display: flex;
  width: 100%;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 0 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.025em;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
  transition: color var(--duration-fast) var(--ease-standard);
}

.category-header:hover,
.channel-category__header:hover,
.category-title:hover {
  color: var(--text-normal);
}

.category-header .chevron,
.channel-category__header .chevron,
.category-header > .fa-chevron-down,
.category-header > .fa-chevron-right {
  width: 10px;
  color: var(--text-muted);
  font-size: 8px;
  transform-origin: center;
  transition: transform var(--duration-fast) var(--ease-standard);
}

.channel-category.is-collapsed .chevron,
.channel-category[aria-expanded="false"] .chevron,
.category-header[aria-expanded="false"] .chevron {
  transform: rotate(-90deg);
}

.category-count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 650;
}

.category-add,
.category-action {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  margin-left: auto;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 12px;
}

.category-add:hover,
.category-action:hover {
  color: var(--text-normal);
}

.channel-items,
.channel-category__items {
  display: grid;
  gap: 1px;
}

.channel-category.is-collapsed .channel-items,
.channel-category.is-collapsed .channel-category__items,
.channel-category[aria-expanded="false"] .channel-items {
  display: none;
}

.channel-row,
.channel-item,
.channel {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 20px;
  text-align: left;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.channel-row:hover,
.channel-item:hover,
.channel:hover {
  background: var(--bg-modifier-hover);
  color: #dbdee1;
}

.channel-row.is-active,
.channel-row.active,
.channel-row[aria-current="page"],
.channel-item.is-active,
.channel-item[aria-current="page"],
.channel.is-active,
.channel[aria-current="page"] {
  background: var(--bg-modifier-selected);
  color: var(--text-normal);
}

.channel-row.is-unread,
.channel-item.is-unread,
.channel.is-unread {
  color: var(--text-normal);
  font-weight: 600;
}

.channel-row.is-unread::before,
.channel-item.is-unread::before,
.channel.is-unread::before {
  position: absolute;
  left: -8px;
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--text-normal);
  content: "";
}

.channel-icon,
.channel-hash,
.channel-row > .fa-solid,
.channel-item > .fa-solid,
.channel > .fa-solid {
  display: inline-grid;
  width: 20px;
  flex: 0 0 20px;
  place-items: center;
  color: var(--text-muted);
  font-size: 15px;
}

.channel-row:hover .channel-icon,
.channel-row.is-active .channel-icon,
.channel-item:hover .channel-icon,
.channel-item.is-active .channel-icon,
.channel:hover .channel-icon,
.channel.is-active .channel-icon {
  color: currentColor;
}

.channel-name,
.channel-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-name::before {
  color: var(--text-faint);
}

.channel-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-standard);
}

.channel-row:hover .channel-actions,
.channel-row:focus-within .channel-actions,
.channel-row.is-active .channel-actions,
.channel-item:hover .channel-actions,
.channel-item:focus-within .channel-actions,
.channel:hover .channel-actions,
.channel:focus-within .channel-actions {
  opacity: 1;
}

.channel-action,
.favorite-button,
.channel-favorite {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 12px;
}

.channel-action:hover,
.favorite-button:hover,
.channel-favorite:hover {
  color: var(--text-normal);
}

.favorite-button.is-favorite,
.favorite-button[aria-pressed="true"],
.channel-favorite.is-favorite,
.channel-favorite[aria-pressed="true"] {
  color: var(--yellow);
  opacity: 1;
}

.channel-badge,
.unread-badge {
  min-width: 17px;
  height: 16px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.channel-list-empty,
.channel-empty {
  margin: 22px 8px;
  padding: 18px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.channel-list-empty .fa-solid,
.channel-empty .fa-solid {
  display: block;
  margin-bottom: 9px;
  color: var(--text-faint);
  font-size: 20px;
}

.user-panel {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: var(--user-panel-height);
  align-items: center;
  gap: 3px;
  padding: 5px 7px;
  background: #232428;
}

.user-identity {
  display: flex;
  min-width: 0;
  height: 42px;
  align-items: center;
  flex: 1 1 auto;
  gap: 8px;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.user-identity:hover {
  background: var(--bg-modifier-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.user-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  line-height: 1.12;
}

.user-copy strong {
  overflow: hidden;
  color: var(--text-normal);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy > span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.user-actions .icon-button {
  width: 30px;
  height: 32px;
  font-size: 14px;
}

[data-density="compact"] .channel-row,
[data-density="compact"] .channel-item,
[data-density="compact"] .channel {
  min-height: 28px;
  padding-top: 3px;
  padding-bottom: 3px;
  font-size: 14px;
}

[data-density="compact"] .channel-category,
[data-density="compact"] .channel-section,
[data-density="compact"] .category {
  margin-top: 8px;
}

[data-density="compact"] .channel-search-wrap {
  padding-top: 5px;
  padding-bottom: 5px;
}

@media (max-width: 720px) {
  .search-shortcut {
    display: none;
  }

  .channel-search {
    padding-right: 12px;
  }
}
