:root {
  --bg-0: #121318;
  --bg-1: #1a1b21;
  --bg-2: #212229;
  --bg-3: #2a2c34;
  --bg-4: #343641;
  --bg-float: #101115;
  --hover: rgba(255, 255, 255, 0.04);
  --active: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.06);
  --text-0: #f3f4f6;
  --text-1: #d5d7dd;
  --text-2: #9c9fab;
  --text-3: #6e717d;
  --accent: #6b5cff;
  --accent-hover: #5b4cf0;
  --accent-soft: rgba(107, 92, 255, 0.18);
  --green: #2fb380;
  --green-hover: #279a6e;
  --red: #e5484d;
  --red-hover: #cc3b40;
  --yellow: #e8a23a;
  --link: #7aa7ff;
  --mention-bg: rgba(232, 162, 58, 0.08);
  --radius: 8px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Cascadia Code', Consolas, 'SFMono-Regular', Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-0);
  color: var(--text-1);
  font: 15px/1.375 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
svg.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 16px; height: 16px; }
svg.icon.lg { width: 24px; height: 24px; }
svg.icon.fill { fill: currentColor; stroke: none; }

::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-thumb { background: var(--bg-0); border: 4px solid transparent; background-clip: padding-box; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
.thin-scroll::-webkit-scrollbar { width: 8px; }
.thin-scroll::-webkit-scrollbar-thumb { border-width: 2px; background-color: transparent; }
.thin-scroll:hover::-webkit-scrollbar-thumb { background-color: var(--bg-0); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--bg-4); }
.btn.secondary:hover { background: #3e404c; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: var(--red-hover); }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-hover); }
.btn.link { background: none; color: var(--text-1); font-weight: 500; }
.btn.link:hover { text-decoration: underline; }
.btn.full { width: 100%; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 6px;
  background: var(--bg-0); border: 1px solid transparent; outline: none;
}
.input:focus { border-color: var(--accent); }
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.form-error { color: #ff8589; font-size: 13px; margin: -6px 0 14px; min-height: 0; }
.form-error:empty { display: none; }

/* ---------- auth ---------- */
.auth {
  height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(107, 92, 255, 0.25), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(47, 179, 128, 0.15), transparent 60%),
    var(--bg-0);
}
.auth-card {
  width: 100%; max-width: 440px; padding: 32px; border-radius: 12px;
  background: var(--bg-2); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; color: var(--text-0); font-weight: 800; font-size: 22px; }
.auth-brand .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.auth h1 { margin: 0 0 6px; text-align: center; color: var(--text-0); font-size: 24px; }
.auth p.sub { margin: 0 0 22px; text-align: center; color: var(--text-2); }
.auth .switch { margin-top: 10px; font-size: 14px; color: var(--text-2); }
.auth .switch button { color: var(--link); }
.auth .switch button:hover { text-decoration: underline; }

/* ---------- app shell ---------- */
.app { display: flex; height: 100vh; }
.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; text-align: center;
  background: var(--yellow); color: #1a1200; font-size: 13px; font-weight: 600; padding: 4px;
}

/* ---------- server rail ---------- */
.rail {
  width: 72px; flex: none; background: var(--bg-0); padding: 12px 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item { position: relative; width: 72px; display: flex; justify-content: center; }
.rail-pill {
  position: absolute; left: 0; top: 50%; width: 4px; height: 0; margin-top: 0;
  background: var(--text-0); border-radius: 0 4px 4px 0; transition: height 0.15s, margin-top 0.15s;
}
.rail-item.unread .rail-pill { height: 8px; margin-top: -4px; }
.rail-item:hover .rail-pill { height: 20px; margin-top: -10px; }
.rail-item.active .rail-pill { height: 40px; margin-top: -20px; }
.rail-icon {
  width: 48px; height: 48px; border-radius: 24px; display: grid; place-items: center;
  background: var(--bg-2); color: var(--text-1); font-weight: 600; font-size: 15px;
  transition: border-radius 0.15s, background 0.15s, color 0.15s; overflow: hidden; user-select: none;
}
.rail-item:hover .rail-icon, .rail-item.active .rail-icon { border-radius: 16px; }
.rail-item.home .rail-icon { color: var(--text-0); }
.rail-item.home:hover .rail-icon, .rail-item.home.active .rail-icon { background: var(--accent); color: #fff; }
.rail-item.action .rail-icon { color: var(--green); }
.rail-item.action:hover .rail-icon { background: var(--green); color: #fff; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--bg-3); flex: none; }
.badge {
  position: absolute; right: 8px; bottom: -2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 3px solid var(--bg-0); box-sizing: content-box;
}

/* ---------- avatars ---------- */
.avatar {
  position: relative; flex: none; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; user-select: none;
}
.avatar .status {
  position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%;
  border: 3px solid var(--status-bg, var(--bg-1)); box-sizing: content-box; background: var(--text-3);
}
.avatar .status.online { background: var(--green); }
.avatar .status.idle { background: var(--yellow); }
.avatar .status.dnd { background: var(--red); }
/* Offline is a hollow ring, idle a crescent and DND a bar, so status reads without colour too. */
.avatar .status::after { content: ''; position: absolute; background: var(--status-bg, var(--bg-1)); }
.avatar .status.online::after { display: none; }
.avatar .status.offline::after { inset: 3px; border-radius: 50%; }
.avatar .status.idle::after { width: 7px; height: 7px; top: -1px; left: -1px; border-radius: 50%; }
.avatar .status.dnd::after { left: 2px; right: 2px; top: 50%; height: 2px; margin-top: -1px; border-radius: 1px; }
.chat { --status-bg: var(--bg-2); }

/* ---------- sidebar ---------- */
.sidebar { width: 240px; flex: none; background: var(--bg-1); display: flex; flex-direction: column; min-width: 0; }
.sidebar-header {
  height: 48px; flex: none; display: flex; align-items: center; padding: 0 16px; gap: 8px;
  border-bottom: 1px solid var(--bg-0); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  color: var(--text-0); font-weight: 700;
}
button.sidebar-header { width: 100%; text-align: left; transition: background 0.1s; }
button.sidebar-header:hover { background: var(--hover); }
.sidebar-header .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-btn {
  width: 100%; height: 28px; border-radius: 4px; background: var(--bg-0); color: var(--text-2);
  font-size: 13px; text-align: left; padding: 0 8px; font-weight: 500;
}
.channel-list { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.category {
  display: flex; align-items: center; gap: 2px; padding: 16px 4px 4px 2px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-2);
}
.category .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category:hover { color: var(--text-1); }
.icon-btn { display: grid; place-items: center; color: var(--text-2); border-radius: 4px; padding: 2px; }
.icon-btn:hover { color: var(--text-0); }
.channel {
  position: relative; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px;
  margin: 1px 0; border-radius: 6px; color: var(--text-3); cursor: pointer; font-weight: 500;
}
.channel .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel:hover { background: var(--hover); color: var(--text-1); }
.channel.active { background: var(--active); color: var(--text-0); }
.channel.unread { color: var(--text-0); font-weight: 600; }
.channel.unread::before {
  content: ''; position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px;
  border-radius: 0 4px 4px 0; background: var(--text-0);
}
.channel .actions { display: none; }
.channel:hover .actions, .channel.active .actions { display: flex; }
.dm-item { height: 44px; gap: 12px; }
.dm-item .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.dm-item .meta .sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.dm-item .count {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: grid; place-items: center;
}
.section-title {
  padding: 16px 8px 6px 10px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.02em; color: var(--text-2); display: flex; align-items: center;
}
.section-title span { flex: 1; }
.empty-hint { padding: 8px 10px; color: var(--text-3); font-size: 13px; }

.user-panel {
  height: 56px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px;
  background: #16171c;
}
.user-panel .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 6px; cursor: pointer; }
.user-panel .who:hover { background: var(--hover); }
.user-panel .who { --status-bg: #16171c; }
.user-panel .names { min-width: 0; line-height: 1.15; }
.user-panel .names div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel .names .dn { color: var(--text-0); font-weight: 600; font-size: 14px; }
.user-panel .names .un { color: var(--text-2); font-size: 12px; }
.user-panel .icon-btn { width: 32px; height: 32px; border-radius: 6px; }
.user-panel .icon-btn:hover { background: var(--hover); }

/* ---------- chat ---------- */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-2); }
.chat-header {
  height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--bg-0); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}
