* { box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
  --bg: #0a0b0f;
  --bg-elevated: #101218;
  --panel: #14161e;
  --panel-alt: #1b1e29;
  --panel-hover: #22263380;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f6;
  --muted: #8d92a3;
  --accent: #7c5cff;
  --accent-2: #a78bfa;
  --accent-pink: #ff6bb3;
  --danger: #ff5c72;
  --success: #34d399;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-pink));
}

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  isolation: isolate;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px circle at 12% -5%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(600px circle at 100% 10%, rgba(255, 107, 179, 0.12), transparent 55%),
    radial-gradient(800px circle at 50% 120%, rgba(34, 211, 238, 0.08), transparent 60%);
  pointer-events: none;
}

* { scrollbar-color: rgba(255, 255, 255, 0.18) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }
*::-webkit-scrollbar-track { background: transparent; }

h1 { margin: 0 0 4px; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 26px 0 12px; letter-spacing: -0.01em; }
h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }

.muted { color: var(--muted); font-size: 0.9rem; }
.small { font-size: 0.8rem; }

button {
  background: var(--gradient-accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}
button:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(124, 92, 255, 0.28); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

.ghost-btn, .decline-btn {
  background: var(--panel-alt);
  color: var(--text);
  box-shadow: none;
}
.ghost-btn:hover, .decline-btn:hover { background: var(--panel-hover); filter: none; box-shadow: none; }

.danger-btn { background: linear-gradient(135deg, var(--danger), #ff8a5c); }

input[type='text'],
input[type='password'],
textarea {
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type='text']:focus,
input[type='password']:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ---- Centered card pages (login) ---- */

.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: min(440px, 92vw);
  padding: 32px;
  background: linear-gradient(180deg, var(--panel), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-ring {
  width: 20px;
  height: 20px;
  border: 3px solid transparent;
  border-radius: 50%;
  background: var(--gradient-accent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}

.auth-tagline { margin: 6px 0 0; }
.auth-card { margin-top: 0; }
.auth-tabs { display: flex; gap: 6px; margin: 22px 0 18px; background: var(--panel-alt); padding: 4px; border-radius: var(--radius-sm); }
.auth-tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.auth-tab:hover { filter: none; transform: none; box-shadow: none; background: rgba(255, 255, 255, 0.04); }
.auth-tab.active { background: var(--gradient-accent); color: white; }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.83rem; color: var(--muted); font-weight: 500; }
.error-text { color: var(--danger); margin-top: 14px; font-size: 0.88rem; }

.divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 16px; color: var(--muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: white;
  color: #3c4043;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.google-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ---- App shell: rail + main ---- */

.app-shell { display: flex; height: 100vh; overflow: hidden; }

.community-rail {
  width: 76px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  overflow-y: auto;
}

.rail-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  margin-bottom: 4px;
}
.rail-logo:hover { filter: none; transform: none; box-shadow: none; background: var(--panel-hover); }

.rail-list { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; overflow-y: auto; width: 100%; }

.rail-icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: white;
  padding: 0;
  box-shadow: none;
  position: relative;
  transition: border-radius 0.18s ease, transform 0.15s ease;
}
.rail-icon:hover { border-radius: var(--radius-md); filter: none; transform: none; box-shadow: none; }
.rail-icon.active { border-radius: var(--radius-md); box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--accent); }
.rail-add { background: var(--panel-alt); color: var(--muted); font-size: 1.2rem; }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---- Top bar / nav ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 18, 24, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.top-nav { display: flex; gap: 26px; }
.nav-link {
  background: none;
  color: var(--muted);
  padding: 6px 2px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: none;
  position: relative;
  border-radius: 0;
}
.nav-link:hover { background: none; color: var(--text); filter: none; transform: none; box-shadow: none; }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: 2px;
}
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--gradient-accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  vertical-align: middle;
}

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.icon-btn {
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  box-shadow: none;
}
.icon-btn:hover { background: var(--panel-alt); color: var(--text); filter: none; transform: none; box-shadow: none; }

