/* kari — dark theme */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg-rail: #1a1b1f;
  --bg-side: #212228;
  --bg-main: #2a2b31;
  --bg-elev: #18191c;
  --bg-input: #1e1f24;
  --bg-hover: rgba(255, 255, 255, 0.045);
  --bg-active: rgba(255, 255, 255, 0.085);
  --bg-modal: #2b2d33;
  --border: rgba(255, 255, 255, 0.06);
  --text: #e3e5e8;
  --text-strong: #f6f7f8;
  --text-muted: #9a9ea6;
  --text-faint: #6f737b;
  --accent: #6c72f5;
  --accent-hover: #5a60e6;
  --accent-soft: rgba(108, 114, 245, 0.16);
  --green: #3ba55d;
  --yellow: #f0b232;
  --red: #ed4a4e;
  --red-hover: #d43c40;
  --mention-bg: rgba(250, 168, 26, 0.09);
  --mention-bar: #f0b232;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --bg-panel: #1d1e23;
  --bg-composer: #34363d;
  --bg-code: #1b1c20;
  --bg-reply: #26272d;
  --bg-modal-foot: #24252a;
  --mention-text: #c9cdfb;
  --font-scale: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg-main); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: #7ab7ff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text-strong); margin: 0 0 8px; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; margin-top: 20px; }
p { margin: 0 0 8px; line-height: 1.45; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-elev); padding: 1px 5px; border-radius: 4px; }
fieldset { border: 0; padding: 0; margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; }
.pad { padding: 16px; }
.grow { flex: 1; min-width: 0; }
.italic { font-style: italic; }
.mono { font-family: var(--mono); }
.icon { width: 20px; height: 20px; flex: none; display: block; }
.root { height: 100vh; width: 100vw; }

