/* Citrus — design tokens and components (docs/DESIGN.md) */
:root,
:root[data-theme="dark"] {
  --bg-rail: #0F1114;
  --bg-sidebar: #16191D;
  --bg-main: #1C2026;
  --bg-elevated: #252A31;
  --bg-overlay: #2E343C;
  --border: #2A3038;
  --text: #EEF1F4;
  --text-2: #A9B1BC;
  --text-muted: #8C95A1;
  --accent: #FF9F1C;
  --accent-hover: #FFB347;
  --accent-press: #E88A0C;
  --accent-soft: rgba(255, 159, 28, .14);
  --accent-text: var(--accent);
  --on-accent: #1A1206;
  --lime: #8BD346;
  --lime-text: var(--lime);
  --yellow: #FFC93C;
  --red: #F25F5C;
  --link: #6CB4FF;
  --speaking-ring: 0 0 0 2px var(--bg-main), 0 0 0 4px var(--lime);
  --status-hole: var(--bg-sidebar);
  --hover: rgba(255, 255, 255, .045);
  --scrim: rgba(5, 6, 8, .62);
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 120ms;
  --t-med: 180ms;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Outfit", "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg-rail: #EDE6D9;
  --bg-sidebar: #F5F0E6;
  --bg-main: #FFFBF2;
  --bg-elevated: #EFE8DA;
  --bg-overlay: #FFFFFF;
  --border: #E2D9C8;
  --text: #1A1D21;
  --text-2: #4A525C;
  --text-muted: #636A73;
  --accent: #F28C00;
  --accent-hover: #FF9F1C;
  --accent-press: #D97C00;
  --accent-soft: rgba(242, 140, 0, .14);
  --accent-text: #A35500;
  --lime-text: #36701A;
  --red: #C23532;
  --hover: rgba(60, 40, 10, .05);
  --scrim: rgba(40, 30, 15, .42);
  --shadow: 0 8px 24px rgba(60, 40, 10, .16);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; touch-action: manipulation; }
body {
  background: var(--bg-main);
  color: var(--text);
  font: 500 14px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .5; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; }
h2 { font-size: 24px; font-weight: 700; margin-bottom: 16px; }
h3 { font-size: 16px; font-weight: 700; margin: 28px 0 12px; color: var(--text); }
kbd {
  font: 400 12px var(--font-mono); background: var(--bg-elevated); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: var(--r-sm); padding: 2px 7px; color: var(--text-2);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.mono { font-family: var(--font-mono); font-weight: 400; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.lime-text { color: var(--lime-text); font-weight: 700; }
.red-text { color: var(--red); font-weight: 700; }
.icon { flex-shrink: 0; display: block; }
.logo { display: inline-flex; line-height: 0; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--bg-overlay) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--bg-overlay); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

.wordmark {
  font: 800 28px/1 var(--font-head); letter-spacing: -0.03em; color: var(--text);
}
.wordmark.big { font-size: 44px; }
.wordmark .dot { color: var(--accent); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px; border-radius: var(--r-md);
  font-weight: 700; font-size: 14px; background: var(--bg-elevated); color: var(--text);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), color var(--t-fast);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg-overlay); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.primary:active:not(:disabled) { background: var(--accent-press); }
.btn.secondary { background: var(--bg-overlay); }
.btn.success { background: var(--lime); color: #142006; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--red); }
.btn.danger.ghost:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.big { min-height: 48px; padding: 0 28px; font-size: 16px; }
.btn.block { width: 100%; }
.link-btn { color: var(--text-muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { color: var(--text); }

.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--text-2); flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--text); background: var(--hover); }
.icon-btn.off { color: var(--red); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }

