@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════
   CSS VARIABLES — Discord-faithful dark theme
═══════════════════════════════════════════ */
:root {
  --bg-primary: #313338;
  --bg-secondary: #2b2d31;
  --bg-tertiary: #1e1f22;
  --bg-accent: #4e5058;
  --bg-floating: #111214;
  --bg-overlay: rgba(0,0,0,0.7);
  --bg-hover: rgba(79,84,92,0.16);
  --bg-active: rgba(79,84,92,0.32);
  --bg-selected: rgba(79,84,92,0.48);
  --bg-message-hover: rgba(4,4,5,0.07);

  --text-normal: #dbdee1;
  --text-muted: #949ba4;
  --text-link: #00a8fc;
  --text-positive: #23a55a;
  --text-warning: #f0b132;
  --text-danger: #f23f43;
  --text-header: #f2f3f5;

  --brand: #5865f2;
  --brand-hover: #4752c4;
  --brand-active: #3c45a5;

  --green: #23a55a;
  --red: #f23f43;
  --yellow: #f0b132;
  --blurple: #5865f2;

  --status-online: #23a55a;
  --status-idle: #f0b132;
  --status-dnd: #f23f43;
  --status-offline: #80848e;

  --scrollbar: #1a1b1e;
  --scrollbar-thumb: #2c2e33;

  --rail-width: 72px;
  --panel-width: 240px;
  --members-width: 240px;
  --header-height: 48px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-low: 0 1px 0 rgba(4,4,5,0.2), 0 1.5px 0 rgba(6,6,7,0.05), 0 2px 0 rgba(4,4,5,0.05);
  --shadow-high: 0 8px 16px rgba(0,0,0,0.24);
  --shadow-overlay: 0 4px 60px rgba(0,0,0,0.7);

  --transition: 0.15s ease;

  /* Extended vars — overridden per-theme in themes.css */
  --input-bg:           #1e1f22;
  --input-border:       #1e1f22;
  --input-border-focus: #00a8fc;
  --input-placeholder:  #4e5058;

  --mention-bg:       rgba(88,101,242,.30);
  --mention-color:    #c9cdfb;
  --mention-hover-bg: rgba(88,101,242,.50);
  --code-bg:          rgba(0,0,0,.30);
  --code-color:       #e3e5e8;
  --reaction-bg:      rgba(79,84,92,.20);
  --reaction-hover:   rgba(79,84,92,.30);
  --ctx-sep:          rgba(255,255,255,.06);
  --brand-light:      rgba(88,101,242,.15);

  --msg-hover-bg:      rgba(2,2,2,.06);
  --msg-actions-bg:    #2b2d31;
  --msg-actions-border: rgba(255,255,255,.08);
  --msg-reply-line:    #4e5058;

  --scrollbar-track: transparent;
}

/* ═══════════════════════════════════════════ RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-normal);
  font-size: 15px;
  line-height: 1.375;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-accent); }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════ APP SHELL */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ═══════════════════════════════════════════ SERVER RAIL */
.server-rail {
  width: var(--rail-width);
  min-width: var(--rail-width);
  background: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.server-rail::-webkit-scrollbar { display: none; }

.rail-scroller { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding: 0 12px; }

.rail-item {
  width: 48px; height: 48px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-radius var(--transition), background var(--transition), transform 0.1s;
  position: relative;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700; font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}
.rail-item:hover { border-radius: 16px; color: white; transform: translateY(-1px); }
.rail-item.active { border-radius: 16px; }
.rail-item::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 4px; height: 8px;
  background: white;
  border-radius: 0 4px 4px 0;
  transition: transform 0.2s, height 0.2s;
}
.rail-item:hover::before { transform: translateY(-50%) scaleY(1); height: 20px; }
.rail-item.active::before { transform: translateY(-50%) scaleY(1); height: 40px; }
.rail-item .rail-img { width: 48px; height: 48px; object-fit: cover; }
.rail-item .rail-notification {
  position: absolute; bottom: 0; right: 0;
  background: var(--red); color: white;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-tertiary);
}

.rail-sep { width: 32px; height: 2px; background: var(--bg-accent); border-radius: 1px; flex-shrink: 0; margin: 4px 0; }

