:root {
  font-size: 14px;
  --bg-darkest: #0a0b0f;
  --bg-dark: #101114;
  --bg-mid: #16171b;
  --bg-light: #1e1f24;
  --bg-hover: #25262c;
  --bg-active: #2d2e35;
  --text: #dbdee1;
  --text-muted: #949ba4;
  --text-dim: #6d6f78;
  --accent: #4fc3f7;
  --accent-hover: #29b6f6;
  --accent-dim: rgba(79,195,247,0.15);
  --danger: #da373c;
  --success: #23a559;
  --warning: #f0b232;
  --online: #23a559;
  --away: #f0b232;
  --dnd: #da373c;
  --offline: #6d6f78;
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 4px 12px rgba(0,0,0,0.5);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  font-size: 14px;
  line-height: 1.375;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection { background: var(--accent-dim); }
.hidden { display: none !important; }
.error { color: var(--danger); font-size: 12px; margin-top: 6px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-darkest); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-active); }
::-webkit-scrollbar-corner { background: transparent; }

/* Reconnect overlay */
#reconnect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 19, 0.92);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: reconnect-fade-in 0.3s ease;
}
@keyframes reconnect-fade-in { from { opacity: 0; } to { opacity: 1; } }
#reconnect-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
#reconnect-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bg-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: reconnect-spin 0.8s linear infinite;
}
@keyframes reconnect-spin { to { transform: rotate(360deg); } }
#reconnect-brand {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
#reconnect-msg {
  font-size: 14px;
  color: var(--text-dim);
  animation: reconnect-pulse 2s ease-in-out infinite;
}
@keyframes reconnect-pulse { 50% { opacity: 0.5; } }

/* Saved indicator */
.saved-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 99999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  color: var(--success, #69f0ae);
  padding: 20px 40px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.saved-indicator.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.saved-error { color: var(--danger, #ef5350); }
.saved-info { color: var(--accent, #4fc3f7); }

/* Confirm modal */
#confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fade-in 0.15s ease-out;
}
.confirm-modal {
  background: var(--bg-mid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 380px;
  max-width: 90vw;
  padding: 20px 22px;
  animation: modal-in 0.2s ease-out;
}
.confirm-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.confirm-modal-msg {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 14px;
}
.confirm-modal-input {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 14px;
  background: var(--bg-dark);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  box-sizing: border-box;
}
.confirm-modal-input:focus { outline: none; border-color: var(--accent); }
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.confirm-modal-cancel,
.confirm-modal-ok {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}
.confirm-modal-cancel {
  background: var(--bg-light);
  color: var(--text);
}
.confirm-modal-cancel:hover { background: var(--bg-hover); }
.confirm-modal-ok {
  background: var(--accent);
  color: #fff;
}
.confirm-modal-ok:hover { background: var(--accent-hover); }
.confirm-modal-ok.danger {
  background: var(--danger);
}
.confirm-modal-ok.danger:hover { opacity: 0.9; }

/* Auth */
#auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-darkest);
  animation: auth-fade-in 0.3s ease-out 0.15s both;
}
@keyframes auth-fade-in { from { opacity: 0; } to { opacity: 1; } }

.auth-card {
  background: var(--bg-dark);
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 360px;
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 24px;
  font-weight: 700;
}

/* Logo + animation */
.auth-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.auth-logo .logo-svg { width: 56px; height: 56px; color: var(--accent); }
.auth-logo h1 { margin-bottom: 12px; }

.logo-bounce { display: inline-flex; }
.logo-bounce.loading-active { animation: logoBounce 1.4s ease-in-out infinite; }
.logo-bounce.loading-active .logo-eyes { animation: eyeLag 1.4s ease-in-out infinite; }

@keyframes logoBounce {
  0%, 100% { transform: translateY(0); }
  15% { transform: translateY(-12px); }
  30% { transform: translateY(0); }
  38% { transform: translateY(-3px); }
  46% { transform: translateY(0); }
}

@keyframes eyeLag {
  0%, 100% { transform: translateY(0); }
  10% { transform: translateY(2px); }
  20% { transform: translateY(-3px); }
  32% { transform: translateY(0.5px); }
  40% { transform: translateY(-1px); }
  50% { transform: translateY(0); }
}

#loading-splash {
  position: fixed;
  inset: 0;
  background: var(--bg-darkest);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: var(--accent);
  transition: opacity 0.3s;
}
#loading-splash.hidden { opacity: 0; pointer-events: none; }

#sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 8px;
  color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
#sidebar-logo:hover {
  opacity: 0.85;
}
.accent { color: var(--accent); }

#forgot-password-link {
  display: block;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
  text-decoration: none;
}
#forgot-password-link:hover { color: var(--accent); }

#verify-banner {
  background: var(--accent-dim);
  color: var(--accent);
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  flex-shrink: 0;
}
#verify-banner a { color: var(--accent); font-weight: 600; text-decoration: underline; }

.auth-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }

.auth-card button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s;
}
#login-btn { background: var(--accent); color: #fff; }
#login-btn:hover { background: var(--accent-hover); }
#register-btn { background: var(--bg-light); color: var(--text); }
#register-btn:hover { background: var(--bg-hover); }

/* Main layout */
#main-view { display: flex; height: 100vh; }

/* Server sidebar */
#server-sidebar {
  width: 64px;
  background: var(--bg-darkest);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 4px;
  flex-shrink: 0;
}

#server-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  width: 100%;
  padding: 0 8px;
  scrollbar-width: none;
}
#server-list::-webkit-scrollbar { display: none; }

.server-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: border-radius 0.2s, background 0.2s;
  flex-shrink: 0;
}
.server-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.server-icon:hover, .server-icon.active {
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: #fff;
}
.server-icon {
  position: relative;
}
.server-icon.has-unread::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--text);
}
.srv-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-dim);
  border: 2px solid var(--bg-darkest);
}
.srv-badge.mention {
  width: auto;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #ed4245;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  bottom: -4px;
  right: -4px;
}

#add-server-btn, #join-server-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-mid);
  border: none;
  color: var(--accent);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
#add-server-btn:hover, #join-server-btn:hover {
  background: var(--accent);
  color: #fff;
}

.server-bottom-btns {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-top: 4px;
}
.server-bottom-sep {
  width: 32px;
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

#user-badge {
  position: relative;
  width: 40px;
  height: 40px;
  cursor: pointer;
  flex-shrink: 0;
  margin-bottom: 4px;
}
#user-badge-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  overflow: hidden;
  transition: opacity 0.15s;
}
#user-badge:hover #user-badge-avatar { opacity: 0.8; }
#user-badge .status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg-darkest);
  box-sizing: border-box;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: var(--online); }
.status-dot.away { background: var(--away); }
.status-dot.dnd { background: var(--dnd); }
.status-dot.offline, .status-dot.invisible { background: var(--offline); }

/* Channel sidebar */
#channel-sidebar {
  width: 240px;
  min-width: 160px;
  max-width: 420px;
  background: var(--bg-mid);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
}
#sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -2px;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}
#sidebar-resize-handle:hover,
#sidebar-resize-handle.dragging {
  background: var(--accent);
  opacity: 0.5;
}

#server-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg-light);
  min-height: 48px;
}
#server-header h2 {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#server-settings-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s;
}
#server-settings-btn:hover { color: var(--text); }

#channel-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.channel-category {
  padding: 10px 14px 4px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  transition: color 0.15s;
}
.channel-category:hover { color: var(--text-muted); }
.channel-category::before {
  content: '\25BC';
  font-size: 8px;
  transition: transform 0.15s;
}
.channel-category.collapsed::before { transform: rotate(-90deg); }

.channel-item {
  display: flex;
  align-items: center;
  padding: 5px 14px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  gap: 6px;
  border-radius: var(--radius);
  margin: 0 6px;
  transition: background 0.1s, color 0.1s;
}
.channel-item { position: relative; }
.channel-item:hover { background: var(--bg-hover); color: var(--text); }
.channel-item.active { background: var(--bg-light); color: var(--text); }
.channel-item.unread { color: #fff; font-weight: 700; }
.channel-item.unread .ch-hash { color: var(--text); }
.channel-item.unread::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 10px;
  border-radius: 0 4px 4px 0;
  background: var(--text);
}
.ch-hash { color: var(--text-dim); font-weight: 700; font-size: 16px; }
.ch-unread {
  margin-left: auto;
  background: var(--text-dim);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 700;
}
.ch-unread.mention { background: var(--danger); }

.dm-item {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  cursor: pointer;
  gap: 8px;
  color: var(--text-muted);
  border-radius: var(--radius);
  margin: 0 6px;
  transition: background 0.1s, color 0.1s;
}
.dm-item:hover { background: var(--bg-hover); color: var(--text); }
.dm-item.active { background: var(--bg-light); color: var(--text); }
.dm-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Category hover actions */
.cat-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-actions { display: none; gap: 4px; margin-left: auto; flex-shrink: 0; }
.channel-category:hover .cat-actions { display: flex; }
.cat-actions span {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  transition: color 0.1s;
}
.cat-actions span:hover { color: var(--text); }
.cat-add-ch { font-weight: 700; font-size: 15px !important; }

