/* ========================================
   CSS Custom Properties / Design Tokens
   ======================================== */
:root {
  /* Background depth scale — cool slate with blue undertone */
  --bg-void: #08080b;
  --bg-deepest: #0b0b10;
  --bg-deep: #0f0f16;
  --bg-base: #13131c;
  --bg-raised: #191924;
  --bg-surface: #1f1f2c;
  --bg-hover: #262635;
  --bg-active: #2e2e3f;
  --bg-elevated: #35354a;

  /* Glass layers */
  --glass-subtle: rgba(255, 255, 255, 0.02);
  --glass-light: rgba(255, 255, 255, 0.04);
  --glass-medium: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.08);

  /* Text hierarchy */
  --text-primary: #e8e8f0;
  --text-secondary: #9898ac;
  --text-muted: #5e5e74;
  --text-faint: #3a3a4e;
  --text-ghost: #2a2a3c;

  /* Accent — mint/teal spectrum */
  --accent: #5de4c7;
  --accent-bright: #7aecd5;
  --accent-soft: #4dc4ab;
  --accent-dim: rgba(93, 228, 199, 0.15);
  --accent-wash: rgba(93, 228, 199, 0.08);
  --accent-ghost: rgba(93, 228, 199, 0.04);
  --accent-glow: 0 0 20px rgba(93, 228, 199, 0.15);
  --accent-glow-strong: 0 0 30px rgba(93, 228, 199, 0.25);

  /* Status */
  --status-online: #6bc76b;
  --status-idle: #c7a63e;
  --status-dnd: #c76060;
  --status-offline: #4a4a5a;
  --online: #5ec269;
  --idle: #d4a843;
  --dnd: #d45555;
  --offline: #4a4a5c;

  /* Semantic */
  --danger: #d45555;
  --warning: #d4a843;
  --success: #5ec269;
  --info: #5586d4;

  /* Voice */
  --voice-active: #6bc76b;
  --voice-muted: #5c5c72;

  /* Bot Badge */
  --bot-badge-bg: rgba(93, 228, 199, 0.12);
  --bot-badge-color: var(--accent);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-light: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.10);
  --border-focus: rgba(93, 228, 199, 0.3);
  --border-accent: rgba(93, 228, 199, 0.25);

  /* Radius */
  --r-xs: 3px;
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.6);
  --shadow-overlay: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border-subtle);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.03);

  /* Transitions */
  --t-fast: 80ms ease;
  --t-base: 150ms ease;
  --t-smooth: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Typography */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  /* Layout */
  --topbar-h: 52px;
  --infobar-h: 38px;
  --voicebar-h: 50px;
  --input-area-h: 72px;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deepest);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--glass-medium);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--glass-strong);
}

/* Selection */
::selection {
  background: rgba(93, 228, 199, 0.25);
  color: var(--text-primary);
}

/* ========================================
   App Layout -- Vertical stack
   topbar -> channel-info-bar -> content -> (voice bar)
   ======================================== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: var(--bg-deepest);
  position: relative;
}

/* Subtle noise texture overlay */
.app::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* Ambient teal glow at top */
.app::after {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(93, 228, 199, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   Top Bar
   ======================================== */
.topbar {
  height: 52px;
  min-height: 52px;
  display: flex;
  align-items: center;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 12px;
  gap: 4px;
  z-index: 20;
  user-select: none;
  position: relative;
}

/* Subtle bottom glow line */
.topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(93, 228, 199, 0.08) 50%, transparent 100%);
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 4px;
  margin-right: 4px;
  flex-shrink: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-md);
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Section switcher: Channels | DMs */
.section-switcher {
  display: flex;
  align-items: center;
  gap: 1px;
  background: var(--bg-raised);
  border-radius: var(--r-md);
  padding: 2px;
  flex-shrink: 0;
}

.section-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all var(--t-base);
  white-space: nowrap;
}

.section-btn:hover {
  color: var(--text-secondary);
}

.section-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Divider */
.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 6px;
  flex-shrink: 0;
}

/* Channel tabs */
.channel-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 2px 0;
}

.channel-tabs::-webkit-scrollbar {
  display: none;
}

.channel-tabs.dm-mode {
  overflow: visible;
}

.dm-conversation-list {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 2px 0;
}

.dm-conversation-list::-webkit-scrollbar {
  display: none;
}

.channel-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 450;
  white-space: nowrap;
  transition: all var(--t-fast);
  position: relative;
  flex-shrink: 0;
}

.channel-tab:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.channel-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.channel-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--accent);
  border-radius: var(--r-pill);
  box-shadow: 0 0 8px rgba(93, 228, 199, 0.3);
}

.channel-tab .tab-hash {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  opacity: 0.4;
}

.channel-tab.active .tab-hash {
  opacity: 0.7;
  color: var(--accent);
}

.channel-tab.has-unread {
  color: var(--text-primary);
  font-weight: 600;
}

.channel-tab.has-unread .tab-hash {
  opacity: 0.7;
}

.channel-tab .tab-badge {
  background: var(--accent);
  color: var(--bg-deepest);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* DM tabs */
.dm-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 450;
  white-space: nowrap;
  transition: all var(--t-fast);
  position: relative;
  flex-shrink: 0;
}

.dm-tab:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.dm-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.dm-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--accent);
  border-radius: var(--r-pill);
  box-shadow: 0 0 8px rgba(93, 228, 199, 0.3);
}

.dm-tab-avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.dm-tab-avatar .status-pip {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  border: 2px solid var(--bg-deep);
}

/* Right side of topbar */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 12px;
}

/* Voice dropdown trigger */
.voice-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: all var(--t-fast);
  position: relative;
}

.voice-dropdown-trigger:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.voice-dropdown-trigger.has-users {
  color: var(--voice-active);
}

