:root {
  --brand: #1e9be0;
  --brand-2: #127cc0;
  --accent: #ffd60a;
  --danger: #e5484d;
  --ok: #2fb36b;
  --bg: #e9f0f6;
  --panel: #ffffff;
  --panel-2: #f4f7fa;
  --line: #e1e8ef;
  --text: #15212c;
  --muted: #6b7b8a;
  --hover: #eef4f9;
  --active: #d9ecfa;
  --bubble: #ffffff;
  --bubble-mine: #d4eeff;
  --chat-bg: #dfeaf3;
  --rail: #e6edf3;
  --shadow: 0 8px 30px rgba(15, 40, 70, .15);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c141c;
    --panel: #14202b;
    --panel-2: #1a2834;
    --line: #233340;
    --text: #e6eef5;
    --muted: #8a9bab;
    --hover: #1b2a37;
    --active: #1d3b55;
    --bubble: #1b2a37;
    --bubble-mine: #17527c;
    --chat-bg: #0f1922;
    --rail: #1a2733;
    --shadow: 0 8px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
img { max-width: 100%; }
svg { display: block; }

.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; }
.splash img { width: 110px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ── buttons ── */
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; background: var(--panel-2);
  font-weight: 600; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.danger:hover { background: rgba(229, 72, 77, .1); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--muted); flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--brand); }
.icon-btn svg { width: 22px; height: 22px; }

input[type=text], input[type=password], input[type=search], input:not([type]), textarea.field {
  width: 100%; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px;
  padding: 10px 12px; outline: none;
}
input:focus, textarea.field:focus { border-color: var(--brand); }

/* ── auth ── */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(circle at 20% 10%, rgba(30,155,224,.35), transparent 50%),
              radial-gradient(circle at 90% 90%, rgba(255,214,10,.25), transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow); text-align: center; }