.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  position: relative;
}
#self-avatar { cursor: pointer; }
.avatar-xs { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-more { background: var(--panel-alt) !important; color: var(--muted) !important; font-size: 0.65rem; }
.avatar-sm { width: 36px; height: 36px; font-size: 0.8rem; }
.avatar-lg { width: 76px; height: 76px; font-size: 1.5rem; }

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

main#views { flex: 1; padding: 28px 36px 60px; max-width: 1240px; margin: 0 auto; width: 100%; overflow-y: auto; }

.view { animation: fade-in 0.2s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-md);
}
.inline-form input { flex: 1; min-width: 160px; }

.checkbox-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.85rem; }
.checkbox-label input { width: auto; accent-color: var(--accent); }

/* ---- Comunidades ---- */

.communities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 8px;
}

.community-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.community-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.community-banner { height: 96px; }
.community-body { padding: 18px; display: flex; flex-direction: column; gap: 7px; }
.community-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.enter-btn { margin-top: 8px; width: 100%; }

.invite-panel { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.invite-panel .link-row { display: flex; gap: 6px; }
.invite-panel .link-row input { flex: 1; min-width: 0; font-size: 0.78rem; }
.invite-panel form { display: flex; gap: 6px; }
.invite-panel form input { flex: 1; min-width: 0; }

.invites-section { margin-bottom: 24px; }
.invites-list { display: flex; flex-direction: column; gap: 10px; }
.invite-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}
.invite-row p { margin: 0; }
.invite-actions { display: flex; gap: 8px; flex-shrink: 0; }

.empty-state {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ---- Conversas (channels) ---- */

.conversas-shell {
  display: flex;
  gap: 20px;
  height: calc(100vh - 170px);
  min-height: 0;
}

.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-pink);
  margin-left: 7px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Channel sidebar */

.channel-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.channel-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.channel-sidebar-header h3 { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.channel-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.channel-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.channel-add-btn {
  background: none;
  color: var(--muted);
  box-shadow: none;
  padding: 0 6px;
  font-size: 0.95rem;
  line-height: 1;
}
.channel-add-btn:hover { background: none; filter: none; transform: none; box-shadow: none; color: var(--text); }

.channel-list { display: flex; flex-direction: column; gap: 2px; }
.channel-row { position: relative; border-radius: var(--radius-sm); }
.channel-row:hover { background: var(--panel-hover); }
.channel-row.active { background: var(--panel-alt); }
.channel-row.active .channel-row-name { color: var(--text); }

.channel-row-main {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  box-shadow: none;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  text-align: left;
}
.channel-row-main:hover { background: none; filter: none; transform: none; box-shadow: none; }
.channel-row-icon { color: var(--muted); flex-shrink: 0; width: 16px; text-align: center; }
.channel-row-name { color: var(--muted); font-size: 0.88rem; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-row.active .channel-row-icon { color: var(--accent-2); }
.channel-lock { font-size: 0.7rem; flex-shrink: 0; }

.channel-row-manage {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  box-shadow: none;
  padding: 3px 5px;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.channel-row:hover .channel-row-manage { opacity: 1; }
.channel-row-manage:hover { background: var(--panel-hover); filter: none; transform: none; box-shadow: none; }

.channel-manage-panel {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 4px 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.channel-manage-panel select { width: 100%; }
.channel-manage-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.channel-manage-actions button { padding: 6px 10px; font-size: 0.78rem; }

.new-channel-form { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--panel-alt); border-radius: var(--radius-sm); margin-top: 4px; }
.new-channel-form select { width: 100%; }
.new-channel-actions { display: flex; gap: 6px; }
.new-channel-actions button { flex: 1; padding: 7px; font-size: 0.82rem; }

.leave-community-btn { margin-top: auto; color: var(--danger) !important; }

select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

/* Main chat column */

.conversas-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 14px;
  gap: 12px;
}
.channel-header h2 { margin: 0; }
.channel-header-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.member-bubbles { display: flex; align-items: center; }
.member-bubbles .avatar { margin-left: -8px; border: 2px solid var(--bg); }
.member-bubbles .avatar:first-child { margin-left: 0; }

/* Role badges */

.role-badge { font-size: 0.68rem; }
.role-owner { background: linear-gradient(135deg, #fbbf24, #f59e0b) !important; color: #241a00 !important; }
.role-admin { background: rgba(124, 92, 255, 0.22) !important; color: var(--accent-2) !important; }
.role-moderator { background: rgba(52, 211, 153, 0.2) !important; color: var(--success) !important; }
.my-role-badge { align-self: flex-start; margin-top: -2px; }

/* Members panel */

.members-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-y: auto;
}
.members-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.members-panel-header h3 { margin: 0; }
.members-panel-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.member-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--radius-sm); }
.member-row:hover { background: var(--panel-hover); }
.member-row-info { flex: 1; min-width: 0; }
.member-row-info p { margin: 0; }
.member-row-info p:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-row-actions { flex: 0 0 100%; display: flex; gap: 6px; align-items: center; }
.member-role-select { font-size: 0.78rem; padding: 5px 6px; flex: 1; min-width: 0; }
.member-row-actions .ghost-btn { font-size: 0.78rem; padding: 5px 10px; white-space: nowrap; flex-shrink: 0; }

.text-channel-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.voice-channel-panel { flex: 1; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }

.messages-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 6px;
}