.voice-dropdown-trigger svg {
  width: 14px;
  height: 14px;
}

.voice-dropdown-trigger .voice-count {
  background: var(--bg-surface);
  padding: 1px 5px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.voice-dropdown-trigger.has-users .voice-count {
  background: rgba(107, 199, 107, 0.12);
  color: var(--voice-active);
}

/* Voice dropdown overlay */
.voice-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 260px;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-overlay);
  padding: 8px;
  z-index: 50;
  display: none;
}

.voice-dropdown.open {
  display: block;
}

.voice-dropdown-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 8px 4px;
}

.voice-channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}

.voice-channel-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.voice-channel-item.connected {
  background: rgba(107, 199, 107, 0.08);
  color: var(--voice-active);
}

.voice-channel-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
}

.voice-channel-item.connected .voice-channel-icon {
  opacity: 1;
}

.voice-channel-name {
  font-size: 13px;
  font-weight: 500;
}

.voice-channel-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

.voice-channel-users-list {
  padding: 2px 0 4px 36px;
}

.voice-channel-user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
  color: var(--text-muted);
}

.voice-channel-user-avatar {
  width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Members trigger and overlay */
.members-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  transition: all var(--t-fast);
  position: relative;
}

.members-trigger:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.members-trigger.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.members-trigger svg {
  width: 16px;
  height: 16px;
}

/* Online avatar dots in topbar */
.online-avatars {
  display: flex;
  align-items: center;
  margin-right: 4px;
}

.online-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  margin-left: -6px;
  border: 2px solid var(--bg-deep);
  cursor: default;
  position: relative;
  transition: transform var(--t-fast);
}

.online-dot:first-child {
  margin-left: 0;
}

.online-dot:hover {
  transform: translateY(-2px);
  z-index: 2;
}

/* Members overlay */
.members-overlay {
  position: fixed;
  top: 52px;
  right: 0;
  width: 260px;
  bottom: 0;
  background: var(--bg-deep);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  overflow-y: auto;
  padding: 16px 12px;
  transform: translateX(100%);
  opacity: 0;
  transition: transform var(--t-smooth), opacity var(--t-smooth);
  overflow: hidden;
}

.members-overlay.open {
  transform: translateX(0);
  opacity: 1;
  overflow-y: auto;
}

.members-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 8px 6px;
  user-select: none;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
}

.member-item:hover {
  background: var(--bg-hover);
}

.member-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.member-avatar .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: var(--r-pill);
  border: 2px solid var(--bg-deep);
}

.member-name {
  font-size: 12px;
  font-weight: 450;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-item:hover .member-name {
  color: var(--text-primary);
}

.member-role-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--accent-dim);
  color: var(--accent);
  margin-left: auto;
  white-space: nowrap;
}

.member-item.offline .member-avatar,
.member-item.offline .member-name {
  opacity: 0.55;
}

/* Settings button in topbar */
.topbar-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.topbar-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.topbar-icon-btn svg {
  width: 16px;
  height: 16px;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--status-dnd);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

.toast-item.clickable {
  cursor: pointer;
}

.toast-item.clickable:hover {
  background: var(--bg-hover);
}

/* User avatar in topbar */
.topbar-user {
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all var(--t-base);
  position: relative;
  margin-left: 4px;
  flex-shrink: 0;
}

.topbar-user:hover {
  background: var(--accent);
  color: var(--bg-deepest);
}

.topbar-user .status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
  border: 2px solid var(--bg-deep);
}

/* Status dots */
.status-dot.online, .status-pip.online { background: var(--status-online); }
.status-dot.idle, .status-pip.idle { background: var(--status-idle); }
.status-dot.dnd, .status-pip.dnd { background: var(--status-dnd); }
.status-dot.offline, .status-pip.offline { background: var(--status-offline); }

/* ========================================
   Channel Info Bar (below topbar)
   ======================================== */
.channel-info-bar {
  height: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
}

.channel-info-icon {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
}

.channel-info-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.channel-info-divider {
  width: 1px;
  height: 14px;
  background: var(--border-light);
}

.channel-info-topic {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   Main Content Area (full bleed)
   ======================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-base);
  position: relative;
}

/* Messages area -- full width, centered content */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
}

.messages-container {
  padding: 0 32px;
  max-width: 780px;
  width: 100%;
  align-self: center;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.messages-list {
  margin-top: auto;
}

/* Message groups */
.message-group {
  display: flex;
  gap: 12px;
  padding: 8px 8px;
  margin: 0 -8px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  position: relative;
  animation: messageIn 0.35s ease both;
}

.message-group + .message-group {
  margin-top: 2px;
}

.message-group.new-author {
  margin-top: 16px;
}

.message-group:hover {
  background: var(--glass-subtle);
}

/* Hover action bar */
.message-actions {
  position: absolute;
  top: -14px;
  right: 8px;
  display: flex;
  gap: 1px;
  padding: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--t-base);
  pointer-events: none;
  z-index: 20;
}

.message-group:hover .message-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.action-btn:hover {
  color: var(--text-primary);
  background: var(--glass-medium);
}

.action-btn svg {
  width: 14px;
  height: 14px;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
  transition: transform var(--t-base);
}

.message-group:hover .msg-avatar {
  transform: scale(1.05);
}

/* Continuation message gutter */
.continuation-gutter {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cont-time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.message-group:hover .cont-time {
  opacity: 1;
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.msg-author {
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  border-radius: var(--r-xs);
  padding: 1px 3px;
  margin: -1px -3px;
}

.msg-author:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
  filter: brightness(1.2);
}

.msg-timestamp {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  transition: color var(--t-fast);
}

.message-group:hover .msg-timestamp {
  color: var(--text-muted);
}

.msg-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  word-wrap: break-word;
}

