/* ==========================================================================
   DISCORD CLONE (FULL THROTTLE COMMS) - DESIGN SYSTEM & STYLES
   ========================================================================== */

:root {
  /* Discord Color Palette */
  --bg-tertiary: #1e1f22;       /* Guilds sidebar & user footer */
  --bg-secondary: #2b2d31;      /* Channels sidebar & members list */
  --bg-secondary-alt: #232428;  /* Sub-panels and headers */
  --bg-primary: #313338;        /* Main chat area & canvas */
  --bg-floating: #111214;       /* Modals, tooltips & context menus */
  --bg-modifier-hover: rgba(78, 80, 88, 0.2);
  --bg-modifier-active: rgba(78, 80, 88, 0.35);
  --bg-modifier-selected: rgba(78, 80, 88, 0.45);

  /* Text Colors */
  --text-normal: #dbdee1;
  --text-muted: #a6adb8;
  --text-heading: #f2f3f5;
  --text-link: #00a8fc;
  --text-positive: #23a55a;
  --text-warning: #f0b232;
  --text-danger: #f23f43;

  /* Brand & Accent Colors */
  --brand-primary: #5865f2;
  --brand-hover: #4752c4;
  --brand-active: #3c45a5;
  --brand-experiment: #5865f2;

  /* Status Colors */
  --status-online: #23a55a;
  --status-idle: #f0b232;
  --status-dnd: #f23f43;
  --status-offline: #80848e;
  --status-speaking: #23a55a;

  /* Fonts & Shadows */
  --font-family: 'gg sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-code: 'Consolas', 'Courier New', Courier, monospace;
  --shadow-elevation-low: 0 1px 0 rgba(4, 4, 5, 0.2), 0 1.5px 0 rgba(6, 6, 7, 0.05), 0 2px 0 rgba(4, 4, 5, 0.05);
  --shadow-elevation-high: 0 8px 16px rgba(0, 0, 0, 0.4);
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-round: 50%;

  /* Dimensions */
  --servers-sidebar-width: 72px;
  --channels-sidebar-width: 240px;
  --members-sidebar-width: 240px;
  --topbar-height: 48px;
  --user-footer-height: 54px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-tertiary);
  color: var(--text-normal);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  user-select: none;
  touch-action: manipulation;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #1a1b1e;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #111214;
}

/* App Layout */
#app {
  display: flex;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   1. SERVERS SIDEBAR (COL 1)
   ========================================================================== */
.servers-sidebar {
  width: var(--servers-sidebar-width);
  min-width: var(--servers-sidebar-width);
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  overflow-y: auto;
  z-index: 10;
}

.server-item-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.server-pill {
  position: absolute;
  left: 0;
  width: 4px;
  height: 8px;
  background-color: #fff;
  border-radius: 0 4px 4px 0;
  transition: all 0.2s ease;
  opacity: 0;
}

.server-item-wrapper:hover .server-pill {
  opacity: 1;
  height: 20px;
}

.server-item-wrapper.active .server-pill {
  opacity: 1;
  height: 40px;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-round);
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-heading);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.server-item-wrapper:hover .server-icon,
.server-item-wrapper.active .server-icon {
  border-radius: var(--radius-lg);
  background-color: var(--brand-primary);
  color: #fff;
}

.server-icon img,
.server-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.server-divider {
  width: 32px;
  height: 2px;
  background-color: var(--bg-modifier-active);
  border-radius: 1px;
  margin: 4px 0;
}

.server-icon.add-server {
  background-color: var(--bg-primary);
  color: var(--status-online);
}

.server-icon.add-server:hover {
  background-color: var(--status-online);
  color: #fff;
}

/* ==========================================================================
   2. CHANNELS SIDEBAR (COL 2)
   ========================================================================== */
.channels-sidebar {
  width: var(--channels-sidebar-width);
  min-width: var(--channels-sidebar-width);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  height: 100%;
  border-top-left-radius: 8px;
  overflow: hidden;
}

.server-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 58px;
  height: auto;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  gap: 6px;
  cursor: default;
  transition: background 0.15s ease;
  box-sizing: border-box;
}

.server-header:hover {
  background-color: var(--bg-modifier-hover);
}

.server-header-top {
  display: flex;
  align-items: center;
  width: 100%;
  overflow: hidden;
}

