/* ============================================================================
   ELITELAS — DISCORD-GRADE DARK THEME
   Paleta: Rail #202225 • Sidebars #2f3136 • Chat #36393f • Painel usuário #292b2f
   ============================================================================ */
:root {
  --bg-rail: #202225;
  --bg-tertiary: #18191c;
  --bg-sidebar: #2f3136;
  --bg-chat: #36393f;
  --bg-user-panel: #292b2f;
  --bg-input: #40444b;
  --bg-modifier-hover: rgba(79, 84, 92, 0.32);
  --bg-modifier-active: rgba(79, 84, 92, 0.48);
  --bg-modifier-selected: rgba(79, 84, 92, 0.6);
  --bg-floating: #18191c;

  --text-normal: #dcddde;
  --text-white: #ffffff;
  --text-header: #f2f3f5;
  --text-muted: #8e9297;
  --text-channel: #96989d;
  --interactive-normal: #b9bbbe;
  --interactive-hover: #dcddde;

  --brand: #5865f2;
  --brand-hover: #4752c4;
  --green: #3ba55d;
  --green-bright: #23a55a;
  --idle: #faa81a;
  --dnd: #ed4245;
  --offline: #747f8d;
  --red: #ed4245;
  --mention-bg: rgba(250, 168, 26, 0.08);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 0.15s var(--ease);
  --t-med: 0.2s ease-in-out;

  --shadow-elev-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-elev-high: 0 8px 16px rgba(0, 0, 0, 0.24);
  --font: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Arial, sans-serif;
  --font-code: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg-tertiary);
  color: var(--text-normal);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ============================================================================
   SCROLLBARS FINAS QUE APARECEM NO HOVER
   ============================================================================ */
.custom-scroll {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s ease;
}

.custom-scroll:hover {
  scrollbar-color: #1a1b1e transparent;
}

.custom-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.3s ease;
}

.custom-scroll:hover::-webkit-scrollbar-thumb {
  background-color: #202225;
}

.messages-container.custom-scroll:hover::-webkit-scrollbar-thumb {
  background-color: #202225;
}

.messages-container.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================================
   TOOLTIPS (CSS PURO) — deslizam de baixo (data-tooltip) ou da esquerda (data-tooltip-right)
   ============================================================================ */
[data-tooltip],
[data-tooltip-right] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 6px) scale(0.96);
  background: var(--bg-floating);
  color: var(--text-header);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  padding: 7px 11px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: var(--shadow-elev-high);
  transition: opacity 0.12s var(--ease), transform 0.16s var(--ease);
  z-index: 300;
}

[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translate(-50%, 6px);
  border: 6px solid transparent;
  border-top-color: var(--bg-floating);
  border-bottom-width: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s var(--ease), transform 0.16s var(--ease);
  z-index: 300;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  transition-delay: 0.25s;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0.25s;
}

/* Tooltips que ficam muito à direita (header/input) abrem alinhados à direita */
.chat-header-right [data-tooltip]::after,
.input-right-actions [data-tooltip]::after,
.user-controls [data-tooltip]::after {
  left: auto;
  right: -6px;
  transform: translate(0, 6px) scale(0.96);
}

.chat-header-right [data-tooltip]:hover::after,
.input-right-actions [data-tooltip]:hover::after,
.user-controls [data-tooltip]:hover::after {
  transform: translate(0, 0) scale(1);
}

.chat-header-right [data-tooltip]::after {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translate(0, -6px) scale(0.96);
}

.chat-header-right [data-tooltip]::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: var(--bg-floating);
  border-top-width: 0;
  border-bottom-width: 6px;
  transform: translate(-50%, -6px);
}

.chat-header-right [data-tooltip]:hover::before {
  transform: translate(-50%, 0);
}

/* Tooltip lateral (server rail) — desliza a partir da esquerda */
[data-tooltip-right]::after {
  content: attr(data-tooltip-right);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translate(-8px, -50%) scale(0.95);
  transform-origin: left center;
  background: var(--bg-floating);
  color: var(--text-header);
  font-size: 15px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: var(--shadow-elev-high);
  transition: opacity 0.12s var(--ease), transform 0.18s var(--ease-spring);
  z-index: 300;
}

[data-tooltip-right]::before {
  content: "";
  position: absolute;
  left: calc(100% + 2px);
  top: 50%;
  transform: translate(-8px, -50%);
  border: 6px solid transparent;
  border-right-color: var(--bg-floating);
  border-left-width: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s var(--ease), transform 0.18s var(--ease-spring);
  z-index: 300;
}

[data-tooltip-right]:hover::after {
  opacity: 1;
  transform: translate(0, -50%) scale(1);
}

[data-tooltip-right]:hover::before {
  opacity: 1;
  transform: translate(0, -50%);
}

/* ============================================================================
   TELA DE AUTENTICAÇÃO
   ============================================================================ */
.auth-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(88, 101, 242, 0.35), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(235, 69, 158, 0.18), transparent 60%),
    #202225;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #32353b 0%, #2b2d31 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 28px 30px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28), 0 28px 72px rgba(0, 0, 0, 0.55);
  animation: authPop 0.35s var(--ease-spring);
}

@keyframes authPop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-logo-wrap {
  position: relative;
  flex-shrink: 0;
}

.auth-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(88, 101, 242, 0.38);
  display: block;
}