.msg-body + .msg-body {
  margin-top: 3px;
}

/* Date separator */
.date-separator {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0 12px;
  user-select: none;
}

.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.date-separator span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Welcome message */
.channel-welcome {
  padding: 24px 0 12px;
  margin-bottom: 8px;
}

.channel-welcome h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.channel-welcome p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Message input */
.message-input-wrapper {
  padding: 0 32px 16px;
  max-width: 800px;
  width: 100%;
  align-self: center;
}

.message-input {
  display: flex;
  align-items: center;
  background: var(--bg-raised);
  border-radius: var(--r-lg);
  padding: 4px;
  border: 1px solid var(--border-light);
  transition: border-color var(--t-base), box-shadow var(--t-base);
  box-shadow: var(--shadow-inset);
}

.message-input:focus-within {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-inset), 0 0 0 3px rgba(93, 228, 199, 0.06);
}

.message-input input {
  flex: 1;
  padding: 7px 8px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
}

.message-input input::placeholder {
  color: var(--text-faint);
}

.input-left-btns,
.input-right-btns {
  display: flex;
  gap: 2px;
  padding: 2px;
}

.input-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: all var(--t-fast);
}

.input-btn:hover {
  color: var(--text-secondary);
  background: var(--glass-light);
}

.input-btn svg {
  width: 16px;
  height: 16px;
}

.send-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: all var(--t-fast);
  opacity: 0.3;
}

.send-btn.has-content {
  opacity: 1;
  color: var(--accent);
}

.send-btn:hover {
  background: var(--glass-light);
}

.send-btn svg {
  width: 16px;
  height: 16px;
}

/* Typing indicator */
.typing-indicator {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 18px 0;
  height: 20px;
}

/* ========================================
   Voice Bar (bottom, Spotify-style)
   ======================================== */
.voice-bar {
  height: 50px;
  min-height: 50px;
  display: flex;
  align-items: center;
  background: var(--bg-deep);
  border-top: 1px solid var(--border-subtle);
  padding: 0 16px;
  gap: 12px;
  z-index: 20;
}

.voice-bar.hidden {
  display: none;
}

.voice-bar-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-bar-pulse {
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--voice-active);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(94, 194, 105, 0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 12px rgba(94, 194, 105, 0.6); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Stagger message entrance animations */
.message-group:nth-child(1) { animation-delay: 0s; }
.message-group:nth-child(2) { animation-delay: 0.04s; }
.message-group:nth-child(3) { animation-delay: 0.04s; }
.message-group:nth-child(4) { animation-delay: 0.12s; }
.message-group:nth-child(5) { animation-delay: 0.16s; }
.message-group:nth-child(6) { animation-delay: 0.20s; }
.message-group:nth-child(7) { animation-delay: 0.24s; }
.message-group:nth-child(8) { animation-delay: 0.28s; }
.message-group:nth-child(9) { animation-delay: 0.32s; }
.message-group:nth-child(10) { animation-delay: 0.36s; }
.message-group:nth-child(11) { animation-delay: 0.40s; }
.message-group:nth-child(12) { animation-delay: 0.44s; }

.voice-bar-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--voice-active);
}

.voice-bar-channel {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.voice-bar-users {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.voice-bar-user-chip {
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  margin-left: -4px;
  border: 2px solid var(--bg-deep);
}

.voice-bar-user-chip:first-child {
  margin-left: 0;
}

.voice-bar-spacer {
  flex: 1;
}

.voice-bar-controls {
  display: flex;
  gap: 4px;
}

.voice-bar-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-surface);
  transition: all var(--t-fast);
}

.voice-bar-btn svg {
  width: 16px;
  height: 16px;
}

.voice-bar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.voice-bar-btn.active {
  background: rgba(199, 96, 96, 0.12);
  color: var(--status-dnd);
}

.voice-bar-btn.disconnect {
  background: rgba(199, 96, 96, 0.12);
  color: var(--status-dnd);
}

.voice-bar-btn.disconnect:hover {
  background: rgba(199, 96, 96, 0.25);
}

/* ========================================
   Tooltips
   ======================================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 5px 10px;
  background: var(--bg-deepest);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast), transform var(--t-fast);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========================================
   Empty/placeholder states
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 8px;
  text-align: center;
  padding: 32px;
}

.empty-state .empty-icon {
  font-size: 48px;
  opacity: 0.2;
  margin-bottom: 8px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
  max-width: 280px;
}

/* ========================================
   Click-outside close helper
   ======================================== */
.click-away-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}

.click-away-overlay.active {
  display: block;
}

/* ========================================
   Blazor-specific overrides
   ======================================== */
#blazor-error-ui {
  background: var(--bg-raised);
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.4);
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  color: var(--status-dnd);
  border-top: 1px solid var(--border-light);
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

#blazor-error-ui a {
  color: var(--accent);
}

.blazor-error-boundary {
  background: rgba(199, 96, 96, 0.1);
  padding: 1rem;
  color: var(--status-dnd);
  border-radius: var(--r-md);
  border: 1px solid rgba(199, 96, 96, 0.2);
}

.blazor-error-boundary::after {
  content: "An error has occurred.";
}

/* Loading progress (shown while WASM loads) */
.loading-progress {
  position: relative;
  display: block;
  width: 8rem;
  height: 8rem;
  margin: 20vh auto 1rem auto;
}

.loading-progress circle {
  fill: none;
  stroke: var(--bg-surface);
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--accent);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: bold;
  inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.loading-progress-text::after {
  content: var(--blazor-load-percentage-text, "Loading");
}

/* ========================================
   Page placeholder content
   ======================================== */
.page-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
  text-align: center;
  padding: 32px;
}