.round-btn {
  width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-overlay); color: var(--text); transition: background var(--t-fast), transform var(--t-fast) var(--ease);
}
.round-btn:hover { background: color-mix(in srgb, var(--bg-overlay) 70%, var(--text) 12%); transform: translateY(-1px); }
.round-btn.off { background: color-mix(in srgb, var(--red) 22%, var(--bg-overlay)); color: var(--red); }
.round-btn.active { background: var(--accent); color: var(--on-accent); }
.round-btn.danger { background: var(--red); color: #fff; }
.round-btn.success { background: var(--lime); color: #142006; }
.round-btn.wide { width: 72px; border-radius: 26px; }
.round-icon {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); color: var(--text-2);
}
.round-icon:hover { color: var(--text); background: var(--bg-overlay); }
.round-icon.success:hover { color: var(--lime-text); }
.round-icon.danger:hover { color: var(--red); }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff;
  font: 800 11px/18px var(--font-ui); text-align: center; flex-shrink: 0;
}
.live-badge {
  background: var(--red); color: #fff; font: 800 11px/1 var(--font-ui); letter-spacing: .04em;
  padding: 3px 6px; border-radius: var(--r-sm);
}
.live-badge.small { font-size: 9px; padding: 2px 4px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block; flex-shrink: 0;
  border: 2.5px solid color-mix(in srgb, var(--text) 18%, transparent); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner.dark { border-color: rgba(26, 18, 6, .25); border-top-color: var(--on-accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- inputs */
.input {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--r-md);
  background: var(--bg-rail); border: 1px solid var(--border); color: var(--text); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
:root[data-theme="light"] .input { background: #FFFFFF; }
.input::placeholder { color: var(--text-muted); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.invalid { border-color: var(--red); }
.input.slim { min-height: 30px; padding: 5px 10px; font-size: 13px; border-radius: var(--r-sm); }
textarea.input { resize: vertical; line-height: 1.45; }
select.input { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238C95A1' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; display: flex; gap: 6px; align-items: center; }
.field-error { color: var(--red); font-size: 13px; font-weight: 600; }
.field-hint { color: var(--text-muted); font-size: 12px; }
.form-error { color: var(--red); font-weight: 600; font-size: 13px; margin: 4px 0 14px; }
.form-ok { color: var(--lime-text); font-weight: 600; font-size: 13px; margin: 4px 0 14px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-icon { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); border-radius: var(--r-sm); }
.input-icon:hover { color: var(--text); }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-prefix .input { padding-left: 36px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.copy-row { display: flex; gap: 8px; }
.row-gap { display: flex; gap: 8px; align-items: center; }
.form-grid { display: grid; gap: 0 16px; max-width: 420px; }
.form-grid.two { grid-template-columns: 1fr 1fr; max-width: none; }

.toggle {
  width: 42px; height: 24px; border-radius: 12px; background: var(--bg-overlay); position: relative; flex-shrink: 0;
  transition: background var(--t-med) var(--ease);
  border: 1px solid var(--border);
}
.toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; color: var(--accent-press);
  transition: transform var(--t-med) var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on .toggle-knob { transform: translateX(18px); }
.toggle-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-text { flex: 1; min-width: 0; }
.toggle-label { font-weight: 700; }
.toggle-hint { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.segmented { display: inline-flex; background: var(--bg-rail); border: 1px solid var(--border); border-radius: var(--r-md); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg { padding: 7px 14px; border-radius: 7px; font-weight: 700; color: var(--text-2); transition: background var(--t-fast), color var(--t-fast); }
.seg:hover { color: var(--text); }
.seg.active { background: var(--accent); color: var(--on-accent); }

.checkbox, .radio { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--text-muted); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--on-accent); }
.radio { border-radius: 50%; }
.checkbox.on { background: var(--accent); border-color: var(--accent); }
.radio.on { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--bg-overlay), inset 0 0 0 10px var(--accent); }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--text); margin: 12px 0; }
.notice.error { background: color-mix(in srgb, var(--red) 14%, transparent); }
.notice p { margin: 4px 0 0; color: var(--text-2); }

/* ---------------------------------------------------------------- avatars */
.avatar { position: relative; border-radius: 50%; flex-shrink: 0; transition: box-shadow var(--t-fast); }
.avatar img, .avatar-fallback { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-fallback { display: flex; align-items: center; justify-content: center; color: #1A1206; font-weight: 800; font-family: var(--font-head); user-select: none; }
.avatar.speaking { box-shadow: var(--speaking-ring); }
.avatar-status { position: absolute; right: -2px; bottom: -2px; border-radius: 50%; background: var(--status-hole); padding: 2px; line-height: 0; }
.status-glyph { display: block; }
.st-online { fill: var(--lime); }
.st-idle { fill: var(--yellow); }
.st-dnd { fill: var(--red); }
.st-offline { fill: var(--text-muted); }
.server-icon { border-radius: 16px; overflow: hidden; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-abbr { font: 700 16px var(--font-head); color: var(--text); }
.group-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ------------------------------------------------------------------ login */
.auth-bg { position: fixed; inset: 0; background: var(--bg-rail); display: flex; align-items: center; justify-content: center; overflow: auto; padding: 24px 16px; }
.auth-slice { position: fixed; right: -180px; bottom: -200px; opacity: .08; filter: blur(6px); pointer-events: none; transform: rotate(-12deg); }
.auth-card { position: relative; width: 420px; max-width: 100%; background: var(--bg-sidebar); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 24px; }
.auth-title { font-size: 24px; text-align: center; }
.auth-sub { text-align: center; color: var(--text-2); margin: 6px 0 24px; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.auth-switch a { color: var(--accent-text); font-weight: 700; }
.auth-server-toggle { margin-top: 10px; }
.auth-lang { margin-top: 18px; display: flex; justify-content: center; }
.server-ok { color: var(--lime-text); text-transform: none; }
.server-bad { color: var(--red); text-transform: none; }

.splash { position: fixed; inset: 0; background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.splash-logo { animation: bob 1.6s var(--ease) infinite; }
.splash-text { color: var(--text-2); }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }

/* ----------------------------------------------------------------- layout */
.app { height: 100%; display: flex; flex-direction: column; touch-action: manipulation; }
.app-body { flex: 1; display: flex; min-height: 0; }
.nav-col { display: flex; flex-shrink: 0; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-main); position: relative; }
.mobile-only { display: none !important; }
.mobile-scrim { display: none; }
.conn-banner { background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13px; padding: 6px 12px; display: flex; gap: 10px; align-items: center; justify-content: center; }
.conn-banner .spinner { width: 14px; height: 14px; border-color: rgba(26, 18, 6, .25); border-top-color: var(--on-accent); }

/* rail */
.rail { width: 72px; background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-servers { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.rail-item { position: relative; width: 72px; display: flex; justify-content: center; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); color: var(--text); overflow: hidden;
  transition: border-radius var(--t-med) var(--ease), transform var(--t-med) var(--ease), background var(--t-med);
}
.rail-btn .server-icon { border-radius: inherit; }
.rail-btn.dm { background: none; border-radius: 50%; }
.rail-item:hover .rail-btn, .rail-item.active .rail-btn { border-radius: 14px; transform: translateY(-1px); }
.rail-btn.home { background: var(--bg-elevated); }
.rail-item.active .rail-btn.home { background: var(--accent-soft); }
.rail-btn.add { color: var(--lime); }
.rail-item:hover .rail-btn.add { background: var(--lime); color: #142006; }
.rail-pill { position: absolute; left: 0; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--accent); transform: translateY(-50%); transition: height var(--t-med) var(--ease); }
.rail-item.unread .rail-pill { height: 8px; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.active .rail-pill { height: 40px; }
.rail-badge { position: absolute; right: 8px; bottom: -2px; box-shadow: 0 0 0 3px var(--bg-rail); pointer-events: none; }
.rail-voice { position: absolute; right: 9px; bottom: -2px; background: var(--lime); color: #142006; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--bg-rail); }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--border); margin: 2px 0; flex-shrink: 0; }
.rail-item.drop-over::before { content: ""; position: absolute; top: -5px; left: 16px; right: 16px; height: 3px; border-radius: 2px; background: var(--accent); }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: fixed; left: 78px; margin-top: 10px; z-index: 50; pointer-events: none;
  background: var(--bg-overlay); color: var(--text); padding: 7px 11px; border-radius: var(--r-md);
  font-weight: 700; box-shadow: var(--shadow); white-space: nowrap; animation: pop var(--t-fast) var(--ease);
}
.rail-item[data-tooltip]:hover::after { top: auto; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

/* sidebar */
.sidebar { width: 240px; background: var(--bg-sidebar); display: flex; flex-direction: column; min-height: 0; }
.side-header { height: 48px; flex-shrink: 0; display: flex; align-items: center; padding: 0 10px; border-bottom: 1px solid var(--border); gap: 8px; }
.server-header { padding: 0 14px; cursor: pointer; transition: background var(--t-fast); }
.server-header:hover { background: var(--hover); }
.server-name { flex: 1; font: 700 16px var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 16px; min-height: 0; }
.side-empty { color: var(--text-muted); padding: 16px 8px; text-align: center; font-size: 13px; }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--r-md); color: var(--text-2); font-weight: 700; margin-bottom: 4px; }
.side-link span { flex: 1; text-align: left; }
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--text); }
.side-section { display: flex; align-items: center; justify-content: space-between; padding: 16px 4px 4px 10px; color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.side-section .icon-btn { width: 22px; height: 22px; }

.category { margin-top: 14px; }
.category-head { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 2px; color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; user-select: none; border-radius: var(--r-sm); }
.category-head:hover { color: var(--text-2); }
.category-head.drop-over { box-shadow: inset 0 -2px 0 var(--accent); }
.cat-chevron { transition: transform var(--t-fast) var(--ease); display: flex; }
.category.collapsed .cat-chevron { transform: rotate(-90deg); }
.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-add { width: 20px; height: 20px; opacity: .8; }
.channel-wrap { margin: 1px 0; }
.channel {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--r-md);
  color: var(--text-muted); cursor: pointer; user-select: none; transition: background var(--t-fast), color var(--t-fast);
}
.channel:hover { background: var(--hover); color: var(--text-2); }
.channel.active { background: var(--accent-soft); color: var(--text); }
.channel.unread { color: var(--text); font-weight: 700; }
.channel.unread::before { content: ""; position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--text); }
.channel.drop-over { box-shadow: inset 0 2px 0 var(--accent); }
.channel-icon { display: flex; color: var(--text-muted); }
.channel.active .channel-icon { color: var(--accent-text); }
.channel-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-gear { width: 22px; height: 22px; opacity: 0; }
.channel:hover .channel-gear, .channel.active .channel-gear { opacity: 1; }
.user-limit { font: 400 11px var(--font-mono); color: var(--text-muted); background: var(--bg-rail); padding: 1px 5px; border-radius: var(--r-sm); }
.voice-users { padding: 2px 0 6px 28px; display: flex; flex-direction: column; gap: 4px; }
.voice-user { display: flex; align-items: center; gap: 8px; min-height: 32px; box-sizing: border-box; padding: 4px 8px; border-radius: var(--r-sm); color: var(--text-2); cursor: pointer; font-size: 13px; }
.voice-user:hover { background: var(--hover); color: var(--text); }
.voice-user.speaking .voice-user-name { color: var(--text); }
.voice-user-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user-icons { display: flex; gap: 4px; align-items: center; color: var(--text-muted); }
.muted-ic.server { color: #fff; background: var(--red); border-radius: var(--r-sm); padding: 1px; display: inline-flex; }
/* mic / headphones disabled by a moderator: filled red, not clickable */
.icon-btn.srv, .icon-btn.srv:disabled, .round-btn.srv, .round-btn.srv:disabled { color: #fff; background: var(--red); opacity: 1; cursor: not-allowed; }

.dm-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-md); color: var(--text-muted); cursor: pointer; position: relative; margin: 1px 0; }
.dm-row:hover { background: var(--hover); color: var(--text-2); }
.dm-row.active { background: var(--accent-soft); color: var(--text); }
.dm-row.unread { color: var(--text); }
.dm-row.unread .dm-name { font-weight: 800; }
.dm-text { flex: 1; min-width: 0; }
.dm-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.dm-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-close { width: 22px; height: 22px; opacity: 0; }
.dm-row:hover .dm-close { opacity: 1; }
.dm-call { color: var(--lime-text); display: flex; }

.voice-panel { border-top: 1px solid var(--border); padding: 10px 10px 8px; background: var(--bg-sidebar); }
.voice-panel-top { display: flex; align-items: center; gap: 8px; }
.voice-status { flex: 1; min-width: 0; cursor: pointer; }
.voice-conn { display: flex; align-items: center; gap: 6px; color: var(--lime-text); font-weight: 800; font-size: 14px; }
.voice-conn.connecting { color: var(--accent-text); }
.voice-conn.failed { color: var(--red); }
.ping { font: 400 11px var(--font-mono); color: var(--text-muted); margin-left: auto; }
.voice-place { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.voice-status:hover .voice-place { text-decoration: underline; }
.voice-panel-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.vp-btn { height: 32px; border-radius: var(--r-md); background: var(--bg-elevated); color: var(--text-2); display: flex; align-items: center; justify-content: center; transition: background var(--t-fast), color var(--t-fast); }
.vp-btn:hover { background: var(--bg-overlay); color: var(--text); }
.vp-btn.on { background: var(--accent); color: var(--on-accent); }

.user-panel { position: relative; height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 2px; padding: 0 8px; background: color-mix(in srgb, var(--bg-rail) 55%, var(--bg-sidebar)); }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: var(--r-md); text-align: left; }
.user-chip:hover { background: var(--hover); }
.user-chip-text { min-width: 0; }
.user-chip-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* popovers & menus */
.popover { background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: pop var(--t-fast) var(--ease); }
.status-menu { position: absolute; bottom: 62px; left: 8px; width: 260px; padding: 8px; z-index: 40; }
.status-custom { padding: 4px 4px 8px; }
.status-opt { width: 100%; display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: var(--r-md); text-align: left; }
.status-opt:hover { background: var(--hover); }
.status-opt-label { font-weight: 700; }
.status-opt-hint { font-size: 12px; color: var(--text-muted); }
.ctx-menu { position: fixed; z-index: 100; min-width: 200px; max-width: 280px; padding: 6px; border-radius: var(--r-md); max-height: 80vh; overflow-y: auto; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; text-align: left; }
.menu-item:hover { background: var(--accent); color: var(--on-accent); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: var(--red); color: #fff; }
.menu-label { flex: 1; }
.menu-check { width: 18px; height: 18px; border-radius: 5px; border: 2px solid currentColor; display: flex; align-items: center; justify-content: center; }
.menu-check.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.menu-slider { padding: 8px 10px; }
.menu-slider-label { display: flex; justify-content: space-between; font-weight: 600; color: var(--text-2); margin-bottom: 6px; font-size: 13px; }

.popout { position: fixed; z-index: 90; width: 300px; overflow: hidden; }
.popout-banner { height: 64px; }
.popout-avatar { position: absolute; top: 20px; left: 16px; border-radius: 50%; padding: 5px; background: var(--bg-overlay); }
.popout-avatar .avatar-status { background: var(--bg-overlay); }
.popout-body { padding: 52px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.popout-name { font: 700 20px var(--font-head); }
.popout-username { color: var(--text-2); margin-top: -6px; }
.popout-status { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); }
.popout-custom { background: var(--bg-elevated); padding: 8px 10px; border-radius: var(--r-md); }
.popout-sep { height: 1px; background: var(--border); margin: 4px 0; }
.popout-section { font-size: 13px; }
.popout-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 4px; }
.role-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.role-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-elevated); border-radius: var(--r-sm); padding: 2px 8px; font-size: 12px; font-weight: 600; }
.role-pill i { width: 10px; height: 10px; border-radius: 50%; }

/* ------------------------------------------------------------------- chat */
.chat, .friends, .voice-view { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.chat-header { height: 48px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-main); z-index: 2; }
.chat-header-icon { color: var(--text-muted); display: flex; }
.chat-title { font: 700 16px var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 40%; }
.chat-topic { color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; border-left: 1px solid var(--border); padding-left: 10px; }
.chat-header-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.search-box { position: relative; width: 180px; margin-left: 6px; transition: width var(--t-med) var(--ease); }
.search-box:focus-within { width: 240px; }
.search-box .input { padding-right: 28px; background: var(--bg-rail); }
.search-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.message-scroller { flex: 1; overflow-y: auto; overflow-x: hidden; overflow-anchor: none; }
.message-list { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; padding-bottom: 8px; }
.list-end { height: 4px; }
.history-more { height: 40px; }

.channel-start { padding: 32px 16px 16px; }
.channel-start h2 { font-size: 32px; margin: 12px 0 6px; }
.channel-start p { color: var(--text-2); margin: 0; }
.channel-start-icon { width: 68px; height: 68px; border-radius: 50%; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; color: var(--text); }
.empty-hint { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--text-2); background: var(--bg-elevated); border-radius: var(--r-md); padding: 10px 14px; width: fit-content; }

.msg-skeletons { padding: 16px; display: flex; flex-direction: column; gap: 22px; }
.msg-skeleton { display: flex; gap: 14px; }
.msg-skeleton > span { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-elevated); }
.msg-skeleton div { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.msg-skeleton i, .msg-skeleton b { display: block; height: 12px; border-radius: 6px; background: var(--bg-elevated); }
.msg-skeleton i { width: 120px; }
.msg-skeleton b { width: var(--w); height: 14px; }
.msg-skeleton i, .msg-skeleton b, .msg-skeleton > span { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.day-divider { display: flex; align-items: center; margin: 16px 16px 4px; color: var(--text-muted); font-size: 12px; font-weight: 700; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.day-divider span { padding: 0 8px; }
.new-divider { display: flex; align-items: center; margin: 8px 16px 0; height: 0; border-top: 1px solid var(--red); position: relative; }
.new-divider span { position: absolute; right: 0; top: -9px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; text-transform: uppercase; padding: 1px 6px; border-radius: 0 var(--r-sm) var(--r-sm) 0; letter-spacing: .04em; }

.message { position: relative; padding: 2px 72px 2px 16px; margin-top: 14px; transition: background var(--t-fast); }
.message.grouped { margin-top: 0; }
.message:hover { background: color-mix(in srgb, var(--bg-elevated) 40%, transparent); }
.message.mention { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.message.mention:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.message.pending .message-text { color: var(--text-muted); }
.message.failed .message-text { color: var(--red); }
.message.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 26%, transparent); } }
.message-inner { display: flex; gap: 16px; }
.message-gutter { width: 40px; flex-shrink: 0; display: flex; justify-content: center; }
.avatar-btn { border-radius: 50%; height: 40px; margin-top: 2px; }
.avatar-btn:active { transform: translateY(1px); }
.hover-time { visibility: hidden; font-size: 11px; color: var(--text-muted); line-height: 22px; white-space: nowrap; }
.message:hover .hover-time { visibility: visible; }
.message-content { flex: 1; min-width: 0; }
.message-head { display: flex; align-items: baseline; gap: 8px; }
.author { font-weight: 700; font-size: 15px; color: var(--text); }
.author:hover { text-decoration: underline; }
.msg-time { font-size: 12px; color: var(--text-muted); }
.message-text { font-size: 15px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.message-text.jumbo { font-size: 44px; line-height: 1.15; }
.edited { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.msg-failed { color: var(--red); font-size: 12px; font-weight: 600; }
.reply-ref { display: flex; align-items: center; gap: 6px; margin-left: 56px; font-size: 13px; color: var(--text-2); cursor: pointer; position: relative; min-width: 0; padding-top: 2px; }
.reply-spine { position: absolute; left: -36px; top: 10px; width: 30px; height: 12px; border-left: 2px solid var(--border); border-top: 2px solid var(--border); border-top-left-radius: 6px; }
.reply-name { font-weight: 700; color: var(--text-2); white-space: nowrap; }
.reply-text { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-ref:hover .reply-text { color: var(--text); }

.md-code { font: 400 .87em var(--font-mono); background: var(--bg-elevated); border-radius: 4px; padding: .1em .35em; }
.md-codeblock { position: relative; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md); margin: 6px 0; max-width: 100%; }
.md-codeblock pre { margin: 0; padding: 10px 12px; overflow-x: auto; font: 400 13px/1.5 var(--font-mono); white-space: pre; }
.md-lang { position: absolute; top: 6px; right: 40px; font: 400 11px var(--font-mono); color: var(--text-muted); }
.md-copy { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: var(--r-sm); color: var(--text-muted); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--t-fast); }
.md-codeblock:hover .md-copy { opacity: 1; }
.md-copy:hover { background: var(--hover); color: var(--text); }
.md-quote { margin: 2px 0; padding: 0 0 0 12px; border-left: 4px solid var(--border); color: var(--text-2); }
.md-spoiler { background: var(--text-muted); color: transparent; border-radius: 4px; cursor: pointer; transition: background var(--t-fast); }
.md-spoiler * { visibility: hidden; }
.md-spoiler:hover { background: var(--text-2); }
.md-spoiler.revealed { background: var(--bg-elevated); color: inherit; cursor: text; }
.md-spoiler.revealed * { visibility: visible; }
.md-link { color: var(--link); }
.mention { background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; padding: 0 3px; font-weight: 700; cursor: pointer; }
.mention:hover { background: var(--accent); color: var(--on-accent); }

.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; align-items: flex-start; }
.att-image { display: block; max-width: min(400px, 100%); max-height: 300px; border-radius: var(--r-md); overflow: hidden; background: var(--bg-elevated); }
.att-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--t-med) var(--ease); }
.att-image:hover img { transform: scale(1.015); }
.att-video { max-width: min(480px, 100%); max-height: 320px; border-radius: var(--r-md); background: #000; }
.att-file { display: flex; align-items: center; gap: 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px; max-width: 420px; }
.att-file-icon { color: var(--accent-text); }
.att-file-text { display: flex; flex-direction: column; min-width: 0; }
.att-file-text a { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-size { font-size: 12px; color: var(--text-muted); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 8px; background: var(--bg-elevated); border: 1px solid transparent; font-size: 13px; transition: border-color var(--t-fast), background var(--t-fast); }
.reaction:hover { border-color: var(--text-muted); }
.reaction.me { background: var(--accent-soft); border-color: var(--accent); }
.reaction.me .reaction-count { color: var(--accent-text); }
.reaction-emoji { font-size: 15px; line-height: 1; }
.reaction-count { font-weight: 700; color: var(--text-2); }
.reaction.add { color: var(--text-muted); opacity: 0; }
.message:hover .reaction.add { opacity: 1; }
.msg-actions { position: absolute; right: 16px; top: -16px; display: none; background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 2px; z-index: 3; }
.message:hover .msg-actions { display: flex; }
.message.editing .msg-actions { display: none; }
.msg-action { width: 32px; height: 32px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.msg-action:hover { background: var(--hover); color: var(--text); }
.msg-action.emoji { font-size: 17px; }
.msg-picker { position: absolute; right: 16px; top: 20px; z-index: 30; }
.edit-box { margin: 4px 0; }
.edit-input { resize: none; overflow: hidden; background: var(--bg-elevated); }
.edit-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.jump-present { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 6px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 18px; box-shadow: var(--shadow); }
.typing-bar { height: 22px; padding: 0 16px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.typing-text { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: typing 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-3px); opacity: 1; } }

.composer-wrap { position: relative; padding: 0 16px 16px; flex-shrink: 0; }
.composer { position: relative; display: flex; align-items: flex-end; gap: 4px; background: var(--bg-elevated); border-radius: var(--r-md); padding: 6px 6px 6px 8px; min-height: 48px; }
.composer.disabled { opacity: .6; }
.composer-input { flex: 1; resize: none; border: 0; outline: none; background: transparent; color: var(--text); font-size: 15px; line-height: 1.45; padding: 7px 4px; max-height: 320px; min-height: 36px; }
.composer-input::placeholder { color: var(--text-muted); }
.composer-actions { display: flex; align-items: center; gap: 2px; height: 36px; }
.composer-attach { height: 36px; width: 36px; }
.composer-actions .icon-btn { width: 36px; height: 36px; }
.composer-picker { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30; }
.reply-bar { display: flex; align-items: center; justify-content: space-between; background: var(--bg-sidebar); border-radius: var(--r-md) var(--r-md) 0 0; padding: 6px 8px 6px 14px; font-size: 13px; color: var(--text-2); margin-bottom: -4px; padding-bottom: 10px; }
.pending-files { display: flex; gap: 10px; overflow-x: auto; background: var(--bg-elevated); border-radius: var(--r-md) var(--r-md) 0 0; padding: 12px; margin-bottom: -6px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.pending-file { position: relative; width: 150px; flex-shrink: 0; background: var(--bg-sidebar); border-radius: var(--r-md); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.pending-file img { width: 100%; height: 100px; object-fit: cover; border-radius: var(--r-sm); }
.pf-icon { height: 100px; display: flex; align-items: center; justify-content: center; color: var(--accent-text); }
.pf-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-size { font-size: 11px; color: var(--text-muted); }
.pf-remove { position: absolute; top: 4px; right: 4px; background: var(--bg-overlay); }
.autocomplete { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 8px); background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 6px; z-index: 20; max-height: 320px; overflow-y: auto; }
.ac-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); text-align: left; }
.ac-item.active, .ac-item:hover { background: var(--accent-soft); }
.ac-icon { color: var(--text-muted); display: flex; }
.ac-emoji { font-size: 20px; }
.ac-label { font-weight: 700; }
.ac-sub { color: var(--text-muted); font-size: 12px; margin-left: auto; }

.drop-overlay { position: absolute; inset: 0; z-index: 40; background: var(--scrim); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.drop-card { background: var(--accent); color: var(--on-accent); border-radius: var(--r-lg); padding: 28px 40px; text-align: center; box-shadow: var(--shadow); outline: 2px dashed rgba(26, 18, 6, .4); outline-offset: -10px; }
.drop-title { font: 700 20px var(--font-head); margin-top: 8px; }
.drop-sub { font-size: 13px; opacity: .85; }

.right-panel { width: 340px; flex-shrink: 0; border-left: 1px solid var(--border); background: var(--bg-sidebar); display: flex; flex-direction: column; min-height: 0; }
.rp-header { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.rp-header span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-body { flex: 1; overflow-y: auto; padding: 8px; }
.rp-count { color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 4px 6px 8px; }
.rp-loading, .rp-empty { display: flex; flex-direction: column; align-items: center; padding: 40px 12px; color: var(--text-muted); text-align: center; gap: 10px; }
.rp-msg { display: flex; gap: 10px; padding: 10px; border-radius: var(--r-md); background: var(--bg-main); margin-bottom: 6px; cursor: pointer; border: 1px solid transparent; }
.rp-msg:hover { border-color: var(--border); }
.rp-msg-body { min-width: 0; flex: 1; }
.rp-msg-head { display: flex; gap: 8px; align-items: baseline; }
.rp-msg-head time { font-size: 11px; color: var(--text-muted); }
.rp-msg-text { font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 140px; overflow: hidden; }
.rp-att { display: flex; gap: 4px; align-items: center; color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* members */
.members { width: 240px; flex-shrink: 0; background: var(--bg-sidebar); display: flex; flex-direction: column; min-height: 0; }
.members-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.member-group-title { padding: 18px 8px 4px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.member { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: var(--r-md); cursor: pointer; }
.member:hover { background: var(--hover); }
.member.offline { opacity: .45; }
.member.offline:hover { opacity: 1; }
.member-text { min-width: 0; flex: 1; }
.member-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.owner-crown { color: var(--yellow); display: flex; }
.member-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* friends */
.tabs { display: flex; gap: 4px; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 4px 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 700; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--bg-elevated); color: var(--text); }
.tab.add { background: var(--lime); color: #142006; }
.tab.add.active { background: transparent; color: var(--lime-text); }
.friends-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.list-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px 10px; }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); border-top: 1px solid var(--border); cursor: pointer; }
.friend-row:hover { background: var(--hover); border-top-color: transparent; }
.friend-text { flex: 1; min-width: 0; }
.friend-name { font-weight: 700; }
.friend-username { display: none; color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.friend-row:hover .friend-username { display: inline; }
.friend-sub { font-size: 13px; color: var(--text-muted); }
.friend-actions { display: flex; gap: 8px; }
.add-friend { max-width: 720px; }
.add-friend h2 { margin-bottom: 4px; }
.add-friend-form { display: flex; gap: 8px; margin-top: 16px; padding: 6px; background: var(--bg-rail); border: 1px solid var(--border); border-radius: var(--r-md); }
.add-friend-form .input { border: 0; background: transparent; box-shadow: none; }
.add-friend-form.ok { border-color: var(--lime); }
.add-friend-form.bad { border-color: var(--red); }
.add-result { margin-top: 8px; font-size: 13px; font-weight: 600; }
.add-result.ok { color: var(--lime-text); }
.add-result.bad { color: var(--red); }
.add-friend-art { margin-top: 64px; display: flex; flex-direction: column; align-items: center; color: var(--text-muted); }
.empty-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-2); gap: 10px; padding: 32px; }
.empty-main.small { padding: 24px; color: var(--text-muted); }
.empty-main h3 { margin: 6px 0 0; }
.empty-main p { margin: 0; max-width: 360px; }

/* ----------------------------------------------------------------- modals */
.modal-overlay { position: fixed; inset: 0; z-index: 80; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade var(--t-med) var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; width: 460px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--bg-overlay); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 24px; animation: rise var(--t-med) var(--ease); }
.modal.small { width: 420px; }
.modal.share-dialog { width: 520px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal-title { font: 700 20px var(--font-head); text-align: center; padding: 0 28px; }
.modal-sub { color: var(--text-2); text-align: center; margin: 8px 0 20px; }
.modal-title + * { margin-top: 18px; }
.modal-text { color: var(--text-2); margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.error-text { color: var(--red); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 24px -24px -24px; padding: 16px 24px; background: color-mix(in srgb, var(--bg-sidebar) 60%, var(--bg-overlay)); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal-actions.spread { justify-content: space-between; }
.center-pad { display: flex; justify-content: center; padding: 24px; }
.fine { font-size: 12px; color: var(--text-muted); margin: -4px 0 0; }
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elevated); text-align: left; transition: background var(--t-fast), border-color var(--t-fast); }
.choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.choice-text { flex: 1; font-weight: 700; font-size: 16px; }
.choice-or { text-align: center; color: var(--text-muted); font-weight: 700; margin-top: 8px; }
.icon-upload { position: relative; width: 84px; height: 84px; margin: 4px auto 20px; border-radius: 30%; border: 2px dashed var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: visible; }
.icon-upload.big { width: 108px; height: 108px; margin: 0; border-style: solid; border-color: transparent; }
.icon-upload img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.icon-upload-empty { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; }
.icon-upload-plus { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.icon-upload:hover { border-color: var(--accent); }
.type-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.type-opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-elevated); text-align: left; border: 1px solid transparent; }
.type-opt:hover { background: color-mix(in srgb, var(--bg-elevated) 80%, var(--text) 6%); }
.type-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.type-icon { color: var(--text-2); display: flex; }
.type-text { flex: 1; display: flex; flex-direction: column; }
.type-text small { color: var(--text-muted); font-size: 12px; }
.invite-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; }
.invite-by { color: var(--text-2); }
.invite-server { font: 700 22px var(--font-head); }
.invite-friends { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; max-height: 260px; overflow-y: auto; }
.invite-friend { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-md); }
.invite-friend:hover { background: var(--hover); }
.invite-friend span { flex: 1; font-weight: 700; }
.invite-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick-list { max-height: 320px; overflow-y: auto; margin-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-md); text-align: left; }
.pick-row:hover { background: var(--hover); }
.pick-name { flex: 1; font-weight: 700; }