.auth-logo-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #23a55a;
  border: 3px solid #2f3136;
  box-shadow: 0 0 8px rgba(35, 165, 90, 0.65);
}

.auth-brand-text {
  flex: 1;
  min-width: 0;
}

.auth-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-brand h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-header);
}

.auth-squad-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.28), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(129, 140, 248, 0.4);
  color: #c7d2fe;
}

.auth-subtitle {
  font-size: 13px;
  line-height: 1.4;
  color: var(--interactive-normal);
  margin-top: 4px;
}

.auth-feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.auth-chip {
  font-size: 11px;
  font-weight: 600;
  color: #dcddde;
  background: rgba(30, 31, 34, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 3px 8px;
  border-radius: 6px;
}

.server-target-box {
  background: rgba(30, 31, 34, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 18px;
}

.server-target-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.server-target-header label {
  margin-bottom: 0 !important;
}

.server-presets {
  display: flex;
  gap: 6px;
}

.server-preset-chip {
  background: rgba(79, 84, 92, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--interactive-normal);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--t-fast);
}

.server-preset-chip:hover,
.server-preset-chip.active {
  background: rgba(88, 101, 242, 0.25);
  border-color: rgba(88, 101, 242, 0.65);
  color: #fff;
}

.server-target-box label,
.field label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--interactive-normal);
  margin-bottom: 8px;
}

.server-url-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.server-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.server-input-prefix {
  position: absolute;
  left: 10px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0.75;
}

.server-input-wrap input {
  padding-left: 32px !important;
  font-family: var(--font-code) !important;
  font-size: 13px !important;
}

.btn-server-connect {
  background: rgba(88, 101, 242, 0.18);
  border: 1px solid rgba(88, 101, 242, 0.55);
  color: #dee0fc;
  padding: 0 15px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}

.btn-server-connect:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.server-url-row input,
.field input,
.field select {
  width: 100%;
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-normal);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-med), box-shadow var(--t-med);
}

.server-url-row input:focus,
.field input:focus,
.field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.25);
}

.field input[type="range"] {
  padding: 0;
  accent-color: var(--brand);
  background: transparent;
  border: none;
  box-shadow: none;
}

.server-status-pill {
  margin-top: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(17, 18, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.server-status-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #faa81a;
  flex-shrink: 0;
}

.server-status-pill .status-dot.pulse {
  animation: statusPulse 1.2s infinite ease-in-out;
}

@keyframes statusPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.server-status-pill.ok {
  color: #dcddde;
  background: rgba(35, 165, 90, 0.1);
  border-color: rgba(35, 165, 90, 0.28);
}

.server-status-pill.ok .status-dot {
  background: #23a55a;
  box-shadow: 0 0 8px rgba(35, 165, 90, 0.8);
}

.server-status-pill.err {
  color: #ffb4b6;
  background: rgba(237, 66, 69, 0.1);
  border-color: rgba(237, 66, 69, 0.28);
}

.server-status-pill.err .status-dot {
  background: var(--red);
}

.server-status-pill .pill-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #b5bac1;
}

.auth-tabs {
  display: flex;
  background: var(--bg-rail);
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  padding: 9px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--t-med), color var(--t-med);
}

.auth-tab:hover {
  color: var(--interactive-hover);
}

.auth-tab.active {
  background: var(--bg-input);
  color: var(--text-white);
}

.auth-error {
  background: rgba(237, 66, 69, 0.12);
  border: 1px solid var(--red);
  color: #ffb4b6;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 14px;
  animation: shake 0.3s var(--ease);
}

@keyframes shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.field {
  margin-bottom: 16px;
}

/* ============================================================================
   BOTÕES GENÉRICOS
   ============================================================================ */
.btn-primary,
.btn-primary-sm {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 11px 18px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--t-med), transform 0.1s var(--ease);
}

.btn-primary-sm {
  padding: 7px 14px;
  font-size: 13px;
}

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

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.97);
}

.btn-secondary,
.btn-secondary-sm {
  background: #4f545c;
  color: var(--text-white);
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--t-med), transform 0.1s var(--ease);
}

.btn-secondary-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-secondary:hover,
.btn-secondary-sm:hover {
  background: #686d73;
}

.btn-secondary-sm.selected {
  background: var(--brand);
}

.btn-danger-outline {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--t-med), color var(--t-med);
}

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

.full-width {
  width: 100%;
}

/* ============================================================================
   LAYOUT 4 COLUNAS
   ============================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 72px 240px 1fr 240px;
  height: 100vh;
  width: 100vw;
  animation: fadeIn 0.3s var(--ease);
}

.app-shell.members-hidden {
  grid-template-columns: 72px 240px 1fr 0;
}

.app-shell.members-hidden .sidebar-members {
  opacity: 0;
  pointer-events: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================================================
   1. SERVER RAIL (#202225)
   ============================================================================ */
.server-rail {
  background: var(--bg-rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  z-index: 20;
}

.rail-item {
  position: relative;
  width: 72px;
  display: flex;
  justify-content: center;
  cursor: pointer;
}

.rail-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-chat);
  color: var(--text-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  overflow: hidden;
  transition:
    border-radius 0.2s var(--ease),
    background-color 0.2s var(--ease),
    color 0.2s var(--ease),
    transform 0.2s var(--ease-spring);
}

.rail-item:hover .rail-icon {
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  transform: scale(1.05);
}

.rail-item:active .rail-icon {
  transform: scale(0.96) translateY(1px);
}