.page-placeholder h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
}

.page-placeholder p {
  font-size: 13px;
  max-width: 320px;
}

.placeholder-icon {
  width: 48px;
  height: 48px;
  opacity: 0.2;
  margin-bottom: 4px;
}

/* ========================================
   DMs Page Conversation List
   ======================================== */
.dms-page-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px;
  height: 100%;
  overflow-y: auto;
}

.dms-page-header {
  width: 100%;
  max-width: 500px;
  margin-bottom: 16px;
}

.dms-page-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.dms-page-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 500px;
}

.dms-page-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  font: inherit;
  text-align: left;
  width: 100%;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background-color var(--t-fast);
}

.dms-page-item:hover {
  background: var(--bg-hover);
}

.dms-page-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.dms-page-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.dms-page-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.dms-page-item-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dms-page-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.dms-page-item-time {
  font-size: 11px;
  color: var(--text-muted);
}

.unread-badge {
  background: var(--accent);
  color: var(--bg-deepest);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ========================================
   New DM Picker & Button
   ======================================== */
.new-dm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 10px;
  height: 28px;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.new-dm-btn svg {
  width: 14px;
  height: 14px;
}

.new-dm-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.new-dm-picker {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 260px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  overflow: hidden;
}

.new-dm-search {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.new-dm-search::placeholder {
  color: var(--text-faint);
}

.new-dm-results {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.new-dm-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
}

.new-dm-result-item:hover:not(.loading) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.new-dm-result-item.loading {
  cursor: default;
  color: var(--text-muted);
  justify-content: center;
  padding: 12px 8px;
}

.new-dm-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

/* ========================================
   Auth Pages (Login & Register)
   ======================================== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 80px 24px 40px;
  background: var(--bg-deepest);
  overflow-y: auto;
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-card-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-card-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  margin-bottom: 12px;
}

.auth-card-brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 16px;
  display: block;
}

.auth-card-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-card-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Form fields */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  transition: all var(--t-base);
}

.form-input::placeholder {
  color: var(--text-faint);
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-wash);
  background: var(--bg-raised);
}

.form-input:hover:not(:focus) {
  border-color: rgba(255, 255, 255, 0.1);
}

.form-input.error {
  border-color: var(--status-dnd);
  box-shadow: 0 0 0 3px rgba(199, 96, 96, 0.08);
}

.form-input-code {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.form-error {
  font-size: 11px;
  color: var(--status-dnd);
  margin-top: 4px;
  display: none;
}

.form-group.has-error .form-error {
  display: block;
}

.form-group.has-error .form-input {
  border-color: var(--status-dnd);
  box-shadow: 0 0 0 3px rgba(199, 96, 96, 0.08);
}

/* Password visibility toggle */
.input-wrapper {
  position: relative;
}

.input-wrapper .form-input {
  padding-right: 40px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
  cursor: pointer;
  background: none;
  border: none;
}

.toggle-password:hover {
  color: var(--text-secondary);
}

/* Form helpers */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.form-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.form-link:hover {
  color: var(--accent-bright);
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--bg-deepest);
  background: var(--accent);
  border-radius: var(--r-md);
  transition: all var(--t-base);
  margin-bottom: 20px;
  border: none;
  cursor: pointer;
}

.btn-submit:hover {
  background: var(--accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(93, 228, 199, 0.18);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.auth-divider span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

/* OAuth buttons */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-oauth {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  transition: all var(--t-base);
  cursor: pointer;
}

.btn-oauth:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-oauth svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Auth card footer */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--accent-bright);
}

.auth-back-link {
  display: block;
  text-align: center;
  margin-top: 16px;
}

.auth-back-link a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-back-link a:hover {
  color: var(--accent);
}

/* Registration mode banner */
.reg-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  margin-bottom: 20px;
  border: 1px solid;
}

.reg-banner.open {
  background: rgba(107, 199, 107, 0.06);
  border-color: rgba(107, 199, 107, 0.15);
  color: var(--status-online);
}

.reg-banner.invite {
  background: rgba(199, 166, 62, 0.06);
  border-color: rgba(199, 166, 62, 0.15);
  color: var(--status-idle);
}

.reg-banner.closed {
  background: rgba(199, 96, 96, 0.06);
  border-color: rgba(199, 96, 96, 0.15);
  color: var(--status-dnd);
}

.reg-banner-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Auth alert banner */
.auth-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  margin-bottom: 16px;
  background: rgba(199, 96, 96, 0.08);
  border: 1px solid rgba(199, 96, 96, 0.15);
  color: var(--status-dnd);
}

/* Loading spinner */
.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive auth */
@media (max-width: 640px) {
  .auth-card {
    padding: 28px 20px 24px;
  }
}

/* ========================================
   Admin Panel
   ======================================== */

/* --- Admin-specific semantic colors --- */
:root {
  --danger: #c76060;
  --danger-hover: #d07070;
  --danger-muted: rgba(199, 96, 96, 0.12);
  --warning: #c7a63e;
  --warning-muted: rgba(199, 166, 62, 0.12);
  --success: #6bc76b;
  --success-muted: rgba(107, 199, 107, 0.12);
}

/* --- Admin Layout --- */
.admin-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

.admin-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* --- Admin Topbar additions --- */
.topbar-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  margin-right: 16px;
  text-decoration: none;
}

.topbar-back:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.topbar-back svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.topbar-spacer {
  flex: 1;
}

/* --- Admin Sidebar --- */
.admin-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-deep);
  border-right: 1px solid var(--border-subtle);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  user-select: none;
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 450;
  transition: all var(--t-fast);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.sidebar-item.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.sidebar-item.active .sidebar-icon {
  color: var(--accent);
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-faint);
  transition: color var(--t-fast);
}