.auth-logo { width: 96px; height: 96px; }
.auth-card h1 { margin: 6px 0 18px; font-size: 24px; }
.tabs { display: flex; background: var(--panel-2); border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.tabs button.active { background: var(--panel); color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
#authForm { display: grid; gap: 12px; text-align: left; }
#authForm label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ── layout ── */
.app { display: flex; height: 100%; height: 100dvh; }
.sidebar { width: 400px; max-width: 100%; flex: none; display: flex; background: var(--panel); border-right: 1px solid var(--line); }
.side-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── полоса серверов ── */
.rail {
  width: 84px; flex: none; background: var(--rail); overflow-y: auto; scrollbar-width: none;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 0; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.rail::-webkit-scrollbar { display: none; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--line); flex: none; }
.rail-item { position: relative; flex: none; width: 56px; height: 56px; }
.rail-btn {
  width: 56px; height: 56px; border: 0; padding: 0; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--panel); color: var(--text); font-weight: 700; font-size: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  transition: border-radius .18s ease, background .18s, color .18s;
}
.rail-btn img { width: 100%; height: 100%; object-fit: cover; }
.rail-btn.home img { width: 38px; height: 38px; object-fit: contain; }
.rail-item:hover .rail-btn, .rail-item.active .rail-btn { border-radius: 18px; }
.rail-item:hover .rail-btn:not(.has-img), .rail-item.active .rail-btn:not(.has-img) { background: var(--brand); color: #fff; }
.rail-btn.add { color: var(--ok); font-size: 26px; font-weight: 400; }
.rail-item:hover .rail-btn.add { background: var(--ok); color: #fff; }
.rail-btn.add svg { width: 24px; height: 24px; }
.rail-pill {
  position: absolute; left: -14px; top: 50%; width: 5px; height: 0; border-radius: 0 4px 4px 0; background: var(--text);
  transform: translateY(-50%); transition: height .18s ease;
}
.rail-item.unread .rail-pill { height: 8px; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.active .rail-pill { height: 44px; }
.rail-badge {
  position: absolute; right: -4px; bottom: -4px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: grid; place-items: center; border: 3px solid var(--rail);
  box-sizing: content-box;
}
.rail-voice { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; border: 3px solid var(--rail); }
.rail-voice svg { width: 10px; height: 10px; }

/* ── панель сервера ── */
.server-head {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: var(--panel);
  padding: 0 14px; height: 52px; min-height: 52px; font-weight: 700; font-size: 16px; text-align: left;
  border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.server-head:hover { background: var(--hover); }
.server-head span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-head svg { width: 18px; height: 18px; color: var(--muted); }
.channel-list { flex: 1; overflow-y: auto; padding: 8px 8px 12px; }
.ch-section { display: flex; align-items: center; padding: 14px 4px 4px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ch-section span { flex: 1; }
.ch-section button { border: 0; background: none; color: var(--muted); width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border-radius: 4px; }
.ch-section button:hover { color: var(--text); }
.ch-section button svg { width: 16px; height: 16px; }
.ch-item {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin: 1px 0; border-radius: 6px;
  color: var(--muted); cursor: pointer; user-select: none; font-weight: 500;
}
.ch-item:hover { background: var(--hover); color: var(--text); }
.ch-item.active { background: var(--active); color: var(--text); }
.ch-item.unread { color: var(--text); font-weight: 700; }
.ch-item.unread::before { content: ""; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.ch-item .ch-ico { width: 20px; height: 20px; flex: none; opacity: .8; }
.ch-item .ch-ico svg { width: 20px; height: 20px; }
.ch-item .ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-item .badge { background: var(--danger); }
.voice-users { padding: 0 0 4px 30px; display: grid; gap: 2px; }
.voice-user { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.voice-user:hover { background: var(--hover); }
.voice-user .avatar { transition: box-shadow .1s; }
.voice-user span.vn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user .vi { width: 16px; height: 16px; color: var(--danger); }
.voice-user .vi svg { width: 16px; height: 16px; }
.speaking > .avatar .av-in, .avatar.speaking .av-in { box-shadow: 0 0 0 2px var(--ok); }

.voice-panel { border-top: 1px solid var(--line); background: var(--panel-2); padding: 8px 10px; display: flex; align-items: center; gap: 6px; }
.voice-panel .vp-text { flex: 1; min-width: 0; line-height: 1.25; }
.voice-panel .vp-title { color: var(--ok); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.voice-panel .vp-title svg { width: 16px; height: 16px; }
.voice-panel .vp-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── участники сервера (справа) ── */
.member-panel { width: 240px; flex: none; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 12px 8px; }
.mp-section { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 12px 8px 4px; }
.mp-user { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; cursor: pointer; }
.mp-user:hover { background: var(--hover); }
.mp-user.offline { opacity: .45; }
.mp-user .mp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mp-user .crown { color: #f0b232; width: 16px; height: 16px; flex: none; }
.mp-user .crown svg { width: 16px; height: 16px; }
.role-tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: rgba(30,155,224,.15); color: var(--brand); }
.chan-hash { width: 42px; height: 42px; flex: none; display: grid; place-items: center; color: var(--muted); }
.chan-hash svg { width: 26px; height: 26px; }
.bubble.mention { background: color-mix(in srgb, var(--accent) 22%, var(--bubble)); box-shadow: inset 3px 0 0 #f0b232, 0 1px 1px rgba(0,0,0,.08); }
/* ── роли ── */
.role-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.role-chip.add { cursor: pointer; color: var(--muted); padding: 3px 10px; }
.role-chip.add:hover { color: var(--brand); border-color: var(--brand); }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.role-dot.big { width: 14px; height: 14px; }
.role-list { display: grid; gap: 2px; }
.role-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.role-row:hover { background: var(--hover); }
.role-row.locked { opacity: .55; cursor: not-allowed; }
.role-row .rr-body { flex: 1; min-width: 0; }
.role-row .rr-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-row .rr-sub { font-size: 12px; color: var(--muted); }
.role-row .rr-move { display: flex; }
.role-row .rr-move .icon-btn { width: 30px; height: 30px; }
.role-row .rr-move .icon-btn svg { width: 18px; height: 18px; }
.role-row .rr-move .icon-btn:disabled { opacity: .25; cursor: default; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { position: relative; width: 28px; height: 28px; border-radius: 6px; border: 2px solid transparent; padding: 0; cursor: pointer; display: grid; place-items: center; font-size: 14px; }
.swatch.sel { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--panel); }
.swatch.none { background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 4px, var(--line) 4px, var(--line) 8px); }
.swatch.custom { background: var(--panel-2); overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.role-preview { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm-row.locked { opacity: .5; cursor: not-allowed; }
.perm-row .pr-text { flex: 1; min-width: 0; }
.perm-row .pr-text b { display: block; font-size: 14px; }
.perm-row .pr-text small { color: var(--muted); font-size: 12px; }
.perm-row input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.perm-row .toggle { position: relative; width: 40px; height: 24px; border-radius: 12px; background: var(--line); flex: none; transition: background .15s; }
.perm-row .toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.perm-row input:checked + .toggle { background: var(--ok); }
.perm-row input:checked + .toggle::after { transform: translateX(16px); }
.perm-row input:focus-visible + .toggle { outline: 2px solid var(--brand); outline-offset: 2px; }
.composer textarea:disabled { opacity: .6; cursor: not-allowed; }
.send-btn:disabled { opacity: .5; cursor: default; }
/* ── сообщения в стиле Discord ── */
.messages { padding: 8px 0 16px; gap: 0; background: var(--panel); }
.day-line { display: flex; align-items: center; gap: 8px; margin: 20px 16px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day-line::before, .day-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dmsg { position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr); padding: 2px 48px 2px 0; margin-top: 16px; }
.dmsg.cont { margin-top: 0; }
.dmsg:hover { background: rgba(127, 127, 127, .07); }
.dmsg.mention { background: rgba(240, 178, 50, .1); box-shadow: inset 2px 0 0 #f0b232; }
.dmsg.mention:hover { background: rgba(240, 178, 50, .14); }
.dmsg.flash { animation: flashbg 1.4s ease; }
@keyframes flashbg { 20% { background: rgba(30, 155, 224, .22); } }
.dm-gutter { display: flex; justify-content: center; align-items: flex-start; padding-top: 2px; }
.dm-avatar { cursor: pointer; }
.dm-avatar:active { transform: translateY(1px); }
.dm-htime { font-size: 11px; color: var(--muted); visibility: hidden; padding-top: 4px; user-select: none; }
.dmsg.cont:hover .dm-htime { visibility: visible; }
.dm-body { min-width: 0; }
.dm-head { display: flex; align-items: baseline; gap: 8px; line-height: 1.375; flex-wrap: wrap; }
.dm-name { font-weight: 600; cursor: pointer; color: var(--text); }
.dm-name:hover { text-decoration: underline; }
.dm-crown { display: inline-block; width: 14px; height: 14px; color: #f0b232; align-self: center; }
.dm-crown svg { width: 14px; height: 14px; }
.dm-time { font-size: 12px; color: var(--muted); }
.dm-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.375; }
.dm-text.deleted { color: var(--muted); font-style: italic; }
.dm-edited { font-size: 11px; color: var(--muted); margin-left: 4px; user-select: none; }
.dm-status { display: inline-block; width: 16px; height: 16px; color: var(--muted); vertical-align: middle; margin-left: 4px; }
.dm-status svg { width: 16px; height: 16px; }
.dm-status.read { color: var(--brand); }
.jumbo { font-size: 44px; line-height: 1.2; }
.mention-pill { background: rgba(30, 155, 224, .15); color: var(--brand); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention-pill.me { background: rgba(240, 178, 50, .25); color: #c88a00; }
@media (prefers-color-scheme: dark) { .mention-pill.me { color: #f5c451; } }
.dm-reply { grid-column: 1 / -1; position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0 0 2px 72px; font-size: 13px; color: var(--muted); cursor: pointer; }
.dm-reply::before { content: ""; position: absolute; left: -38px; top: 50%; width: 30px; height: 12px; border-left: 2px solid var(--line); border-top: 2px solid var(--line); border-top-left-radius: 6px; }
.dm-reply b { color: var(--text); font-weight: 600; flex: none; }
.dm-reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-reply:hover span { color: var(--text); }
.dm-sys { display: flex; align-items: center; gap: 12px; padding: 6px 48px 6px 28px; margin-top: 8px; color: var(--muted); font-size: 14px; }
.dm-sys:hover { background: rgba(127, 127, 127, .07); }
.dm-sys .sys-ico { width: 18px; height: 18px; color: var(--ok); flex: none; }
.dm-sys .sys-ico svg { width: 18px; height: 18px; }
.dm-sys .sys-text { color: var(--text); opacity: .85; }
.dm-body .call-msg { margin-top: 2px; }

.att-img { display: block; max-width: min(420px, 100%); max-height: 350px; border-radius: 8px; margin-top: 4px; cursor: zoom-in; background: var(--panel-2); }
.att-video { display: block; max-width: min(480px, 100%); max-height: 360px; border-radius: 8px; margin-top: 4px; background: #000; }
.att-card { display: flex; flex-direction: column; gap: 8px; max-width: 432px; margin-top: 4px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: inherit; text-decoration: none; }
.att-card.file:hover { border-color: var(--brand); }
.att-card .ac-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.att-card .ac-info { flex: 1; min-width: 0; }
.att-card .ac-name { display: block; font-weight: 600; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.att-card .ac-name:hover { text-decoration: underline; }
.att-card .ac-dl { width: 22px; height: 22px; color: var(--muted); flex: none; }
.att-card .ac-dl svg { width: 22px; height: 22px; }
.att-card audio { width: 100%; height: 40px; }
.file-ico.music { background: linear-gradient(135deg, #9b59b6, #e91e63); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent; background: var(--panel-2); font-size: 15px; line-height: 1; }
.react:hover { border-color: var(--line); }
.react.me { background: rgba(30, 155, 224, .15); border-color: var(--brand); }
.react .rc { font-size: 13px; font-weight: 700; color: var(--muted); }
.react.me .rc { color: var(--brand); }
.react.add { color: var(--muted); opacity: 0; padding: 0 6px; }
.react.add svg { width: 18px; height: 18px; }
.dmsg:hover .react.add { opacity: 1; }

.dm-tools { position: absolute; right: 16px; top: -18px; display: none; gap: 0; padding: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); z-index: 3; }
.dm-tools button { width: 34px; height: 32px; border: 0; background: none; border-radius: 6px; color: var(--muted); display: grid; place-items: center; }
.dm-tools button svg { width: 20px; height: 20px; }
.dm-tools button:hover { background: var(--hover); color: var(--text); }
.dm-tools button.danger:hover { color: var(--danger); }
@media (hover: hover) { .dmsg:hover .dm-tools { display: flex; } }

.emoji-pick { position: fixed; z-index: 65; width: 320px; max-width: calc(100vw - 16px); max-height: 340px; overflow-y: auto; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.ep-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 4px 4px; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.ep-grid button { border: 0; background: none; font-size: 22px; height: 36px; border-radius: 6px; padding: 0; }
.ep-grid button:hover { background: var(--hover); }

.attach-tray { display: flex; gap: 10px; overflow-x: auto; padding: 10px 12px; background: var(--panel); border-top: 1px solid var(--line); }
.pend { position: relative; flex: none; width: 150px; padding: 8px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); }
.pend-prev { height: 100px; border-radius: 6px; overflow: hidden; display: grid; place-items: center; background: var(--panel); color: var(--muted); }
.pend-prev img, .pend-prev video { width: 100%; height: 100%; object-fit: cover; }
.pend-prev svg { width: 40px; height: 40px; }
.pend-name { font-size: 13px; font-weight: 600; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pend-size { font-size: 11px; color: var(--muted); }
.pend-x { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--danger); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.pend-x svg { width: 16px; height: 16px; }

.vad-box { display: grid; gap: 10px; padding: 12px; border-radius: 10px; background: var(--panel-2); }
.vad-value { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.vad-meter { position: relative; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.vad-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #f0b232; transition: width .05s linear; }
.vad-meter.on .vad-fill { background: var(--ok); }
.vad-mark { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: var(--text); border-radius: 2px; }
.vad-slider { width: 100%; accent-color: var(--brand); }

@media (max-width: 760px) {
  .dmsg { grid-template-columns: 56px minmax(0, 1fr); padding-right: 12px; }
  .dm-reply { margin-left: 56px; }
  .dm-reply::before { left: -30px; width: 24px; }
  .dm-sys { padding: 6px 12px 6px 18px; }
}
.invite-box { display: flex; gap: 8px; }
.invite-box input { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.server-preview { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.server-icon-big { width: 88px; height: 88px; border-radius: 24px; overflow: hidden; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff; }
.server-icon-big img { width: 100%; height: 100%; object-fit: cover; }
.kind-pick { display: grid; gap: 8px; }
.kind-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 2px solid transparent; cursor: pointer; }
.kind-opt.sel { border-color: var(--brand); }
.kind-opt svg { width: 22px; height: 22px; color: var(--muted); }
.kind-opt b { display: block; }
.kind-opt small { color: var(--muted); }
.main { flex: 1; min-width: 0; position: relative; display: flex; background: var(--chat-bg); }

.side-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px; padding-top: max(10px, env(safe-area-inset-top)); }

/* ── панель пользователя (снизу слева, в стиле Discord) ── */
.user-panel {
  display: flex; align-items: center; gap: 2px; flex: none;
  padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom));
  background: var(--panel-2); border-top: 1px solid var(--line); min-height: 56px;
}
.up-user {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  border: 0; background: none; padding: 4px 6px 4px 4px; border-radius: 8px; text-align: left;
}
.up-user:hover { background: var(--hover); }
.up-user .avatar.online::after, .up-user .avatar.away::after { border-color: var(--panel-2); }
.avatar.away::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 26%; height: 26%; min-width: 10px; min-height: 10px; border-radius: 50%; background: #f0b232; border: 2px solid var(--panel); }
.up-text { min-width: 0; line-height: 1.2; }
.up-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-sub { position: relative; height: 16px; font-size: 12px; color: var(--muted); overflow: hidden; }
.up-sub span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform .18s ease; }
.up-user:hover .up-sub span { transform: translateY(-16px); }
.up-btn {
  width: 34px; height: 34px; flex: none; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); display: grid; place-items: center;
}
.up-btn:hover { background: var(--hover); color: var(--text); }
.up-btn svg { width: 20px; height: 20px; }
.up-btn.off { color: var(--danger); }
.brand { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; min-width: 0; }
.brand img { width: 26px; height: 26px; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { position: relative; padding: 4px 12px 8px; }
.search input { padding-left: 38px; border-radius: 22px; }
.search-ico { position: absolute; left: 24px; top: 14px; color: var(--muted); }
.search-ico svg { width: 18px; height: 18px; }
.conn-bar { text-align: center; font-size: 12px; color: var(--muted); padding: 4px; background: var(--panel-2); }

.chat-list { flex: 1; overflow-y: auto; padding: 0 6px 10px; }
.list-section { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 10px 4px; }
.list-empty { color: var(--muted); text-align: center; padding: 30px 20px; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer; user-select: none; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.ci-body { flex: 1; min-width: 0; }
.ci-top, .ci-bottom { display: flex; align-items: center; gap: 6px; }
.ci-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-time { font-size: 12px; color: var(--muted); flex: none; }
.ci-preview { flex: 1; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-preview .typing, .typing { color: var(--brand); }
.badge { background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; display: inline-grid; place-items: center; flex: none; }

/* ── avatar ── */
.avatar { position: relative; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; overflow: visible; user-select: none; }
.avatar .av-in { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.online::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 26%; height: 26%; min-width: 10px; min-height: 10px; border-radius: 50%; background: var(--ok); border: 2px solid var(--panel); }
.avatar .av-in svg { width: 55%; height: 55%; }

/* ── empty ── */
.empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.empty img { width: 130px; opacity: .95; }
.empty h2 { color: var(--text); margin: 10px 0 4px; }

/* ── chat ── */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.chat-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); min-height: 60px; }
.chat-head .back { display: none; }
.chat-head-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 2px 6px; border-radius: 10px; }
.chat-head-info:hover { background: var(--hover); }
.chi-text { min-width: 0; }
.chi-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chi-status { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chi-status.on { color: var(--brand); }

.messages { flex: 1; overflow-y: auto; padding: 12px 4% 8px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.messages .loader { text-align: center; color: var(--muted); font-size: 13px; padding: 8px; }
.day-sep { align-self: center; background: rgba(0,0,0,.18); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; margin: 10px 0 6px; }
@media (prefers-color-scheme: dark) { .day-sep { background: rgba(255,255,255,.1); } }
.sys-msg { align-self: center; text-align: center; font-size: 13px; color: var(--muted); background: var(--panel); padding: 4px 12px; border-radius: 12px; margin: 6px 0; max-width: 90%; }

.msg { display: flex; align-items: flex-end; gap: 8px; max-width: min(620px, 88%); }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.cont { margin-top: -1px; }
.msg .avatar { margin-bottom: 2px; }
.msg .av-spacer { width: 32px; flex: none; }
.msg.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 3px var(--accent); } }
.bubble { position: relative; background: var(--bubble); padding: 6px 10px 6px; border-radius: 16px; border-bottom-left-radius: 6px; box-shadow: 0 1px 1px rgba(0,0,0,.08); min-width: 64px; max-width: 100%; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--bubble-mine); border-bottom-left-radius: 16px; border-bottom-right-radius: 6px; }
.bubble .sender { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; }
.bubble .text.deleted { color: var(--muted); font-style: italic; }
.bubble .meta { float: right; margin: 6px 0 -4px 10px; font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; user-select: none; }
.bubble .meta svg { width: 16px; height: 16px; }
.bubble .meta .read { color: var(--brand); }
.msg.mine .meta { color: color-mix(in srgb, var(--muted) 80%, var(--brand)); }
.bubble.media { padding: 4px; }
.bubble.media .text { padding: 4px 6px 2px; }
.bubble.media .meta { margin-right: 6px; }
.bubble .m-img { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; cursor: zoom-in; background: var(--panel-2); }
.bubble video.m-video { display: block; max-width: 100%; max-height: 360px; border-radius: 12px; background: #000; }
.reply-quote { border-left: 3px solid var(--brand); background: rgba(30,155,224,.1); border-radius: 6px; padding: 3px 8px; margin: 2px 0 4px; font-size: 13px; cursor: pointer; max-width: 100%; }
.reply-quote b { display: block; color: var(--brand); }
.reply-quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.file-box { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 4px 2px; }
.file-ico { width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.file-ico svg { width: 22px; height: 22px; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-size { font-size: 12px; color: var(--muted); }
.voice { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.voice audio { width: 240px; max-width: 100%; height: 40px; }
.call-msg { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 2px 0; }
.call-msg .ci { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(30,155,224,.15); color: var(--brand); }
.call-msg .ci.bad { background: rgba(229,72,77,.12); color: var(--danger); }
.call-msg .ci svg { width: 20px; height: 20px; }
.call-msg b { display: block; }
.call-msg small { color: var(--muted); }

.down-btn { position: absolute; right: 18px; bottom: 80px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--panel); color: var(--muted); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 2; }
.down-btn svg { width: 22px; height: 22px; }

.reply-bar { display: flex; align-items: center; gap: 10px; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 12px; }
.reply-bar .rb-ico { color: var(--brand); }
.reply-bar .rb-body { flex: 1; min-width: 0; border-left: 3px solid var(--brand); padding-left: 8px; font-size: 13px; }
.reply-bar .rb-body b { color: var(--brand); display: block; }
.reply-bar .rb-body span { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; border: 0; background: var(--panel-2); border-radius: 20px; padding: 10px 14px; outline: none; max-height: 160px; min-height: 40px; line-height: 20px; }
.send-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; transition: transform .1s, background .15s; }
.send-btn:hover { background: var(--brand-2); }
.send-btn:active { transform: scale(.92); }
.send-btn svg { width: 22px; height: 22px; }
.send-btn.rec { background: var(--danger); animation: pulse 1s infinite; }
.rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-bar .rec-time { font-variant-numeric: tabular-nums; flex: 1; }
.drop-zone { position: absolute; inset: 10px; border: 3px dashed var(--brand); border-radius: 18px; background: rgba(30,155,224,.12); display: grid; place-items: center; font-size: 18px; font-weight: 700; color: var(--brand); z-index: 5; pointer-events: none; backdrop-filter: blur(2px); }

/* ── menus, modals, toasts ── */
.ctx-menu { position: fixed; z-index: 60; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 180px; border: 1px solid var(--line); }
.ctx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 12px; border-radius: 8px; text-align: left; }
.ctx-menu button:hover { background: var(--hover); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu svg { width: 18px; height: 18px; color: var(--muted); }
.ctx-menu button.danger svg { color: var(--danger); }

.modal-back { position: fixed; inset: 0; background: rgba(5,15,25,.5); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 12px 12px 4px 20px; }
.modal-head h3 { flex: 1; margin: 0; font-size: 18px; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; display: grid; gap: 12px; }
.profile-top { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 6px 0 4px; }
.profile-top .name { font-size: 20px; font-weight: 700; }
.profile-top .sub { color: var(--muted); font-size: 14px; }
.profile-top .bio { white-space: pre-wrap; }
.avatar-edit { position: relative; cursor: pointer; }
.avatar-edit .cam { position: absolute; right: 0; bottom: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; border: 3px solid var(--panel); }
.avatar-edit .cam svg { width: 16px; height: 16px; }
.field-label { font-size: 13px; color: var(--muted); font-weight: 600; display: grid; gap: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; }
.section-title { font-weight: 700; margin-top: 6px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.user-row:hover { background: var(--hover); }
.user-row .ur-body { flex: 1; min-width: 0; }
.user-row .ur-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .ur-sub { font-size: 13px; color: var(--muted); }
.user-row .check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; }
.user-row.sel .check { background: var(--brand); border-color: var(--brand); }
.user-row .check svg { width: 14px; height: 14px; }
.user-row .role { font-size: 12px; color: var(--brand); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--active); border-radius: 14px; padding: 3px 10px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.chip button { border: 0; background: none; padding: 0; color: var(--muted); }
.pick-list { max-height: 260px; overflow-y: auto; display: grid; gap: 2px; }
.muted { color: var(--muted); font-size: 13px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast { background: rgba(20,30,40,.92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); animation: pop .2s; pointer-events: auto; }

.viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: grid; place-items: center; cursor: zoom-out; animation: fade .15s; }
.viewer img { max-width: 96vw; max-height: 92vh; object-fit: contain; }
.viewer .icon-btn { position: absolute; top: 12px; color: #fff; }

/* ── calls ── */
.call { position: fixed; inset: 0; z-index: 80; background: radial-gradient(circle at 50% 20%, #1f4a6e, #08121b 70%); color: #fff; display: flex; flex-direction: column; animation: fade .2s; }
.call video.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.call .call-info { position: relative; z-index: 2; text-align: center; padding: 40px 20px 0; padding-top: max(40px, env(safe-area-inset-top)); display: grid; justify-items: center; gap: 10px; }
.call.has-video .call-info { padding-top: 16px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.call.has-video .call-info .avatar { display: none; }
.call .call-name { font-size: 24px; font-weight: 700; }
.call .call-status { opacity: .8; font-variant-numeric: tabular-nums; }
.call .avatar.ring { animation: ring 1.6s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(30,155,224,.6); } 70% { box-shadow: 0 0 0 30px rgba(30,155,224,0); } 100% { box-shadow: 0 0 0 0 rgba(30,155,224,0); } }
.call video.local { position: absolute; right: 16px; top: 16px; top: max(16px, env(safe-area-inset-top)); width: 26vw; max-width: 220px; min-width: 110px; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; background: #111; z-index: 3; box-shadow: 0 4px 20px rgba(0,0,0,.5); transform: scaleX(-1); }
.call video.local.screen { transform: none; object-fit: contain; }
.call-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; justify-content: center; gap: 16px; padding: 24px 16px; padding-bottom: max(28px, env(safe-area-inset-bottom)); flex-wrap: wrap; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.cbtn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); transition: background .15s, transform .1s; }
.cbtn:hover { background: rgba(255,255,255,.28); }
.cbtn:active { transform: scale(.93); }
.cbtn svg { width: 26px; height: 26px; }
.cbtn.off { background: #fff; color: #111; }
.cbtn.end { background: var(--danger); }
.cbtn.accept { background: var(--ok); }
.cbtn-wrap { display: grid; justify-items: center; gap: 6px; font-size: 12px; opacity: .95; }

.incoming { position: fixed; z-index: 85; left: 50%; top: 16px; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); width: min(380px, calc(100% - 24px)); background: #10202e; color: #fff; border-radius: 20px; padding: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.5); display: flex; align-items: center; gap: 12px; animation: pop .2s; }
.incoming .in-body { flex: 1; min-width: 0; }
.incoming .in-name { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.incoming .in-sub { opacity: .75; font-size: 13px; }
.incoming .cbtn { width: 48px; height: 48px; }
.incoming .cbtn svg { width: 22px; height: 22px; }

/* ── mobile ── */
@media (max-width: 1180px) {
  .member-panel { position: absolute; right: 0; top: 60px; bottom: 0; z-index: 6; box-shadow: var(--shadow); }
}
@media (max-width: 760px) {
  .sidebar { width: 100%; border-right: 0; }
  .main { display: none; }
  .app.chat-open .sidebar { display: none; }
  .app.chat-open .main { display: flex; }
  .chat-head .back { display: inline-grid; }
  .member-panel { display: none !important; }
  .messages { padding: 10px 8px 6px; }
  .msg { max-width: 92%; }
  .modal-back { align-items: end; padding: 0; }
  .modal { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .modal-body { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

/* ── крупнее и вплотную к левому краю ── */
.messages { font-size: 16px; padding: 6px 0 18px !important; }
.dmsg { grid-template-columns: 68px minmax(0, 1fr); padding: 3px 56px 3px 0; margin-top: 18px; }
.dmsg.cont { margin-top: 0; }
.dm-gutter { justify-content: flex-start; padding-left: 12px; }
.dmsg.cont .dm-gutter { justify-content: center; padding-left: 0; }
.dm-name { font-size: 16.5px; }
.dm-time { font-size: 12.5px; }
.dm-text { font-size: 16px; line-height: 1.45; }
.dm-htime { font-size: 11.5px; }
.dm-reply { margin-left: 68px; font-size: 14px; }
.dm-reply::before { left: -46px; width: 38px; }
.dm-sys { padding-left: 24px; font-size: 15px; }
.day-line { margin-left: 12px; margin-right: 12px; font-size: 13px; }
.att-img { max-width: min(520px, 100%); max-height: 420px; }
.att-video { max-width: min(560px, 100%); max-height: 420px; }
.jumbo { font-size: 48px; }
.react { height: 28px; font-size: 16px; }
@media (max-width: 760px) {
  .dmsg { grid-template-columns: 58px minmax(0, 1fr); padding-right: 10px; }
  .dm-gutter { padding-left: 8px; }
  .dm-reply { margin-left: 58px; }
  .dm-reply::before { left: -38px; width: 30px; }
}

/* ── профиль человека (карточка как в Discord) ── */
.modal-ucard { position: relative; max-width: 400px; overflow: hidden; }
.modal-ucard .modal-head { position: absolute; top: 0; right: 0; left: auto; z-index: 2; padding: 8px; }
.modal-ucard .modal-head h3 { display: none; }
.modal-ucard .modal-head .icon-btn { background: rgba(0, 0, 0, .35); color: #fff; }
.modal-ucard .modal-body { padding: 0; display: block; }
.ucard { position: relative; }
.uc-banner { height: 110px; }
.uc-avatar { position: absolute; top: 58px; left: 18px; border-radius: 50%; padding: 6px; background: var(--panel); }
.uc-avatar .avatar.online::after { border-color: var(--panel); width: 22px; height: 22px; right: 2px; bottom: 2px; border-width: 4px; }
.uc-body { padding: 58px 20px 20px; display: grid; gap: 4px; }
.uc-name { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.uc-user { color: var(--muted); font-size: 15px; }
.uc-status { font-size: 13px; color: var(--muted); }
.uc-status.on { color: var(--ok); font-weight: 600; }
.uc-label { margin-top: 12px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.uc-bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.ucard .chips { margin-top: 2px; }
.uc-actions { display: flex; gap: 8px; margin-top: 16px; }
.uc-actions .btn.primary { flex: 1; }
.uc-body > .btn { margin-top: 16px; }
.uc-body > .btn.danger { margin-top: 6px; }
.btn-ico { display: inline-grid; width: 20px; height: 20px; vertical-align: middle; }
.btn-ico svg { width: 20px; height: 20px; }
.voice-user { cursor: pointer; }
.vtile:not(.has-video) { cursor: pointer; }
.vtile.has-video .vt-name { cursor: pointer; }
.mp-user, .user-row { cursor: pointer; }

/* галочки прочтения — в строке с текстом */
.dm-text .dm-status { margin-left: 6px; vertical-align: -3px; }

/* ── обводка «говорит» ── */
.avatar .av-in { transition: box-shadow .12s ease; }
.avatar.speaking .av-in, .speaking > .avatar .av-in { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ok); }
.up-user .avatar.speaking .av-in { box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 4px var(--ok); }
.call .call-info .avatar.speaking .av-in { box-shadow: 0 0 0 4px #0b1620, 0 0 0 8px var(--ok), 0 0 30px rgba(47, 179, 107, .5); }

/* ── личный звонок: мой квадратик в углу ── */
.call-self {
  position: absolute; right: 16px; top: max(16px, env(safe-area-inset-top)); z-index: 3;
  width: 26vw; max-width: 220px; min-width: 120px; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  background: #16242f; display: grid; place-items: center; box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
  outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .12s ease;
}
.call-self.speaking { outline-color: var(--ok); }
.call-self video.local { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; min-width: 0; aspect-ratio: auto; border-radius: 0; box-shadow: none; top: 0; right: 0; }
.call-self.has-video .avatar { display: none; }
.call-self .cs-name { position: absolute; left: 8px; bottom: 6px; font-size: 12px; font-weight: 700; background: rgba(0, 0, 0, .5); padding: 1px 8px; border-radius: 6px; z-index: 2; }
.call-self.muted .cs-name::before { content: "🔇 "; }

/* ── экран голосового канала ── */
.main.voice-mode #empty { display: none; }
.voice-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #0d1720; color: #fff; position: relative; }
.main.voice-mode .chat { flex: none; width: 380px; border-left: 1px solid var(--line); }
.vs-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 60px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.vs-head .icon-btn { color: rgba(255, 255, 255, .75); }
.vs-head .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.vs-head .back { display: none; }
.vs-ico { width: 22px; height: 22px; color: rgba(255, 255, 255, .7); }
.vs-ico svg { width: 22px; height: 22px; }
.vs-title { flex: 1; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-grid {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.vs-grid[data-count="1"] { grid-template-columns: minmax(0, 860px); justify-content: center; }
.vs-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vtile {
  position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #1b2a37;
  display: grid; place-items: center; outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .12s ease;
}
.vtile.speaking { outline-color: var(--ok); }
.vtile.focus { grid-column: 1 / -1; }
.vtile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.vtile.mirror video { transform: scaleX(-1); }
.vt-av { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--tile) 35%, #1b2a37), #1b2a37 70%); }
.vtile.speaking .vt-av .avatar .av-in { box-shadow: 0 0 0 4px #1b2a37, 0 0 0 7px var(--ok); }
.vt-name { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 3px 10px; border-radius: 8px; background: rgba(0, 0, 0, .55); font-size: 14px; font-weight: 600; }
.vt-name span:not(.vt-ico):not(.vt-live) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-ico { width: 16px; height: 16px; color: #ff6b6b; flex: none; }
.vt-ico svg { width: 16px; height: 16px; }
.vt-live { font-size: 10px; font-weight: 800; background: var(--danger); color: #fff; padding: 1px 6px; border-radius: 4px; flex: none; }
.vs-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 6px; color: rgba(255, 255, 255, .7); text-align: center; }
.vs-empty-ico { width: 56px; height: 56px; opacity: .6; }
.vs-empty-ico svg { width: 56px; height: 56px; }
.vs-controls { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.vs-controls .cbtn { width: 54px; height: 54px; }
.vs-controls .cbtn.live { background: var(--ok); color: #fff; }
.vs-join { padding: 14px 26px; font-size: 16px; background: var(--ok); }
.vs-join:hover { background: #27985a; }
@media (min-width: 1101px) {
  .main.voice-mode.vs-chat .chat { display: none; }
}
@media (max-width: 1100px) {
  .main.voice-mode .chat { display: none; }
  .main.voice-mode.vs-chat .voice-stage { display: none; }
  .main.voice-mode.vs-chat .chat { display: flex; width: auto; flex: 1; border-left: 0; }
}
@media (max-width: 760px) {
  .vs-head .back { display: inline-grid; }
  .vs-grid { padding: 10px; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .vs-grid[data-count="2"] { grid-template-columns: 1fr; }
}

/* ── групповой звонок в группе: плашка над сообщениями ── */
.gcall-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--ok) 14%, var(--panel)); border-bottom: 1px solid var(--line); }
.gcall-bar[hidden] { display: none; }
.gcall-bar .gc-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; flex: none; animation: gcPulse 1.6s ease-in-out infinite; }
.gcall-bar .gc-ico svg { width: 18px; height: 18px; }
.gcall-bar .gc-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gcall-bar .gc-text b { font-size: 15px; }
.gcall-bar .gc-text span { font-size: 13px; color: var(--muted); }
.gcall-bar .gc-avs { display: flex; }
.gcall-bar .gc-avs > * { margin-left: -6px; border: 2px solid var(--panel); border-radius: 50%; }
.gcall-bar .btn { flex: none; }
@keyframes gcPulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }
@media (max-width: 520px) { .gcall-bar .gc-avs { display: none; } }

/* ── логотип ~1.75 раза больше обычного ── */
.splash img { width: 192px; }
.auth-logo { width: 168px; height: 168px; }
.brand { gap: 10px; }
.brand img { width: 46px; height: 46px; }
.empty img { width: 228px; }
.rail-item:has(> .rail-btn.home) { width: 66px; height: 66px; }
.rail-btn.home { width: 66px; height: 66px; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
.rail-btn.home img { width: 66px; height: 66px; }
.rail-item:hover .rail-btn.home, .rail-item.active .rail-btn.home { border-radius: 0; }
.rail-item:has(> .rail-btn.home) .rail-pill { left: -9px; }

/* ── админ-панель сайта ── */
.up-btn.admin-btn { color: var(--brand); }
.modal-admin { max-width: 860px; }
.modal-admin .modal-body { display: block; }
.adm-tabs { position: sticky; top: 0; z-index: 2; }
.adm-content { display: flex; flex-direction: column; gap: 10px; }
.adm-back { margin-bottom: 12px; }
.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.adm-stat { background: var(--hover); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.adm-stat b { font-size: 26px; color: var(--brand); }
.adm-stat span { color: var(--muted); font-size: 13px; }
.adm-note { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.adm-search { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.adm-list { display: flex; flex-direction: column; gap: 6px; }
.adm-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--hover); flex-wrap: wrap; }
.adm-row.compact { padding: 7px 10px; }
.adm-row.banned { background: color-mix(in srgb, var(--danger) 10%, var(--panel)); }
.adm-info { flex: 1; min-width: 200px; }
.adm-name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.adm-meta.ban { color: var(--danger); }
.adm-muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.adm-badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--active); color: var(--brand); text-transform: uppercase; }
.adm-badge.admin { background: var(--brand); color: #fff; }
.adm-badge.ban { background: var(--danger); color: #fff; }
.adm-badge.live { background: var(--ok); color: #fff; text-transform: none; }
.adm-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.adm-actions input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; min-width: 180px; }
.btn.adm-sm { padding: 6px 11px; font-size: 13px; }
.btn.danger.armed { background: var(--danger); color: #fff; }
.adm-ico { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: none; }
.adm-ico.txt { display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; }
.adm-chan { width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); flex: none; }
.adm-chan svg { width: 20px; height: 20px; }
.adm-h { margin: 0 0 4px; font-size: 18px; }
.adm-sub { font-weight: 700; font-size: 12px; text-transform: uppercase; color: var(--muted); margin-top: 10px; letter-spacing: .04em; }
.adm-empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.adm-msgs { display: flex; flex-direction: column; gap: 4px; }
.adm-msg { padding: 8px 10px; border-radius: 10px; background: var(--hover); }
.adm-mhead { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.adm-mhead .btn { margin-left: auto; }
.adm-mtext { white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.adm-mimg { display: block; max-width: 240px; max-height: 180px; border-radius: 8px; margin-top: 6px; }
.adm-more { align-self: center; }

/* ── «В ЭФИРЕ»: стрим в голосовом канале ── */
.live-pill { flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; line-height: 1; color: #fff; background: var(--danger); padding: 4px 8px; border-radius: 999px; cursor: pointer; box-shadow: 0 0 0 0 rgba(229, 72, 77, .6); animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .55); } 50% { box-shadow: 0 0 0 5px rgba(229, 72, 77, 0); } }
.voice-user.streaming .vn { color: var(--text); }
.voice-user .vi.cam { color: var(--muted); }
.stream-pop { position: fixed; z-index: 60; width: 320px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); animation: pop .14s ease; }
.stream-pop .sp-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
.stream-pop .sp-ph { aspect-ratio: 16 / 9; display: grid; place-content: center; justify-items: center; gap: 8px; background: #0d1720; color: rgba(255, 255, 255, .75); font-size: 13px; text-align: center; padding: 10px; }
.stream-pop .sp-ph svg { width: 34px; height: 34px; opacity: .7; }
.stream-pop .sp-foot { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px; }
.stream-pop .sp-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stream-pop .sp-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-pop .btn { width: 100%; justify-content: center; }
.vtile.waiting::after { content: 'Подключение к трансляции…'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .45); font-weight: 600; }
.vtile.focus { aspect-ratio: auto; height: 62vh; min-height: 240px; }
.vs-grid:has(.vtile.focus) { align-content: start; }

/* ── антиспам-бот в настройках сервера ── */
.antispam { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.antispam .section-title { margin-top: 6px; }
.antispam .pr-text small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.as-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 0 12px 6px 14px; color: var(--muted); font-size: 14px; }
.as-sub.as-timeout { color: var(--text); font-weight: 600; padding-top: 6px; }
.as-num { width: 70px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; text-align: center; }
.as-note { font-size: 12.5px; }

/* ── сообщения заблокированных ── */
.dm-blocked { display: flex; align-items: center; gap: 10px; margin: 2px 0; padding: 6px 16px 6px 68px; color: var(--muted); font-size: 14px; font-style: italic; }
.dm-blocked button { border: 0; background: none; color: var(--brand); font: inherit; font-style: normal; font-weight: 600; cursor: pointer; padding: 0; }
.dm-blocked button:hover { text-decoration: underline; }
.blocked-list { display: flex; flex-direction: column; gap: 4px; }