.rail-item.dm-btn { background: var(--bg-secondary); color: #23a55a; }
.rail-item.dm-btn:hover { background: #23a55a; color: white; border-radius: 16px; }
.rail-item.dm-btn.active { background: var(--brand); color: white; }

.rail-item.add-btn { background: var(--bg-secondary); color: var(--green); }
.rail-item.add-btn:hover { background: var(--green); color: white; border-radius: 16px; }

/* ═══════════════════════════════════════════ SIDE PANEL */
.side-panel {
  width: var(--panel-width);
  min-width: var(--panel-width);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Panel header */
.panel-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex; align-items: center;
  font-weight: 600; font-size: 15px;
  border-bottom: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
  box-shadow: var(--shadow-low);
}
.panel-header.clickable { cursor: pointer; justify-content: space-between; }
.panel-header.clickable:hover { background: var(--bg-hover); }

/* Server dropdown */
.server-header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.server-dropdown {
  position: absolute; top: var(--header-height); left: 0; right: 0;
  background: var(--bg-floating);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 8px;
  z-index: 200;
  box-shadow: var(--shadow-high);
  animation: dropIn 0.1s ease-out;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Panel body */
.panel-body { flex: 1; overflow-y: auto; padding: 8px 0; }

/* Channel list */
.ch-category {
  padding: 16px 8px 2px 16px;
  display: flex; align-items: center; gap: 4px;
  cursor: pointer;
  user-select: none;
}
.ch-category-name {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted);
  flex: 1;
}
.ch-category:hover .ch-category-name { color: var(--text-normal); }
.ch-category-arrow { color: var(--text-muted); transition: transform 0.15s; font-size: 10px; }
.ch-category.collapsed .ch-category-arrow { transform: rotate(-90deg); }

.ch-item {
  display: flex; align-items: center;
  padding: 5px 8px 5px 12px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  gap: 6px;
  transition: background 0.1s, color 0.1s;
  position: relative;
  user-select: none;
}
.ch-item:hover { background: var(--bg-hover); color: var(--text-normal); }
.ch-item.active { background: var(--bg-active); color: var(--text-header); }
.ch-item .ch-icon { font-size: 18px; flex-shrink: 0; opacity: 0.6; }
.ch-item.active .ch-icon { opacity: 1; }
.ch-item .ch-name { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-item .ch-unread { width: 8px; height: 8px; background: var(--text-header); border-radius: 50%; position: absolute; left: 0; }
.ch-item.unread .ch-name { color: var(--text-header); font-weight: 600; }
.ch-item .ch-badge { background: var(--red); color: white; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 8px; flex-shrink: 0; min-width: 16px; text-align: center; }

/* Voice users under channel */
.vc-sub-users { padding: 0 8px 4px 36px; }
.vc-sub-user { display: flex; align-items: center; gap: 6px; padding: 2px 4px; font-size: 13px; color: var(--text-muted); border-radius: 3px; }
.vc-sub-user:hover { background: var(--bg-hover); color: var(--text-normal); }

/* DM items */
.dm-item {
  display: flex; align-items: center;
  padding: 7px 8px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  gap: 10px;
  transition: background 0.1s;
}
.dm-item:hover { background: var(--bg-hover); }
.dm-item.active { background: var(--bg-active); }
.dm-item .dm-info { flex: 1; min-width: 0; }
.dm-item .dm-name { font-size: 14px; font-weight: 500; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item:hover .dm-name, .dm-item.active .dm-name { color: var(--text-normal); }
.dm-item .dm-sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item .dm-close { width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; font-size: 12px; color: var(--text-muted); }
.dm-item:hover .dm-close { opacity: 1; }
.dm-item .dm-close:hover { color: var(--text-normal); }

.panel-section-label {
  padding: 16px 12px 4px 16px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-section-label button { color: var(--text-muted); border-radius: 3px; padding: 2px 4px; font-size: 14px; }
.panel-section-label button:hover { color: var(--text-normal); background: var(--bg-hover); }

/* Friends filter tabs */
.friends-tabs {
  display: flex; gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
}
.friends-tab {
  padding: 12px 10px; font-size: 14px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  transition: color 0.1s;
  white-space: nowrap;
}
.friends-tab:hover { color: var(--text-normal); }
.friends-tab.active { color: var(--text-normal); border-bottom-color: var(--text-normal); }
.friends-tab.green { color: var(--green); }
.friends-tab.green:hover { background: rgba(35,165,90,0.1); border-radius: 4px; }

/* ═══════════════════════════════════════════ USER AREA */
.user-area {
  height: 52px;
  background: var(--bg-tertiary);
  display: flex; align-items: center;
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
  border-top: 1px solid rgba(0,0,0,0.2);
}
.user-info-box {
  flex: 1; display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
  min-width: 0; overflow: hidden;
  transition: background 0.1s;
}
.user-info-box:hover { background: var(--bg-hover); }
.avatar-stack { position: relative; flex-shrink: 0; }
.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
  overflow: hidden; flex-shrink: 0;
}
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.status-ring {
  position: absolute; bottom: -2px; right: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-tertiary);
}
.status-ring.online { background: var(--status-online); }
.status-ring.idle { background: var(--status-idle); }
.status-ring.dnd { background: var(--status-dnd); }
.status-ring.offline { background: var(--status-offline); }

.user-text { min-width: 0; flex: 1; }
.user-name { font-size: 14px; font-weight: 600; color: var(--text-header); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-tag { font-size: 12px; color: var(--text-muted); }

.ua-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}
.ua-btn:hover { background: var(--bg-hover); color: var(--text-normal); }
.ua-btn.danger { color: var(--red); }

/* ═══════════════════════════════════════════ MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
  min-width: 0;
}

/* Top bar */
.top-bar {
  height: var(--header-height);
  display: flex; align-items: center;
  padding: 0 16px; gap: 8px;
  border-bottom: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
  box-shadow: var(--shadow-low);
}
.top-icon { font-size: 20px; color: var(--text-muted); flex-shrink: 0; }
.top-channel-name { font-weight: 700; font-size: 15px; color: var(--text-header); flex-shrink: 0; }
.top-sep { width: 1px; height: 24px; background: var(--bg-accent); margin: 0 4px; flex-shrink: 0; }
.top-topic { font-size: 14px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.top-actions { display: flex; gap: 2px; margin-left: auto; flex-shrink: 0; }
.top-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}
.top-btn:hover { background: var(--bg-hover); color: var(--text-normal); }
.top-btn svg { pointer-events: none; }

/* DM call buttons — voice gets green hover, video gets blue hover */
.top-btn--call {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
#tb-voice-call:hover {
  background: rgba(35, 165, 90, 0.15);
  color: #23a55a;
}
#tb-video-call:hover {
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
}
.top-btn--call:active { transform: scale(0.9); }

/* ═══════════════════════════════════════════ FRIENDS PAGE */
.friends-page {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.friends-header {
  height: var(--header-height);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  border-bottom: 1px solid var(--bg-tertiary);
  flex-shrink: 0; box-shadow: var(--shadow-low);
}
.friends-header-icon { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.friends-header-icon svg { color: var(--text-muted); }
.friends-header-title { font-weight: 700; font-size: 15px; }
.fh-divider { width: 1px; height: 24px; background: var(--bg-accent); }
.friends-nav { display: flex; gap: 2px; }
.fnav-btn {
  padding: 3px 8px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: background 0.1s, color 0.1s;
}
.fnav-btn:hover { background: var(--bg-hover); color: var(--text-normal); }
.fnav-btn.active { background: var(--bg-active); color: var(--text-normal); }
.fnav-btn.green { background: var(--green); color: white; }
.fnav-btn.green:hover { background: #1a8a48; }

.friends-body { flex: 1; overflow-y: auto; }
.friends-search-bar {
  padding: 16px 20px 8px;
}
.friends-search-input {
  width: 100%; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  padding: 8px 12px; color: var(--text-normal); font-size: 14px;
  outline: none;
}

.friends-count-label {
  padding: 16px 20px 8px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-tertiary);
}

.friend-row {
  display: flex; align-items: center;
  padding: 8px 16px; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.1s;
  border-radius: var(--radius-sm);
  margin: 0 8px;
}
.friend-row:hover { background: var(--bg-hover); }
.friend-info { flex: 1; min-width: 0; }
.friend-name { font-size: 15px; font-weight: 600; color: var(--text-header); }
.friend-sub { font-size: 13px; color: var(--text-muted); }
.friend-actions { display: flex; gap: 8px; flex-shrink: 0; }
.friend-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background 0.1s, color 0.1s;
}
.friend-btn:hover { background: var(--bg-primary); color: var(--text-normal); }
.friend-btn.accept:hover { background: rgba(35,165,90,0.2); color: var(--green); }
.friend-btn.reject:hover { background: rgba(242,63,67,0.2); color: var(--red); }

.add-friend-page { padding: 24px; max-width: 700px; }
.add-friend-page h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.add-friend-page p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.add-friend-form { display: flex; gap: 0; background: var(--bg-tertiary); border-radius: var(--radius-sm); border: 1px solid var(--bg-accent); overflow: hidden; }
.add-friend-form:focus-within { border-color: var(--brand); }
.add-friend-form input { flex: 1; background: transparent; border: none; padding: 12px 16px; color: var(--text-normal); font-size: 15px; outline: none; }
.add-friend-form button { padding: 8px 16px; background: var(--brand); color: white; font-size: 14px; font-weight: 500; margin: 4px; border-radius: var(--radius-sm); }
.add-friend-form button:hover { background: var(--brand-hover); }

/* ═══════════════════════════════════════════ CHAT AREA */
.chat-wrapper { flex: 1; display: flex; overflow: hidden; }
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.messages-container {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  padding-bottom: 8px;
}
.messages-list { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; }

/* Channel welcome */
.channel-welcome {
  padding: 32px 16px 16px;
}
.cw-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--bg-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; margin-bottom: 16px;
}
.cw-title { font-size: 28px; font-weight: 800; color: var(--text-header); margin-bottom: 8px; }
.cw-desc { color: var(--text-muted); font-size: 15px; }

/* Date dividers */
.date-divider {
  display: flex; align-items: center;
  padding: 16px 16px 8px; gap: 8px;
  color: var(--text-muted); font-size: 12px; font-weight: 600;
}
.date-divider::before, .date-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--bg-accent);
}