.sidebar-item:hover .sidebar-icon {
  color: var(--text-muted);
}

/* --- Admin Main Content --- */
.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--bg-base);
}

.admin-main-inner {
  max-width: 860px;
}

/* --- Section Headers --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-header-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Admin Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
  border: none;
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deepest);
}

.btn-primary:hover {
  background: var(--accent-bright);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-muted);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(199, 96, 96, 0.2);
  color: var(--danger-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 8px;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-muted);
  transition: all var(--t-fast);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.btn-icon.danger:hover {
  background: var(--danger-muted);
  color: var(--danger);
}

.btn-icon svg {
  width: 15px;
  height: 15px;
}

/* --- Admin Form Controls --- */
.admin-form-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.admin-form-input {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
}

.admin-form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.form-input-row {
  display: flex;
  gap: 12px;
}

.form-input-row .form-group {
  flex: 1;
}

/* Select */
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239898a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-wash);
  outline: none;
}

.form-select option {
  background: var(--bg-raised);
  color: var(--text-primary);
}

/* Segmented control */
.segmented-control {
  display: inline-flex;
  background: var(--bg-raised);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border-subtle);
}

.segmented-option {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  background: none;
  border: none;
}

.segmented-option:hover {
  color: var(--text-secondary);
}

.segmented-option.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* --- Admin Tables --- */
.admin-table-wrap {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
}

.admin-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: background var(--t-fast);
}

.admin-table tbody tr:hover {
  background: var(--bg-hover);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

.badge-text {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-voice {
  background: rgba(107, 199, 107, 0.12);
  color: var(--status-online);
}

.badge-admin {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-mod {
  background: rgba(160, 140, 220, 0.12);
  color: #a08cdc;
}

.badge-member {
  background: var(--bg-surface);
  color: var(--text-muted);
}

.badge-active {
  background: var(--success-muted);
  color: var(--success);
}

.badge-expired {
  background: var(--warning-muted);
  color: var(--warning);
}

.badge-revoked {
  background: var(--danger-muted);
  color: var(--danger);
}

.badge-used-up {
  background: var(--bg-surface);
  color: var(--text-muted);
}

/* --- Role Dropdown (inline in table) --- */
.role-select {
  padding: 4px 24px 4px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' stroke='%235c5c72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: all var(--t-fast);
  outline: none;
}

.role-select:hover {
  border-color: var(--border-light);
}

.role-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--accent-wash);
}

.role-select option {
  background: var(--bg-raised);
  color: var(--text-primary);
}

/* --- Search / Filter Bar --- */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-input-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.filter-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.filter-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.filter-input::placeholder {
  color: var(--text-muted);
}

/* --- Invite code / copy --- */
.invite-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  letter-spacing: 0.02em;
  user-select: all;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: all var(--t-fast);
  cursor: pointer;
}

.copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.copy-btn.copied {
  background: var(--success-muted);
  color: var(--success);
  border-color: transparent;
}

.copy-btn svg {
  width: 12px;
  height: 12px;
}

/* --- API Key one-time display --- */
.key-display {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(93, 228, 199, 0.15);
  border-radius: var(--r-md);
  padding: 12px 16px;
  word-break: break-all;
  user-select: all;
  line-height: 1.5;
}

/* --- Reorder arrows --- */
.reorder-arrows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.reorder-btn {
  width: 22px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  border-radius: var(--r-xs);
  transition: all var(--t-fast);
  cursor: pointer;
  padding: 0;
  background: none;
  border: none;
}

.reorder-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.reorder-btn svg {
  width: 12px;
  height: 12px;
}

/* --- User avatar in table --- */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-cell-name {
  font-weight: 500;
  color: var(--text-primary);
}

/* --- Modal / Dialog --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--t-smooth);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 520px;
  max-width: 90vw;
  overflow: hidden;
  transform: translateY(12px) scale(0.96);
  transition: all var(--t-smooth);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-muted);
  transition: all var(--t-fast);
  background: none;
  border: none;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--glass-light);
  color: var(--text-primary);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 20px 24px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 20px;
}

/* Confirmation dialog (smaller) */
.modal.modal-confirm {
  width: 380px;
}

.confirm-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.confirm-message strong {
  color: var(--text-primary);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.setting-row:last-child { border-bottom: none; }

.setting-label { font-size: 13px; font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.toggle {
  width: 38px;
  height: 22px;
  background: var(--bg-active);
  border-radius: var(--r-pill);
  position: relative;
  cursor: pointer;
  transition: background var(--t-base);
  flex-shrink: 0;
}

.toggle.on { background: var(--accent); }

.toggle-knob {
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform var(--t-spring);
  box-shadow: var(--shadow-sm);
}

.toggle.on .toggle-knob { transform: translateX(16px); }

/* --- Admin Empty State --- */
.admin-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  color: var(--text-muted);
  gap: 8px;
  text-align: center;
}

.admin-empty-state .empty-icon {
  font-size: 40px;
  opacity: 0.15;
  margin-bottom: 8px;
}

.admin-empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.admin-empty-state p {
  font-size: 13px;
  max-width: 280px;
}

/* --- Settings form specifics --- */
.settings-form {
  max-width: 480px;
}

.settings-saved-msg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--success);
  opacity: 0;
  transition: opacity var(--t-base);
  margin-left: 12px;
}

.settings-saved-msg.visible {
  opacity: 1;
}

.settings-saved-msg svg {
  width: 14px;
  height: 14px;
}

/* --- Admin error banner --- */
.admin-error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  background: rgba(199, 96, 96, 0.08);
  border: 1px solid rgba(199, 96, 96, 0.15);
  color: var(--danger);
}

/* --- Admin form error (visible state) --- */
.form-error.visible {
  display: block;
}