.rail-item.active .rail-icon {
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
}

.rail-icon.brand-gradient {
  background: linear-gradient(135deg, #5865f2, #3b44b8);
}

.rail-svg-logo {
  width: 100%;
  height: 100%;
}

/* Pílula branca indicadora à esquerda */
.rail-pill {
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 8px;
  margin-top: -4px;
  background: #fff;
  border-radius: 0 4px 4px 0;
  transform: scaleY(0) translateX(-4px);
  opacity: 0;
  transition: transform 0.2s var(--ease), height 0.2s var(--ease), margin-top 0.2s var(--ease), opacity 0.2s var(--ease);
}

.rail-item:hover .rail-pill {
  opacity: 1;
  height: 20px;
  margin-top: -10px;
  transform: scaleY(1) translateX(0);
}

.rail-item.active .rail-pill {
  opacity: 1;
  height: 40px;
  margin-top: -20px;
  transform: scaleY(1) translateX(0);
}

.rail-item.has-unread:not(.active) .rail-pill {
  opacity: 1;
  transform: scaleY(1) translateX(0);
}

/* Botões verdes (adicionar/explorar) */
.rail-action-green .rail-icon {
  color: var(--green-bright);
  font-size: 26px;
  font-weight: 400;
}

.rail-action-green:hover .rail-icon {
  background: var(--green-bright);
  color: #fff;
}

.rail-separator {
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: rgba(79, 84, 92, 0.48);
  margin: 2px 0;
}

.rail-spacer {
  flex: 1;
}

/* ============================================================================
   2. SIDEBAR DE CANAIS (#2f3136)
   ============================================================================ */
.sidebar-channels {
  position: relative;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-top-left-radius: 8px;
  z-index: 10;
}

.server-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-elev-low);
  cursor: pointer;
  flex-shrink: 0;
  z-index: 3;
  transition: background-color var(--t-fast);
}

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

.server-title-group {
  overflow: hidden;
}

.server-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-header);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.server-chevron-btn {
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--t-fast), transform 0.2s var(--ease);
}

.server-header:hover .server-chevron-btn {
  color: var(--text-white);
}

.channels-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px 8px;
}

.channel-category {
  margin-top: 16px;
}

.channel-category:first-child {
  margin-top: 8px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 4px 0;
  height: 24px;
}

.category-title-left {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text-channel);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  flex: 1;
  transition: color var(--t-fast);
}

.category-title-left:hover {
  color: var(--interactive-hover);
}

.cat-arrow {
  transition: transform 0.2s var(--ease);
  flex-shrink: 0;
}

.channel-category.collapsed .cat-arrow {
  transform: rotate(-90deg);
}

/* Quando colapsado, mostra apenas o canal ativo (comportamento Discord) */
.channel-category.collapsed .channel-item:not(.active):not(.voice-joined),
.channel-category.collapsed .voice-room-members {
  display: none;
}

.cat-add-btn {
  background: transparent;
  border: none;
  color: var(--text-channel);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--t-fast);
}

.cat-add-btn:hover {
  color: var(--interactive-hover);
}

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

.channel-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px;
  border-radius: 4px;
  color: var(--text-channel);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color var(--t-fast), color var(--t-fast);
}

.channel-item .ch-icon {
  color: var(--text-muted);
  font-size: 20px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-weight: 400;
  transition: color var(--t-fast);
}

.channel-item .ch-icon svg {
  display: block;
}

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

.channel-item .ch-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 1px 6px;
  border-radius: 8px;
}

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

.channel-item:hover .ch-icon {
  color: var(--interactive-hover);
}

.channel-item.active {
  background: var(--bg-modifier-selected);
  color: var(--text-white);
  font-weight: 600;
}

.channel-item.active .ch-icon {
  color: var(--text-white);
}

/* Canal não lido: texto branco com brilho suave + pílula à esquerda */
.channel-item.unread {
  color: var(--text-white);
  font-weight: 600;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
  animation: unreadGlow 2.4s ease-in-out infinite;
}

.channel-item.unread::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 8px;
  margin-top: -4px;
  background: #fff;
  border-radius: 0 4px 4px 0;
}

@keyframes unreadGlow {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 255, 255, 0.2); }
  50% { text-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }
}

/* Membros conectados dentro da sala de voz na sidebar */
.voice-room-members {
  padding: 2px 0 6px 30px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.voice-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-channel);
  cursor: default;
  transition: background-color var(--t-fast), color var(--t-fast);
}

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

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

.voice-member-left span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-member-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.avatar-xs {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  transition: box-shadow 0.12s var(--ease);
}

.avatar-xs.speaking {
  box-shadow: 0 0 0 2px var(--bg-sidebar), 0 0 0 4px var(--green-bright);
}

