:root {
  --bg-tertiary: #1e1f22;
  --bg-secondary: #2b2d31;
  --bg-secondary-alt: #232428;
  --bg-primary: #313338;
  --bg-floating: #111214;
  --bg-input: #383a40;
  --bg-modifier-hover: rgba(78, 80, 88, 0.3);
  --bg-modifier-selected: rgba(78, 80, 88, 0.6);
  --text-normal: #dbdee1;
  --text-muted: #949ba4;
  --header-primary: #f2f3f5;
  --header-secondary: #b5bac1;
  --interactive-normal: #b5bac1;
  --interactive-hover: #dbdee1;
  --interactive-active: #fff;
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --green: #23a559;
  --red: #da373c;
  --red-hover: #a12828;
  --yellow: #f0b232;
  --divider: rgba(255, 255, 255, 0.06);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Noto Sans', 'gg sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg-tertiary);
  color: var(--text-normal);
  font-size: 15px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: #00a8fc; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
svg { flex-shrink: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
.thin-scroll::-webkit-scrollbar { width: 4px; }

/* ---------- Botões ---------- */
.btn {
  padding: 2px 16px; min-height: 38px; border-radius: 3px; font-weight: 500; font-size: 14px;
  transition: background-color .17s ease; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-sm { min-height: 32px; font-size: 14px; }
.btn-primary { background: var(--blurple); color: #fff; }
.btn-primary:hover { background: var(--blurple-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary { background: #4e5058; color: #fff; }
.btn-secondary:hover { background: #6d6f78; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-hover); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #1a7f45; }
.btn-link { color: #fff; padding: 2px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-block { width: 100%; }

/* ---------- Login ---------- */
.auth-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 20% 20%, #5865f2 0, transparent 45%),
              radial-gradient(circle at 80% 80%, #eb459e 0, transparent 40%), #404eed;
}
.auth-card {
  width: 480px; max-width: 100%; background: var(--bg-primary); padding: 32px; border-radius: 5px;
  box-shadow: 0 2px 10px 0 rgba(0,0,0,.2); display: flex; flex-direction: column; gap: 20px;
}
.auth-card h1 { margin: 0; text-align: center; color: var(--header-primary); font-size: 24px; font-weight: 600; }
.auth-card > p.muted { margin: -14px 0 0; text-align: center; }
.auth-card label, .form-label {
  display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 700; color: var(--header-secondary); letter-spacing: .02em;
}
.req { color: var(--red); }
.auth-card input, .input {
  background: var(--bg-tertiary); border: 0; border-radius: 3px; padding: 10px; font-size: 16px; outline: none; width: 100%;
}
.auth-card input::placeholder, .input::placeholder { color: #6d6f78; }
.auth-error { color: #fa777c; font-size: 14px; min-height: 0; }
.auth-error:empty { display: none; }
.auth-switch { margin: -12px 0 0; font-size: 14px; color: var(--text-muted); }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; }

.server-list {
  width: 72px; background: var(--bg-tertiary); padding: 12px 0; display: flex; flex-direction: column; align-items: center;
  gap: 8px; overflow-y: auto; flex-shrink: 0; scrollbar-width: none;
}
.server-list::-webkit-scrollbar { display: none; }
.server-item { position: relative; width: 72px; display: flex; justify-content: center; }
.server-pill {
  position: absolute; left: 0; top: 50%; width: 8px; height: 0; margin-left: -4px; border-radius: 0 4px 4px 0;
  background: #fff; transform: translateY(-50%); transition: height .2s ease;
}
.server-item.unread .server-pill { height: 8px; }
.server-item:hover .server-pill { height: 20px; }
.server-item.active .server-pill { height: 40px; }
.server-icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--bg-primary); color: var(--text-normal);
  display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 16px;
  transition: border-radius .2s ease, background-color .2s ease, color .2s ease; overflow: hidden; user-select: none;
}
.server-item:hover .server-icon, .server-item.active .server-icon { border-radius: 16px; }
.server-item.home .server-icon:hover, .server-item.home.active .server-icon { background: var(--blurple); color: #fff; }
.server-item[style*="--c"]:hover .server-icon, .server-item[style*="--c"].active .server-icon { background: var(--c); color: #fff; }
.server-item.add .server-icon { color: var(--green); font-size: 26px; font-weight: 300; }
.server-item.add:hover .server-icon { background: var(--green); color: #fff; }
.server-separator { width: 32px; height: 2px; border-radius: 1px; background: #35363c; margin: 0 auto; }
.badge {
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700; border-radius: 8px; min-width: 16px;
  height: 16px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.server-item .badge { position: absolute; bottom: -2px; right: 10px; box-shadow: 0 0 0 3px var(--bg-tertiary); }

.tooltip {
  position: fixed; background: var(--bg-floating); color: var(--header-primary); padding: 8px 12px; border-radius: 5px;
  font-size: 15px; font-weight: 600; pointer-events: none; z-index: 1000; white-space: nowrap; box-shadow: 0 8px 16px rgba(0,0,0,.24);
}

.sidebar { width: 240px; background: var(--bg-secondary); display: flex; flex-direction: column; flex-shrink: 0; min-width: 0; }
.sidebar-content { flex: 1; overflow-y: auto; min-height: 0; }
.sidebar-header {
  height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; font-weight: 600;
  color: var(--header-primary); box-shadow: 0 1px 0 rgba(4,4,5,.2), 0 1.5px 0 rgba(6,6,7,.05), 0 2px 0 rgba(4,4,5,.05);
  position: sticky; top: 0; background: var(--bg-secondary); z-index: 2; cursor: pointer; gap: 8px;
}
.sidebar-header:hover { background: #35373c; }
.sidebar-header .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-btn {
  width: 100%; height: 28px; background: var(--bg-tertiary); border-radius: 4px; color: var(--text-muted);
  font-size: 14px; text-align: left; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-header.home { cursor: default; padding: 0 10px; }
.sidebar-header.home:hover { background: var(--bg-secondary); }

.channel-list { padding: 8px 8px 16px; }
.category {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 4px 2px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); letter-spacing: .02em; text-transform: uppercase; user-select: none;
}
.category:hover { color: var(--interactive-hover); }
.category .icon-btn { opacity: .8; }
.channel {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 4px; color: var(--text-muted);
  cursor: pointer; margin: 1px 0; font-weight: 500; position: relative; user-select: none;
}
.channel:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.channel.active { background: var(--bg-modifier-selected); color: var(--interactive-active); }
.channel.unread { color: var(--interactive-active); font-weight: 600; }
.channel.unread::before {
  content: ''; position: absolute; left: -8px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: #fff;
}
.channel .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel .actions { display: none; gap: 4px; }
.channel:hover .actions { display: flex; }
.channel .badge { margin-left: auto; }
.channel-icon { color: var(--text-muted); opacity: .9; }

.voice-users { padding-left: 32px; padding-bottom: 4px; }
.voice-user {
  display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 4px; color: var(--text-muted); font-size: 14px;
}
.voice-user:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.voice-user .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user .icons { display: flex; gap: 4px; align-items: center; color: var(--text-muted); }
.live-badge {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 8px; padding: 0 6px; height: 16px;
  display: inline-flex; align-items: center; letter-spacing: .02em;
}

.dm-item { display: flex; align-items: center; gap: 12px; padding: 4px 8px; height: 42px; border-radius: 4px; color: var(--text-muted); cursor: pointer; margin: 1px 0; }
.dm-item:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.dm-item.active { background: var(--bg-modifier-selected); color: var(--interactive-active); }
.dm-item .name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item .close { display: none; color: var(--text-muted); }
.dm-item:hover .close { display: block; }
.dm-item.unread { color: var(--interactive-active); }

/* ---------- Avatar ---------- */
.avatar {
  position: relative; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 600; flex-shrink: 0; user-select: none; transition: box-shadow .1s;
}
.avatar.speaking { box-shadow: 0 0 0 2px var(--green), inset 0 0 0 1px var(--green); }
.status-dot {
  position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--bg-secondary);
  background: #80848e;
}
.status-dot.online { background: var(--green); }
.status-dot.offline { background: #80848e; }
.status-dot.offline::after { content: ''; position: absolute; inset: 2px; background: var(--bg-secondary); border-radius: 50%; }

/* ---------- Painel de voz / usuário ---------- */
.voice-panel { background: var(--bg-secondary-alt); border-bottom: 1px solid var(--divider); padding: 8px; }
.voice-panel .row { display: flex; align-items: center; gap: 8px; }
.voice-panel .status { flex: 1; min-width: 0; }
.voice-panel .status .title { color: var(--green); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.voice-panel .status .sub { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-panel .buttons { display: flex; gap: 8px; margin-top: 8px; }
.voice-panel .buttons .btn { flex: 1; min-height: 32px; background: #2b2d31; color: var(--interactive-normal); padding: 0; }
.voice-panel .buttons .btn:hover { background: #35373c; color: var(--interactive-hover); }
.voice-panel .buttons .btn.on { color: var(--green); }

.user-panel { height: 52px; background: var(--bg-secondary-alt); padding: 0 8px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.user-panel .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 2px; border-radius: 4px; cursor: pointer; }
.user-panel .who:hover { background: var(--bg-modifier-hover); }
.user-panel .who .names { min-width: 0; line-height: 1.2; }
.user-panel .who .username { font-size: 14px; font-weight: 600; color: var(--header-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel .who .status-text { font-size: 12px; color: var(--text-muted); }
.user-panel .avatar .status-dot { border-color: var(--bg-secondary-alt); }

.icon-btn {
  width: 32px; height: 32px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--interactive-normal);
}
.icon-btn:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.icon-btn.small { width: 18px; height: 18px; }
.icon-btn.small:hover { background: none; }
.icon-btn.danger { color: var(--red); }
.icon-btn.active-red { color: var(--red); }

/* ---------- Área principal ---------- */
.main { flex: 1; background: var(--bg-primary); display: flex; flex-direction: column; min-width: 0; }
.main-header {
  height: 48px; padding: 0 8px 0 16px; display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(4,4,5,.2), 0 1.5px 0 rgba(6,6,7,.05), 0 2px 0 rgba(4,4,5,.05); z-index: 2;
}
.main-header .title { font-weight: 600; color: var(--header-primary); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.main-header .divider { width: 1px; height: 24px; background: rgba(255,255,255,.06); margin: 0 8px; }
.main-header .spacer { flex: 1; }
.main-body { flex: 1; display: flex; min-height: 0; }

.tabs { display: flex; gap: 16px; align-items: center; }
.tab { padding: 2px 8px; border-radius: 4px; color: var(--interactive-normal); font-weight: 500; }
.tab:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.tab.active { background: var(--bg-modifier-selected); color: var(--interactive-active); }
.tab.add { background: var(--green); color: #fff; }
.tab.add.active { background: transparent; color: #2dc770; }
.tab .badge { margin-left: 4px; }

/* ---------- Amigos ---------- */
.friends { flex: 1; overflow-y: auto; padding: 16px 20px 16px 30px; }
.friends-title { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 8px; letter-spacing: .02em; }
.friend-row {
  display: flex; align-items: center; gap: 12px; height: 62px; border-top: 1px solid var(--divider); padding: 0 10px;
  margin: 0 -10px; border-radius: 8px; cursor: pointer;
}
.friend-row:hover { background: var(--bg-modifier-hover); border-top-color: transparent; }
.friend-row:hover + .friend-row { border-top-color: transparent; }
.friend-row .info { flex: 1; min-width: 0; }
.friend-row .info .name { font-weight: 600; color: var(--header-primary); }
.friend-row .info .sub { font-size: 14px; color: var(--text-muted); }
.friend-row .actions { display: flex; gap: 10px; }
.round-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-secondary); color: var(--interactive-normal);
  display: flex; align-items: center; justify-content: center;
}
.friend-row:hover .round-btn { background: var(--bg-tertiary); }
.round-btn:hover { color: var(--interactive-hover); }
.round-btn.accept:hover { color: var(--green); }
.round-btn.deny:hover { color: var(--red); }

.add-friend h2 { margin: 4px 0 8px; font-size: 16px; color: var(--header-primary); text-transform: uppercase; }
.add-friend p { margin: 0 0 16px; color: var(--text-muted); font-size: 14px; }
.add-friend form {
  display: flex; align-items: center; background: var(--bg-tertiary); border-radius: 8px; padding: 0 12px; height: 52px; border: 1px solid transparent;
}
.add-friend form:focus-within { border-color: #00a8fc; }
.add-friend form.ok { border-color: var(--green); }
.add-friend form.err { border-color: var(--red); }
.add-friend input { flex: 1; background: none; border: 0; outline: none; font-size: 16px; }
.add-friend .feedback { margin-top: 8px; font-size: 14px; }
.add-friend .feedback.ok { color: #2dc770; }
.add-friend .feedback.err { color: #fa777c; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); padding: 60px 20px; text-align: center; gap: 12px; }
.empty-state { gap: 20px; font-size: 15px; max-width: 420px; margin: 0 auto; line-height: 1.4; }
.empty-art {
  width: 160px; height: 160px; border-radius: 50%; background: var(--bg-secondary); color: #4e5058;
  display: flex; align-items: center; justify-content: center;
}

.active-now { width: 360px; border-left: 1px solid var(--divider); padding: 16px; overflow-y: auto; flex-shrink: 0; }
.active-now h3 { margin: 8px 0 16px; font-size: 20px; font-weight: 800; color: var(--header-primary); }
.active-card { background: var(--bg-secondary); border-radius: 8px; padding: 16px; margin-bottom: 8px; }
.active-card .who { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--header-primary); }
.active-card .what { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Chat ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding-bottom: 24px; overflow-anchor: none; }
.messages-start { padding: 16px 16px 8px; margin-top: 16px; }
.messages-start .icon-circle {
  width: 68px; height: 68px; border-radius: 50%; background: #41434a; display: flex; align-items: center; justify-content: center;
  color: #fff; margin-bottom: 8px;
}
.messages-start h1 { margin: 8px 0; font-size: 32px; color: var(--header-primary); font-weight: 700; }
.messages-start p { margin: 0; color: var(--text-muted); }
.load-more { text-align: center; padding: 8px; }

.msg { position: relative; padding: 2px 48px 2px 72px; min-height: 22px; }
.msg:hover { background: rgba(2, 2, 2, 0.06); }
.msg.head { margin-top: 17px; padding-top: 2px; }
.msg .avatar { position: absolute; left: 16px; top: 4px; cursor: pointer; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; line-height: 22px; }
.msg .author { font-weight: 500; color: var(--header-primary); cursor: pointer; }
.msg .author:hover { text-decoration: underline; }
.msg .time { font-size: 12px; color: var(--text-muted); }
.msg .side-time {
  position: absolute; left: 0; width: 72px; text-align: center; font-size: 11px; color: var(--text-muted); line-height: 22px; display: none;
}
.msg:not(.head):hover .side-time { display: block; }
.msg .content { line-height: 1.375; white-space: pre-wrap; word-wrap: break-word; color: var(--text-normal); }
.msg .content code { background: var(--bg-secondary); padding: 0 3px; border-radius: 3px; font-size: 85%; font-family: Consolas, Menlo, monospace; }
.msg .content pre { background: var(--bg-secondary); border: 1px solid var(--bg-tertiary); padding: 8px; border-radius: 4px; margin: 4px 0; overflow-x: auto; font-family: Consolas, Menlo, monospace; font-size: 14px; white-space: pre-wrap; }
.msg .content .mention { background: rgba(88,101,242,.3); color: #c9cdfb; padding: 0 2px; border-radius: 3px; font-weight: 500; }
.msg.mentioned { background: rgba(240,177,50,.08); box-shadow: inset 2px 0 0 var(--yellow); }
.msg .attachment img { max-width: min(400px, 100%); max-height: 350px; border-radius: 8px; margin-top: 4px; cursor: zoom-in; display: block; }
.msg .hover-actions {
  position: absolute; right: 16px; top: -16px; background: var(--bg-primary); border: 1px solid var(--bg-tertiary); border-radius: 4px;
  display: none; box-shadow: 0 0 0 1px rgba(0,0,0,.05);
}
.msg:hover .hover-actions { display: flex; }
.msg.pending .content { color: var(--text-muted); }
.day-divider { display: flex; align-items: center; margin: 24px 16px 8px; font-size: 12px; font-weight: 600; color: var(--text-muted); gap: 8px; }
.day-divider::before, .day-divider::after { content: ''; flex: 1; height: 1px; background: var(--divider); }

.composer-wrap { padding: 0 16px 24px; flex-shrink: 0; position: relative; }
.composer { background: var(--bg-input); border-radius: 8px; display: flex; align-items: flex-start; padding: 0 16px 0 4px; }
.composer .attach-btn { width: 40px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--interactive-normal); }
.composer .attach-btn:hover { color: var(--interactive-hover); }
.composer textarea {
  flex: 1; background: none; border: 0; outline: none; resize: none; padding: 11px 0; max-height: 50vh; line-height: 22px; font-size: 15px;
}
.composer textarea::placeholder { color: #6d6f78; }
.typing { position: absolute; left: 16px; bottom: 4px; font-size: 13px; color: var(--text-normal); height: 20px; display: flex; align-items: center; gap: 6px; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-normal); animation: typing 1.4s infinite; opacity: .3; }
.typing .dots span:nth-child(2) { animation-delay: .2s; }
.typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.upload-preview { display: flex; gap: 8px; padding: 12px 12px 4px; background: var(--bg-input); border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--divider); }
.upload-preview + .composer { border-radius: 0 0 8px 8px; }
.upload-preview .item { position: relative; background: var(--bg-secondary); border-radius: 4px; padding: 8px; }
.upload-preview img { max-height: 120px; max-width: 200px; border-radius: 4px; display: block; }
.upload-preview .remove { position: absolute; top: -8px; right: -8px; background: var(--bg-secondary); border-radius: 4px; color: var(--red); width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1px var(--bg-tertiary); }

/* ---------- Lista de membros ---------- */
.members { width: 240px; background: var(--bg-secondary); overflow-y: auto; padding: 0 8px 20px; flex-shrink: 0; }
.members h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); padding: 24px 8px 4px; margin: 0; letter-spacing: .02em; }
.member { display: flex; align-items: center; gap: 12px; padding: 4px 8px; height: 42px; border-radius: 4px; cursor: pointer; color: var(--text-muted); }
.member:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.member .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.member.offline { opacity: .3; }
.member.offline:hover { opacity: 1; }
.member .crown { color: var(--yellow); }

/* ---------- Voz / transmissões ---------- */
.voice-view { flex: 1; background: #000; display: flex; flex-direction: column; min-height: 0; position: relative; }
.voice-view .main-header { background: transparent; box-shadow: none; position: absolute; top: 0; left: 0; right: 0; z-index: 5; }
.voice-view .main-header .title { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.voice-stage { flex: 1; display: flex; flex-direction: column; padding: 56px 16px 8px; min-height: 0; gap: 8px; }
.voice-focus { flex: 1; min-height: 0; display: flex; }
.voice-focus .tile { flex: 1; aspect-ratio: auto; }
.voice-grid {
  flex: 1; display: grid; gap: 8px; align-content: center; justify-content: center; min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); overflow-y: auto;
}
.voice-grid.strip { flex: 0 0 auto; height: 130px; display: flex; overflow-x: auto; overflow-y: hidden; justify-content: center; }
.voice-grid.strip .tile { width: 210px; flex-shrink: 0; aspect-ratio: auto; }
.tile {
  position: relative; background: #2b2d31; border-radius: var(--radius); aspect-ratio: 16 / 9; display: flex; align-items: center;
  justify-content: center; overflow: hidden; min-height: 0; cursor: pointer; max-height: 100%;
}
.tile.speaking::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); box-shadow: inset 0 0 0 3px var(--green); pointer-events: none; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile .label {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 4px; padding: 2px 8px;
  font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 16px);
}
.tile .label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .tile-actions { position: absolute; right: 8px; top: 8px; display: none; gap: 6px; }
.tile:hover .tile-actions { display: flex; }
.tile .tile-actions button { background: rgba(0,0,0,.6); color: #fff; border-radius: 4px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.tile .tile-actions button:hover { background: rgba(0,0,0,.85); }
.tile .waiting { color: var(--text-muted); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.voice-controls { display: flex; justify-content: center; gap: 16px; padding: 12px 0 24px; }
.ctrl {
  width: 56px; height: 56px; border-radius: 50%; background: #2b2d31; color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.ctrl:hover { background: #404249; }
.ctrl.off { background: #fff; color: #000; }
.ctrl.on { background: var(--green); }
.ctrl.danger { background: var(--red); }
.ctrl.danger:hover { background: var(--red-hover); }
.voice-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: #fff; }
.voice-empty h2 { margin: 0; font-size: 24px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--bg-primary); border-radius: 8px; width: 440px; max-width: 100%; overflow: hidden; animation: pop .2s; }
.modal-body { padding: 24px 16px 16px; }
.modal h2 { margin: 0 0 8px; text-align: center; color: var(--header-primary); font-size: 24px; }
.modal p.center { text-align: center; color: var(--header-secondary); margin: 0 0 16px; }
.modal-footer { background: var(--bg-secondary); padding: 16px; display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.modal .choice {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 1px solid rgba(78,80,88,.48); border-radius: 8px;
  font-weight: 700; margin-bottom: 8px; text-align: left; color: var(--header-primary);
}
.modal .choice:hover { background: var(--bg-modifier-hover); }
.modal .choice .emoji { font-size: 28px; }
.modal .choice .chev { margin-left: auto; color: var(--interactive-normal); }
.modal .field { margin-bottom: 16px; }
.modal .field .input { margin-top: 8px; }
.radio-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg-secondary); border-radius: 4px; margin-top: 8px; cursor: pointer;
}
.radio-row:hover { background: #393c41; }
.radio-row.selected { background: #43444b; }
.radio-row .rt { flex: 1; }
.radio-row .rt b { display: block; color: var(--header-primary); }
.radio-row .rt small { color: var(--text-muted); }
.invite-box { display: flex; background: var(--bg-tertiary); border-radius: 3px; padding: 4px; align-items: center; gap: 4px; }
.invite-box input { flex: 1; background: none; border: 0; outline: none; padding: 6px; font-size: 16px; }
.lightbox { max-width: 90vw; max-height: 90vh; border-radius: 4px; }
.menu { max-height: calc(100vh - 16px); overflow-y: auto; position: fixed; background: var(--bg-floating); border-radius: 4px; padding: 6px 8px; min-width: 188px; z-index: 200; box-shadow: 0 8px 16px rgba(0,0,0,.24); }
.menu button { display: flex; width: 100%; padding: 8px; border-radius: 2px; font-size: 14px; font-weight: 500; color: var(--interactive-normal); justify-content: space-between; align-items: center; }
.menu button:hover { background: var(--blurple); color: #fff; }
.menu button.danger { color: #f23f42; }
.menu button.danger:hover { background: var(--red); color: #fff; }
.menu .sep { height: 1px; background: var(--divider); margin: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 300; align-items: center; }
.toast { background: var(--bg-floating); color: var(--header-primary); padding: 10px 16px; border-radius: 6px; box-shadow: 0 8px 16px rgba(0,0,0,.24); font-size: 14px; animation: pop .2s; }
.toast.err { border-left: 4px solid var(--red); }
.toast.ok { border-left: 4px solid var(--green); }

@media (max-width: 1100px) { .active-now { display: none; } }
@media (max-width: 900px) { .members { display: none; } }
@media (max-width: 640px) {
  .sidebar { width: 200px; }
  .tabs { gap: 4px; overflow-x: auto; }
}

/* ---------- Cartão de perfil ---------- */
.profile-card { width: 300px; background: var(--bg-floating); border-radius: 8px; overflow: hidden; position: relative; }
.profile-card.popout {
  position: fixed; z-index: 250; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: pop .15s;
  max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; overscroll-behavior: contain;
}
.pc-banner { height: 105px; background-size: cover; background-position: center; }
.pc-avatar { position: absolute; top: 61px; left: 16px; border-radius: 50%; padding: 6px; background: var(--bg-floating); }
.pc-avatar .avatar .status-dot { width: 22px; height: 22px; border-width: 5px; border-color: var(--bg-floating); right: 0; bottom: 0; }
.pc-avatar .avatar .status-dot.offline::after { inset: 3px; background: var(--bg-floating); }
.pc-body { padding: 52px 16px 16px; }
.pc-name { font-size: 20px; font-weight: 700; color: var(--header-primary); margin-bottom: 12px; word-break: break-word; }
.pc-section { background: #232428; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.pc-section h4 { margin: 0 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--header-secondary); letter-spacing: .02em; }
.pc-section p { margin: 0; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.pc-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.slider { width: 100%; accent-color: var(--blurple); margin-top: 6px; }

/* ---------- Configurações (tela cheia) ---------- */
.settings { position: fixed; inset: 0; z-index: 150; display: flex; background: var(--bg-primary); animation: fade .15s; }
.settings-nav { flex: 1 0 218px; background: var(--bg-secondary); display: flex; justify-content: flex-end; overflow-y: auto; }
.settings-nav .inner { width: 218px; padding: 60px 6px 60px 20px; }
.settings-nav h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin: 0 0 6px; padding: 6px 10px; letter-spacing: .02em; }
.settings-nav button { display: block; width: 100%; text-align: left; padding: 6px 10px; border-radius: 4px; margin-bottom: 2px; font-weight: 500; color: var(--interactive-normal); }
.settings-nav button:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.settings-nav button.active { background: var(--bg-modifier-selected); color: var(--interactive-active); }
.settings-nav button.danger { color: #f23f42; }
.settings-nav .sep { height: 1px; background: var(--divider); margin: 8px 10px; }
.settings-content { flex: 1 1 800px; position: relative; overflow-y: auto; display: flex; }
.settings-content .inner { width: 100%; max-width: 740px; padding: 60px 40px 100px; }
.settings-content h2 { margin: 0 0 20px; font-size: 20px; color: var(--header-primary); }
.settings-close {
  position: sticky; top: 60px; align-self: flex-start; margin-right: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--interactive-normal); font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.settings-close svg { width: 36px; height: 36px; padding: 8px; border: 2px solid currentColor; border-radius: 50%; }
.settings-close:hover { color: var(--interactive-hover); }
.hint { color: var(--text-muted); font-size: 13px; font-weight: 400; }
.divider-h { height: 1px; background: var(--divider); margin: 28px 0; }
.settings-sub { margin: 0 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--header-secondary); letter-spacing: .02em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-content select.input { appearance: auto; cursor: pointer; }
.form-label.disabled { opacity: .5; pointer-events: none; }

.account-card { background: var(--bg-tertiary); border-radius: 8px; overflow: hidden; position: relative; }
.account-head { display: flex; align-items: flex-end; gap: 16px; padding: 0 16px; margin-top: -40px; position: relative; }
.account-head .pc-avatar { position: static; }
.account-name { flex: 1; font-size: 20px; font-weight: 700; color: var(--header-primary); padding-bottom: 12px; }
.account-head .btn { margin-bottom: 14px; }
.account-fields { margin: 8px 16px 16px; background: var(--bg-secondary); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 20px; }
.field-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.field-row h5 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; color: var(--header-secondary); }

.profile-editor { display: flex; gap: 32px; flex-wrap: wrap; }
.pe-form { flex: 1 1 280px; }
.pe-preview { flex: 0 0 300px; }
.pe-preview h5, .pe-group h5 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; color: var(--header-secondary); letter-spacing: .02em; }
.pe-group { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--divider); }
.pe-buttons { display: flex; gap: 8px; align-items: center; }
.color-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 14px; color: var(--text-muted); }
.color-row input { width: 64px; height: 36px; border: 0; border-radius: 4px; background: none; cursor: pointer; padding: 0; }
.pe-group textarea { resize: vertical; font-size: 15px; }
.counter { text-align: right; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.save-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: min(700px, calc(100% - 32px)); z-index: 160;
  background: var(--bg-floating); border-radius: 6px; padding: 10px 10px 10px 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; box-shadow: 0 8px 16px rgba(0,0,0,.3); color: var(--header-primary); font-weight: 500; animation: pop .2s;
}
.save-bar.hidden { display: none; }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--divider); }
.toggle-row b { display: block; color: var(--header-primary); font-weight: 500; margin-bottom: 4px; }
.toggle-row small { color: var(--text-muted); font-size: 14px; }
.toggle { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: #80848e; position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle:checked { background: var(--green); }
.toggle:checked::after { transform: translateX(16px); }

.mic-test { display: flex; align-items: center; gap: 16px; margin: 12px 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.meter { position: relative; height: 10px; border-radius: 5px; background: var(--bg-tertiary); overflow: hidden; margin-bottom: 8px; }
.meter-fill { height: 100%; width: 0; background: var(--yellow); transition: width .05s linear; }
.meter-fill.open { background: var(--green); }
.meter-threshold { position: absolute; top: -2px; bottom: -2px; width: 3px; background: #fff; border-radius: 2px; }
.settings-content .form-label { margin-bottom: 4px; }

.server-icon.big { width: 80px; height: 80px; border-radius: 50%; font-size: 26px; }
.server-icon-edit { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }

.msg .attachment video { max-width: min(480px, 100%); max-height: 360px; border-radius: 8px; margin-top: 4px; display: block; background: #000; }
.upload-preview .item { position: relative; }
.upload-preview .uploading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px #000; }
.toast.ok { border-left: 4px solid var(--green); }

@media (max-width: 760px) {
  .settings { flex-direction: column; }
  .settings-nav { flex: 0 0 auto; justify-content: flex-start; }
  .settings-nav .inner { width: 100%; padding: 16px; display: flex; flex-wrap: wrap; gap: 4px; }
  .settings-nav h4, .settings-nav .sep { display: none; }
  .settings-nav button { width: auto; }
  .settings-content .inner { padding: 24px 16px 100px; }
  .settings-close { position: absolute; top: 16px; right: 0; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Mensagem do sistema (entrada no servidor) */
.msg.system { display: flex; align-items: center; gap: 8px; padding-left: 28px; color: var(--text-muted); }
.msg.system .sys-icon { color: var(--green); width: 44px; display: flex; justify-content: center; flex-shrink: 0; }
.msg.system .author { color: var(--header-primary); font-weight: 500; cursor: pointer; }
.msg.system .author:hover { text-decoration: underline; }
.msg.system .time { font-size: 12px; }

/* Parar transmissão: sempre bem visível */
.voice-panel .buttons .btn.stop-stream { background: var(--red); color: #fff; font-weight: 600; font-size: 13px; }
.voice-panel .buttons .btn.stop-stream:hover { background: var(--red-hover); color: #fff; }
.voice-panel .buttons .btn { font-size: 13px; gap: 6px; }
.ctrl-wide { height: 56px; padding: 0 22px; border-radius: 28px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: #fff; background: var(--red); }
.ctrl-wide:hover { background: var(--red-hover); }
.stop-own-stream {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: none; align-items: center; gap: 6px;
  background: var(--red); color: #fff; font-weight: 600; padding: 10px 18px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.stop-own-stream:hover { background: var(--red-hover); }
.tile:hover .stop-own-stream { display: flex; }