/* --- Admin misc utility --- */
.text-muted {
  color: var(--text-muted);
}

.text-mono {
  font-family: var(--font-mono);
}

.channel-name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.channel-hash {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
}

.channel-name-text {
  font-weight: 500;
  color: var(--text-primary);
}

.topic-cell {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.uses-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ========================================
   Search Overlay
   ======================================== */
.search-overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  z-index: 200;
  animation: search-backdrop-in var(--t-smooth) forwards;
}

@keyframes search-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-overlay {
  width: 580px;
  max-width: 90vw;
  max-height: 460px;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: search-dialog-in var(--t-smooth) forwards;
}

@keyframes search-dialog-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Search input wrapper */
.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
}

.search-input-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-overlay .search-input {
  flex: 1;
  padding: 0;
  font-size: 16px;
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
}

.search-overlay .search-input::placeholder {
  color: var(--text-muted);
}

.search-spinner {
  flex-shrink: 0;
}

.search-shortcut-hint {
  flex-shrink: 0;
}

.search-kbd-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xs);
  padding: 3px 6px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.search-shortcut-hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xs);
  padding: 2px 6px;
  line-height: 1;
}

/* Channel filter bar */
.search-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-channel-filter {
  padding: 5px 28px 5px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' stroke='%235c5c72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  outline: none;
  transition: border-color var(--t-base);
}

.search-channel-filter:focus {
  border-color: var(--border-focus);
}

.search-channel-filter option {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.search-result-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Results list */
.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.search-empty-state svg {
  opacity: 0.3;
}

/* Result item */
.search-result-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--glass-light);
}

.search-result-item.selected {
  background: var(--bg-active);
}

.search-result-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.search-result-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-channel {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  opacity: 0.7;
}

.search-result-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  margin-left: auto;
}

.search-result-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-snippet mark {
  background: rgba(93, 228, 199, 0.18);
  color: var(--accent-bright);
  border-radius: 2px;
  padding: 0 2px;
}

.search-scope-filter {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--t-fast);
}

.search-scope-filter:focus {
  border-color: var(--accent);
}

.search-channel-filter:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.search-result-dm {
  color: var(--accent);
}

.search-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--text-error, #e55);
  text-align: center;
  font-size: 0.9rem;
}

.search-error-state svg {
  opacity: 0.6;
  color: var(--text-error, #e55);
}

.search-load-more {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--t-fast);
  margin-top: 4px;
}

.search-load-more:hover {
  background: var(--bg-hover);
}

.search-loading-more {
  display: flex;
  justify-content: center;
  padding: 12px;
}

/* Jump-to-message highlight */
@keyframes highlight-flash {
  0% { background-color: rgba(88, 166, 255, 0.3); }
  100% { background-color: transparent; }
}

.message-highlight {
  animation: highlight-flash 2s ease-out;
}

/* ========================================
   Skeleton Loading States
   ======================================== */

/* Shimmer animation */
@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Base skeleton element */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-hover) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
  border-radius: var(--r-sm);
}

/* Text-shaped skeleton (inline block for varied widths) */
.skeleton-text {
  display: block;
  height: 12px;
  border-radius: var(--r-sm);
}

.skeleton-text.short {
  width: 40%;
}

.skeleton-text.medium {
  width: 65%;
}

.skeleton-text.long {
  width: 85%;
}

/* Circular avatar skeleton */
.skeleton-avatar {
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

/* Channel tab skeleton */
.skeleton-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  flex-shrink: 0;
}

.skeleton-channel-hash {
  width: 12px;
  height: 12px;
  border-radius: var(--r-xs);
}

.skeleton-channel-name {
  height: 13px;
  border-radius: var(--r-sm);
}

/* Message row skeleton */
.skeleton-message {
  display: flex;
  gap: 14px;
  padding: 4px 8px;
  margin-top: 16px;
}

.skeleton-message .skeleton-avatar {
  width: 34px;
  height: 34px;
  margin-top: 2px;
}

.skeleton-message-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.skeleton-message-author {
  height: 13px;
  border-radius: var(--r-sm);
}

.skeleton-message-time {
  width: 48px;
  height: 10px;
  border-radius: var(--r-xs);
}

.skeleton-message-line {
  height: 14px;
  border-radius: var(--r-sm);
}

/* Member row skeleton */
.skeleton-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
}

.skeleton-member .skeleton-avatar {
  width: 26px;
  height: 26px;
}

.skeleton-member-name {
  height: 12px;
  border-radius: var(--r-sm);
}

/* Members section label skeleton */
.skeleton-section-label {
  height: 10px;
  width: 80px;
  border-radius: var(--r-xs);
  margin: 8px 8px 6px;
}

/* Pagination loading spinner (top of message list) */
.pagination-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.pagination-loader .spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
  color: var(--text-muted);
}

/* Fade-in transition for content replacing skeletons */
.skeleton-fade-in {
  animation: skeleton-content-in var(--t-smooth) forwards;
}

@keyframes skeleton-content-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========================================
   Global Error Boundary
   ======================================== */
.global-error-boundary {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: var(--bg-deepest);
  padding: 24px;
}

.global-error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  max-width: 400px;
  padding: 48px 36px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.global-error-icon {
  width: 48px;
  height: 48px;
  color: var(--status-dnd);
  opacity: 0.7;
}

.global-error-icon svg {
  width: 100%;
  height: 100%;
}

.global-error-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.global-error-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 320px;
}

/* ========================================
   Connection Status Banner
   ======================================== */
.connection-status {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  animation: connection-status-slide-in var(--t-smooth) forwards;
}