.server-header-top h2,
.server-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.server-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.channels-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-category {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.category-title:hover {
  color: var(--text-normal);
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
}

.channel-item:hover {
  background-color: var(--bg-modifier-hover);
  color: var(--text-normal);
}

.channel-item.active {
  background-color: var(--bg-modifier-selected);
  color: var(--text-heading);
}

.channel-icon {
  font-size: 16px;
  opacity: 0.8;
}

.channel-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-badge {
  font-size: 11px;
  background-color: var(--brand-primary);
  color: #fff;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: bold;
}

/* Connected Voice Members List Under Voice Channel */
.voice-members-list {
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.voice-member-item {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  gap: 8px;
  font-size: 13px;
  color: var(--text-normal);
  transition: background 0.15s ease;
}

.voice-member-item:hover {
  background-color: var(--bg-modifier-hover);
}

.voice-member-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  position: relative;
  transition: box-shadow 0.2s ease;
}

.voice-member-avatar.speaking {
  box-shadow: 0 0 0 2px var(--status-speaking);
}

.voice-member-nick {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-member-badges {
  display: flex;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Voice Connection Quick Bar (when connected to voice) */
.voice-active-bar {
  background-color: #232428;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-status-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.voice-status-connected {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

/* Dynamic Ping Status Colors */
.voice-status-connected.ping-green {
  color: #23a55a;
}
.voice-status-connected.ping-yellow {
  color: #fee75c;
}
.voice-status-connected.ping-orange {
  color: #f39c12;
}
.voice-status-connected.ping-red {
  color: #ed4245;
}

.voice-connection-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.voice-status-connected:hover .voice-connection-icon {
  transform: scale(1.15);
}

.connection-bars-svg {
  display: block;
  overflow: visible;
}

/* Voice Connection Tooltip using data-tooltip */
.voice-status-connected[data-tooltip]::after {
  left: 0;
  top: auto;
  bottom: calc(100% + 8px);
  transform: none;
}

.voice-status-connected[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 10px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--bg-floating) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 1000;
}

.voice-status-connected[data-tooltip]:hover::before {
  opacity: 1;
}

.voice-channel-current-name {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-disconnect {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 16px;
  transition: all 0.15s ease;
}

.btn-disconnect:hover {
  color: var(--text-danger);
  background-color: rgba(242, 63, 67, 0.1);
}

/* User Footer Profile & Controls */
.user-footer {
  height: var(--user-footer-height);
  min-height: var(--user-footer-height);
  background-color: var(--bg-secondary-alt);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  z-index: 5;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 4px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  overflow: hidden;
}

.user-profile-badge:hover {
  background-color: var(--bg-modifier-hover);
}

.avatar-container {
  position: relative;
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  transition: box-shadow 0.2s ease;
}

.avatar-circle.speaking {
  box-shadow: 0 0 0 2px var(--status-speaking);
}

.status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--status-online);
  border: 2px solid var(--bg-secondary-alt);
}

.user-info-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-nickname {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-custom-tag {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.control-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
}

.control-btn:hover {
  background-color: var(--bg-modifier-hover);
  color: var(--text-normal);
}

.control-btn.active-red {
  color: var(--text-danger);
}

.control-btn.active-green {
  color: var(--text-positive);
}

/* ==========================================================================
   3. MAIN CONTENT (COL 3)
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Top Channel Header */
.channel-header {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  background-color: var(--bg-primary);
  z-index: 5;
  box-shadow: var(--shadow-elevation-low);
}

.channel-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.channel-header-icon {
  font-size: 20px;
  color: var(--text-muted);
}

.channel-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
}

.channel-header-divider {
  width: 1px;
  height: 16px;
  background-color: var(--text-muted);
  opacity: 0.3;
  margin: 0 4px;
}

.channel-header-topic {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.header-action-btn:hover {
  color: var(--text-heading);
}

/* Mobile Toggle Buttons (Hidden on desktop) */
.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  margin-right: 4px;
  flex-shrink: 0;
  transition: all 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-toggle:hover,
.mobile-nav-toggle:active {
  color: var(--text-heading);
  background-color: var(--bg-modifier-hover);
}

.mobile-members-toggle {
  display: none;
}

/* Mobile Drawer Overlay Backdrop */
.mobile-backdrop {
  display: none;
}


/* Chat Stage */
.chat-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-scroller {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Scroll-up History Loader */
.chat-history-loader {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}

.chat-history-loader.show {
  display: flex;
}

.chat-history-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spinHistory 0.6s linear infinite;
}

@keyframes spinHistory {
  to { transform: rotate(360deg); }
}

.chat-welcome-banner {
  margin-bottom: 16px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 8px;
}

.chat-welcome-banner h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.chat-welcome-banner p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Individual Message Entry */
.message-entry {
  display: flex;
  gap: 16px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  transition: background 0.1s ease;
  position: relative;
}

.message-entry:hover {
  background-color: rgba(2, 2, 3, 0.08);
}

/* Discord-Style System Messages (Member Join Welcome) */
.message-entry.message-system-join {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  margin: 3px 0;
  border-radius: var(--radius-sm);
  background: rgba(35, 165, 90, 0.06);
  border-left: 3px solid #23a55a;
  transition: background-color 0.15s ease;
}

.message-entry.message-system-join:hover {
  background: rgba(35, 165, 90, 0.12);
}

.message-system-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(35, 165, 90, 0.18);
  color: #23a55a;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.message-system-avatar {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  font-size: 11px !important;
  flex-shrink: 0;
}

.message-system-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.message-system-body {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1.4;
}

.message-system-author {
  font-weight: 700;
  color: var(--text-heading);
  cursor: pointer;
}

.message-system-author:hover {
  text-decoration: underline;
}

.message-system-text {
  color: var(--text-normal);
  font-weight: 500;
}

.message-system-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.message-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background-color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
}

.message-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.message-author {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-heading);
  cursor: pointer;
}

.message-author:hover {
  text-decoration: underline;
}

.bot-tag {
  background-color: var(--brand-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
}

.message-time {
  font-size: 12px;
  color: var(--text-muted);
}

.message-body {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-normal);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.message-body strong {
  font-weight: 700;
  color: var(--text-heading);
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.reaction-pill:hover {
  background-color: var(--bg-modifier-hover);
  color: var(--text-heading);
}

.reaction-pill.reacted {
  background-color: rgba(88, 101, 242, 0.15);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

/* Clickable Chat Links */
.chat-link {
  color: #00a8fc;
  text-decoration: none;
  word-break: break-all;
}

.chat-link:hover {
  text-decoration: underline;
}

/* YouTube & Rich Media Embeds (Discord Style) */
.message-embeds-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  max-width: 100%;
}

.message-embed {
  background-color: #2b2d31;
  border-left: 4px solid #f23f43; /* YouTube red accent bar */
  border-radius: 4px;
  padding: 8px 12px 10px 12px;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  min-width: 460px;
  max-width: 480px;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.message-embed.youtube-shorts {
  max-width: 280px;
}

.embed-provider {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #dbdee1;
  user-select: none;
}

.embed-provider-icon {
  font-size: 13px;
}

.embed-video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background-color: #1e1f22;
}

.message-embed.youtube-shorts .embed-video-wrapper {
  aspect-ratio: 9 / 16;
  max-height: 480px;
}

.embed-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Chat Input Bar */
.chat-input-container {
  padding: 0 16px 20px 16px;
  background-color: var(--bg-primary);
}

.chat-input-box {
  background-color: #383a40;
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 44px;
}

.chat-attach-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  border-radius: 50%;
  transition: color 0.15s, background-color 0.15s;
}

.chat-attach-btn:hover {
  color: var(--text-heading);
  background-color: var(--bg-modifier-hover);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-normal);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  padding: 10px 0;
  resize: none;
  min-height: 24px;
  max-height: 180px;
  line-height: 1.4;
  overflow-y: hidden;
}