/* Channel label and hover gear */
.ch-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-gear {
  display: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.1s;
}
.channel-item:hover .ch-gear { display: inline; }
.ch-gear:hover { color: var(--text) !important; }

/* Inline add links */
.inline-add-channel, .inline-add-category {
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  opacity: 0.6;
}
.inline-add-channel:hover, .inline-add-category:hover {
  color: var(--text-muted);
  opacity: 1;
}
.inline-add-category {
  margin-top: 4px;
  padding-top: 8px;
}

/* Drag and drop */
.drop-indicator {
  height: 2px;
  background: var(--accent);
  margin: 0 6px;
  border-radius: 1px;
  pointer-events: none;
}
[data-drag-type] { cursor: default; }
[data-drag-type][draggable="true"] { cursor: grab; }
[data-drag-type].dragging { opacity: 0.35; }

/* Chat area */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  min-width: 0;
}

#chat-header {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--bg-light);
  flex-shrink: 0;
  min-height: 48px;
}
#chat-channel-name { font-weight: 600; font-size: 14px; }
#chat-topic { color: var(--text-dim); font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header-actions { display: flex; gap: 2px; }
.chat-header-actions button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: background 0.1s, color 0.1s;
}
.chat-header-actions button:hover { background: var(--bg-hover); color: var(--text); }
#mentions-btn { font-weight: 700; font-size: 14px; font-family: inherit; }

.mention-result {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.mention-result:hover { background: var(--bg-hover); }
.mention-result-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px; font-size: 12px;
}
.mention-result-author { font-weight: 600; color: var(--text); }
.mention-result-channel {
  color: var(--text-dim); font-size: 11px;
  background: var(--bg-dark); padding: 1px 6px;
  border-radius: 3px;
}
.mention-result-time { color: var(--text-dim); font-size: 11px; margin-left: auto; }
.mention-result-body {
  font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}

.msg-highlight {
  animation: msg-flash 2s ease;
}
@keyframes msg-flash {
  0%, 100% { background: transparent; }
  15%, 50% { background: var(--bg-hover); }
}

#messages-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}
#scroll-bottom-btn {
  position: sticky;
  bottom: 8px;
  align-self: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  z-index: 10;
  transition: opacity 0.15s, transform 0.15s;
}
#scroll-bottom-btn:hover { filter: brightness(1.1); }
#scroll-bottom-btn.hidden { display: none; }

#messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0;
}