.share-sources { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 18px; }
.share-preview { width: 100%; aspect-ratio: 16 / 7; border-radius: var(--r-md); background: var(--bg-rail); border: 1px dashed var(--border); display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; padding: 12px; text-align: center; }
.share-group { margin-bottom: 16px; }
.share-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-2); letter-spacing: .04em; margin-bottom: 8px; }
.share-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.share-dialog .segmented { display: flex; }
.share-dialog .seg { flex: 1; }

.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(5, 6, 8, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 48px 16px; animation: fade var(--t-med); }
.lightbox img { max-width: 100%; max-height: calc(100% - 56px); border-radius: var(--r-md); box-shadow: var(--shadow); }
.lightbox-bar { display: flex; align-items: center; gap: 12px; color: #EEF1F4; }
.lightbox-bar .btn { color: #EEF1F4; }
.lightbox-name { font-weight: 700; }
.lightbox-close { position: absolute; top: 12px; right: 12px; color: #EEF1F4; width: 44px; height: 44px; }

.toasts { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--bg-overlay); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--lime); padding: 10px 16px; border-radius: var(--r-md); box-shadow: var(--shadow); font-weight: 600; max-width: min(520px, calc(100vw - 32px)); animation: rise var(--t-med) var(--ease); }
.toast.error { border-left-color: var(--red); }

.ring-card { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 150; width: 260px; background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: rise var(--t-med) var(--ease); }
.ring-card .avatar { animation: ring 1.4s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 6px var(--accent-soft), 0 0 0 12px color-mix(in srgb, var(--accent) 8%, transparent); } }
.ring-name { font: 700 20px var(--font-head); margin-top: 8px; }
.ring-sub { color: var(--text-2); }
.ring-actions { display: flex; gap: 24px; margin-top: 12px; }