.chat-header .title { color: var(--text-0); font-weight: 700; white-space: nowrap; }
.chat-header .glyph { color: var(--text-3); display: grid; }
.chat-header .topic {
  flex: 1; min-width: 0; color: var(--text-2); font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--bg-4);
}
.chat-header .topic:empty { border: 0; }
.chat-header .tools { display: flex; gap: 8px; margin-left: auto; }
.chat-header .tools .icon-btn { width: 32px; height: 32px; }
.chat-header .tools .icon-btn.on { color: var(--text-0); }

.messages { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.messages-inner { min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px 0 24px; }
.loading-more { text-align: center; color: var(--text-3); padding: 16px; font-size: 13px; }
.channel-welcome { padding: 16px 16px 8px; margin-bottom: 8px; }
.channel-welcome .big-glyph {
  width: 68px; height: 68px; border-radius: 50%; background: var(--bg-4); display: grid; place-items: center;
  color: var(--text-0); margin-bottom: 8px;
}
.channel-welcome .big-glyph svg { width: 40px; height: 40px; }
.channel-welcome h2 { margin: 8px 0 4px; color: var(--text-0); font-size: 30px; line-height: 1.2; }
.channel-welcome p { margin: 0; color: var(--text-2); }

.date-divider {
  display: flex; align-items: center; margin: 24px 16px 8px; color: var(--text-3);
  font-size: 12px; font-weight: 600;
}
.date-divider::before, .date-divider::after { content: ''; flex: 1; height: 1px; background: var(--bg-4); }
.date-divider span { padding: 0 8px; }

.msg { position: relative; padding: 2px 48px 2px 72px; margin-top: 16px; min-height: 44px; }
.msg.grouped { margin-top: 0; min-height: 0; }
.msg:hover { background: rgba(0, 0, 0, 0.08); }
.msg.mentioned { background: var(--mention-bg); }
.msg.mentioned::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--yellow); }
.msg.flash { animation: flash 1.6s ease-out; }
.msg.replying { background: var(--accent-soft); }
.msg.replying::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent); }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.msg > .avatar { position: absolute; left: 16px; top: 4px; cursor: pointer; }
.msg.has-reply > .avatar { top: 26px; }
.msg .gutter-time {
  position: absolute; left: 0; width: 72px; top: 5px; text-align: center; font-size: 11px; color: var(--text-3);
  visibility: hidden;
}
.msg.grouped:hover .gutter-time { visibility: visible; }
.msg-header { display: flex; align-items: baseline; gap: 8px; }
.msg-header .author { color: var(--text-0); font-weight: 600; cursor: pointer; }
.msg-header .author:hover { text-decoration: underline; }
.msg-header .ts { font-size: 12px; color: var(--text-3); }
.msg-content { color: var(--text-1); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-content.jumbo { font-size: 44px; line-height: 1.2; }
.msg-content .edited { font-size: 11px; color: var(--text-3); margin-left: 4px; }
.msg-content code {
  font-family: var(--mono); font-size: 0.85em; background: var(--bg-0); padding: 2px 4px; border-radius: 4px;
}
.msg-content pre {
  margin: 6px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--bg-0); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.85em; white-space: pre-wrap; max-width: 90%;
}
.msg-content pre code { background: none; padding: 0; font-size: 1em; }
.msg-content blockquote { margin: 2px 0; padding: 0 0 0 12px; border-left: 4px solid var(--bg-4); }
.msg-content .mention {
  background: var(--accent-soft); color: #c7c1ff; padding: 0 2px; border-radius: 3px; font-weight: 500;
}
.msg-content .spoiler { background: var(--bg-0); color: transparent; border-radius: 3px; cursor: pointer; padding: 0 2px; }
.msg-content .spoiler.shown { color: inherit; background: var(--bg-3); }
.reply-ref {
  position: relative; display: flex; align-items: center; gap: 6px; margin: 0 0 2px; font-size: 13px;
  color: var(--text-2); cursor: pointer; min-width: 0;
}
.reply-ref::before {
  content: ''; position: absolute; left: -38px; top: 50%; width: 30px; height: 12px;
  border-left: 2px solid var(--bg-4); border-top: 2px solid var(--bg-4); border-top-left-radius: 6px;
}
.reply-ref .rname { color: var(--text-0); font-weight: 600; white-space: nowrap; }
.reply-ref .rtext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-ref:hover .rtext { color: var(--text-1); }
.reply-ref.deleted { font-style: italic; cursor: default; }

.msg.system { min-height: 0; padding-top: 4px; padding-bottom: 4px; color: var(--text-2); margin-top: 8px; }
.msg.system .sys-icon { position: absolute; left: 30px; top: 6px; color: var(--green); }
.msg.system strong { color: var(--text-0); cursor: pointer; font-weight: 600; }
.msg.system .ts { font-size: 12px; color: var(--text-3); margin-left: 6px; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid transparent; font-size: 14px;
}
.reaction:hover { border-color: var(--bg-4); }
.reaction .n { font-size: 13px; font-weight: 600; color: var(--text-2); }
.reaction.me { background: var(--accent-soft); border-color: var(--accent); }
.reaction.me .n { color: #c7c1ff; }
.reaction.add { display: none; color: var(--text-2); }
.msg:hover .reaction.add { display: inline-flex; }

.msg-toolbar {
  position: absolute; right: 16px; top: -16px; display: none; z-index: 2;
  background: var(--bg-2); border: 1px solid var(--bg-0); border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 2px;
}
.msg:hover .msg-toolbar, .msg-toolbar.open { display: flex; }
.msg-toolbar button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--text-2); }
.msg-toolbar button:hover { background: var(--bg-3); color: var(--text-0); }
.msg-toolbar button.danger:hover { color: var(--red); }