/* Message groups */
.msg-group {
  display: flex;
  padding: 2px 16px;
  position: relative;
}
.msg-group:hover { background: var(--bg-message-hover); }
.msg-group:hover .msg-timestamp-small { visibility: visible; }
.msg-group:hover .msg-actions { opacity: 1; }

.msg-group.first { padding-top: 16px; }

.msg-avatar-col { width: 40px; flex-shrink: 0; padding-top: 2px; }
.msg-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: white;
  cursor: pointer; overflow: hidden;
  flex-shrink: 0;
}
.msg-avatar:hover { box-shadow: 0 0 0 2px var(--brand); }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.msg-timestamp-small {
  visibility: hidden;
  font-size: 11px; color: var(--text-muted);
  padding-top: 6px; text-align: right;
  user-select: none; flex-shrink: 0;
}

.msg-body { flex: 1; min-width: 0; padding-left: 16px; }
.msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author {
  font-weight: 600; font-size: 15px;
  cursor: pointer; color: var(--text-header);
}
.msg-author:hover { text-decoration: underline; }
.msg-time { font-size: 11px; color: var(--text-muted); }
.msg-text { font-size: 15px; color: var(--text-normal); word-break: break-word; white-space: pre-wrap; }
.msg-text.deleted { color: var(--text-muted); font-style: italic; }
.msg-edited-tag { font-size: 10px; color: var(--text-muted); margin-left: 4px; }

/* Reply bar above message */
.msg-reply-bar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 2px; font-size: 13px; color: var(--text-muted);
  cursor: pointer;
  overflow: hidden;
}
.msg-reply-bar:hover { color: var(--text-normal); }
.msg-reply-bar .reply-line { width: 28px; height: 10px; border-left: 2px solid var(--bg-accent); border-top: 2px solid var(--bg-accent); border-radius: 4px 0 0 0; flex-shrink: 0; }
.msg-reply-bar .reply-author { font-weight: 600; color: var(--text-normal); flex-shrink: 0; }
.msg-reply-bar .reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Message actions */
.msg-actions {
  position: absolute; right: 16px; top: -16px;
  background: var(--bg-floating);
  border-radius: var(--radius-sm);
  padding: 3px;
  display: flex; gap: 2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
  opacity: 0; transition: opacity 0.1s;
  z-index: 10;
}
.msg-action {
  width: 30px; height: 30px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 15px;
  transition: background 0.1s, color 0.1s;
}
.msg-action:hover { background: var(--bg-hover); color: var(--text-normal); }
.msg-action.danger:hover { background: rgba(242,63,67,0.2); color: var(--red); }

/* Reactions */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: flex; align-items: center; gap: 4px;
  background: var(--reaction-bg); border: 1px solid transparent;
  border-radius: var(--radius-md); padding: 2px 7px;
  cursor: pointer; font-size: 14px;
  transition: border-color 0.1s, background 0.1s;
}
.reaction:hover { border-color: var(--bg-accent); background: var(--reaction-hover); }
.reaction.own { background: var(--brand-light); border-color: var(--brand); }
.reaction .r-count { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.reaction.own .r-count { color: var(--brand); }

/* Attachments */
.msg-attachments { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.att-image { max-width: min(400px, 100%); max-height: 300px; border-radius: var(--radius-sm); cursor: pointer; display: block; }
.att-file {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-secondary); border: 1px solid var(--bg-accent);
  border-radius: var(--radius-sm); padding: 10px 12px;
  max-width: 400px;
}
.att-file-icon { font-size: 28px; flex-shrink: 0; }
.att-file-name { font-size: 14px; color: var(--text-link); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file-size { font-size: 12px; color: var(--text-muted); }

/* Inline edit */
.msg-edit-input {
  width: 100%; background: var(--bg-tertiary);
  border: 2px solid var(--brand); border-radius: var(--radius-sm);
  padding: 8px; color: var(--text-normal); font-size: 15px;
  font-family: inherit; resize: none; outline: none; line-height: 1.375;
}
.msg-edit-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.msg-edit-hint kbd { background: var(--bg-accent); padding: 0 4px; border-radius: 3px; }

/* Thread indicator */
.thread-indicator {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-link); cursor: pointer;
  margin-top: 4px; padding: 2px 4px; border-radius: 3px;
}
.thread-indicator:hover { text-decoration: underline; background: rgba(0,168,252,0.1); }

/* Typing indicator */
.typing-bar {
  height: 24px; padding: 0 72px;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  flex-shrink: 0;
}
.typing-dots { display: flex; gap: 3px; align-items: center; }
.typing-dots span {
  width: 5px; height: 5px; background: var(--text-muted);
  border-radius: 50%;
  animation: tdot 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tdot { 0%,60%,100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ═══════════════════════════════════════════ INPUT AREA */
.input-area { padding: 0 16px 20px; flex-shrink: 0; }

.reply-strip {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-secondary); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 8px 12px; font-size: 13px; color: var(--text-muted);
  border: 1px solid var(--bg-accent); border-bottom: none;
}
.reply-strip strong { color: var(--text-normal); }
.reply-strip button { color: var(--text-muted); border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.reply-strip button:hover { color: var(--text-normal); background: var(--bg-hover); }

.input-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  display: flex; align-items: flex-end;
  padding: 4px 4px 4px 8px;
  min-height: 44px;
  position: relative;
}
.reply-strip + .input-box { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.input-attach-btn {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); flex-shrink: 0;
}
.input-attach-btn:hover { color: var(--text-normal); }
.msg-input {
  flex: 1; min-height: 24px; max-height: 200px;
  overflow-y: auto; outline: none;
  color: var(--text-normal); font-size: 15px;
  line-height: 1.375; padding: 6px 4px;
  word-break: break-word;
}
.msg-input:empty::before { content: attr(placeholder); color: var(--text-muted); pointer-events: none; }
.input-actions { display: flex; align-items: flex-end; gap: 2px; }
.input-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); border-radius: var(--radius-sm);
}
.input-icon-btn:hover { color: var(--text-normal); }