.chat-message { display: flex; gap: 12px; }
.chat-message-body { flex: 1; min-width: 0; }
.chat-message .message-meta { margin: 0 0 4px; font-size: 0.85rem; }
.chat-message .message-meta strong { font-weight: 700; }

.message-row { position: relative; display: flex; flex-direction: column; align-items: flex-start; padding: 2px 0; border-radius: var(--radius-sm); }
.message-row:hover { background: rgba(255, 255, 255, 0.02); }
.message-row:hover .message-actions { opacity: 1; pointer-events: auto; }
.message-text { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.message-deleted { font-style: italic; color: var(--muted); }
.edited-tag { font-size: 0.72rem; }

.message-actions {
  position: absolute;
  top: -14px;
  right: 4px;
  display: flex;
  gap: 2px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  box-shadow: var(--shadow-sm);
}
.msg-action-btn {
  background: none;
  box-shadow: none;
  padding: 4px 7px;
  font-size: 0.85rem;
  line-height: 1;
}
.msg-action-btn:hover { background: var(--panel-hover); filter: none; transform: none; box-shadow: none; }
.msg-action-btn.confirm-armed { background: rgba(255, 92, 114, 0.18); color: var(--danger); }

.reaction-picker {
  position: absolute;
  top: -48px;
  right: 4px;
  display: flex;
  gap: 3px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px;
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.reaction-picker button { background: none; box-shadow: none; padding: 4px 6px; font-size: 1rem; }
.reaction-picker button:hover { background: var(--panel-hover); filter: none; transform: none; box-shadow: none; }

.reactions-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.reaction-chip {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  box-shadow: none;
}
.reaction-chip:hover { filter: none; transform: none; box-shadow: none; background: var(--panel-hover); }
.reaction-chip.mine { background: rgba(124, 92, 255, 0.18); border-color: var(--accent); color: var(--accent-2); }

.message-edit-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 6px 10px;
}

.typing-indicator {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.message-form { display: flex; gap: 8px; margin-top: 14px; }
.message-form input { flex: 1; }
.send-btn { width: 44px; padding: 10px; display: flex; align-items: center; justify-content: center; }

/* ---- Voice channel ---- */

.call-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }

.call-icon-btn {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--panel-alt);
  color: var(--text);
  box-shadow: none;
}
.call-icon-btn svg { width: 20px; height: 20px; }
.call-icon-btn:hover { background: var(--panel-hover); filter: none; transform: none; box-shadow: none; }
.call-icon-btn.call-icon-active { background: rgba(255, 92, 114, 0.18); color: var(--danger); }
.call-icon-btn.call-icon-active:hover { background: rgba(255, 92, 114, 0.28); }
.call-icon-join { background: var(--gradient-accent); color: white; }
.call-icon-join.call-icon-hangup { background: linear-gradient(135deg, var(--danger), #ff8a5c); }

.voice-participants {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.voice-participant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: box-shadow 0.15s ease;
}
.voice-participant-avatar-wrap { position: relative; flex-shrink: 0; }
.voice-participant-row.speaking .voice-participant-avatar-wrap .avatar {
  box-shadow: 0 0 0 3px var(--success);
}
.voice-participant-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-participant-icons { display: flex; align-items: center; gap: 8px; color: var(--muted); flex-shrink: 0; }
.voice-participant-icons svg { width: 16px; height: 16px; display: block; }
.voice-deafen-icon { color: var(--danger); }
.voice-share-icon { color: var(--accent-2); }
.voice-mic-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--panel);
}
.voice-mic-badge svg { width: 10px; height: 10px; }

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.video-tile {
  position: relative;
  background: black;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: box-shadow 0.15s ease;
}
.video-tile video { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
}
.unmute-btn { position: absolute; top: 8px; right: 8px; padding: 4px 10px; font-size: 0.8rem; }

