/* style.css — чат: темы тёмная/светлая/системная; нейтральные палитры;
модальные окна без затемнения; брейкпоинт max-width: 768px. */
:root {
  --bg:           #0a0b0d;
  --panel:        #15161a;
  --panel-deep:   #0f1013;
  --text:         #e7e8ea;
  --muted:        #8a8d94;
  --green:        #22c55e;
  --red:          #ef4444;
  --scroll-thumb: #2b2d33;
  --nick-own:     #f2f3f5;
  --nick-other:   #c9ccd2;
  --accent:        #b9bdc4;
  --accent-bright: #e6e8eb;
  --accent-ink:    #101114;
  --line:         rgba(255, 255, 255, .08);
  --line-strong:  rgba(255, 255, 255, .18);
  --grad-btn:     linear-gradient(180deg, #e8eaed, #b9bdc4 55%, #8f939a);
  --grad-banner:  linear-gradient(135deg, #c9ccd2, #84878d);
  --work-top:     #0e0f12;
  --friends-ctrl-h: 38px;
}
html[data-theme="light"] {
  --bg:           #e4e4e7;
  --panel:        #f2f2f4;
  --panel-deep:   #e9e9ec;
  --text:         #1a1a1c;
  --muted:        #6c6c72;
  --green:        #15803d;
  --red:          #dc2626;
  --scroll-thumb: #c5c5ca;
  --nick-own:     #101012;
  --nick-other:   #46464a;
  --accent:        #3a3a3e;
  --accent-bright: #0f0f11;
  --accent-ink:    #ffffff;
  --line:         rgba(10, 10, 12, .10);
  --line-strong:  rgba(10, 10, 12, .22);
  --grad-btn:     linear-gradient(180deg, #47474b, #2a2a2d 55%, #19191b);
  --grad-banner:  linear-gradient(135deg, #d8d8dc, #a2a2a8);
  --work-top:     #fafafb;
}
html[data-theme="light"] body { background: var(--bg); }
html[data-theme="light"] body::before {
  background:
    radial-gradient(900px 600px at 12% 8%,  rgba(10, 10, 12, .04), transparent 70%),
    radial-gradient(1000px 700px at 88% 92%, rgba(10, 10, 12, .03), transparent 70%);
}
html[data-theme="light"] .workspace { box-shadow: 0 1px 3px rgba(10, 10, 12, .10); }
html[data-theme="light"] .modal,
html[data-theme="light"] .confirm,
html[data-theme="light"] .msg-menu,
html[data-theme="light"] .emoji-picker__panel,
html[data-theme="light"] .mobile-sheet { box-shadow: 0 12px 32px rgba(10, 10, 12, .18); }
html[data-theme="light"] .friends-tabs,
html[data-theme="light"] .chats-search-box { background: #e9e9ec; border-color: rgba(10, 10, 12, .14); }
html[data-theme="light"] .chats-search-btn:hover { background: rgba(10, 10, 12, .06); color: #1a1a1c; }
html[data-theme="light"] .pm-list__item:hover,
html[data-theme="light"] .friends-item:hover,
html[data-theme="light"] .online-list__item:hover { background: rgba(10, 10, 12, .05); }
html[data-theme="light"] .pm-list__item--active,
html[data-theme="light"] .pm-list__item--active:hover { background: rgba(10, 10, 12, .09); }
html[data-theme="light"] .pm-list__item--unread,
html[data-theme="light"] .pm-list__item--unread:hover { background: rgba(10, 10, 12, .06); }
html[data-theme="light"] .message:hover { background: rgba(10, 10, 12, .045); }
html[data-theme="light"] .message--mention,
html[data-theme="light"] .message--mention:hover { background: rgba(10, 10, 12, .09); }
html[data-theme="light"] .chat__input,
html[data-theme="light"] .settings-about,
html[data-theme="light"] .friend-add-input,
html[data-theme="light"] .auth-form__input { background: #e9e9ec; border-color: rgba(10, 10, 12, .14); }
html[data-theme="light"] .chat__input:focus,
html[data-theme="light"] .settings-about:focus,
html[data-theme="light"] .friend-add-input:focus,
html[data-theme="light"] .auth-form__input:focus { border-color: #3a3a3e; }
html[data-theme="light"] .chat__room-pic--hash,
html[data-theme="light"] .pm-list__avatar--hash { background: rgba(10, 10, 12, .08); color: #3a3a3e; }
html[data-theme="light"] .msg-menu__item:hover { background: rgba(10, 10, 12, .07); color: #0f0f11; }
html[data-theme="light"] .emoji-picker__item:hover { background: rgba(10, 10, 12, .07); }
html[data-theme="light"] .emoji-picker__btn:hover,
html[data-theme="light"] .emoji-picker--open .emoji-picker__btn { color: #0f0f11; }
html[data-theme="light"] .friends-act:hover { background: rgba(10, 10, 12, .08); color: #0f0f11; }
html[data-theme="light"] .modal__close:hover { background: rgba(10, 10, 12, .06); color: #0f0f11; }
html[data-theme="light"] .channel-add__btn:hover { background: rgba(10, 10, 12, .07); color: #0f0f11; }
html[data-theme="light"] .chat__editbar { background: rgba(10, 10, 12, .06); color: #0f0f11; }
html[data-theme="light"] .chat__editbar button:hover { background: rgba(10, 10, 12, .08); color: #0f0f11; }
html[data-theme="light"] .chat__back:hover { color: #0f0f11; }
html[data-theme="light"] .chat__room-act:hover { color: #3a3a3e; }
html[data-theme="light"] .chat__room-act--active,
html[data-theme="light"] .chat__room-act--active:hover { color: #0f0f11; }
html[data-theme="light"] .chat__send:hover,
html[data-theme="light"] .chat__send:active { color: #0f0f11; }
html[data-theme="light"] .header__iconbtn:hover { background: rgba(10, 10, 12, .07); color: #1a1a1c; }
html[data-theme="light"] .header__iconbtn--active,
html[data-theme="light"] .header__iconbtn--active:hover { background: rgba(10, 10, 12, .10); color: #0f0f11; }
html[data-theme="light"] .mobile-bar { background: #f2f2f4; border-top-color: rgba(10, 10, 12, .14); }
html[data-theme="light"] .mobile-bar__btn--active { color: #0f0f11; }
html[data-theme="light"] .mobile-bar__btn--active .mobile-bar__pill { background: rgba(10, 10, 12, .10); }
html[data-theme="light"] .settings-nav__btn:hover { color: #1a1a1c; }
html[data-theme="light"] .settings-nav__btn--active { background: rgba(10, 10, 12, .10); color: #0f0f11; }
html[data-theme="light"] .theme-row__btn:hover { color: #1a1a1c; }
html[data-theme="light"] .theme-row__btn--active {
  background: rgba(10, 10, 12, .10);
  color: #0f0f11;
  border-color: rgba(10, 10, 12, .22);
}
html[data-theme="light"] .status-option:hover,
html[data-theme="light"] .status-option:focus-visible { background: rgba(10, 10, 12, .06); color: #1a1a1c; }
html[data-theme="light"] .status-option--active { color: #0f0f11; }
html[data-theme="light"] .settings-msg--ok   { color: #15803d; }
html[data-theme="light"] .settings-msg--err  { color: #b91c1c; }
html[data-theme="light"] .auth-card__error   { color: #b91c1c; }
html[data-theme="light"] .auth-card__success { color: #15803d; }
html[data-theme="light"] .settings-logout    { color: #dc2626; }
* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% 8%,  rgba(255, 255, 255, .035), transparent 70%),
    radial-gradient(900px 700px at 88% 92%, rgba(255, 255, 255, .025), transparent 70%);
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { filter: brightness(1.25); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
.chat-page { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.header__iconbtn {
  position: relative;
  width: 40px; height: 40px;
  flex: 0 0 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background-color .15s;
}
.header__iconbtn:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.header__iconbtn--active,
.header__iconbtn--active:hover {
  color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.header__icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.header__badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 9px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.header__badge[hidden] { display: none; }
.modal--channel-add { width: 360px; max-width: 92vw; padding: 24px 16px 14px; gap: 10px; }
.channel-add__note { padding: 0 4px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.channel-add__list {
  list-style: none;
  display: flex; flex-direction: column; gap: 0;
  max-height: 300px;
  overflow-y: auto;
}
.channel-add__item { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.channel-add__item + .channel-add__item::before {
  content: "";
  position: absolute;
  top: 0; left: 4px; right: 4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
  pointer-events: none;
}
.channel-add__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  flex: 0 0 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  color: #0b0f14;
  text-transform: uppercase;
  object-fit: cover;
  background: var(--panel-deep);
  user-select: none;
}
html[data-theme="light"] .channel-add__avatar { color: #ffffff; }
.channel-add__login {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 700;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.channel-add__btn {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.channel-add__btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-bright);
}
.channel-add__btn--done,
.channel-add__btn--done:hover {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 45%, transparent);
  background: color-mix(in srgb, var(--green) 10%, transparent);
  cursor: default;
}
.channel-add__empty { color: var(--muted); font-size: 12px; padding: 6px 4px; }
.modal--friend-add { width: 360px; max-width: 92vw; padding: 24px 20px 20px; gap: 14px; }
.friend-add-form { display: flex; flex-direction: column; gap: 10px; }
.friend-add-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--panel-deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.friend-add-input::placeholder { color: var(--muted); }
.friend-add-input:focus { border-color: var(--accent); }
.friend-add-submit {
  padding: 10px;
  border: none; border-radius: 12px;
  background: var(--grad-btn);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .14em;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}
.friend-add-submit:hover  { filter: brightness(1.12); }
.friend-add-submit:active { transform: scale(.98); }
.status-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.status-option {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px; color: var(--text);
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.status-option + .status-option::before {
  content: "";
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
  pointer-events: none;
}
.status-option:hover,
.status-option:focus-visible {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-bright);
  outline: none;
}
.status-option--active { color: var(--accent-bright); }
.status-option--active::after { content: "✓"; margin-left: auto; color: var(--accent); }
.status-option__dot { width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%; background: var(--muted); }
.status-option__dot--online    { background: var(--green); }
.status-option__dot--away      { background: #fbbf24; }
.status-option__dot--busy      { background: #fb923c; }
.status-option__dot--dnd       { background: var(--red); }
.status-option__dot--invisible { background: var(--muted); }
.layout { flex: 1; display: flex; min-height: 0; gap: 0; background: var(--work-top); }
.rail {
  flex: 0 0 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0 16px 20px;
  background: var(--work-top);
  overflow-y: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { width: 0; height: 0; display: none; }
.rail .header__iconbtn:last-child { margin-top: auto; }
.rail .header__icon { width: 20px; height: 20px; }
.rail .header__badge { top: 0; right: 0; box-shadow: 0 0 0 2px var(--work-top); z-index: 1; }
.layout.right-hidden .sidebar--right { display: none; }
.layout.pm-mode      .sidebar--right { display: none; }
.layout.friends-hub  .sidebar--right { display: none; }
.layout.channels-mode .sidebar--right { display: none; }
.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  margin: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  background: var(--work-top);
}
.sidebar {
  position: relative;
  flex: 0 0 320px;
  padding: 20px 14px;
  overflow-y: auto;
  background: var(--panel);
}
.sidebar--left,
.sidebar--right {
  margin: 0;
  border: none;
  border-radius: 0;
  display: flex; flex-direction: column;
}
.sidebar--left {
  flex: 0 0 280px;
  padding: 20px 0 16px;
  overflow-x: hidden;
}
.sidebar__heading {
  display: flex; align-items: center; gap: 10px;
  margin: 0 4px 14px;
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .22em;
  color: var(--accent);
}
.sidebar__heading::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.sidebar__heading--left { margin: 0 2px 12px; flex: 0 0 auto; }
.pm-list {
  list-style: none;
  display: none; flex-direction: column; gap: 0;
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  margin-bottom: 0;
  padding: 0 16px;
}
.sidebar--left.show-chats .pm-list { display: flex; }
.sidebar--left.show-channels .pm-list { display: flex; }
.sidebar--left.show-friends .pm-list { display: flex; }
.friends-tabs {
  flex: 0 0 auto;
  display: flex; gap: 5px;
  margin: 0;
  height: var(--friends-ctrl-h);
  padding: 4px;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 100px;
}
.friends-tabs__btn {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  height: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 14px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--nick-other);
  font-family: inherit;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.friends-tabs__btn:hover { color: var(--accent-bright); }
.friends-tabs__btn--active {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 20%, transparent),
    color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--accent-bright);
}
.friends-tabs__btn--alert { color: var(--accent-bright); }
.friends-tabs__btn--alert:hover { color: var(--accent-bright); }
.friends-tabs__badge {
  flex: 0 0 auto;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 9px; font-weight: 800;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.friends-tabs__badge[hidden] { display: none; }
/* хаб друзей — ОТ КРАЯ ДО КРАЯ с отступами 20px */
.friends-view {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  width: 100%;
}
.layout.friends-hub .friends-view { display: flex; }
.layout.friends-hub .chat__room,
.layout.friends-hub .chat__messages,
.layout.friends-hub .chat__editbar,
.layout.friends-hub .chat__form { display: none; }
.layout.friends-hub .chat::after { content: none; }
.layout.friends-hub .sidebar--left,
.layout.friends-hub .sidebar--right {
  display: none;
}
.layout.friends-hub .chat {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}
/* Шапка хаба друзей: кнопки слева, поиск ПО ЦЕНТРУ 720px (absolute) */
.friends-view__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  width: 100%;
  position: relative;
}
.friends-view__sep {
  flex: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg,
    transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
}
.friends-view .friends-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.pm-list__item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s;
}
.pm-list__item::before {
  content: "";
  position: absolute;
  top: 0; left: 10px; right: 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
  pointer-events: none;
}
.pm-list__item:first-child::before { content: none; }
.pm-list__item:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.pm-list__item--active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pm-list__item--active .pm-list__name { color: var(--accent-bright); }
.pm-list__item--unread { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pm-list__item--unread:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pm-list__item--unread .pm-list__name { color: var(--accent-bright); }
.pm-list__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800;
  color: #0b0f14;
  text-transform: uppercase;
  object-fit: cover;
  background: var(--panel-deep);
  user-select: none;
  cursor: pointer;
}
.pm-list__avatar--hash {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 18px; font-weight: 800;
  cursor: default;
}
.pm-list__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.pm-list__name {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pm-list__pin {
  width: 12px; height: 12px; flex: 0 0 12px;
  display: inline-flex;
  color: var(--accent);
}
.pm-list__pin svg {
  width: 12px; height: 12px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.pm-list__preview {
  font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pm-list__meta {
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 4px;
  align-self: flex-start;
  padding-top: 2px;
}
.pm-list__time { font-size: 10px; color: var(--muted); line-height: 1; }
.pm-list__badge {
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px; font-weight: 800;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.friends-list { list-style: none; display: flex; flex-direction: column; gap: 0; }
.friends-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  transition: background-color .12s ease;
}
.friends-item + .friends-item::before {
  content: "";
  position: absolute;
  top: 0; left: 10px; right: 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
  pointer-events: none;
}
.friends-item:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.friends-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  flex: 0 0 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  color: #0b0f14;
  text-transform: uppercase;
  object-fit: cover;
  background: var(--panel-deep);
  user-select: none;
}
.friends-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.friends-name {
  font-size: 14px; font-weight: 700; letter-spacing: .02em;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.friends-hint {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.friends-actions { display: flex; align-items: center; gap: 2px; }
.friends-act {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.friends-act:hover {
  color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.friends-act--ok,
.friends-act--ok:hover { color: var(--green); }
.friends-act--ok:hover { background: color-mix(in srgb, var(--green) 14%, transparent); }
.friends-act--danger:hover { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.friends-act svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.friends-empty { color: var(--muted); font-size: 12px; padding: 2px 8px; }
.profile {
  position: relative;
  width: 420px; max-width: 92vw;
  padding-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  overflow: hidden;
}
.profile__actions { position: absolute; top: 22px; right: 16px; display: flex; align-items: center; gap: 6px; z-index: 2; }
.profile__act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.profile__act:hover {
  color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.profile__act[hidden] { display: none; }
.profile__act-icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.profile__avatar-wrap {
  position: relative;
  width: 90px; height: 90px;
  margin: 20px 0 0 20px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
}
.profile__avatar {
  width: 90px; height: 90px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800;
  color: #0b0f14;
  text-transform: uppercase;
  object-fit: cover;
  background: var(--panel-deep);
  border: 0 none transparent !important;
  outline: none;
  user-select: none;
}
.profile__status-dot {
  position: absolute; right: 4px; bottom: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--muted);
  box-shadow: 0 0 0 5px var(--panel);
  z-index: 1;
}
.profile__status-dot--online    { background: var(--green); }
.profile__status-dot--away      { background: #fbbf24; }
.profile__status-dot--busy      { background: #fb923c; }
.profile__status-dot--dnd       { background: var(--red); }
.profile__status-dot--invisible { background: var(--muted); }
.profile__status-dot--offline   { background: var(--muted); }
.profile__namerow { display: flex; align-items: center; gap: 10px; padding: 8px 20px 0; }
.profile__name {
  flex: 1; min-width: 0;
  font-size: 18px; font-weight: 800;
  letter-spacing: .04em;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile__status { padding: 2px 20px 0; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.profile__about { padding: 12px 20px 0; }
.profile__about[hidden] { display: none; }
.profile__about-sep {
  height: 1px;
  margin: 0 0 10px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
}
.profile__about-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat {
  position: relative;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: transparent;
}
.chat::before,
.chat::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
  pointer-events: none;
  z-index: 1;
}
.chat::before { left: 0; }
.chat::after  { right: 0; }
.layout.right-hidden .chat::after,
.layout.pm-mode .chat::after,
.layout.friends-hub .chat::after { content: none; }
.chat__room {
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  padding: 20px 20px 0;
}
.chat__room-head { display: flex; align-items: center; gap: 10px; width: 100%; }
.chat__back {
  display: none;
  width: 32px; height: 32px;
  flex: 0 0 32px;
  margin-right: 0;
  align-items: center; justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s;
}
.chat__back:hover { color: var(--accent-bright); }
.chat__back svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.chat__room-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: block; }
.chat__room-avatar.is-clickable { cursor: pointer; }
.chat__room-avatar.is-clickable:hover .chat__room-pic,
.chat__room-avatar.is-clickable:focus-visible .chat__room-pic {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.chat__room-pic {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  object-fit: cover;
  background: var(--panel-deep);
  color: #0b0f14;
  font-size: 16px; font-weight: 800;
  text-transform: uppercase;
  user-select: none;
  line-height: 1;
  text-align: center;
}
.chat__room-pic--hash {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 18px; font-weight: 800;
  line-height: 1;
}
.chat__room-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat__room-name {
  font-size: 15px; font-weight: 800;
  letter-spacing: .03em;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat__room-name.is-clickable { cursor: pointer; transition: color .15s; }
.chat__room-name.is-clickable:hover { color: var(--accent-bright); }
.chat__room-online { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.chat__room-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.chat__room-act {
  width: 20px; height: 20px;
  flex: 0 0 20px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s;
}
.chat__room-act[hidden] { display: none; }
.chat__room-act:hover { color: var(--accent); }
.chat__room-act--active,
.chat__room-act--active:hover { color: var(--accent-bright); }
.chat__room-act-icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.chat__room-sep {
  position: relative;
  z-index: 2;
  display: flex; align-items: center; gap: 12px;
  height: 0;
  margin: 20px 0 0;
  user-select: none;
}
.chat__room-sep::before,
.chat__room-sep::after { content: ""; flex: 1; height: 1px; }
.chat__room-sep::before { background: linear-gradient(90deg, transparent, var(--line-strong)); }
.chat__room-sep::after  { background: linear-gradient(90deg, var(--line-strong), transparent); }
.chat__room-date {
  font-size: 10px; font-weight: 500;
  line-height: 1px;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted);
  white-space: nowrap;
  background: transparent;
}
.chat__room-sep--empty,
.chat__room-sep--hidden { gap: 0; }
.chat__room-sep--empty::before,
.chat__room-sep--empty::after,
.chat__room-sep--hidden::before,
.chat__room-sep--hidden::after { content: none; }
.chat__room-sep--empty .chat__room-date,
.chat__room-sep--hidden .chat__room-date { display: none; }
.chat:not(:has(.chat__day)) .chat__room-sep--empty { height: 1px; }
.chat:not(:has(.chat__day)) .chat__room-sep--empty::before,
.chat:not(:has(.chat__day)) .chat__room-sep--empty::after { content: ""; }
.chat__messages {
  flex: 1; overflow-y: auto;
  padding: 0 0 12px;
  display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chat__messages::-webkit-scrollbar { width: 0; height: 0; display: none; }
.chat__day {
  display: flex; align-items: center; gap: 12px;
  margin: 2px 0;
  padding: 0 20px;
  user-select: none;
}
.chat__day::before { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong)); }
.chat__day::after  { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.chat__messages > .chat__day:first-child { margin-top: 0; }
.chat__day__label {
  font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted);
  white-space: nowrap;
}
.message {
  width: 100%;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 4px 20px;
  border-radius: 0;
  transition: background-color .12s ease;
}
.message:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.message--mention,
.message--mention:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.message__time { flex: 0 0 auto; color: var(--muted); font-size: 11px; letter-spacing: .08em; line-height: 20px; }
.message__avatar {
  width: 20px; height: 20px; border-radius: 50%;
  flex: 0 0 20px;
  object-fit: cover;
  background: var(--panel-deep);
  user-select: none;
  cursor: pointer;
}
.message__avatar--letter {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  color: #0b0f14;
  text-transform: uppercase;
}
.message__author {
  flex: 0 0 auto;
  font-weight: 700; font-size: 14px;
  letter-spacing: .02em;
  line-height: 20px;
  color: var(--nick-own);
  user-select: none;
}
.message__author--other { color: var(--nick-other); cursor: pointer; }
.message__text {
  flex: 1; min-width: 0;
  color: var(--text);
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-emoji { font-size: 20px; line-height: 1; }
.chat__editbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-top: 1px solid var(--line);
  color: var(--accent-bright);
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .14em;
}
.chat__editbar[hidden] { display: none; }
.chat__editbar button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 12px;
  font: inherit;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.chat__editbar button:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-bright);
}
.chat__form {
  position: relative;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 0 16px 20px;
  background: transparent;
}
.chat__input-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.chat__input {
  flex: 1;
  padding: 12px 46px 12px 18px;
  background: var(--panel-deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 22px;
  font-size: 14px; font-family: inherit;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  outline: none;
  transition: border-color .15s;
}
.chat__input::-webkit-scrollbar { width: 4px; }
.chat__input::-webkit-scrollbar-track { background: transparent; }
.chat__input::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 2px; }
.chat__input::placeholder { color: var(--muted); }
.chat__input:focus { border-color: var(--accent); }
.msg-menu {
  position: fixed; z-index: 70;
  min-width: 190px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.msg-menu[hidden] { display: none; }
.msg-menu__item {
  display: flex; align-items: center; gap: 10px;
  border: none;
  background: none;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px; color: var(--text);
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.msg-menu__item:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-bright);
}
.msg-menu__item--danger:hover {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}
.msg-menu__item--active { color: var(--accent-bright); }
.msg-menu__item--active::after { content: "✓"; margin-left: auto; color: var(--accent); }
.msg-menu__icon {
  width: 16px; height: 16px; flex: 0 0 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  opacity: .85;
}
.msg-menu__sep {
  height: 1px;
  margin: 4px 8px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.msg-menu__item--others,
.msg-menu__item--edit { display: none; }
.msg-menu:not(.msg-menu--mine) .msg-menu__item--others { display: flex; }
.msg-menu--editable .msg-menu__item--edit { display: flex; }
.theme-row { display: flex; gap: 6px; }
.theme-row__btn {
  flex: 1;
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-deep);
  color: var(--muted);
  font-family: inherit;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.theme-row__btn:hover { color: var(--text); }
.theme-row__btn--active {
  color: var(--accent-bright);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.emoji-picker { position: static; }
.emoji-picker__btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s;
  z-index: 2;
}
.emoji-picker__btn:hover,
.emoji-picker--open .emoji-picker__btn { color: var(--accent-bright); background: transparent; }
.emoji-picker__icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.emoji-picker__panel {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% + 6px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  z-index: 50;
  overflow: hidden;
}
.emoji-picker__panel[hidden] { display: none; }
.emoji-picker__scroll {
  flex: none;
  height: 308px;
  overflow-y: auto;
  padding: 12px 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}
.emoji-picker__scroll::-webkit-scrollbar { width: 6px; }
.emoji-picker__scroll::-webkit-scrollbar-track { background: transparent; }
.emoji-picker__scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }
.emoji-section { margin-bottom: 10px; }
.emoji-section__head {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 6px;
  color: var(--accent);
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .18em;
}
.emoji-section__head::before,
.emoji-section__head::after { content: ""; flex: 1; height: 1px; }
.emoji-section__head::before { background: linear-gradient(90deg, transparent, var(--line-strong)); }
.emoji-section__head::after  { background: linear-gradient(90deg, var(--line-strong), transparent); }
.emoji-section__icon { font-size: 14px; line-height: 1; }
.emoji-section__title { white-space: nowrap; }
.emoji-section__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 4px;
}
.emoji-picker__item {
  border: none;
  background: none;
  font-size: 40px; line-height: 1;
  height: 56px;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .12s, transform .12s;
}
.emoji-picker__item:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  transform: scale(1.08);
}
.chat__send {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: none;
  align-items: center; justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s;
  z-index: 2;
}
.chat__send:hover { color: var(--accent-bright); }
.chat__send:active { color: var(--accent-bright); transform: translateY(-50%); }
.chat__send-icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  margin: 0;
}
.online-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.online-list__item {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  transition: background-color .12s ease;
}
.online-list__item:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.online-list__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  flex: 0 0 40px;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  color: #0b0f14;
  text-transform: uppercase;
  user-select: none;
  cursor: pointer;
  background: var(--panel-deep);
}
.online-list__avatar--img { object-fit: cover; }
.online-list__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.online-list__name {
  font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: .02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.online-list__status { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.settings-logout {
  display: flex;
  flex: 0 0 auto;
  align-items: center; justify-content: center;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--red) 45%, transparent);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--red);
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .18em;
  text-decoration: none;
  border-radius: 12px;
  transition: background-color .15s;
}
.settings-logout:hover { background: color-mix(in srgb, var(--red) 16%, transparent); }
.settings-logout:active { background: color-mix(in srgb, var(--red) 22%, transparent); }
#settings-overlay { padding: 20px; }
#settings-overlay .modal--settings {
  width: 600px; max-width: 100vw;
  height: 100%;
  max-height: none;
  border-radius: 16px;
  overflow: hidden;
  padding: 24px 24px 20px;
}
.settings-layout { display: flex; gap: 16px; align-items: stretch; flex: 1; min-height: 0; }
.settings-nav {
  flex: 0 0 116px;
  align-self: flex-start;
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.settings-nav__btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1em;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.settings-nav__btn:hover { color: var(--text); }
.settings-nav__btn--active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-bright);
}
.settings-nav__icon {
  width: 16px; height: 16px; flex: 0 0 16px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.settings-panes {
  flex: 1; min-width: 0;
  overflow-y: auto;
  padding: 4px 4px 4px 16px;
  background: linear-gradient(180deg,
      transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent)
    left top / 1px 100% no-repeat;
}
.settings-pane { display: none; }
.settings-pane--active { display: block; }
.settings-msg { font-size: 13px; padding: 9px 11px; border-radius: 10px; }
.settings-msg--ok {
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
  color: var(--green);
}
.settings-msg--err {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  color: var(--red);
}
.settings-form { display: flex; flex-direction: column; gap: 14px; }
.settings-form--about { margin-top: 16px; }
.settings-about-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent);
}
.settings-about-title::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.settings-about {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px; line-height: 20px;
  resize: none;
  overflow-y: auto;
  outline: none;
  transition: border-color .15s;
}
.settings-about::-webkit-scrollbar { width: 4px; }
.settings-about::-webkit-scrollbar-track { background: transparent; }
.settings-about::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 2px; }
.settings-about::placeholder { color: var(--muted); }
.settings-about:focus { border-color: var(--accent); }
.settings-about-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-counter { color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.settings-save {
  padding: 8px 20px;
  border: none; border-radius: 10px;
  background: var(--grad-btn);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .14em;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}
.settings-save:hover  { filter: brightness(1.12); }
.settings-save:active { transform: scale(.98); }
.settings-avatar-btn {
  position: relative;
  display: block;
  margin: 4px auto 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .12s ease;
}
.settings-avatar-btn:hover  { transform: scale(1.03); }
.settings-avatar-btn:active { transform: scale(.98); }
.settings-avatar-wrap { display: block; }
.settings-avatar-btn__overlay {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.settings-avatar-btn:hover .settings-avatar-btn__overlay,
.settings-avatar-btn:focus-visible .settings-avatar-btn__overlay { opacity: 1; }
.settings-avatar-btn__overlay svg {
  width: 26px; height: 26px;
  fill: none; stroke: var(--accent-bright);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.settings-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  margin: 0 auto;
  object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 800;
  color: #0b0f14;
  text-transform: uppercase;
  background: var(--panel-deep);
  border: none;
  user-select: none;
}
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay--top { z-index: 90; }
.modal {
  position: relative;
  width: 380px; max-width: 92vw;
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px 24px 22px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.modal__title {
  text-align: center;
  font-size: 16px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .26em;
  color: var(--accent);
}
.modal__close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 13px; line-height: 1;
  cursor: pointer;
  outline: none;
  transition: color .15s, border-color .15s, background-color .15s;
  z-index: 2;
}
.modal__close:focus-visible { border-color: var(--accent); color: var(--accent-bright); }
.modal__close:hover {
  color: var(--accent-bright);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.confirm {
  width: 360px; max-width: 92vw;
  padding: 22px 22px 18px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.confirm__title {
  font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .2em;
  color: var(--accent);
}
.confirm__text { color: var(--text); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.confirm__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.confirm__btn {
  padding: 9px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .12em;
  cursor: pointer;
  outline: none;
  transition: background-color .15s, color .15s, filter .15s, transform .1s;
}
.confirm__btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent-bright);
}
.confirm__btn:active { transform: scale(.98); }
.confirm__btn:focus-visible { border-color: var(--accent); }
.confirm__btn--ok { border: none; background: var(--grad-btn); color: var(--accent-ink); }
.confirm__btn--ok:hover { filter: brightness(1.12); color: var(--accent-ink); }
.confirm__btn--ok.confirm__btn--danger { background: var(--red); color: #ffffff; }
.confirm__btn--ok.confirm__btn--danger:hover { filter: brightness(1.1); color: #ffffff; }
.mobile-bar { display: none; }
.mobile-bar[hidden] { display: none; }
.mobile-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 46;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 70vh;
  padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  transform: translateY(105%);
  transition: transform .2s ease;
}
.mobile-sheet[hidden] { display: none; }
.mobile-sheet--open { transform: translateY(0); }
.mobile-sheet__grab {
  width: 40px; height: 4px;
  margin: 2px auto 0;
  border-radius: 2px;
  background: var(--line-strong);
}
.mobile-sheet__title {
  text-align: center;
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .22em;
  color: var(--accent);
}
.mobile-sheet__list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@media (max-width: 768px) {
  .rail { display: none; }
  .chat__send { display: flex; }
  .chat__back { display: inline-flex; }
  .emoji-picker__btn { right: 40px; }
  .chat__input { padding-right: 80px; }
  .workspace { margin: 0; border: none; border-radius: 0; }
  .chat::before,
  .chat::after { content: none; }
  .sidebar--left,
  .sidebar--right { margin: 0; border: none; border-radius: 0; }
  .sidebar--left {
    position: fixed;
    left: 0; right: 0; top: 0;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    overflow-x: hidden;
    padding: 20px 0 16px;
    background: var(--panel);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }
  .sidebar--left.show-pm {
    transform: translateX(0);
  }
  .chat {
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-origin: center center;
  }
  .sidebar--left.show-pm ~ .chat {
    transform: scale(0.92);
    opacity: 0.6;
  }
  .sidebar--right { display: none; }
  #profile-overlay { align-items: flex-end; padding: 0; }
  #profile-overlay .profile {
    width: 100%; max-width: none;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding-top: 26px;
    transform: translateY(105%);
    transition: transform .2s ease;
  }
  #profile-overlay .profile::before {
    content: "";
    position: absolute;
    top: 8px; left: 50%;
    width: 40px; height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--line-strong);
  }
  #profile-overlay .profile.profile-sheet--open { transform: translateY(0); }
  .mobile-bar {
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
    padding: 6px 6px 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--panel-deep);
    border-top: 1px solid var(--line-strong);
    position: relative;
    z-index: 40;
  }
  .mobile-bar__btn {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    background: none; border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    cursor: pointer;
    transition: color .15s;
  }
  .mobile-bar__btn--active { color: var(--accent-bright); }
  .mobile-bar__pill {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 48px; height: 26px;
    padding: 0 12px;
    border-radius: 999px;
    transition: background-color .15s;
  }
  .mobile-bar__btn--active .mobile-bar__pill {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
  }
  .mobile-bar__icon {
    width: 20px; height: 20px;
    fill: none; stroke: currentColor;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  }
  .mobile-bar__badge {
    position: absolute; top: -5px; right: 4px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 9px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .mobile-bar__badge[hidden] { display: none; }
  .chat__room-actions { gap: 12px; }
  .chat__form { padding: 0 12px 20px; }
  .chat__input { padding-right: 74px; }
  .emoji-picker__btn { width: 32px; height: 32px; right: 37px; }
  .emoji-picker__icon { width: 18px; height: 18px; }
  .chat__send { width: 32px; height: 32px; right: 5px; }
  .chat__send-icon { width: 18px; height: 18px; }
  .emoji-picker__scroll { height: 268px; }
  .emoji-section__grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .emoji-picker__item { font-size: 34px; height: 48px; }
  .modal { padding: 24px 18px 18px; }
  #settings-overlay .modal--settings { padding: 20px 16px 16px; }
  .settings-layout { flex-direction: column; gap: 12px; }
  .settings-nav { flex: none; align-self: stretch; flex-direction: row; }
  .settings-nav__btn { flex: 1; justify-content: center; }
  .settings-panes { background: none; padding-left: 0; }
  .profile { width: 320px; padding-bottom: 16px; }
  .profile__avatar-wrap { margin: 16px 0 0 16px; }
  .profile__actions { top: 16px; right: 12px; }
  .profile__namerow { padding: 8px 16px 0; }
  .profile__status { padding: 2px 16px 0; }
  .profile__about { padding: 12px 16px 0; }
  .confirm { width: 92vw; }
  .modal--friend-add { padding: 20px 16px 16px; }
  .friends-view { padding: 16px 12px 12px; }
}
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-card {
  position: relative;
  width: 400px; max-width: 92vw;
  padding: 30px 26px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 18px;
}
.auth-card__title {
  text-align: center;
  font-size: 18px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .3em;
  color: var(--accent);
}
.auth-card__note { text-align: center; color: var(--muted); font-size: 13px; }
.auth-card__error {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  color: var(--red);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.auth-card__success {
  background: color-mix(in srgb, var(--green) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
  color: var(--green);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.auth-tabs {
  display: flex; gap: 4px;
  padding: 4px;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.auth-tabs__btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .14em;
  cursor: pointer;
  transition: background-color .15s;
}
.auth-tabs__btn:hover { color: var(--text); }
.auth-tabs__btn--active {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 20%, transparent),
    color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--accent-bright);
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form[hidden] { display: none; }
.auth-form__label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em;
  display: flex; flex-direction: column; gap: 6px;
}
.auth-form__input {
  width: 100%;
  padding: 12px 14px;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px; font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.auth-form__input::placeholder { color: var(--muted); }
.auth-form__input:focus { border-color: var(--accent); }
.auth-form__input:-webkit-autofill,
.auth-form__input:-webkit-autofill:hover,
.auth-form__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel-deep) inset;
  caret-color: var(--text);
  transition: background-color 99999s ease-out;
}
.auth-form__btn {
  margin-top: 2px;
  padding: 12px;
  border: none; border-radius: 12px;
  background: var(--grad-btn);
  color: var(--accent-ink);
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .2em;
  cursor: pointer;
  transition: filter .15s, transform .1s;
}
a.auth-form__btn { display: block; text-align: center; text-decoration: none; }
.auth-form__btn:hover  { filter: brightness(1.12); }
.auth-form__btn:active { transform: scale(.98); }
.auth-form__btn--secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.auth-form__btn--secondary:hover {
  filter: none;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent-bright);
}
.auth-form__btn--green {
  background: linear-gradient(180deg, #86efac, #22c55e 60%, #16a34a);
  color: #052e16;
}
.auth-form__btn--green:hover { filter: brightness(1.1); }
.chats-topbar {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 14px;
  padding: 0 16px;
}
.chats-tabs {
  display: none;
  flex: 0 0 50px;
  min-width: 0;
  width: 50px;
  height: 50px;
  padding: 4px;
  gap: 4px;
  align-items: center;
  overflow: hidden;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 100px;
}
.sidebar--left.show-chats .chats-tabs { display: flex; }
.chats-tabs:not(.chats-tabs--open) .friends-tabs__btn:not(.friends-tabs__btn--active) {
  display: none;
}
.chats-tabs--open {
  position: absolute;
  top: 0;
  left: 16px;
  z-index: 60;
  flex: none;
  width: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
html[data-theme="light"] .chats-tabs--open {
  box-shadow: 0 12px 32px rgba(35, 42, 52, .18);
}
.chats-tabs--open + .chats-search-box { margin-left: 66px; }
.chats-tabs .friends-tabs__btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  justify-content: center;
  padding: 0;
}
.chats-tabs .friends-tabs__btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.chats-search-box {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 50px;
  width: auto;
  padding: 4px;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 100px;
  overflow: hidden;
  transition: border-color .15s;
}
.chats-search-box:hover { border-color: var(--line-strong); }
.chats-search-box:focus-within { border-color: var(--line-strong); }
.chats-search-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 100px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 20%, transparent),
    color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--accent-bright);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.chats-search-btn:hover { color: var(--accent-bright); }
.chats-search-btn__icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.chats-search {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 100%;
  padding: 0 10px 0 16px;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 0;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.chats-search::placeholder { color: var(--muted); }
.chats-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.chats-tabs-sep {
  display: none;
  flex: 0 0 auto;
  height: 1px;
  margin: 0 16px 12px;
  background: linear-gradient(90deg,
    transparent, var(--line-strong) 10%, var(--line-strong) 90%, transparent);
  pointer-events: none;
}
.sidebar--left.show-chats .chats-tabs-sep { display: block; }
.sidebar--left.chats-filter-channels .pm-list__item--pm { display: none; }
.sidebar--left.chats-filter-pm .pm-list__item--channel { display: none; }
.sidebar--left.chats-filter-pinned .pm-list__item:not(.pm-list__item--pinned) { display: none; }
.layout.channels-mode .sidebar--left { display: none; }
.layout.channels-mode .chat { display: none; }
@media (max-width: 768px) {
  .layout.friends-hub .sidebar--left.show-pm { display: flex; }
  .layout.channels-mode .sidebar--left { display: none; }
}
:root {
  --bg: #0c0e12;
  --panel: #15181e;
  --panel-deep: #1b1f26;
  --work-top: #101319;
  --text: #e8ebf0;
  --muted: #9299a6;
  --nick-own: #f2f4f7;
  --nick-other: #c5cad3;
  --accent: #aeb5c0;
  --accent-bright: #f0f2f5;
  --accent-ink: #111318;
  --scroll-thumb: #353a43;
  --line: rgba(255,255,255,.085);
  --line-strong: rgba(255,255,255,.17);
  --grad-btn: linear-gradient(180deg, #e8ebef 0%, #c5cad2 52%, #9ca3ad 100%);
  --grad-banner: linear-gradient(135deg, #30353e, #1c2027);
}
html[data-theme="light"] {
  --bg: #e7e9ed;
  --panel: #f7f8fa;
  --panel-deep: #eceef2;
  --work-top: #f1f3f6;
  --text: #20242b;
  --muted: #69717d;
  --nick-own: #171a20;
  --nick-other: #454c57;
  --accent: #59616d;
  --accent-bright: #242931;
  --accent-ink: #ffffff;
  --scroll-thumb: #b7bdc7;
  --line: rgba(30,35,42,.10);
  --line-strong: rgba(30,35,42,.18);
  --grad-btn: linear-gradient(180deg, #4e5662 0%, #3a414c 52%, #292f38 100%);
  --grad-banner: linear-gradient(135deg, #e3e6eb, #c9ced6);
}
html[data-theme="light"] body { background: #e7e9ed; }
html[data-theme="light"] body::before {
  background:
    radial-gradient(900px 600px at 8% 0%, rgba(255,255,255,.72), transparent 68%),
    radial-gradient(1000px 700px at 92% 100%, rgba(210,214,221,.38), transparent 70%);
}
html[data-theme="light"] .workspace { box-shadow: 0 10px 35px rgba(25,30,38,.08); }
html[data-theme="light"] .friends-tabs,
html[data-theme="light"] .chats-search-box,
html[data-theme="light"] .friends-search-box,
html[data-theme="light"] .mobile-bar { background: #e9ebef; }
html[data-theme="light"] .pm-list__item:hover,
html[data-theme="light"] .friends-item:hover,
html[data-theme="light"] .online-list__item:hover,
html[data-theme="light"] .message:hover { background: rgba(35,40,48,.045); }
html[data-theme="light"] .pm-list__item--active,
html[data-theme="light"] .pm-list__item--active:hover { background: rgba(65,72,82,.085); }
html[data-theme="light"] .pm-list__item--unread,
html[data-theme="light"] .pm-list__item--unread:hover { background: rgba(65,72,82,.06); }
html[data-theme="light"] .message--mention,
html[data-theme="light"] .message--mention:hover { background: rgba(65,72,82,.075); }
html[data-theme="light"] .chat__input,
html[data-theme="light"] .settings-about,
html[data-theme="light"] .friend-add-input,
html[data-theme="light"] .auth-form__input { background: #ffffff; }
html[data-theme="light"] .chat__input:focus,
html[data-theme="light"] .settings-about:focus,
html[data-theme="light"] .friend-add-input:focus,
html[data-theme="light"] .auth-form__input:focus {
  border-color: #727a86;
  box-shadow: 0 0 0 3px rgba(89,97,109,.10);
}
html[data-theme="light"] .header__iconbtn:hover,
html[data-theme="light"] .chats-search-btn:hover,
html[data-theme="light"] .friends-search-btn:hover,
html[data-theme="light"] .friends-act:hover,
html[data-theme="light"] .modal__close:hover,
html[data-theme="light"] .channel-add__btn:hover,
html[data-theme="light"] .msg-menu__item:hover,
html[data-theme="light"] .emoji-picker__item:hover { background: rgba(35,40,48,.065); }
html[data-theme="light"] .settings-nav__btn--active,
html[data-theme="light"] .theme-row__btn--active { background: rgba(65,72,82,.095); color: #20242b; }
html[data-theme="light"] .chats-search-btn,
html[data-theme="light"] .friends-search-box--open .friends-search-btn {
  background: linear-gradient(180deg, #555e6b 0%, #3d4551 100%);
  color: #fff;
}
html[data-theme="light"] .chat__room-date { color: #4e5662; background: rgba(247,248,250,.92); }
html[data-theme="light"] .chat__day__label { color: #69717d; background: #f1f3f6; }
html[data-theme="dark"] .workspace { box-shadow: 0 12px 40px rgba(0,0,0,.28); }
html[data-theme="dark"] .chat__input,
html[data-theme="dark"] .settings-about,
html[data-theme="dark"] .friend-add-input,
html[data-theme="dark"] .auth-form__input { background: #1a1e25; }
html[data-theme="dark"] .chat__input:focus,
html[data-theme="dark"] .settings-about:focus,
html[data-theme="dark"] .friend-add-input:focus,
html[data-theme="dark"] .auth-form__input:focus {
  border-color: #737b88;
  box-shadow: 0 0 0 3px rgba(174,181,192,.08);
}
html[data-theme="dark"] .chat__room-date { color: #d2d6dd; background: rgba(16,19,25,.94); }
html[data-theme="dark"] .chat__day__label { color: #9da4af; background: #101319; }
#settings-overlay .modal--settings {
  width: min(760px, calc(100vw - 32px));
  height: min(820px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  padding: 26px 26px 22px;
  background:
    radial-gradient(520px 260px at 82% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 72%),
    var(--panel);
  box-shadow: 0 24px 70px rgba(0,0,0,.20), 0 2px 10px rgba(0,0,0,.08);
}
#settings-overlay .modal__title {
  margin-bottom: 24px;
  padding-right: 42px;
  font-size: 16px;
  letter-spacing: .28em;
}
.settings-layout { gap: 20px; }
.settings-nav {
  flex-basis: 142px;
  padding: 7px;
  gap: 5px;
  background: color-mix(in srgb, var(--panel-deep) 88%, var(--panel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.settings-nav__btn {
  min-height: 42px;
  padding: 10px 11px;
  border-radius: 9px;
  font-size: 10px;
  letter-spacing: .13em;
  transition: background-color .16s ease, color .16s ease, transform .16s ease;
}
.settings-nav__btn:hover { transform: translateX(1px); }
.settings-nav__btn--active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 8%, transparent);
}
.settings-panes {
  padding: 0 4px 4px 20px;
  background: linear-gradient(180deg,
      transparent, var(--line-strong) 8%, var(--line-strong) 92%, transparent)
    left top / 1px 100% no-repeat;
}
.settings-pane { display: none; }
.settings-pane--active { display: block; }
.settings-pane--active { animation: settings-pane-in .18s ease both; }
@keyframes settings-pane-in {
  from { opacity: .55; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
#pane-avatar .settings-form:first-child { align-items: center; gap: 10px; }
.settings-avatar-btn { margin: 2px auto 0; }
.settings-avatar {
  width: 116px;
  height: 116px;
  font-size: 42px;
  box-shadow: 0 12px 28px rgba(0,0,0,.13);
}
.settings-avatar-btn__overlay { background: color-mix(in srgb, var(--bg) 58%, transparent); }
.settings-profile-head { width: 100%; text-align: center; padding: 2px 0 2px; }
.settings-profile-eyebrow {
  color: var(--muted);
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .22em;
  margin-bottom: 5px;
}
.settings-profile-name {
  color: var(--text);
  font-size: 20px; line-height: 1.15; font-weight: 800; letter-spacing: .015em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-profile-hint { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45; }
#pane-avatar .settings-form--about { margin-top: 24px; gap: 11px; }
.settings-about-title { font-size: 10px; letter-spacing: .2em; }
.settings-about {
  min-height: 116px;
  padding: 13px 14px;
  background: color-mix(in srgb, var(--panel-deep) 78%, var(--panel));
  border-radius: 10px;
  font-size: 13px; line-height: 21px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.025);
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.settings-about:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent), inset 0 1px 2px rgba(0,0,0,.025);
}
.settings-about-foot { align-items: center; }
.settings-counter { font-size: 10px; letter-spacing: .08em; }
.settings-save {
  min-width: 126px;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: 10px;
  letter-spacing: .15em;
  box-shadow: 0 7px 18px rgba(0,0,0,.13);
}
.settings-msg { width: 100%; }
.settings-logout {
  min-height: 42px;
  margin-top: 14px;
  border-radius: 11px;
  letter-spacing: .2em;
  box-shadow: none;
}
html[data-theme="light"] #settings-overlay .modal--settings {
  background:
    radial-gradient(560px 300px at 88% 0%, rgba(110,118,130,.075), transparent 70%),
    linear-gradient(180deg, #fbfcfd 0%, #f5f6f8 100%);
  box-shadow: 0 26px 70px rgba(35,42,52,.16), 0 3px 12px rgba(35,42,52,.08);
}
html[data-theme="light"] .settings-nav {
  background: linear-gradient(180deg, #eef0f3 0%, #e7e9ed 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 8px 22px rgba(40,46,56,.05);
}
html[data-theme="light"] .settings-nav__btn--active {
  background: linear-gradient(180deg, #e0e3e8 0%, #d7dbe1 100%);
  color: #242931;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 4px 12px rgba(40,46,56,.07);
}
html[data-theme="light"] .settings-avatar { box-shadow: 0 14px 30px rgba(35,42,52,.15); }
html[data-theme="light"] .settings-about {
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgba(25,30,38,.025), 0 5px 18px rgba(35,42,52,.045);
}
html[data-theme="light"] .settings-save { box-shadow: 0 8px 18px rgba(35,42,52,.16); }
@media (max-width: 768px) {
  #settings-overlay { align-items: flex-end; padding: 8px; }
  #settings-overlay .modal--settings {
    width: 100%;
    height: calc(100dvh - 8px);
    max-height: calc(100dvh - 8px);
    padding: 20px 14px 12px;
    border-radius: 18px;
  }
  #settings-overlay .modal__title {
    margin-bottom: 16px;
    padding-right: 44px;
    text-align: left;
    font-size: 14px;
    letter-spacing: .24em;
  }
  .settings-layout { gap: 14px; }
  .settings-nav {
    width: 100%;
    flex-basis: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 5px;
    gap: 4px;
  }
  .settings-nav__btn {
    min-height: 44px;
    justify-content: center;
    gap: 7px;
    padding: 8px 5px;
    font-size: 9px;
    letter-spacing: .09em;
  }
  .settings-nav__btn:hover { transform: none; }
  .settings-nav__icon { width: 15px; height: 15px; flex-basis: 15px; }
  .settings-panes {
    padding: 0 2px 2px;
    background: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  #pane-avatar .settings-form:first-child { gap: 8px; }
  .settings-avatar { width: 104px; height: 104px; font-size: 38px; }
  .settings-profile-name { font-size: 19px; }
  .settings-profile-hint {
    max-width: 280px;
    margin-left: auto; margin-right: auto;
    font-size: 10px;
  }
  #pane-avatar .settings-form--about { margin-top: 20px; }
  .settings-about { min-height: 126px; max-height: 190px; }
  .settings-about-foot { gap: 8px; }
  .settings-save { min-width: 116px; min-height: 40px; }
  .settings-logout {
    min-height: 44px;
    margin-top: 10px;
    margin-bottom: max(2px, env(safe-area-inset-bottom, 0px));
  }
  #profile-overlay { align-items: flex-end; padding: 8px; }
  #profile-overlay .profile {
    width: 100%;
    max-height: calc(100dvh - 8px);
    border-radius: 18px;
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
  }
  #profile-overlay .profile::before { top: 8px; width: 36px; height: 4px; margin-left: -18px; }
  .profile__avatar-wrap { margin: 24px auto 0; }
  .profile__namerow { padding: 10px 18px 0; justify-content: center; text-align: center; }
  .profile__name { font-size: 19px; }
  .profile__actions { top: 18px; right: 12px; }
  .profile__status { padding: 4px 18px 0; text-align: center; font-size: 12px; }
  .profile__about { padding: 16px 18px 0; }
  .profile__about-text { font-size: 13px; line-height: 1.55; }
}
.chat__room { padding: 20px 20px 0; }
.chat__room-head { display: flex; align-items: center; gap: 10px; width: 100%; }
.chat__back { margin-right: 0; }
.chat__room-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: block; }
.chat__room-pic {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; text-align: center;
}
.chat__room-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat__room-sep { height: 0; margin: 20px 0 0; }
.chat__room-sep--hidden { margin: 0; }
.chat__messages > .chat__day:first-child { margin: 14px 0 2px; }
.chat__day { padding: 0 20px; }
.message { padding: 4px 20px; }
@media (max-width: 768px) {
  .chat__room { padding: 20px 12px 0; }
  .chat__room-head { gap: 10px; }
  .chat__room-sep { margin-top: 20px; }
  .chat__room-sep--hidden { margin: 0; }
  .chat__messages > .chat__day:first-child { margin: 14px 0 2px; }
  .chat__day { padding: 0 12px; }
  .message { padding: 4px 12px; }
}
/* табы друзей: пилюля той же геометрии */
.friends-view__head .friends-tabs--icons {
  flex: 0 0 auto;
  height: 50px;
  padding: 4px;
  gap: 4px;
  align-items: center;
}
.friends-view__head .friends-tabs--icons .friends-tabs__btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
}
.friends-view__head .friends-tabs--icons .friends-tabs__btn svg {
  width: 20px; height: 20px;
  flex: 0 0 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.friends-view__head .friends-tabs--icons .friends-tabs__badge {
  position: absolute;
  top: 0px; right: 0px;
  z-index: 2;
  box-shadow: 0 0 0 2px var(--panel-deep);
}
html[data-theme="light"] .friends-view__head .friends-tabs--icons .friends-tabs__badge {
  box-shadow: 0 0 0 2px #e9ebef;
}
/* ПОИСК ДРУЗЕЙ: 720px по центру рабочей области.
   Меню кнопок (пилюля) остаётся слева в потоке, поиск позиционируется
   абсолютно по центру через left: 50% + translateX(-50%). */
.friends-search-box {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  max-width: calc(100% - 220px); /* чтобы не наезжал на кнопки слева */
  display: flex;
  align-items: center;
  height: 50px;
  padding: 4px;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 100px;
  overflow: hidden;
  transition: width .25s ease, border-color .15s;
}
.friends-search-box:hover,
.friends-search-box:focus-within { border-color: var(--line-strong); }
.friends-search-box .friends-search {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 100%;
  padding: 0 10px 0 16px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.friends-search-box .friends-search::placeholder { color: var(--muted); }
.friends-search-box .friends-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.friends-search-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--nick-other);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.friends-search-btn:hover { color: var(--accent-bright); }
.friends-search-btn__icon {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
@media (max-width: 768px) {
  /* На мобильных поиск остаётся как был: справа, раскрывается на всю строку */
  .friends-view__head .friends-tabs--icons {
    flex: 1 1 auto;
    min-width: 0;
    height: 50px;
  }
  .friends-view__head .friends-tabs--icons .friends-tabs__btn {
    flex: 1 1 0;
    width: auto;
  }
  .friends-search-box {
    position: static;
    left: auto;
    transform: none;
    flex: 0 0 auto;
    width: 50px;
    max-width: none;
  }
  .friends-search-box .friends-search {
    width: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, padding .25s ease, visibility 0s linear .25s;
  }
  .friends-search-box--open {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 720px;
  }
  .friends-search-box--open .friends-search {
    width: auto;
    padding: 0 10px 0 16px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .18s ease, padding .25s ease, visibility 0s;
  }
  .friends-search-box--open .friends-search-btn {
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--accent) 20%, transparent),
      color-mix(in srgb, var(--accent) 10%, transparent));
    color: var(--accent-bright);
  }
  .friends-view__head.friends-searching .friends-tabs--icons { display: none; }
}
.friends-tabs__btn {
  background: rgba(0, 0, 0, .22);
}
.friends-tabs__btn:hover {
  background: rgba(0, 0, 0, .32);
}
.friends-tabs__btn--active,
.friends-tabs__btn--active:hover {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 20%, transparent),
    color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--accent-bright);
}
html[data-theme="light"] .friends-tabs__btn {
  background: rgba(30, 35, 42, .10);
}
html[data-theme="light"] .friends-tabs__btn:hover {
  background: rgba(30, 35, 42, .18);
}
html[data-theme="light"] .friends-tabs__btn--active,
html[data-theme="light"] .friends-tabs__btn--active:hover {
  background: linear-gradient(180deg, #555e6b 0%, #3d4551 100%);
  color: #ffffff;
}
.layout,
.workspace,
.chat,
.chat__form,
.chat__input-wrap,
.chat__input {
  min-width: 0;
}
.chat__form {
  width: 100%;
}
.chat__input-wrap {
  flex: 1 1 0;
  width: 100%;
}
.chat__input {
  flex: 1 1 0;
  width: 100%;
  max-width: 100%;
}
.chat__input-wrap > .emoji-picker {
  flex: 0 0 0px;
  width: 0;
  min-width: 0;
  overflow: visible;
}
.sidebar {
  flex: 0 1 320px;
  min-width: 260px;
}
.sidebar--right {
  min-width: 240px;
}
@media (max-width: 1200px) {
  .sidebar {
    flex-basis: 280px;
    min-width: 240px;
  }
  .sidebar--right {
    flex-basis: 250px;
    min-width: 220px;
  }
}
@media (max-width: 1100px) {
  .layout:not(.pm-mode):not(.friends-hub):not(.channels-mode) .sidebar--right {
    display: none;
  }
  .layout:not(.pm-mode):not(.friends-hub):not(.channels-mode) .chat::after {
    content: none;
  }
}
@media (max-width: 768px) {
  .sidebar {
    min-width: 0;
  }
  .chat__messages {
    touch-action: pan-y;
  }
}