@font-face { font-family: 'Noto Sans Khmer'; font-weight: 400; font-display: swap; src: url(fonts/noto-sans-khmer-khmer-400-normal.woff2) format('woff2'); unicode-range: U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Khmer'; font-weight: 600; font-display: swap; src: url(fonts/noto-sans-khmer-khmer-600-normal.woff2) format('woff2'); unicode-range: U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Khmer'; font-weight: 400; font-display: swap; src: url(fonts/noto-sans-khmer-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Noto Sans Khmer'; font-weight: 600; font-display: swap; src: url(fonts/noto-sans-khmer-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Phum colours: deep river teal greys, temple gold, clay red.
   Panels are layered by tone (darkest rail → lighter chat), not by borders. */
:root {
  --rail: #0d1416;
  --side: #141c1f;
  --chat: #1a2326;
  --float: #0f1618;
  --input: #222d31;
  --ink: #e8e4db;
  --ink-2: #c3c9c8;
  --muted: #8f9b9c;
  --faint: #66737a;
  --line: rgba(255, 255, 255, .06);
  --hover: rgba(255, 255, 255, .045);
  --hover-2: rgba(255, 255, 255, .07);
  --select: rgba(255, 255, 255, .10);
  --brand: #2a8fa1;
  --brand-2: #23798a;
  --brand-ink: #fff;
  --gold: #e0a72c;
  --clay: #e0624a;
  --green: #3fb06a;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --name-l: 72%;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --rail: #dde5e3;
  --side: #eef2f1;
  --chat: #fbfbf8;
  --float: #ffffff;
  --input: #e8edec;
  --ink: #1f2426;
  --ink-2: #384245;
  --muted: #5d6a6d;
  --faint: #8a9699;
  --line: rgba(0, 0, 0, .07);
  --hover: rgba(0, 0, 0, .035);
  --hover-2: rgba(0, 0, 0, .06);
  --select: rgba(0, 0, 0, .085);
  --brand: #146a7b;
  --brand-2: #0f5664;
  --gold: #b97f0c;
  --clay: #c8452d;
  --green: #23944f;
  --shadow: 0 8px 30px rgba(20, 30, 30, .18);
  --name-l: 34%;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--chat);
  color: var(--ink);
  font: 15px/1.5 'Noto Sans Khmer', 'Khmer OS System', 'Khmer OS', 'Leelawadee UI', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
:lang(km) body, html:lang(km) { line-height: 1.6; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { display: block; }
i[data-icon] { display: inline-grid; place-items: center; font-style: normal; }
.error { color: var(--clay); margin: 0; font-size: 13px; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Buttons */
.primary, .secondary {
  border: 0; border-radius: 6px; padding: 9px 18px; font-weight: 600; font-size: 14px; transition: background .15s;
}
.primary { background: var(--brand); color: var(--brand-ink); }
.primary:hover { background: var(--brand-2); }
.primary:disabled { opacity: .55; cursor: default; }
.primary.big { width: 100%; padding: 11px; font-size: 15px; }
.secondary { background: var(--hover-2); color: var(--ink); }
.secondary:hover { background: var(--select); }
.secondary.danger { color: var(--clay); }
.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; font-size: 14px; }
:root:not([data-theme="light"]) .link { color: #4fb7c9; }
.link:hover { text-decoration: underline; }
.icon-btn {
  background: none; border: 0; border-radius: 6px; width: 32px; height: 32px; display: inline-grid; place-items: center;
  color: var(--muted); flex-shrink: 0; transition: color .1s, background .1s;
}
.icon-btn:hover { background: var(--hover-2); color: var(--ink); }
.icon-btn.active { color: var(--ink); }
.icon-btn.off { color: var(--clay); }

/* Forms */
label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
:lang(km) label { text-transform: none; letter-spacing: 0; font-size: 13px; }
label small { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; color: var(--faint); }
label input {
  border: 0; background: var(--float); border-radius: 6px; padding: 10px 12px; font-size: 15px; font-weight: 400; color: var(--ink);
  text-transform: none; letter-spacing: 0;
}
:root[data-theme="light"] label input { background: var(--input); }
label input:focus, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: -1px; }
.label-like { margin: 0; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
:lang(km) .label-like { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ================= Auth ================= */
.auth {
  min-height: 100%; display: grid; place-items: center; padding: 16px; position: relative; overflow: auto;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(224, 167, 44, .16), transparent 45%),
    radial-gradient(ellipse at 90% 100%, rgba(42, 143, 161, .28), transparent 50%),
    var(--rail);
}
.auth-corner { position: absolute; top: 14px; right: 14px; display: flex; gap: 6px; }
.chip { border: 0; background: var(--hover-2); color: var(--muted); border-radius: 999px; padding: 3px 12px; font-size: 13px; }
.chip.active { background: var(--brand); color: #fff; }
.auth-card {
  width: 100%; max-width: 440px; background: var(--side); border-radius: 10px; padding: 32px; box-shadow: var(--shadow); text-align: center;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.wordmark { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.wordmark span { color: var(--gold); margin-left: 4px; }
.auth h1 { margin: 0; font-size: 23px; }
.auth-sub { color: var(--muted); margin: 6px 0 20px; }
#auth-form { display: grid; gap: 16px; text-align: left; }
.only-register { display: none; }
.auth.register .only-register { display: grid; }
.auth-switch { margin: 14px 0 0; text-align: left; font-size: 14px; color: var(--muted); }

/* ================= App layout ================= */
.app { height: 100%; height: 100dvh; display: grid; grid-template-columns: 72px 240px minmax(0, 1fr); }

/* Rail */
.rail {
  background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0;
  overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.group-list { display: contents; }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--hover-2); flex-shrink: 0; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; flex-shrink: 0; position: relative; display: grid; place-items: center;
  background: var(--chat); color: var(--ink); font-weight: 600; font-size: 15px; transition: border-radius .18s, background .18s, color .18s;
}
.rail-btn.group { background: var(--chat); }
.rail-btn.group > span { color: var(--ink); }
.rail-btn:hover, .rail-btn.active { border-radius: 16px; }
.rail-btn.group:hover, .rail-btn.group.active { background: hsl(var(--h, 190) 42% 40%); }
.rail-btn.group:hover > span, .rail-btn.group.active > span { color: #fff; }
.rail-btn.home { background: var(--chat); }
.rail-btn.home:hover, .rail-btn.home.active { background: var(--brand); }
.rail-btn.action { color: var(--green); }
.rail-btn.action:hover { background: var(--green); color: #fff; }
/* the pill on the left edge */
.rail-btn::before {
  content: ''; position: absolute; left: -12px; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0;
  background: var(--ink); transform: translateY(-50%); transition: height .18s;
}
.rail-btn.unread::before { height: 8px; }
.rail-btn:hover::before { height: 20px; }
.rail-btn.active::before { height: 40px; }
.rail-btn.action::before { display: none; }

/* Sidebar */
.sidebar { background: var(--side); display: flex; flex-direction: column; min-height: 0; position: relative; }
.group-head {
  display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 12px 0 16px; border: 0; background: none; text-align: left;
  box-shadow: 0 1px 0 var(--line), 0 2px 2px rgba(0,0,0,.08); font-weight: 600; font-size: 15px; flex-shrink: 0; z-index: 2;
}
.group-head:hover { background: var(--hover); }
.group-head span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-head .chev { transition: transform .15s; color: var(--muted); }
.group-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.group-head:disabled { cursor: default; }
.group-head:disabled .chev { display: none; }
.group-menu {
  position: absolute; top: 54px; left: 10px; right: 10px; z-index: 30; background: var(--float); border-radius: 6px; padding: 6px;
  box-shadow: var(--shadow); display: grid;
}
.group-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: none; border-radius: 4px;
  padding: 7px 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); text-align: left;
}
.group-menu button:hover { background: var(--brand); color: #fff; }
.group-menu .accent { color: #6cc4d3; }
:root[data-theme="light"] .group-menu .accent { color: var(--brand); }
.group-menu .danger { color: var(--clay); }
.group-menu .danger:hover { background: var(--clay); color: #fff; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }

.channel-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 12px; scrollbar-width: thin; scrollbar-color: var(--hover-2) transparent; }
.cat {
  display: flex; align-items: center; gap: 2px; padding: 16px 4px 4px 2px; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .02em; user-select: none;
}
:lang(km) .cat { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.cat-sec:first-child .cat { padding-top: 8px; }
.cat-toggle { display: flex; align-items: center; gap: 2px; flex: 1; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; text-align: left; }
.cat-toggle:hover { color: var(--ink); }
.cat-toggle i { transition: transform .15s; }
.cat-sec.collapsed .cat-toggle i { transform: rotate(-90deg); }
.cat .icon-btn { width: 20px; height: 20px; }

.ch {
  width: 100%; display: flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 4px; padding: 6px 8px;
  margin: 1px 0; color: var(--muted); font-size: 15px; font-weight: 500; text-align: left; position: relative;
}
.ch > span.name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch i { color: var(--faint); }
.ch:hover { background: var(--hover-2); color: var(--ink-2); }
.ch.active { background: var(--select); color: var(--ink); }
.ch.active i { color: var(--ink-2); }
.ch.unread { color: var(--ink); font-weight: 600; }
.ch.unread::before { content: ''; position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--ink); }
.ch .ch-action { opacity: 0; width: 22px; height: 22px; }
.ch:hover .ch-action, .ch.active .ch-action { opacity: 1; }
.cat-sec.collapsed .ch-wrap:not(.keep) { display: none; }
.cat-sec.collapsed .voice-people { display: none; }

.voice-people { list-style: none; margin: 0 0 4px; padding: 0 0 0 30px; }
.voice-people li { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 4px; font-size: 14px; color: var(--muted); }
.voice-people li:hover { background: var(--hover); color: var(--ink-2); }
.voice-people .avatar { width: 24px; height: 24px; font-size: 10px; transition: box-shadow .12s; }
.voice-people li.speaking .avatar { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px var(--green); }
.voice-people li.speaking { color: var(--ink); }
.voice-people .member-name { flex: 1; }
.voice-people .state { color: var(--faint); display: inline-flex; gap: 2px; }

.voice-bar { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 12px; background: var(--side); border-top: 1px solid var(--line); }
.voice-info { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
#voice-status { display: flex; align-items: center; gap: 6px; color: var(--green); font-size: 14px; }
#voice-status.pending { color: var(--gold); }
#voice-where { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hangup:hover { color: var(--clay); }

.user-panel { display: flex; align-items: center; gap: 2px; padding: 6px 8px; background: color-mix(in srgb, var(--rail) 55%, var(--side)); min-height: 54px; }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; border-radius: 6px; padding: 3px 4px; text-align: left; }
.me:hover { background: var(--hover-2); }
.me-name { min-width: 0; display: grid; line-height: 1.25; }
.me-name strong { font-size: 14px; }
.me-name strong, .me-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-name small { color: var(--muted); font-size: 12px; }

/* Avatars + status dots */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; position: relative;
  background: hsl(var(--h, 190) 45% 42%); color: #fff; font-size: 13px; font-weight: 600; user-select: none;
}
.avatar.big { width: 64px; height: 64px; font-size: 22px; }
.dot {
  position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid var(--side); background: var(--faint);
}
.user-panel .dot { border-color: color-mix(in srgb, var(--rail) 55%, var(--side)); background: var(--green); }
.online .dot { background: var(--green); }

/* ================= Chat ================= */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat); }
.chat-head {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 10px 0 16px; flex-shrink: 0;
  box-shadow: 0 1px 0 var(--line), 0 2px 2px rgba(0,0,0,.06); z-index: 2;
}
.chat-head-icon { color: var(--faint); display: inline-grid; }
.chat-head h3 { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 40%; }
.head-divider { width: 1px; height: 24px; background: var(--hover-2); margin: 0 4px; }
.chat-topic { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-topic:empty + .conn, .chat-topic:empty { flex: 1; }
.conn { font-size: 12px; color: var(--gold); white-space: nowrap; display: none; }
.conn.show { display: inline; }
.mobile-only { display: none !important; }

.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.messages { flex: 1; overflow-y: auto; padding: 0 0 12px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--hover-2) transparent; }
.channel-welcome { padding: 32px 16px 8px; margin-top: auto; }
.channel-welcome .big-icon {
  width: 68px; height: 68px; border-radius: 50%; background: var(--hover-2); display: grid; place-items: center; color: var(--ink); margin-bottom: 8px;
}
.channel-welcome h2 { margin: 0; font-size: 28px; line-height: 1.3; }
:lang(km) .channel-welcome h2 { font-size: 24px; line-height: 1.6; }
.channel-welcome p { margin: 4px 0 0; color: var(--muted); }
.load-older { display: block; margin: 12px auto; background: var(--hover-2); border: 0; border-radius: 999px; padding: 4px 14px; font-size: 13px; color: var(--muted); }

.day { display: flex; align-items: center; gap: 8px; margin: 20px 16px 6px; color: var(--faint); font-size: 12px; font-weight: 600; }
.day::before, .day::after { content: ''; flex: 1; height: 1px; background: var(--hover-2); }

.msg { position: relative; padding: 2px 48px 2px 72px; min-height: 22px; }
.msg.head { margin-top: 16px; }
.msg:hover { background: color-mix(in srgb, var(--rail) 22%, transparent); }
:root[data-theme="light"] .msg:hover { background: rgba(0, 0, 0, .03); }
.msg .avatar { position: absolute; left: 16px; top: 4px; width: 40px; height: 40px; font-size: 14px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; line-height: 1.375; }
.msg-head strong { font-weight: 600; color: hsl(var(--h, 190) 60% var(--name-l)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.msg-head time { color: var(--faint); font-size: 12px; flex-shrink: 0; }
.msg .side-time {
  position: absolute; left: 0; width: 64px; text-align: right; top: 4px; font-size: 11px; color: var(--faint); opacity: 0; line-height: 1.6;
}
.msg:hover .side-time { opacity: 1; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); line-height: 1.375; }
:root[data-theme="light"] .msg-body { color: var(--ink); }
:lang(km) .msg-body, :lang(km) .msg-head { line-height: 1.7; }
.msg-body a { color: #4fb7c9; text-decoration: none; }
:root[data-theme="light"] .msg-body a { color: var(--brand); }
.msg-body a:hover { text-decoration: underline; }
.msg.mention-me { background: rgba(224, 167, 44, .08); box-shadow: inset 2px 0 0 var(--gold); }
.msg-tools {
  position: absolute; right: 16px; top: -14px; display: none; background: var(--side); border-radius: 6px; box-shadow: 0 0 0 1px var(--line), var(--shadow);
  padding: 2px;
}
.msg:hover .msg-tools { display: flex; }
.msg-tools .icon-btn { width: 30px; height: 28px; }
.msg-tools .quick { font-size: 16px; line-height: 1; }
.msg-tools .danger:hover { color: var(--clay); }

.composer { padding: 0 16px; flex-shrink: 0; }
.composer-box { display: flex; align-items: flex-end; gap: 4px; background: var(--input); border-radius: 8px; padding: 0 6px 0 16px; }
.composer textarea {
  flex: 1; border: 0; background: none; resize: none; padding: 11px 0; line-height: 1.375; font-size: 15px; max-height: 50vh; outline: none; color: var(--ink);
}
:lang(km) .composer textarea { line-height: 1.6; padding: 9px 0; }
.composer textarea::placeholder { color: var(--faint); }
.send { border: 0; background: none; color: var(--muted); border-radius: 6px; width: 36px; height: 36px; margin: 4px 0; display: grid; place-items: center; flex-shrink: 0; }
.send:hover { color: var(--ink); }
.composer.has-text .send { color: var(--brand); }
:root:not([data-theme="light"]) .composer.has-text .send { color: #4fb7c9; }
.typing { height: 24px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.typing b { color: var(--ink-2); }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-2); animation: blink 1.2s infinite; }
.typing .dots span:nth-child(2) { animation-delay: .2s; }
.typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.empty { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; padding: 24px; gap: 6px; }
.empty h2 { margin: 16px 0 0; font-size: 24px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 0 16px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ================= Members ================= */
.members { width: 240px; background: var(--side); overflow-y: auto; padding: 8px 8px 16px; flex-shrink: 0; scrollbar-width: thin; scrollbar-color: var(--hover-2) transparent; }
.app.members-hidden .members { display: none; }
.member-section { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; padding: 16px 8px 4px; }
:lang(km) .member-section { text-transform: none; letter-spacing: 0; }
.member { display: flex; align-items: center; gap: 12px; padding: 5px 8px; border-radius: 4px; margin: 1px 0; }
.member:hover { background: var(--hover-2); }
.member:not(.online) { opacity: .4; }
.member:not(.online):hover { opacity: 1; }
.member .avatar { width: 32px; height: 32px; font-size: 12px; }
.member-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.member.online .member-name { color: hsl(var(--h, 190) 60% var(--name-l)); }
.crown { color: var(--gold); display: inline-grid; flex-shrink: 0; }

/* ================= Dialogs ================= */
dialog {
  border: 0; border-radius: 10px; padding: 0; background: var(--side); color: var(--ink); box-shadow: var(--shadow);
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
}
:root[data-theme="light"] dialog { background: var(--float); }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
dialog[open] { animation: pop .16s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.dlg { display: grid; gap: 14px; padding: 24px; position: relative; }
.dlg.center { text-align: center; }
.dlg.center label { text-align: left; }
.dlg h2 { margin: 0; font-size: 22px; }
.dlg p { margin: 0; color: var(--muted); }
.dlg .close { position: absolute; top: 10px; right: 10px; border: 0; background: none; color: var(--muted); width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; }
.dlg .close:hover { color: var(--ink); background: var(--hover-2); }
.dlg-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px -24px -24px; padding: 14px 24px;
  background: color-mix(in srgb, var(--rail) 45%, var(--side)); border-radius: 0 0 10px 10px;
}
:root[data-theme="light"] .dlg-foot { background: var(--side); }
.dlg-create, .dlg-join { display: grid; gap: 14px; }
#dlg-group .dlg-join, #dlg-group.join-mode .dlg-create { display: none; }
#dlg-group.join-mode .dlg-join { display: grid; }
.group-preview { display: grid; place-items: center; }
.group-preview span {
  width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 600; color: #fff;
  background: hsl(var(--h, 190) 42% 40%); border: 2px dashed rgba(255,255,255,.35);
}
.kind-pick { display: grid; gap: 8px; }
.kind { display: block; cursor: pointer; text-transform: none; letter-spacing: 0; }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind > span { display: flex; align-items: center; gap: 14px; background: var(--hover-2); border-radius: 6px; padding: 10px 14px; color: var(--ink); font-size: 15px; }
.kind > span > i { color: var(--muted); }
.kind > span > span { display: grid; line-height: 1.35; }
.kind b { font-weight: 600; }
.kind small { color: var(--muted); font-weight: 400; font-size: 13px; }
.kind:hover > span { background: var(--select); }
.kind input:checked + span { background: var(--select); box-shadow: inset 0 0 0 2px var(--brand); }
.kind input:focus-visible + span { outline: 2px solid var(--brand); }
.prefixed { display: flex; align-items: center; gap: 4px; background: var(--float); border-radius: 6px; padding-left: 10px; color: var(--muted); }
:root[data-theme="light"] .prefixed { background: var(--input); }
.prefixed input { flex: 1; background: none !important; padding-left: 4px; }
.prefixed:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; }
.prefixed input:focus { outline: none; }
.copy-row { display: flex; gap: 6px; background: var(--float); border-radius: 6px; padding: 4px 4px 4px 12px; align-items: center; }
:root[data-theme="light"] .copy-row { background: var(--input); }
.copy-row input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font-size: 14px; outline: none; }
.copy-row .primary { padding: 7px 16px; }
.copy-row .primary.done { background: var(--green); }
#invite-code { color: var(--gold); font-weight: 600; letter-spacing: .06em; }
.profile-card { display: flex; align-items: center; gap: 14px; background: var(--float); border-radius: 8px; padding: 14px; }
:root[data-theme="light"] .profile-card { background: var(--side); }
.profile-card div:last-child { display: grid; }
.profile-card strong { font-size: 18px; }
.profile-card small { color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button { border: 0; background: var(--hover-2); border-radius: 6px; padding: 9px; font-weight: 600; color: var(--ink-2); }
.seg button:hover { background: var(--select); }
.seg button.active { background: var(--brand); color: #fff; }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--float); color: var(--ink); font-size: 14px; font-weight: 600;
  padding: 6px 10px; border-radius: 6px; box-shadow: var(--shadow); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis;
}

.notice {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 120;
  background: var(--float); color: var(--ink); padding: 10px 16px; border-radius: 8px; font-size: 14px; transition: .2s; box-shadow: var(--shadow);
  max-width: calc(100vw - 32px); border-left: 3px solid var(--clay); white-space: pre-line;
}
.notice.ok { border-left-color: var(--green); }
.notice.show { opacity: 1; transform: translate(-50%, 0); }
.scrim { display: none; }

/* ================= New: roles, DMs, rich messages, uploads, profiles ================= */
:root { --role-owner: var(--gold); --role-admin: #ef7a62; --role-mod: #4fc0a0; --red: #e0483c; }
:root[data-theme="light"] { --role-owner: #a46f00; --role-admin: #c8452d; --role-mod: #17846a; }
.role-owner { color: var(--role-owner) !important; }
.role-admin { color: var(--role-admin) !important; }
.role-mod { color: var(--role-mod) !important; }
.role-icon { display: inline-grid; flex-shrink: 0; }
.uname { cursor: pointer; }
.uname:hover { text-decoration: underline; }
.secondary.small, .primary.small { padding: 6px 12px; font-size: 13px; }
.secondary.danger:hover { background: var(--clay); color: #fff; }
.primary.danger-fill { background: var(--clay); }
.primary.danger-fill:hover { background: color-mix(in srgb, var(--clay) 85%, #000); }
.link.small { font-size: 13px; justify-self: start; }
.secondary, .primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
textarea { resize: vertical; }
label textarea { border: 0; background: var(--float); border-radius: 6px; padding: 10px 12px; font-size: 15px; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; }
:root[data-theme="light"] label textarea { background: var(--input); }
select { font: inherit; color: var(--ink); background: var(--float); border: 0; border-radius: 6px; padding: 6px 8px; }
:root[data-theme="light"] select { background: var(--input); }

/* Avatars with pictures */
.avatar img, .rail-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.avatar.has-img { background: var(--hover-2); }
.avatar.tiny { width: 16px; height: 16px; font-size: 8px; }
.avatar.huge { width: 80px; height: 80px; font-size: 28px; }
.avatar .dot { z-index: 1; }
.rail-btn.has-img { overflow: visible; }
.rail-btn.has-img img { border-radius: 50%; transition: border-radius .18s; }
.rail-btn.has-img:hover img, .rail-btn.has-img.active img { border-radius: 16px; }
.rail-btn.dm .avatar { width: 48px; height: 48px; font-size: 16px; }

/* Red mention badges */
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700;
  display: inline-grid; place-items: center; line-height: 1; flex-shrink: 0;
}
.rail-btn .badge { position: absolute; right: -4px; bottom: -4px; box-shadow: 0 0 0 3px var(--rail); min-width: 20px; height: 20px; font-size: 12px; }
.nav-badge { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
#toggle-nav { position: relative; }

/* Channel rows */
.ch .badge { margin-left: auto; }
.ch .ch-action { opacity: 0; color: var(--muted); border-radius: 4px; }
.ch .ch-action:hover { color: var(--ink); }
.ch:hover .ch-action, .ch.active .ch-action { opacity: 1; }
.ch.dm { padding: 5px 8px; gap: 10px; }
.ch.dm .avatar { width: 32px; height: 32px; font-size: 12px; }
.ch.dm .avatar .dot { border-color: var(--side); }
.ch.dm.online .dot { background: var(--green); }
.ch.dm:hover .dot { border-color: color-mix(in srgb, var(--side) 80%, var(--ink)); }
.side-hint { color: var(--faint); font-size: 13px; margin: 6px 8px; }
.group-head.search-like { margin: 9px 10px; height: 30px; border-radius: 6px; background: var(--float); box-shadow: none; font-weight: 500; font-size: 13.5px; color: var(--muted); padding: 0 10px; }
.group-head.search-like .chev { display: none; }
.app.home .sidebar .group-head.search-like { flex-shrink: 0; }
.sidebar:has(.group-head.search-like) { box-shadow: none; }
.live { background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; letter-spacing: .04em; }

/* Voice bar with screen share */
.voice-bar { display: grid; gap: 8px; }
.voice-row { display: flex; align-items: center; gap: 4px; }
.share-btn { width: 100%; }
.share-btn.on { background: var(--green); color: #fff; }

/* Screen share stage */
.stage { flex-shrink: 0; background: var(--rail); padding: 8px 12px 12px; max-height: 55%; display: flex; flex-direction: column; min-height: 0; }
.stage-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-bottom: 8px; }
.stage-head strong { flex: 1; }
.stage-head .icon-btn { transform: rotate(180deg); }
.stage.mini .stage-head .icon-btn { transform: none; }
.stage.mini .stage-grid { display: none; }
.stage-grid { display: grid; gap: 8px; grid-template-columns: 1fr; min-height: 0; flex: 1; }
.stage-grid[data-count="2"], .stage-grid[data-count="3"], .stage-grid[data-count="4"] { grid-template-columns: 1fr 1fr; }
.tile { position: relative; background: #000; border-radius: 8px; overflow: hidden; min-height: 0; display: grid; }
.tile video { width: 100%; height: 100%; max-height: 46vh; object-fit: contain; background: #000; }
.tile-name { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 12.5px; padding: 2px 8px; border-radius: 4px; }
.tile .icon-btn { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; }

/* Messages: replies, formatting, mentions, attachments, reactions */
.msg { transition: background .3s; }
.msg.replying { background: color-mix(in srgb, var(--brand) 14%, transparent); box-shadow: inset 2px 0 0 var(--brand); }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--gold) 22%, transparent); } }
.msg .avatar { cursor: pointer; }
.reply-preview {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0 0 2px; position: relative; cursor: pointer; min-width: 0;
}
.reply-preview::before {
  content: ''; position: absolute; left: -38px; top: 50%; width: 30px; height: 12px; border: 2px solid var(--hover-2); border-right: 0; border-bottom: 0; border-top-left-radius: 6px;
}
.msg .reply-preview .avatar { position: static; width: 16px; height: 16px; font-size: 8px; flex-shrink: 0; }
.reply-preview .uname { font-weight: 600; flex-shrink: 0; color: hsl(var(--h, 190) 60% var(--name-l)); }
.reply-preview .snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-preview:hover .snippet { color: var(--ink); }
.reply-preview .gone { font-style: italic; }
.msg.head .reply-preview + .avatar { top: 28px; }
.msg-body.jumbo { font-size: 44px; line-height: 1.2; }
.msg-body strong { font-weight: 700; color: var(--ink); }
.msg-body code.inline { background: var(--float); padding: 1px 5px; border-radius: 4px; font-size: 13.5px; }
.code-block { background: var(--float); border-radius: 6px; padding: 8px 10px; margin: 4px 0; overflow-x: auto; max-width: 100%; font-size: 13.5px; white-space: pre; }
.spoiler { background: var(--ink-2); color: transparent; border-radius: 3px; cursor: pointer; transition: .15s; }
.spoiler.shown { background: var(--hover-2); color: inherit; cursor: auto; }
.mention { background: color-mix(in srgb, var(--brand) 28%, transparent); color: #8fd6e2; border-radius: 4px; padding: 0 3px; font-weight: 600; cursor: pointer; }
:root[data-theme="light"] .mention { color: var(--brand-2); }
.mention:hover { background: var(--brand); color: #fff; }
.edited { font-size: 11px; color: var(--faint); margin-left: 4px; }
.msg-edit { display: grid; gap: 4px; padding: 4px 0; }
.msg-edit textarea { background: var(--input); border: 0; border-radius: 8px; padding: 9px 12px; resize: none; outline: none; font-size: 15px; line-height: 1.4; color: var(--ink); }
.edit-help { font-size: 12px; color: var(--muted); }
.edit-help .link { font-size: 12px; }

.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; max-width: 560px; }
.att-img { max-width: min(100%, 400px); max-height: 320px; border-radius: 8px; cursor: zoom-in; display: block; background: var(--hover); object-fit: cover; }
.att-video { max-width: min(100%, 440px); max-height: 320px; border-radius: 8px; background: #000; }
.att-file { display: flex; align-items: center; gap: 10px; background: var(--side); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-width: 420px; width: 100%; color: var(--brand); }
:root:not([data-theme="light"]) .att-file { color: #4fb7c9; }
.att-meta { flex: 1; min-width: 0; display: grid; }
.att-meta a, .att-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.att-meta small { color: var(--faint); font-size: 12px; }
.att-meta audio { width: 100%; height: 32px; margin-top: 4px; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 7px; border-radius: 8px; border: 1px solid transparent;
  background: var(--hover-2); font-size: 14px; line-height: 1;
}
.reaction .count { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.reaction:hover { border-color: var(--faint); }
.reaction.mine { background: color-mix(in srgb, var(--brand) 22%, transparent); border-color: var(--brand); }
.reaction.mine .count { color: var(--ink); }
.reaction.add { width: 32px; justify-content: center; color: var(--muted); opacity: 0; }
.msg:hover .reaction.add { opacity: 1; }

/* Composer extras */
.composer { position: relative; }
.composer-box { padding: 0 6px 0 4px; }
.attach-btn, .emoji-btn { margin: 6px 0; }
.attach-btn:hover { color: var(--ink); }
.reply-bar {
  display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--rail) 50%, var(--input)); border-radius: 8px 8px 0 0;
  padding: 4px 6px 4px 14px; font-size: 13px; color: var(--muted);
}
.reply-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-bar b { color: var(--ink-2); }
.reply-bar + .attach-tray, .reply-bar:not([hidden]) ~ .composer-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.attach-tray { display: flex; gap: 8px; overflow-x: auto; padding: 10px; background: var(--input); border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--line); }
.attach-tray:not([hidden]) + .composer-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.pending { position: relative; flex: 0 0 auto; width: 132px; background: var(--side); border-radius: 6px; padding: 8px; display: grid; gap: 6px; justify-items: center; color: var(--muted); }
.pending img { width: 100%; height: 84px; object-fit: cover; border-radius: 4px; }
.pending i[data-icon="file"] { height: 84px; }
.pname { font-size: 12px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.pbar { width: 100%; height: 4px; border-radius: 2px; background: var(--hover-2); position: relative; overflow: hidden; }
.pbar::after { content: ''; position: absolute; inset: 0; width: calc(var(--p, 0) * 100%); background: var(--brand); transition: width .15s; }
.premove { position: absolute; top: -8px; right: -8px; background: var(--float); box-shadow: var(--shadow); width: 28px; height: 28px; }
.premove:hover { color: var(--clay); }
.mention-pop {
  position: absolute; left: 16px; right: 16px; bottom: calc(100% - 2px); background: var(--float); border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px; max-height: 300px; overflow-y: auto; z-index: 10;
}
.mp-title { font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 8px 6px; }
.mp-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; border-radius: 4px; padding: 5px 8px; text-align: left; }
.mp-item .avatar { width: 24px; height: 24px; font-size: 10px; }
.mp-item .avatar.at { background: var(--brand); }
.mp-item small { color: var(--muted); margin-left: auto; }
.mp-item.active, .mp-item:hover { background: var(--hover-2); }
.drop-zone { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 55%, rgba(0,0,0,.4)); pointer-events: none; }
.drop-zone > div { display: grid; justify-items: center; gap: 10px; color: #fff; font-size: 20px; padding: 40px; border: 2px dashed rgba(255,255,255,.7); border-radius: 16px; }
.chat-main { position: relative; }

/* Popovers */
.popover { position: fixed; z-index: 90; background: var(--float); border-radius: 10px; box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.emoji-pop { width: 320px; padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 260px; overflow-y: auto; }
.emoji-pop button { border: 0; background: none; font-size: 22px; line-height: 1; padding: 6px 0; border-radius: 6px; }
.emoji-pop button:hover { background: var(--hover-2); transform: scale(1.12); }
.popover.sheet-like { left: 8px !important; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: 70vh; }
.profile-pop { width: 300px; overflow: hidden; max-height: calc(100vh - 16px); overflow-y: auto; }

.profile-card-big { position: relative; padding-bottom: 12px; }
.profile-card-big .banner { height: 60px; background: linear-gradient(135deg, hsl(var(--h, 190) 45% 38%), hsl(calc(var(--h, 190) + 40) 50% 30%)); }
.profile-card-big > .avatar { position: absolute; left: 16px; top: 18px; box-shadow: 0 0 0 6px var(--float); }
.profile-card-big .avatar .dot { width: 22px; height: 22px; border-width: 4px; border-color: var(--float); right: 0; bottom: 0; }
.profile-card-big.online .avatar .dot { background: var(--green); }
.profile-card-big .pbody { padding: 48px 16px 0; display: grid; gap: 2px; }
.profile-card-big h3 { margin: 0; font-size: 20px; line-height: 1.3; }
.profile-card-big .handle { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.profile-card-big .label-like { margin-top: 10px; font-size: 11.5px; }
.profile-card-big .bio, .profile-card-big .since { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-card-big.in-panel { margin: -8px -8px 0; }
.profile-card-big.in-panel > .avatar { box-shadow: 0 0 0 6px var(--side); }
.profile-card-big.in-panel .avatar .dot { border-color: var(--side); }
.role-pill { display: inline-flex; align-items: center; gap: 4px; justify-self: start; font-size: 12px; font-weight: 600; background: var(--hover-2); border-radius: 4px; padding: 2px 8px; }
.pactions { display: grid; gap: 10px; padding: 14px 16px 2px; }
.pactions > .primary { width: 100%; }
.mod-box { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.mod-row { display: flex; gap: 8px; }
.mod-row button { flex: 1; }
label.inline { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13px; }

/* Members */
.member { cursor: pointer; }
.member-name.role-owner, .member-name.role-admin, .member-name.role-mod { font-weight: 600; }
.member.online .member-name.role-owner { color: var(--role-owner); }

/* DM welcome */
.channel-welcome .avatar.huge { margin-bottom: 8px; }
.channel-welcome .handle { margin: 0 0 8px; color: var(--ink-2); font-size: 18px; }

/* Dialog extras */
dialog.wide { width: min(560px, calc(100vw - 32px)); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 0; }
.tabs button { border: 0; background: none; padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }
.tab-pane { display: grid; gap: 12px; }
.gs-overview, .profile-edit { display: flex; gap: 16px; align-items: center; }
.gs-fields { flex: 1; display: grid; gap: 6px; min-width: 0; }
.icon-upload { position: relative; border: 0; background: none; padding: 0; flex-shrink: 0; }
.icon-upload > span:first-child { width: 80px; height: 80px; border-radius: 22px; display: grid; place-items: center; background: hsl(var(--h, 190) 42% 40%); color: #fff; font-size: 26px; font-weight: 600; overflow: hidden; }
.icon-upload.round > span:first-child { border-radius: 50%; }
.icon-upload > span:first-child img { width: 100%; height: 100%; object-fit: cover; }
.icon-upload > i { position: absolute; right: -2px; top: -2px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 0 0 3px var(--side); }
.icon-upload:hover > span:first-child { filter: brightness(.8); }
.copy-row code { flex: 1; color: var(--gold); font-weight: 600; letter-spacing: .06em; }
.danger-zone { display: flex; gap: 12px; align-items: center; border: 1px solid color-mix(in srgb, var(--clay) 50%, transparent); border-radius: 8px; padding: 12px; }
.danger-zone > div { flex: 1; display: grid; }
.danger-zone small { color: var(--muted); }
.roles-help { background: var(--hover); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.roles-help summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.roles-help ul { margin: 8px 0 2px; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); }
.roles-help b { color: var(--ink); }
.manage-list { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.manage-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; }
.manage-row:hover { background: var(--hover); }
.manage-row .who { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.manage-row .who .avatar { grid-row: span 2; }
.manage-row .who strong, .manage-row .who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.manage-row .who small { color: var(--muted); font-size: 12px; }
.manage-row .acts { display: flex; align-items: center; gap: 4px; }
.manage-row .danger:hover { color: var(--clay); }
.pick-list { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; margin: 0 -8px; }
.pick { display: flex; align-items: center; gap: 10px; border: 0; background: none; border-radius: 6px; padding: 6px 8px; text-align: left; }
.pick:hover { background: var(--hover-2); }
.pick .avatar .dot { border-color: var(--side); }
:root[data-theme="light"] .pick .avatar .dot { border-color: var(--float); }
.pick.online .dot { background: var(--green); }
.pick small { color: var(--muted); }
#dlg-settings .dlg { max-height: calc(100dvh - 32px); overflow-y: auto; }
#dlg-settings #save-profile { justify-self: start; }
#confirm-text { white-space: pre-line; }

/* Bottom sheet (phones) and picture viewer */
dialog.sheet { margin: auto 0 0; width: 100vw; max-width: none; border-radius: 14px 14px 0 0; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
dialog.sheet[open] { animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-body { display: grid; gap: 4px; }
.sheet-quick { display: flex; justify-content: space-around; padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sheet-quick button { border: 0; background: var(--hover-2); width: 44px; height: 44px; border-radius: 50%; font-size: 22px; display: grid; place-items: center; }
.sheet-item { display: flex; align-items: center; gap: 14px; border: 0; background: none; padding: 12px; border-radius: 8px; font-size: 16px; text-align: left; }
.sheet-item:hover { background: var(--hover-2); }
.sheet-item.danger { color: var(--clay); }
dialog.lightbox { background: transparent; box-shadow: none; width: auto; max-width: 96vw; max-height: 96vh; padding: 0; overflow: visible; text-align: center; }
dialog.lightbox img { max-width: 96vw; max-height: 88vh; border-radius: 6px; display: block; margin: 0 auto; cursor: zoom-out; }
dialog.lightbox a { color: #fff; opacity: .8; font-size: 14px; display: inline-block; margin-top: 8px; }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, .85); }

/* ================= Smaller screens ================= */
@media (max-width: 1099px) {
  .members {
    position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; width: 260px; display: block !important;
    transform: translateX(100%); transition: transform .2s ease; visibility: hidden;
  }
  .app.members-open .members { transform: none; box-shadow: var(--shadow); visibility: visible; }
  .app.members-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 15; }
  #toggle-members.active { color: var(--muted); }
}
@media (max-width: 759px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .mobile-only { display: inline-grid !important; }
  .chat-head { padding: 0 6px; gap: 4px; }
  .head-divider, .chat-topic { display: none; }
  .chat-head h3 { flex: 1; max-width: none; }
  .rail, .sidebar { position: fixed; top: 0; bottom: 0; z-index: 20; transition: transform .2s ease; }
  .rail { left: 0; width: 72px; transform: translateX(-110vw); padding-top: calc(12px + env(safe-area-inset-top)); }
  .sidebar { left: 72px; width: min(280px, calc(100vw - 100px)); transform: translateX(-110vw); }
  .app.nav-open .rail, .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar { box-shadow: var(--shadow); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 15; }
  .msg { padding-left: 64px; padding-right: 12px; }
  .msg .avatar { left: 12px; }
  .msg .side-time { width: 56px; }
  .msg-tools { display: none !important; }
  .composer { padding: 0 8px calc(env(safe-area-inset-bottom)); }
  .tooltip { display: none; }
  .msg-tools, .reaction.add { display: none !important; }
  .composer-box { padding-left: 2px; }
  .emoji-btn { display: none !important; }
  .stage { max-height: 40%; }
  .stage-grid[data-count] { grid-template-columns: 1fr; }
  .mention-pop { left: 8px; right: 8px; }
  .msg-body.jumbo { font-size: 36px; }
  .gs-overview, .profile-edit { gap: 12px; }
  .danger-zone { flex-direction: column; align-items: stretch; }
  .reply-preview::before { left: -34px; width: 26px; }
}

/* =====================================================================
   Phum "Night river" look: black gradients, floating glass panels,
   squircle avatars, teal→gold accents. Loaded last so it wins.
   ===================================================================== */
:root {
  --bg0: #030405;
  --rail: #090b0d;
  --side: #0d1013;
  --chat: #0f1215;
  --float: #15191d;
  --input: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .07);
  --hover: rgba(255, 255, 255, .035);
  --hover-2: rgba(255, 255, 255, .06);
  --select: rgba(255, 255, 255, .09);
  --brand: #27a9bb;
  --brand-2: #1d8797;
  --accent-a: #2fc3d4;
  --accent-b: #e8b03a;
  --grad: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .012));
  --glass-line: rgba(255, 255, 255, .075);
  --page:
    radial-gradient(1100px 650px at -5% -10%, rgba(39, 169, 187, .20), transparent 60%),
    radial-gradient(900px 600px at 105% 110%, rgba(232, 176, 58, .12), transparent 60%),
    radial-gradient(700px 500px at 60% 40%, rgba(120, 60, 160, .06), transparent 70%),
    linear-gradient(165deg, #0c0f12 0%, #050607 55%, #000 100%);
}
:root[data-theme="light"] {
  --bg0: #e9efef;
  --rail: #e4ebea;
  --side: #f3f6f6;
  --chat: #fbfcfc;
  --float: #ffffff;
  --input: rgba(0, 0, 0, .04);
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .78));
  --glass-line: rgba(0, 0, 0, .07);
  --accent-a: #138fa1;
  --accent-b: #c98a10;
  --page:
    radial-gradient(1000px 600px at -5% -10%, rgba(19, 143, 161, .16), transparent 60%),
    radial-gradient(900px 600px at 105% 110%, rgba(201, 138, 16, .12), transparent 60%),
    linear-gradient(165deg, #f4f7f7 0%, #e5ecec 100%);
}
body { background: var(--page); background-attachment: fixed; }
.app { background: transparent; }

/* Panels become floating glass cards */
.sidebar, .chat, dialog, .popover, .group-menu, .tooltip, .notice {
  background: var(--glass), var(--side);
  border: 1px solid var(--glass-line);
}
.chat { background: var(--glass), color-mix(in srgb, var(--chat) 70%, transparent); }
.sidebar { background: var(--glass), color-mix(in srgb, var(--side) 75%, transparent); }
@supports (backdrop-filter: blur(1px)) {
  .sidebar, .chat { backdrop-filter: blur(14px); }
}
.members { background: transparent; }
.rail { background: transparent; }
.user-panel { background: rgba(255, 255, 255, .035); border: 1px solid var(--glass-line); border-radius: 14px; margin: 8px; }
:root[data-theme="light"] .user-panel { background: rgba(0, 0, 0, .03); }
.voice-bar { background: transparent; border-top: 0; margin: 0 8px; padding: 10px; border-radius: 14px; background: linear-gradient(135deg, rgba(63, 176, 106, .14), rgba(63, 176, 106, .03)); border: 1px solid rgba(63, 176, 106, .25); }

@media (min-width: 760px) {
  .app { padding: 10px; gap: 10px; grid-template-columns: 60px 256px minmax(0, 1fr); }
  .sidebar, .chat { border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
  :root[data-theme="light"] .sidebar, :root[data-theme="light"] .chat { box-shadow: 0 10px 40px rgba(20, 40, 40, .08); }
  .rail { padding: 4px 0; gap: 10px; }
}
@media (min-width: 1100px) {
  .members { margin: 10px 10px 10px 0; border-radius: 16px; background: rgba(255, 255, 255, .025); border: 1px solid var(--glass-line); }
  :root[data-theme="light"] .members { background: rgba(0, 0, 0, .02); }
}

/* Rail: rounded tiles with a glowing ring, no morphing circles */
.rail-btn { width: 46px; height: 46px; border-radius: 15px; background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-line); }
:root[data-theme="light"] .rail-btn { background: rgba(255, 255, 255, .8); }
.rail-btn:hover, .rail-btn.active { border-radius: 15px; }
.rail-btn::before { left: auto; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50%; transform: none; background: var(--accent-b); }
.rail-btn::before { height: 0; width: 0; }
.rail-btn.unread::before { height: 10px; width: 10px; box-shadow: 0 0 0 3px var(--bg0), 0 0 10px var(--accent-b); }
.rail-btn:hover::before { height: 0; width: 0; }
.rail-btn.unread:hover::before { height: 10px; width: 10px; }
.rail-btn.active::before { height: 0; width: 0; }
.rail-btn.active { box-shadow: 0 0 0 2px var(--bg0), 0 0 0 4px var(--accent-a), 0 0 22px rgba(47, 195, 212, .35); }
.rail-btn.group:hover, .rail-btn.group.active { background: linear-gradient(145deg, hsl(var(--h, 190) 45% 42%), hsl(calc(var(--h, 190) + 35) 50% 28%)); }
.rail-btn.group { background: linear-gradient(145deg, hsl(var(--h, 190) 30% 22%), hsl(var(--h, 190) 30% 14%)); }
.rail-btn.group > span { color: #fff; }
:root[data-theme="light"] .rail-btn.group { background: linear-gradient(145deg, hsl(var(--h, 190) 45% 48%), hsl(var(--h, 190) 45% 36%)); }
.rail-btn.home { background: transparent; border: 0; }
.rail-btn.home img { width: 40px; height: 40px; }
.rail-btn.home:hover, .rail-btn.home.active { background: transparent; }
.rail-btn.has-img img, .rail-btn.has-img:hover img, .rail-btn.has-img.active img { border-radius: 14px; }
.rail-btn.action { color: var(--accent-a); border-style: dashed; background: transparent; }
.rail-btn.action:hover { background: var(--grad); color: #071012; border-color: transparent; }
.rail-sep { width: 26px; height: 2px; background: var(--grad); opacity: .45; }
.rail-btn .badge { box-shadow: 0 0 0 3px var(--bg0); }

/* Squircle avatars everywhere (status dot stays round) */
.avatar { border-radius: 34%; }
.avatar.huge, .avatar.big { border-radius: 30%; }
.icon-upload.round > span:first-child { border-radius: 30%; }
.avatar .dot { border-radius: 50%; }

/* Group header + channel list */
.group-head { box-shadow: none; border-bottom: 1px solid var(--line); height: 54px; font-size: 16px; }
.group-head:not(.search-like) span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.group-head.search-like { border: 1px solid var(--glass-line); border-radius: 12px; height: 36px; margin: 10px; background: rgba(0, 0, 0, .25); }
:root[data-theme="light"] .group-head.search-like { background: rgba(0, 0, 0, .04); }
.cat { letter-spacing: .08em; font-size: 11px; }
.ch { border-radius: 10px; padding: 7px 10px; }
.ch:hover { background: rgba(255, 255, 255, .045); }
.ch.active { background: linear-gradient(90deg, rgba(47, 195, 212, .20), rgba(47, 195, 212, .03)); box-shadow: inset 3px 0 0 var(--accent-a); color: var(--ink); }
:root[data-theme="light"] .ch.active { background: linear-gradient(90deg, rgba(19, 143, 161, .15), rgba(19, 143, 161, .02)); }
.ch.active i { color: var(--accent-a); }
.ch.unread::before { left: -6px; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent-b); }
.ch.voice > i:first-child { color: var(--accent-b); opacity: .85; }

/* Chat header */
.chat-head { height: 56px; box-shadow: none; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent); }
.chat-head-icon { width: 30px; height: 30px; border-radius: 10px; background: rgba(47, 195, 212, .12); color: var(--accent-a); place-items: center; }
.chat-head h3 { font-size: 17px; }
.head-divider { background: var(--line); }

/* Messages */
.msg { margin: 0 10px; border-radius: 12px; padding-left: 62px; }
.msg .avatar { left: 10px; }
.msg .side-time { width: 54px; }
.msg:hover, :root[data-theme="light"] .msg:hover { background: rgba(255, 255, 255, .03); }
:root[data-theme="light"] .msg:hover { background: rgba(0, 0, 0, .025); }
.msg.mention-me { background: linear-gradient(90deg, rgba(232, 176, 58, .12), rgba(232, 176, 58, .02)); box-shadow: inset 3px 0 0 var(--accent-b); }
.reply-preview::before { left: -34px; width: 26px; }
.day { margin: 22px 20px 8px; }
.day::before, .day::after { background: linear-gradient(90deg, transparent, var(--line), transparent); }
.day { color: var(--muted); }
.msg-tools { border-radius: 12px; background: var(--glass), var(--float); border: 1px solid var(--glass-line); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); right: 14px; }
.reaction { border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-line); }
.reaction.mine { background: linear-gradient(135deg, rgba(47, 195, 212, .22), rgba(232, 176, 58, .14)); border-color: rgba(47, 195, 212, .6); }
.att-img, .att-video { border-radius: 14px; border: 1px solid var(--glass-line); }
.att-file { border-radius: 14px; background: rgba(255, 255, 255, .03); }
.mention { background: rgba(47, 195, 212, .16); color: #7fdbe6; border-radius: 6px; }
.channel-welcome .big-icon { border-radius: 22px; background: linear-gradient(145deg, rgba(47, 195, 212, .25), rgba(232, 176, 58, .15)); color: #fff; border: 1px solid var(--glass-line); }
:root[data-theme="light"] .channel-welcome .big-icon { color: var(--brand-2); }
.channel-welcome h2 { background: linear-gradient(90deg, var(--ink), var(--accent-a)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Composer: floating capsule with a gradient send button */
.composer { padding: 0 18px 4px; }
.composer-box { border-radius: 18px; background: rgba(255, 255, 255, .045); border: 1px solid var(--glass-line); padding: 4px 6px 4px 6px; align-items: flex-end; transition: border-color .15s, box-shadow .15s; }
:root[data-theme="light"] .composer-box { background: #fff; }
.composer-box:focus-within { border-color: rgba(47, 195, 212, .55); box-shadow: 0 0 0 4px rgba(47, 195, 212, .10); }
.attach-btn, .emoji-btn { border-radius: 12px; }
.send { width: 38px; height: 38px; border-radius: 13px; background: rgba(255, 255, 255, .06); color: var(--muted); margin: 2px 0; transition: .15s; }
.composer.has-text .send, :root:not([data-theme="light"]) .composer.has-text .send { background: var(--grad); color: #061013; box-shadow: 0 6px 18px rgba(47, 195, 212, .3); }
.reply-bar, .attach-tray { border-radius: 14px 14px 0 0; border: 1px solid var(--glass-line); border-bottom: 0; }

/* Buttons, inputs, dialogs */
.primary { background: var(--grad); color: #061013; border-radius: 10px; font-weight: 700; }
.primary:hover { background: var(--grad); filter: brightness(1.08); }
.primary.danger-fill { background: linear-gradient(135deg, #f0705a, #c8452d); color: #fff; }
.secondary { border-radius: 10px; border: 1px solid var(--glass-line); }
.chip.active, .seg button.active { background: var(--grad); color: #061013; }
.seg button { border-radius: 10px; }
label input, label textarea, .prefixed, .copy-row, select { border-radius: 10px; border: 1px solid var(--glass-line); background: rgba(0, 0, 0, .25); }
:root[data-theme="light"] label input, :root[data-theme="light"] label textarea, :root[data-theme="light"] .prefixed, :root[data-theme="light"] .copy-row, :root[data-theme="light"] select { background: rgba(0, 0, 0, .03); }
.prefixed input { border: 0; }
dialog { border-radius: 22px; background: var(--glass), var(--side); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
.dlg-foot { background: rgba(0, 0, 0, .2); border-radius: 0 0 22px 22px; border-top: 1px solid var(--line); }
:root[data-theme="light"] .dlg-foot { background: rgba(0, 0, 0, .03); }
.tabs button.active { border-bottom-color: var(--accent-a); }
.popover { border-radius: 18px; background: var(--glass), var(--float); }
.profile-card-big .banner { height: 72px; background: linear-gradient(135deg, hsl(var(--h, 190) 50% 30%), #050607 85%); }
.profile-card-big > .avatar { top: 26px; box-shadow: 0 0 0 5px var(--float); }
.group-menu { border-radius: 14px; background: var(--glass), var(--float); }
.group-menu button { border-radius: 8px; }
.group-menu button:hover { background: rgba(47, 195, 212, .18); color: var(--ink); }
.member { border-radius: 10px; }
.badge { background: linear-gradient(135deg, #ff6a55, #e0483c); }
.live { background: linear-gradient(135deg, #ff6a55, #e0483c); }
.stage { background: rgba(0, 0, 0, .35); border-bottom: 1px solid var(--line); }
.tile { border-radius: 14px; border: 1px solid var(--glass-line); }
.auth { background: var(--page); }
.auth-card { background: var(--glass), var(--side); border: 1px solid var(--glass-line); border-radius: 24px; }
.wordmark span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 759px) {
  .rail { background: #07090b; border-right: 1px solid var(--line); }
  .sidebar { background: #0c0f12; border-radius: 0 18px 18px 0; }
  :root[data-theme="light"] .rail { background: #e4ebea; }
  :root[data-theme="light"] .sidebar { background: #f6f8f8; }
  .chat { border: 0; }
  .msg { margin: 0 4px; padding-left: 58px; }
  .msg .avatar { left: 8px; }
  .composer { padding: 0 8px calc(4px + env(safe-area-inset-bottom)); }
}
@media (max-width: 1099px) {
  .members { background: #0c0f12; }
  :root[data-theme="light"] .members { background: #f6f8f8; }
}
.rail-btn.dm { padding: 0; border: 0; background: transparent; }
.rail-btn.dm .avatar { width: 46px; height: 46px; border-radius: 15px; font-size: 15px; }

/* ===================== Round 3: safety, pins, search, voice settings ===================== */
/* Checkbox rows */
label.check { display: flex; align-items: flex-start; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); font-weight: 400; cursor: pointer; padding: 6px 0; }
label.check input { appearance: auto; width: 18px; height: 18px; margin: 2px 0 0; padding: 0; flex-shrink: 0; accent-color: var(--accent-a); border: 0; background: none; }
label.check span { display: grid; gap: 2px; }
label.check b { font-weight: 600; }
label.check small { color: var(--muted); font-size: 12.5px; }
select { color: var(--ink); padding: 8px 10px; font: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 400; }
:lang(km) label { text-transform: none; letter-spacing: 0; }

/* Sign up: username or phone */
#signup-with { margin-bottom: 4px; }
.auth-card label small { margin-top: -2px; }

/* Header: pins + search */
.head-search { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 10px; background: rgba(0, 0, 0, .25); border: 1px solid var(--glass-line); color: var(--muted); width: 190px; transition: width .2s, border-color .15s; flex-shrink: 0; }
:root[data-theme="light"] .head-search { background: rgba(0, 0, 0, .04); }
.head-search:focus-within { width: 260px; border-color: rgba(47, 195, 212, .55); }
.head-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 13.5px; outline: none; }
.head-search input::-webkit-search-cancel-button { filter: grayscale(1); }
#head-pins.on, .app.side-open #head-pins:hover { color: var(--accent-a); }

/* Side panel (pins / search results) */
.side-panel { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: rgba(0, 0, 0, .12); }
.side-panel[hidden] { display: none; }
.app.side-open .members { display: none !important; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--line); color: var(--accent-a); }
.side-head strong { flex: 1; color: var(--ink); font-size: 15px; }
.side-scope { padding: 10px 12px 0; }
.seg.small button { padding: 6px; font-size: 12.5px; }
.side-list { flex: 1; overflow-y: auto; padding: 10px 12px 16px; display: grid; align-content: start; gap: 8px; scrollbar-width: thin; }
.side-empty, .side-count { color: var(--muted); font-size: 13px; margin: 6px 4px; }
.side-count { font-size: 12px; }
.result { border: 1px solid var(--glass-line); border-radius: 14px; padding: 10px 12px; background: rgba(255, 255, 255, .03); display: grid; gap: 6px; position: relative; }
:root[data-theme="light"] .result { background: #fff; }
.result-head { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.result-head .avatar.tiny { width: 20px; height: 20px; font-size: 9px; position: static; }
.result-head .uname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-head time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.result-ch { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.result-body { font-size: 14px; line-height: 1.45; color: var(--ink-2); overflow-wrap: anywhere; max-height: 9em; overflow: hidden; }
.result-acts { display: flex; gap: 6px; justify-content: flex-end; }
.result-acts .secondary.small { padding: 4px 12px; }
.result-acts .icon-btn { width: 28px; height: 28px; }

/* Pinned messages + jump back */
.pin-flag { display: flex; align-items: center; gap: 4px; color: var(--accent-b); font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.msg.pinned { box-shadow: inset 3px 0 0 rgba(232, 176, 58, .6); }
.msg-tools .icon-btn.on { color: var(--accent-b); }
.chat-main { position: relative; }
.jump-present { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; background: var(--grad); color: #061013; font-weight: 700; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); border: 0; cursor: pointer; }
.jump-present[hidden] { display: none; }

/* Messages from blocked people */
.msg.blocked-msg { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; font-style: italic; padding-top: 6px; padding-bottom: 6px; }
.msg.blocked-msg .link { font-style: normal; }

/* Risky links */
.msg-body a.risky, .result-body a.risky { color: #ff8a73; text-decoration: underline wavy rgba(255, 106, 85, .7); text-underline-offset: 3px; }
.msg-body a.risky i, .result-body a.risky i { display: inline-block; vertical-align: -3px; margin-right: 2px; }
.msg-body a.risky svg, .result-body a.risky svg { width: 15px; height: 15px; }
#dlg-link .link-host code { display: inline-block; font-size: 17px; font-weight: 700; padding: 8px 12px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--glass-line); word-break: break-all; }
:root[data-theme="light"] #dlg-link .link-host code { background: rgba(0, 0, 0, .05); }
#dlg-link .link-reasons { margin: 0; padding-left: 20px; color: #ff9b86; font-size: 14px; display: grid; gap: 4px; }
#dlg-link .link-reasons:empty { display: none; }
#dlg-link #link-full { word-break: break-all; font-size: 12px; }
#dlg-link.risky h2 { color: #ff8a73; }
#dlg-link.risky .dlg { border-top: 3px solid #e0483c; }
.btn-like { display: inline-flex; align-items: center; justify-content: center; padding: 9px 18px; text-decoration: none; font-weight: 700; font-size: 14px; }
.btn-like.secondary.danger { color: #ff8a73; }

/* Composer notes: slow mode, read-only, timeout */
.composer-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--accent-b); padding: 4px 8px 6px; }
.composer-note[hidden] { display: none; }
.composer.locked .composer-box { opacity: .55; }
.composer.locked .composer-note { color: #ff8a73; }

/* Members: timed out */
.timeout-icon { color: #ff8a73; display: inline-grid; margin-left: 2px; }
.timeout-note { margin: 0 0 6px; color: #ff8a73; font-size: 13px; }

/* Profile: volume + block */
.volume-row { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink-2); margin: 2px 0 8px; }
.volume-row input[type=range] { flex: 1; accent-color: var(--accent-a); padding: 0; border: 0; background: none; min-width: 0; }
.vol-val { width: 38px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.block-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); }
.block-btn.danger { color: #ff8a73; }
.pactions { display: grid; gap: 4px; }
.manage-row .acts .role-select { max-width: 130px; }

/* Voice: push to talk */
.voice-actions { display: flex; gap: 6px; margin-top: 8px; }
.voice-actions > button { flex: 1; margin: 0; }
.ptt-btn { user-select: none; -webkit-user-select: none; touch-action: none; }
.ptt-btn.on { background: linear-gradient(135deg, rgba(63, 176, 106, .5), rgba(63, 176, 106, .25)); color: #fff; border-color: rgba(63, 176, 106, .8); }
.ptt-key { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); margin: -2px 0 4px 28px; }
.ptt-key[hidden] { display: none; }
.ptt-key button { min-width: 48px; font-family: ui-monospace, monospace; }

/* Settings: security */
.pw-change { border: 1px solid var(--glass-line); border-radius: 12px; padding: 10px 12px; }
.pw-change summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink); }
.pw-change[open] { display: grid; gap: 10px; }
.pw-change[open] summary { margin-bottom: 4px; }
.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--ink-2); }

/* Activity log */
.audit-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.audit-row .avatar.tiny { width: 22px; height: 22px; font-size: 9px; position: static; }
.audit-row > i { color: var(--accent-b); }
.audit-row time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.audit-text { color: var(--ink-2); overflow-wrap: anywhere; }
.audit-text strong { color: var(--ink); }
.tabs { flex-wrap: wrap; }
.text-only { display: grid; gap: 12px; }
.text-only[hidden] { display: none; }

@media (max-width: 1099px) {
  .side-panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; width: min(360px, 100vw); background: #0c0f12; box-shadow: var(--shadow); }
  :root[data-theme="light"] .side-panel { background: #f6f8f8; }
  .head-search { width: 150px; }
  .head-search:focus-within { width: 200px; }
}
@media (max-width: 759px) {
  .head-search { display: none; position: absolute; left: 8px; right: 8px; top: 10px; width: auto !important; height: 38px; z-index: 6; background: var(--float); }
  .app.searching .head-search { display: flex; }
  .side-panel { width: 100vw; padding-top: env(safe-area-inset-top); }
  .chat-head { position: relative; }
  .jump-present { bottom: 84px; }
}
@media (min-width: 1100px) {
  .side-panel { margin: 10px 10px 10px 0; border-radius: 16px; border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .025); }
}