.edit-box { margin-top: 4px; }
.edit-box textarea {
  width: 100%; resize: none; border: 0; outline: none; border-radius: 8px; padding: 10px 12px;
  background: var(--bg-3); max-height: 50vh;
}
.edit-box .hint { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.edit-box .hint button { color: var(--link); }
.edit-box .hint button:hover { text-decoration: underline; }

/* ---------- composer ---------- */
.composer { padding: 0 16px; flex: none; }
.reply-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; color: var(--text-2);
  background: var(--bg-1); border-radius: 8px 8px 0 0;
}
.reply-bar strong { color: var(--text-0); }
.reply-bar .icon-btn { margin-left: auto; }
.composer-box {
  display: flex; align-items: flex-end; gap: 4px; background: var(--bg-3); border-radius: 8px; padding: 0 8px 0 16px;
}
.composer.has-reply .composer-box { border-radius: 0 0 8px 8px; }
.composer-box textarea {
  flex: 1; resize: none; border: 0; outline: none; background: none; padding: 11px 0; max-height: 40vh;
  line-height: 1.375; min-height: 44px;
}
.composer-box textarea::placeholder { color: var(--text-3); }
.composer-box .icon-btn { width: 36px; height: 44px; }
.composer-box .count { font-size: 12px; color: var(--text-3); align-self: center; }
.composer-box .count.over { color: var(--red); }
.typing { height: 24px; display: flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 13px; color: var(--text-1); }
.typing strong { font-weight: 700; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-1); animation: blink 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: 0.2s; }
.typing .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--text-2); }
.chat-empty .art {
  width: 120px; height: 120px; margin: 0 auto 20px; border-radius: 36px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #2fb380); color: #fff;
}
.chat-empty .art svg { width: 64px; height: 64px; }
.chat-empty h2 { color: var(--text-0); margin: 0 0 8px; }
.chat-empty p { margin: 0 0 20px; max-width: 420px; }

/* ---------- members ---------- */
.members { width: 240px; flex: none; background: var(--bg-1); overflow-y: auto; padding: 8px 8px 20px; }
.member { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px; border-radius: 6px; cursor: pointer; }
.member:hover { background: var(--hover); }
.member.offline { opacity: 0.35; }
.member.offline:hover { opacity: 1; }
.member .meta { flex: 1; min-width: 0; line-height: 1.2; }
.member .meta .dn { display: flex; align-items: center; gap: 4px; color: var(--text-1); font-weight: 500; }
.member .meta .dn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .meta .sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crown { color: var(--yellow); }

/* ---------- floating: modal, popover, menu, tooltip, toast ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.7);
  display: grid; place-items: center; padding: 20px; animation: fade 0.12s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }
.modal {
  width: 100%; max-width: 460px; background: var(--bg-2); border-radius: 10px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: pop 0.14s ease-out;
}
.modal-head { padding: 22px 22px 0; position: relative; }
.modal-head h2 { margin: 0; color: var(--text-0); font-size: 20px; }
.modal-head p { margin: 8px 0 0; color: var(--text-2); font-size: 14px; }
.modal-head .close { position: absolute; top: 14px; right: 14px; }
.modal-body { padding: 20px 22px 4px; max-height: 65vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; background: var(--bg-1); }
.modal-foot .spacer { flex: 1; }
.modal.center .modal-head { text-align: center; }
.choice {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; border-radius: 8px;
  border: 1px solid var(--bg-4); text-align: left; font-weight: 600; color: var(--text-0);
}
.choice:hover { background: var(--hover); }
.choice .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: #c7c1ff; }
.choice .chev { margin-left: auto; color: var(--text-2); transform: rotate(-90deg); }
.invite-row { display: flex; gap: 8px; }
.invite-row .input { flex: 1; font-family: var(--mono); font-size: 13px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; }
.swatch.on { border-color: var(--text-0); }
.preview-msg { background: var(--bg-1); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; color: var(--text-1); }
.preview-msg strong { color: var(--text-0); }
.picker-list { max-height: 300px; overflow-y: auto; margin: 0 -6px; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 6px; cursor: pointer; }
.picker-row:hover { background: var(--hover); }
.picker-row .un { color: var(--text-2); font-size: 13px; }

.popover {
  position: fixed; z-index: 150; background: var(--bg-float); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55); border: 1px solid var(--border); animation: pop 0.1s ease-out;
}
.menu { padding: 6px; min-width: 200px; }
.menu button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 4px; font-size: 14px; font-weight: 500; color: var(--text-1); text-align: left;
}
.menu button:hover { background: var(--accent); color: #fff; }
.menu button.danger { color: #ff8589; }
.menu button.danger:hover { background: var(--red); color: #fff; }
.menu hr { border: 0; height: 1px; background: var(--border); margin: 4px 6px; }

.emoji-picker { padding: 8px; width: 300px; }
.emoji-picker .grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-picker button { font-size: 22px; height: 34px; border-radius: 6px; }
.emoji-picker button:hover { background: var(--bg-3); }

.profile-card { width: 300px; overflow: hidden; }
.profile-card .banner { height: 60px; }
.profile-card .body { padding: 0 16px 16px; }
.profile-card .avatar { margin-top: -40px; border: 6px solid var(--bg-float); box-sizing: content-box; }
.profile-card { --status-bg: var(--bg-float); }
.profile-card .avatar .status { width: 14px; height: 14px; right: 2px; bottom: 2px; }
.profile-card .card {
  margin-top: 12px; background: var(--bg-1); border-radius: 8px; padding: 12px;
}
.profile-card .dn { color: var(--text-0); font-size: 20px; font-weight: 700; }
.profile-card .un { color: var(--text-1); font-size: 14px; }
.profile-card .st { margin-top: 10px; font-size: 14px; color: var(--text-1); }
.profile-card .sec { margin-top: 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-2); }
.profile-card .btn { margin-top: 14px; }

.tooltip {
  position: fixed; z-index: 200; pointer-events: none; background: var(--bg-float); color: var(--text-0);
  font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--bg-float); color: var(--text-0); padding: 10px 16px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); border: 1px solid var(--border); animation: pop 0.15s ease-out;
}
.toast.error { border-color: rgba(229, 72, 77, 0.6); }

/* ---------- voice ---------- */
.channel .count {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: grid; place-items: center;
}
.voice-channel.connected { color: var(--text-0); }
.voice-users { margin: 0 0 4px 30px; }
.voice-user {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px; border-radius: 6px;
  color: var(--text-2); font-size: 14px; cursor: pointer;
}
.voice-user:hover { background: var(--hover); color: var(--text-1); }
.voice-user .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user .avatar, .speak-ring { transition: box-shadow 0.08s; border-radius: 50%; }
.voice-user.speaking .avatar, .speak-ring.speaking { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--green); }
.voice-user.speaking .name { color: var(--text-0); }
.vu-flag { color: var(--red); display: grid; }
.in-voice { color: var(--green); display: grid; }