/* File chips */
.file-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0 0 36px; }
.file-chip {
  background: var(--bg-tertiary); border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: 12px;
  display: flex; align-items: center; gap: 6px;
}
.file-chip button { color: var(--text-muted); font-size: 13px; }
.file-chip button:hover { color: var(--text-normal); }

/* ═══════════════════════════════════════════ EMOJI PICKER */
.emoji-picker {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: var(--bg-floating); border-radius: var(--radius-md);
  padding: 12px; width: 360px;
  box-shadow: var(--shadow-overlay);
  z-index: 100;
}
.emoji-search { width: 100%; background: var(--bg-secondary); border: none; border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text-normal); font-size: 13px; margin-bottom: 8px; outline: none; }
.emoji-grid { display: grid; grid-template-columns: repeat(10,1fr); gap: 3px; max-height: 180px; overflow-y: auto; }
.e-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 20px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.1s; }
.e-btn:hover { background: var(--bg-hover); }

/* ═══════════════════════════════════════════ MEMBER LIST */
.member-list {
  width: var(--members-width);
  min-width: var(--members-width);
  background: var(--bg-secondary);
  overflow-y: auto; padding: 16px 0 8px;
  flex-shrink: 0;
}
.ml-role-header {
  padding: 16px 8px 4px 16px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted);
}
.ml-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 12px; margin: 1px 4px;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.1s;
}
.ml-item:hover { background: var(--bg-hover); }
.ml-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-activity { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════ VOICE VIEW */
.voice-view {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px;
  background: var(--bg-primary);
  position: relative;
}
.vc-header { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; color: var(--text-muted); font-size: 18px; font-weight: 700; }
.vc-grid { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-content: center; max-width: 800px; }
.vc-tile {
  /* Audio-only tile: fixed square-ish card */
  position:  relative;
  width:     160px;
  height:    160px;          /* explicit height so absolute children resolve */
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding:   20px 12px;
  display:   flex;
  flex-direction: column;
  align-items:    center;
  justify-content: center;
  gap:       8px;
  border:    2px solid transparent;
  transition: border-color 0.2s, width 0.2s, height 0.2s;
  overflow:  hidden;
  flex-shrink: 0;
}
/* Video-active tile: 16:9 aspect ratio */
.vc-tile.vc-tile--video {
  width:  320px;
  height: 180px;   /* 320 × 9/16 = 180 — explicit height, not min-height */
  padding: 0;
  background: #000;
}
/* Speaking glow */
/* speaking handled by animation below */
.vc-tile.muted    { opacity: 0.7; }
.vc-tile.vc-tile--connecting { opacity: 0.6; }

/* ── Video element fills the tile absolutely ──
   Works because .vc-tile has an EXPLICIT height (160px or 180px).
   position:absolute + height:100% resolves to that explicit height. */
.vc-remote-video-el {
  display:  block;
  position: absolute;
  inset:    0;
  width:    100%;
  height:   100%;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) - 2px);
  background: #000;
  z-index:  0;
}

/* Overlay floats above video */
.vc-overlay {
  position: relative;
  z-index:  2;
  display:  flex;
  flex-direction: column;
  align-items:    center;
  gap:    6px;
  width:  100%;
  padding: 0 4px;
  pointer-events: none;
}
/* In video-mode, pin overlay to the bottom */
.vc-tile.vc-tile--video .vc-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px 8px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  border-radius: 0 0 calc(var(--radius-lg) - 2px) calc(var(--radius-lg) - 2px);
  z-index: 3;
}
.vc-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: white;
  overflow: hidden; flex-shrink: 0;
}
.vc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.vc-name {
  font-size: 13px; font-weight: 600; text-align: center;
  color: var(--text-header); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.vc-tile.vc-tile--video .vc-name { color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.vc-state { display: flex; gap: 4px; font-size: 14px; }
.vc-state-icon { font-size: 14px; color: var(--text-muted); }
.vc-state-icon.active { color: var(--red); }
.vc-controls { display: flex; gap: 12px; margin-top: 40px; flex-wrap: wrap; justify-content: center; }
.vc-ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 20px; background: var(--bg-secondary);
  border-radius: var(--radius-md); font-size: 12px; color: var(--text-normal);
  transition: background 0.1s;
  min-width: 80px;
}
.vc-ctrl-btn:hover { background: var(--bg-accent); }
.vc-ctrl-btn.leave-btn { background: var(--red); color: white; }
.vc-ctrl-btn.leave-btn:hover { background: #c0373a; }
.vc-ctrl-btn.muted-state { color: var(--red); }
.vc-ctrl-btn svg { width: 24px; height: 24px; }

/* ═══════════════════════════════════════════ PROFILE POPOUT */
.profile-popout {
  width: 340px;
  background: var(--bg-floating);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-overlay);
  position: fixed; z-index: 500;
  animation: popIn 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.pp-banner {
  height: 90px;
  background: linear-gradient(135deg, #5865f2, #eb459e);
  position: relative; flex-shrink: 0;
}
.pp-banner img { width: 100%; height: 100%; object-fit: cover; }
.pp-avatar-wrap {
  position: absolute; left: 16px; bottom: -36px;
}
.pp-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  border: 6px solid var(--bg-floating);
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: white;
  overflow: hidden; cursor: pointer;
}
.pp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pp-status-ring {
  position: absolute; bottom: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 4px solid var(--bg-floating);
}

.pp-body { padding: 44px 16px 16px; }
.pp-name { font-size: 20px; font-weight: 800; color: var(--text-header); }
.pp-tag { font-size: 13px; color: var(--text-muted); }
.pp-custom-status { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.pp-divider { height: 1px; background: var(--bg-accent); margin: 12px 0; }

.pp-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-normal); margin-bottom: 6px; }
.pp-bio { font-size: 14px; color: var(--text-normal); line-height: 1.4; }

.pp-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pp-badge {
  background: var(--bg-secondary);
  border-radius: 4px; padding: 4px 8px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.pp-badge.gold { color: #faa61a; }
.pp-badge.brand { color: var(--brand); }

.pp-mutual { display: flex; flex-direction: column; gap: 4px; }
.pp-mutual-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }

.pp-actions { display: flex; gap: 8px; margin-top: 12px; }
.pp-btn {
  flex: 1; padding: 8px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; text-align: center; cursor: pointer;
  transition: background 0.1s;
}
.pp-btn.primary { background: var(--brand); color: white; }
.pp-btn.primary:hover { background: var(--brand-hover); }
.pp-btn.secondary { background: var(--bg-accent); color: var(--text-normal); }
.pp-btn.secondary:hover { background: #5c6068; }
.pp-btn.danger-outline { border: 1px solid var(--red); color: var(--red); }
.pp-btn.danger-outline:hover { background: rgba(242,63,67,0.1); }

/* ═══════════════════════════════════════════ SETTINGS PAGE */
.settings-page {
  position: fixed; inset: 0;
  display: flex;
  background: var(--bg-primary);
  z-index: 300;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.settings-sidebar {
  width: 232px; min-width: 232px;
  background: var(--bg-secondary);
  padding: 60px 0 20px;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.settings-sidebar-inner { padding: 0 8px; flex: 1; }
.settings-category {
  padding: 6px 10px 2px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); margin-top: 8px;
}
.settings-nav-item {
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 15px; color: var(--text-muted);
  cursor: pointer; transition: background 0.1s, color 0.1s;
  display: flex; align-items: center; justify-content: space-between;
}
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text-normal); }
.settings-nav-item.active { background: var(--bg-active); color: var(--text-normal); }
.settings-nav-item.danger { color: var(--red); }
.settings-nav-item.danger:hover { background: rgba(242,63,67,0.1); }
.settings-sep { height: 1px; background: var(--bg-accent); margin: 8px 10px; }

.settings-close {
  position: fixed; right: 40px; top: 40px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-accent);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; z-index: 10;
  transition: background 0.1s;
}
.settings-close:hover { background: var(--bg-hover); }
.settings-close svg { pointer-events: none; }

.settings-content {
  flex: 1; overflow-y: auto;
  padding: 60px 40px 80px;
  max-width: 860px;
}
.settings-content h2 { font-size: 20px; font-weight: 700; margin-bottom: 24px; color: var(--text-header); }
.settings-content h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 8px; margin-top: 20px; }
.settings-divider { height: 1px; background: var(--bg-accent); margin: 20px 0; }