.badge-live {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

/* ============================================================================
   BARRA DE STATUS DE CONEXÃO / VOZ & POPOVER DE PING (ESTILO DISCORD)
   ============================================================================ */
.voice-connected-bar {
  background: #232428;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(0, 0, 0, 0.28);
  padding: 7px 8px;
  flex-shrink: 0;
  transition: background-color var(--t-fast);
}

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

.voice-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.voice-stage-actions {
  margin-top: 7px;
}

.voice-status-info {
  overflow: hidden;
  cursor: pointer;
  padding: 3px 6px;
  margin: -3px -6px;
  border-radius: 4px;
  flex: 1;
  min-width: 0;
  transition: background-color var(--t-fast);
}

.voice-status-info:hover {
  background: var(--bg-modifier-hover);
}

.voice-signal-ok {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green-bright);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.voice-signal-ok.signal-good {
  color: var(--green-bright);
}

.voice-signal-ok.signal-warn {
  color: var(--idle);
}

.voice-signal-ok.signal-bad {
  color: var(--red);
}

/* Ícone de 3 Barras de Sinal do Discord */
.signal-bars-svg {
  flex-shrink: 0;
  display: block;
}

.signal-bars-svg .sig-bar {
  fill: rgba(185, 187, 190, 0.25);
  transition: fill 0.2s var(--ease);
}

.signal-bars-svg.signal-good .sig-bar.b1,
.signal-bars-svg.signal-good .sig-bar.b2,
.signal-bars-svg.signal-good .sig-bar.b3 {
  fill: var(--green-bright);
}

.signal-bars-svg.signal-warn .sig-bar.b1,
.signal-bars-svg.signal-warn .sig-bar.b2 {
  fill: var(--idle);
}

.signal-bars-svg.signal-bad .sig-bar.b1 {
  fill: var(--red);
}

.ping-badge {
  margin-left: auto;
  color: #57f287;
  background: rgba(35, 165, 90, 0.14);
  border: 1px solid rgba(35, 165, 90, 0.32);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-code);
  letter-spacing: -0.02em;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}

.ping-badge.signal-warn {
  color: var(--idle);
  background: rgba(250, 168, 26, 0.14);
  border-color: rgba(250, 168, 26, 0.35);
}

.ping-badge.signal-bad {
  color: var(--red);
  background: rgba(237, 66, 69, 0.14);
  border-color: rgba(237, 66, 69, 0.35);
}

/* Popover de Informações da Conexão (Gráfico Sparkline + Métricas de Ping) */
.connection-info-popover {
  position: absolute;
  left: 8px;
  width: 264px;
  bottom: 106px;
  background: var(--bg-floating);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow-elev-high);
  z-index: 60;
  animation: slideUp 0.18s var(--ease);
}

.conn-pop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(79, 84, 92, 0.35);
}

.conn-pop-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.conn-pop-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-header);
  line-height: 1.2;
}

.conn-pop-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.conn-quality-pill {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(35, 165, 90, 0.18);
  color: #57f287;
  flex-shrink: 0;
}

.conn-quality-pill.warn {
  background: rgba(250, 168, 26, 0.18);
  color: var(--idle);
}

.conn-quality-pill.bad {
  background: rgba(237, 66, 69, 0.18);
  color: var(--red);
}

.conn-sparkline-box {
  margin-top: 10px;
  background: #111214;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 8px 8px 4px;
}

.conn-sparkline-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ping-sparkline-svg {
  width: 100%;
  height: 46px;
  display: block;
}

.conn-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.conn-metric-card {
  background: #232428;
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conn-metric-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.conn-metric-value {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-code);
  color: var(--text-header);
}

.conn-pop-footer {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(79, 84, 92, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-code);
}

.conn-pop-dot {
  opacity: 0.5;
}

.voice-room-sub {
  font-size: 12px;
  color: var(--interactive-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.btn-disconnect-icon {
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.btn-disconnect-icon:hover {
  background: var(--bg-modifier-hover);
  color: var(--red);
}

.btn-screen-share {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-input);
  color: var(--text-normal);
  border: none;
  padding: 7px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-med), color var(--t-med);
}

.btn-screen-share:hover {
  background: #4f545c;
  color: var(--text-white);
}

.btn-screen-share.active {
  background: var(--red);
  color: #fff;
}

/* ============================================================================
   4. PAINEL DO USUÁRIO (#292b2f)
   ============================================================================ */
.user-panel {
  height: 52px;
  background: var(--bg-user-panel);
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 4px 4px 4px 2px;
  margin-right: 4px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 0;
  flex: 1;
  transition: background var(--t-fast);
}

.user-info:hover {
  background: var(--bg-modifier-hover);
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

/* Bolinha de status sobreposta no canto inferior direito com "recorte" */
.avatar-status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--bg-user-panel);
  background: var(--green-bright);
  transition: background-color var(--t-med);
}

.avatar-status-dot.online { background: var(--green-bright); }
.avatar-status-dot.idle { background: var(--idle); }
.avatar-status-dot.dnd { background: var(--dnd); }
.avatar-status-dot.offline { background: var(--offline); }

.sidebar-members .avatar-status-dot {
  border-color: var(--bg-sidebar);
}

.member-row:hover .avatar-status-dot {
  border-color: #393c43;
}

.user-names {
  overflow: hidden;
  min-width: 0;
  line-height: 1.2;
}

.me-display {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-header);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.me-handle {
  font-size: 12px;
  color: var(--interactive-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-controls {
  display: flex;
  flex-shrink: 0;
}

.control-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.85;
  transition: background var(--t-fast), color var(--t-fast), opacity var(--t-fast);
}

.control-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--interactive-hover);
  opacity: 1;
}

.control-btn.active-danger {
  color: var(--red);
  opacity: 1;
  /* Risco diagonal vermelho (via background para não conflitar com o ::before do tooltip) */
  background-image: linear-gradient(
    to top right,
    transparent calc(50% - 1.5px),
    var(--red) calc(50% - 1.5px),
    var(--red) calc(50% + 1.5px),
    transparent calc(50% + 1.5px)
  );
  background-size: 22px 22px;
  background-position: center;
  background-repeat: no-repeat;
}