.voice-panel { padding: 10px 8px 10px 12px; background: #16171c; border-bottom: 1px solid var(--border); }
.vp-row { display: flex; align-items: center; gap: 8px; }
.vp-info { flex: 1; min-width: 0; }
.vp-status { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.vp-status.good { color: var(--green); }
.vp-status.warn { color: var(--yellow); }
.vp-status.bad { color: var(--red); }
.vp-where {
  display: block; max-width: 100%; font-size: 12px; color: var(--text-2); text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vp-where:hover { color: var(--text-1); text-decoration: underline; }
.voice-panel .vp-hangup { width: 32px; height: 32px; border-radius: 6px; }
.voice-panel .vp-hangup:hover { background: var(--hover); color: var(--red); }
.user-panel .icon-btn.off { color: var(--red); }
.user-panel .icon-btn.off:hover { color: #ff7b7f; }
.user-panel .speak-ring { display: grid; }

/* ---------- attachments ---------- */
.attachments { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 4px; }
.att-image { display: block; border-radius: 8px; overflow: hidden; background: var(--bg-1); line-height: 0; cursor: zoom-in; }
.att-image img { display: block; object-fit: contain; max-width: 100%; }
.att-video { max-width: min(400px, 100%); max-height: 320px; border-radius: 8px; background: #000; }
.att-file {
  width: min(400px, 100%); padding: 10px 12px; border-radius: 8px; background: var(--bg-1);
  border: 1px solid var(--border);
}
.att-file audio { width: 100%; margin-top: 8px; height: 36px; }
.af-row { display: flex; align-items: center; gap: 10px; }
.af-icon { color: var(--accent); display: grid; }
.af-meta { flex: 1; min-width: 0; }
.af-name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-size { font-size: 12px; color: var(--text-3); }
.att-file .icon-btn { width: 32px; height: 32px; }
.reply-ref .rtext.att { display: inline-flex; align-items: center; gap: 4px; font-style: italic; }

.lightbox { background: rgba(0, 0, 0, 0.85); cursor: zoom-out; }
.lb-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 92vw; cursor: default; }
.lb-inner img { max-width: 92vw; max-height: 82vh; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.lb-bar { display: flex; gap: 16px; align-items: center; color: var(--text-2); font-size: 13px; }

.pending-files {
  display: flex; gap: 10px; overflow-x: auto; padding: 12px; background: var(--bg-3);
  border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--border);
}
.composer.has-reply .pending-files { border-radius: 0; }
#pending-slot:not(:empty) + .composer-box { border-radius: 0 0 8px 8px; }
.pending-file {
  position: relative; flex: none; width: 150px; padding: 8px; border-radius: 8px; background: var(--bg-1);
  display: flex; flex-direction: column; gap: 6px;
}
.pending-file img { width: 100%; height: 96px; object-fit: cover; border-radius: 4px; }
.pending-file .pf-icon { height: 96px; display: grid; place-items: center; color: var(--accent); background: var(--bg-2); border-radius: 4px; }
.pending-file .pf-icon svg { width: 40px; height: 40px; }
.pf-name { font-size: 12px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-bar { height: 4px; border-radius: 2px; background: var(--bg-4); overflow: hidden; }
.pf-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.15s; }
.pf-error { font-size: 12px; color: #ff8589; }
.pending-file.error { outline: 1px solid rgba(229, 72, 77, 0.6); }
.pf-remove {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg-4); color: var(--text-1); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.pf-remove:hover { background: var(--red); color: #fff; }
.composer-box .attach-btn { width: 36px; margin-left: -10px; }
.composer-box .attach-btn:hover { color: var(--text-0); }

.chat { position: relative; }
.drop-overlay {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(18, 19, 24, 0.82); pointer-events: none;
}
.drop-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 48px; border-radius: 16px;
  background: var(--accent); color: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); text-align: center;
  outline: 2px dashed rgba(255, 255, 255, 0.6); outline-offset: -10px;
}
.drop-card svg { width: 40px; height: 40px; }
.drop-card strong { font-size: 20px; }

/* ---------- mention autocomplete ---------- */
.composer { position: relative; }
.autocomplete {
  position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); z-index: 10;
  background: var(--bg-1); border-radius: 8px; padding: 8px; box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}
.ac-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-2); padding: 2px 8px 6px; }
.ac-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ac-row.active { background: var(--bg-4); }
.ac-name { color: var(--text-0); font-weight: 500; }
.ac-user { margin-left: auto; color: var(--text-3); font-size: 13px; }
.ac-at { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-4); color: var(--text-1); font-weight: 700; }