/* Messages */
.message {
  display: flex;
  gap: 12px;
  padding: 6px 16px;
  border-radius: var(--radius);
  position: relative;
}
.message + .message:not(.grouped) { margin-top: 1em; }
.message:hover { background: rgba(0,0,0,0.12); }
.message.pinned { border-left: 2px solid var(--warning); padding-left: 14px; }
.message.msg-mentioned { background: rgba(250, 166, 26, 0.08); border-left: 2px solid var(--warning); padding-left: 14px; }
.message.msg-mentioned:hover { background: rgba(250, 166, 26, 0.13); }
.message.grouped {
  padding: 1px 16px 1px 64px;
  margin-top: 0;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
}
.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-body { flex: 1; min-width: 0; }
.msg-header { display: flex; align-items: baseline; gap: 6px; }
.msg-author { font-weight: 600; font-size: 1rem; color: var(--accent); }
.msg-time { font-size: 0.786rem; color: var(--text-dim); }
.msg-edited { font-size: 0.786rem; color: var(--text-dim); font-style: italic; }
.msg-content {
  font-size: 1rem;
  line-height: 1.4;
  word-wrap: break-word;
  margin-top: 2px;
}
.msg-content code {
  background: var(--bg-mid);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
  font-family: var(--mono);
}
.msg-content pre.code-block {
  background: var(--bg-darkest);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 4px 0;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.4;
  position: relative;
}
.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 4px;
  width: 26px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.1s, color 0.1s;
  padding: 0;
  line-height: 1;
}
.code-block:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: var(--bg-hover); color: var(--text); }
.code-copy-btn.copied { color: #4caf50; opacity: 1; }
.msg-content pre.code-block code {
  background: none;
  padding: 0;
  font-family: var(--mono);
}
.hljs { background: transparent; color: var(--text); }
.hljs-keyword, .hljs-selector-tag { color: #c792ea; }
.hljs-string, .hljs-regexp { color: #c3e88d; }
.hljs-number, .hljs-literal { color: #f78c6c; }
.hljs-comment, .hljs-quote { color: var(--text-dim); font-style: italic; }
.hljs-built_in { color: #82aaff; }
.hljs-title, .hljs-title\.function_ { color: #82aaff; }
.hljs-type, .hljs-title\.class_ { color: #ffcb6b; }
.hljs-attr, .hljs-attribute { color: #ffcb6b; }
.hljs-variable, .hljs-template-variable { color: #f07178; }
.hljs-tag { color: #f07178; }
.hljs-name { color: #f07178; }
.hljs-selector-class { color: #ffcb6b; }
.hljs-selector-id { color: #82aaff; }
.hljs-meta, .hljs-meta .hljs-keyword { color: var(--text-muted); }
.hljs-addition { color: #c3e88d; }
.hljs-deletion { color: #f07178; }
.hljs-symbol { color: #c792ea; }
.hljs-params { color: var(--text); }
.hljs-property { color: #82aaff; }
.hljs-operator { color: #89ddff; }
.hljs-punctuation { color: #89ddff; }
.hljs-subst { color: var(--text); }
.msg-content a { color: var(--accent); text-decoration: none; }
.msg-content a:hover { text-decoration: underline; }
.msg-content blockquote {
  border-left: 3px solid var(--text-dim);
  padding: 2px 10px;
  margin: 4px 0;
  color: var(--text-muted);
}
.msg-content blockquote blockquote {
  border-left-color: var(--accent);
  margin: 4px 0 4px 4px;
}

.msg-content .chat-heading { margin: 8px 0 4px; line-height: 1.3; }
.msg-content h1.chat-heading { font-size: 1.4rem; }
.msg-content h2.chat-heading { font-size: 1.2rem; }
.msg-content h3.chat-heading { font-size: 1.1rem; }
.msg-content h4.chat-heading { font-size: 1rem; font-weight: 600; }

.msg-content .chat-hr { border: none; border-top: 1px solid var(--bg-light); margin: 8px 0; }

.msg-content .chat-table { border-collapse: collapse; margin: 6px 0; font-size: 0.85rem; max-width: 100%; overflow-x: auto; display: block; }
.msg-content .chat-table th, .msg-content .chat-table td { border: 1px solid var(--bg-light); padding: 4px 10px; }
.msg-content .chat-table th { background: var(--bg-dark); font-weight: 600; color: var(--text-bright); }
.msg-content .chat-table td { background: var(--bg-darkest); }

.msg-content .chat-list { margin: 4px 0 4px 8px; padding-left: 18px; }
.msg-content .chat-list li { margin: 2px 0; line-height: 1.4; }
.msg-content .chat-list .chat-list { margin: 2px 0 2px 4px; }

.msg-content .chat-task { list-style: none; margin-left: -18px; }
.msg-content .chat-task input[type="checkbox"] { margin-right: 6px; vertical-align: middle; accent-color: var(--accent); }

.msg-content .chat-md-img { max-width: 400px; max-height: 300px; border-radius: var(--radius); margin: 4px 0; cursor: pointer; display: block; }

.msg-content .chat-math { display: inline; }
.msg-content .chat-math-block { margin: 6px 0; overflow-x: auto; text-align: center; }
.msg-content del { color: var(--text-dim); }
.msg-content.emoji-only { font-size: 2.5rem; line-height: 1.3; }
.msg-content.emoji-only .custom-emoji { width: 2.5rem; height: 2.5rem; vertical-align: middle; }

/* Link references */
.link-ref-inline { color: var(--accent); text-decoration: none; }
.link-ref-inline sup { font-size: 0.75em; font-weight: 600; }
.link-ref-inline:hover sup { text-decoration: underline; }
.link-refs { margin-top: 6px; padding: 6px 8px; background: var(--bg-darkest); border-radius: var(--radius); border-left: 2px solid var(--bg-light); font-size: 0.8rem; }
.link-ref { display: flex; align-items: center; gap: 6px; padding: 2px 0; min-width: 0; }
.link-ref-num { color: var(--text-dim); font-weight: 600; flex-shrink: 0; font-size: 0.75rem; }
.link-ref-url { color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link-ref-url:hover { text-decoration: underline; }
.link-ref-copy, .link-ref-open { flex-shrink: 0; background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.8rem; padding: 2px 4px; border-radius: 3px; text-decoration: none; line-height: 1; }
.link-ref-copy:hover, .link-ref-open:hover { color: var(--text); background: var(--bg-hover); }
.link-ref-copy.copied { color: #4caf50; }

/* Spoilers */
.spoiler {
  background: var(--bg-darkest);
  color: transparent;
  border-radius: 3px;
  padding: 0 3px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.spoiler.revealed { color: var(--text); background: var(--bg-hover); }

/* Mention pills */
.mention-pill {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}
.mention-pill:hover { background: rgba(79,195,247,0.3); }
.mention-pill.mention-self {
  background: rgba(79,195,247,0.25);
  color: #fff;
}

.channel-pill {
  background: rgba(79,195,247,0.12);
  color: #4fc3f7;
  padding: 0 5px;
  border-radius: 3px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.channel-pill:hover { background: rgba(79,195,247,0.28); }
.channel-pill-hash { opacity: 0.6; margin-right: 1px; }
.channel-pill.channel-private {
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  cursor: default;
  font-weight: 500;
}
.channel-pill.channel-private:hover { background: rgba(255,255,255,0.10); }
.channel-pill-lock { vertical-align: -1px; margin-right: 3px; opacity: 0.7; }

.channel-hover-card {
  position: fixed;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 200px;
  max-width: 300px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  pointer-events: none;
  animation: chc-fade-in 0.12s ease;
}
@keyframes chc-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.channel-hover-card.hidden { display: none; }
.chc-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.95em;
}
.chc-hash { color: var(--text-dim); font-size: 1.1em; }
.chc-lock { color: var(--text-dim); flex-shrink: 0; }
.chc-name { color: var(--text-primary); }
.chc-topic {
  font-size: 0.82em;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.chc-access {
  font-size: 0.78em;
  color: var(--text-dim);
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-height: 18px;
}
.chc-private-msg { color: #e57373; }
.chc-vis-icon { font-size: 1em; flex-shrink: 0; }
.chc-role {
  font-size: 0.9em;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid var(--text-dim);
  font-weight: 500;
}

.mention-hash {
  color: var(--text-dim);
  font-weight: 700;
  font-size: 1.05em;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.msg-reply-preview {
  background: var(--bg-darkest);
  border-left: 3px solid var(--accent);
  padding: 6px 10px 8px;
  margin-bottom: 6px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  max-width: 520px;
  transition: background 0.1s;
}
.msg-reply-preview:hover { background: var(--bg-hover); }
.reply-header {
  font-size: 0.75rem;
  margin-bottom: 2px;
  color: var(--text-dim);
}
.reply-author { font-weight: 600; color: var(--text); }
.reply-body { line-height: 1.35; }
.reply-body br { display: none; }
.reply-body .code-block { margin: 2px 0; padding: 3px 6px; font-size: 0.8rem; }

.msg-actions {
  display: none;
  position: absolute;
  top: -8px;
  right: 8px;
  background: var(--bg-mid);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2px;
  gap: 1px;
}
.message:hover .msg-actions { display: flex; }
.msg-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  font-size: 13px;
  border-radius: 3px;
  transition: background 0.1s, color 0.1s;
}
.msg-actions button:hover { background: var(--bg-hover); color: var(--text); }

.msg-reactions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.reaction-chip {
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: border-color 0.1s;
}
.reaction-chip:hover { border-color: var(--accent); }
.reaction-chip.mine { border-color: var(--accent); background: var(--accent-dim); }
.reaction-chip .count { font-size: 10px; color: var(--text-muted); }

/* YouTube embeds */
.msg-embed-yt {
  margin-top: 6px;
  max-width: 440px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
}
.msg-embed-yt iframe {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  border: none;
}
.yt-thumb-wrap {
  position: relative;
  cursor: pointer;
  aspect-ratio: 16/9;
  overflow: hidden;
}
.yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.15s;
}
.yt-thumb-wrap:hover .yt-thumb { filter: brightness(0.8); }
.yt-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.yt-thumb-wrap:hover .yt-play-btn { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
.yt-play-btn svg { width: 100%; height: 100%; }

/* Spotify embeds */
.msg-embed-spotify {
  margin-top: 6px;
  max-width: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.msg-embed-spotify iframe {
  width: 100%;
  height: 352px;
  display: block;
  border: none;
  border-radius: var(--radius-lg);
}
.msg-embed-spotify.spotify-compact iframe {
  height: 80px;
}

/* Embedded images */
.msg-embed-img {
  margin-top: 6px;
  max-width: 400px;
}
.msg-embed-img img {
  max-width: 100%;
  max-height: 350px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: block;
  transition: opacity 0.15s;
}
.msg-embed-img img:hover { opacity: 0.9; }
.msg-embed-video {
  margin-top: 6px;
  max-width: 500px;
}
.msg-embed-video video {
  max-width: 100%;
  max-height: 350px;
  border-radius: var(--radius-lg);
  display: block;
  background: #000;
}
.msg-embed-audio {
  margin-top: 6px;
  max-width: 400px;
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.audio-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.audio-icon { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.audio-filename {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-embed-audio audio { width: 100%; height: 32px; }
#image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fade-in 0.15s ease-out;
}
#image-viewer img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  cursor: default;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

/* GitHub cards */
.gh-card {
  margin-top: 6px;
  max-width: 420px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.gh-card:hover { border-color: #58a6ff; }
.gh-card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.gh-icon { width: 16px; height: 16px; color: #8b949e; flex-shrink: 0; }
.gh-repo-name { font-size: 14px; font-weight: 600; color: #58a6ff; }
.gh-desc { font-size: 12px; color: #8b949e; line-height: 1.5; margin-bottom: 10px; }
.gh-meta { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #8b949e; }
.gh-meta-item { display: flex; align-items: center; gap: 4px; }
.gh-meta-icon { width: 14px; height: 14px; }
.gh-lang-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: #8b949e; }
.gh-issue-card { }
.gh-issue-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gh-state-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; line-height: 1;
}
.gh-state-badge svg { width: 14px; height: 14px; }
.gh-state-open { background: #1a7f37; color: #fff; }
.gh-state-closed { background: #8957e5; color: #fff; }
.gh-state-merged { background: #8957e5; color: #fff; }
.gh-issue-repo { font-size: 12px; color: #8b949e; }
.gh-issue-title { font-size: 14px; font-weight: 600; color: #c9d1d9; line-height: 1.4; }
.gh-issue-num { color: #8b949e; font-weight: 400; }
.gh-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.gh-label {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; line-height: 1.5; white-space: nowrap;
}
.gh-issue-footer {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  font-size: 12px; color: #8b949e;
}
.gh-author-avatar { width: 18px; height: 18px; border-radius: 50%; }
.gh-author-name { font-weight: 500; }
.gh-issue-date { color: #484f58; }

/* Discord invite cards */
.discord-invite-card {
  margin-top: 6px;
  max-width: 420px;
  background: #2b2d31;
  border: 1px solid #1e1f22;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.discord-invite-banner { overflow: hidden; max-height: 120px; }
.discord-invite-banner img { width: 100%; display: block; object-fit: cover; }
.discord-invite-body { padding: 14px 16px; }
.discord-invite-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #b5bac1;
  margin-bottom: 10px;
}
.discord-invite-main { display: flex; align-items: center; gap: 12px; }
.discord-invite-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
}
.discord-invite-initial {
  background: #5865f2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.discord-invite-info { flex: 1; min-width: 0; }
.discord-invite-name {
  font-size: 15px;
  font-weight: 600;
  color: #f2f3f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.discord-invite-counts { display: flex; gap: 12px; margin-top: 4px; }
.discord-invite-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #b5bac1;
}
.discord-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.discord-dot.online { background: #23a559; }
.discord-dot.offline { background: #80848e; }
.discord-invite-join {
  background: #248046;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}
.discord-invite-join:hover { background: #1a6334; }

/* Uproar invite cards */
.uproar-invite-card {
  margin-top: 6px;
  max-width: 420px;
  background: var(--bg-light);
  border: 1px solid var(--bg-active);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.uproar-invite-banner { overflow: hidden; max-height: 120px; }
.uproar-invite-banner img { width: 100%; display: block; object-fit: cover; }
.uproar-invite-body { padding: 14px 16px; }
.uproar-invite-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.uproar-invite-main { display: flex; align-items: center; gap: 12px; }
.uproar-invite-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
}
.uproar-invite-initial {
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.uproar-invite-info { flex: 1; min-width: 0; }
.uproar-invite-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uproar-invite-counts { display: flex; gap: 12px; margin-top: 4px; }
.uproar-invite-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.uproar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.uproar-dot.online { background: var(--online); }
.uproar-dot.members { background: var(--text-dim); }
.uproar-invite-join {
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
  cursor: pointer;
}
.uproar-invite-join:hover { background: var(--accent-hover); }

/* Shared embed card base */
.embed-card {
  margin-top: 6px;
  max-width: 420px;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}

/* Reddit */
.reddit-card {
  background: #1a1a1b;
  border: 1px solid #343536;
}
.reddit-card:hover { border-color: #ff4500; }
.reddit-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.reddit-icon { width: 20px; height: 20px; flex-shrink: 0; }
.reddit-sub { font-size: 13px; font-weight: 700; color: #d7dadc; }
.reddit-author { font-size: 12px; color: #818384; margin-left: auto; }
.reddit-title { font-size: 15px; font-weight: 600; color: #d7dadc; line-height: 1.4; }
.reddit-nsfw {
  background: #ff585b; color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 4px; border-radius: 2px; vertical-align: middle;
}
.reddit-selftext { font-size: 12px; color: #818384; margin-top: 6px; line-height: 1.4; }
.reddit-thumb { margin-top: 8px; border-radius: var(--radius); overflow: hidden; }
.reddit-thumb img { max-width: 100%; max-height: 200px; display: block; border-radius: var(--radius); }
.reddit-footer { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: #818384; }
.reddit-stat { display: flex; align-items: center; gap: 4px; }

/* Wikipedia */
.wikipedia-card {
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
}
.wikipedia-card:hover { border-color: #36c; }
.wiki-header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.wiki-icon { color: #202122; }
.wiki-label { font-size: 11px; font-weight: 700; color: #54595d; letter-spacing: 0.5px; }
.wiki-body { display: flex; gap: 12px; }
.wiki-content { flex: 1; min-width: 0; }
.wiki-title { font-size: 16px; font-weight: 700; color: #202122; font-family: "Linux Libertine", Georgia, serif; }
.wiki-extract { font-size: 13px; color: #202122; line-height: 1.5; margin-top: 4px; }
.wiki-thumb { width: 100px; height: 100px; border-radius: var(--radius); object-fit: cover; flex-shrink: 0; }

/* Hacker News */
.hn-card {
  background: #f6f6ef;
  border: 1px solid #d4d4c8;
}
.hn-card:hover { border-color: #ff6600; }
.hn-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.hn-logo { flex-shrink: 0; }
.hn-label { font-size: 13px; font-weight: 700; color: #828282; }
.hn-title { font-size: 14px; font-weight: 600; color: #000; line-height: 1.4; }
.hn-domain { font-size: 11px; color: #828282; font-weight: 400; }
.hn-footer { display: flex; gap: 10px; margin-top: 8px; font-size: 12px; color: #828282; }
.hn-stat { white-space: nowrap; }

/* Steam */
.steam-card {
  background: #1b2838;
  border: 1px solid #2a475e;
  padding: 0;
  overflow: hidden;
}
.steam-card:hover { border-color: #66c0f4; }
.steam-header-img img { width: 100%; display: block; }
.steam-body { padding: 12px 16px; }
.steam-top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.steam-icon { flex-shrink: 0; }
.steam-label { font-size: 11px; font-weight: 700; color: #66c0f4; letter-spacing: 1px; }
.steam-name { font-size: 16px; font-weight: 600; color: #c7d5e0; }
.steam-desc { font-size: 12px; color: #8f98a0; line-height: 1.4; margin-top: 4px; }
.steam-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.steam-genres { font-size: 11px; color: #66c0f4; }
.steam-price { font-size: 14px; font-weight: 700; color: #beee11; }
.steam-discount {
  background: #4c6b22; color: #beee11; font-size: 12px; font-weight: 700;
  padding: 2px 6px; border-radius: 2px; margin-right: 6px;
}

/* TikTok */
.tiktok-card {
  background: #121212;
  border: 1px solid #2f2f2f;
}
.tiktok-card:hover { border-color: #ff004f; }
.tiktok-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.tiktok-icon { flex-shrink: 0; }
.tiktok-label { font-size: 13px; font-weight: 700; color: #e1e1e1; }
.tiktok-handle { font-size: 12px; color: #8a8b91; margin-left: auto; }
.tiktok-title { font-size: 14px; font-weight: 600; color: #e1e1e1; line-height: 1.4; }
.tiktok-desc { font-size: 12px; color: #8a8b91; margin-top: 4px; line-height: 1.4; }
.tiktok-thumb { margin-top: 8px; border-radius: var(--radius); overflow: hidden; }
.tiktok-thumb img { max-width: 100%; max-height: 250px; display: block; }

/* Instagram */
.instagram-card {
  background: #1a1a1a;
  border: 1px solid #363636;
}
.instagram-card:hover { border-color: #d62976; }
.ig-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ig-icon { flex-shrink: 0; }
.ig-label { font-size: 13px; font-weight: 700; color: #e1e1e1; }
.ig-title { font-size: 14px; font-weight: 600; color: #e1e1e1; line-height: 1.4; }
.ig-desc { font-size: 12px; color: #8e8e8e; margin-top: 4px; line-height: 1.4; }
.ig-thumb { margin-top: 8px; border-radius: var(--radius); overflow: hidden; }
.ig-thumb img { max-width: 100%; max-height: 280px; display: block; }

/* Twitch */
.twitch-card {
  background: #0e0e10;
  border: 1px solid #2c2c35;
}
.twitch-card:hover { border-color: #9146ff; }
.twitch-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.twitch-icon { flex-shrink: 0; }
.twitch-label { font-size: 13px; font-weight: 700; color: #efeff1; }
.twitch-channel { font-size: 12px; color: #adadb8; margin-left: auto; }
.twitch-title { font-size: 14px; font-weight: 600; color: #efeff1; line-height: 1.4; }
.twitch-desc { font-size: 12px; color: #adadb8; margin-top: 4px; line-height: 1.4; }
.twitch-thumb { margin-top: 8px; border-radius: var(--radius); overflow: hidden; }
.twitch-thumb img { max-width: 100%; display: block; }

/* Twitter/X cards */
.tw-card {
  margin-top: 6px;
  max-width: 420px;
  background: #000;
  border: 1px solid #2f3336;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.tw-card:hover { border-color: #536471; }
.tw-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.tw-x-icon { width: 18px; height: 18px; color: #e7e9ea; }
.tw-author { margin-bottom: 8px; }
.tw-author-name { font-size: 14px; font-weight: 700; color: #e7e9ea; }
.tw-handle { font-size: 13px; color: #71767b; margin-left: 6px; }
.tw-text { font-size: 14px; color: #e7e9ea; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.tw-media { margin-top: 10px; border-radius: var(--radius); overflow: hidden; }
.tw-media img {
  width: 100%; max-height: 280px; object-fit: cover; display: block;
  cursor: pointer;
}

/* Link unfurl */
.unfurl-card {
  background: var(--bg-mid);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 10px;
  margin-top: 4px;
  max-width: 400px;
}
.unfurl-site { font-size: 10px; color: var(--text-dim); }
.unfurl-title { font-weight: 600; font-size: 13px; color: var(--accent); }
.unfurl-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.unfurl-card img { max-width: 100%; max-height: 200px; border-radius: var(--radius); margin-top: 4px; }

#typing-indicator {
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 20px;
}

/* Message form */
#message-form {
  padding: 0 16px 12px;
  flex-shrink: 0;
  position: relative;
}

#reply-preview {
  background: var(--bg-mid);
  padding: 4px 10px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
#reply-cancel {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  transition: color 0.1s;
}
#reply-cancel:hover { color: var(--text); }

.message-input-row { display: flex; gap: 8px; align-items: flex-end; }
#emoji-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
#emoji-btn:hover { opacity: 1; }

#emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 340px;
  max-height: 360px;
  background: var(--bg-mid);
  border: 1px solid var(--bg-active);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  z-index: 200;
  margin-bottom: 4px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}
#emoji-picker.hidden { display: none; }
.emoji-search-wrap { padding: 8px 8px 4px; }
.emoji-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  background: var(--bg-dark);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.emoji-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--bg-light);
}
.emoji-tab {
  font-size: 18px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: var(--radius);
  opacity: 0.5;
  transition: opacity 0.1s, background 0.1s;
}
.emoji-tab:hover { opacity: 0.8; background: var(--bg-hover); }
.emoji-tab.active { opacity: 1; background: var(--bg-active); }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}
.emoji-cell {
  font-size: 22px;
  text-align: center;
  padding: 4px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.1s;
  line-height: 1.2;
}
.emoji-cell:hover { background: var(--bg-hover); }

/* @mention autocomplete */
.mention-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-mid);
  border: 1px solid var(--bg-active);
  border-radius: var(--radius);
  z-index: 200;
  margin-bottom: 4px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}
.mention-dropdown.hidden { display: none; }
.mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
}
.mention-item:hover, .mention-item.active { background: var(--bg-hover); }
.mention-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}
.mention-emoji { font-size: 20px; line-height: 1; width: 24px; text-align: center; flex-shrink: 0; }
.mention-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.mention-slash {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-active);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.slash-desc { color: var(--text-dim); font-weight: 400; margin-left: 4px; }

/* Shortcuts help overlay */
#shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shortcuts-panel {
  background: var(--bg-mid);
  border-radius: var(--radius);
  padding: 24px 32px;
  min-width: 320px;
  max-width: 420px;
  color: var(--text);
}
.shortcuts-panel h3 { margin: 0 0 16px; font-size: 16px; }
.shortcut-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sc-row { display: flex; align-items: center; gap: 12px; }
.sc-row kbd {
  background: var(--bg-dark);
  border: 1px solid var(--bg-active);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-family: monospace;
  min-width: 50px;
  text-align: center;
}
.sc-row span { font-size: 13px; color: var(--text-muted); }

#message-input {
  flex: 1;
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  resize: none;
  max-height: 150px;
  transition: border-color 0.15s;
}
#message-input:focus { outline: none; border-color: var(--accent); }

#send-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  opacity: 0.7;
  padding: 0;
  margin-bottom: 2px;
}
#send-btn:hover { background: var(--accent-hover); opacity: 1; }

/* Right panel */
#right-panel {
  width: 260px;
  background: var(--bg-mid);
  border-left: 1px solid var(--bg-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#right-panel-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bg-light);
  min-height: 48px;
}
#right-panel-header h3 { font-size: 14px; font-weight: 600; }
#right-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.1s;
}
#right-panel-close:hover { color: var(--text); }

#right-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.member-item {
  display: flex;
  align-items: center;
  padding: 5px 14px;
  gap: 8px;
  cursor: pointer;
  border-radius: var(--radius);
  margin: 0 4px;
  transition: background 0.1s;
}
.member-item:hover { background: var(--bg-hover); }
.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.member-status {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-mid);
}
.member-info { min-width: 0; }
.member-name { font-size: 13px; }
.member-name .nickname { color: var(--text-dim); font-size: 11px; }
.member-status-text { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.role-dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  min-width: 3px;
  min-height: 3px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  cursor: default;
}

.msg-header .role-dot {
  margin-left: 4px;
}

/* Role pills (e.g. user profile modal) */
.role-pill {
  font-size: 10px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid var(--text-dim);
  color: var(--text-dim);
  white-space: nowrap;
  line-height: 16px;
}

/* Role badge next to message author */
.bot-badge {
  font-size: 10px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  white-space: nowrap;
  margin-left: 4px;
  line-height: 14px;
  font-weight: 700;
}

.member-role-header {
  padding: 8px 14px 3px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* Modal */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  z-index: 600;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }

#modal {
  background: var(--bg-mid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-x: hidden;
  overflow-y: auto;
  animation: modal-in 0.2s ease-out;
}
@keyframes modal-in { from { transform: scale(0.95); opacity: 0; } }

#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--bg-light);
}
#modal-header h3 { font-size: 16px; font-weight: 600; }
#modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  transition: color 0.1s;
}
#modal-close:hover { color: var(--text); }

#modal-body { padding: 14px 16px; overflow: hidden; }
.invite-banner {
  margin: -14px -16px 12px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.invite-banner img { width: 100%; display: block; }
#modal-body input, #modal-body textarea, #modal-body select {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
}
#modal-body input:focus, #modal-body textarea:focus, #modal-body select:focus {
  outline: none;
  border-color: var(--accent);
}
#modal-body button,
#settings-content-body button {
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  margin-right: 6px;
  transition: background 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-secondary { background: var(--bg-light); color: var(--text); }
.btn-secondary:hover { background: var(--bg-hover); }

/* Search in panel */
.search-input {
  width: calc(100% - 24px);
  padding: 8px 10px;
  background: var(--bg-dark);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  margin: 8px 12px;
  transition: border-color 0.15s;
}
.search-input:focus { outline: none; border-color: var(--accent); }

/* Discriminator */
.disc { color: var(--text-dim); font-size: 0.85em; }

/* Setup modal */
.setup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}
.setup-card {
  background: var(--bg-mid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
}
.setup-card h2 { margin-bottom: 6px; font-size: 20px; }
.setup-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.setup-card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
}
.setup-card input:focus { outline: none; border-color: var(--accent); }
.setup-card button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.setup-card button:hover { background: var(--accent-hover); }

/* Context menu */
.context-menu {
  position: fixed;
  z-index: 300;
  background: var(--bg-darkest);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 4px;
  min-width: 160px;
  animation: modal-in 0.1s ease-out;
}
.context-menu-item {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.context-menu-item:hover { background: var(--accent); color: #fff; }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: var(--danger); color: #fff; }
.context-menu-sep {
  height: 1px;
  background: var(--bg-light);
  margin: 4px 6px;
}
.context-menu-has-sub {
  position: relative;
}
.context-menu-has-sub::after {
  content: '\25B8';
  float: right;
  margin-left: 8px;
  color: var(--text-dim);
}
.context-menu-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: -4px;
  background: var(--bg-darkest);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 6px;
  gap: 2px;
  flex-wrap: wrap;
  width: 200px;
  z-index: 301;
}
.context-menu-has-sub:hover > .context-menu-sub.flip-left {
  left: auto;
  right: 100%;
}
.context-menu-has-sub:hover > .context-menu-sub {
  display: flex;
}
.context-menu-roles {
  width: 200px;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  padding: 4px 0;
  max-height: 260px;
  overflow-y: auto;
}
.context-role-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}
.context-role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.context-role-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-role-check {
  width: 16px;
  text-align: center;
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}
.context-menu-emoji {
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  transition: background 0.1s;
  line-height: 1;
}
.context-menu-emoji:hover {
  background: var(--bg-light);
}

/* Role manager */
.role-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
}
.role-list-item:hover { background: var(--bg-hover); }
.role-list-name { flex: 1; font-size: 13px; }
.role-list-count { font-size: 11px; color: var(--text-dim); }

.role-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Role editor */
.role-editor {}
.re-section { margin-bottom: 12px; }
.re-label { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--text-dim); letter-spacing: 0.04em; display: block; margin-bottom: 6px; }

.color-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.color-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.1s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; }

.re-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.re-toggle-row input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* Permission grid */
.perm-group-label {
  font-size: 10px; text-transform: uppercase; font-weight: 700;
  color: var(--text-dim); letter-spacing: 0.04em;
  margin-top: 8px; margin-bottom: 4px;
}
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.perm-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 3px 0; cursor: pointer;
}
.perm-toggle input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

/* Profile card */
.profile-card {
  margin: -14px -16px;
}
.pc-banner {
  height: 60px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.pc-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: -40px auto 0;
}
.pc-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-mid);
  background: var(--bg-dark);
}
.pc-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-muted);
}
.pc-status-ring {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--bg-mid);
}
.pc-status-ring.online { background: var(--success); }
.pc-status-ring.away { background: #fdd835; }
.pc-status-ring.dnd { background: var(--danger); }
.pc-status-ring.invisible, .pc-status-ring.offline { background: var(--text-dim); }
.pc-identity {
  text-align: center;
  padding: 8px 16px 0;
}
.pc-name {
  font-size: 18px;
  font-weight: 700;
}
.pc-username {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.pc-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.pc-status-text {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}
.pc-section {
  padding: 10px 16px 0;
  border-top: 1px solid var(--bg-light);
  margin-top: 10px;
}
.pc-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.pc-detail {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 0;
}
.pc-detail-label {
  color: var(--text-dim);
  margin-right: 8px;
  font-weight: 600;
}
.pc-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pc-roles-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pc-role-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}
.pc-role-row:hover { background: var(--bg-hover); }
.pc-role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pc-role-name { flex: 1; }
.pc-role-check {
  width: 16px;
  text-align: center;
  color: var(--success);
  font-weight: 700;
}
.pc-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--bg-light);
  margin-top: 10px;
}
.btn-danger-subtle {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger-subtle:hover {
  background: var(--danger);
  color: #fff;
}

/* Channel settings tabs */
.ch-settings-tabs {
  display: flex; gap: 2px; margin-bottom: 10px;
  border-bottom: 1px solid var(--bg-light); padding-bottom: 6px;
}
.ch-tab {
  background: none; border: none; color: var(--text-dim);
  font-size: 12px; padding: 4px 10px; cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, background 0.15s;
}
.ch-tab:hover { color: var(--text); }
.ch-tab.active { color: var(--text); background: var(--bg-hover); }

/* Permission override rows */
.ovr-row {
  margin-bottom: 4px;
  background: var(--bg-dark);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ovr-row-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 13px;
  cursor: pointer; user-select: none;
  transition: background 0.1s;
}
.ovr-row-header:hover { background: var(--bg-hover); }
.ovr-chevron {
  font-size: 11px; color: var(--text-dim);
  transition: transform 0.15s;
  display: inline-block;
}
.ovr-chevron.expanded { transform: rotate(90deg); }
.ovr-row-name { font-weight: 600; }
.ovr-summary {
  margin-left: auto; font-size: 11px; color: var(--text-dim);
}
.ovr-count-allow { color: #4caf50; }
.ovr-count-deny { color: #ef5350; }
.ovr-count-neutral { color: var(--text-dim); }
.ovr-remove {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 0 4px;
  line-height: 1;
}
.ovr-remove:hover { color: var(--danger); }

.ovr-perms {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 2px 0; padding: 4px 12px 10px 12px;
  border-top: 1px solid var(--border);
}
.ovr-perms.hidden { display: none; }

.ovr-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; padding: 6px 8px; cursor: pointer;
  user-select: none; border-radius: var(--radius);
  transition: background 0.1s;
}
.ovr-toggle:hover { background: var(--bg-hover); }
.ovr-toggle-label { flex: 1; color: var(--text); }

.ovr-toggle-indicator {
  width: 18px; height: 18px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  transition: background 0.15s;
}
.ovr-inherit { background: var(--bg-light); color: var(--text-dim); }
.ovr-inherit::after { content: '—'; }
.ovr-allow { background: #2e7d32; color: #fff; }
.ovr-allow::after { content: '✓'; }
.ovr-deny { background: #c62828; color: #fff; }
.ovr-deny::after { content: '✕'; }

#add-member-ovr-select {
  width: 100%; padding: 8px 10px;
  background: var(--bg-dark); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12px; cursor: pointer;
}

#ch-overrides-list .re-label {
  text-transform: uppercase; font-size: 11px;
  font-weight: 700; color: var(--text-dim);
  letter-spacing: 0.5px; margin-bottom: 6px;
}

#sync-cat-btn {
  width: 100%; margin-top: 10px;
}

/* Slowmode indicator */
.slowmode-indicator {
  background: var(--bg-light);
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
  padding: 3px 8px;
  border-radius: var(--radius);
  margin: 0 12px 4px;
}

.btn-secondary {
  background: var(--bg-hover);
  border: 1px solid var(--bg-light);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
}
.btn-secondary:hover { background: var(--bg-light); }

/* Welcome prompt */
#welcome-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-dim);
  gap: 8px;
  padding: 24px;
}
#welcome-prompt h2 { color: var(--text); font-size: 22px; font-weight: 600; }
#welcome-prompt p { font-size: 14px; max-width: 320px; line-height: 1.5; }
.welcome-actions { display: flex; gap: 10px; margin-top: 12px; }
.welcome-btn {
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-weight: 500;
}
.welcome-btn.primary { background: var(--accent); color: #000; }
.welcome-btn.primary:hover { background: var(--accent-hover); }
.welcome-btn.secondary {
  background: transparent;
  border: 1px solid var(--bg-light);
  color: var(--text);
}
.welcome-btn.secondary:hover { background: var(--bg-hover); }

/* DM tabs */
.dm-tabs {
  display: flex;
  border-bottom: 1px solid var(--bg-light);
  margin-bottom: 4px;
  padding: 0 4px;
}
.dm-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.dm-tab:hover { color: var(--text); }
.dm-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.dm-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px 14px;
  text-align: center;
}

/* Friends list */
.friend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-radius: var(--radius);
}
.friend-item:hover { background: var(--bg-hover); }
.friend-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.friend-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.friend-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}
.friend-status-dot.online { background: var(--online); }
.friend-status-dot.away { background: var(--away); }
.friend-status-dot.dnd { background: var(--danger); }
.friend-status-dot.offline { background: var(--text-dim); }
.friend-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.friend-star {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-dim);
  padding: 2px 4px;
  line-height: 1;
}
.friend-star:hover { color: var(--accent); }
.friend-star.active { color: #ffc107; }
.friend-msg-btn, .friend-remove-btn {
  padding: 3px 8px;
  font-size: 11px;
}
.pending-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 12px 4px;
  letter-spacing: 0.5px;
}
.pending-accept, .pending-decline, .pending-cancel {
  padding: 3px 10px;
  font-size: 11px;
}

.msg-ignored {
  padding: 4px 16px;
  opacity: 0.5;
}
.msg-ignored:hover { opacity: 0.7; }
.msg-ignored.revealed { opacity: 0.85; }
.msg-ignored-placeholder {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}
.msg-ignored-show, .msg-ignored-show-inline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 3px;
  cursor: pointer;
}
.msg-ignored-show:hover, .msg-ignored-show-inline:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.msg-ignored-content.hidden { display: none; }
.msg-blocked-reply {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  padding: 2px 0 4px;
}
.msg-ignored-reply {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  padding: 2px 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.block-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.block-entry:last-child { border-bottom: none; }
.block-entry-info { display: flex; flex-direction: column; gap: 2px; }
.block-entry-name { font-size: 13px; }
.block-entry-kind {
  font-size: 11px;
  color: var(--text-dim);
}
.block-kind-block { color: var(--danger); }
.block-kind-cooldown { color: var(--warning, #ffc107); }

.invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.invite-row:last-child { border-bottom: none; }
.invite-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.invite-row-code {
  font-size: 13px;
  font-weight: 600;
  user-select: all;
}
.invite-row-meta {
  font-size: 11px;
  color: var(--text-dim);
}
.invite-row-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.invite-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Settings overlay */
#settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg-dark);
  animation: fade-in 0.15s ease-out;
}
#settings-container {
  display: flex;
  height: 100%;
  position: relative;
}
#settings-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 10;
  background: var(--bg-light);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
#settings-close:hover { color: var(--text); border-color: var(--text-dim); }
#settings-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-darkest);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
#settings-search {
  margin: 16px 12px 8px;
  padding: 7px 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font);
  outline: none;
  flex-shrink: 0;
}
#settings-search:focus { border-color: var(--accent); }
#settings-search::placeholder { color: var(--text-dim); }
#settings-nav {
  padding: 4px 8px 16px;
  flex: 1;
  overflow-y: auto;
}
.settings-cat-header {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 16px 10px 4px;
  margin-top: 4px;
  border-top: 1px solid var(--bg-light);
}
.settings-cat-header:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 8px;
}
.settings-nav-item {
  padding: 7px 10px;
  font-size: 0.92rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.settings-nav-item:hover { background: var(--bg-light); color: var(--text); }
.settings-nav-item.active { background: var(--accent); color: #fff; }
.settings-nav-item.hidden { display: none; }
#settings-content {
  flex: 1;
  background: var(--bg-dark);
  border-top-left-radius: 14px;
  overflow: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 48px;
}
#settings-content-title {
  font-size: 1.4rem;
  font-weight: 700;
  width: 100%;
  max-width: 660px;
  margin-bottom: 20px;
}
#settings-content-body {
  width: 100%;
  max-width: 660px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; min-width: 0; }
.setting-name { font-size: 1rem; font-weight: 600; margin-bottom: 2px; }
.setting-desc { font-size: 0.85rem; color: var(--text-dim); line-height: 1.4; }
.setting-control { flex-shrink: 0; }
.setting-control input[type="text"],
.setting-control select {
  padding: 6px 10px;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font);
  width: 240px;
  box-sizing: border-box;
}
.setting-control input[type="text"]:focus,
.setting-control select:focus { outline: none; border-color: var(--accent); }
.setting-readonly {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding: 6px 0;
}
.setting-section-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.setting-section-header:first-child { padding-top: 0; }
.setting-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 16px -16px 0;
  position: sticky;
  bottom: 0;
  background: var(--bg-darkest);
  border-top: 1px solid var(--bg-light);
  z-index: 5;
}
.setting-actions .btn-primary {
  min-width: 120px;
}
.setting-actions.hidden {
  display: none;
}
.badge-enabled {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #43a047;
  border-radius: 10px;
  vertical-align: middle;
  margin-right: 4px;
  letter-spacing: 0.02em;
}
.setting-dirty {
  background: var(--accent-dim, rgba(79,195,247,0.1));
  border-radius: var(--radius);
  margin-left: -8px;
  margin-right: -8px;
  padding-left: 8px !important;
  padding-right: 8px !important;
  transition: background 0.2s;
}
.settings-danger-zone {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-lg);
}
.settings-danger-zone .setting-name { color: var(--danger); }

/* Admin panel */
.admin-loading { padding: 16px; color: var(--text-dim); font-size: 13px; }
.dash-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.dash-card { background: var(--bg-dark); border: 1px solid var(--bg-light); border-radius: var(--radius-lg); padding: 16px; display: flex; align-items: center; gap: 12px; }
.dash-card-accent { border-color: var(--accent); border-width: 1px 1px 1px 3px; }
.dash-card-icon { font-size: 24px; flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--bg-light); border-radius: var(--radius); }
.dash-card-val { font-size: 24px; font-weight: 700; color: var(--text-bright); line-height: 1.1; }
.dash-card-of { font-size: 14px; font-weight: 400; color: var(--text-dim); }
.dash-card-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.dash-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .dash-panels { grid-template-columns: 1fr; } }
.dash-panel { background: var(--bg-dark); border: 1px solid var(--bg-light); border-radius: var(--radius-lg); padding: 16px; }
.dash-panel-title { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--bg-light); }

.dash-metric-rows { display: flex; flex-direction: column; gap: 0; }
.dash-metric { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--bg-light); }
.dash-metric:last-child { border-bottom: none; }
.dash-metric-label { font-size: 0.85rem; color: var(--text-muted); }
.dash-metric-val { font-size: 0.85rem; font-weight: 600; color: var(--text-bright); }
.dash-pct { font-weight: 400; color: var(--text-dim); }

.dash-user-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bg-light); }
.dash-user-row:last-child { border-bottom: none; }
.dash-user-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.dash-user-av-ph { background: var(--bg-light); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--text-dim); }
.dash-user-info { flex: 1; min-width: 0; }
.dash-user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-user-sub { font-size: 0.75rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-user-date { font-size: 0.75rem; color: var(--text-dim); flex-shrink: 0; }
.dash-empty { font-size: 0.85rem; color: var(--text-dim); font-style: italic; }
.admin-search { margin-bottom: 10px; }
.admin-table-info { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--bg-light); }
.admin-table tr:hover td { background: var(--bg-hover); }
.admin-table tr.admin-disabled td { opacity: 0.5; }
.admin-user-cell { display: flex; align-items: center; gap: 8px; }
.admin-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.admin-avatar-ph { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-light); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.admin-user-name { font-weight: 600; color: var(--text); font-size: 13px; }
.admin-user-sub { font-size: 11px; color: var(--text-dim); }
.admin-badge { font-size: 9px; background: var(--accent); color: #fff; padding: 1px 5px; border-radius: 3px; font-weight: 700; vertical-align: middle; }
.admin-actions { display: flex; gap: 4px; }
.btn-small { padding: 3px 8px; font-size: 11px; border: 1px solid var(--border); background: var(--bg-mid); color: var(--text); border-radius: 4px; cursor: pointer; white-space: nowrap; }
.btn-small:hover { background: var(--bg-hover); }
.btn-small.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-small.btn-danger:hover { background: var(--danger); color: #fff; }
.admin-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0; }
.admin-page-info { font-size: 12px; color: var(--text-dim); }
.admin-textarea { width: 100%; min-height: 80px; resize: vertical; padding: 10px; background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: inherit; font-size: 13px; }
.admin-textarea:focus { outline: none; border-color: var(--accent); }
.admin-announce-compose { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.admin-announce-compose .btn-primary { align-self: flex-end; }
.admin-announce-list { display: flex; flex-direction: column; gap: 8px; }
.admin-announce-item { background: var(--bg-dark); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.admin-announce-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.admin-announce-author { font-weight: 600; font-size: 13px; }
.admin-announce-time { font-size: 11px; color: var(--text-dim); }
.admin-announce-del { margin-left: auto; }
.admin-announce-body { font-size: 13px; line-height: 1.4; color: var(--text-muted); }
.admin-empty { padding: 12px; color: var(--text-dim); font-size: 13px; }

/* God mode overlay */
#god-mode {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--bg-darkest);
}
#god-mode.hidden { display: none; }
#god-mode-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-dim);
  border-bottom: 2px solid var(--accent);
  flex-shrink: 0;
}
#god-mode-title {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}
#god-mode-close {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
#god-mode-close:hover { color: var(--text); }
#god-mode-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
#god-mode-sidebar {
  width: 220px;
  background: var(--bg-dark);
  border-right: 1px solid var(--bg-light);
  overflow-y: auto;
  padding: 8px 0;
  flex-shrink: 0;
}
#god-mode-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-mid);
}
.god-sidebar-section { margin-bottom: 4px; }
.god-sidebar-label {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.god-channel {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  margin: 0 6px;
}
.god-channel:hover { background: var(--bg-light); color: var(--text); }
.god-channel.active { background: var(--accent-dim); color: var(--accent); }
.god-mode-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 14px;
}
.god-msg .msg-actions { display: none !important; }

@media (max-width: 768px) {
  #god-mode-sidebar { width: 160px; }
}

/* Icon upload */
.icon-upload-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 20px;
}
.icon-preview-squircle {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: border-radius 0.2s;
}
.icon-preview-squircle:hover { border-radius: 20px; }
.icon-preview-squircle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.icon-preview-initial {
  font-size: 40px;
  font-weight: 700;
  color: var(--text-muted);
}
.icon-preview-hover {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.15s;
}
.icon-preview-squircle:hover .icon-preview-hover { opacity: 1; }
.avatar-preview-circle { border-radius: 50%; }
.avatar-preview-circle:hover { border-radius: 50%; }

/* Appearance settings */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 8px 0 16px;
}
.theme-card {
  cursor: pointer;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  padding: 4px;
  transition: border-color 0.15s, transform 0.1s;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--accent); }
.theme-preview {
  border-radius: var(--radius);
  border: 1px solid;
  height: 56px;
  display: flex;
  overflow: hidden;
}
.theme-preview-sidebar {
  width: 22%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-preview-accent {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.theme-preview-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px;
}
.theme-preview-line {
  height: 4px;
  border-radius: 2px;
  opacity: 0.7;
}
.theme-preview-line.short { width: 55%; }
.theme-card-label {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 5px;
  color: var(--text-muted);
}
.theme-card.active .theme-card-label { color: var(--accent); }

.preview-chat {
  background: var(--bg-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--bg-active);
  pointer-events: none;
  position: relative;
  padding: 8px 0;
  margin-bottom: 16px;
}
.preview-label {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  opacity: 0.6;
}
#preview-float-wrap {
  position: fixed;
  width: 260px;
  pointer-events: none;
  transition: opacity 0.2s;
}
#preview-float-wrap .preview-chat {
  margin-bottom: 0;
  box-shadow: var(--shadow);
}

.accent-picker { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.accent-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}
.accent-swatch:hover { transform: scale(1.15); }
.accent-swatch.active { border-color: var(--text); }
.accent-swatch-default { position: relative; }
.accent-swatch-default::after {
  content: '\2713';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.15s;
}
.accent-swatch-default.active::after { opacity: 1; }
.accent-swatch-picker {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  background: conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  transition: border-color 0.15s, transform 0.15s;
}
.accent-swatch-picker:hover { transform: scale(1.15); }
.accent-swatch-picker.active { border-color: var(--text); }
.accent-swatch-picker input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.seg-btn:hover { background: var(--bg-hover); color: var(--text); }
.seg-btn.active { background: var(--accent); color: var(--bg-dark); }

.font-size-label {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

#main-view.sidebar-right { flex-direction: row-reverse; }
#main-view.sidebar-right #sidebar-resize-handle { right: auto; left: -2px; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-active);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Notched slider */
.notch-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.notch-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  background: var(--bg-active);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.notch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-darkest);
  cursor: pointer;
  transition: transform 0.1s;
}
.notch-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.notch-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-darkest);
  cursor: pointer;
}

/* Compact mode */
body.compact-mode .message { padding: 2px 12px; margin-top: 1px; }
body.compact-mode .message.grouped { padding: 1px 12px 1px 52px; }
body.compact-mode .msg-avatar { width: 28px; height: 28px; font-size: 12px; }

/* Roomy mode */
body.roomy-mode .message { padding: 10px 16px; margin-top: 6px; }
body.roomy-mode .message.grouped { padding: 4px 16px 4px 64px; }

/* All-timestamps mode */
.msg-time-inline { display: none; font-size: 0.786rem; color: var(--text-dim); margin-left: 6px; font-weight: 400; }
body.show-all-timestamps .msg-time-inline { display: inline; }

/* Mobile server strip (hidden on desktop) */
#mobile-server-strip {
  display: none;
}

/* Mobile hamburger button (hidden on desktop) */
#mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  #server-sidebar { display: none; }
  #channel-sidebar { display: none; position: fixed; top: 0; left: 0; bottom: 0; z-index: 500; width: 260px !important; max-width: 80vw; }
  #channel-sidebar.mobile-open { display: flex; }
  #sidebar-resize-handle { display: none; }
  #mobile-menu-btn { display: block; }
  #mobile-server-strip {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-darkest);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    scrollbar-width: none;
    align-items: center;
  }
  #mobile-server-strip::-webkit-scrollbar { display: none; }
  .mobile-srv-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--bg-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    transition: border-radius 0.15s, background 0.15s;
    overflow: hidden;
  }
  .mobile-srv-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
  }
  .mobile-srv-icon:hover, .mobile-srv-icon.active {
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
  }
  .mobile-srv-sep {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
  }
  .mobile-srv-add, .mobile-srv-join {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--bg-mid);
    border: none;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
  }
  .mobile-srv-add:hover, .mobile-srv-join:hover {
    background: var(--accent);
    color: #fff;
  }
  #chat-area { width: 100%; }
  #right-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 100% !important; z-index: 500; }
  #modal { max-width: 95vw; }
  #settings-container { flex-direction: column; }
  #settings-sidebar { max-height: 30vh; overflow-y: auto; border-right: none; border-bottom: 1px solid var(--bg-light); width: 100%; }
  #settings-content { flex: 1; border-top-left-radius: 0; }
  .context-menu { max-width: 90vw; }
  .message { padding: 6px 10px; }
  .msg-avatar { width: 30px; height: 30px; font-size: 12px; }
  .message.grouped { padding: 1px 10px 1px 52px; }
  #emoji-picker { width: calc(100vw - 32px); max-width: 340px; }
  .member-item { padding: 6px 8px; }

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 499;
  }
}

.custom-emoji { height: 1.4em; width: auto; vertical-align: middle; margin: 0 1px; display: inline; }
.custom-emoji.animated { }
.custom-emoji-pick { height: 24px; width: 24px; object-fit: contain; }
.emoji-mgmt-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-mgmt-item { display: flex; align-items: center; gap: 6px; background: var(--bg-mid); padding: 4px 10px; border-radius: var(--radius); }
.emoji-mgmt-img { height: 28px; width: 28px; object-fit: contain; }
.emoji-mgmt-name { font-size: 13px; color: var(--text-dim); }
.emoji-mgmt-del { background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; padding: 0 4px; }
.emoji-mgmt-del:hover { color: var(--danger); }

#server-banner { width: 100%; overflow: hidden; flex-shrink: 0; }
#server-banner img { width: 100%; display: block; }

.banner-upload-wrap { width: 100%; max-width: 480px; }
.banner-preview { position: relative; width: 100%; height: 160px; background: var(--bg-dark); border-radius: var(--radius); overflow: hidden; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.banner-placeholder { color: var(--text-dim); font-size: 13px; }
.banner-preview-hover { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; opacity: 0; transition: opacity 0.15s; }
.banner-preview:hover .banner-preview-hover { opacity: 1; }

.ip-log-popup { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: var(--bg-dark); border: 1px solid var(--bg-light); border-radius: var(--radius-lg); padding: 16px 20px; max-width: 480px; width: 90%; max-height: 400px; overflow-y: auto; z-index: 2000; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.ip-log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ip-log-close { background: none; border: none; color: var(--text-dim); font-size: 22px; cursor: pointer; }

.reduced-motion, .reduced-motion * { animation-duration: 0s !important; transition-duration: 0s !important; }
.reduced-motion img[src$=".gif"] { animation: none !important; }

.shortcuts-ref { display: flex; flex-direction: column; gap: 2px; }
.shortcut-ref-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--bg-light); }
.shortcut-ref-row:last-child { border-bottom: none; }
.shortcut-ref-row kbd { min-width: 110px; text-align: center; background: var(--bg-light); border: 1px solid var(--bg-dark); border-radius: 4px; padding: 4px 10px; font-family: inherit; font-size: 0.8rem; color: var(--text-bright); }
.shortcut-ref-row span { color: var(--text-dim); font-size: 0.85rem; }

.settings-form-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; max-width: 360px; }
.settings-form-grid label { font-size: 0.85rem; color: var(--text-dim); }
.settings-form-grid input { padding: 8px 10px; background: var(--bg-dark); border: 1px solid var(--bg-light); border-radius: var(--radius); color: var(--text-bright); font-size: 0.9rem; }
.settings-form-grid input:focus { border-color: var(--accent); outline: none; }

/* Structured embed cards (bot embeds) */
.structured-embed {
  border-left: 3px solid var(--primary);
  background: var(--bg-dark);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 6px;
  max-width: 520px;
}
.embed-body-wrap { display: flex; gap: 16px; }
.embed-title { font-weight: 600; font-size: 14px; color: var(--text-bright); margin-bottom: 4px; }
.embed-description { font-size: 13px; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
.embed-fields { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.embed-field { min-width: 0; margin-bottom: 4px; }
.embed-field.inline { flex: 1; min-width: 100px; }
.embed-field:not(.inline) { width: 100%; }
.embed-field-name { font-size: 12px; font-weight: 600; color: var(--text-bright); }
.embed-field-value { font-size: 13px; color: var(--text); }
.embed-thumbnail { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }
.embed-image { max-width: 100%; border-radius: var(--radius); margin-top: 8px; }
.embed-footer { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

/* Bot settings cards */
.bot-card {
  background: var(--bg-dark);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.bot-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.bot-card-identity { display: flex; align-items: center; gap: 10px; }
.bot-card-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.bot-card-avatar-default { display: flex; align-items: center; justify-content: center; background: var(--bg-light); color: var(--text-dim); font-size: 16px; font-weight: 600; }
.bot-card-name { font-size: 14px; font-weight: 600; color: var(--text-bright); }
.bot-card-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.bot-card-section { padding: 10px 0; border-top: 1px solid var(--bg-light); }
.bot-card-section:first-child,
.bot-card-header + .bot-card-section,
.bot-card-warning + .bot-card-section { border-top: none; }
.bot-label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; font-weight: 600; }
.bot-card-warning { padding: 8px 12px; background: rgba(var(--danger-rgb, 255,80,80), 0.1); border: 1px solid var(--danger); border-radius: var(--radius); font-size: 12px; color: var(--danger); margin-bottom: 10px; }

/* Server folders */
.server-folder {
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.server-folder-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-mid);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 1px;
  padding: 6px;
  transition: border-radius 0.2s, background 0.2s;
  position: relative;
  flex-shrink: 0;
}
.server-folder-icon:hover,
.server-folder.open > .server-folder-icon {
  border-radius: var(--radius-lg);
  background: var(--bg-light);
}
.server-folder-icon .folder-mini {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--bg-active);
  overflow: hidden;
}
.server-folder-icon .folder-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.server-folder-servers {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  margin: 0;
  border-left: 2px solid var(--border);
}
.server-folder.open .server-folder-servers {
  display: flex;
}
.server-folder-name {
  font-size: 9px;
  color: var(--text-dim);
  text-align: center;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.server-folder-name:hover { color: var(--text); }
#server-list .drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: var(--radius-lg); }
#server-list .drag-placeholder { width: 44px; height: 4px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }

/* Discover overlay */
#discover-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg-dark);
  animation: fade-in 0.15s ease-out;
}
#discover-container {
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}
#discover-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 10;
  background: var(--bg-light);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#discover-close:hover { color: var(--text); border-color: var(--text-dim); }
#discover-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.discover-hero {
  text-align: center;
  padding: 48px 24px 32px;
  background: linear-gradient(135deg, var(--bg-darkest) 0%, color-mix(in srgb, var(--accent) 15%, var(--bg-dark)) 100%);
  border-bottom: 1px solid var(--border);
}
.discover-hero h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-bright);
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}
.discover-hero p {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 20px;
}
.discover-search-wrap {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}
.discover-search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.discover-search {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.discover-search:focus { border-color: var(--accent); }
.discover-search::placeholder { color: var(--text-dim); }
.discover-invite-hint {
  margin-top: 8px;
  padding: 10px 16px;
  background: var(--bg-mid);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: fade-in 0.15s ease-out;
}
.discover-invite-hint span { font-size: 13px; color: var(--text); }
.discover-invite-hint button {
  padding: 6px 18px;
  font-size: 13px;
  white-space: nowrap;
}
.discover-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}
.discover-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 0 0 12px;
}
.discover-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.discover-tag {
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.discover-tag:hover { background: var(--bg-light); border-color: var(--text-dim); }
.discover-tag.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.discover-card {
  background: var(--bg-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.discover-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  border-color: var(--bg-light);
}
.discover-card-banner {
  height: 100px;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-active) 100%);
  overflow: hidden;
  position: relative;
}
.discover-card-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.discover-card-body {
  padding: 0 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.discover-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  overflow: hidden;
  margin-top: -24px;
  border: 4px solid var(--bg-mid);
  position: relative;
  z-index: 1;
}
.discover-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.discover-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  margin: 8px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.discover-card-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: auto;
  min-height: 36px;
}
.discover-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.discover-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}
.discover-card-meta .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.discover-card-joined {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
}
.discover-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 8px 0 0;
}
.discover-card-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-light);
  color: var(--text-dim);
}
.discover-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.discover-empty svg { margin-bottom: 12px; opacity: 0.3; }
.discover-empty p { font-size: 15px; margin: 0 0 4px; }
.discover-empty small { font-size: 13px; color: var(--text-dim); }
.discover-load-more {
  text-align: center;
  padding: 4px 0 0;
}
.discover-adult-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  cursor: pointer;
}
@media (max-width: 768px) {
  .discover-hero { padding: 32px 16px 24px; }
  .discover-hero h1 { font-size: 22px; }
  .discover-content { padding: 16px 12px 40px; }
  .discover-grid { grid-template-columns: 1fr; }
}

/* Server folder — mobile */
@media (max-width: 768px) {
  .mobile-folder {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
  }
  .mobile-folder-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--bg-mid);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    gap: 1px;
    padding: 4px;
    transition: border-radius 0.15s, background 0.15s;
    flex-shrink: 0;
  }
  .mobile-folder-icon:hover,
  .mobile-folder.open > .mobile-folder-icon {
    border-radius: 8px;
    background: var(--bg-light);
  }
  .mobile-folder-icon .folder-mini {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--bg-active);
    overflow: hidden;
  }
  .mobile-folder-icon .folder-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .mobile-folder-servers {
    display: none;
    gap: 4px;
    align-items: center;
  }
  .mobile-folder.open .mobile-folder-servers {
    display: flex;
  }
  .mobile-folder.open > .mobile-folder-icon {
    display: none;
  }
}

/* Tag input */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: var(--bg-mid);
  border: 1px solid var(--bg-light);
  border-radius: var(--radius);
  min-height: 34px;
}
.tag-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-light);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text);
}
.tag-chip-x {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1;
}
.tag-chip-x:hover { color: var(--danger); }
.tag-input-wrap input {
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 60px;
  flex: 1;
}