.server-header.open .server-chevron-btn {
  transform: rotate(180deg);
  color: var(--text-white);
}

/* ============================================================================
   3. ÁREA PRINCIPAL DE CHAT (#36393f)
   ============================================================================ */
.main-content {
  position: relative;
  background: var(--bg-chat);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

.chat-header {
  height: 48px;
  padding: 0 8px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: var(--shadow-elev-low);
  z-index: 4;
  gap: 12px;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.channel-hash {
  font-size: 24px;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1;
}

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

.header-divider {
  width: 1px;
  height: 24px;
  background: rgba(79, 84, 92, 0.48);
  margin: 0 4px;
  flex-shrink: 0;
}

.topic-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topic-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--interactive-normal);
  background: rgba(32, 34, 37, 0.6);
  border: 1px solid transparent;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.topic-pill:hover {
  background: var(--bg-rail);
  color: var(--text-white);
}

.ping-pill {
  cursor: pointer;
  font-family: var(--font-code);
  color: #57f287;
  border-color: rgba(35, 165, 90, 0.28);
}

.ping-pill.signal-warn {
  color: var(--idle);
  border-color: rgba(250, 168, 26, 0.32);
}

.ping-pill.signal-bad {
  color: var(--red);
  border-color: rgba(237, 66, 69, 0.35);
}

.wasm-pill {
  color: #57f287;
}

.runtime-pill {
  color: #a8b1ff;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-action-btn {
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: color var(--t-fast), transform 0.1s var(--ease);
}

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

.header-action-btn.active {
  color: var(--text-white);
}

.header-action-btn:active {
  transform: scale(0.92);
}

.header-search-box {
  position: relative;
  margin-left: 6px;
}

.header-search-box input {
  width: 144px;
  height: 24px;
  background: var(--bg-rail);
  border: none;
  border-radius: 4px;
  color: var(--text-normal);
  padding: 0 26px 0 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: width 0.25s var(--ease);
}

.header-search-box input:focus {
  width: 240px;
}

.header-search-box input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Popover de mensagens fixadas */
.pinned-popover {
  position: absolute;
  top: 52px;
  right: 120px;
  width: 380px;
  max-height: 420px;
  background: var(--bg-sidebar);
  border-radius: 8px;
  box-shadow: var(--shadow-elev-high), 0 0 0 1px rgba(4, 4, 5, 0.15);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.18s var(--ease-spring);
  transform-origin: top right;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.pinned-popover-header {
  background: var(--bg-rail);
  padding: 14px 16px;
  font-weight: 700;
  color: var(--text-header);
  font-size: 15px;
}

.pinned-messages-list {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pinned-item {
  background: var(--bg-chat);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  user-select: text;
}

.pinned-item-author {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 3px;
}

.pinned-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 12px;
}

/* ============================================================================
   PALCO DE VOZ & TELA
   ============================================================================ */
.live-voice-stage {
  background: #0b0c0e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  animation: slideDown 0.25s var(--ease);
}

.live-voice-stage.has-stream.theater-mode {
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
}

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

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.stage-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-header);
  min-width: 0;
}

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

.stage-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stream-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.screen-video-wrapper {
  position: relative;
  width: 100%;
  height: 46vh;
  max-height: 46vh;
  flex-shrink: 0;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.45);
}

.screen-video-wrapper video,
.screen-video-wrapper .screen-share-canvas-img {
  width: 100%;
  height: 46vh;
  max-height: 46vh;
  object-fit: contain;
  display: block;
  background: #000;
}

.screen-video-wrapper video.hidden,
.screen-video-wrapper .screen-share-canvas-img.hidden {
  display: none !important;
}

.live-voice-stage.has-stream.theater-mode .screen-video-wrapper,
.live-voice-stage.has-stream.theater-mode .screen-video-wrapper video,
.live-voice-stage.has-stream.theater-mode .screen-video-wrapper .screen-share-canvas-img {
  height: calc(100vh - 150px);
  max-height: calc(100vh - 150px);
}

.screen-video-wrapper:fullscreen,
.screen-video-wrapper:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}

.screen-video-wrapper:fullscreen video,
.screen-video-wrapper:-webkit-full-screen video,
.screen-video-wrapper:fullscreen .screen-share-canvas-img,
.screen-video-wrapper:-webkit-full-screen .screen-share-canvas-img {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  object-fit: contain;
}

.screen-video-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(237, 66, 69, 0.92);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.voice-participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

/* Quando há transmissão de tela ativa, os participantes ficam em uma barra compacta
   horizontal para dar 90% da área vertical ao monitor 16:9 sem cortar o vídeo */
.live-voice-stage.has-stream .voice-participants-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stage-tile {
  background: #1e1f22;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: box-shadow 0.15s var(--ease), transform 0.2s var(--ease);
}

.live-voice-stage.has-stream .stage-tile {
  flex-direction: row;
  padding: 6px 12px;
  gap: 8px;
  border-radius: 999px;
}

.stage-tile:hover {
  transform: translateY(-1px);
}

.stage-tile.speaking {
  box-shadow: inset 0 0 0 2px var(--green-bright), 0 0 14px rgba(35, 165, 90, 0.35);
}

.stage-tile.is-streaming {
  cursor: pointer;
  border-color: rgba(237, 66, 69, 0.45);
}

