/* ═══════════════════════════════════════════════════════════════════════════
   Auth
   ═══════════════════════════════════════════════════════════════════════════ */

#auth-screen {
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  overflow-y: auto;
  padding: 24px 16px;
  background: #5865f2;
  background-image:
    radial-gradient(
      circle at 18% 12%,
      rgba(255, 255, 255, 0.14),
      transparent 42%
    ),
    radial-gradient(
      circle at 88% 92%,
      rgba(0, 0, 0, 0.24),
      transparent 48%
    ),
    linear-gradient(160deg, #5865f2 0%, #4752c4 58%, #3c45a5 100%);
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  transform: translateZ(0);
}

.auth-blob.b1 {
  top: -180px;
  left: -140px;
  width: 520px;
  height: 520px;
  background: #7289da;
  opacity: 0.32;
}

.auth-blob.b2 {
  right: -100px;
  bottom: -140px;
  width: 420px;
  height: 420px;
  background: #eb459e;
  opacity: 0.16;
}

.auth-blob.b3 {
  top: 50%;
  left: 50%;
  width: 320px;
  height: 320px;
  background: #57f287;
  transform: translate(-50%, -50%);
  opacity: 0.08;
}

.auth-box {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  flex-shrink: 0;
  width: 100%;
  max-width: 480px;
  margin-block: auto;
  padding: 32px;
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.16),
    0 24px 64px rgba(0, 0, 0, 0.28);
  animation: auth-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--accent);
  border-radius: 13px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-logo-icon svg {
  width: 24px;
  height: 24px;
}

.auth-logo-text {
  color: var(--text-h);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.auth-heading {
  margin-bottom: 8px;
  text-align: center;
}

.auth-title {
  color: var(--text-h);
  font-size: 26px;
  font-weight: 700;
  line-height: 32px;
  letter-spacing: -0.5px;
  overflow-wrap: anywhere;
}

.auth-sub {
  margin-top: 8px;
  color: var(--text2);
  font-size: 15px;
  line-height: 22px;
}

/* Переключение — через ссылки ниже */

.tabs {
  display: none;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.auth-switch {
  margin-top: -8px;
  color: var(--text3);
  font-size: 14px;
  line-height: 20px;
}

.auth-link {
  padding: 0;
  color: var(--link);
  font-size: 14px;
  font-weight: 500;
  border-radius: 3px;
  text-underline-offset: 3px;
}

.auth-link:hover {
  text-decoration: underline;
}


/* ─── App Layout ───────────────────────────────────────────────────────── */

#app-screen {
  flex-direction: row;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}


/* ═══════════════════════════════════════════════════════════════════════════
   Sidebar = рельса + колонка
   ═══════════════════════════════════════════════════════════════════════════ */

.sidebar {
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  width: calc(var(--rail-w) + var(--sidebar-w));
  min-width: calc(var(--rail-w) + var(--sidebar-w));
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--bg1);
  user-select: none;
}

/* Рельса серверов */

.guild-rail {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  width: var(--rail-w);
  min-height: 0;
  padding: 12px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  background: var(--bg);
}

.rail-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  color: var(--text);
  background: var(--bg2);
  border-radius: 50%;
  cursor: pointer;
  transition:
    border-radius 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    transform 0.15s ease;
}

.rail-btn svg {
  width: 24px;
  height: 24px;
}

.rail-btn:hover,
.rail-btn.active {
  color: #fff;
  background: var(--accent);
  border-radius: 16px;
}

.rail-btn:active {
  transform: translateY(1px) scale(0.96);
}

.rail-add {
  color: var(--green);
}

.rail-add:hover {
  color: #fff;
  background: var(--green);
}

.rail-pill {
  position: absolute;
  top: 50%;
  left: -12px;
  width: 8px;
  height: 8px;
  background: var(--text-h);
  border-radius: 0 4px 4px 0;
  opacity: 0;
  transform: translateY(-50%);
  pointer-events: none;
  transition:
    height 0.18s ease,
    opacity 0.18s ease;
}

.rail-btn:hover .rail-pill {
  height: 20px;
  opacity: 1;
}

.rail-btn.active .rail-pill {
  height: 40px;
  opacity: 1;
}

.rail-add .rail-pill {
  display: none;
}

.rail-divider {
  flex-shrink: 0;
  width: 32px;
  height: 2px;
  margin: 2px 0;
  background: #35363c;
  border-radius: 2px;
}

/* Синхронизация активного раздела рельсы со скрытыми табами */