/* emoji picker */
.emoji-picker { width: 344px; height: 380px; display: flex; flex-direction: column; overflow: hidden; }
.ep-top { padding: 10px 10px 6px; }
.ep-cats { display: flex; gap: 2px; padding: 0 8px 6px; border-bottom: 1px solid var(--border); }
.ep-cat { width: 36px; height: 32px; border-radius: var(--r-sm); font-size: 18px; filter: grayscale(.7); opacity: .8; }
.ep-cat:hover, .ep-cat.active { filter: none; opacity: 1; background: var(--hover); }
.ep-label { padding: 8px 12px 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); letter-spacing: .04em; }
.ep-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); padding: 0 8px 8px; align-content: start; }
.ep-emoji { height: 40px; font-size: 24px; border-radius: var(--r-sm); line-height: 1; }
.ep-emoji:hover { background: var(--hover); transform: scale(1.1); }

/* -------------------------------------------------------------- voice view */
.voice-view { background: #0B0D10; }
:root[data-theme="light"] .voice-view { background: #1C2026; }
.voice-view .chat-header { background: transparent; border-color: rgba(255, 255, 255, .06); color: #EEF1F4; }
.voice-view .chat-header-icon, .voice-count { color: #A9B1BC; font-size: 13px; }
.voice-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.voice-grid { flex: 1; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 12px; align-content: center; justify-content: center; min-height: 0;
  width: min(100%, calc((100vh - 190px) / var(--rows) * 16 / 9 * var(--cols)), calc(var(--cols) * 720px)); margin: 0 auto; }
.tile {
  position: relative; aspect-ratio: 16 / 9; background: #252A31; border-radius: var(--r-lg); overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: box-shadow var(--t-fast);
  min-height: 0; max-height: 100%;
}
.tile.speaking { box-shadow: 0 0 0 3px var(--lime) inset; }
.tile.speaking .tile-avatar .avatar { box-shadow: 0 0 0 3px #252A31, 0 0 0 6px var(--lime); }
.tile.stream { background: #16191D; }
.tile.ringing { opacity: .7; }
.tile-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile-video.contain { object-fit: contain; }
.tile-video.mirror { transform: scaleX(-1); }
.tile-avatar { display: flex; }
.tile-label { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; background: rgba(15, 17, 20, .72); color: #EEF1F4; padding: 4px 8px; border-radius: var(--r-sm); font-weight: 700; font-size: 13px; max-width: calc(100% - 16px); backdrop-filter: blur(6px); }
.tile-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-ic { color: var(--red); display: flex; }
.tile-ic.server { color: #fff; background: var(--red); border-radius: var(--r-sm); padding: 1px; }
.tile-ringing { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); color: #A9B1BC; font-size: 12px; font-weight: 700; }
.tile-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity var(--t-fast); }
.tile:hover .tile-tools { opacity: 1; }
.tile-tool { width: 32px; height: 32px; border-radius: var(--r-sm); background: rgba(15, 17, 20, .72); color: #EEF1F4; display: flex; align-items: center; justify-content: center; }
.tile-tool:hover { background: rgba(15, 17, 20, .92); }
.tile-stream-off { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #A9B1BC; font-weight: 700; }
.tile:fullscreen { border-radius: 0; }
.voice-stage.focused { flex-direction: column; }
.focus-main { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.focus-main .tile { height: 100%; width: auto; max-width: 100%; aspect-ratio: 16 / 9; }
.focus-strip { flex-shrink: 0; display: flex; gap: 10px; overflow-x: auto; justify-content: center; padding-bottom: 2px; }
.focus-strip .tile { width: 180px; flex-shrink: 0; }
.focus-strip .tile .avatar { width: 48px !important; height: 48px !important; }
.voice-lobby { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #EEF1F4; text-align: center; padding: 24px; }
.voice-lobby p { color: #A9B1BC; margin: 0 0 8px; }
.lobby-avatars { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.control-bar { flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 16px 20px; position: relative; }
.cb-status { position: absolute; left: 20px; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.cb-status .muted { color: #A9B1BC; }
.cb-buttons { display: flex; gap: 12px; }
.cb-right { position: absolute; right: 16px; display: flex; gap: 4px; }
.voice-view .cb-right .icon-btn, .dm-call .cb-right .icon-btn { color: #A9B1BC; }
.voice-view .round-btn:not(.active):not(.off):not(.danger):not(.success), .dm-call .round-btn:not(.active):not(.off):not(.danger):not(.success) { background: #2E343C; color: #EEF1F4; }
.ptt-chip { font: 800 11px var(--font-mono); padding: 2px 6px; border-radius: var(--r-sm); background: #2E343C; color: #A9B1BC; }
.ptt-chip.on { background: var(--lime); color: #142006; }
.call-hint { color: #A9B1BC; font-weight: 700; margin-right: 8px; }
.dm-call { background: #0B0D10; flex-shrink: 0; display: flex; flex-direction: column; max-height: 55%; min-height: 260px; border-bottom: 1px solid var(--border); }
.dm-call .voice-stage { padding: 16px 16px 0; }
.dm-call .voice-grid { grid-template-columns: repeat(var(--cols), minmax(0, 260px)); }

/* --------------------------------------------------------------- settings */
.settings-screen { position: fixed; inset: 0; z-index: 70; display: flex; background: var(--bg-main); animation: fade var(--t-med) var(--ease); }
.settings-nav { flex: 1 0 220px; background: var(--bg-sidebar); display: flex; justify-content: flex-end; overflow-y: auto; }
.settings-nav-inner { width: 232px; padding: 56px 8px 24px 20px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav-title { padding: 14px 10px 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); color: var(--text-2); font-weight: 700; text-align: left; }
.settings-nav-item:hover { background: var(--hover); color: var(--text); }
.settings-nav-item.active { background: var(--accent-soft); color: var(--text); }
.settings-nav-item.active .icon { color: var(--accent-text); }
.settings-nav-item.danger { color: var(--red); }
.settings-nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.settings-version { margin-top: 16px; padding: 0 10px; color: var(--text-muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.settings-content { flex: 1 1 800px; display: flex; overflow-y: auto; position: relative; }
.settings-content-inner { width: 100%; max-width: 760px; padding: 56px 40px 80px; }
.settings-close { position: sticky; top: 56px; margin-right: 24px; height: fit-content; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; font-weight: 700; }
.settings-close .icon { width: 36px; height: 36px; padding: 7px; border-radius: 50%; border: 2px solid var(--text-muted); }
.settings-close:hover { color: var(--text); }
.settings-close:hover .icon { border-color: var(--text); }
.account-card { background: var(--bg-sidebar); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); }
.account-banner { height: 96px; background: linear-gradient(120deg, #FF9F1C, #FFC93C 55%, #8BD346); }
.account-head { display: flex; align-items: flex-end; gap: 16px; padding: 0 16px 16px; margin-top: -32px; }
.account-head > div:nth-child(2) { flex: 1; padding-bottom: 4px; }
.account-head .avatar { box-shadow: 0 0 0 6px var(--bg-sidebar); }
.account-name { font: 700 20px var(--font-head); }
.account-rows { margin: 0 16px 16px; background: var(--bg-main); border-radius: var(--r-md); padding: 4px 16px; }
.account-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.account-row:last-child { border-bottom: 0; }
.profile-grid { display: grid; grid-template-columns: 1fr 300px; gap: 32px; }
.preview-card { background: var(--bg-overlay); border-radius: var(--r-lg); overflow: hidden; position: relative; border: 1px solid var(--border); }
.preview-banner { height: 64px; background: linear-gradient(120deg, #FF9F1C, #FFC93C); }
.preview-avatar { position: absolute; top: 20px; left: 16px; padding: 5px; border-radius: 50%; background: var(--bg-overlay); }
.preview-body { padding: 52px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.mic-test { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-radius: var(--r-md); background: var(--bg-sidebar); border: 1px solid var(--border); margin-top: 4px; }
.sensitivity { display: flex; flex-direction: column; gap: 8px; }
.meter { position: relative; height: 10px; border-radius: 5px; background: var(--bg-rail); overflow: hidden; border: 1px solid var(--border); }
.meter-fill { height: 100%; background: var(--yellow); transition: width 60ms linear; }
.meter-fill.hot { background: var(--lime); }
.meter-thr { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: var(--text); border-radius: 2px; }
.key-recorder { display: flex; align-items: center; gap: 8px; }
.keycap-btn { min-width: 220px; height: 40px; padding: 0 14px; border-radius: var(--r-md); background: var(--bg-rail); border: 1px solid var(--border); font: 400 14px var(--font-mono); text-align: left; }
.keycap-btn.recording { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.camera-preview { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.camera-preview .tile-video { position: static; width: 360px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-lg); }
.camera-off { width: 360px; max-width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-lg); background: var(--bg-sidebar); border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.theme-cards { display: flex; gap: 16px; }
.theme-card { display: flex; flex-direction: column; gap: 8px; align-items: center; font-weight: 700; }
.theme-swatch { width: 120px; height: 80px; border-radius: var(--r-lg); border: 2px solid var(--border); display: grid; grid-template-columns: 14px 30px 1fr; overflow: hidden; transition: border-color var(--t-fast); }
.theme-card.active .theme-swatch { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-dark .theme-swatch i:nth-child(1) { background: #0F1114; } .theme-dark .theme-swatch i:nth-child(2) { background: #16191D; } .theme-dark .theme-swatch i:nth-child(3) { background: #1C2026; }
.theme-light .theme-swatch i:nth-child(1) { background: #EDE6D9; } .theme-light .theme-swatch i:nth-child(2) { background: #F5F0E6; } .theme-light .theme-swatch i:nth-child(3) { background: #FFFBF2; }
.appearance-preview { background: var(--bg-main); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 4px 0 16px; }
.appearance-preview .message { padding-right: 16px; }
.keybind-list { margin-top: 16px; }
.keybind-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.keys { display: flex; gap: 4px; }
.save-bar { position: sticky; bottom: 20px; margin-top: 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--bg-rail); color: var(--text); padding: 10px 10px 10px 16px; border-radius: var(--r-md); box-shadow: var(--shadow); font-weight: 700; animation: rise var(--t-med) var(--ease); }
.overview-grid { display: grid; grid-template-columns: 120px 1fr; gap: 24px; align-items: start; }
.roles-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin-top: 16px; }
.role-list { display: flex; flex-direction: column; gap: 2px; }
.role-list .btn { margin-bottom: 8px; }
.role-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); text-align: left; color: var(--text-2); font-weight: 700; }
.role-item:hover { background: var(--hover); color: var(--text); }
.role-item.active { background: var(--accent-soft); color: var(--text); }
.grip { color: var(--text-muted); cursor: grab; display: flex; }
.role-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.role-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-count { font-size: 12px; color: var(--text-muted); }
.color-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatch { width: 32px; height: 32px; border-radius: var(--r-sm); border: 2px solid transparent; }
.swatch.none { background: var(--bg-elevated); color: var(--text-muted); display: flex; align-items: center; justify-content: center; }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-main) inset; }
.swatch-picker { width: 40px; height: 34px; padding: 0; border: 0; background: none; cursor: pointer; }
.role-actions { margin-top: 16px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.toolbar .input { max-width: 260px; }
.table { display: flex; flex-direction: column; }
.table-head { display: grid; grid-template-columns: 1.4fr 1fr .6fr .8fr 40px; gap: 12px; padding: 8px; font-size: 12px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
.table-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table-row.invite-row { display: grid; grid-template-columns: 1.4fr 1fr .6fr .8fr 40px; }
.invite-row .mono { cursor: copy; }
.table-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.table-title { font-weight: 700; }

/* ----------------------------------------------------------------- mobile */
@media (max-width: 1100px) {
  .search-box { width: 140px; }
  .search-box:focus-within { width: 180px; }
}
@media (max-width: 767px) {
  /* >= 16px: iOS Safari does not auto-zoom on focus */
  input, textarea, select, .input, .composer-input { font-size: 16px; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .nav-col { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; transform: translateX(-100%); transition: transform var(--t-med) var(--ease); box-shadow: var(--shadow); max-width: calc(100vw - 48px); }
  .sidebar { width: calc(100vw - 72px - 48px); max-width: 300px; }
  .members { position: fixed; top: 0; bottom: 0; right: 0; z-index: 60; transform: translateX(100%); transition: transform var(--t-med) var(--ease); box-shadow: var(--shadow); width: min(280px, calc(100vw - 48px)); }
  .app[data-panel="nav"] .nav-col { transform: none; }
  .app[data-panel="members"] .members { transform: none; }
  .app[data-panel="nav"] .mobile-scrim, .app[data-panel="members"] .mobile-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--scrim); }
  .chat-header { padding: 0 8px; gap: 6px; }
  .chat-topic { display: none; }
  .chat-title { max-width: none; flex: 1; }
  .search-box { display: none; }
  .tabs { margin-left: 0; }
  .friends .chat-header .chat-title, .friends .chat-header .chat-header-icon { display: none; }
  .message { padding-right: 16px; }
  .msg-actions { top: -30px; }
  .composer-wrap { padding: 0 8px 8px; }
  .right-panel { position: fixed; inset: 0; z-index: 65; width: auto; }
  .settings-screen { flex-direction: column; }
  .settings-nav { flex: 0 0 auto; justify-content: flex-start; overflow-x: auto; }
  .settings-nav-inner { width: auto; flex-direction: row; padding: 8px; gap: 4px; }
  .settings-nav-title, .settings-version, .settings-nav-sep { display: none; }
  .settings-nav-item span { white-space: nowrap; }
  .settings-content-inner { padding: 20px 16px 80px; }
  .settings-close { position: fixed; top: 64px; right: 8px; margin: 0; z-index: 2; }
  .settings-close span { display: none; }
  .form-grid.two, .profile-grid, .roles-layout, .overview-grid, .invite-opts { grid-template-columns: 1fr; }
  .control-bar { flex-wrap: wrap; padding-bottom: 12px; }
  .cb-status, .cb-right { position: static; }
  .round-btn { width: 46px; height: 46px; }
  .voice-grid { grid-template-columns: repeat(min(var(--cols), 2), minmax(0, 1fr)); }
  .modal { padding: 20px 16px; }
  .modal-actions { margin: 20px -16px -20px; padding: 12px 16px; }
  .emoji-picker { width: min(344px, calc(100vw - 16px)); }
  .popout { width: min(300px, calc(100vw - 16px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* polish */
.field-label .mono { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-muted); }
.segmented + .field, .segmented + .notice { margin-top: 14px; }
@media (hover: none) {
  .message:hover .msg-actions { display: none; }
  .message:hover { background: transparent; }
  .channel-gear, .dm-close { opacity: 1; }
  .reaction.add { opacity: 1; }
}

/* voice node picker / panel */
.node-picker { position: relative; }
.node-picker-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.node-picker-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; padding: 6px; border-radius: var(--r-md); max-height: 260px; overflow-y: auto; }
.node-opt { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); text-align: left; }
.node-opt:hover { background: var(--hover); }
.node-opt.active { background: var(--accent-soft); }
.node-opt-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.node-opt-main small { color: var(--text-muted); font-size: 12px; }
.node-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; box-shadow: 0 0 0 2px var(--bg-overlay); }
.node-dot.on { background: var(--lime); }
.node-dot.auto { width: 18px; height: 18px; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; box-shadow: none; }
.node-empty { padding: 12px; color: var(--text-muted); display: flex; justify-content: center; }
.voice-node { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.voice-node-ping { font-family: var(--font-mono); font-weight: 400; }
.node-list-inline { display: flex; flex-direction: column; gap: 4px; background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px; }
.node-list-inline.compact { background: transparent; border: 0; padding: 0; }
.node-opt.offline { opacity: .55; }
.node-opt .pill { margin-left: 6px; vertical-align: 1px; }
.node-ping { font: 400 12px var(--font-mono); white-space: nowrap; }
.ping-good { color: var(--lime-text); }
.ping-mid { color: var(--yellow); }
:root[data-theme="light"] .ping-mid { color: #8A6400; }
.ping-bad { color: var(--red); }
.ping-none { color: var(--text-muted); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 4px; }
.section-head h3 { margin: 0; }
.voice-panel { position: relative; }
.voice-node { border-radius: var(--r-sm); padding: 1px 4px 1px 0; }
.voice-node:hover { color: var(--text); }
.node-switcher { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 40; padding: 8px; border-radius: var(--r-md); max-height: 360px; overflow-y: auto; }
.node-switcher-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 2px 6px 6px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--r-sm); background: var(--bg-elevated); color: var(--text-2); font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill.lime { background: color-mix(in srgb, var(--lime) 18%, transparent); color: var(--lime-text); }
.pill.red { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn.flip .icon { transform: rotate(180deg); }
.row-gap.tight { gap: 2px; }

/* ------------------------------------------------------------ MOTD banner */
.motd-banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; background: var(--accent-soft); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 600; font-size: 14px; }
.motd-banner > .icon { color: var(--accent-text); }
.motd-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.motd-banner.preview { border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); margin-top: 6px; }

/* --------------------------------------------------- typed confirmation */
.type-confirm .field-label { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ---------------------------------------------------------------- admin */
.admin-screen .settings-nav-title.admin-title { display: flex; align-items: center; gap: 6px; color: var(--accent-text); }
.settings-content-inner.wide { max-width: 1080px; }
.settings-nav-item.admin-entry .icon { color: var(--accent-text); }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.admin-head h2 { margin: 0; }
.admin-head.sub { margin: 28px 0 12px; }
.admin-head.sub h3 { margin: 0; }
.admin-loading { display: flex; justify-content: center; padding: 32px; }
.admin-search { position: relative; display: flex; gap: 8px; margin-bottom: 16px; }
.admin-search .search-icon { left: 12px; right: auto; z-index: 1; }
.admin-search .input { padding-left: 36px; }
.admin-search.grow { flex: 1; margin: 0; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.input.filter { width: auto; min-width: 180px; flex: 0 1 220px; }
.grow { flex: 1; min-width: 0; }
.row-gap.wrap { flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat-card { background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.stat-card.accent { background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--bg-sidebar); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--bg-elevated); color: var(--accent-text); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.stat-val { font: 700 28px/1.1 var(--font-head); }
.stat-label { color: var(--text-2); font-weight: 700; font-size: 13px; }
.stat-sub { color: var(--text-muted); font-size: 12px; }
.node-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.node-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-sidebar); border: 1px solid var(--border); }
.node-card.off { opacity: .6; }
.node-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.node-card-main small { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.node-card-load { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--text-2); }

.admin-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 12px; }
.admin-tr { display: grid; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); text-align: left; min-width: 0; }
.admin-tr:first-child { border-top: 0; }
.admin-tr > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.admin-tr.head { background: var(--bg-sidebar); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding-top: 8px; padding-bottom: 8px; }
button.admin-tr:hover { background: var(--hover); }
.admin-tr.active { background: var(--accent-soft); }
.admin-tr .num { text-align: right; font-variant-numeric: tabular-nums; }
.users-table .admin-tr { grid-template-columns: 36px 1.6fr 1fr 1.2fr .6fr .7fr; }
.servers-table .admin-tr { grid-template-columns: 36px 1.6fr 1fr .6fr .6fr .7fr 1fr; }
.voice-table .admin-tr { grid-template-columns: 32px 1.3fr 1.3fr 1fr .7fr auto; }
.nodes-table .admin-tr { grid-template-columns: 20px 1.6fr 1.2fr .5fr 60px auto; }
.audit-table .admin-tr { grid-template-columns: 1fr 1fr 1.2fr 1.4fr; }
.cell-main { display: flex; flex-direction: column; gap: 1px; }
.cell-main b { font-weight: 700; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-main small { color: var(--text-muted); font-size: 12px; display: flex; gap: 4px; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-inline { display: flex; align-items: center; gap: 6px; }
.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.mini-icon { width: 32px; height: 32px; border-radius: 10px; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-elevated); font: 700 12px var(--font-head); }
.audit-details { margin: 0; padding: 10px 14px; background: var(--bg-rail); border-top: 1px solid var(--border); font: 400 12px/1.5 var(--font-mono); white-space: pre-wrap; overflow-x: auto; color: var(--text-2); }
.btn.block + .btn.block, .admin-table + .btn.block { margin-top: 4px; }

.drawer-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 74; animation: fade var(--t-med); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 75; background: var(--bg-overlay); border-left: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slidein var(--t-med) var(--ease); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.drawer-body h4 { margin: 14px 0 2px; font: 700 13px var(--font-ui); text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.drawer-body h4.danger-title { color: var(--red); }
.drawer-body .field { margin-bottom: 6px; }
.drawer-body .btn { align-self: flex-start; }
.drawer-hero { display: flex; gap: 14px; align-items: center; }
.drawer-hero .mini-icon { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; }
.drawer-name { font: 700 20px var(--font-head); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 4px 0; font-size: 13px; background: var(--bg-elevated); border-radius: var(--r-md); padding: 10px 12px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.sessions { display: flex; flex-direction: column; gap: 4px; }
.session-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 8px; background: var(--bg-elevated); border-radius: var(--r-sm); }
.pick-hits { display: flex; flex-direction: column; gap: 2px; }
.admin-channels { display: flex; flex-direction: column; gap: 2px; }
.admin-channels .channel { width: 100%; text-align: left; }
.modal.reader { width: 720px; }
.reader-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.admin-msgs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.admin-msg { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-sidebar); border: 1px solid var(--border); }
.admin-msg-body { flex: 1; min-width: 0; }
.admin-msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.admin-msg-head time { color: var(--text-muted); font-size: 12px; }
.admin-msg-text { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 14px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.file-card { position: relative; background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; }
.file-thumb { display: block; aspect-ratio: 4 / 3; background: var(--bg-elevated); width: 100%; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-thumb.icon { display: flex; align-items: center; justify-content: center; color: var(--accent-text); }
.file-meta { padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.file-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small { color: var(--text-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-del { position: absolute; top: 6px; right: 6px; background: var(--bg-overlay); opacity: 0; }
.file-card:hover .file-del { opacity: 1; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); max-width: none; }
.admin-invite-form { display: flex; flex-direction: column; gap: 4px; }
.num-input { width: 72px; }
.invite-mini-list { display: flex; flex-direction: column; gap: 2px; }
.invite-mini { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: var(--r-sm); background: var(--bg-elevated); }
.invite-mini .mono { cursor: copy; }
.input-prefix.grow .input { padding-left: 64px; }
.input-prefix > span.mono { left: 10px; }
.custom-invite { margin-bottom: 14px; }

/* -------------------------------------------------------- member details */
.member-details { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.md-row { display: flex; flex-direction: column; gap: 1px; }
.md-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.md-via { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.md-roles-label { margin-top: 2px; }
.role-pills.editable { align-items: center; }
.role-x { width: 14px; height: 14px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); margin-left: 2px; }
.role-x:hover { background: var(--red); color: #fff; }
.role-add { width: 22px; height: 22px; border-radius: var(--r-sm); background: var(--bg-elevated); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; }
.role-add:hover { background: var(--accent); color: var(--on-accent); }
.role-picker { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: var(--bg-elevated); border-radius: var(--r-md); }
.role-pick { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-sm); background: var(--bg-overlay); font-size: 12px; font-weight: 700; }
.role-pick:hover { background: var(--accent-soft); }
.role-pick i { width: 10px; height: 10px; border-radius: 50%; }
.popout .member-details { margin-top: 2px; }
.table-title { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.table-row.clickable { cursor: pointer; border-radius: var(--r-md); }
.table-row.clickable:hover { background: var(--hover); }
.member-block.open .table-row { background: var(--accent-soft); }
.member-expand { padding: 10px 14px 14px 52px; border-bottom: 1px solid var(--border); }

@media (max-width: 767px) {
  .users-table .admin-tr { grid-template-columns: 36px 1fr auto; }
  .users-table .admin-tr > span:nth-child(3), .users-table .admin-tr > span:nth-child(5), .users-table .admin-tr > span:nth-child(6) { display: none; }
  .servers-table .admin-tr, .voice-table .admin-tr, .nodes-table .admin-tr, .audit-table .admin-tr { grid-template-columns: 1fr 1fr; }
  .form-grid.three { grid-template-columns: 1fr; }
}
.icon-upload .server-icon { width: 100% !important; height: 100% !important; border-radius: 30%; }

/* Fluent emoji artwork */
img.emoji { display: inline-block; width: 1.375em; height: 1.375em; vertical-align: -0.3em; object-fit: contain; margin: 0 .05em; }
.message-text.jumbo img.emoji { width: 48px; height: 48px; vertical-align: middle; margin: 2px 2px 0 0; }
img.emoji.rx { width: 18px; height: 18px; vertical-align: middle; margin: 0; }
img.emoji.quick { width: 20px; height: 20px; margin: 0; }
img.emoji.picker { width: 32px; height: 32px; margin: 0; vertical-align: middle; }
img.emoji.cat { width: 20px; height: 20px; margin: 0; }
img.emoji.ac { width: 22px; height: 22px; margin: 0; }
img.emoji.tone { width: 22px; height: 22px; margin: 0; }
.ep-emoji { display: flex; align-items: center; justify-content: center; }
.ep-emoji:hover img.emoji { transform: scale(1.12); transition: transform var(--t-fast) var(--ease); }
.ep-top { display: flex; gap: 6px; align-items: center; }
.ep-top .input { flex: 1; }
.ep-tone { position: relative; }
.ep-tone-btn { width: 32px; height: 30px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; }
.ep-tone-btn:hover { background: var(--hover); }
.ep-tones { position: absolute; top: 34px; left: 0; z-index: 5; display: flex; gap: 2px; padding: 4px; border-radius: var(--r-md); }
.ep-tone-opt { width: 32px; height: 32px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; }
.ep-tone-opt.active, .ep-tone-opt:hover { background: var(--accent-soft); }
.ep-cat { filter: none; opacity: .65; display: flex; align-items: center; justify-content: center; }
.ep-cat:hover, .ep-cat.active { opacity: 1; }
.node-opt-main { overflow: hidden; }
.node-opt-main b, .node-opt-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-ping { flex-shrink: 0; }
.node-list-inline.compact .node-opt { padding: 7px 8px; gap: 8px; }
.node-list-inline.compact .node-opt-main small { display: none; }
.node-list-inline.compact .node-opt .pill { display: none; }
.admin-invite-form .input-prefix.grow { flex: 1 1 100%; }