/* Account section */
.account-banner {
  height: 100px; background: linear-gradient(135deg, var(--brand), #eb459e);
  border-radius: var(--radius-md) var(--radius-md) 0 0; position: relative;
}
.account-card {
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 16px;
}
.account-avatar-section { display: flex; align-items: flex-end; gap: 16px; margin-top: -50px; margin-bottom: 16px; }
.account-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  border: 6px solid var(--bg-secondary);
  cursor: pointer; overflow: hidden; flex-shrink: 0;
  background: var(--bg-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: white;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-edit-btn {
  background: var(--bg-accent); color: var(--text-normal);
  padding: 6px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  transition: background 0.1s; margin-bottom: 8px;
}
.account-edit-btn:hover { background: #5c6068; }

.profile-field {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-tertiary); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 8px;
}
.field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 4px; }
.field-value { font-size: 15px; color: var(--text-normal); }
.field-edit-btn { color: var(--text-link); font-size: 14px; font-weight: 500; flex-shrink: 0; }
.field-edit-btn:hover { text-decoration: underline; }

/* Settings forms */
.settings-input {
  width: 100%; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text-normal); font-size: 15px;
  outline: none; transition: border-color 0.15s;
}
.settings-input:focus { border-color: var(--input-border-focus); }
.settings-label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); margin-bottom: 8px;
}
.settings-select {
  width: 100%; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text-normal); font-size: 15px;
  outline: none; cursor: pointer;
  transition: border-color 0.15s; appearance: none;
}
.settings-select:focus { border-color: var(--input-border-focus); }
.settings-textarea {
  width: 100%; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text-normal); font-size: 15px;
  outline: none; resize: vertical; min-height: 80px;
  transition: border-color 0.15s; font-family: inherit;
}
.settings-textarea:focus { border-color: var(--input-border-focus); }

/* Toggle switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--bg-accent);
}
.toggle-info { flex: 1; margin-right: 16px; }
.toggle-title { font-size: 16px; font-weight: 500; color: var(--text-normal); margin-bottom: 2px; }
.toggle-desc { font-size: 13px; color: var(--text-muted); }
.toggle-switch {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--bg-accent); position: relative;
  cursor: pointer; flex-shrink: 0; transition: background 0.2s;
}
.toggle-switch.on { background: var(--green); }
.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: white; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle-switch.on::after { left: 22px; }

/* Slider */
.slider-row { margin: 12px 0; }
.slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.slider-label span { font-size: 14px; color: var(--text-normal); }
.slider-value { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.settings-slider {
  -webkit-appearance: none; width: 100%;
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--brand) var(--val, 50%), var(--bg-accent) var(--val, 50%));
  outline: none; cursor: pointer;
}
.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4); cursor: pointer;
  transition: transform 0.1s;
}
.settings-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* Device cards */
.device-card {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 8px; display: flex;
  align-items: center; gap: 12px;
}
.device-icon { font-size: 24px; flex-shrink: 0; }
.device-info { flex: 1; }
.device-name { font-size: 14px; font-weight: 600; }
.device-detail { font-size: 12px; color: var(--text-muted); }
.device-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-full); }
.device-badge.current { background: rgba(35,165,90,0.2); color: var(--green); }

/* Mic test visualizer */
.mic-visualizer {
  height: 40px; background: var(--bg-tertiary);
  border-radius: var(--radius-sm); overflow: hidden;
  display: flex; align-items: center; gap: 2px; padding: 8px;
  margin-top: 8px;
}
.mic-bar {
  flex: 1; max-width: 6px; background: var(--brand);
  border-radius: 2px; transition: height 0.05s;
  min-height: 2px;
}

/* Color swatches for appearance */
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  transition: transform 0.1s; border: 2px solid transparent;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: white; }

/* ═══════════════════════════════════════════ MODAL SYSTEM */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.1s ease-out;
}
.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px; width: 90%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.15s ease-out;
}
.modal.wide { max-width: 680px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.modal-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.modal-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.modal-field { margin-bottom: 16px; }
.modal-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 8px; }
.modal-input {
  width: 100%; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text-normal); font-size: 15px;
  outline: none; transition: border-color 0.15s;
}
.modal-input:focus { border-color: var(--input-border-focus); }
.modal-select {
  width: 100%; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text-normal); font-size: 15px;
  outline: none; appearance: none;
}
.modal-textarea {
  width: 100%; background: var(--input-bg);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text-normal); font-size: 15px;
  outline: none; resize: vertical; min-height: 80px; font-family: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.btn { padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; transition: background 0.1s; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; color: var(--text-normal); }