.stage-tile.is-streaming:hover {
  background: #26282d;
  border-color: rgba(237, 66, 69, 0.85);
  box-shadow: 0 0 12px rgba(237, 66, 69, 0.25);
}

.stage-tile.watching-stream {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1.5px var(--brand), 0 0 12px rgba(88, 101, 242, 0.3);
}

.voice-member-row.is-streaming {
  cursor: pointer;
}

.voice-member-row.is-streaming .badge-live:hover {
  filter: brightness(1.15);
  transform: scale(1.04);
}

.stage-tile .avatar-circle {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.live-voice-stage.has-stream .stage-tile .avatar-circle {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.stage-tile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-header);
}

.live-voice-stage.has-stream .stage-tile-name {
  font-size: 13px;
}

.stage-tile-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================================
   FEED DE MENSAGENS
   ============================================================================ */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0 8px;
  display: flex;
  flex-direction: column;
  user-select: text;
}

/* Impede que as mensagens encolham/sobreponham dentro do container rolável */
.messages-container > * {
  flex-shrink: 0;
}

/* Empurra o conteúdo para baixo quando há poucas mensagens (comportamento Discord) */
.messages-container > .channel-welcome {
  margin-top: auto;
}

/* Boas-vindas do canal (topo) */
.channel-welcome {
  padding: 16px 16px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(79, 84, 92, 0.48);
}

.welcome-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #4f545c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #fff;
  margin-bottom: 8px;
}

.channel-welcome h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-header);
  margin: 8px 0;
}

.channel-welcome p {
  color: var(--interactive-normal);
  font-size: 15px;
}

/* Linha de mensagem */
.msg-row {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 2px 48px 2px 16px;
  margin-top: 17px;
  min-height: 44px;
  transition: background-color 0.08s linear;
}

.msg-row.grouped {
  margin-top: 0;
  min-height: 0;
  padding-top: 1px;
  padding-bottom: 1px;
}

.msg-row:hover {
  background: rgba(4, 4, 5, 0.07);
}

.msg-row.mention {
  background: var(--mention-bg);
  box-shadow: inset 2px 0 0 var(--idle);
}

.msg-row.search-hidden {
  display: none;
}

.msg-row .avatar-circle {
  width: 40px;
  height: 40px;
  font-size: 16px;
  margin-top: 2px;
  cursor: pointer;
  transition: transform 0.1s var(--ease), box-shadow 0.15s var(--ease);
}

.msg-row .avatar-circle:active {
  transform: translateY(1px);
}

.msg-gutter-time {
  width: 40px;
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 22px;
  opacity: 0;
  transition: opacity 0.08s linear;
}

.msg-row.grouped:hover .msg-gutter-time {
  opacity: 1;
}

.msg-body {
  flex: 1;
  min-width: 0;
}

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 22px;
}

.msg-author {
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
}

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

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

.msg-text {
  font-size: 16px;
  line-height: 1.375;
  color: var(--text-normal);
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg-text a {
  color: #00aff4;
  text-decoration: none;
}

.msg-text a:hover {
  text-decoration: underline;
}

.msg-text strong {
  color: var(--text-white);
}

.msg-text .inline-code {
  background: #2f3136;
  border-radius: 3px;
  padding: 0 4px;
  font-family: var(--font-code);
  font-size: 85%;
  white-space: pre-wrap;
}

.msg-text .mention-pill {
  background: rgba(88, 101, 242, 0.3);
  color: #dee0fc;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 500;
}

/* Blocos de código com destaque de sintaxe */
.code-block {
  position: relative;
  background: #2f3136;
  border: 1px solid #202225;
  border-radius: 4px;
  margin-top: 6px;
  max-width: 90%;
  overflow: hidden;
  white-space: normal;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(32, 34, 37, 0.6);
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-code);
  text-transform: lowercase;
}

.code-copy-btn {
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.code-block:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-white);
}

.code-block pre {
  margin: 0;
  padding: 10px 12px;
  overflow-x: auto;
  font-family: var(--font-code);
  font-size: 14px;
  line-height: 1.45;
  color: #b9bbbe;
  white-space: pre;
}