/* ---------- create channel & settings ---------- */
.type-options { display: flex; flex-direction: column; gap: 8px; }
.type-option {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  background: var(--bg-1); text-align: left; border: 1px solid transparent; color: var(--text-2);
}
.type-option div { flex: 1; display: flex; flex-direction: column; }
.type-option strong { color: var(--text-0); font-weight: 600; }
.type-option span { font-size: 13px; }
.type-option .radio { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-3); }
.type-option.on { border-color: var(--accent); background: var(--accent-soft); }
.type-option.on .radio { border: 6px solid var(--accent); }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-1); cursor: pointer; text-transform: none; font-weight: 400; letter-spacing: 0; }
.field label.toggle { font-size: 14px; font-weight: 400; color: var(--text-1); text-transform: none; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- avatars & icons with pictures ---------- */
.avatar { overflow: visible; }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.rail-icon .server-icon { width: 100%; height: 100%; object-fit: cover; display: block; }
svg.icon.up { transform: rotate(180deg); }
.avatar-editor { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 18px; }
.avatar-editor > div:last-child { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.muted { color: var(--text-2); font-size: 14px; margin: 0 0 12px; }
.muted.small { font-size: 12px; margin-top: 12px; }

/* ---------- chat header: pins & search ---------- */
.chat-header .tools { align-items: center; }
.header-search {
  width: 160px; height: 28px; padding: 0 10px; border-radius: 6px; border: 0; outline: none;
  background: var(--bg-0); color: var(--text-1); font-size: 13px; transition: width 0.15s;
}
.header-search:focus { width: 240px; }
.members.wide { width: 360px; padding: 0; }
.search-panel { display: flex; flex-direction: column; min-height: 100%; }
.search-head {
  display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--bg-0); color: var(--text-0); position: sticky; top: 0; background: var(--bg-1); z-index: 1;
}
.search-hint { font-size: 12px; color: var(--text-3); padding: 10px 16px 4px; }
.search-results { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.search-panel > .btn { margin: 0 8px 16px; width: auto; }

.mini-msg { background: var(--bg-2); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--border); }
.mini-label { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.mini-row { display: flex; gap: 10px; align-items: flex-start; }
.mini-body { flex: 1; min-width: 0; }
.mini-head { display: flex; gap: 8px; align-items: baseline; }
.mini-head .author { color: var(--text-0); font-weight: 600; }
.mini-head .ts { font-size: 11px; color: var(--text-3); }
.mini-content { color: var(--text-1); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; max-height: 180px; overflow: hidden; }
.mini-content code { font-family: var(--mono); font-size: 0.85em; background: var(--bg-0); padding: 1px 4px; border-radius: 4px; }
.mini-content pre { margin: 4px 0 0; padding: 6px 8px; background: var(--bg-0); border-radius: 6px; font-family: var(--mono); font-size: 12px; }
.mini-content .mention { background: var(--accent-soft); color: #c7c1ff; border-radius: 3px; padding: 0 2px; }
.mini-att { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); margin-top: 4px; }
.mini-actions { display: flex; align-items: center; gap: 2px; }
.mini-jump {
  font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 4px; background: var(--bg-3); color: var(--text-1);
  opacity: 0; transition: opacity 0.1s;
}
.mini-msg:hover .mini-jump, .mini-jump:focus { opacity: 1; }
.mini-jump:hover { background: var(--bg-4); color: var(--text-0); }

.pins-pop { width: 420px; max-height: 70vh; display: flex; flex-direction: column; }
.pins-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; font-weight: 700; color: var(--text-0); border-bottom: 1px solid var(--border); }
.pins-list { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.pins-empty { text-align: center; color: var(--text-2); padding: 24px 12px; }
.pins-empty svg { width: 40px; height: 40px; color: var(--text-3); }
.pinned-flag { color: var(--text-3); display: inline-grid; align-self: center; }
.msg.system .sys-icon svg { stroke: currentColor; }
.pin-notice .sys-icon { color: var(--text-2); }
.sys-link { color: var(--text-0); font-weight: 600; }

.jump-bar {
  display: flex; align-items: center; justify-content: space-between; margin: 0 16px 6px; padding: 6px 12px;
  border-radius: 8px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
.jump-bar button { display: inline-flex; align-items: center; gap: 4px; color: #fff; font-weight: 700; }
.jump-bar button:hover { text-decoration: underline; }
.composer-box.locked {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px; color: var(--text-3); font-size: 14px; min-height: 44px;
}

/* ---------- profile: roles & moderation ---------- */
.owner-tag { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--yellow); }
.role-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.role-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 6px; border-radius: 4px;
  background: var(--bg-3); font-size: 12px; font-weight: 500; color: var(--text-1);
}
.role-chip.add { width: 22px; justify-content: center; padding: 0; color: var(--text-2); }
.role-chip.add:hover { color: var(--text-0); background: var(--bg-4); }
.role-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.role-x { display: grid; color: var(--text-3); margin-right: -2px; }
.role-x:hover { color: var(--red); }
.role-picker { margin-top: 6px; background: var(--bg-2); border-radius: 6px; padding: 4px; max-height: 180px; overflow-y: auto; }
.role-option { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; font-size: 13px; text-align: left; }
.role-option:hover { background: var(--bg-4); }
.mod-actions { display: flex; gap: 8px; margin-top: 8px; }
.mod-actions .btn { flex: 1; height: 32px; }

/* ---------- server settings window ---------- */
.settings-modal { max-width: 900px; height: min(680px, 90vh); display: flex; }
.settings-nav { width: 200px; flex: none; background: var(--bg-1); padding: 20px 10px; display: flex; flex-direction: column; gap: 2px; }
.settings-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-2); padding: 0 10px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-tab { text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text-2); font-weight: 500; }
.settings-tab:hover { background: var(--hover); color: var(--text-1); }
.settings-tab.active { background: var(--active); color: var(--text-0); }
.settings-main { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.settings-main > .close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.settings-pane { flex: 1; overflow-y: auto; padding: 24px 28px; }
.settings-pane h2 { margin: 0 0 16px; color: var(--text-0); font-size: 20px; }
.overview-row { display: flex; gap: 20px; align-items: center; margin-bottom: 22px; }
.icon-preview {
  width: 96px; height: 96px; flex: none; border-radius: 28px; display: grid; place-items: center; overflow: hidden;
  color: #fff; font-size: 28px; font-weight: 700;
}
.icon-preview img { width: 100%; height: 100%; object-fit: cover; }

.roles-layout { display: flex; gap: 20px; height: 100%; margin: -24px -28px; }
.roles-side { width: 220px; flex: none; border-right: 1px solid var(--border); padding: 24px 12px 16px 20px; overflow-y: auto; }
.roles-side-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }
.role-row { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 10px; border-radius: 6px; cursor: pointer; color: var(--text-1); }
.role-row:hover { background: var(--hover); }
.role-row.active { background: var(--active); color: var(--text-0); }
.role-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.role-moves { display: none; }
.role-row:hover .role-moves, .role-row.active .role-moves { display: flex; }
.role-moves .icon-btn { width: 22px; height: 22px; }
.role-editor { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 28px 24px 0; }
.role-editor .swatch.none { display: grid; place-items: center; background: var(--bg-3); color: var(--text-2); }
.color-input { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 2px solid var(--bg-4); border-radius: 50%; }
.perm-list { display: flex; flex-direction: column; }
.perm-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.field label.perm-row { text-transform: none; font-weight: 400; letter-spacing: 0; font-size: 14px; color: var(--text-1); }
.perm-row > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.perm-row strong { color: var(--text-0); font-weight: 600; }
.perm-row span { font-size: 13px; color: var(--text-2); }
.perm-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.perm-row input:disabled { opacity: 0.4; }
.editor-actions { display: flex; gap: 8px; margin-top: 20px; position: sticky; bottom: 0; padding: 12px 0; background: var(--bg-2); }
.editor-actions .spacer { flex: 1; }
.ban-list { display: flex; flex-direction: column; gap: 6px; }
.ban-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg-1); }
.ban-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ban-meta strong { color: var(--text-0); }
.ban-meta span { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .members.auto { display: none; }
}
@media (max-width: 720px) {
  .sidebar { width: 200px; }
  .msg { padding-right: 16px; }
}