.sidebar:has(.sidebar-tab[data-stab="dm"].active) .rail-btn[data-rail="dm"],
.sidebar:has(.sidebar-tab[data-stab="groups"].active) .rail-btn[data-rail="groups"] {
  color: #fff;
  background: var(--accent);
  border-radius: 16px;
}

.sidebar:has(.sidebar-tab[data-stab="dm"].active) .rail-btn[data-rail="dm"] .rail-pill,
.sidebar:has(.sidebar-tab[data-stab="groups"].active) .rail-btn[data-rail="groups"] .rail-pill {
  height: 40px;
  opacity: 1;
}

/* Колонка */

.sidebar-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg1);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 0;
}

/* Поиск */

.search-box {
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: var(--header-h);
  padding: 0 10px;
  box-shadow: var(--shadow-header);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 20px;
  width: 16px;
  height: 16px;
  color: var(--text3);
  transform: translateY(-50%);
  pointer-events: none;
  transition: color 0.15s ease;
}

.search-box:focus-within .search-icon {
  color: var(--text-h);
}

#search-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 10px 0 32px;
  color: var(--text-h);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 24px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

#search-input::placeholder {
  color: var(--text3);
  font-weight: 500;
  opacity: 1;
}

#search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.search-drop {
  position: absolute;
  top: calc(100% + 6px);
  right: 8px;
  left: 8px;
  z-index: var(--z-dropdown);
  box-sizing: border-box;
  display: none;
  max-height: 320px;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background: var(--bg1);
  border-radius: 10px;
  box-shadow: var(--shadow-lg), var(--shadow-stroke);
}

.search-drop.open {
  display: block;
  animation: drop-in 0.15s ease-out;
}