.tok-kw { color: #ff7b72; font-weight: 600; }
.tok-str { color: #a5d6ff; }
.tok-num { color: #79c0ff; }
.tok-com { color: #8b949e; font-style: italic; }
.tok-fn { color: #d2a8ff; }
.tok-type { color: #ffa657; }
.tok-mac { color: #7ee787; }

/* Embeds ricos (links, YouTube, GIF) */
.rich-embed {
  margin-top: 6px;
  max-width: 432px;
  background: #2f3136;
  border-left: 4px solid var(--brand);
  border-radius: 4px;
  padding: 10px 14px 14px 12px;
  white-space: normal;
}

.embed-provider {
  font-size: 12px;
  color: var(--interactive-normal);
  margin-bottom: 4px;
}

.embed-title {
  font-size: 15px;
  font-weight: 600;
  color: #00aff4;
  margin-bottom: 8px;
  text-decoration: none;
  display: block;
  word-break: break-all;
}

.embed-title:hover {
  text-decoration: underline;
}

.embed-media {
  border-radius: 4px;
  overflow: hidden;
  background: #000;
}

.embed-media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
}

/* Mídia inline com cantos arredondados */
.msg-attachment-img {
  display: block;
  max-width: min(420px, 100%);
  max-height: 320px;
  border-radius: 8px;
  margin-top: 6px;
  cursor: zoom-in;
  object-fit: cover;
  transition: filter var(--t-fast), transform 0.2s var(--ease);
}

.msg-attachment-img:hover {
  filter: brightness(1.06);
}

.msg-attachment-video {
  display: block;
  max-width: min(480px, 100%);
  max-height: 320px;
  border-radius: 8px;
  margin-top: 6px;
  background: #000;
}

.msg-attachment-file {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  margin-top: 6px;
  background: #2f3136;
  border: 1px solid #292b2f;
  border-radius: 6px;
  padding: 12px 14px;
  white-space: normal;
  transition: border-color var(--t-fast);
}

.msg-attachment-file:hover {
  border-color: #202225;
}

.file-icon-box {
  font-size: 28px;
}

.file-meta a {
  color: #00aff4;
  font-weight: 500;
  text-decoration: none;
  word-break: break-all;
}

.file-meta a:hover {
  text-decoration: underline;
}

.file-meta small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* Barra de reações */
.reactions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2f3136;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 14px;
  color: var(--interactive-normal);
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), transform 0.12s var(--ease-spring);
}

.reaction-chip:hover {
  background: #36393f;
  border-color: #4f545c;
}

.reaction-chip:active {
  transform: scale(0.92);
}

.reaction-chip.mine {
  background: rgba(88, 101, 242, 0.15);
  border-color: var(--brand);
  color: #dee0fc;
}

.reaction-chip .r-count {
  font-size: 13px;
  font-weight: 600;
}

.reaction-chip.pop {
  animation: reactionPop 0.3s var(--ease-spring);
}

@keyframes reactionPop {
  50% { transform: scale(1.25); }
}

/* Barra de ações flutuante no hover da mensagem */
.msg-hover-actions {
  position: absolute;
  top: -16px;
  right: 16px;
  display: flex;
  background: var(--bg-chat);
  border: 1px solid rgba(4, 4, 5, 0.15);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(4, 4, 5, 0.08), 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.12s var(--ease), transform 0.15s var(--ease);
  z-index: 5;
  user-select: none;
}

.msg-row:hover .msg-hover-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.hover-action-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--interactive-normal);
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--t-fast), transform 0.12s var(--ease-spring), color var(--t-fast);
}

.hover-action-btn:hover {
  background: var(--bg-modifier-hover);
  color: var(--text-white);
  transform: scale(1.15);
}

.hover-action-sep {
  width: 1px;
  background: rgba(79, 84, 92, 0.48);
  margin: 6px 2px;
}

/* Indicador de digitação */
.typing-indicator {
  height: 24px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-normal);
  flex-shrink: 0;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-normal);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* ============================================================================
   CAIXA DE ENTRADA
   ============================================================================ */
.attachment-staging-bar {
  margin: 0 16px;
  background: var(--bg-sidebar);
  border-radius: 8px 8px 0 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideUp 0.18s var(--ease);
}

.staging-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-normal);
}

.chat-input-wrapper {
  padding: 0 16px 24px;
  flex-shrink: 0;
}

.discord-input-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-radius: 8px;
  padding: 0 6px 0 16px;
  min-height: 44px;
  transition: box-shadow var(--t-med);
}

.attachment-staging-bar:not(.hidden) + .typing-indicator + .emoji-picker-popover + .chat-input-wrapper .discord-input-box {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.discord-input-box:focus-within {
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.35);
}

.attach-circle-btn {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #b9bbbe;
  color: var(--bg-input);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 14px;
  transition: background var(--t-med), transform 0.2s var(--ease-spring);
}

.attach-circle-btn:hover {
  background: var(--text-white);
  transform: rotate(90deg);
}

.attach-circle-btn::after {
  transform: translate(-25%, 6px) scale(0.96) !important;
  left: 0 !important;
}

.attach-circle-btn:hover::after {
  transform: translate(-25%, 0) scale(1) !important;
}

.discord-input-box input,
.discord-input-box textarea {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-normal);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.375;
  padding: 11px 0;
  outline: none;
  resize: none;
  max-height: 40vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.discord-input-box input::placeholder,
.discord-input-box textarea::placeholder {
  color: #72767d;
}

.discord-input-box {
  align-items: flex-end;
}

.discord-input-box .attach-circle-btn {
  margin-bottom: 10px;
}

.discord-input-box .input-right-actions {
  margin-bottom: 6px;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(88, 101, 242, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  z-index: 80;
  pointer-events: none;
  animation: fadeIn 0.15s var(--ease);
}

.input-right-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}

.input-icon-btn {
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  height: 32px;
  min-width: 32px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  transition: color var(--t-fast), transform 0.15s var(--ease-spring);
}

.input-icon-btn code {
  font-family: var(--font-code);
  font-size: 13px;
}

.input-icon-btn:hover {
  color: var(--interactive-hover);
  transform: scale(1.12);
}

.gif-pill-btn {
  font-size: 11px;
  letter-spacing: 0.02em;
}

.gif-pill-btn:hover {
  color: var(--text-white);
}

#btn-emoji-picker:hover {
  color: #faa61a;
  transform: scale(1.15) rotate(-8deg);
}

.btn-send-discord {
  position: relative;
  background: var(--brand);
  border: none;
  color: #fff;
  width: 34px;
  height: 32px;
  border-radius: 6px;
  margin-left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-med), transform 0.12s var(--ease);
}