/* Maximize a tile within the browser's own viewport (not OS fullscreen,
   which would take over the whole monitor regardless of window size). */
.tile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 998;
}
.tile-maximized {
  position: fixed !important;
  inset: 24px;
  width: auto !important;
  height: auto !important;
  aspect-ratio: unset !important;
  z-index: 999;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

/* Voice channel presence shown right in the sidebar */

.channel-voice-presence { display: flex; flex-direction: column; gap: 4px; padding: 2px 8px 8px 34px; }
.channel-voice-presence-item { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.78rem; }
.channel-voice-presence-item span:not(.channel-voice-presence-mic) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-voice-presence-mic { display: flex; color: var(--danger); flex-shrink: 0; }
.channel-voice-presence-mic svg { width: 11px; height: 11px; display: block; }

.channel-row-hangup {
  margin-left: auto;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
}
.channel-row-hangup svg { width: 11px; height: 11px; }
.channel-row-hangup:hover { filter: brightness(1.1); transform: none; box-shadow: none; }
.channel-row:has(.channel-row-hangup) .channel-row-manage { right: 32px; }

/* ---- Mensagens (DMs) ---- */

.dm-strip { display: flex; gap: 18px; overflow-x: auto; padding: 4px 0 20px; }
.dm-strip-item {
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  width: 72px;
  box-shadow: none;
}
.dm-strip-item:hover { background: none; color: var(--text); filter: none; transform: none; box-shadow: none; }
.dm-strip-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72px; }

.dm-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  height: calc(100vh - 300px);
  min-height: 420px;
}

.dm-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.dm-list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.12s ease;
}
.dm-list-item:hover { background: var(--panel-hover); }
.dm-list-item.active { background: var(--panel-alt); }
.dm-list-text { flex: 1; min-width: 0; }
.dm-list-text p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dm-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  padding: 18px;
  min-height: 0;
}
.dm-panel-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.dm-panel-header p { margin: 0; }
#dm-messages { flex: 1; }

/* ---- Perfil ---- */

.profile-banner {
  height: 130px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 20% 20%, rgba(124, 92, 255, 0.45), transparent 55%),
    radial-gradient(circle at 80% 60%, rgba(255, 107, 179, 0.3), transparent 55%),
    var(--panel);
  margin-bottom: -44px;
}

.profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.profile-header { display: flex; align-items: center; gap: 18px; }
.profile-identity { flex: 1; }
.profile-header .avatar-lg { border: 3px solid var(--panel); }
.status-badge { background: var(--gradient-accent); color: white; }
.profile-bio { white-space: pre-wrap; margin: 16px 0 10px; line-height: 1.5; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }

.stats-row { display: flex; gap: 14px; margin: 20px 0; }
.stat-box {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-value { font-size: 1.5rem; font-weight: 800; background: var(--gradient-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }

.settings-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 480px;
}
.settings-panel label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.settings-label { display: block; margin-bottom: 6px; }
.status-options { display: flex; gap: 8px; flex-wrap: wrap; }
.status-option { background: var(--panel-alt); color: var(--muted); box-shadow: none; }
.status-option:hover { filter: none; transform: none; box-shadow: none; background: var(--panel-hover); }
.status-option.active { background: var(--gradient-accent); color: white; }

/* ---- Toasts ---- */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}
.toast {
  background: var(--panel-alt);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 320px;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast-error { border-color: var(--danger); color: #ffb3bd; }

/* ---- Quick switcher (Ctrl+K) ---- */

.quick-switcher-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.quick-switcher {
  width: min(560px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.quick-switcher input {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 16px 20px;
  font-size: 1rem;
  background: transparent;
}
.quick-switcher input:focus { box-shadow: none; border-bottom-color: var(--accent); }

.quick-switcher-results { overflow-y: auto; padding: 8px; }
.quick-switcher-empty { padding: 20px; text-align: center; }
.quick-switcher-section { margin-bottom: 6px; }
.quick-switcher-heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px 4px;
  margin: 0;
}
.quick-switcher-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  box-shadow: none;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--text);
}
.quick-switcher-item:hover { background: var(--panel-hover); filter: none; transform: none; box-shadow: none; }
.quick-switcher-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-switcher-icon-text {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--panel-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- Mute toggles ---- */

.channel-row-mute-toggle,
.dm-mute-toggle {
  background: none;
  box-shadow: none;
  padding: 2px 4px;
  font-size: 0.75rem;
  opacity: 0;
  flex-shrink: 0;
  margin-left: auto;
}
.channel-row:hover .channel-row-mute-toggle,
.channel-row-mute-toggle.active {
  opacity: 0.85;
}
.channel-row-mute-toggle:hover { background: none; filter: none; transform: none; box-shadow: none; opacity: 1; }

.dm-list-item .dm-mute-toggle { opacity: 0; margin-left: 0; }
.dm-list-item:hover .dm-mute-toggle,
.dm-mute-toggle.active {
  opacity: 0.85;
}
.dm-mute-toggle:hover { background: none; filter: none; transform: none; box-shadow: none; opacity: 1; }

/* ---- Lightweight markdown in messages ---- */

.msg-inline-code {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85em;
}
.msg-code-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 6px 0 0;
  overflow-x: auto;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85em;
}

/* ---- Persistent active-call bar (stays visible across navigation) ---- */

.active-call-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  animation: fade-in 0.2s ease;
}
.active-call-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}
.active-call-info:hover { filter: none; transform: none; box-shadow: none; opacity: 0.85; }
.active-call-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: call-pulse 2s infinite;
}
@keyframes call-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.active-call-text { display: flex; flex-direction: column; line-height: 1.25; }
.active-call-text strong { font-size: 0.88rem; }
.active-call-text span { font-size: 0.76rem; }
.active-call-actions { display: flex; align-items: center; gap: 8px; }
.call-icon-btn-sm { width: 36px; height: 36px; min-width: 36px; }
.call-icon-btn-sm svg { width: 16px; height: 16px; }

/* ---- New-version banner ---- */

.update-banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 18px;
  background: var(--gradient-accent);
  color: white;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  animation: fade-in 0.25s ease;
}
.update-banner button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 7px 14px;
  font-size: 0.85rem;
}
.update-banner button:hover { background: rgba(255, 255, 255, 0.32); filter: none; transform: none; box-shadow: none; }
.msg-code-block code { background: none; border: none; padding: 0; }