.btn-ghost:hover { text-decoration: underline; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #c0373a; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: #1a8a48; }

/* ═══════════════════════════════════════════ CONTEXT MENU */
.ctx-menu {
  position: fixed; background: var(--bg-floating);
  border-radius: var(--radius-md); padding: 6px;
  z-index: 2000; min-width: 188px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
  animation: popIn 0.1s ease-out;
}
.ctx-item {
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 14px; cursor: pointer; display: flex;
  align-items: center; gap: 8px;
  color: var(--text-normal); transition: background 0.08s;
}
.ctx-item:hover { background: var(--brand); color: white; }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: var(--red); color: white; }
.ctx-sep { height: 1px; background: var(--ctx-sep); margin: 4px 0; }

/* ═══════════════════════════════════════════ TOASTS */
.toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 3000; pointer-events: none; }
.toast {
  background: var(--bg-floating);
  border-radius: var(--radius-md); padding: 12px 16px;
  min-width: 280px; max-width: 360px;
  box-shadow: var(--shadow-high);
  pointer-events: all; cursor: pointer;
  font-size: 14px;
  animation: slideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--brand); }
.toast.warning { border-left: 4px solid var(--yellow); }

/* ═══════════════════════════════════════════ THREAD PANEL */
.thread-panel {
  width: 420px; min-width: 420px;
  background: var(--bg-primary);
  border-left: 1px solid var(--bg-tertiary);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.thread-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 15px;
  border-bottom: 1px solid var(--bg-tertiary); flex-shrink: 0;
}
.thread-header button { color: var(--text-muted); padding: 4px; border-radius: var(--radius-sm); }
.thread-header button:hover { background: var(--bg-hover); color: var(--text-normal); }
.thread-body { flex: 1; overflow-y: auto; padding: 16px; }
.thread-input-area { padding: 0 16px 16px; }
.thread-input {
  width: 100%; background: var(--bg-secondary);
  border-radius: var(--radius-sm); padding: 10px 12px;
  color: var(--text-normal); font-size: 15px; min-height: 44px;
  outline: none; font-family: inherit;
}
.thread-input:empty::before { content: 'Reply in thread…'; color: var(--text-muted); }

/* ═══════════════════════════════════════════ PINS PANEL */
.pins-panel {
  width: 360px;
  position: absolute; right: 16px; top: 56px;
  background: var(--bg-floating); border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  z-index: 50; display: flex; flex-direction: column;
  max-height: 600px; overflow: hidden;
  animation: popIn 0.15s ease-out;
}
.pins-header { padding: 16px; font-weight: 700; border-bottom: 1px solid var(--bg-accent); display: flex; justify-content: space-between; }
.pins-header button { color: var(--text-muted); }
.pins-list { overflow-y: auto; padding: 8px; }
.pin-item { padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.pin-item:hover { background: var(--bg-hover); }
.pin-author { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.pin-text { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════ IMAGE LIGHTBOX */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 9999; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: var(--radius-sm); }

/* ═══════════════════════════════════════════ MISC */
.welcome-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--text-muted); }
.welcome-state .ws-icon { width: 80px; height: 80px; background: var(--brand); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 900; color: white; }
.welcome-state h2 { font-size: 22px; color: var(--text-header); }

.invite-box { display: flex; gap: 8px; }
.invite-box input { flex: 1; background: var(--bg-tertiary); border: 1px solid var(--bg-accent); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text-normal); font-size: 14px; outline: none; }
.invite-box button { padding: 10px 16px; background: var(--brand); color: white; border-radius: var(--radius-sm); font-size: 14px; }
.invite-box button:hover { background: var(--brand-hover); }

.mention { color: var(--mention-color); background: var(--mention-bg); border-radius: 3px; padding: 0 2px; cursor: pointer; }
.mention:hover { color: white; background: var(--mention-hover-bg); }
code { background: var(--code-bg); color: var(--code-color); padding: 2px 5px; border-radius: 3px; font-family: monospace; font-size: 13px; }

/* Scrollbar for message area */
.messages-container::-webkit-scrollbar { width: 8px; }

/* ═══ ADDITIONAL STYLES ═══ */

/* Theme card in appearance settings */
.theme-card {
  border: 2px solid var(--bg-accent);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  width: 140px;
  transition: border-color 0.15s;
}
.theme-card:hover { border-color: var(--text-muted); }
.theme-card.selected-theme { border-color: var(--brand); }

/* Settings slider improved */
.slider-row { margin: 8px 0; }
.slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* Voice ctrl button active states */
.vc-ctrl-btn.muted-state { color: var(--text-muted); background: rgba(79,84,92,0.24); }
.vc-ctrl-btn.muted-state:hover { background: var(--bg-accent); color: var(--text-normal); }

/* Color swatch selected state */
.color-swatch.selected { border: 3px solid white !important; transform: scale(1.15); }

/* profile popout in settings (non-positioned) */
.settings-content .profile-popout {
  width: 100%;
  box-shadow: none;
  border: 1px solid var(--bg-accent);
}