@keyframes drop-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.s-item {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.s-item:hover {
  background: var(--hover);
}

.s-item:active {
  background: var(--active);
}

.s-item:not(:last-child) {
  margin-bottom: 2px;
}

.s-nick {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.s-item:hover .s-nick {
  color: var(--text-h);
}

.s-id {
  color: var(--text3);
  font-size: 12px;
  line-height: 16px;
}

.s-empty {
  padding: 16px 8px;
  color: var(--text3);
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

/* Табы DM/Группы — скрыты, но сохранены для JS */

.sidebar-tabs {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 2px;
}

@supports not selector(:has(a)) {
  .sidebar-tabs {
    display: flex;
  }
}

.sidebar-tab {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  color: var(--text3);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.sidebar-tab.active {
  color: #fff;
  background: var(--selected);
}

.sidebar-tab:hover:not(.active) {
  color: var(--text);
  background: var(--hover);
}

.sidebar-tab-add {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  color: var(--text3);
  border-radius: 6px;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.sidebar-tab-add:hover {
  color: var(--text-h);
  background: var(--hover);
}

.sidebar-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: 0;
  padding: 0 8px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
}

.section-label {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  min-height: 44px;
  padding: 16px 8px 8px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.section-label:hover {
  color: var(--text);
}

.section-add {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-left: auto;
  color: var(--text3);
  border-radius: 4px;
  opacity: 0;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    opacity 0.15s ease;
}

.section-label:hover .section-add,
.section-add:focus-visible {
  opacity: 1;
}

.section-add:hover {
  color: var(--text-h);
  background: var(--hover);
}

.section-add svg {
  width: 16px;
  height: 16px;
}

/* Заявки в друзья */

.req-card {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
  margin-bottom: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.req-card:hover {
  background: var(--hover);
}

.req-info {
  flex: 1;
  min-width: 0;
}

.req-nick {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.req-card:hover .req-nick {
  color: var(--text-h);
}

.req-id {
  overflow: hidden;
  color: var(--text3);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.req-btns {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  margin-left: auto;
}

.req-card .btn-ok,
.req-card .btn-no {
  background: var(--bg);
}

/* Друзья / группы */

.friend-item {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 12px;
  min-width: 0;
  min-height: 46px;
  padding: 4px 8px;
  color: var(--text3);
  border-radius: 8px;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.friend-item:hover {
  color: var(--text);
  background: var(--hover);
}

.friend-item:active {
  background: var(--active);
}

.friend-item.active,
.friend-item.active:hover {
  color: #fff;
  background: var(--selected);
}

.friend-item:hover .f-nick {
  color: var(--text);
}

.friend-item.active .f-nick {
  color: #fff;
}

.friend-item .f-dot {
  border-color: var(--bg1);
}

.friend-item:hover .f-dot {
  border-color: #34363c;
}

.friend-item.active .f-dot {
  border-color: #3b3d44;
}

.friend-item.unread .f-nick {
  color: var(--text-h);
  font-weight: 600;
}

.group-item {
  flex-wrap: wrap;
  row-gap: 4px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.f-info {
  flex: 1;
  min-width: 0;
}

.f-nick {
  overflow: hidden;
  color: var(--text3);
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.f-stat {
  overflow: hidden;
  color: var(--text3);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.f-stat.on {
  color: var(--text3);
}

.friend-item.active .f-stat,
.friend-item:hover .f-stat {
  color: var(--text2);
}

.f-unread {
  flex-shrink: 0;
  margin-left: auto;
}

/* Голосовой канал внутри карточки группы */

.group-voice-channel {
  box-sizing: border-box;
  display: grid;
  flex: 1 0 calc(100% - 44px);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 6px;
  min-width: 0;
  min-height: 36px;
  margin: 2px 0 0 44px;
  padding: 0 4px 0 6px;
  color: var(--text3);
  background: var(--dc-voice-bg);
  border-radius: 6px;
  font-size: 14px;
  line-height: 20px;
  cursor: default;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.group-voice-channel:hover {
  color: var(--text);
  background: var(--dc-voice-bg-h);
}

.group-voice-channel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 36px;
}

.group-voice-channel-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text3);
  font-size: 16px;
}

.group-voice-channel-icon svg {
  width: 20px;
  height: 20px;
}

.group-voice-channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-voice-channel-count {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
  color: var(--text3);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.group-voice-channel-members {
  display: flex;
  flex-direction: column;
  grid-column: 1 / -1;
  gap: 2px;
  min-width: 0;
  padding: 0 0 5px 22px;
  color: var(--text3);
  font-size: 13px;
}

.group-voice-member {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 3px 6px;
  overflow: hidden;
  color: var(--text2);
  border-radius: 5px;
  font-weight: 500;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.group-voice-member:hover {
  color: var(--text-h);
  background: var(--hover);
}

.group-voice-member i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--dc-green);
  border-radius: 50%;
}

.group-voice-member-avatar {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  font-size: 10px;
}

.group-voice-member.speaking .group-voice-member-avatar {
  box-shadow: 0 0 0 2px var(--green);
}

.group-voice-member.empty {
  color: var(--text3);
  font-style: italic;
  font-weight: 400;
}

.group-voice-member.empty:hover {
  color: var(--text3);
  background: transparent;
}

.group-voice-channel-join {
  box-sizing: border-box;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  min-height: 26px;
  margin-top: 0;
  padding: 3px 8px;
  color: #fff;
  background: var(--green-btn);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    opacity 0.15s ease;
}

.group-voice-channel-join:hover:not(:disabled) {
  background: var(--green-btn-h);
}

.group-voice-channel-join:active:not(:disabled) {
  background: var(--green-btn-a);
}

.group-voice-channel-join:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Пустое состояние */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--text3);
  text-align: center;
  overflow-wrap: anywhere;
}

.empty-icon {
  margin-bottom: 6px;
  opacity: 0.4;
}

.empty-title {
  color: var(--text2);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
}

.empty-sub {
  max-width: 240px;
  font-size: 13px;
  line-height: 20px;
}

/* Панель пользователя внизу */

.sidebar-footer {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
  height: var(--user-panel-h);
  min-height: 48px;
  padding: 0 8px;
  background: var(--panel-user);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.me-card {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0;
  min-width: 0;
  height: 40px;
  margin-left: -2px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.me-card:hover {
  background: var(--hover);
}

.me-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  padding: 4px;
  border-radius: 6px;
}

.me-card:hover .me-avatar-wrap {
  background: transparent;
}

.me-info {
  flex: 1;
  min-width: 0;
  margin-left: -4px;
  padding: 4px 6px 4px 8px;
  border-radius: 6px;
}

.me-card:hover .me-info {
  background: transparent;
}

.me-nick {
  overflow: hidden;
  color: var(--text-h);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-id {
  overflow: hidden;
  color: var(--text2);
  font-size: 12px;
  line-height: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-card .icon-btn,
.sidebar-footer .icon-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  color: var(--text2);
  border-radius: 6px;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.me-card .icon-btn:hover,
.sidebar-footer .icon-btn:hover {
  color: var(--text-h);
  background: var(--hover);
}

.sidebar-footer .icon-btn:active {
  background: var(--active);
}

.sidebar-footer .icon-btn svg {
  width: 20px;
  height: 20px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   Chat Main
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg2);
}

.chat-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding: 32px 24px;
  color: var(--text3);
  text-align: center;
  overflow-wrap: anywhere;
  user-select: none;
}

.chat-empty-icon {
  margin-bottom: 10px;
  opacity: 0.24;
}

.chat-empty-title {
  color: var(--text2);
  font-size: 20px;
  font-weight: 600;
  line-height: 26px;
  letter-spacing: -0.3px;
}

.chat-empty-sub {
  max-width: 320px;
  font-size: 14px;
  line-height: 22px;
}

.chat-window {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-head {
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  min-width: 0;
  height: var(--header-h);
  padding: 0 12px 0 16px;
  background: var(--bg2);
  box-shadow: var(--shadow-header);
  user-select: none;
}

.back-btn {
  display: none;
  flex-shrink: 0;
  margin-left: -8px;
}

.chat-head-info {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-head-nick {
  min-width: 0;
  overflow: hidden;
  color: var(--text-h);
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-head-status {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  color: var(--text3);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

.chat-head-status::before {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background: var(--grey-status);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 2px var(--bg2),
    inset 0 0 0 3px var(--grey-status);
}

.chat-head-status.on::before {
  background: var(--green);
  box-shadow: none;
}

#group-chat-members-count::before {
  display: none;
}

.chat-head-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  margin-left: auto;
}

.chat-head .icon-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: 0;
  color: var(--text2);
  border-radius: 6px;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.chat-head .icon-btn svg {
  width: 22px;
  height: 22px;
}

.chat-head .icon-btn:hover {
  color: var(--text-h);
  background: var(--hover);
}

.chat-head .icon-btn:active {
  color: var(--text-active);
  background: var(--active);
}

.chat-head .icon-btn.active {
  color: var(--text-active);
  background: var(--selected);
}

#chat-head-click,
#group-chat-head-click {
  min-width: 0;
  border-radius: 4px;
  cursor: pointer;
}

#chat-head-click:hover .chat-head-nick,
#group-chat-head-click:hover .chat-head-nick {
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* ─── Фокус с клавиатуры ────────────────────────────────────────────────── */

.auth-link:focus-visible,
.rail-btn:focus-visible,
.s-item:focus-visible,
.sidebar-tab:focus-visible,
.sidebar-tab-add:focus-visible,
.section-add:focus-visible,
.req-card .btn-ok:focus-visible,
.req-card .btn-no:focus-visible,
.friend-item:focus-visible,
.group-voice-member:focus-visible,
.group-voice-channel-join:focus-visible,
.me-card:focus-visible,
.sidebar-footer .icon-btn:focus-visible,
.chat-head .icon-btn:focus-visible,
#chat-head-click:focus-visible,
#group-chat-head-click:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rail-btn:focus-visible {
  outline-color: var(--text-h);
}


/* ─── Небольшие экраны ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #auth-screen {
    padding: 16px 12px;
  }

  .auth-box {
    padding: 26px 20px;
    border-radius: 12px;
  }

  .auth-logo {
    margin-bottom: 20px;
  }

  .auth-title {
    font-size: 24px;
    line-height: 30px;
  }

  .auth-sub {
    font-size: 14px;
    line-height: 20px;
  }

  .chat-head {
    gap: 6px;
    padding-right: 8px;
    padding-left: 12px;
  }

  .chat-head-info {
    gap: 6px;
  }

  .chat-head-actions {
    gap: 2px;
  }

  .chat-empty {
    padding: 24px 16px;
  }
}


/* ─── Сенсорные устройства ──────────────────────────────────────────────── */

@media (hover: none) {
  .section-add {
    opacity: 1;
  }
}


/* ─── Уменьшение анимации по настройке системы ───────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .auth-box,
  .search-drop.open {
    animation: none;
  }

  .rail-btn,
  .rail-pill,
  .search-icon,
  #search-input,
  .s-item,
  .sidebar-tab,
  .sidebar-tab-add,
  .section-label,
  .section-add,
  .req-card,
  .friend-item,
  .f-nick,
  .group-voice-channel,
  .group-voice-member,
  .group-voice-channel-join,
  .me-card,
  .me-card .icon-btn,
  .sidebar-footer .icon-btn,
  .chat-head .icon-btn {
    transition: none;
  }
}