/* scrollbars */
.scroll-thin { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.12) transparent; }
.scroll-thin::-webkit-scrollbar { width: 8px; }
.scroll-thin::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------------------------------------------------------- buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 6px; font-weight: 600; font-size: 14px; transition: background .15s, color .15s, transform .05s; white-space: nowrap; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: #4b4e57; color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #5a5d67; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #33914f; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--red-hover); }
.btn-danger-outline { border: 1px solid var(--red); color: var(--red); }
.btn-danger-outline:hover { background: var(--red); color: #fff; }
.btn-link { color: var(--text); background: none; }
.btn-link:hover { text-decoration: underline; }
.btn .icon { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field.disabled { opacity: .5; }
.field-label { font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--text-muted); display: block; }
.field input:not([type=range]):not([type=color]):not([type=checkbox]), .field textarea, .field select, input.wide, .pc-message, .nick-edit input {
  background: var(--bg-input); border: 1px solid transparent; border-radius: 6px; padding: 10px 12px; outline: none; transition: border-color .15s; width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus, input.wide:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 60px; }
input.wide { margin-bottom: 12px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.form-error { color: #ff8a8d; font-size: 13.5px; margin: -4px 0 12px; }
.ok-text { color: #57d283; font-size: 13.5px; }

.slider { width: 100%; accent-color: var(--accent); height: 20px; }

.toggle { width: 42px; height: 24px; border-radius: 12px; background: #72767d; position: relative; transition: background .2s; flex: none; }
.toggle.on { background: var(--green); }
.toggle-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle.on .toggle-knob { transform: translateX(18px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tr-title { font-weight: 600; color: var(--text-strong); display: flex; align-items: center; gap: 6px; }
.tr-title .icon { width: 16px; height: 16px; }

.radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-muted); display: inline-block; flex: none; position: relative; }
.radio.on { border-color: var(--accent); }
.radio.on::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.radio-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-input); border-radius: 6px; cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; font-size: 14px; }
.check-row.disabled { opacity: .5; cursor: default; }
.check-row input { accent-color: var(--accent); width: 16px; height: 16px; }

.seg { display: flex; gap: 4px; background: var(--bg-input); border-radius: 8px; padding: 3px; margin-bottom: 12px; }
.seg.wrap { flex-wrap: wrap; }
.seg-btn { flex: 1; padding: 6px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.seg-btn:hover { color: var(--text); background: var(--bg-hover); }
.seg-btn.on { background: var(--accent); color: #fff; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge { background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; flex: none; }

.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ---------------------------------------------------------- auth */
.auth-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 24px; padding: 24px; overflow: auto;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(108,114,245,.35), transparent 60%), radial-gradient(900px 600px at 90% 90%, rgba(235,69,158,.22), transparent 60%), #121317; }
.auth-bg.column { flex-direction: column; }
.auth-card { width: 100%; max-width: 440px; background: var(--bg-modal); border-radius: 14px; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,.45); animation: pop .25s ease; }
.auth-card h1 { text-align: center; font-size: 24px; }
.auth-card > p.center { display: block; margin-bottom: 20px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 16px; }
.auth-switch { margin-top: 14px; font-size: 14px; }
.brand-mark { width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, #6c72f5, #b05cf0); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 28px; box-shadow: 0 6px 20px rgba(108,114,245,.45); }
.brand-mark.big { width: 84px; height: 84px; font-size: 44px; border-radius: 26px; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .75; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.loading-screen { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: #121317; }
.invite-card { text-align: center; }
.invite-card .center { display: flex; }
.invite-icon { width: 80px; height: 80px; border-radius: 24px; background: var(--accent); margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 28px; font-weight: 700; color: #fff; }
.invite-icon img { width: 100%; height: 100%; object-fit: cover; }
.invite-counts { display: flex; justify-content: center; gap: 16px; margin: 4px 0 20px; color: var(--text-muted); font-size: 14px; }
.invite-counts > span { display: flex; align-items: center; gap: 6px; }
.dot-online, .dot-offline { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--green); }
.dot-offline { background: #80848e; }

/* ---------------------------------------------------------- layout */
.layout { display: flex; height: 100vh; width: 100vw; position: relative; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-main); position: relative; }
.empty-main { flex: 1; display: flex; align-items: center; justify-content: center; }
.gw-banner { position: absolute; top: 0; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 6px 14px; border-radius: 0 0 8px 8px; display: flex; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; z-index: 50; }
.gw-banner .spinner { width: 14px; height: 14px; border-width: 2px; border-top-color: #fff; }

/* ---------------------------------------------------------- rail */
.rail { width: 72px; flex: none; background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; 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-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-main); display: flex; align-items: center; justify-content: center; overflow: hidden; transition: border-radius .2s, background .2s, color .2s; color: var(--text); }
.rail-btn:hover, .rail-btn.active { border-radius: 16px; background: var(--accent); color: #fff; }
.rail-btn.guild:hover, .rail-btn.guild.active { background: var(--accent); }
.rail-btn img { width: 100%; height: 100%; object-fit: cover; }
.rail-btn.action { color: var(--green); }
.rail-btn.action:hover { background: var(--green); color: #fff; }
.rail-btn.dm-btn { background: transparent; }
.rail-btn.dm-btn .avatar .av-clip { border-radius: inherit; }
.home-btn .brand-glyph { font-weight: 800; font-size: 24px; }
.home-btn.active, .home-btn:hover { background: linear-gradient(135deg, #6c72f5, #b05cf0); }
.guild-initials { font-weight: 600; font-size: 15px; letter-spacing: -.02em; }
.rail-pill { position: absolute; left: 0; top: 50%; width: 4px; height: 0; background: var(--text-strong); border-radius: 0 4px 4px 0; transform: translateY(-50%); transition: height .2s; }
.rail-pill.unread { height: 8px; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-pill.active { height: 40px !important; }
.rail-badge { position: absolute; right: 10px; bottom: -2px; border: 3px solid var(--bg-rail); height: 22px; min-width: 22px; border-radius: 11px; }
.rail-voice { position: absolute; right: 10px; bottom: -2px; background: var(--green); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border: 3px solid var(--bg-rail); }
.rail-voice .icon { width: 11px; height: 11px; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--border); margin: 2px 0; flex: none; }
[data-tip] { position: relative; }
.rail-item[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 70px; top: 50%; transform: translateY(-50%); background: var(--bg-elev); color: var(--text-strong); padding: 8px 12px; border-radius: 6px; white-space: nowrap; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); z-index: 100; pointer-events: none; }

/* ---------------------------------------------------------- sidebar */
.sidebar { width: 248px; flex: none; background: var(--bg-side); display: flex; flex-direction: column; min-height: 0; position: relative; }
.sidebar-header { height: 48px; flex: none; display: flex; align-items: center; padding: 0 10px; border-bottom: 1px solid rgba(0,0,0,.25); box-shadow: 0 1px 0 rgba(0,0,0,.1); }
.guild-header { padding: 0 16px; cursor: pointer; gap: 6px; transition: background .15s; }
.guild-header:hover, .guild-header.open { background: var(--bg-hover); }
.guild-name { flex: 1; font-weight: 700; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-header .chev .icon, .muted-ic .icon { width: 18px; height: 18px; }
.muted-ic { color: var(--text-muted); }
.search-fake { width: 100%; height: 30px; border-radius: 6px; background: var(--bg-elev); color: var(--text-muted); text-align: left; padding: 0 8px; font-size: 13.5px; }
.channel-list { flex: 1; padding: 8px 8px 16px; min-height: 0; }
.section { margin-bottom: 4px; }
.category { display: flex; align-items: center; gap: 2px; padding: 16px 4px 4px 0; color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; cursor: pointer; user-select: none; }
.category:hover { color: var(--text); }
.cat-chev .icon { width: 12px; height: 12px; transition: transform .15s; }
.cat-chev.collapsed .icon { transform: rotate(-90deg); }
.cat-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-btn { opacity: 0; color: var(--text-muted); padding: 2px; border-radius: 4px; }
.cat-btn .icon { width: 15px; height: 15px; }
.category:hover .cat-btn, .dm-header .cat-btn { opacity: 1; }
.cat-btn:hover { color: var(--text-strong); }
.channel-row { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; border-radius: 6px; color: var(--text-faint); cursor: pointer; margin: 1px 0; position: relative; transition: background .1s, color .1s; }
.channel-row:hover { background: var(--bg-hover); color: var(--text); }
.channel-row.active { background: var(--bg-active); color: var(--text-strong); }
.channel-row.unread { color: var(--text-strong); }
.channel-row.unread .ch-name { font-weight: 600; }
.channel-row.unread::before { content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%); width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text-strong); }
.channel-row.muted-ch { opacity: .5; }
.ch-icon { position: relative; display: flex; color: inherit; opacity: .8; }
.ch-icon .icon { width: 19px; height: 19px; }
.ch-lock { position: absolute; right: -4px; top: -3px; background: var(--bg-side); border-radius: 50%; }
.ch-lock .icon { width: 10px; height: 10px; }
.ch-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ch-limit { font-size: 11px; background: var(--bg-elev); padding: 1px 5px; border-radius: 6px; color: var(--text-muted); }
.ch-actions { display: none; gap: 2px; }
.channel-row:hover .ch-actions, .channel-row.active .ch-actions { display: flex; }
.ch-btn { color: var(--text-muted); padding: 2px; }
.ch-btn:hover { color: var(--text-strong); }
.ch-btn .icon { width: 15px; height: 15px; }
.voice-users { padding: 2px 0 6px 30px; }
.voice-user { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px; border-radius: 6px; cursor: pointer; color: var(--text-muted); font-size: 14px; }
.voice-user:hover { background: var(--bg-hover); color: var(--text); }
.vu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vu-name.speaking { color: var(--text-strong); }
.vu-icons { display: flex; gap: 4px; align-items: center; color: var(--text-muted); }
.vu-icons .icon { width: 14px; height: 14px; }
.vu-icons .server { color: var(--red); }
.live-badge { background: var(--red); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; letter-spacing: .03em; }
.dm-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 8px 6px; color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.dm-nav { height: 42px; color: var(--text-muted); }
.dm-nav .ch-name { font-weight: 600; }
.dm-row { height: 44px; gap: 10px; }
.dm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dm-sub { font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-call { color: var(--green); }
.dm-call .icon { width: 16px; height: 16px; }
.dm-close { opacity: 0; color: var(--text-muted); }
.dm-close .icon { width: 16px; height: 16px; }
.dm-row:hover .dm-close { opacity: 1; }
.dm-close:hover { color: var(--text-strong); }
.group-av { --av-bg: #5865f2; }
.group-av .av-clip { background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; }
.group-av .icon { width: 18px; height: 18px; }

/* dropdowns & popovers */
.dropdown { position: absolute; background: var(--bg-elev); border-radius: 8px; padding: 6px; box-shadow: var(--shadow); z-index: 60; min-width: 200px; animation: pop .12s ease; }
.guild-menu { top: 54px; left: 10px; right: 10px; }
.dd-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 4px; font-size: 14px; font-weight: 500; color: var(--text); text-align: left; }
.dd-item .icon { width: 17px; height: 17px; }
.dd-item:hover { background: var(--accent); color: #fff; }
.dd-item.accent { color: #9ea3ff; }
.dd-item.accent:hover { color: #fff; }
.dd-item.danger { color: #ff7b7e; }
.dd-item.danger:hover { background: var(--red); color: #fff; }
.dd-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.dd-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px 4px; }
.popover { position: absolute; background: var(--bg-elev); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); z-index: 70; animation: pop .12s ease; }
.pop-title { font-weight: 700; color: var(--text-strong); margin-bottom: 10px; }

/* voice panel & user panel */
.voice-panel { border-top: 1px solid var(--border); background: var(--bg-panel); padding: 8px 8px 6px; position: relative; }
.vp-top { display: flex; align-items: center; gap: 4px; }
.vp-info { flex: 1; min-width: 0; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.vp-info:hover .vp-place { text-decoration: underline; }
.vp-state { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--yellow); }
.vp-state.connected { color: #4fd17c; }
.vp-state.failed, .vp-state.disconnected { color: var(--red); }
.vp-state .icon { width: 15px; height: 15px; }
.vp-ping { font-weight: 500; font-size: 11px; color: var(--text-faint); margin-left: auto; }
.vp-place { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-buttons { display: flex; gap: 6px; margin-top: 6px; }
.vp-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: 6px; background: var(--bg-hover); font-size: 13px; font-weight: 600; color: var(--text); transition: background .15s; }
.vp-btn .icon { width: 17px; height: 17px; }
.vp-btn:hover { background: var(--bg-active); }
.vp-btn.on { background: var(--green); color: #fff; }
.screen-menu { bottom: 100%; left: 8px; right: 8px; margin-bottom: 6px; }
.screen-menu.up { left: 50%; right: auto; width: 280px; transform: translateX(-50%); bottom: 64px; }
.icon-btn { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex: none; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--bg-active); color: var(--text-strong); }
.icon-btn.small { width: 24px; height: 24px; }
.icon-btn.small .icon { width: 15px; height: 15px; }
.icon-btn.danger:hover { color: var(--red); }
.icon-btn.danger-on { color: var(--red); }
.icon-btn.on { color: var(--green); }
.user-panel { height: 56px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 8px; background: var(--bg-panel); position: relative; }
.up-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 6px; cursor: pointer; }
.up-user:hover { background: var(--bg-active); }
.up-names { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.up-name { font-weight: 600; font-size: 14px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-picker { bottom: 62px; left: 8px; width: 280px; padding: 8px; }
.sp-custom { display: flex; gap: 4px; align-items: center; }
.sp-custom input { flex: 1; background: var(--bg-input); border: 1px solid transparent; border-radius: 6px; padding: 8px 10px; outline: none; }
.sp-custom input:focus { border-color: var(--accent); }
.status-opt { justify-content: flex-start; }
.status-opt.selected { background: var(--bg-active); }
.so-text { display: flex; flex-direction: column; }
.so-text small { color: var(--text-muted); font-size: 12px; }
.dd-item:hover .so-text small { color: rgba(255,255,255,.8); }

/* avatars & status */
.avatar { position: relative; flex: none; border-radius: 50%; }
.av-clip { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--av-bg, #5865f2); display: flex; align-items: center; justify-content: center; }
.av-clip img { width: 100%; height: 100%; object-fit: cover; }
.av-initials { color: #fff; font-weight: 600; letter-spacing: -.02em; user-select: none; }
.avatar.speaking .av-clip { box-shadow: 0 0 0 2px var(--bg-side), 0 0 0 4px #3ba55d; }
.status-dot { position: absolute; right: -2px; bottom: -2px; width: 34%; height: 34%; min-width: 10px; min-height: 10px; border-radius: 50%; border: 3px solid var(--bg-side); }
.status-dot.inline { position: static; width: 12px; height: 12px; min-width: 12px; border: 0; display: inline-block; }
.st-online { background: #3ba55d; }
.st-idle { background: #f0b232; }
.st-dnd { background: #ed4a4e; }
.st-offline { background: #80848e; }
.member-list .status-dot, .friend-row .status-dot { border-color: var(--bg-main); }
.member-list .status-dot { border-color: var(--bg-side); }
.chat-header .status-dot { border-color: var(--bg-main); }

/* ---------------------------------------------------------- headers */
.chat-header { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; border-bottom: 1px solid rgba(0,0,0,.25); box-shadow: 0 1px 0 rgba(0,0,0,.08); background: var(--bg-main); z-index: 5; min-width: 0; }
.chat-header .ch-icon { color: var(--text-faint); opacity: 1; }
.header-title { font-weight: 700; color: var(--text-strong); white-space: nowrap; }
.header-divider { width: 1px; height: 24px; background: var(--border); margin: 0 6px; flex: none; }
.header-topic { color: var(--text-muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.header-topic .md, .header-topic .md-p { display: inline; }
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.hdr-btn { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.hdr-btn:hover, .hdr-btn.active { color: var(--text-strong); background: var(--bg-hover); }
.hdr-pop-anchor { position: relative; }
.search-box { display: flex; align-items: center; background: var(--bg-elev); border-radius: 6px; height: 28px; padding: 0 6px 0 8px; width: 150px; transition: width .2s; margin-left: 6px; }
.search-box:focus-within, .search-box.active { width: 240px; }
.search-box input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13.5px; }
.search-box .icon { width: 15px; height: 15px; color: var(--text-muted); }
.tab { padding: 3px 10px; border-radius: 6px; font-weight: 600; font-size: 14.5px; color: var(--text-muted); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: var(--bg-active); color: var(--text-strong); }
.tab.add-friend { background: var(--green); color: #fff; }
.tab.add-friend.active { background: transparent; color: #57d283; }

/* ---------------------------------------------------------- friends */
.friends-body { flex: 1; min-height: 0; }
.friends-list { padding: 16px 20px 16px 30px; }
.list-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin: 8px 0 12px; }
.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(--bg-hover); border-top-color: transparent; }
.friend-row:hover + .friend-row { border-top-color: transparent; }
.friend-names { flex: 1; min-width: 0; }
.fr-name { font-weight: 600; color: var(--text-strong); }
.fr-user { color: var(--text-muted); font-size: 13px; margin-left: 6px; opacity: 0; transition: opacity .15s; }
.friend-row:hover .fr-user { opacity: 1; }
.fr-sub { color: var(--text-muted); font-size: 13px; }
.fr-actions { display: flex; gap: 10px; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-elev); color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: color .15s, background .15s; }
.round-btn .icon { width: 18px; height: 18px; }
.round-btn:hover { color: var(--text-strong); }
.round-btn.danger-hover:hover { color: var(--red); }
.round-btn.success-hover:hover { color: #57d283; }
.round-btn.danger { background: var(--red); color: #fff; }
.round-btn.danger:hover { background: var(--red-hover); }
.round-btn.success { background: var(--green); color: #fff; }
.add-friend-pane { padding: 20px 30px; border-bottom: 1px solid var(--border); }
.add-friend-pane h2 { text-transform: uppercase; font-size: 16px; }
.add-friend-form { display: flex; align-items: center; gap: 12px; background: var(--bg-elev); border: 1px solid rgba(0,0,0,.3); border-radius: 10px; padding: 0 12px; height: 52px; margin: 12px 0 8px; transition: border-color .15s; }
.add-friend-form:focus-within { border-color: var(--accent); }
.add-friend-form.ok { border-color: var(--green); }
.add-friend-form.err { border-color: var(--red); }
.add-friend-form input { flex: 1; background: none; border: 0; outline: none; font-size: 15px; }
.add-friend-form .btn { height: 32px; font-size: 13px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px; gap: 12px; }
.empty-state.small { padding: 30px 16px; }
.empty-art { width: 96px; height: 96px; border-radius: 50%; background: var(--bg-elev); display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.empty-state.small .empty-art { width: 64px; height: 64px; }
.empty-art .icon { width: 44%; height: 44%; }

/* ---------------------------------------------------------- chat */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-col { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.messages-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column-reverse; overflow-anchor: none; }
.messages-inner { display: flex; flex-direction: column; padding-top: 16px; }
.messages-spacer { height: 18px; flex: none; }
.msg-loading { display: flex; justify-content: center; padding: 24px; }
.msg-skeleton { height: 400px; }
.chan-begin { padding: 16px 16px 8px; margin-bottom: 8px; }
.chan-begin h1 { font-size: 30px; font-weight: 800; margin: 10px 0 6px; }
.begin-icon { width: 68px; height: 68px; border-radius: 50%; background: var(--bg-input); display: flex; align-items: center; justify-content: center; color: #fff; }
.begin-icon .icon { width: 40px; height: 40px; }
.jump-present { position: absolute; left: 16px; right: 16px; bottom: 8px; display: flex; align-items: center; justify-content: space-between; background: var(--accent); color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); z-index: 4; animation: pop .15s; }
.jump-present button { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.jump-present .icon { width: 16px; height: 16px; }
.day-divider { display: flex; align-items: center; margin: 16px 16px 8px; font-size: 12px; font-weight: 600; color: var(--text-faint); gap: 8px; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.day-divider.with-new::before, .day-divider.with-new::after { background: var(--red); }
.day-divider.with-new { color: var(--red); }
.new-tag { font-style: normal; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; }
.day-divider + .new-divider { display: none; }
.new-divider { position: relative; height: 1px; background: var(--red); margin: 10px 16px 6px; }
.new-divider span { position: absolute; right: 0; top: -8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 4px; }

.msg { position: relative; padding: 2px 48px 2px 72px; margin-top: 16px; transition: background .08s; }
.msg.grouped { margin-top: 0; }
.msg:hover { background: rgba(0, 0, 0, 0.08); }
.msg.mentioned { background: var(--mention-bg); }
.msg.mentioned::before, .msg.replying::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--mention-bar); }
.msg.replying { background: var(--accent-soft); }
.msg.replying::before { background: var(--accent); }
.msg.pending .msg-content { opacity: .55; }
.msg.failed .md { color: #ff8a8d; }
.msg.flash { animation: flash 2s ease; }
@keyframes flash { 0%, 40% { background: rgba(250, 168, 26, .2); } 100% { background: transparent; } }
.msg-main { position: relative; }
.msg-avatar { position: absolute; left: -56px; top: 2px; cursor: pointer; }
.msg-avatar:active { transform: translateY(1px); }
.msg-header { display: flex; align-items: baseline; gap: 8px; line-height: 1.375; }
.msg-author { font-weight: 600; color: var(--text-strong); cursor: pointer; }
.msg-author:hover { text-decoration: underline; }
.msg-ts { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.msg-gutter-ts { position: absolute; left: -64px; width: 56px; text-align: right; top: 3px; font-size: 10.5px; color: var(--text-faint); opacity: 0; }
.msg:hover .msg-gutter-ts { opacity: 1; }
.msg-content { min-width: 0; }
.msg.system { display: flex; align-items: center; gap: 12px; padding-left: 28px; margin-top: 8px; color: var(--text-muted); font-size: 14.5px; }
.msg.system + .msg.system { margin-top: 2px; }
.sys-icon { color: #57d283; width: 32px; display: flex; justify-content: center; }
.sys-icon .icon { width: 17px; height: 17px; }
.sys-text { flex: none; }
.reply-preview { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin: 2px 0 2px; cursor: pointer; position: relative; min-width: 0; }
.reply-spine { position: absolute; left: -38px; top: 50%; width: 32px; height: 12px; border-left: 2px solid #4e5058; border-top: 2px solid #4e5058; border-top-left-radius: 6px; }
.reply-name { font-weight: 600; color: var(--text); flex: none; }
.reply-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.reply-preview:hover .reply-text { color: var(--text); }

/* markdown */
.md { line-height: 1.375; color: var(--text); word-wrap: break-word; overflow-wrap: anywhere; white-space: normal; }
.md-p { white-space: pre-wrap; }
.md.jumbo .md-p { font-size: 44px; line-height: 1.2; }
.md-code { background: var(--bg-code); border: 1px solid rgba(0,0,0,.35); border-radius: 6px; padding: 8px 10px; margin: 6px 0; font-family: var(--mono); font-size: 13.5px; white-space: pre-wrap; overflow-x: auto; max-width: 100%; }
.md-code code { background: none; padding: 0; font-size: inherit; }
.md-inline-code { font-family: var(--mono); font-size: 0.85em; background: var(--bg-code); padding: 2px 4px; border-radius: 4px; }
.md-quote { margin: 2px 0; padding: 0 0 0 12px; border-left: 4px solid #4e5058; }
.md-link { color: #64b5ff; }
.spoiler { background: #18191c; color: transparent; border-radius: 3px; cursor: pointer; transition: background .15s; }
.spoiler * { visibility: hidden; }
.spoiler:hover { background: #222327; }
.spoiler.shown { background: rgba(255,255,255,.08); color: inherit; cursor: auto; }
.spoiler.shown * { visibility: visible; }
.mention { background: rgba(108, 114, 245, .28); color: var(--mention-text); border-radius: 3px; padding: 0 2px; font-weight: 500; cursor: pointer; transition: background .1s; }
.mention:hover { background: var(--accent); color: #fff; }
.edited { font-size: 10.5px; color: var(--text-faint); }

/* attachments & embeds */
.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; align-items: flex-start; }
.att-image { max-width: min(400px, 100%); border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--bg-elev); }
.att-image img { display: block; width: 100%; height: 100%; max-height: 300px; object-fit: contain; }
.att-video { max-width: min(480px, 100%); max-height: 320px; border-radius: 8px; background: #000; }
.att-file { background: var(--bg-side); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: min(420px, 100%); }
.att-file-row { display: flex; align-items: center; gap: 10px; }
.att-file-icon { color: #9ea3ff; }
.att-file-icon .icon { width: 30px; height: 30px; }
.att-file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-file-meta a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.att-file-meta span { font-size: 12px; color: var(--text-faint); }
.att-dl { color: var(--text-muted); }
.att-file.audio audio { width: 100%; margin-top: 8px; height: 36px; }
.embed { margin-top: 6px; max-width: 432px; background: var(--bg-side); border-left: 4px solid #1e1f22; border-radius: 4px; padding: 8px 14px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.embed-site { font-size: 12px; color: var(--text-muted); }
.embed-title { font-weight: 600; color: #64b5ff; }
.embed-desc { font-size: 13.5px; color: var(--text); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.embed-img { max-width: 100%; max-height: 240px; border-radius: 4px; margin-top: 6px; object-fit: cover; }
.send-failed { color: #ff8a8d; font-size: 12.5px; }

/* reactions */
.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-side); border: 1px solid transparent; transition: border-color .1s, background .1s; }
.reaction:hover { border-color: rgba(255,255,255,.15); }
.reaction.me { background: var(--accent-soft); border-color: var(--accent); }
.r-emoji { font-size: 15px; }
.r-count { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.reaction.me .r-count { color: var(--mention-text); }
.reaction.add { opacity: 0; color: var(--text-muted); }
.reaction.add .icon { width: 16px; height: 16px; }
.msg:hover .reaction.add { opacity: 1; }

/* hover toolbar */
.msg-toolbar { position: absolute; right: 16px; top: -16px; display: none; background: var(--bg-side); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.25); padding: 2px; z-index: 3; }
.msg:hover .msg-toolbar { display: flex; }
.msg.editing .msg-toolbar { display: none; }
.tb-btn { width: 32px; height: 30px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.tb-btn .icon { width: 18px; height: 18px; }
.tb-btn:hover { background: var(--bg-active); color: var(--text-strong); }
.tb-btn.danger:hover { color: var(--red); }
.msg-picker { position: absolute; right: 16px; top: 18px; z-index: 30; }

/* emoji picker */
.emoji-picker { width: 320px; background: var(--bg-elev); border-radius: 10px; box-shadow: var(--shadow); padding: 10px; animation: pop .12s; }
.emoji-search { width: 100%; background: var(--bg-input); border: 1px solid transparent; outline: none; border-radius: 6px; padding: 7px 10px; margin-bottom: 8px; font-size: 13.5px; }
.emoji-search:focus { border-color: var(--accent); }
.emoji-quick { display: flex; gap: 2px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 240px; overflow-y: auto; scrollbar-width: thin; }
.emoji-cell { font-size: 22px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: background .1s, transform .1s; }
.emoji-quick .emoji-cell { flex: 1; }
.emoji-cell:hover { background: var(--bg-active); transform: scale(1.12); }

/* editor */
.msg-editor textarea { width: 100%; resize: none; background: var(--bg-input); border: 0; border-radius: 8px; padding: 10px 12px; outline: none; line-height: 1.375; margin: 4px 0 2px; max-height: 400px; }
.editor-hint { font-size: 12px; color: var(--text-muted); }

/* composer */
.composer-wrap { padding: 0 16px; flex: none; position: relative; }
.composer { background: var(--bg-composer); border-radius: 10px; position: relative; }
.composer.disabled { opacity: .6; }
.composer.has-reply { border-top-left-radius: 0; border-top-right-radius: 0; }
.reply-bar { position: absolute; bottom: 100%; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: var(--bg-reply); border-radius: 10px 10px 0 0; font-size: 13.5px; color: var(--text-muted); }
.reply-bar strong { color: var(--text); }
.composer-row { display: flex; align-items: flex-start; gap: 4px; padding: 0 8px 0 4px; }
.composer textarea { flex: 1; resize: none; background: none; border: 0; outline: none; padding: 12px 6px; line-height: 1.375; max-height: 50vh; min-height: 46px; }
.composer textarea::placeholder { color: var(--text-faint); }
.composer-btn { width: 40px; height: 46px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex: none; }
.composer-btn:hover { color: var(--text-strong); }
.composer-btn.upload .icon { background: var(--text-muted); color: var(--bg-composer); border-radius: 50%; padding: 2px; width: 22px; height: 22px; stroke-width: 3; }
.composer-btn.upload:hover .icon { background: var(--text-strong); }
.composer-btn .icon { width: 22px; height: 22px; }
.composer-picker { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; }
.composer-foot { height: 24px; display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); padding: 0 4px; }
.typing { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.typing strong { color: var(--text); }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text); animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.composer-meta { display: flex; gap: 10px; align-items: center; }
.uploading { display: flex; gap: 6px; align-items: center; }
.uploading .spinner { width: 12px; height: 12px; border-width: 2px; }
.slowmode { display: flex; gap: 4px; align-items: center; }
.slowmode .icon { width: 14px; height: 14px; }
.char-count.over { color: var(--red); font-weight: 700; }
.upload-previews { display: flex; gap: 10px; padding: 16px 12px 8px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.upload-card { position: relative; width: 180px; flex: none; background: var(--bg-side); border-radius: 8px; padding: 8px; }
.uc-thumb { height: 120px; border-radius: 6px; background: var(--bg-elev); display: flex; align-items: center; justify-content: center; overflow: hidden; color: #9ea3ff; }
.uc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.uc-thumb .icon { width: 48px; height: 48px; }
.uc-name { font-size: 13px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-size { font-size: 11px; color: var(--text-faint); }
.uc-remove { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 6px; background: var(--bg-side); box-shadow: var(--shadow); color: var(--red); display: flex; align-items: center; justify-content: center; }
.uc-remove .icon { width: 16px; height: 16px; }
.autocomplete { position: absolute; left: 16px; right: 16px; bottom: calc(100% + 4px); background: var(--bg-side); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; z-index: 20; animation: pop .1s; }
.ac-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ac-item.sel { background: var(--bg-active); }
.ac-item .icon { width: 16px; height: 16px; color: var(--text-muted); }
.ac-name { font-weight: 500; color: var(--text-strong); }
.ac-sub { color: var(--text-muted); font-size: 13px; margin-left: auto; }
.ac-role { font-weight: 600; }
.ac-emoji { font-size: 20px; }
.drop-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 40; pointer-events: none; animation: pop .1s; }
.drop-card { background: var(--accent); border-radius: 14px; padding: 24px 40px; text-align: center; color: #fff; box-shadow: var(--shadow); outline: 2px dashed rgba(255,255,255,.6); outline-offset: -10px; }
.drop-icon .icon { width: 48px; height: 48px; margin: 0 auto 8px; }

/* pins & search */
.pins-pop { right: 0; top: 40px; width: 420px; padding: 0; overflow: hidden; }
.pins-pop .pop-title { padding: 14px 16px; margin: 0; background: var(--bg-side); }
.pins-list { max-height: 60vh; padding: 8px; }
.mini-msg { position: relative; background: var(--bg-main); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; border: 1px solid transparent; }
.mini-msg:hover { border-color: var(--border); }
.mini { display: flex; gap: 10px; }
.mini-body { flex: 1; min-width: 0; }
.mini-att { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-muted); }
.mini-att .icon { width: 14px; height: 14px; }
.mini-x { position: absolute; top: 6px; right: 6px; opacity: 0; }
.mini-msg:hover .mini-x { opacity: 1; }
.jump-tag { position: absolute; top: 8px; right: 8px; font-size: 11px; background: var(--bg-side); padding: 2px 8px; border-radius: 4px; opacity: 0; }
.mini-msg:hover .jump-tag { opacity: 1; }
.search-panel { width: 420px; flex: none; background: var(--bg-side); display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.search-head { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; font-weight: 700; color: var(--text-strong); border-bottom: 1px solid var(--border); }
.search-results { flex: 1; padding: 8px 12px; }
.hit-channel { font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 8px 0 4px; }

/* member list */
.member-list { width: 240px; flex: none; background: var(--bg-side); padding: 8px 8px 20px; }
.ml-group { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); padding: 18px 8px 4px; }
.member-item { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px; border-radius: 6px; cursor: pointer; }
.member-item:hover { background: var(--bg-hover); }
.member-item.offline { opacity: .35; }
.member-item.offline:hover { opacity: 1; }
.mi-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mi-name-row { display: flex; align-items: center; gap: 4px; }
.mi-name { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crown { color: #f0b232; display: inline-flex; }
.crown .icon { width: 14px; height: 14px; }
.mi-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-sub.live { color: #9ea3ff; font-weight: 600; }

/* profile popout */
.popout { position: fixed; z-index: 90; animation: pop .12s ease; }
.profile-card { width: 320px; background: var(--bg-elev); border-radius: 12px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.5); max-height: calc(100vh - 16px); overflow-y: auto; scrollbar-width: thin; }
.pc-banner { height: 72px; position: relative; display: flex; justify-content: flex-end; padding: 8px; }
.pc-banner .icon-btn { background: rgba(0,0,0,.35); color: #fff; border-radius: 50%; }
.pc-avatar { position: absolute; margin-top: -44px; margin-left: 16px; padding: 5px; background: var(--bg-elev); border-radius: 50%; }
.pc-avatar .status-dot { border-color: var(--bg-elev); border-width: 4px; }
.pc-body { padding: 48px 16px 16px; }
.pc-names { background: var(--bg-side); border-radius: 8px; padding: 12px; }
.pc-display { font-size: 20px; font-weight: 700; color: var(--text-strong); }
.pc-username { font-size: 14px; color: var(--text-muted); }
.pc-custom { font-size: 13.5px; margin-top: 6px; }
.pc-divider { height: 0; }
.pc-section { background: var(--bg-side); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.pc-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-strong); margin-bottom: 6px; }
.pc-bio { font-size: 13.5px; white-space: pre-wrap; }
.pc-since { font-size: 13.5px; }
.role-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-elev); border-radius: 5px; padding: 3px 7px; font-size: 12.5px; font-weight: 500; }
.role-chip.add { padding: 3px 4px; color: var(--text-muted); }
.role-chip.add .icon { width: 14px; height: 14px; }
.role-chip.add:hover { color: var(--text-strong); }
.role-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; cursor: default; position: relative; }
.role-x { opacity: 0; color: #000; display: flex; }
.role-x .icon { width: 10px; height: 10px; stroke-width: 3; }
.role-chip:hover .role-x { opacity: 1; cursor: pointer; }
.role-add-anchor { position: relative; }
.role-add-menu { top: 26px; left: 0; max-height: 240px; overflow-y: auto; }
.role-add-menu .dd-item { justify-content: flex-start; }
.mod-actions { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.pc-act { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 4px; font-size: 14px; text-align: left; }
.pc-act .icon { width: 17px; height: 17px; }
.pc-act:hover { background: var(--accent); color: #fff; }
.pc-act.danger { color: #ff7b7e; }
.pc-act.danger:hover { background: var(--red); color: #fff; }
.nick-edit { display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.pc-message { margin-top: 12px; border: 1px solid var(--border) !important; }
.profile-card .btn-block { margin-top: 12px; }

/* ---------------------------------------------------------- calls */
.call-page { flex: 1; min-height: 0; display: flex; }
.call-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #0f1013; }
.call-header { background: #0f1013; border-bottom-color: rgba(255,255,255,.04); }
.call-chat { width: 420px; flex: none; display: flex; border-left: 1px solid var(--border); }
.call-chat .chat { width: 100%; }
.call-chat .member-list { display: none; }
.call-lobby { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.lobby-avatars { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); grid-auto-rows: minmax(160px, 1fr); align-content: center; overflow-y: auto; }
.call-grid.n1 { grid-template-columns: minmax(0, 960px); justify-content: center; }
.call-grid.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-grid.compact { grid-auto-rows: 180px; grid-template-columns: repeat(auto-fit, minmax(240px, 320px)); justify-content: center; max-height: 46vh; flex: none; }
.call-grid.focused-mode { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 110px; grid-template-rows: minmax(0, 1fr); align-content: stretch; }
.call-grid.focused-mode .tile.focused { grid-column: 1 / -1; grid-row: 1; }
.call-grid.compact.focused-mode { max-height: 70vh; grid-template-rows: 360px; }
.tile { position: relative; border-radius: 10px; overflow: hidden; background: var(--tile-bg, #2b2d31); background: color-mix(in srgb, var(--tile-bg, #2b2d31) 55%, #1a1b1e); display: flex; align-items: center; justify-content: center; cursor: pointer; min-height: 0; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .12s; }
.tile.speaking { outline-color: #3ba55d; }
.tile.screen { background: #000; }
.tile-avatar .avatar.speaking .av-clip { box-shadow: 0 0 0 3px #3ba55d; }
.tile-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile:not(.screen) .tile-video { object-fit: cover; }
.tile-video.mirror { transform: scaleX(-1); }
.tile-label { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); color: #fff; font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 6px; max-width: calc(100% - 16px); }
.tile-ic { color: #ff7b7e; display: flex; }
.tile-ic .icon { width: 14px; height: 14px; }
.tile-fs, .tile-stop { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.tile-stop { right: 44px; }
.tile:hover .tile-fs, .tile:hover .tile-stop { opacity: 1; }
.tile-fs .icon, .tile-stop .icon { width: 16px; height: 16px; }
.stream-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.call-controls { flex: none; display: flex; justify-content: center; gap: 12px; padding: 12px 0 18px; }
.call-controls .round-btn { width: 52px; height: 52px; background: #2b2d31; color: var(--text); }
.call-controls .round-btn .icon { width: 22px; height: 22px; }
.call-controls .round-btn:hover { background: #3a3c42; }
.call-controls .round-btn.off { background: #fff; color: #111; }
.call-controls .round-btn.danger-on { color: var(--red); }
.call-controls .round-btn.danger { background: var(--red); color: #fff; }
.call-controls .round-btn.danger:hover { background: var(--red-hover); }
.dm-call { background: #0f1013; display: flex; flex-direction: column; flex: none; border-bottom: 1px solid var(--border); }
.dm-call-idle { display: flex; flex-direction: column; align-items: center; padding: 20px; gap: 6px; }
.ring-modal { position: fixed; left: 50%; top: 80px; transform: translateX(-50%); width: 260px; background: var(--bg-elev); border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.6); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 95; animation: pop .2s; }
.ring-avatar .avatar { animation: ring 1.6s ease-in-out infinite; border-radius: 50%; }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 rgba(59,165,93,.6); } 50% { box-shadow: 0 0 0 14px rgba(59,165,93,0); } }
.ring-title { font-size: 18px; font-weight: 700; color: var(--text-strong); margin-top: 8px; text-align: center; }
.ring-actions { display: flex; gap: 28px; margin-top: 14px; }
.ring-actions .round-btn { width: 52px; height: 52px; }

/* ---------------------------------------------------------- modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-wrap { max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); display: flex; }
.modal { width: 460px; max-width: 100%; background: var(--bg-modal); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); display: flex; flex-direction: column; max-height: calc(100vh - 32px); animation: pop .18s ease; }
.modal.small { width: 420px; }
.modal-head { padding: 22px 22px 8px; }
.modal-head.center p { text-align: center; }
.modal-body { padding: 8px 22px 16px; overflow-y: auto; }
.modal-foot { background: var(--bg-modal-foot); padding: 14px 18px; border-radius: 0 0 12px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.modal-foot > :only-child { margin-left: auto; }
.image-viewer { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.image-viewer img { max-width: 90vw; max-height: 82vh; border-radius: 6px; box-shadow: var(--shadow); }
.open-original { color: #ccc; font-size: 14px; }
.type-options { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 18px; }
.type-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg-input); cursor: pointer; transition: background .12s; }
.type-opt:hover, .type-opt.on { background: var(--bg-active); }
.to-icon { color: var(--text-muted); }
.to-icon .icon { width: 24px; height: 24px; }
.to-name { font-weight: 600; color: var(--text-strong); }
.type-opt > div { flex: 1; }
.input-icon { display: flex; align-items: center; gap: 6px; background: var(--bg-input); border-radius: 6px; padding-left: 10px; }
.input-icon .icon { width: 17px; height: 17px; color: var(--text-muted); }
.input-icon input { background: none !important; padding-left: 4px !important; }
.copy-row { display: flex; gap: 8px; background: var(--bg-input); border-radius: 8px; padding: 4px; border: 1px solid transparent; margin: 8px 0; }
.copy-row.copied { border-color: var(--green); }
.copy-row.copied .btn { background: var(--green); }
.copy-row input { flex: 1; background: none; border: 0; outline: none; padding: 0 8px; }
.invite-settings { margin-top: 12px; padding: 12px; background: var(--bg-input); border-radius: 8px; }
.pick-list { max-height: 300px; margin: 0 -8px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pick-row:hover, .pick-row.on { background: var(--bg-hover); }
.pick-name { font-weight: 500; }
.pick-row input { margin-left: auto; accent-color: var(--accent); width: 18px; height: 18px; }
.image-upload { width: 88px; height: 88px; border-radius: 16px; background: var(--bg-input); position: relative; overflow: hidden; cursor: pointer; display: flex; align-items: center; justify-content: center; border: 2px dashed rgba(255,255,255,.2); flex: none; }
.image-upload.round { border-radius: 50%; }
.image-upload img { width: 100%; height: 100%; object-fit: cover; }
.iu-fallback { font-weight: 700; font-size: 26px; color: var(--text-muted); }
.iu-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; text-align: center; padding: 4px; }
.image-upload:hover .iu-overlay { opacity: 1; }

/* settings (full-screen) */
.settings-layer { position: fixed; inset: 0; z-index: 100; background: var(--bg-main); animation: settings-in .2s ease; }
@keyframes settings-in { from { opacity: 0; transform: scale(1.03); } }
.settings { display: flex; height: 100%; }
.settings-nav { flex: 1 0 220px; background: var(--bg-side); display: flex; justify-content: flex-end; overflow-y: auto; }
.nav-inner { width: 220px; padding: 60px 8px 20px 20px; }
.nav-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 6px 10px; margin-top: 8px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 7px 10px; border-radius: 6px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; text-align: left; }
.nav-item .icon { width: 16px; height: 16px; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text-strong); }
.nav-item.danger { color: #ff7b7e; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 10px; }
.settings-content { flex: 1 1 800px; position: relative; overflow-y: auto; }
.content-inner { max-width: 740px; padding: 60px 40px 120px; }
.settings-close { position: absolute; top: 60px; right: 40px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.close-circle { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--text-muted); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.close-circle:hover { background: var(--bg-hover); color: var(--text-strong); border-color: var(--text-strong); }
.save-bar { position: sticky; bottom: 20px; margin-top: 24px; display: flex; align-items: center; gap: 12px; background: var(--bg-elev); padding: 10px 10px 10px 16px; border-radius: 8px; box-shadow: var(--shadow); animation: slide-up .2s; z-index: 5; }
.save-bar span { flex: 1; font-weight: 500; }
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } }
.account-card { background: var(--bg-elev); border-radius: 10px; overflow: hidden; margin-top: 16px; }
.ac-banner { height: 100px; }
.ac-row { display: flex; align-items: flex-end; gap: 16px; padding: 0 16px; margin-top: -44px; }
.ac-avatar .image-upload { width: 92px; height: 92px; border: 6px solid var(--bg-elev); background: var(--bg-input); }
.ac-names { flex: 1; padding-bottom: 8px; }
.ac-fields { padding: 16px; margin: 16px; background: var(--bg-side); border-radius: 8px; }
.color-row { display: flex; align-items: center; gap: 12px; }
.color-row input[type=color] { width: 64px; height: 40px; border: 0; background: none; padding: 0; cursor: pointer; }
.pw-form { max-width: 420px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin-top: 16px; }
.mic-test { display: flex; align-items: center; gap: 14px; margin: 8px 0; }
.meter { flex: 1; height: 10px; border-radius: 5px; background: var(--bg-input); position: relative; overflow: hidden; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #f0b232; border-radius: 5px; transition: width .05s linear; }
.meter-fill.open { background: #3ba55d; }
.meter-thresh { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; }
.meter-db { width: 60px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.key-capture { background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; text-align: left; font-family: var(--mono); min-width: 200px; }
.key-capture.capturing { border-color: var(--red); color: #ff8a8d; animation: pulse 1s infinite; }
.overview-row { display: flex; gap: 24px; align-items: center; margin-top: 16px; }
.roles-layout { display: flex; gap: 20px; margin-top: 16px; align-items: flex-start; }
.roles-list { width: 230px; flex: none; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.roles-list > .btn { margin-bottom: 10px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.role-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.role-row:hover { background: var(--bg-hover); }
.role-row.active { background: var(--bg-active); }
.role-row .icon { width: 14px; height: 14px; color: var(--text-muted); }
.role-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.role-move { display: none; gap: 0; }
.role-row:hover .role-move { display: flex; }
.role-move .icon-btn { font-size: 9px; width: 18px; }
.role-editor { flex: 1; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 6px; border: 2px solid transparent; color: #fff; font-size: 14px; }
.swatch.on { border-color: #fff; }
.swatch-custom { width: 44px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; }
.perm-row { padding: 14px 0; }
.add-target { top: 28px; right: 0; max-height: 320px; overflow-y: auto; width: 240px; }
.add-target .dd-item { justify-content: flex-start; }
.tristate { display: flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); flex: none; }
.ts { width: 34px; height: 30px; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-weight: 700; }
.ts .icon { width: 16px; height: 16px; stroke-width: 3; }
.ts + .ts { border-left: 1px solid var(--border); }
.ts:hover { background: var(--bg-hover); }
.ts.deny.on { background: var(--red); color: #fff; }
.ts.neutral.on { background: #4e5058; color: #fff; }
.ts.allow.on { background: var(--green); color: #fff; }
.member-table { display: flex; flex-direction: column; }
.mt-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.mt-names { width: 180px; min-width: 0; }
.mt-name { font-weight: 600; display: flex; align-items: center; gap: 4px; }
.mt-roles { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.mt-actions { display: flex; gap: 6px; }
.mt-role-editor { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 12px; padding: 8px 12px 12px 48px; background: var(--bg-side); border-radius: 0 0 8px 8px; }
.table { display: flex; flex-direction: column; margin-top: 16px; }
.t-head, .t-row { display: grid; grid-template-columns: 1.4fr 1fr .6fr 1.6fr 40px; gap: 8px; align-items: center; padding: 8px 4px; }
.t-head { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.t-row { border-bottom: 1px solid var(--border); font-size: 14px; }
.t-row:hover { background: var(--bg-hover); }

/* toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toast { background: var(--bg-elev); color: var(--text-strong); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: slide-up .2s; max-width: 520px; border-left: 4px solid var(--green); }
.toast.error { border-left-color: var(--red); }

@media (max-width: 1100px) {
  .member-list { display: none; }
  .search-panel { width: 320px; }
}
@media (max-width: 760px) {
  .sidebar { width: 200px; }
  .call-chat { display: none; }
  .settings-nav { flex-basis: 180px; }
}

/* refinements */
.vp-state { white-space: nowrap; }
.vp-state span:first-of-type { overflow: hidden; text-overflow: ellipsis; }
.composer-wrap:has(.composer.has-reply) .autocomplete { bottom: calc(100% + 40px); }
.call-grid.n1:not(.focused-mode) { grid-template-columns: minmax(0, min(960px, calc((100vh - 220px) * 16 / 9))); grid-auto-rows: auto; }
.call-grid.n1:not(.focused-mode) .tile { aspect-ratio: 16 / 9; }
.call-grid.n2:not(.focused-mode) .tile, .call-grid.n3:not(.focused-mode) .tile, .call-grid.n4:not(.focused-mode) .tile { aspect-ratio: 16 / 9; }
.call-grid.n2:not(.focused-mode), .call-grid.n3:not(.focused-mode), .call-grid.n4:not(.focused-mode) { grid-auto-rows: auto; }
.tile { background: color-mix(in srgb, var(--tile-bg, #2b2d31) 30%, #1d1e22); }
.tile.screen { background: #000; }
.call-grid.compact:not(.focused-mode) { grid-template-columns: repeat(auto-fit, minmax(220px, 300px)); grid-auto-rows: 170px; }
.call-grid.compact:not(.focused-mode) .tile { aspect-ratio: auto; }
.dm-call .call-controls { padding: 4px 0 14px; }
.screen-menu select.stream-audio { width: 100%; margin-bottom: 12px; }

/* channel drag & drop */
.channel-row.dragging, .category.dragging { opacity: .4; }
.channel-row.drop-before, .category.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.channel-row.drop-after, .category.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.category.drop-before, .category.drop-after { background: var(--accent-soft); border-radius: 4px; }
.header-title.editable { cursor: text; border-radius: 4px; padding: 2px 4px; margin: -2px -4px; }
.header-title.editable:hover { background: var(--bg-input); }
.header-rename { background: var(--bg-input); border: 1px solid var(--accent); border-radius: 4px; padding: 3px 6px; font-weight: 700; outline: none; width: 220px; }
.mi-remove { margin-left: auto; opacity: 0; }
.member-item:hover .mi-remove { opacity: 1; }
.transfer-row { display: flex; gap: 12px; align-items: center; }
.transfer-row select { flex: 1; background: var(--bg-input); border: 1px solid transparent; border-radius: 6px; padding: 10px 12px; }

/* ---------------------------------------------------------- appearance */
:root[data-theme="darker"] {
  --bg-rail: #0d0e10; --bg-side: #141518; --bg-main: #1a1b1e; --bg-elev: #0b0c0e; --bg-input: #101114;
  --bg-modal: #1a1b1e; --bg-panel: #101114; --bg-composer: #24252a; --bg-code: #0e0f11; --bg-reply: #141518; --bg-modal-foot: #121316;
}
:root[data-theme="light"] {
  --bg-rail: #e3e5e8; --bg-side: #f2f3f5; --bg-main: #ffffff; --bg-elev: #ffffff; --bg-input: #e3e5e8;
  --bg-hover: rgba(6, 6, 7, 0.04); --bg-active: rgba(6, 6, 7, 0.08); --bg-modal: #ffffff; --border: rgba(6, 6, 7, 0.08);
  --text: #2e3338; --text-strong: #060607; --text-muted: #5c5e66; --text-faint: #80848e;
  --bg-panel: #ebedef; --bg-composer: #ebedef; --bg-code: #f2f3f5; --bg-reply: #e3e5e8; --bg-modal-foot: #f2f3f5;
  --mention-text: #4752c4; --mention-bg: rgba(250, 168, 26, 0.12);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
  color-scheme: light;
}
:root[data-theme="light"] .msg:hover { background: rgba(6, 6, 7, 0.03); }
:root[data-theme="light"] .spoiler { background: #c4c6cc; }
:root[data-theme="light"] .md-quote { border-left-color: #c4c6cc; }
:root[data-theme="light"] .reply-spine { border-color: #c4c6cc; }
:root[data-theme="light"] .status-dot { border-color: var(--bg-side); }
:root[data-theme="light"] .md-link, :root[data-theme="light"] .embed-title { color: #006ce7; }
:root[data-theme="light"] .mention { background: rgba(88, 101, 242, .15); }
:root[data-theme="light"] .chat-header, :root[data-theme="light"] .sidebar-header { border-bottom-color: rgba(0,0,0,.08); }
:root[data-theme="light"] .round-btn { background: var(--bg-side); }
:root[data-theme="light"] .attachments .att-file, :root[data-theme="light"] .embed { background: var(--bg-side); }

/* font scale */
.messages-inner, .composer textarea, .msg-editor textarea { font-size: calc(15px * var(--font-scale)); }
.msg-ts, .msg-gutter-ts { font-size: calc(11.5px * var(--font-scale)); }

/* compact message density */
:root[data-density="compact"] .msg { margin-top: 2px; padding-left: 16px; padding-top: 1px; padding-bottom: 1px; }
:root[data-density="compact"] .msg.grouped { padding-left: 16px; }
:root[data-density="compact"] .msg-avatar, :root[data-density="compact"] .msg-gutter-ts { display: none; }
:root[data-density="compact"] .msg-header { float: left; margin-right: 8px; flex-direction: row-reverse; }
:root[data-density="compact"] .msg.system { margin-top: 2px; padding-left: 8px; }
:root[data-density="compact"] .reply-spine { display: none; }
:root[data-density="compact"] .day-divider { margin: 8px 16px 4px; }
:root[data-density="compact"] .attachments, :root[data-density="compact"] .reactions { clear: both; }

.appearance-preview { border-radius: 10px; background: var(--bg-main); border: 1px solid var(--border); padding: 12px 0; margin: 8px 0 24px; pointer-events: none; }
.theme-options { display: flex; gap: 16px; margin: 8px 0 20px; }
.theme-swatch { width: 72px; height: 72px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.theme-swatch.on { border-color: var(--accent); }
.theme-swatch .icon { color: var(--accent); width: 26px; height: 26px; }
.theme-label { text-align: center; font-size: 13px; margin-top: 6px; color: var(--text-muted); }
.drop-zone { margin: 4px 0; padding: 8px; border: 2px dashed var(--border); border-radius: 6px; color: var(--text-muted); font-size: 12px; text-align: center; }
.drop-zone.over { border-color: var(--accent); color: var(--text-strong); background: var(--accent-soft); }
.modal-backdrop.overlay { z-index: 150; }
.sound-list { display: flex; flex-direction: column; gap: 2px; }
.sound-row { padding: 6px 0; gap: 10px; }
.sound-row .tr-title { flex: 1; }
.sound-play { width: 28px; height: 28px; font-size: 11px; border-radius: 50%; background: var(--bg-tertiary, rgba(0,0,0,.25)); }
.mic-test-hint { margin: -2px 0 8px; }