/* ---------- private channels & channel permissions ---------- */
.ch-glyph { position: relative; display: grid; flex: none; }
.ch-glyph .lock-badge {
  position: absolute; right: -4px; top: -3px; width: 11px; height: 11px; stroke-width: 3;
  background: var(--bg-1); border-radius: 3px; padding: 1px; box-sizing: content-box;
}
.chat-header .ch-glyph .lock-badge { background: var(--bg-2); right: -3px; top: -2px; }
.settings-sep { height: 1px; background: var(--border); margin: 8px 10px; }
.settings-tab.danger { color: #ff8589; }
.settings-tab.danger:hover { background: rgba(229, 72, 77, 0.12); color: #ff8589; }
.private-toggle { align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: var(--bg-1); margin: 4px 0 6px; }
.private-toggle > span { display: flex; flex-direction: column; gap: 2px; }
.private-toggle strong { display: inline-flex; align-items: center; gap: 4px; color: var(--text-0); }
.private-toggle .muted { font-size: 13px; color: var(--text-2); }
.private-toggle input { margin-top: 2px; }
.roles-layout.embedded { margin: 16px 0 0; height: auto; min-height: 380px; border-top: 1px solid var(--border); }
.roles-layout.embedded .roles-side { padding: 16px 12px 16px 0; }
.roles-layout.embedded .role-editor { padding: 16px 0 0; }
.tri-row { cursor: default; }
.perm-row > .tri-group { display: flex; flex: none; flex-direction: row; gap: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--bg-4); }
.tri { width: 30px; height: 26px; display: grid; place-items: center; color: var(--text-3); background: var(--bg-1); }
.tri + .tri { border-left: 1px solid var(--bg-4); }
.tri:hover:not(:disabled) { color: var(--text-0); background: var(--bg-3); }
.tri:disabled { opacity: 0.35; cursor: not-allowed; }
.tri.deny.on { background: var(--red); color: #fff; }
.tri.inherit.on { background: var(--bg-4); color: var(--text-0); }
.tri.allow.on { background: var(--green); color: #fff; }
.target-picker { max-height: 320px; overflow-y: auto; width: 240px; }
.target-picker button { display: flex; align-items: center; gap: 8px; justify-content: flex-start; }
.picker-head { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-3); padding: 8px 8px 4px; }

/* ---------- friends ---------- */
.friends-link { height: 42px; gap: 12px; margin-bottom: 4px; }
.friends-link .count, .ftab .count {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: inline-grid; place-items: center;
}
.friends-page { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.friends-header { gap: 6px; }
.friends-header .divider { width: 1px; height: 24px; background: var(--bg-4); margin: 0 8px; }
.ftab { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 4px; color: var(--text-2); font-weight: 500; }
.ftab:hover { background: var(--hover); color: var(--text-1); }
.ftab.active { background: var(--active); color: var(--text-0); }
.ftab.add { background: var(--green); color: #fff; margin-left: 4px; }
.ftab.add.active { background: none; color: var(--green); }
.friends-body { flex: 1; overflow-y: auto; padding: 8px 20px 20px 24px; }
.friends-count { padding-left: 4px; }
.friend-row {
  display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 10px; margin: 0 -10px;
  border-top: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.friend-row:hover { background: var(--hover); border-top-color: transparent; }
.friend-row:hover + .friend-row { border-top-color: transparent; }
.friend-row .meta { flex: 1; min-width: 0; line-height: 1.25; }
.friend-row .dn { color: var(--text-0); font-weight: 600; }
.friend-row .dn .un { color: var(--text-2); font-weight: 500; font-size: 13px; opacity: 0; transition: opacity 0.1s; }
.friend-row:hover .dn .un { opacity: 1; }
.friend-row .sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-actions { display: flex; gap: 8px; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-1); color: var(--text-2); }
.round-btn:hover { color: var(--text-0); }
.round-btn.danger:hover { color: var(--red); }
.round-btn.good:hover { color: var(--green); }
.friends-empty { text-align: center; color: var(--text-2); padding: 60px 20px; }
.friends-empty .art svg { width: 72px; height: 72px; color: var(--text-3); stroke-width: 1.5; }
.friends-empty p { margin: 12px 0 18px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; }
.add-friend { max-width: 720px; padding-top: 12px; }
.add-friend h2 { margin: 0 0 4px; color: var(--text-0); font-size: 16px; text-transform: uppercase; }
.add-friend .muted { margin: 0 0 14px; color: var(--text-2); font-size: 14px; }
.add-row { display: flex; gap: 8px; padding: 6px; border-radius: 8px; background: var(--bg-0); border: 1px solid var(--bg-0); }
.add-row:focus-within { border-color: var(--accent); }
.add-row .input { flex: 1; background: none; border: 0; outline: none; }
.add-row .btn { height: 34px; flex: none; }
.add-result { margin-top: 8px; font-size: 14px; min-height: 20px; }
.add-result.good { color: var(--green); }
.add-result.bad { color: #ff8589; }

/* profile card: friend actions, menu, status picker */
.profile-card { position: relative; }
.card-more { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, 0.35); color: #fff; }
.card-more:hover { background: rgba(0, 0, 0, 0.55); }
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { flex: 1; height: 34px; padding: 0 10px; white-space: nowrap; }
.popover .user-menu { position: absolute; z-index: 3; background: var(--bg-float); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.status-picker { display: flex; flex-direction: column; margin: 4px 0 10px; padding: 4px; border-radius: 8px; background: var(--bg-2); }
.status-opt { display: flex; align-items: flex-start; gap: 10px; padding: 6px 8px; border-radius: 6px; text-align: left; }
.status-opt:hover { background: var(--bg-4); }
.status-opt.on { background: var(--accent-soft); }
.status-dot { position: relative; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--text-3); }
.status-dot.online { background: var(--green); }
.status-dot.idle { background: var(--yellow); }
.status-dot.dnd { background: var(--red); }
.status-dot.offline { background: none; box-shadow: inset 0 0 0 2.5px var(--text-3); }
.so-text { display: flex; flex-direction: column; line-height: 1.25; }
.so-text strong { color: var(--text-0); font-weight: 600; font-size: 14px; }
.so-text span { font-size: 12px; color: var(--text-2); }

/* blocked messages */
.msg.blocked-msg { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.link-btn { color: var(--link); font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.composer-box.locked > span { flex: 1; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }

/* ---------- camera & screen sharing ---------- */
.vp-actions { display: flex; gap: 6px; margin-top: 8px; }
.vp-media {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; border-radius: 6px;
  background: var(--bg-3); color: var(--text-1); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden;
}
.vp-media:hover:not(:disabled) { background: var(--bg-4); color: var(--text-0); }
.vp-media.on { background: var(--green); color: #fff; }
.vp-media:disabled { opacity: 0.5; cursor: not-allowed; }
.live-badge {
  display: inline-grid; place-items: center; height: 16px; padding: 0 5px; border-radius: 4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
}
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-col > .chat { flex: 1; min-height: 0; }
.call-stage {
  flex: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-content: center;
  padding: 12px; background: #0b0c0f; max-height: 46vh; overflow-y: auto;
}
.stage-tile {
  position: relative; flex: 1 1 200px; max-width: 520px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: #000; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color 0.08s;
}
.stage-tile.speaking { outline-color: var(--green); }
.stage-tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.stage-tile.screen video, .stage-tile.big video { object-fit: contain; }
.stage-tile video.mirror { transform: scaleX(-1); }
.call-stage.focused .stage-tile { flex: 0 0 160px; }
.call-stage.focused .stage-tile.big { flex: 1 1 100%; max-width: none; max-height: 40vh; order: -1; }
.stage-label {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 16px);
  padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-full {
  position: absolute; right: 8px; top: 8px; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.55); color: #fff; opacity: 0; transition: opacity 0.1s;
}
.stage-tile:hover .stage-full { opacity: 1; }

/* ---------- threads ---------- */
svg.icon.side { transform: rotate(-90deg); }
.thread-list { margin: 0 0 2px 22px; }
.thread-item { height: 30px; padding-left: 14px; font-size: 14px; }
.thread-curve {
  position: absolute; left: 0; top: -6px; width: 11px; height: 21px;
  border-left: 2px solid var(--bg-4); border-bottom: 2px solid var(--bg-4); border-bottom-left-radius: 8px;
}
.thread-item.unread::before { left: -30px; }
.chat-header .crumb { color: var(--text-2); font-weight: 600; }
.chat-header .crumb:hover { color: var(--text-0); text-decoration: underline; }
.crumb-sep { color: var(--text-3); display: grid; }
.thread-card {
  margin-top: 6px; max-width: 460px; padding: 8px 12px; border-radius: 8px; background: var(--bg-1);
  border: 1px solid var(--border); cursor: pointer; transition: border-color 0.1s;
}
.thread-card:hover { border-color: var(--bg-4); }
.thread-card.archived { opacity: 0.75; }
.tc-top { display: flex; align-items: center; gap: 6px; color: var(--text-0); }
.tc-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tc-open { display: inline-flex; align-items: center; gap: 2px; color: var(--link); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tc-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.thread-notice .thread-card { margin-left: 0; }
.msg.system.thread-notice .sys-icon { color: var(--text-2); }
.thread-starter { margin-top: 14px; max-width: 560px; }
.archived-note {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 6px 12px; border-radius: 8px;
  background: var(--bg-1); color: var(--text-2); font-size: 13px;
}
.threads-pop { width: 380px; max-height: 70vh; display: flex; flex-direction: column; }
.threads-pop .pins-head .spacer { flex: 1; }
.threads-body { overflow-y: auto; padding: 6px 8px 10px; }
.thread-row { width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: 6px; text-align: left; color: var(--text-2); }
.thread-row:hover { background: var(--bg-3); }
.thread-row svg { margin-top: 3px; }
.tr-meta { display: flex; flex-direction: column; min-width: 0; }
.tr-meta strong { color: var(--text-0); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-meta span { font-size: 12px; }

/* ---------- edit history & the NEW line ---------- */
.msg-content button.edited { font-size: 11px; color: var(--text-3); margin-left: 4px; }
.msg-content button.edited:hover { color: var(--text-1); text-decoration: underline; }
.history-pop { width: 400px; }
.history-list { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.history-version { padding: 8px 10px; border-radius: 8px; background: var(--bg-2); }
.history-version.current { outline: 1px solid var(--accent); }
.hv-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.hv-head strong { color: var(--text-0); font-size: 13px; }
.hv-head .ts { font-size: 12px; color: var(--text-3); }
.hv-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-1); font-size: 14px; }
.new-divider { display: flex; align-items: center; margin: 10px 16px 2px; height: 1px; background: var(--red); position: relative; }
.new-divider span {
  position: absolute; right: 0; top: -8px; height: 16px; padding: 0 6px; border-radius: 4px 0 0 4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 800; line-height: 16px;
}

/* ---------- custom emoji ---------- */
img.cemoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; display: inline-block; }
.msg-content.jumbo img.cemoji { width: 48px; height: 48px; vertical-align: -8px; }
.reaction img.cemoji { width: 18px; height: 18px; vertical-align: -4px; }
.r-emoji { display: inline-grid; place-items: center; }
.emoji-picker { width: 340px; padding: 0; display: flex; flex-direction: column; max-height: 380px; }
.emoji-search {
  margin: 8px; height: 32px; padding: 0 10px; border-radius: 6px; border: 0; outline: none;
  background: var(--bg-0); color: var(--text-0);
}
.emoji-body { overflow-y: auto; padding: 0 8px 8px; }
.emoji-section .picker-head { padding: 8px 2px 4px; }
.emoji-picker button img.cemoji { width: 26px; height: 26px; }
.emoji-picker button { display: grid; place-items: center; }
.ac-emoji { width: 24px; height: 24px; display: grid; place-items: center; font-size: 20px; }
img.cemoji.ac-emoji { width: 24px; height: 24px; }
.emoji-upload-row { display: flex; align-items: center; gap: 14px; margin: 6px 0 16px; }
.emoji-admin-list { display: flex; flex-direction: column; gap: 4px; }
.emoji-admin-row { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 8px; background: var(--bg-1); }
.emoji-admin-row .spacer { flex: 1; }
img.cemoji.admin { width: 32px; height: 32px; margin-right: 10px; }
.emoji-admin-row .colon { color: var(--text-3); font-weight: 700; }
.emoji-admin-row .emoji-name { width: 220px; height: 32px; }

/* Keep the chat header inside its column on narrow windows: names shrink with "…", then the search box. */
.chat-header { min-width: 0; overflow: hidden; }
.chat-header .title { min-width: 40px; overflow: hidden; text-overflow: ellipsis; flex-shrink: 3; }
.chat-header .crumb { min-width: 40px; flex-shrink: 3; max-width: 30%; }
.chat-header .glyph, .chat-header .crumb-sep, .chat-header .tools .icon-btn { flex: none; }
.chat-header .tools { flex-shrink: 1; min-width: 0; }
.header-search { min-width: 110px; flex-shrink: 1; }
@media (max-width: 1000px) {
  .header-search { width: 110px; }
  .header-search:focus { width: 180px; }
}

/* ---------- moderation: timeouts, slow mode, audit log ---------- */
.timeout-tag {
  display: inline-flex; align-items: center; gap: 5px; margin: 6px 0 2px; padding: 3px 8px; border-radius: 6px;
  background: rgba(229, 72, 77, 0.14); color: #ff8589; font-size: 12px; font-weight: 600;
}
.member .timed-out { color: #ff8589; display: grid; }
.choice-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--bg-3); color: var(--text-1); font-size: 13px; font-weight: 600; }
.chip:hover { background: var(--bg-4); }
.chip.on { background: var(--accent); color: #fff; }
.slow-note { display: flex; align-items: center; gap: 6px; padding: 4px 4px 0; font-size: 12px; color: var(--text-3); }
.slow-note.waiting { color: var(--yellow); }
select.input { appearance: auto; cursor: pointer; }
.settings-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.settings-section h3 { margin: 0 0 6px; color: var(--text-0); font-size: 16px; }
.settings-section .muted { margin: 0 0 10px; font-size: 14px; }
.security-row { display: flex; flex-wrap: wrap; gap: 8px; }
.audit-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.audit-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-1); }
.audit-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-3); color: var(--text-2); flex: none; }
.audit-noone { width: 28px; height: 28px; flex: none; }
.audit-text { flex: 1; min-width: 0; font-size: 14px; color: var(--text-2); }
.audit-text strong { color: var(--text-0); font-weight: 600; }
.audit-details { font-size: 12px; color: var(--text-3); margin-top: 1px; overflow-wrap: anywhere; }
.audit-row .ts { font-size: 12px; color: var(--text-3); white-space: nowrap; }


/* ---------- phones and small windows ---------- */
.nav-toggle, .mobile-search, .drawer-backdrop { display: none; }
@media (hover: none) {
  .msg:hover .msg-toolbar { display: none; }
  .msg.touch-tools .msg-toolbar, .msg-toolbar.open { display: flex; }
  .msg.touch-tools { background: var(--hover); }
}
@media (max-width: 760px) {
  .app { height: 100dvh; }
  .nav-toggle { display: grid; width: 36px; height: 36px; margin-left: -8px; flex: none; }
  .rail, .sidebar { position: fixed; top: 0; bottom: 0; z-index: 60; transition: transform 0.2s ease; }
  .rail { left: 0; transform: translateX(-100%); }
  .sidebar { left: 72px; width: min(300px, calc(100vw - 72px - 44px)); transform: translateX(calc(-100% - 72px)); box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35); }
  .app.nav-open .rail, .app.nav-open .sidebar { transform: none; }
  .members, .members.wide {
    position: fixed; top: 0; bottom: 0; right: 0; z-index: 60; width: min(320px, calc(100vw - 44px));
    transform: translateX(105%); transition: transform 0.2s ease; box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
  }
  .app.members-open .members { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.5); }
  .app.nav-open .drawer-backdrop, .app.members-open .drawer-backdrop { display: block; }
  .chat-header { padding: 0 8px 0 12px; }
  .chat-header .topic, .header-search { display: none; }
  .mobile-search { display: grid; }
  .chat-header .tools { gap: 2px; }
  .msg { padding: 2px 10px 2px 58px; }
  .msg > .avatar { left: 10px; }
  .msg .gutter-time { width: 58px; }
  .msg-toolbar { right: 8px; }
  .composer { padding: 0 8px; }
  .composer-box textarea { font-size: 16px; } /* stops phones zooming in on focus */
  .backdrop { padding: 10px; }
  .modal-body { max-height: 70dvh; }
  .settings-modal { flex-direction: column; height: 92dvh; }
  .settings-nav { width: auto; flex-direction: row; overflow-x: auto; padding: 10px; gap: 4px; }
  .settings-nav .settings-title, .settings-nav .settings-sep { display: none; }
  .settings-tab { white-space: nowrap; }
  .settings-pane { padding: 18px 16px; }
  .roles-layout { flex-direction: column; margin: 0; height: auto; }
  .roles-side { width: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 12px; }
  .role-editor { padding: 12px 0; }
  .friends-header { overflow-x: auto; }
  .friends-header .divider { display: none; }
  .friends-body { padding: 8px 12px 20px; }
  .friend-row .dn .un { display: none; }
  .call-stage { max-height: 34dvh; padding: 8px; }
  .stage-tile { flex-basis: 140px; }
  .pins-pop, .threads-pop, .history-pop { width: calc(100vw - 20px); }
  .emoji-picker { width: min(340px, calc(100vw - 20px)); }
  .channel-welcome h2 { font-size: 24px; }
  .jump-bar { margin: 0 8px 6px; }
}


/* ---------- muted channels ---------- */
.channel.muted { opacity: 0.5; }
.channel.muted:hover, .channel.muted.active { opacity: 1; }

/* ---------- richer formatting ---------- */
.msg-content .md-h1, .msg-content .md-h2, .msg-content .md-h3 { color: var(--text-0); font-weight: 700; line-height: 1.25; margin: 6px 0 2px; }
.msg-content .md-h1 { font-size: 1.5em; }
.msg-content .md-h2 { font-size: 1.25em; }
.msg-content .md-h3 { font-size: 1.1em; }
.msg-content .md-sub { font-size: 12px; color: var(--text-3); }
.msg-content ul, .msg-content ol { margin: 2px 0; padding-left: 22px; white-space: normal; }
.msg-content li { margin: 1px 0; white-space: pre-wrap; }

/* ---------- polls ---------- */
.plus-menu button { display: flex; align-items: center; gap: 8px; justify-content: flex-start; }
.poll-edit-answers { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.poll-edit-row { display: flex; align-items: center; gap: 6px; }
.poll-edit-row .input { flex: 1; }
.poll {
  margin-top: 6px; max-width: 440px; padding: 12px 14px; border-radius: 10px; background: var(--bg-1);
  border: 1px solid var(--border);
}
.poll-q { color: var(--text-0); font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.poll-hint { font-size: 12px; color: var(--text-3); margin: 2px 0 10px; }
.poll-answer {
  position: relative; overflow: hidden; width: 100%; display: flex; align-items: center; gap: 8px; min-height: 40px;
  margin-bottom: 6px; padding: 8px 12px; border-radius: 8px; background: var(--bg-3); text-align: left; color: var(--text-1);
  border: 1px solid transparent; transition: border-color 0.1s;
}
.poll-answer:hover:not(:disabled) { border-color: var(--bg-4); }
.poll-answer:disabled { cursor: default; }
.poll-answer.mine { border-color: var(--accent); }
.poll-answer.won .poll-text { color: var(--text-0); font-weight: 700; }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width 0.25s; }
.poll-answer.won .poll-bar { background: rgba(47, 179, 128, 0.25); }
.poll-check {
  position: relative; width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--text-3);
  display: grid; place-items: center; color: #fff;
}
.poll-answer.mine .poll-check { background: var(--accent); border-color: var(--accent); }
.poll-check svg { width: 12px; height: 12px; stroke-width: 3; }
.poll-text { position: relative; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.poll-count { position: relative; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.poll-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); margin-top: 4px; }

/* ---------- link previews ---------- */
.embeds { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.embed {
  max-width: 460px; display: flex; gap: 12px; padding: 10px 12px; border-radius: 6px; background: var(--bg-1);
  border-left: 4px solid var(--bg-4);
}
.embed-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.embed-site { font-size: 12px; color: var(--text-2); }
.embed-title { color: var(--link); font-weight: 600; overflow-wrap: anywhere; }
.embed-desc { font-size: 14px; color: var(--text-1); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.embed-thumb { width: 80px; height: 80px; flex: none; border-radius: 6px; object-fit: cover; }
.embed-large { display: block; margin-top: 6px; }
.embed-pic { display: block; max-width: 100%; height: auto; border-radius: 6px; object-fit: contain; background: var(--bg-0); }
.embed-image { display: inline-block; max-width: 400px; }

/* ---------- quick switcher ---------- */
.qs-backdrop { place-items: start center; padding-top: 12vh; }
.qs-modal { max-width: 560px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.qs-input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 8px; border: 0; outline: none;
  background: var(--bg-0); color: var(--text-0); font-size: 18px;
}
.qs-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.qs-row { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 6px; cursor: pointer; color: var(--text-1); }
.qs-row.active { background: var(--active); color: var(--text-0); }
.qs-icon { width: 24px; height: 24px; display: grid; place-items: center; color: var(--text-3); flex: none; }
.qs-icon.server { border-radius: 8px; color: #fff; font-size: 10px; font-weight: 700; }
.qs-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-sub { margin-left: auto; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.qs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-0); flex: none; }
.qs-row .count { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: grid; place-items: center; }
.qs-tip { font-size: 12px; color: var(--text-3); }
.qs-tip strong { color: var(--green); }
@media (max-width: 760px) {
  .qs-backdrop { padding-top: 10px; }
  .poll, .embed { max-width: 100%; }
}