@keyframes connection-status-slide-in {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.connection-status-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.connection-status-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Reconnecting state - amber */
.connection-status-reconnecting {
  background: rgba(199, 166, 62, 0.12);
  border-bottom: 1px solid rgba(199, 166, 62, 0.2);
  color: var(--status-idle);
}

/* Reconnected state - green */
.connection-status-reconnected {
  background: rgba(107, 199, 107, 0.12);
  border-bottom: 1px solid rgba(107, 199, 107, 0.2);
  color: var(--status-online);
}

/* Disconnected state - red */
.connection-status-disconnected {
  background: rgba(199, 96, 96, 0.12);
  border-bottom: 1px solid rgba(199, 96, 96, 0.2);
  color: var(--status-dnd);
}

/* Spinner for reconnecting state */
.connection-status-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

/* Retry button */
.connection-status-retry {
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: opacity var(--t-fast);
}

.connection-status-retry:hover {
  opacity: 0.8;
}

/* ========================================
   Bot Badge
   ======================================== */
.bot-badge {
  display: inline-flex;
  align-items: center;
  font-size: 8px;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: var(--r-xs);
  background: var(--bot-badge-bg);
  color: var(--bot-badge-color);
  vertical-align: middle;
  margin-left: 6px;
  line-height: 1;
}

/* ========================================
   Accessibility Utilities
   ======================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   Toast Notification System
   ======================================== */
.toast-stack {
  position: fixed;
  bottom: 70px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  animation: toastIn 0.35s var(--t-spring) forwards;
  max-width: 360px;
}

.toast-item.toast-success { border-left: 3px solid var(--success); }
.toast-item.toast-error { border-left: 3px solid var(--danger); }
.toast-item.toast-warning { border-left: 3px solid var(--warning); }
.toast-item.toast-info { border-left: 3px solid var(--accent); }

.toast-item .toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast-item.toast-success .toast-icon { color: var(--success); }
.toast-item.toast-error .toast-icon { color: var(--danger); }
.toast-item.toast-warning .toast-icon { color: var(--warning); }
.toast-item.toast-info .toast-icon { color: var(--accent); }

.toast-item .toast-content { flex: 1; }

.toast-item .toast-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 1px;
}

.toast-item .toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-item .toast-dismiss {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  transition: all var(--t-fast);
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.toast-item .toast-dismiss:hover {
  color: var(--text-secondary);
  background: var(--glass-light);
}

.toast-item .toast-dismiss svg {
  width: 12px;
  height: 12px;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  animation: toastProgress 4s linear forwards;
}

/* ========================================
   Notifications Page
   ======================================== */
.notifications-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.notifications-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notifications-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--r-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}

.notifications-back:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.notifications-back svg {
  width: 18px;
  height: 18px;
}

.notifications-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.notifications-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notifications-list {
  flex: 1;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid var(--border-subtle);
}

.notification-item:hover {
  background: var(--bg-hover);
}

.notification-item.unread {
  background: var(--bg-raised);
}

.notification-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-context {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notification-sender {
  font-weight: 600;
  color: var(--text-primary);
}

.notification-action {
  margin: 0 4px;
}

.notification-source {
  font-weight: 500;
  color: var(--text-primary);
}

.notification-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.notification-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}

.notifications-load-more {
  display: flex;
  justify-content: center;
  padding: 16px 20px;
}

/* ========================================
   Mute Toggle Button
   ======================================== */
.mute-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  margin-left: 8px;
  flex-shrink: 0;
}

.mute-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.mute-toggle.muted {
  color: var(--status-dnd);
}

.mute-toggle.muted:hover {
  color: var(--status-dnd);
}

.mute-toggle svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   Shared Dropdown
   ======================================== */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-trigger {
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  min-width: 180px;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-overlay);
  padding: 6px;
  z-index: 50;
  animation: dropdown-enter var(--t-smooth) forwards;
}

.dropdown-menu.dropdown-bottom-start { top: calc(100% + 6px); left: 0; }
.dropdown-menu.dropdown-bottom-end { top: calc(100% + 6px); right: 0; }
.dropdown-menu.dropdown-top-start { bottom: calc(100% + 6px); left: 0; }
.dropdown-menu.dropdown-top-end { bottom: calc(100% + 6px); right: 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.dropdown-item.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@keyframes dropdown-enter {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Shared Tab Component
   ======================================== */
.tab-control {
  display: flex;
  flex-direction: column;
}

.tab-headers {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 4px;
}

.tab-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--t-fast);
  cursor: pointer;
  white-space: nowrap;
}

.tab-header:hover {
  color: var(--text-secondary);
}

.tab-header.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.tab-header svg {
  width: 14px;
  height: 14px;
}

.tab-content {
  padding: 16px 0;
}

/* ========================================
   Shared Toggle Switch
   ======================================== */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-active);
  border-radius: var(--r-pill);
  transition: background var(--t-base);
  flex-shrink: 0;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-primary);
  border-radius: var(--r-pill);
  transition: transform var(--t-base);
}

.toggle-switch input:checked + .toggle-track .toggle-knob {
  transform: translateX(16px);
}

.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========================================
   Shared Tooltip
   ======================================== */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.tooltip-popup {
  position: absolute;
  padding: 5px 10px;
  background: var(--bg-deepest);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: var(--r-md);
  border: 1px solid var(--border-light);
  pointer-events: none;
  z-index: 100;
  animation: tooltip-enter var(--t-fast) forwards;
}

.tooltip-popup.tooltip-top {
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
}

.tooltip-popup.tooltip-bottom {
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
}

.tooltip-popup.tooltip-left {
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}

.tooltip-popup.tooltip-right {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}

@keyframes tooltip-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================
   Shared Badge/Pill (#140)
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  border-radius: var(--r-pill);
  white-space: nowrap;
  line-height: 1;
}

.badge.badge-md {
  font-size: 11px;
  padding: 3px 8px;
  height: 20px;
}