/* Account page card */
.account-card {
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 16px;
}
.account-avatar-section {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: -44px;
  margin-bottom: 20px;
}
.account-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 6px solid var(--bg-secondary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  position: relative;
  flex-shrink: 0;
}
.account-edit-btn {
  background: var(--bg-accent);
  color: var(--text-normal);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.1s;
}
.account-edit-btn:hover { background: #5c6068; }
.account-banner {
  height: 100px;
  background: linear-gradient(135deg, var(--brand), #eb459e);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.profile-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
}
.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.field-value { font-size: 15px; color: var(--text-normal); }
.field-edit-btn { color: var(--text-link); font-size: 14px; font-weight: 500; flex-shrink: 0; }
.field-edit-btn:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════
   DM CALL OVERLAY
═══════════════════════════════════════════════════════ */
#dmcall-overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}
.dmcall-panel {
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 480px; max-width: 95vw;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: popIn 0.2s cubic-bezier(0.175,0.885,0.32,1.275);
}
.dmcall-active {
  width: 640px; min-height: 480px;
  display: flex; flex-direction: column;
}
.dmcall-bg {
  height: 120px;
  background: linear-gradient(135deg, #5865f2, #eb459e);
}
.dmcall-incoming .dmcall-content {
  background: linear-gradient(180deg, #5865f2 0%, var(--bg-secondary) 60%);
  padding-top: 40px;
}
.dmcall-content {
  padding: 20px 32px 32px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.dmcall-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: #5865f2;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800; color: white;
  border: 4px solid var(--bg-secondary);
  margin-bottom: 16px; overflow: hidden; flex-shrink: 0;
}
.dmcall-name {
  font-size: 24px; font-weight: 800; color: var(--text-header);
  margin-bottom: 6px;
}
.dmcall-status {
  font-size: 14px; color: var(--text-muted);
}
.dmcall-controls {
  display: flex; gap: 24px; align-items: center; justify-content: center;
  margin-top: 24px;
}
.dcall-btn {
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; transition: transform 0.1s, background 0.1s;
}
.dcall-btn:hover { transform: scale(1.08); }
.dcall-btn.green { background: var(--green); color: white; }
.dcall-btn.green:hover { background: #1a8a48; }
.dcall-btn.red { background: var(--red); color: white; }
.dcall-btn.red:hover { background: #c0373a; }
.dcall-btn svg { pointer-events: none; }

/* Active call */
.dcall-timer {
  text-align: center; font-size: 14px; color: var(--text-muted);
  padding: 8px; font-variant-numeric: tabular-nums;
}
.dcall-active-controls {
  background: var(--bg-tertiary);
  padding: 16px 24px;
  border-top: 1px solid var(--bg-accent);
}
.dcall-ctrl-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg-accent); color: var(--text-normal);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; transition: background 0.1s;
}
.dcall-ctrl-btn:hover { background: #5c6068; }
.dcall-ctrl-btn.active { background: var(--red); color: white; }

/* Participant tiles */
.dcall-participants {
  flex: 1; display: flex; gap: 12px; padding: 16px;
  justify-content: center; align-items: center;
  background: #111214; min-height: 280px;
}
.dcall-tile {
  flex: 1; max-width: 280px; min-height: 200px;
  background: var(--bg-secondary); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; gap: 10px; position: relative; overflow: hidden;
}
.dcall-tile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: white; overflow: hidden;
}
.dcall-tile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dcall-tile-name { font-size: 14px; font-weight: 600; color: var(--text-header); z-index: 2; }
.dcall-tile-states { font-size: 16px; z-index: 2; }
.dcall-tile-video { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; }

/* ═══════════════════════════════════════════════════════
   INVITE JOIN PAGE
═══════════════════════════════════════════════════════ */
.invite-join-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg-tertiary);
  font-family: 'Noto Sans', sans-serif;
}
.invite-join-card {
  background: var(--bg-secondary);
  border-radius: 16px; padding: 0;
  width: 440px; max-width: 95vw;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.invite-join-banner {
  height: 80px;
  background: linear-gradient(135deg, #5865f2, #eb459e);
}
.invite-join-body {
  padding: 24px;
}
.invite-join-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
  margin-top: -36px;
}
.invite-join-icon {
  width: 72px; height: 72px; border-radius: 50%;
  border: 6px solid var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: white; overflow: hidden;
  flex-shrink: 0;
}
.invite-join-icon img { width: 100%; height: 100%; object-fit: cover; }
.invite-join-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }
.invite-join-stats { display: flex; gap: 24px; margin-bottom: 24px; }
.invite-stat { text-align: center; }
.invite-stat-val { font-size: 20px; font-weight: 800; color: var(--text-header); }
.invite-stat-label { font-size: 12px; color: var(--text-muted); }


/* Speaking indicator pulse animation */
@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--green), 0 0 8px rgba(35,165,90,0.30); }
  50%       { box-shadow: 0 0 0 3px var(--green), 0 0 16px rgba(35,165,90,0.55); }
}
.vc-tile.speaking {
  border-color: var(--green) !important;
  animation: speakPulse 1.2s ease-in-out infinite;
}