.chat-input::-webkit-scrollbar {
  width: 6px;
}

.chat-input::-webkit-scrollbar-thumb {
  background-color: var(--bg-tertiary);
  border-radius: 3px;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.chat-char-counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, font-weight 0.15s;
  user-select: none;
}

.chat-char-counter.warning {
  color: #faa61a;
}

.chat-char-counter.limit {
  color: #ed4245;
  font-weight: 700;
}

.chat-send-btn {
  background: var(--discord-blurple);
  border: none;
  color: #ffffff;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background-color 0.15s, transform 0.1s;
  padding-left: 2px;
}

.chat-send-btn:hover {
  background-color: var(--discord-blurple-hover);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-action-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.chat-action-icon:hover {
  color: var(--text-heading);
}

/* ==========================================================================
   4. VOICE & STREAM STAGE (WEBRTC MULTI-SCREEN GRID & SWITCHER)
   ========================================================================== */
.voice-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #0c0e12;
  position: relative;
  overflow: hidden;
}

/* Stage Top Controls & Driver Switcher Bar */
.stage-top-bar {
  height: 52px;
  min-height: 52px;
  background-color: rgba(17, 18, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
  z-index: 10;
}

.driver-switcher-container {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 2px;
}

.switcher-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.driver-switcher-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

/* Driver Switcher Chip */
.driver-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #1e2024;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  color: var(--text-normal);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.driver-chip:hover {
  background-color: #2b2d31;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.driver-chip.active {
  background-color: rgba(88, 101, 242, 0.2);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.35);
}

.driver-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-danger);
  animation: pulse-dot 1.5s infinite;
}

.driver-chip-shortcut {
  font-size: 10px;
  background-color: rgba(0, 0, 0, 0.4);
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font-code);
}

/* View Mode Buttons */
.stage-view-modes {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-mode-btn {
  background-color: #1e2024;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.stage-mode-btn:hover {
  background-color: #2b2d31;
  color: var(--text-heading);
}

.stage-mode-btn.active {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.stage-mode-btn.btn-accent {
  background-color: rgba(35, 165, 90, 0.15);
  border-color: rgba(35, 165, 90, 0.4);
  color: #23a55a;
}

.stage-mode-btn.btn-accent:hover {
  background-color: #23a55a;
  color: #fff;
}

/* Grid Container (Equitable Grid View) */
.voice-grid-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  padding: 16px;
  overflow-y: auto;
  align-content: center;
}

/* Single stream in grid expands nicely */
.voice-grid-container.single-stream {
  grid-template-columns: 1fr;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.voice-grid-container.dual-stream {
  grid-template-columns: repeat(2, 1fr);
}

.voice-grid-container.quad-stream {
  grid-template-columns: repeat(2, 1fr);
}

/* Tile in the Voice/Stream Grid */
.voice-tile {
  background-color: #1e1f22;
  border-radius: var(--radius-md);
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-elevation-high);
  border: 2px solid transparent;
  transition: border-color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.voice-tile:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
}

.voice-tile.speaking {
  border-color: var(--status-speaking);
  box-shadow: 0 0 16px rgba(35, 165, 90, 0.3);
}

.voice-tile.focused {
  border-color: var(--brand-primary);
}

.voice-tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #050608;
}

.voice-tile canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #050608;
}

.voice-tile-avatar-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tile-big-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background-color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  color: #fff;
  transition: all 0.2s ease;
  position: relative;
}

.tile-big-avatar.speaking {
  box-shadow: 0 0 0 4px var(--status-speaking), 0 0 20px rgba(35, 165, 90, 0.6);
  transform: scale(1.05);
}

/* User Info Overlay in Tile */
.tile-user-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  padding: 4px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  z-index: 4;
}

.tile-badges {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 4;
}