.badge.badge-sm {
  font-size: 10px;
  padding: 2px 6px;
  height: 16px;
}

/* Status variant */
.badge-status { background: var(--bg-surface); color: var(--text-secondary); }
.badge-status .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
}
.badge-status.status-online .badge-dot { background: var(--status-online); }
.badge-status.status-idle .badge-dot { background: var(--status-idle); }
.badge-status.status-dnd .badge-dot { background: var(--status-dnd); }
.badge-status.status-offline .badge-dot { background: var(--status-offline); }

/* Role variant */
.badge-role {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Count variant */
.badge-count {
  background: var(--accent);
  color: var(--bg-deepest);
  font-weight: 700;
  min-width: 16px;
  justify-content: center;
}

.badge-count.badge-sm {
  min-width: 14px;
}

/* Custom variant (uses Color parameter) */
.badge-custom {
  background: var(--bg-surface);
  color: var(--text-secondary);
}

/* ========================================
   Shared Empty State (#142)
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  max-width: 320px;
  margin: 0 auto;
}

.empty-state-icon {
  font-size: 36px;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.empty-state-icon svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.5;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.empty-state-action {
  margin-top: 4px;
}

/* ========================================
   Animated Typing Indicator (#146)
   ======================================== */
.typing-indicator .typing-text {
  font-size: 12px;
  color: var(--text-muted);
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
  vertical-align: middle;
}

.typing-dot {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: var(--r-pill);
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ========================================
   Component Showcase
   ======================================== */
.showcase-layout {
  height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(93, 228, 199, 0.03) 0%, transparent 50%),
    var(--bg-deepest);
  color: var(--text-primary);
  overflow-y: auto;
}

.showcase-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.showcase-header {
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.showcase-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  box-shadow: 0 0 8px var(--accent-wash);
}

.showcase-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}

.showcase-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
  box-shadow: 0 0 12px var(--accent-wash);
}

.showcase-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 20px 0 48px;
  line-height: 1.5;
}

.showcase-section {
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-top: 2px solid rgba(93, 228, 199, 0.2);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  transition:
    border-color var(--t-base),
    box-shadow var(--t-base),
    transform var(--t-base);
  position: relative;
}

.showcase-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(93, 228, 199, 0.15), transparent);
  opacity: 0;
  transition: opacity var(--t-base);
}

.showcase-section:hover {
  border-top-color: rgba(93, 228, 199, 0.35);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 24px rgba(93, 228, 199, 0.06);
  transform: translateY(-1px);
}

.showcase-section:hover::before {
  opacity: 1;
}

.showcase-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.showcase-section > p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 24px;
  line-height: 1.6;
}

.showcase-section h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 20px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.showcase-section h4:first-child {
  margin-top: 0;
}

.showcase-demo {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent),
    var(--bg-deep);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.1) inset,
    0 0 0 1px rgba(0, 0, 0, 0.05) inset;
}

.showcase-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.showcase-params {
  background:
    linear-gradient(135deg, var(--bg-raised) 0%, var(--bg-base) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) inset;
}

.showcase-params h4 {
  margin: 0 0 12px;
  border-bottom: none;
  color: var(--accent);
  font-size: 11px;
}

.showcase-params table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.showcase-params thead {
  background: rgba(0, 0, 0, 0.1);
}

.showcase-params th {
  text-align: left;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 8px 12px 8px 0;
  border-bottom: 2px solid var(--border-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.showcase-params td {
  padding: 8px 12px 8px 0;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  line-height: 1.5;
}

.showcase-params tbody tr:last-child td {
  border-bottom: none;
}

.showcase-params tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.showcase-params td:first-child {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
}

.showcase-params code {
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  font-size: 12px;
  border: 1px solid var(--border-subtle);
  color: var(--accent-bright);
}

.showcase-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background:
    linear-gradient(135deg, var(--accent-dim), rgba(93, 228, 199, 0.06));
  border: 1px solid rgba(93, 228, 199, 0.15);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(93, 228, 199, 0.04);
}

.showcase-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent-wash));
}

.showcase-note code {
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  font-size: 12px;
  border: 1px solid var(--border-subtle);
  color: var(--accent-bright);
}

.showcase-section .showcase-demo code {
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  font-size: 12px;
  border: 1px solid var(--border-subtle);
  color: var(--accent-bright);
}

/* ========================================
   @mention Autocomplete
   ======================================== */
.mention-autocomplete {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 4px 0;
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

.mention-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background 0.1s ease;
}

.mention-autocomplete-item:hover,
.mention-autocomplete-item.selected {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mention-autocomplete-item .mention-display-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-autocomplete-item .mention-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: var(--r-xs);
  background: var(--bot-badge-bg);
  color: var(--bot-badge-color);
  flex-shrink: 0;
}

/* ========================================
   Mention Rendering (in message content)
   ======================================== */
.mention {
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: var(--r-xs);
  padding: 0 2px;
  font-weight: 500;
  transition: background var(--t-fast);
}

.mention:hover {
  background: rgba(93, 228, 199, 0.18);
}

.mention.mention-self {
  color: var(--accent-bright);
  background: rgba(93, 228, 199, 0.15);
}

/* Message group mentioned indicator */
.message-group.mentioned {
  background: rgba(93, 228, 199, 0.04);
  border-left: 2px solid var(--accent);
  padding-left: 6px;
}

.message-group.mentioned:hover {
  background: rgba(93, 228, 199, 0.06);
}

/* Jump-to-message highlight */
@keyframes highlight-flash {
    0% { background-color: rgba(88, 166, 255, 0.3); }
    100% { background-color: transparent; }
}

.message-highlight {
    animation: highlight-flash 2s ease-out;
}