.btn-send-discord:hover {
  background: var(--brand-hover);
}

.btn-send-discord:active {
  transform: scale(0.92);
}

/* Popover de emojis */
.emoji-picker-popover {
  position: absolute;
  right: 24px;
  bottom: 80px;
  display: grid;
  grid-template-columns: repeat(6, 40px);
  gap: 4px;
  padding: 10px;
  background: var(--bg-sidebar);
  border-radius: 8px;
  box-shadow: var(--shadow-elev-high), 0 0 0 1px rgba(4, 4, 5, 0.15);
  z-index: 60;
  animation: popInUp 0.18s var(--ease-spring);
  transform-origin: bottom right;
}

@keyframes popInUp {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.emoji-pick-item {
  width: 40px;
  height: 40px;
  font-size: 24px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--t-fast), transform 0.15s var(--ease-spring);
}

.emoji-pick-item:hover {
  background: var(--bg-modifier-hover);
  transform: scale(1.18);
}

/* ============================================================================
   5. LISTA DE MEMBROS (#2f3136)
   ============================================================================ */
.sidebar-members {
  background: var(--bg-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
  transition: opacity 0.2s var(--ease);
}

.members-list {
  padding: 0 8px 20px;
}

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

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--t-fast), opacity var(--t-fast);
  animation: fadeIn 0.25s var(--ease);
}

.member-row:hover {
  background: #393c43;
}

.member-row.offline {
  opacity: 0.35;
}

.member-row.offline:hover {
  opacity: 1;
}

.member-row .avatar-circle {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.member-text {
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.member-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-activity {
  font-size: 12px;
  color: var(--interactive-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.member-activity strong {
  font-weight: 600;
}

.member-role-crown {
  color: var(--idle);
  font-size: 12px;
  margin-left: 4px;
}

/* ============================================================================
   MODAIS
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  animation: fadeIn 0.15s var(--ease);
}

.modal-card {
  background: var(--bg-chat);
  border-radius: 8px;
  padding: 22px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-elev-high);
  animation: authPop 0.25s var(--ease-spring);
}

.modal-card-lg {
  max-width: 560px;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

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

.modal-subtext {
  color: var(--interactive-normal);
  font-size: 13px;
  margin-bottom: 18px;
}

.icon-close-btn {
  background: transparent;
  border: none;
  color: var(--interactive-normal);
  font-size: 18px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  transition: color var(--t-fast), background var(--t-fast), transform 0.2s var(--ease);
}

.icon-close-btn:hover {
  color: var(--text-white);
  background: var(--bg-modifier-hover);
  transform: rotate(90deg);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(79, 84, 92, 0.3);
}

.settings-info-box {
  background: var(--bg-sidebar);
  border-radius: 6px;
  padding: 12px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: text;
}

.settings-info-box code {
  background: var(--bg-rail);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-code);
}

.sfx-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.sfx-preview-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: var(--interactive-normal);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform 0.1s ease;
}

.sfx-preview-btn:hover {
  background: rgba(88, 101, 242, 0.18);
  border-color: rgba(88, 101, 242, 0.45);
  color: #fff;
}

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

/* Medidor de Microfone em Tempo Real & Loopback Test */
.sr-audio-bucket {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.mic-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mic-select-row select {
  flex: 1;
  min-width: 0;
}

.btn-mic-loopback {
  background: rgba(35, 165, 90, 0.14);
  border: 1px solid rgba(35, 165, 90, 0.42);
  color: #46d17a;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 13px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}

.btn-mic-loopback:hover {
  background: rgba(35, 165, 90, 0.26);
  color: #fff;
}

.btn-mic-loopback.active,
#btn-mic-loopback.active {
  background: var(--green-bright);
  border-color: var(--green-bright);
  color: #fff;
  box-shadow: 0 0 12px rgba(35, 165, 90, 0.45);
}

.mic-meter-box {
  margin-top: 9px;
  background: var(--bg-sidebar);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 9px 11px;
}

.mic-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--interactive-normal);
  margin-bottom: 6px;
  font-weight: 600;
}

.mic-meter-header .speaking-ok {
  color: #46d17a;
}

.mic-meter-track {
  position: relative;
  height: 10px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  overflow: hidden;
}

.mic-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #23a55a 0%, #46d17a 70%, #faa81a 100%);
  transition: width 45ms linear;
}

.mic-meter-threshold {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 15%;
  width: 2px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.stage-mic-meter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  height: 28px;
}

.stage-mic-icon {
  font-size: 13px;
  line-height: 1;
}

.stage-mic-bar-track {
  width: 56px;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.stage-mic-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #23a55a, #46d17a);
  transition: width 45ms linear;
}

/* Lightbox */
.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 92vw;
  max-height: 92vh;
  animation: authPop 0.25s var(--ease-spring);
}

.lightbox-content img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 6px;
  box-shadow: var(--shadow-elev-high);
}

.lightbox-actions {
  display: flex;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-floating);
  color: var(--text-header);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-elev-high);
  opacity: 0;
  z-index: 400;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease-spring);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================================
   RESPONSIVO
   ============================================================================ */
@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 72px 220px 1fr 0;
  }
  .sidebar-members {
    display: none;
  }
  .topic-badges {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 0 200px 1fr 0;
  }
  .server-rail {
    display: none;
  }
  .header-search-box {
    display: none;
  }
}

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