/* Speaking label badge in user-area (shown when speaking in voice channel) */
.ua-speaking-badge {
  position: absolute;
  bottom: -2px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: white;
  font-size: 9px; font-weight: 700;
  padding: 1px 4px; border-radius: 3px;
  white-space: nowrap; pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   DM CALL — INCOMING NOTIFICATION
═══════════════════════════════════════════════════════════ */
.dmc-incoming {
  position: fixed; top: 16px; right: 16px; z-index: 4000;
  background: var(--bg-floating);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.06);
  min-width: 320px; max-width: 360px;
  opacity: 0; transform: translateX(20px) scale(0.95);
  transition: opacity .25s ease, transform .25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(12px);
}
.dmc-incoming--visible {
  opacity: 1; transform: translateX(0) scale(1);
}
.dmc-incoming-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  position: relative;
}
.dmc-incoming-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: white;
  overflow: hidden; flex-shrink: 0;
}
.dmc-incoming-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dmc-incoming-info { flex: 1; }
.dmc-incoming-type { font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: .6px; margin-bottom: 3px; }
.dmc-incoming-name { font-size: 18px; font-weight: 800; color: var(--text-header); }
.dmc-incoming-pulse {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 0 rgba(35,165,90,.4);
  animation: dmcPulseRing 1.5s infinite;
}
@keyframes dmcPulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(35,165,90,.4); }
  70%  { box-shadow: 0 0 0 10px rgba(35,165,90,0); }
  100% { box-shadow: 0 0 0 0 rgba(35,165,90,0); }
}
.dmc-incoming-actions {
  display: flex; gap: 8px;
}
.dmc-btn-decline, .dmc-btn-answer-audio, .dmc-btn-answer-video {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 10px; border-radius: 10px; border: none;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.dmc-btn-decline:hover, .dmc-btn-answer-audio:hover, .dmc-btn-answer-video:hover {
  filter: brightness(1.1); transform: translateY(-1px);
}
.dmc-btn-decline { background: #ed4245; color: white; }
.dmc-btn-answer-audio { background: #23a55a; color: white; }
.dmc-btn-answer-video { background: #5865f2; color: white; }

/* ═══════════════════════════════════════════════════════════
   DM CALL — FULL SCREEN OVERLAY
═══════════════════════════════════════════════════════════ */
.dmc-overlay {
  position: fixed; inset: 0; z-index: 3500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s ease;
}
.dmc-overlay--visible { opacity: 1; }
.dmc-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #0d0e16 0%, #111318 50%, #0a0b10 100%);
}

/* Active call layout */
.dmc-call-wrap {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 0;
}

/* Top bar */
.dmc-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.dmc-topbar-left { display: flex; align-items: center; gap: 12px; }
.dmc-call-type-badge {
  background: rgba(88,101,242,.25); color: #8892f5;
  border: 1px solid rgba(88,101,242,.3);
  padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.dmc-call-name { font-size: 16px; font-weight: 800; color: white; }
.dmc-topbar-right { display: flex; align-items: center; gap: 12px; }
.dmc-status-text { font-size: 13px; color: var(--text-muted); }
.dmc-timer {
  font-size: 16px; font-weight: 700; color: var(--green);
  font-variant-numeric: tabular-nums; letter-spacing: .05em;
}

/* Video grid */
.dmc-video-grid {
  flex: 1; display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  padding: 16px;
  min-height: 0;
}

/* Participants */
.dmc-participant {
  position: relative; border-radius: 16px; overflow: hidden;
  background: #111318;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.06);
  min-height: 200px;
}
.dmc-participant--remote { border-color: rgba(88,101,242,.3); }
.dmc-participant--local  { max-height: 100%; aspect-ratio: auto; }
.dmc-participant.connected { border-color: rgba(35,165,90,.4); }

/* Avatar shown when camera is off */
.dmc-participant-avatar {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  padding: 24px;
  position: absolute; inset: 0;
}
.dmc-avatar-wrap {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800; color: white; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  border: 3px solid rgba(255,255,255,.15);
}
.dmc-avatar-wrap.connected { border-color: var(--green); }
.dmc-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dmc-remote-avatar-wrap.connected { border-color: var(--green); }

.dmc-local-avatar .dmc-avatar-wrap { width: 72px; height: 72px; font-size: 26px; }
.dmc-participant-name {
  font-size: 16px; font-weight: 700; color: white; text-align: center;
}

/* Connecting dots animation */
.dmc-connecting-dots { display: flex; gap: 6px; }
.dmc-connecting-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted); animation: dmcDot 1.2s infinite;
}
.dmc-connecting-dots span:nth-child(2) { animation-delay: .2s; }
.dmc-connecting-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dmcDot { 0%, 80%, 100% { opacity: .3; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* Name label at bottom of participant tile */
.dmc-participant-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px 12px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: white; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  border-radius: 0 0 14px 14px;
}
.dmc-mic-indicator {
  margin-left: auto; font-size: 14px;
}
.dmc-muted-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(237,66,69,.9); color: white;
  border-radius: 50%; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; z-index: 10;
}

/* Screen share preview */
.dmc-screen-preview-wrap {
  flex-shrink: 0; margin: 0 16px;
  background: rgba(0,0,0,.4);
  border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(88,101,242,.3);
  padding: 10px;
  max-height: 200px;
}
.dmc-screen-preview-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 6px;
}

/* Controls bar */
.dmc-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 16px 24px;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.dmc-ctrl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 20px; min-width: 72px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px; cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s;
  color: var(--text-normal);
}
.dmc-ctrl-btn:hover {
  background: rgba(255,255,255,.12); transform: translateY(-2px);
}
.dmc-ctrl-icon { font-size: 22px; line-height: 1; }
.dmc-ctrl-label { font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--text-muted); }
.dmc-ctrl-btn--end {
  background: #ed4245; border-color: #ed4245; color: white;
}
.dmc-ctrl-btn--end:hover { background: #c0373a; border-color: #c0373a; }
.dmc-ctrl-btn--end .dmc-ctrl-label { color: rgba(255,255,255,.8); }
.dmc-ctrl--active {
  background: rgba(237,66,69,.2); border-color: rgba(237,66,69,.4);
  color: #ed4245;
}
.dmc-ctrl--active .dmc-ctrl-label { color: #ed4245; }
.dmc-ctrl--active:hover { background: rgba(237,66,69,.3); }

/* Ringing / outgoing call layout */
.dmc-call-wrap--ringing, .dmc-call-wrap--ended {
  align-items: center; justify-content: center; gap: 0;
}
.dmc-ringing-avatar {
  position: relative;
  width: 140px; height: 140px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 56px; font-weight: 800; color: white; overflow: visible;
  margin-bottom: 28px;
}
.dmc-ringing-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dmc-ring-1, .dmc-ring-2, .dmc-ring-3 {
  position: absolute; inset: -12px; border-radius: 50%;
  border: 2px solid rgba(88,101,242,.4);
  animation: dmcRing 2s infinite ease-out;
  pointer-events: none;
}
.dmc-ring-2 { inset: -24px; animation-delay: .5s; }
.dmc-ring-3 { inset: -36px; animation-delay: 1s; }
@keyframes dmcRing {
  0%   { opacity: .7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3); }
}
.dmc-ringing-name {
  font-size: 28px; font-weight: 800; color: white; margin-bottom: 8px; text-align: center;
}
.dmc-ringing-label {
  font-size: 14px; color: var(--text-muted); margin-bottom: 40px; text-align: center;
}
.dmc-ringing-actions { display: flex; justify-content: center; }
.dmc-ended-avatar {
  width: 100px; height: 100px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: white; overflow: hidden;
  margin-bottom: 20px; opacity: .6;
}
.dmc-ended-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dmc-ended-msg { font-size: 15px; color: var(--text-muted); margin-top: 8px; }

/* DM call buttons in top bar */
.dm-call-btns { display: flex; align-items: center; gap: 4px; }
.dm-call-btn-voice, .dm-call-btn-video {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-muted); font-size: 16px;
  transition: background .15s, color .15s;
}
.dm-call-btn-voice:hover, .dm-call-btn-video:hover {
  background: var(--bg-hover); color: var(--text-header);
}
.dm-call-btn-video { font-size: 15px; }

/* vc-status-row for voice channel tiles */
.vc-status-row { display: flex; gap: 4px; align-items: center; }
.vc-status-badge {
  font-size: 13px; padding: 2px 4px; border-radius: 4px;
  background: rgba(0,0,0,.3);
}
.vc-status-badge.muted { color: var(--red); }

/* Responsive: stack video grid on small screens */
@media (max-width: 600px) {
  .dmc-video-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 180px;
  }
}

/* Friend request buttons */
.friend-btn-accept {
  background: var(--green) !important;
  color: white !important;
}
.friend-btn-accept:hover {
  background: #1e8e4f !important;
}
.friend-btn-decline {
  background: var(--red) !important;
  color: white !important;
}
.friend-btn-decline:hover {
  background: #c0373a !important;
}

/* ═══════════════════════════════════════════════════════
   SETTINGS - COMPACT MODE & TIMESTAMPS
═══════════════════════════════════════════════════════ */
body.compact-mode .message {
  padding: 2px 16px !important;
  margin-bottom: 0 !important;
}

body.compact-mode .message-header {
  margin-bottom: 2px !important;
}

body.compact-mode .msg-content {
  line-height: 1.3 !important;
}

body.show-timestamps .message-time {
  display: inline !important;
  opacity: 1 !important;
}

body.show-timestamps .msg-content::before {
  content: attr(data-time);
  color: var(--text-muted);
  font-size: 11px;
  margin-right: 8px;
}
