/* Trixie Messenger web client */
:root {
  --accent: #8b5cf6;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-strong: color-mix(in srgb, var(--accent) 80%, #fff);
  --danger: #f43f5e;
  --warn: #f59e0b;
  --ok: #22c55e;
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, ui-monospace, monospace;
  font-size: 15px;
}
:root.fs-small { font-size: 13.5px; }
:root.fs-large { font-size: 17px; }

[data-theme="dark"] {
  --bg-0: #0f1117; --bg-1: #151821; --bg-2: #1b1f2a; --bg-3: #242938; --bg-hover: #2a3042;
  --line: #2b3142; --text: #e6e8ef; --text-2: #a3a9bb; --text-3: #6f768a; --shadow: 0 12px 40px rgba(0,0,0,.45);
  color-scheme: dark;
}
[data-theme="midnight"] {
  --bg-0: #000; --bg-1: #07080c; --bg-2: #0c0e14; --bg-3: #141722; --bg-hover: #1a1e2b;
  --line: #1c2030; --text: #e9ebf3; --text-2: #9aa1b5; --text-3: #616881; --shadow: 0 12px 40px rgba(0,0,0,.7);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg-0: #e9ebf1; --bg-1: #f2f3f7; --bg-2: #ffffff; --bg-3: #eef0f5; --bg-hover: #e6e8ef;
  --line: #dcdfe8; --text: #1b1e27; --text-2: #4e5568; --text-3: #8a90a2; --shadow: 0 12px 40px rgba(20,24,40,.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg-0); color: var(--text); font-family: var(--font); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-3); }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: .85em; }

/* ---------- buttons & inputs ---------- */
.btn { border: 0; border-radius: 8px; padding: .55em 1em; background: var(--bg-3); cursor: pointer; font-weight: 600; transition: background .12s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn.danger { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.sm { padding: .3em .7em; font-size: .85em; }
.icon-btn { border: 0; background: transparent; color: var(--text-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; font-size: 1.05em; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.active { color: var(--accent-strong); }
.input, select.input, textarea.input { width: 100%; padding: .6em .8em; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-1); outline: none; transition: border-color .12s, box-shadow .12s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: block; margin-bottom: .9em; }
label.field > span { display: block; font-size: .78em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); margin-bottom: .35em; }
.check { display: flex; align-items: center; gap: .6em; cursor: pointer; margin: .4em 0; }
.check input { width: 1.1em; height: 1.1em; accent-color: var(--accent); }
.error-text { color: var(--danger); font-size: .9em; min-height: 1.2em; margin: .3em 0; }
.row { display: flex; gap: .6em; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%), var(--bg-0); }
.auth-card { width: min(440px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 .1em; font-size: 1.6em; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand img { width: 52px; height: 52px; border-radius: 50%; }
.motd { background: var(--bg-1); border-left: 3px solid var(--accent); padding: .6em .8em; border-radius: 6px; color: var(--text-2); margin: 0 0 1.2em; white-space: pre-wrap; font-size: .92em; }
.auth-switch { margin-top: 1em; text-align: center; font-size: .9em; color: var(--text-2); }
.linkish { background: none; border: 0; color: var(--accent-strong); cursor: pointer; padding: 0; font-weight: 600; }
.linkish:hover { text-decoration: underline; }

/* ---------- app layout ---------- */
.app { display: grid; grid-template-columns: 260px 1fr auto; height: 100vh; overflow: hidden; }
.sidebar { background: var(--bg-1); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.server-head { padding: 14px 14px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.server-head .logo { width: 36px; height: 36px; flex: none; border-radius: 50%; }
.server-head .name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-head .sub { font-size: .75em; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.lock-badge { color: var(--ok); }
.chan-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.section-title { display: flex; align-items: center; padding: 14px 8px 4px; font-size: .72em; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.section-title .icon-btn { width: 22px; height: 22px; font-size: 1.1em; }
.chan { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; color: var(--text-2); cursor: pointer; user-select: none; position: relative; }
.chan:hover { background: var(--bg-hover); color: var(--text); }
.chan.active { background: var(--accent-soft); color: var(--text); }
.chan.unread { color: var(--text); font-weight: 700; }
.chan .glyph { width: 18px; text-align: center; color: var(--text-3); flex: none; }
.chan .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.badge { background: var(--danger); color: #fff; font-size: .7em; font-weight: 800; border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center; }
.me-bar { border-top: 1px solid var(--line); padding: 10px; display: flex; align-items: center; gap: 10px; background: var(--bg-0); }
.me-bar .who { flex: 1; min-width: 0; }
.me-bar .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; position: relative; font-size: .85em; text-transform: uppercase; }
.avatar.sm { width: 24px; height: 24px; font-size: .65em; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.4em; }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--bg-1); background: var(--text-3); }
.avatar .dot.on { background: var(--ok); }
.avatar.sm .dot { width: 10px; height: 10px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-2); }
.chan-header { height: 54px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 12px 0 18px; flex: none; }
.chan-header .title { font-weight: 800; font-size: 1.05em; white-space: nowrap; }
.chan-header .topic { color: var(--text-2); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; border-left: 1px solid var(--line); padding-left: 10px; }
.banner { background: color-mix(in srgb, var(--warn) 20%, var(--bg-2)); color: var(--text); padding: 8px 18px; font-size: .9em; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }
.banner.err { background: color-mix(in srgb, var(--danger) 22%, var(--bg-2)); }

.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; min-height: 0; }
.chan-intro { padding: 16px 20px 20px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.chan-intro h2 { margin: 6px 0 4px; }
.chan-intro .big { width: 56px; height: 56px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; font-size: 1.8em; color: var(--text-2); }
.day-sep { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: .75em; font-weight: 700; margin: 14px 20px 6px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { display: grid; grid-template-columns: 40px 1fr; gap: 0 14px; padding: 3px 20px; position: relative; }
.msg.first { margin-top: 12px; }
.msg:hover { background: color-mix(in srgb, var(--bg-hover) 45%, transparent); }
.msg.mention { background: color-mix(in srgb, var(--warn) 9%, transparent); box-shadow: inset 3px 0 0 var(--warn); }
.msg .gutter { color: var(--text-3); font-size: .68em; text-align: right; padding-top: .35em; opacity: 0; }
.msg:hover .gutter { opacity: 1; }
.msg .avatar { width: 40px; height: 40px; cursor: pointer; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; }
.msg .author { font-weight: 700; cursor: pointer; }
.msg .author:hover { text-decoration: underline; }
.msg .time { color: var(--text-3); font-size: .75em; }
.msg .body { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg .edited { color: var(--text-3); font-size: .72em; margin-left: 4px; }
.msg .body code { font-family: var(--mono); background: var(--bg-3); padding: .1em .35em; border-radius: 5px; font-size: .88em; }
.msg .body pre { background: var(--bg-1); border: 1px solid var(--line); border-radius: 8px; padding: .7em .9em; overflow-x: auto; margin: .3em 0; white-space: pre; }
.msg .body pre code { background: none; padding: 0; }
.msg .body blockquote { margin: .2em 0; padding-left: .8em; border-left: 3px solid var(--line); color: var(--text-2); }
.mention-tag { background: var(--accent-soft); color: var(--accent-strong); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.msg-actions { position: absolute; right: 16px; top: -14px; display: none; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 2px; }
.msg:hover .msg-actions { display: flex; }
.msg-actions .icon-btn { width: 30px; height: 28px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { border: 1px solid var(--line); background: var(--bg-1); border-radius: 8px; padding: 1px 8px; font-size: .85em; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.reaction.mine { border-color: var(--accent); background: var(--accent-soft); }
.reaction:hover { border-color: var(--text-3); }
:root.compact .msg { grid-template-columns: 52px 1fr; padding-top: 1px; padding-bottom: 1px; }
:root.compact .msg.first { margin-top: 4px; }
:root.compact .msg .avatar { display: none; }
:root.compact .msg .gutter { opacity: 1; }
:root.compact .msg .meta { display: inline-flex; margin-right: 6px; }
:root.compact .msg .content { display: block; }
:root.compact .msg .body { display: inline; }
.edit-box textarea { width: 100%; }
.load-more { text-align: center; padding: 6px; }

.composer-wrap { padding: 0 18px 6px; flex: none; position: relative; }
.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--bg-3); border-radius: 12px; padding: 8px 8px 8px 14px; border: 1px solid transparent; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.composer textarea { flex: 1; background: transparent; border: 0; outline: none; resize: none; max-height: 40vh; min-height: 1.45em; padding: 4px 0; }
.composer.disabled { opacity: .6; }
.typing { height: 20px; font-size: .78em; color: var(--text-2); padding: 2px 4px; }
.typing b { color: var(--text); }
.char-count { font-size: .72em; color: var(--text-3); align-self: center; }
.char-count.over { color: var(--danger); }
.autocomplete { position: absolute; bottom: 100%; left: 18px; right: 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; max-height: 240px; overflow-y: auto; z-index: 5; }
.autocomplete .opt { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.autocomplete .opt.sel, .autocomplete .opt:hover { background: var(--accent-soft); }

.members { width: 240px; background: var(--bg-1); border-left: 1px solid var(--line); overflow-y: auto; padding: 8px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.member:hover { background: var(--bg-hover); }
.member.offline { opacity: .5; }
.member .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.empty-main { flex: 1; display: grid; place-items: center; color: var(--text-3); text-align: center; padding: 20px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4,6,12,.62); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .14s ease-out; }
.modal.wide { width: min(1040px, 100%); height: min(760px, calc(100vh - 40px)); }
.modal-head { display: flex; align-items: center; padding: 16px 18px 10px; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 1.15em; flex: 1; }
.modal-body { padding: 4px 18px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg-1); border-radius: 0 0 16px 16px; }

.tabs-layout { display: grid; grid-template-columns: 210px 1fr; flex: 1; min-height: 0; }
.tabs-nav { background: var(--bg-1); padding: 10px; border-right: 1px solid var(--line); overflow-y: auto; border-bottom-left-radius: 16px; }
.tabs-nav .tab { padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 600; margin-bottom: 2px; }
.tabs-nav .tab:hover { background: var(--bg-hover); color: var(--text); }
.tabs-nav .tab.active { background: var(--accent-soft); color: var(--text); }
.tabs-nav .grp { font-size: .7em; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 12px 10px 4px; }
.tab-pane { padding: 18px 22px; overflow-y: auto; }
.tab-pane h4 { margin: 0 0 .3em; font-size: 1.15em; }
.tab-pane .lead { color: var(--text-2); margin: 0 0 1.2em; font-size: .92em; }
.setting-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting-row .lbl { flex: 1; }
.setting-row .ctl { width: 220px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.setting-row .ctl .input { width: 100%; }
.setting-row.locked .lbl::after { content: " 🔒"; }
.setting-row .note { font-size: .78em; color: var(--text-3); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--bg-3); border-radius: 22px; cursor: pointer; transition: .15s; border: 1px solid var(--line); }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

table.grid { width: 100%; border-collapse: collapse; font-size: .92em; }
table.grid th { text-align: left; color: var(--text-3); font-size: .75em; text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-2); }
table.grid td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:hover td { background: color-mix(in srgb, var(--bg-hover) 40%, transparent); }
.pill { display: inline-block; border-radius: 20px; padding: 1px 9px; font-size: .78em; font-weight: 700; border: 1px solid currentColor; }
.role-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.perm-list .perm { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.perm-list .perm .d { font-size: .82em; color: var(--text-3); }
.list-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.list-item:hover { background: var(--bg-hover); }

/* ---------- popover / toast ---------- */
.popover { position: fixed; z-index: 60; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; animation: pop .1s ease-out; }
.profile-card { width: 280px; }
.profile-card .top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
#toasts { position: fixed; bottom: calc(var(--composer-h, 0px) + 22px); right: 18px; transition: bottom .15s; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--bg-3); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 360px; animation: pop .15s ease-out; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* ---------- composer extras (v1.1) ---------- */
.composer { align-items: center; padding: 6px 6px 6px 6px; }
.composer textarea { padding: 6px 4px; align-self: stretch; }
.comp-btn { width: 34px; height: 34px; font-size: 1.15em; flex: none; }
.comp-btn:disabled { opacity: .4; cursor: not-allowed; }
.gif-btn { font-size: .72em; font-weight: 900; letter-spacing: .04em; border: 1.5px solid currentColor; width: auto; height: 22px; padding: 0 5px; border-radius: 5px; margin: 0 5px; }
.send-btn { align-self: center; }
.upload-tray { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; }
.up-chip { position: relative; display: flex; gap: 8px; align-items: center; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 6px 30px 6px 6px; min-width: 190px; max-width: 260px; flex: none; }
.up-chip img, .up-chip .up-icon { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--bg-1); font-size: 1.4em; }
.up-meta { min-width: 0; flex: 1; }
.up-name { font-size: .85em; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 4px; background: var(--bg-1); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.up-chip.done .up-bar span { background: var(--ok); }
.up-chip.error { border-color: var(--danger); }
.up-chip.error .up-bar span { background: var(--danger); width: 100% !important; }
.up-rm { position: absolute; top: 4px; right: 4px; border: 0; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 6px; width: 22px; height: 22px; }
.up-rm:hover { background: var(--bg-hover); color: var(--danger); }
.main.dropping { box-shadow: inset 0 0 0 3px var(--accent); }
.main.dropping::after { content: "Drop files to upload"; position: fixed; inset: auto 0 50% 0; text-align: center; font-weight: 800; font-size: 1.4em; color: var(--accent-strong); pointer-events: none; }

/* ---------- emoji picker ---------- */
.emoji-picker { width: 352px; height: 380px; display: flex; flex-direction: column; gap: 6px; }
.emoji-search { padding: .45em .7em; }
.emoji-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 4px; overflow-x: auto; }
.emoji-tabs button { border: 0; background: transparent; font-size: 1.1em; padding: 3px 6px; border-radius: 6px; cursor: pointer; flex: none; }
.emoji-tabs button:hover { background: var(--bg-hover); }
.emoji-scroll { overflow-y: auto; flex: 1; position: relative; }
.emoji-sec-title { font-size: .7em; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); padding: 8px 4px 4px; position: sticky; top: 0; background: var(--bg-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; }
.emoji-grid button { border: 0; background: transparent; font-size: 1.45em; border-radius: 7px; cursor: pointer; height: 38px; padding: 0; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.emoji-grid button:hover { background: var(--bg-hover); transform: scale(1.12); }

/* ---------- GIF picker ---------- */
.gif-picker { width: 420px; height: 460px; display: flex; flex-direction: column; gap: 6px; }
.gif-scroll { flex: 1; overflow-y: auto; }
.gif-status { padding: 2px 2px 6px; font-weight: 700; }
.gif-grid { columns: 2; column-gap: 6px; }
.gif-item { display: block; width: 100%; border: 0; padding: 0; margin: 0 0 6px; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--bg-3); break-inside: avoid; }
.gif-item { position: relative; }
.gif-item img { display: block; width: 100%; height: auto; }
.gif-badge { position: absolute; left: 5px; bottom: 5px; font-size: 9px; font-weight: 900; letter-spacing: .05em; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; opacity: .85; }
.gif-badge.klipy { background: rgba(124, 58, 237, .85); }
.gif-badge.giphy { background: rgba(0, 0, 0, .75); }
.gif-item:hover { outline: 3px solid var(--accent); }
.gif-foot { text-align: right; font-weight: 700; letter-spacing: .04em; }

/* ---------- attachments ---------- */
.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; align-items: flex-start; }
.att-media img, .att-media video { display: block; max-width: min(400px, 100%); max-height: 320px; border-radius: 10px; background: var(--bg-3); cursor: zoom-in; object-fit: contain; }
.att-media video { cursor: default; }
.att-media.gif img { border-radius: 8px; }
.att-file { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center; background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: min(420px, 100%); }
.att-icon { font-size: 1.8em; }
.att-info { min-width: 0; }
.att-name { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.att-name:hover { text-decoration: underline; }
.att-file audio { grid-column: 1 / -1; width: 100%; height: 36px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 12px; animation: fade .12s; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 6px; cursor: zoom-out; }
.lightbox-bar { display: flex; gap: 10px; align-items: center; color: #eee; flex-wrap: wrap; justify-content: center; }
.lightbox-bar .btn { text-decoration: none; }

/* ---------- v1.3: image previews in the upload tray ---------- */
.up-chip.image { padding: 6px 6px 6px 6px; min-width: 230px; }
.up-thumb { position: relative; border: 0; padding: 0; background: var(--bg-1); border-radius: 8px; overflow: hidden; cursor: zoom-in; flex: none; width: 76px; height: 76px; }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0; transition: filter .15s; }
.up-thumb:hover img { filter: brightness(1.1); }
.up-spoiler-tag { display: none; position: absolute; inset: auto 0 6px 0; margin: auto; width: max-content; font-size: 9px; font-weight: 900; letter-spacing: .08em; padding: 2px 6px; border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; }
.up-chip.spoiler .up-thumb img { filter: blur(10px) brightness(.8); }
.up-chip.spoiler .up-spoiler-tag { display: block; }
.up-chip { padding-right: 6px; }
.up-tools { display: flex; flex-direction: column; gap: 2px; align-self: flex-start; }
.up-tools button { border: 0; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 6px; width: 26px; height: 24px; font-size: .9em; }
.up-tools button:hover { background: var(--bg-hover); color: var(--text); }
.up-tools .up-spoiler-btn.on { color: var(--accent-strong); background: var(--accent-soft); }
.up-rm { display: none; }

/* ---------- v1.3: replies ---------- */
.reply-bar { display: flex; align-items: center; gap: 8px; background: var(--bg-1); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; padding: 6px 6px 6px 14px; font-size: .85em; color: var(--text-2); }
.reply-bar-label { white-space: nowrap; }
.reply-bar-label b { color: var(--text); }
.reply-bar-excerpt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.reply-bar .icon-btn { width: 26px; height: 26px; }
.composer.replying { border-top-left-radius: 0; border-top-right-radius: 0; }
.msg.has-reply { margin-top: 14px; }
.reply-ref { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; margin: 0 0 3px 20px; padding-left: 34px; position: relative; font-size: .82em; color: var(--text-2); cursor: pointer; min-width: 0; max-width: 100%; }
.reply-ref::before { content: ""; position: absolute; left: 0; top: 50%; width: 28px; height: 12px; border-left: 2px solid var(--line); border-top: 2px solid var(--line); border-top-left-radius: 7px; }
.reply-ref:hover .reply-ref-text { color: var(--text); }
.reply-ref-name { font-weight: 700; white-space: nowrap; }
.reply-ref-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.reply-ref-att { color: var(--text-3); }
.reply-ref.deleted { cursor: default; font-style: italic; color: var(--text-3); }
.avatar.xs { width: 16px; height: 16px; font-size: .5em; }
:root.compact .reply-ref { margin-left: 52px; }
@keyframes msgflash { 0%, 30% { background: color-mix(in srgb, var(--accent) 28%, transparent); } 100% { background: transparent; } }
.msg.flash { animation: msgflash 2.2s ease-out; }

/* ---------- v1.3: spoilers ---------- */
.att-media { position: relative; display: inline-block; max-width: 100%; }
.att-media.spoiler { overflow: hidden; border-radius: 10px; }
.att-media.spoiler img, .att-media.spoiler video { transition: filter .2s; }
.att-media.spoiler.concealed img, .att-media.spoiler.concealed video { filter: blur(44px) brightness(.75); transform: scale(1.04); }
.spoiler-cover { display: none; position: absolute; inset: 0; border: 0; background: rgba(10,12,20,.25); cursor: pointer; place-items: center; z-index: 1; }
.spoiler-cover span { background: rgba(0,0,0,.72); color: #fff; font-weight: 900; letter-spacing: .12em; font-size: .78em; padding: 6px 12px; border-radius: 20px; }
.spoiler-cover:hover span { background: #000; }
.att-media.spoiler.concealed .spoiler-cover { display: grid; }
.spoiler-hide { display: none; position: absolute; top: 6px; right: 6px; z-index: 2; border: 0; width: 30px; height: 30px; border-radius: 8px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; place-items: center; opacity: .85; }
.spoiler-hide:hover { opacity: 1; background: rgba(0,0,0,.8); }
.att-media.spoiler:not(.concealed) .spoiler-hide { display: grid; }

/* ---------- v1.3: image editor (preview / crop / spoiler) ---------- */
.modal.editor-modal { width: min(860px, 100%); }
.editor-preview { display: flex; justify-content: center; background: repeating-conic-gradient(var(--bg-3) 0 25%, var(--bg-1) 0 50%) 0 0 / 18px 18px; border-radius: 10px; padding: 10px; margin-bottom: 6px; }
.crop-stage { position: relative; display: inline-block; line-height: 0; user-select: none; touch-action: none; }
.crop-stage img { max-width: 100%; max-height: min(60vh, 560px); display: block; }
.editor-preview.spoiler-on img { filter: blur(24px) brightness(.8); }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none; }
.crop-box::before, .crop-box::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 1px solid rgba(255,255,255,.35); }
.crop-box::before { left: 33.33%; right: 33.33%; border-top: 0; border-bottom: 0; }
.crop-box::after { top: 33.33%; bottom: 33.33%; border-left: 0; border-right: 0; }
.crop-h { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; z-index: 1; }
.crop-h.nw { left: -8px; top: -8px; cursor: nwse-resize; } .crop-h.se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-h.ne { right: -8px; top: -8px; cursor: nesw-resize; } .crop-h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-h.n { left: calc(50% - 7px); top: -8px; cursor: ns-resize; } .crop-h.s { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.crop-h.e { top: calc(50% - 7px); right: -8px; cursor: ew-resize; } .crop-h.w { top: calc(50% - 7px); left: -8px; cursor: ew-resize; }
.crop-box.locked .crop-h.n, .crop-box.locked .crop-h.s, .crop-box.locked .crop-h.e, .crop-box.locked .crop-h.w { display: none; }
.crop-ratios .btn { padding: .25em .6em; }
@media (hover: none) { .crop-h { width: 22px; height: 22px; } .crop-h.nw, .crop-h.ne { top: -12px; } .crop-h.sw, .crop-h.se { bottom: -12px; } .crop-h.nw, .crop-h.sw { left: -12px; } .crop-h.ne, .crop-h.se { right: -12px; } }

.mobile-only { display: none !important; }
.scrim { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 220px 1fr; }
  .members { display: none; }
  .tabs-layout { grid-template-columns: 1fr; }
  .tabs-nav { display: flex; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .tabs-nav .grp { display: none; }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .mobile-only { display: inline-grid !important; }
  .btn.mobile-only { display: inline-block !important; margin-top: 10px; }
  .app { grid-template-columns: 1fr; height: 100dvh; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); padding-top: env(safe-area-inset-top); }
  .app.nav-open .sidebar { transform: none; }
  .members { display: block !important; position: fixed; inset: 0 0 0 auto; width: min(280px, 82vw); z-index: 30; transform: translateX(102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .members.hidden { display: none !important; }
  .app.members-open .members { transform: none; }
  .app.nav-open .scrim, .app.members-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; }
  .chan-header { padding: 0 6px; gap: 6px; height: 50px; }
  .chan-header .topic { display: none; }
  .chan-header .title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
  .msg { padding: 3px 10px; grid-template-columns: 36px 1fr; gap: 0 10px; }
  .msg .avatar { width: 36px; height: 36px; }
  .msg-actions { right: 8px; }
  .msg.sel { background: color-mix(in srgb, var(--bg-hover) 55%, transparent); }
  .composer-wrap { padding: 0 8px calc(4px + env(safe-area-inset-bottom)); }
  .composer { gap: 2px; }
  .comp-btn { width: 32px; }
  .send-btn { padding: .45em .7em; }
  .overlay { padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .modal-foot { border-radius: 0; flex-wrap: wrap; }
  .setting-row { flex-wrap: wrap; }
  .setting-row .ctl { width: 100%; justify-content: flex-start; }
  table.grid { font-size: .82em; }
  .popover { left: 6px !important; right: 6px; max-width: calc(100vw - 12px); }
  .emoji-picker, .gif-picker { width: 100%; height: min(420px, 60dvh); }
  #toasts { left: 10px; right: 10px; bottom: calc(var(--composer-h, 60px) + 14px); }
  .toast { max-width: none; }
  .auth-card { padding: 22px; }
  .tab-pane { padding: 14px; }
}
@media (hover: none) {
  .msg:hover .msg-actions { display: none; }
  .msg.sel .msg-actions { display: flex; }
  .msg .gutter { opacity: 0 !important; }
}

/* ---------------------------------------------------------------- profile pictures (v1.4.0) */
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--bg-2); }
.avatar.has-img { color: transparent; }
.avatar.xl { width: 96px; height: 96px; font-size: 2em; }
.crop-box.round { border-radius: 50%; }
.crop-box.round::before, .crop-box.round::after { display: none; }
.editor-preview.round-preview .crop-stage img { border-radius: 50%; aspect-ratio: 1; object-fit: cover; max-height: min(50vh, 360px); }
.avatar-current { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.avatar-history { display: flex; gap: 12px; flex-wrap: wrap; }
.avatar-hist { position: relative; width: 64px; height: 64px; }
.avatar-hist-pick { width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 2px solid transparent; background: var(--bg-2); cursor: pointer; overflow: hidden; }
.avatar-hist-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-hist-pick:hover:not(:disabled) { border-color: var(--accent); }
.avatar-hist.current .avatar-hist-pick { border-color: var(--ok); cursor: default; }
.avatar-hist-tag { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); background: var(--ok); color: #fff; font-size: .62em; font-weight: 700; padding: 1px 6px; border-radius: 8px; }
.avatar-hist-del { position: absolute; top: -4px; right: -4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bg-3); color: var(--text); font-size: .7em; cursor: pointer; opacity: 0; transition: opacity .15s; }
.avatar-hist:hover .avatar-hist-del, .avatar-hist-del:focus { opacity: 1; }
@media (hover: none) { .avatar-hist-del { opacity: 1; } }
.avatar-hist-del:hover { background: var(--danger); color: #fff; }

/* ---------------------------------------------------------------- client update prompt (v1.4.0) */
.update-prompt { position: fixed; top: 14px; right: 14px; z-index: 900; width: min(400px, calc(100vw - 28px)); display: flex; gap: 12px;
  padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow); animation: upd-in .25s ease-out; }
.update-prompt .update-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; }
.update-prompt .update-text { min-width: 0; line-height: 1.4; }
@keyframes upd-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 760px) { .update-prompt { top: 8px; right: 8px; left: 8px; width: auto; } }
.update-bar { position: relative; height: 8px; margin-top: 12px; border-radius: 4px; background: var(--bg-3); overflow: hidden; }
.update-bar > span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); border-radius: 4px; transition: width .3s; }
.update-bar.indeterminate > span { width: 35% !important; animation: upd-slide 1.1s ease-in-out infinite; }
@keyframes upd-slide { from { left: -35%; } to { left: 100%; } }

/* ---------------------------------------------------------------- status (v1.5.0) */
.avatar .dot.away { background: var(--warn); }
.avatar .dot.dnd { background: var(--danger); }
.avatar .dot.dnd::after { content: ""; position: absolute; left: 50%; top: 50%; width: 55%; height: 2px; transform: translate(-50%, -50%); background: var(--bg-1); border-radius: 1px; }
.avatar .dot.away::after { content: ""; position: absolute; left: -1px; top: -1px; width: 60%; height: 60%; border-radius: 50%; background: var(--bg-1); }
.status-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); vertical-align: middle; position: relative; }
.status-dot.online { background: var(--ok); }
.status-dot.away { background: var(--warn); }
.status-dot.dnd { background: var(--danger); }
.status-dot.dnd::after { content: ""; position: absolute; left: 2px; right: 2px; top: 4px; height: 2px; background: var(--bg-2); border-radius: 1px; }
.me-status-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px; margin: -4px; border-radius: 8px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.me-status-btn:hover { background: var(--bg-hover); }
.me-status-btn .who { flex: 1; min-width: 0; }
.me-status-btn .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-menu { width: 300px; }
.status-opt { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.status-opt:hover { background: var(--bg-hover); }
.status-opt.sel { background: var(--accent-soft); }
.status-opt .status-check { margin-left: auto; color: var(--accent-strong); font-weight: 800; }
.status-menu .row .input { flex: 1; min-width: 0; }
.dm-status { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.dm-status-label { white-space: nowrap; }
.dm-custom-status { font-style: italic; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.member-status, .member-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-status { color: var(--text-2); }
.profile-status { margin: -2px 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--bg-3); font-size: .9em; word-break: break-word; }
.hover-tip { position: fixed; z-index: 2000; max-width: 280px; padding: 6px 10px; border-radius: 8px; background: var(--bg-0); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .85em; line-height: 1.4; word-break: break-word; pointer-events: none; }

/* ---------------------------------------------------------------- custom emoji (v1.5.0) */
.cemoji { width: 1.375em; height: 1.375em; object-fit: contain; vertical-align: -0.3em; display: inline-block; }
.body.jumbo .cemoji { width: 3em; height: 3em; vertical-align: middle; margin: 2px 2px 0 0; }
.cemoji.big { width: 40px; height: 40px; }
.reaction .cemoji { width: 1.2em; height: 1.2em; }
.emoji-grid button .cemoji { width: 24px; height: 24px; vertical-align: middle; }
.emoji-picker > .row { gap: 6px; }
.emoji-picker > .row .input { flex: 1; min-width: 0; }
.emoji-upload-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 56px; padding: 8px 12px; margin-bottom: 10px; border-radius: 10px; background: var(--bg-3); }
.emoji-upload-preview .msg-sample { font-size: .95em; }
.emoji-table td { vertical-align: middle; }
.muted-row { opacity: .55; }
.input.sm { padding: 4px 8px; font-size: .9em; }

/* ---------------------------------------------------------------- favourite GIFs (v1.5.0) */
.gif-star { position: absolute; top: 6px; right: 6px; z-index: 3; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer; opacity: 0; transition: opacity .15s, transform .15s; padding: 0; }
.gif-star svg { fill: none; }
.gif-star.on { color: #facc15; }
.gif-star.on svg { fill: #facc15; }
.gif-item:hover .gif-star, .att-media:hover .gif-star, .gif-star:focus-visible { opacity: 1; }
.gif-star:hover { transform: scale(1.12); background: rgba(0,0,0,.75); }
@media (hover: none) { .gif-star.on { opacity: 1; } .msg.sel .gif-star, .gif-item .gif-star { opacity: 1; } }
.att-media.spoiler .gif-star { right: 40px; }
.att-media.concealed .gif-star { display: none; }
.gif-tabs { display: flex; gap: 4px; }
.gif-tab { flex: 1; border: 0; padding: 6px 8px; border-radius: 8px; background: var(--bg-3); color: var(--text-2); font: inherit; font-weight: 700; cursor: pointer; }
.gif-tab.active { background: var(--accent-soft); color: var(--accent-strong); }
.gif-empty { padding: 30px 12px; text-align: center; column-span: all; }
.up-chip.sending { opacity: .5; }

/* ---------------------------------------------------------------- formatting (v1.6.0) */
.fmt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 8px; margin-bottom: 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.fmt-group { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.fmt-group + .fmt-group { padding-left: 8px; margin-left: 2px; box-shadow: inset 1px 0 0 var(--line); }
.fmt-group.fmt-colors { box-shadow: none; padding-left: 4px; }
.fmt-btn { min-width: 30px; height: 28px; padding: 0 6px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: inherit; font-size: .9em; cursor: pointer; }
.fmt-btn:hover { background: var(--bg-hover); color: var(--text); }
.fmt-spoiler { letter-spacing: -2px; }
.fmt-select { height: 28px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-1); color: var(--text); font: inherit; font-size: .85em; padding: 0 4px; }
.fmt-swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--bg-2); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; margin: 0 1px; }
.fmt-swatch:hover { transform: scale(1.15); }
.fmt-color-input { width: 26px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.fmt-toggle { font-weight: 800; font-size: .95em !important; letter-spacing: -.02em; }
.fmt-toggle.active { color: var(--accent-strong); background: var(--accent-soft); }
.shortcut-list { width: 260px; }
.shortcut-list .row { padding: 3px 0; font-size: .9em; }
kbd { font-family: var(--mono); font-size: .8em; padding: 1px 6px; border-radius: 5px; background: var(--bg-3); border: 1px solid var(--line); border-bottom-width: 2px; }
.fs-small { font-size: .82em; }
.fs-large { font-size: 1.35em; line-height: 1.3; }
.fs-huge { font-size: 1.9em; line-height: 1.2; font-weight: 700; }
.ff-serif { font-family: Georgia, "Times New Roman", serif; }
.ff-mono { font-family: var(--mono); }
.ff-script { font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive; }
.ff-comic { font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", cursive; }
.ff-impact { font-family: Impact, "Arial Black", "Haettenschweiler", sans-serif; letter-spacing: .02em; }
.ff-rounded { font-family: "Arial Rounded MT Bold", "Varela Round", "Nunito", system-ui, sans-serif; }
.md-h1, .md-h2, .md-h3 { font-weight: 800; line-height: 1.25; margin: .25em 0 .1em; }
.md-h1 { font-size: 1.6em; } .md-h2 { font-size: 1.3em; } .md-h3 { font-size: 1.1em; }
.msg .body ul { margin: .1em 0; padding-left: 1.4em; }
.msg .body a, .member-status a, .dm-custom-status a { color: var(--accent-strong); }
/* ||spoiler|| text */
.tspoiler { border-radius: 4px; padding: 0 2px; cursor: pointer; transition: background .15s, color .15s; background: color-mix(in srgb, var(--text) 10%, transparent); }
.tspoiler.concealed { background: #0b0c10; color: transparent !important; user-select: none; }
.tspoiler.concealed * { color: transparent !important; visibility: hidden; }
.tspoiler.concealed:hover { background: #1c1f29; }
.tspoiler:not(.concealed):hover { outline: 1px dashed var(--text-3); }
[data-theme="light"] .tspoiler.concealed { background: #2b2f3a; }
.status-preview { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--bg-3); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-fmt { display: flex; gap: 2px; margin-top: 6px; }
.member-status, .dm-custom-status, .me-sub, .dm-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-status .cemoji, .dm-sub .cemoji, .me-sub .cemoji, .dm-custom-status .cemoji { width: 1.2em; height: 1.2em; }

/* ---------------------------------------------------------------- DMs, groups (v1.6.0) */
.dm-item { align-items: center; }
.dm-label { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.dm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-sub { font-size: .76em; font-weight: 400; color: var(--text-3); margin-top: 1px; }
.chan.unread .dm-sub { font-weight: 400; }
.avatar.group-av { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #0ea5e9)); font-size: .8em; }
.avatar.group-av .group-count { position: absolute; right: -3px; bottom: -3px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px; background: var(--bg-0); color: var(--text); font-size: 9px; line-height: 14px; text-align: center; border: 1.5px solid var(--bg-1); }
.avatar.sm.group-av { font-size: .6em; }
.avatar.lg.group-av { font-size: 1.6em; }
.avatar.lg.group-av .group-count { font-size: 12px; min-width: 20px; height: 20px; line-height: 20px; border-radius: 10px; }
.members-add { width: 100%; margin: 4px 0 6px; }
.pick-list { max-height: 46vh; overflow-y: auto; }
.pick-item { cursor: pointer; border-radius: 8px; }
.pick-item.sel { background: var(--accent-soft); }
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pick-chips:empty { display: none; }
.pick-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-strong); font-size: .85em; font-weight: 600; }
.pick-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: .85em; }

/* ---------------------------------------------------------------- About: app version (v1.6.0) */
.app-version { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 4px 0 18px; background: var(--bg-2); }
.app-version-rows { display: flex; gap: 28px; flex-wrap: wrap; }
.app-version-rows > div { display: flex; flex-direction: column; gap: 1px; }
.app-version-rows b { font-size: 1.25em; }
.update-check-result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ok-text { color: var(--ok); font-weight: 600; }

/* ---- context menus (1.7.0) ---- */
.ctx-pop { padding: 5px; min-width: 210px; max-width: 300px; }
.ctx-menu { display: flex; flex-direction: column; outline: none; }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; color: var(--text); text-align: left;
  padding: 7px 9px; border-radius: 7px; cursor: pointer; font: inherit; font-size: .93em; }
.ctx-item:hover:not(:disabled), .ctx-item:focus-visible { background: var(--accent); color: #fff; outline: none; }
.ctx-item:disabled { opacity: .45; cursor: default; }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover, .ctx-item.danger:focus-visible { background: var(--danger); color: #fff; }
.ctx-icon { width: 18px; text-align: center; flex: none; display: inline-flex; justify-content: center; }
.ctx-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-hint { font-size: .8em; opacity: .65; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.ctx-header { font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 6px 9px 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-row { display: flex; gap: 2px; padding: 2px; justify-content: space-between; }
.ctx-react { background: var(--bg-3); border: 1px solid transparent; border-radius: 8px; font-size: 1.15em; width: 32px; height: 32px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--text); }
.ctx-react:hover { border-color: var(--accent); transform: scale(1.08); }
.ctx-react.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
@media (max-width: 720px) { .ctx-pop { left: auto !important; right: auto; max-width: calc(100vw - 16px); } }

/* ---- username style (1.7.0) ---- */
.name-sample { display: flex; gap: 10px; align-items: center; background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0 10px; }
.name-preview { font-weight: 700; }
.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--bg-2); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch:hover:not(:disabled) { transform: scale(1.12); }
.swatch:disabled { opacity: .4; cursor: default; }

/* ---- message auditing (1.7.0) ---- */
.audit-note { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; color: var(--text-2); }
.audit-perm b { color: var(--warn); }
.seg { display: inline-flex; background: var(--bg-1); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg-btn { border: 0; background: none; color: var(--text-2); padding: 5px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.seg-btn.active { background: var(--accent); color: #fff; }
.empty-note { padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
.maudit-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.maudit-filters .input { flex: 1 1 140px; min-width: 0; }
.maudit-list { display: flex; flex-direction: column; gap: 6px; }
.maudit-entry { background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.maudit-entry.ev-deleted, .maudit-entry.ev-channel_deleted { border-left: 3px solid var(--danger); }
.maudit-entry.ev-edited { border-left: 3px solid var(--warn); }
.maudit-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; font-size: .9em; }
.maudit-entry .body { white-space: pre-wrap; word-break: break-word; }
.maudit-atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.maudit-file { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; font-size: .9em; }
.maudit-file img { max-width: 180px; max-height: 140px; border-radius: 8px; cursor: zoom-in; }
.maudit-file.gone { color: var(--text-3); }
.maudit-convs { display: flex; flex-direction: column; gap: 4px; }
.maudit-conv { display: flex; gap: 10px; align-items: center; background: var(--bg-1); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  cursor: pointer; color: var(--text); text-align: left; font: inherit; }
.maudit-conv:hover { border-color: var(--accent); }
.maudit-conv .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.tiny { font-size: .7em; padding: 0 7px; }
.pill.tone-ok { color: var(--ok); } .pill.tone-warn { color: var(--warn); } .pill.tone-danger { color: var(--danger); }

/* ---- group icons + rename (1.8.0) ---- */
.chan-header .title-btn { background: none; border: 0; color: var(--text); cursor: pointer; padding: 2px 6px; margin-left: -6px; border-radius: 6px; font: inherit; font-weight: 800; font-size: 1.05em; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.chan-header .title-btn:hover { background: var(--bg-hover); }
.chan-header .title-btn::after { content: "✎"; font-size: .75em; opacity: 0; color: var(--text-3); transition: opacity .1s; }
.chan-header .title-btn:hover::after, .chan-header .title-btn:focus-visible::after { opacity: 1; }
.group-icon-row { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.avatar.xl.group-av { font-size: 2.4em; }
.avatar.xl.group-av .group-count { font-size: 13px; min-width: 24px; height: 24px; line-height: 24px; border-radius: 12px; right: 0; bottom: 0; }
.avatar.group-av.has-img > span:first-child { visibility: hidden; }

/* ---- server GIF library (1.8.0) ---- */
.gif-badge.server { background: color-mix(in srgb, var(--accent) 85%, #000); }
.gif-lib-bar { gap: 6px; flex-wrap: nowrap; }
.gif-lib-bar .input { flex: 1; min-width: 0; }
.gif-upload-preview { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 12px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; min-height: 60px; justify-content: center; }
.gif-upload-preview img { max-width: 260px; max-height: 200px; border-radius: 8px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: -4px 0 10px; }
.tag-chip { background: var(--accent-soft, var(--bg-3)); color: var(--text); border-radius: 12px; padding: 2px 9px; font-size: .8em; font-weight: 600; }
.cgif-list { display: flex; flex-direction: column; gap: 8px; }
.cgif-row { display: flex; gap: 12px; align-items: center; background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.cgif-row img { width: 88px; height: 66px; object-fit: cover; border-radius: 7px; flex: none; background: var(--bg-3); }
.cgif-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.cgif-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.muted-row { opacity: .55; }
.last-online-text { color: var(--text-2); }
@media (max-width: 720px) { .cgif-row { flex-wrap: wrap; } .cgif-actions { flex-direction: row; width: 100%; justify-content: flex-end; } }