.stream-live-badge {
  background-color: var(--text-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fps-badge {
  background-color: rgba(0, 0, 0, 0.75);
  color: #23a55a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(35, 165, 90, 0.3);
}

/* Floating Action Overlay on Tile (Hover Buttons) */
.tile-actions-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 5;
}

.voice-tile:hover .tile-actions-overlay {
  opacity: 1;
  transform: translateY(0);
}

.tile-action-btn {
  background-color: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.tile-action-btn:hover {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  transform: scale(1.1);
}

/* ==========================================================================
   SPOTLIGHT LAYOUT (MAIN VIEWPORT + THUMBNAILS STRIP)
   ========================================================================== */
.spotlight-stage-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  overflow: hidden;
}

.spotlight-main-viewport {
  flex: 1;
  background-color: #050608;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-elevation-high);
  border: 2px solid rgba(88, 101, 242, 0.3);
}

.spotlight-main-viewport video,
.spotlight-main-viewport canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.spotlight-thumbnails-strip {
  height: 120px;
  min-height: 120px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px;
  align-items: center;
}

.spotlight-thumb-item {
  width: 180px;
  min-width: 180px;
  height: 100%;
  background-color: #1e1f22;
  border-radius: var(--radius-sm);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spotlight-thumb-item:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

.spotlight-thumb-item.active {
  border-color: var(--brand-primary);
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.4);
}

.spotlight-thumb-item video,
.spotlight-thumb-item canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spotlight-thumb-overlay {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}

/* Floating Bottom Voice Controls Bar */
.voice-bottom-controls {
  height: 80px;
  min-height: 80px;
  background-color: rgba(17, 18, 20, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.voice-action-circle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #2b2d31;
  border: none;
  color: var(--text-heading);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.2s ease;
  position: relative;
}

.voice-action-circle-btn:hover {
  background-color: #3f4248;
  transform: translateY(-2px);
}

.voice-action-circle-btn.btn-active {
  background-color: #fff;
  color: #000;
}

.voice-action-circle-btn.btn-red {
  background-color: var(--text-danger);
  color: #fff;
}

.voice-action-circle-btn.btn-red:hover {
  background-color: #d83a3e;
}

.voice-action-circle-btn.btn-green {
  background-color: var(--status-online);
  color: #fff;
}

/* ==========================================================================
   5. MEMBERS SIDEBAR (COL 4)
   ========================================================================== */
.members-sidebar {
  width: var(--members-sidebar-width);
  min-width: var(--members-sidebar-width);
  background-color: var(--bg-secondary);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  height: 100%;
}

.members-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.members-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 4px 8px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.15s ease;
}

.member-card:hover {
  background-color: var(--bg-modifier-hover);
}

.member-card-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.member-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-card-status {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   6. MODALS & POPUPS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background-color: var(--bg-primary);
  width: 480px;
  max-width: 90vw;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevation-high);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-backdrop.show .modal-window {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px 12px 24px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.modal-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-body {
  padding: 12px 24px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--bg-tertiary);
  border-radius: 3px;
}

.form-section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.form-section-divider span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* GPU Status Card */
.gpu-status-card {
  background-color: var(--bg-secondary);
  border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gpu-icon-wrap {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.gpu-info-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.gpu-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gpu-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gpu-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: rgba(35, 165, 90, 0.2);
  color: #23a55a;
  border: 1px solid rgba(35, 165, 90, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gpu-badge.warning {
  background-color: rgba(240, 178, 50, 0.2);
  color: #f0b232;
  border-color: rgba(240, 178, 50, 0.4);
}

.gpu-description {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-top: 2px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.form-control {
  background-color: var(--bg-tertiary);
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  color: var(--text-normal);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--brand-primary);
}

/* Audio Checkbox / Feature Toggles */
.checkbox-group {
  padding: 4px 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  background-color: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.checkbox-label:hover .checkbox-custom {
  border-color: var(--brand-primary);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.checkbox-custom::after {
  content: "";
  display: none;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-custom::after {
  display: block;
}

.checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.checkbox-text small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-container input[type="range"] {
  flex: 1;
  accent-color: var(--brand-primary);
}

.modal-footer {
  background-color: var(--bg-secondary);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-secondary {
  background: none;
  border: none;
  color: var(--text-heading);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
}

.btn-secondary:hover {
  text-decoration: underline;
}

.btn-primary {
  background-color: var(--brand-primary);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 24px;
  border-radius: var(--radius-xs);
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background-color: var(--brand-hover);
}

/* Auth / Google Login Invite Modal */
.auth-modal-window {
  width: 440px;
  text-align: center;
}

.auth-modal-body {
  align-items: center;
  text-align: center;
  padding: 24px 28px 20px 28px;
}

.auth-modal-illustration {
  margin-bottom: 12px;
}

.auth-icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.2), rgba(242, 63, 67, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto;
}

.auth-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 8px;
}

.auth-modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
  max-width: 360px;
}

.auth-features-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 22px;
  text-align: left;
}

.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-normal);
}

.auth-feature-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.btn-google-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background-color: #ffffff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn-google-login:hover {
  background-color: #f8f9fa;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
}

.btn-google-login:active {
  background-color: #f1f3f4;
  transform: scale(0.99);
}

.google-svg-icon {
  flex-shrink: 0;
}

.auth-modal-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* Header Login Button & Authenticated Profile */
.btn-header-login {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--discord-blurple);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-header-login:hover {
  background-color: var(--discord-blurple-hover);
}

.btn-header-login:active {
  transform: scale(0.96);
}

.google-icon-mini {
  flex-shrink: 0;
}

.user-header-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 8px 3px 4px;
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
}

.user-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--discord-blurple);
  flex-shrink: 0;
}

.user-header-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.user-header-name {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  width: fit-content;
  letter-spacing: 0.5px;
  background-color: var(--discord-blurple);
  color: #ffffff;
}

.user-role-badge.badge-admin {
  background-color: #f0b232;
  color: #1e1f22;
  font-weight: 800;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(242, 63, 67, 0.15);
  color: #f23f43;
  border: 1px solid rgba(242, 63, 67, 0.3);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  margin-left: 2px;
}

.btn-logout:hover {
  background: #f23f43;
  color: #ffffff;
}

.btn-logout:active {
  transform: scale(0.96);
}

.avatar-circle-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.message-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.message-role-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  letter-spacing: 0.5px;
  vertical-align: middle;
  background-color: var(--discord-blurple);
  color: #ffffff;
}

.message-role-badge.badge-admin {
  background-color: #f0b232;
  color: #1e1f22;
  font-weight: 800;
}

.auth-dev-section {
  width: 100%;
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: left;
}

.auth-dev-notice {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.auth-dev-notice code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
  color: #fff;
  font-family: monospace;
}

.auth-dev-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-dev-form .settings-input {
  width: 100%;
  padding: 8px 10px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
}

.auth-dev-form .btn-primary {
  width: 100%;
  padding: 9px;
  justify-content: center;
  font-size: 13px;
}

.auth-loggedin-section {
  width: 100%;
  text-align: center;
  padding: 10px 0;
}

.auth-loggedin-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--discord-blurple);
  margin: 0 auto 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.auth-loggedin-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.auth-loggedin-email {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.auth-loggedin-status-text {
  font-size: 13px;
  color: var(--text-normal);
  line-height: 1.5;
  margin: 14px 0 18px;
  background: var(--bg-secondary);
  padding: 10px;
  border-radius: var(--radius-sm);
}

.auth-loggedin-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Server Header Action Buttons */

.btn-server-action {
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.btn-server-invite {
  background: rgba(88, 101, 242, 0.15);
  color: var(--discord-blurple);
  border-color: rgba(88, 101, 242, 0.35);
}

.btn-server-invite:hover {
  background: var(--discord-blurple);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-server-invite:active {
  transform: scale(0.96);
}

.btn-server-edit {
  background: rgba(78, 80, 88, 0.25);
  color: var(--text-normal);
  border-color: rgba(78, 80, 88, 0.45);
}

.btn-server-edit:hover {
  background: rgba(78, 80, 88, 0.5);
  color: var(--text-heading);
  transform: translateY(-1px);
}

.btn-server-edit:active {
  transform: scale(0.96);
}

.edit-server-window {
  max-width: 460px;
  width: 90%;
}

.edit-preview-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

.btn-server-delete {
  background: rgba(237, 66, 69, 0.15);
  color: #f23f43;
  border-color: rgba(237, 66, 69, 0.35);
}

.btn-server-delete:hover {
  background: #da373c;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-server-delete:active {
  transform: scale(0.96);
}

/* Discord Floating Tooltip for Server List */
.discord-floating-tooltip {
  position: fixed;
  background-color: #111214;
  color: #f2f3f5;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.95);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 99999;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.discord-floating-tooltip::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid #111214;
}

.discord-floating-tooltip.show {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* Create Server Modal Styles */
.create-server-window {
  max-width: 440px;
}

.create-server-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
  text-align: left;
}

.server-icon-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.icon-picker-btn {
  font-size: 22px;
  height: 44px;
  background-color: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-picker-btn:hover {
  background-color: var(--bg-modifier-hover);
  transform: scale(1.06);
}

.icon-picker-btn.active {
  border-color: var(--discord-blurple);
  background-color: rgba(88, 101, 242, 0.25);
  box-shadow: 0 0 8px rgba(88, 101, 242, 0.4);
}

/* Invite Pilots Modal Styles */
.invite-modal-window {
  max-width: 440px;
}

.invite-modal-body {
  text-align: left;
}

.invite-server-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-secondary);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.invite-server-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  background-color: var(--bg-tertiary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.invite-server-info h3 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 2px;
}

.invite-server-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.invite-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.invite-url-input {
  flex: 1;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 13px;
  font-family: monospace;
  outline: none;
}

.invite-url-input:focus {
  border-color: var(--discord-blurple);
}

.btn-copy-invite {
  background-color: var(--discord-blurple);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-copy-invite:hover {
  background-color: var(--discord-blurple-hover);
}

.btn-copy-invite.copied {
  background-color: #23a55a;
}

.invite-modal-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* User Settings Overlay (Full Screen Discord Modal) */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 150;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.settings-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.settings-sidebar {
  width: 240px;
  background-color: var(--bg-secondary-alt);
  padding: 40px 16px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-nav-item {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-nav-item:hover {
  background-color: var(--bg-modifier-hover);
  color: var(--text-normal);
}

.settings-nav-item.active {
  background-color: var(--bg-modifier-selected);
  color: var(--text-heading);
}

.settings-content {
  flex: 1;
  padding: 40px 60px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 720px;
}

.settings-close-btn {
  position: absolute;
  top: 36px;
  right: 48px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-close-btn:hover {
  border-color: var(--text-heading);
  color: var(--text-heading);
  transform: rotate(90deg);
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-floating);
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: var(--shadow-elevation-high);
  transition: opacity 0.15s ease;
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE UX (DISCORD MOBILE ARCHITECTURE)
   ========================================================================== */

/* Tablet & Intermediate Desktop */
@media (max-width: 992px) {
  .members-sidebar {
    display: none;
  }
}

/* Mobile Devices (Smartphones & Small Tablets <= 768px) */
@media (max-width: 768px) {
  /* 1. App Container & Viewport */
  #app {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
  }

  /* 2. Sidebars converted to Left Drawer */
  .servers-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 72px;
    min-width: 72px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.6);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    padding-top: env(safe-area-inset-top);
  }

  .channels-sidebar {
    position: fixed;
    left: 72px;
    top: 0;
    bottom: 0;
    width: min(calc(100vw - 72px), 280px);
    min-width: 0;
    z-index: 100;
    transform: translateX(calc(-100% - 72px));
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
  }

  /* When Mobile Navigation Drawer is Open */
  #app.mobile-nav-open .servers-sidebar {
    transform: translateX(0);
  }

  #app.mobile-nav-open .channels-sidebar {
    transform: translateX(0);
  }

  /* 3. Members converted to Right Drawer */
  .members-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(80vw, 280px);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.75);
    display: block !important;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  #app.mobile-members-open .members-sidebar {
    transform: translateX(0);
  }

  /* 4. Backdrop Overlay */
  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  #app.mobile-nav-open .mobile-backdrop,
  #app.mobile-members-open .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* 5. Main Stage fills 100% of viewport */
  .main-content {
    width: 100vw;
    min-width: 0;
    flex: 1;
  }

  /* 6. Channel Header (Mobile Responsive & Never-Overflow) */
  .channel-header {
    padding: 0 8px;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Left: Nav Toggle (☰) + Channel Icon + Channel Name */
  .channel-header-left {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
  }

  .mobile-nav-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    flex-shrink: 0 !important;
    background: transparent;
    color: var(--text-normal);
    font-size: 22px;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    margin-right: 2px;
    padding: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-toggle:active {
    background-color: var(--bg-modifier-active);
    color: var(--text-heading);
  }

  .channel-header-icon {
    font-size: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
  }

  .channel-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    max-width: 90px;
    flex-shrink: 1;
  }

  .channel-header-topic,
  .channel-header-divider {
    display: none !important;
  }

  /* Right: Compact Action Controls & Guaranteed Members Button (👥) */
  .channel-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0 !important;
    margin-left: auto;
    min-width: 0;
  }

  /* User Profile on Mobile: Avatar + Compact Logout Icon only */
  .user-header-profile {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 0;
    flex-shrink: 0;
  }

  .user-header-avatar {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    border: 2px solid var(--discord-blurple);
    cursor: pointer;
    flex-shrink: 0;
  }

  .user-header-info {
    display: none !important; /* Hides username & huge role badge on mobile screens */
  }

  .btn-logout {
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .btn-logout:hover,
  .btn-logout:active {
    background: rgba(237, 66, 69, 0.25);
    color: #f23f43;
    border-color: rgba(237, 66, 69, 0.5);
  }

  .btn-logout .btn-logout-text {
    display: none !important; /* Hides text 'Sair', keeping clean SVG icon */
  }

  /* Compact Upgrade Pro Button (💎 only on mobile) */
  .btn-upgrade-pro {
    padding: 4px 7px;
    font-size: 13px;
    border-radius: var(--radius-xs);
    height: 26px;
    min-width: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .btn-upgrade-pro .pro-btn-text {
    display: none !important; /* Hides text 'Seja Pro' / 'Assinante Pro', keeping 💎 */
  }

  /* Compact Admin Button (👑 only on mobile) */
  .btn-admin-header {
    padding: 4px 7px !important;
    font-size: 13px !important;
    border-radius: var(--radius-xs) !important;
    height: 26px !important;
    min-width: 26px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
  }

  .btn-admin-header .admin-btn-text {
    display: none !important; /* Hides text 'Admin', keeping 👑 */
  }

  /* Action Buttons (Chat 💬, Voice 📺, Members 👥) */
  .header-action-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: 16px;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important;
    padding: 0;
    color: var(--text-normal);
    touch-action: manipulation;
  }

  .header-action-btn:active {
    background-color: var(--bg-modifier-active);
  }

  /* Members Button (👥) is ALWAYS prominently visible on the right */
  .mobile-members-toggle {
    display: inline-flex !important;
    flex-shrink: 0 !important;
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 18px;
    color: var(--text-normal);
  }

  /* Login Button on Mobile */
  .btn-header-login {
    padding: 4px 8px;
    font-size: 12px;
    height: 28px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
  }

  /* 7. Chat Stage Mobile */
  .messages-scroller {
    padding: 10px 8px;
  }

  .chat-welcome-banner {
    margin-bottom: 12px;
    padding: 10px;
  }

  .chat-welcome-banner h1 {
    font-size: 18px;
  }

  .message-item {
    padding: 6px 4px;
    gap: 8px;
  }

  .message-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 14px;
  }

  .message-text {
    font-size: 14px;
    line-height: 1.4;
  }

  .message-embed {
    max-width: 100%;
    width: 100%;
  }

  .message-embed.youtube-shorts {
    max-width: 260px;
  }

  .chat-input-container {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom)) 8px;
  }

  .chat-input-box {
    padding: 2px 8px;
    min-height: 44px;
  }

  .chat-input {
    font-size: 16px; /* Essential: prevents auto-zoom on mobile safari & chrome */
    padding: 8px 4px;
  }

  .chat-attach-btn,
  .chat-action-icon,
  .chat-send-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* 8. Voice Stage Mobile */
  .stage-top-bar {
    padding: 6px 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-height: auto;
  }

  .driver-switcher-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .driver-switcher-container::-webkit-scrollbar {
    display: none;
  }

  .driver-switcher-bar {
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .stage-view-modes {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }

  .stage-view-modes::-webkit-scrollbar {
    display: none;
  }

  .stage-mode-btn {
    padding: 6px 10px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .voice-grid-container {
    grid-template-columns: 1fr;
    padding: 8px;
    gap: 8px;
    overflow-y: auto;
    padding-bottom: 90px;
  }

  .participant-tile {
    min-height: 180px;
    max-height: 38vh;
    aspect-ratio: 16/9;
  }

  .spotlight-stage-layout {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    padding-bottom: 90px;
  }

  .spotlight-main-viewport {
    min-height: 200px;
    max-height: 45vh;
    flex: 1;
  }

  .spotlight-thumbnails-strip {
    height: 80px;
    min-height: 80px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }

  .spotlight-thumb-item {
    width: 110px;
    min-width: 110px;
    height: 70px;
  }

  .voice-bottom-controls {
    bottom: calc(12px + env(safe-area-inset-bottom));
    padding: 8px 16px;
    gap: 16px;
    background: rgba(30, 31, 34, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }

  .voice-action-circle-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  /* 9. User Footer in Mobile Drawer */
  .user-footer {
    height: calc(54px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: 8px;
    padding-right: 8px;
  }

  .control-btn {
    width: 36px;
    height: 36px;
    font-size: 17px;
  }

  /* 10. Settings Modal on Mobile */
  .modal-window {
    width: calc(100vw - 20px);
    max-width: 500px;
    max-height: calc(90dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .modal-header h3 {
    font-size: 18px;
  }

  .modal-body {
    padding-right: 2px;
    gap: 12px;
  }

  .color-picker-dot {
    width: 32px;
    height: 32px;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .btn-modal-cancel,
  .btn-modal-save {
    width: 100%;
    min-height: 44px;
  }

  /* Disable hover tooltips on mobile devices */
  [data-tooltip]::after {
    display: none !important;
  }
}

/* Compact adjustments for narrow smartphones (<= 480px) */
@media (max-width: 480px) {
  .channel-header {
    padding: 0 6px;
    gap: 3px;
  }

  .channel-header-right {
    gap: 3px;
  }

  .channel-header-title {
    max-width: 70px;
  }

  .btn-header-login .btn-login-text {
    display: none !important;
  }
}

/* Micro devices & narrow foldables (<= 360px) */
@media (max-width: 360px) {
  .channel-header {
    padding: 0 4px;
    gap: 2px;
  }

  .channel-header-right {
    gap: 2px;
  }

  .channel-header-title {
    max-width: 45px;
    font-size: 14px;
  }

  .header-action-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    font-size: 14px;
  }

  .mobile-nav-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 20px;
  }

  .mobile-members-toggle {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 16px;
  }

  .btn-upgrade-pro,
  .btn-admin-header {
    padding: 3px 5px !important;
    font-size: 12px !important;
    height: 24px !important;
    min-width: 24px !important;
  }

  .user-header-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
  }

  .btn-logout {
    min-width: 24px;
    height: 24px;
    padding: 3px 4px;
  }
}

/* ==========================================================================
   MESSAGE ACTIONS BAR & MODERATION (ETAPA 4: SUPERPODERES)
   ========================================================================== */
.message-actions-bar {
  position: absolute;
  top: -14px;
  right: 16px;
  background-color: var(--bg-surface-2, #313338);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  padding: 2px 4px;
  gap: 2px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.message-entry:hover .message-actions-bar {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.message-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #949ba4);
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.message-action-btn:hover {
  color: var(--text-normal, #dbdee1);
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-delete-msg {
  color: var(--text-muted, #949ba4);
}

.btn-delete-msg:hover {
  color: #fa777c !important;
  background-color: rgba(218, 55, 60, 0.18) !important;
}

/* Smooth deletion exit transition */
.message-entry.deleting {
  opacity: 0 !important;
  transform: scale(0.96) translateY(-6px);
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Delete Message Modal */
.delete-modal-window {
  max-width: 440px;
  background-color: var(--bg-surface-1, #2b2d31);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.delete-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.delete-modal-text {
  font-size: 15px;
  color: var(--text-normal, #dbdee1);
  line-height: 1.4;
  margin: 0;
}

.delete-msg-preview {
  background-color: var(--bg-surface-2, #1e1f22);
  border-left: 3px solid #da373c;
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 130px;
  overflow-y: auto;
}

.delete-msg-preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.delete-msg-preview-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading, #f2f3f5);
}

.delete-msg-preview-time {
  font-size: 11px;
  color: var(--text-muted, #949ba4);
}

.delete-msg-preview-body {
  font-size: 13px;
  color: var(--text-normal, #dbdee1);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}

.btn-confirm-delete {
  background-color: #da373c;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn-confirm-delete:hover {
  background-color: #ba2f33;
}

.btn-confirm-delete:active {
  transform: scale(0.98);
}

/* ==========================================================================
   CUSTOM TEXT CHANNELS & CHANNEL SETTINGS (ETAPA 4)
   ========================================================================== */
.btn-add-channel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.15s ease, background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.btn-add-channel:hover:not(:disabled) {
  color: var(--text-normal);
  background-color: var(--bg-modifier-hover);
}

.btn-add-channel:disabled,
.btn-add-channel.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.channel-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.channel-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.channel-settings-btn {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.channel-item:hover .channel-settings-btn,
.channel-item.active .channel-settings-btn,
.channel-settings-btn:focus-visible {
  opacity: 0.7;
}

.channel-settings-btn:hover {
  opacity: 1 !important;
  color: var(--text-normal);
  background-color: var(--bg-modifier-hover);
}

@media (hover: none) {
  .channel-settings-btn {
    opacity: 0.75;
  }
}

.channel-modal-window {
  max-width: 460px;
  width: 92%;
}

.channel-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.channel-input-prefix {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
}

.channel-slug-input {
  padding-left: 30px !important;
}

.btn-danger-outline {
  background: transparent;
  color: var(--status-danger, #da373c);
  border: 1px solid var(--status-danger, #da373c);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-outline:hover {
  background-color: var(--status-danger, #da373c);
  color: #fff;
}

/* =========================================================================
   FREEMIUM ARCHITECTURE, PRO 💎 BADGES & MODO DEGUSTAÇÃO
   ========================================================================= */

/* Header Pro Button */
.btn-upgrade-pro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #7289da 0%, #00b0f4 50%, #5865f2 100%);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 176, 244, 0.3);
}

.btn-upgrade-pro:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 176, 244, 0.5);
  filter: brightness(1.1);
}

.btn-upgrade-pro.active-pro {
  background: rgba(0, 176, 244, 0.15);
  border: 1px solid #00b0f4;
  color: #00b0f4;
  box-shadow: none;
}

.btn-admin-header {
  background: linear-gradient(135deg, #f1c40f 0%, #e67e22 100%) !important;
  color: #000 !important;
  font-weight: 700 !important;
}

/* User Pro 💎 Badge */
.user-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  margin-left: 4px;
  cursor: help;
  animation: pulse-gem 3s infinite ease-in-out;
  will-change: transform, opacity;
}

@keyframes pulse-gem {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* NANO Checkout Pulse Dot (GPU Composited Animation) */
.nano-pulse-dot {
  width: 10px;
  height: 10px;
  background: #00b0f4;
  border-radius: 50%;
  box-shadow: 0 0 8px #00b0f4;
  animation: nanoPulseDot 1.5s infinite ease-in-out;
  flex-shrink: 0;
  will-change: transform, opacity;
}

@keyframes nanoPulseDot {
  0%, 100% { transform: scale(0.9); opacity: 0.65; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Sponsor Promo Banner (Modo Degustação) */
.sponsor-promo-banner {
  background: linear-gradient(90deg, #1e1b4b 0%, #312e81 30%, #4338ca 70%, #1e1b4b 100%);
  border-bottom: 2px solid #6366f1;
  padding: 8px 16px;
  width: 100%;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
  animation: fadeInBanner 0.3s ease-out;
  z-index: 10;
}

@keyframes fadeInBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sponsor-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  text-align: center;
}

.sponsor-fire-icon {
  font-size: 18px;
  animation: flame-flicker 1.5s infinite alternate;
}

@keyframes flame-flicker {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 4px #ff5722); }
}

.sponsor-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.sponsor-banner-tag {
  font-size: 12px;
  color: #fbbf24;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
}

.sponsor-badge-4k {
  font-size: 11px;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* Chat Attachment Preview */
.chat-attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-normal);
}

.attachment-preview-name {
  font-weight: 600;
  color: #fff;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-size {
  color: var(--text-muted);
  font-size: 11px;
}

.attachment-remove-btn {
  background: none;
  border: none;
  color: var(--status-danger);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
}

.attachment-remove-btn:hover {
  background: rgba(218, 55, 60, 0.15);
}

/* Message Attachment Styles */
.message-attachment {
  margin-top: 8px;
}

.message-attachment-image img {
  max-width: 400px;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.message-attachment-image img:hover {
  transform: scale(1.02);
}

.message-attachment-file {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 420px;
}

.message-attachment-file .file-icon {
  font-size: 26px;
}

.message-attachment-file .file-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.message-attachment-file .file-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-attachment-file .file-size {
  font-size: 11px;
  color: var(--text-muted);
}

.message-attachment-file .file-download-btn {
  background: var(--discord-blurple);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background 0.15s;
}

.message-attachment-file .file-download-btn:hover {
  background: #4752c4;
}

/* Upgrade Modal Window */
.upgrade-modal-window {
  max-width: 680px;
  width: 95%;
  background: #18191c;
}

.upgrade-modal-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 20px 24px;
}

.upgrade-header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.upgrade-gem-icon {
  font-size: 36px;
}

.upgrade-header-brand h2 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.upgrade-header-brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* Pro Subscriber Active Status & Cumulative Renewal Notice */
.pro-subscriber-status-card {
  background: linear-gradient(135deg, rgba(0, 176, 244, 0.15) 0%, rgba(88, 101, 242, 0.12) 100%);
  border: 1px solid rgba(0, 176, 244, 0.35);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pro-status-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pro-status-gem {
  font-size: 26px;
  filter: drop-shadow(0 0 8px rgba(0, 176, 244, 0.7));
}

.pro-status-title {
  font-size: 14px;
  font-weight: 700;
  color: #00b0f4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pro-status-validity {
  font-size: 13px;
  color: #ffffff;
  margin-top: 2px;
  font-weight: 500;
}

.pro-status-validity strong {
  color: #38bdf8;
}

.pro-renewal-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #e2e8f0;
}

.pro-renewal-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.pro-renewal-info strong {
  color: #facc15;
}

.pro-renewal-info u {
  text-decoration-color: #38bdf8;
  font-weight: 600;
}

/* Plan Tabs */
.upgrade-plan-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.upgrade-plan-tab {
  position: relative;
  background: var(--bg-secondary);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.upgrade-plan-tab:hover {
  background: var(--bg-modifier-hover);
}

.upgrade-plan-tab.active {
  border-color: #00b0f4;
  background: rgba(0, 176, 244, 0.08);
}

.plan-tab-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: #10b981;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
}

.plan-tab-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.plan-tab-price {
  font-size: 18px;
  font-weight: 800;
  color: #00b0f4;
  margin-top: 4px;
}

.plan-tab-price small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Perks Grid */
.upgrade-perks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.perk-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 10px 12px;
}

.perk-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.perk-info strong {
  display: block;
  font-size: 13px;
  color: #fff;
}

.perk-info span {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* NANO Checkout Card */
.nano-checkout-card {
  background: #111214;
  border: 1px solid #23a55a;
  border-radius: 8px;
  padding: 18px;
}

.nano-checkout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.nano-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nano-symbol {
  font-size: 22px;
  color: #23a55a;
}

.nano-brand strong {
  display: block;
  font-size: 14px;
  color: #fff;
}

.nano-brand small {
  color: var(--text-muted);
  font-size: 11px;
}

.nano-quote-box {
  text-align: right;
}

.nano-quote-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.nano-quote-val {
  font-size: 18px;
  font-weight: 800;
  color: #23a55a;
}

.nano-checkout-body {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.nano-qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.nano-qr-image {
  width: 140px;
  height: 140px;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}

.nano-qr-container small {
  font-size: 10px;
  color: var(--text-muted);
}

.nano-address-wrap {
  flex: 1;
  min-width: 260px;
}

.nano-address-wrap label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.copy-input-group,
.verify-hash-group {
  display: flex;
  gap: 8px;
}

.btn-copy-address {
  background: var(--bg-secondary);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-copy-address:hover {
  background: var(--bg-modifier-hover);
}

.btn-verify-nano {
  background: #23a55a;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-verify-nano:hover {
  background: #1b8547;
}

.nano-payment-feedback {
  margin-top: 10px;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 4px;
}

.nano-payment-feedback.success {
  background: rgba(35, 165, 90, 0.2);
  color: #23a55a;
  border: 1px solid #23a55a;
}

.nano-payment-feedback.error {
  background: rgba(218, 55, 60, 0.2);
  color: var(--status-danger);
  border: 1px solid var(--status-danger);
}

.upgrade-guarantee-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* Admin Modal */
.admin-modal-window {
  max-width: 650px;
  width: 95%;
}

.admin-modal-header {
  border-bottom: 1px solid var(--border-subtle);
}

.admin-modal-header h2 {
  font-size: 18px;
  color: #fff;
  margin: 0;
}

.admin-modal-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.admin-section h3 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 4px;
}

.admin-form-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-secondary);
  padding: 14px;
  border-radius: 8px;
}

.admin-date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-form-row {
  display: flex;
  gap: 10px;
  background: var(--bg-secondary);
  padding: 14px;
  border-radius: 8px;
  align-items: flex-end;
}

.admin-events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-height: 180px;
  overflow-y: auto;
}

.admin-event-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  padding: 10px 14px;
  border-radius: 6px;
  border-left: 3px solid var(--discord-blurple);
}

.admin-event-item.active {
  border-left-color: #10b981;
}

.admin-event-item.scheduled {
  border-left-color: #fbbf24;
}

.admin-event-item.expired {
  border-left-color: #64748b;
  opacity: 0.75;
}

.admin-event-item.paused {
  border-left-color: #ef4444;
  opacity: 0.85;
}

.admin-event-info strong {
  display: block;
  font-size: 13px;
  color: #fff;
}

.admin-event-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.admin-event-actions {
  display: flex;
  gap: 6px;
}

