/* PoleiaTalk — identidade Poleia Team (PLTM): grafite, laranja e branco quente. */
@font-face {
  font-family: 'Russo One';
  src: url('/fonts/russo-one-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Rajdhani';
  src: url('/fonts/rajdhani-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Rajdhani';
  src: url('/fonts/rajdhani-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Rajdhani';
  src: url('/fonts/rajdhani-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg-0: #07090d;
  --bg-1: #0d1016;
  --bg-2: #12151c;
  --bg-3: #1a1e27;
  --bg-4: #262b36;
  --bg-hover: rgba(255, 255, 255, 0.045);
  --bg-active: rgba(255, 122, 26, 0.12);
  --text: #f4efe8;
  --text-2: #c2bdb6;
  --muted: #7f8594;
  --border: rgba(255, 255, 255, 0.07);
  --accent: #ff7a1a;
  --accent-2: #ff8f3d;
  --accent-soft: rgba(255, 122, 26, 0.15);
  --on-accent: #140a02; /* texto sobre laranja (contraste alto) */
  --success: #2fb67c;
  --danger: #ef4f5a;
  --warning: #ffb02e;
  --mention-bg: rgba(255, 122, 26, 0.09);
  --mention-bar: #ff7a1a;
  --online: #2fb67c;
  --idle: #ffb02e;
  --dnd: #ef4f5a;
  --offline: #6b7180;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  --radius: 8px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: 'Russo One', 'Arial Black', Impact, sans-serif;
  --heading: 'Rajdhani', 'Segoe UI', sans-serif;
  --mono: Consolas, 'Cascadia Code', Menlo, monospace;
  /* Textura da marca: listras diagonais finas + brilho laranja. */
  --stripes: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 12px);
  --glow: radial-gradient(ellipse at 50% 50%, rgba(255, 122, 26, 0.22), transparent 60%);
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg-0: #e4e0da;
  --bg-1: #ece8e2;
  --bg-2: #f6f3ef;
  --bg-3: #ffffff;
  --bg-4: #e2ddd6;
  --bg-hover: rgba(0, 0, 0, 0.045);
  --bg-active: rgba(255, 122, 26, 0.16);
  --text: #16130f;
  --text-2: #3e3a34;
  --muted: #6f6a63;
  --border: rgba(0, 0, 0, 0.09);
  --accent: #e8650a;
  --accent-2: #ff7a1a;
  --accent-soft: rgba(232, 101, 10, 0.14);
  --mention-bg: rgba(232, 101, 10, 0.1);
  --mention-bar: #e8650a;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  --stripes: repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 12px);
  --glow: radial-gradient(ellipse at 50% 50%, rgba(232, 101, 10, 0.16), transparent 60%);
  color-scheme: light;
}

/* ---------- marca ---------- */
/* Letreiro com o corte diagonal do logo: metade de cima laranja, de baixo branca. */
.brand-split {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45));
}
/* Cada linha (<span>) recebe o próprio corte, como no logo. */
.brand-split > span {
  display: block;
  background: linear-gradient(174deg, var(--accent) 0 52%, var(--text) 52% 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font: 700 13px var(--heading);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-tag::before,
.brand-tag::after {
  content: '';
  width: 40px;
  height: 2px;
  background: var(--accent);
}
.brand-tag b {
  color: var(--accent-2);
}
.brand-tag i {
  width: 1px;
  height: 14px;
  background: var(--border);
}
.brand-bg {
  background: var(--glow), var(--stripes), var(--bg-0);
}
.brand-icon {
  display: block;
  width: 100%;
  height: 100%;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text);
  font: 15px/1.4 var(--font);
}
/* Páginas avulsas (/status, /download): a página inteira rola, no PC e no celular. */
html.page-scroll {
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}
html.page-scroll body {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
}
a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
[hidden] {
  display: none !important;
}
svg {
  flex-shrink: 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn.small {
  padding: 5px 10px;
  font-size: 13px;
}
.btn.block {
  width: 100%;
}
.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover {
  background: var(--accent-2);
}
.btn.success {
  background: var(--success);
  color: #fff;
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.ghost {
  background: var(--bg-4);
}
.btn.ghost:hover {
  background: var(--bg-active);
}
.btn.left {
  margin-right: auto;
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--text-2);
}
.icon-btn:hover,
.icon-btn.on {
  background: var(--bg-hover);
  color: var(--text);
}
.icon-btn.off {
  color: var(--danger);
}
.icon-btn.tiny {
  width: 20px;
  height: 20px;
}
.icon-btn.tiny svg {
  width: 14px;
  height: 14px;
}
.icon-btn.danger-hover:hover {
  color: var(--danger);
}
.input,
.field input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  resize: vertical;
}
.input:focus,
.field input:focus {
  border-color: var(--accent);
}
.input.small {
  padding: 4px 8px;
  width: auto;
}
.input.big {
  font-size: 18px;
  padding: 14px;
}
.field {
  display: block;
  margin-bottom: 16px;
}
.field > span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
  margin-bottom: 8px;
}
.req {
  color: var(--danger);
}
.form-error,
.modal-error {
  color: var(--danger);
  font-size: 14px;
  margin: 0 0 12px;
}

/* ---------- autenticação ---------- */
#auth {
  height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(91, 108, 255, 0.35), transparent 60%),
    radial-gradient(900px 500px at 90% 90%, rgba(47, 182, 124, 0.22), transparent 60%), var(--bg-0);
  padding: 16px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-2);
  padding: 32px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card .field {
  text-align: left;
}
.auth-card .field small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.auth-forgot {
  display: block;
  text-align: left;
  margin: -6px 0 14px;
  color: var(--accent);
  font-size: 13px;
}
.form-info {
  color: var(--text-2);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  margin: 0 0 12px;
  text-align: left;
}
.auth-card h1 {
  margin: 8px 0 4px;
  font-size: 24px;
}
.auth-card > p {
  margin: 0 0 20px;
}
.auth-card .small {
  margin-top: 14px;
  text-align: left;
}
.auth-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
}
.auth-logo svg {
  width: 32px;
  height: 32px;
}

/* ---------- carregando ---------- */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-0);
  color: var(--muted);
  z-index: 50;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--bg-4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.small {
  width: 20px;
  height: 20px;
  border-width: 3px;
  margin: 12px auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#reconnect-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--warning);
  color: #1d1f26;
  padding: 6px 16px;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  font-size: 13px;
  z-index: 60;
}

/* ---------- barra de título (desktop) ---------- */
#titlebar {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-0);
  -webkit-app-region: drag;
  padding-left: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.titlebar-buttons {
  display: flex;
  -webkit-app-region: no-drag;
  height: 100%;
}
.titlebar-buttons button {
  width: 44px;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.titlebar-buttons svg {
  width: 14px;
  height: 14px;
}
.titlebar-buttons button:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.titlebar-buttons .close:hover {
  background: var(--danger);
  color: #fff;
}
body.desktop #app {
  height: calc(100% - 24px);
}

/* ---------- layout ---------- */
#app {
  display: flex;
  height: 100%;
}
#guild-bar {
  width: 72px;
  flex-shrink: 0;
  background: var(--bg-0);
  padding: 12px 0;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
#guild-bar::-webkit-scrollbar {
  display: none;
}
#sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
}
#right-panel {
  width: 264px;
  flex-shrink: 0;
  background: var(--bg-1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
#right-panel.search-panel {
  width: 380px;
}

/* ---------- barra de servidores ---------- */
.guild-item {
  position: relative;
  width: 72px;
  display: flex;
  justify-content: center;
}
.guild-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-3);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: border-radius 0.18s, background 0.18s, color 0.18s;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.guild-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.guild-icon.home {
  color: var(--text);
}
.guild-icon.action {
  color: var(--success);
}
.guild-item:hover .guild-icon,
.guild-item.active .guild-icon {
  border-radius: 16px;
  background: var(--accent);
  color: var(--on-accent);
}
.guild-item:hover .guild-icon.action {
  background: var(--success);
  color: #fff;
}
.guild-pill {
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 0;
  background: var(--text);
  border-radius: 0 4px 4px 0;
  transform: translateY(-50%);
  transition: height 0.18s;
}
.guild-item.unread .guild-pill {
  height: 8px;
}
.guild-item:hover .guild-pill {
  height: 20px;
}
.guild-item.active .guild-pill {
  height: 40px;
}
.guild-sep {
  width: 32px;
  height: 2px;
  background: var(--bg-3);
  border-radius: 1px;
}
.badge {
  position: absolute;
  right: 10px;
  bottom: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 3px solid var(--bg-0);
  box-sizing: content-box;
}
.badge.inline {
  position: static;
  border: 0;
  margin-left: auto;
}
.guild-voice {
  position: absolute;
  right: 10px;
  top: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: grid;
  place-items: center;
  border: 3px solid var(--bg-0);
  box-sizing: content-box;
}
.guild-voice svg {
  width: 12px;
  height: 12px;
}

/* ---------- barra lateral ---------- */
#sidebar-header {
  height: 48px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 10px;
}
.guild-name {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 4px;
}
.guild-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.guild-name:hover {
  background: var(--bg-hover);
}
.search-fake {
  width: 100%;
  background: var(--bg-0);
  border-radius: 4px;
  padding: 6px 8px;
  text-align: left;
  color: var(--muted);
  font-size: 13px;
}
#sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 8px 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.section-title .icon-btn {
  color: var(--muted);
}
.channel,
.nav-item,
.dm-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
  text-align: left;
}
.channel svg {
  width: 18px;
  height: 18px;
}
.channel:hover,
.nav-item:hover,
.dm-item:hover {
  background: var(--bg-hover);
  color: var(--text-2);
}
.channel.active,
.nav-item.active,
.dm-item.active {
  background: var(--bg-active);
  color: var(--text);
}
.channel.unread,
.dm-item.unread {
  color: var(--text);
  font-weight: 600;
}
.channel.unread::before {
  content: '';
  position: absolute;
  left: -8px;
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--text);
}
.channel.connected {
  color: var(--success);
}
.ch-name,
.dm-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-gear {
  display: none;
}
.channel:hover .ch-gear {
  display: inline-flex;
}
.nav-item {
  padding: 10px 8px;
  font-weight: 500;
}
.dm-item {
  padding: 5px 8px;
}
.call-ind {
  color: var(--success);
}
.call-ind svg {
  width: 16px;
  height: 16px;
}
.empty-hint {
  color: var(--muted);
  font-size: 13px;
  padding: 8px;
  text-align: center;
}
.voice-users {
  padding: 2px 0 6px 28px;
}
.voice-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
}
.voice-user:hover {
  background: var(--bg-hover);
}
.vu-avatar {
  border-radius: 50%;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 0.1s;
  display: inline-flex;
}
.vu-avatar.speaking,
.vt-avatar.speaking {
  box-shadow: 0 0 0 2px var(--success);
}
.vu-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vu-icon {
  color: var(--muted);
}
.vu-icon.off {
  color: var(--danger);
}
.vu-icon svg {
  width: 14px;
  height: 14px;
}
.live {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
}

#voice-panel {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  background: var(--bg-1);
}
.vp-row {
  display: flex;
  align-items: center;
}
.vp-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.vp-status {
  color: var(--success);
  font-weight: 700;
  font-size: 14px;
}
.vp-where {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vp-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.vp-btn {
  flex: 1;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--bg-3);
  border-radius: 6px;
  color: var(--text-2);
}
.vp-btn:hover {
  background: var(--bg-4);
}
.vp-btn.on {
  background: var(--success);
  color: #fff;
}
#user-panel {
  height: 54px;
  flex-shrink: 0;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 2px;
}
.up-me {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 6px;
  text-align: left;
}
.up-me:hover {
  background: var(--bg-hover);
}
.up-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.up-names b,
.up-names small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.up-names b {
  font-size: 14px;
}
.up-names small {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- avatar e presença ---------- */
.avatar {
  width: var(--size);
  height: var(--size);
  position: relative;
  flex-shrink: 0;
}
.avatar > img,
.avatar > span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: calc(var(--size) * 0.42);
}
.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: calc(var(--size) * 0.32 + 2px);
  height: calc(var(--size) * 0.32 + 2px);
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  border: 3px solid var(--bg-1);
  box-sizing: content-box;
}
.status-dot.static {
  position: static;
  width: 10px;
  height: 10px;
  border: 0;
  display: inline-block;
}
.s-online {
  background: var(--online);
}
.s-idle {
  background: var(--idle);
}
.s-dnd {
  background: var(--dnd);
}
.s-offline {
  background: var(--offline);
}

/* ---------- cabeçalho principal ---------- */
#main-header {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}
.h-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  flex-shrink: 0;
}
.h-title b {
  color: var(--text);
}
.h-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}
.h-topic {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.h-fill {
  flex: 1;
}
.h-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.h-search {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-0);
  border-radius: 4px;
  padding: 0 6px;
  height: 26px;
  color: var(--muted);
  margin-left: 4px;
}
.h-search svg {
  width: 14px;
  height: 14px;
}
.h-search input {
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  width: 140px;
  font: 13px var(--font);
  transition: width 0.2s;
}
.h-search input:focus {
  width: 220px;
}
.tab {
  padding: 2px 10px;
  border-radius: 4px;
  color: var(--text-2);
  font-weight: 500;
}
.tab:hover {
  background: var(--bg-hover);
}
.tab.active {
  background: var(--bg-active);
  color: var(--text);
}
.tab.add {
  background: var(--success);
  color: #fff;
}
.tab.add.active {
  background: none;
  color: var(--success);
}

#main-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- amigos ---------- */
.friends {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}
.friends h3 {
  margin: 8px 0 4px;
  text-transform: uppercase;
  font-size: 15px;
}
.add-friend {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  background: var(--bg-0);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.add-friend .input {
  border: 0;
  background: none;
}
.add-result {
  margin-top: 8px;
  font-size: 14px;
}
.add-result.ok {
  color: var(--success);
}
.add-result.err {
  color: var(--danger);
}
.friend-row,
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.friend-row:hover {
  background: var(--bg-hover);
}
.fr-names {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.fr-names small {
  color: var(--muted);
  font-size: 13px;
}
.fr-actions,
.mr-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.round-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-1);
  display: grid;
  place-items: center;
  color: var(--text-2);
}
.round-btn svg {
  width: 18px;
  height: 18px;
}
.round-btn:hover {
  color: var(--text);
}
.round-btn.ok:hover {
  color: var(--success);
}
.empty-state {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 32px;
}
.empty-state svg {
  width: 56px;
  height: 56px;
  opacity: 0.5;
}
.empty-state.small svg {
  width: 40px;
  height: 40px;
}

/* ---------- chat ---------- */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.messages-inner {
  padding: 16px 0 8px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.intro {
  padding: 16px 16px 8px;
}
.intro h1 {
  margin: 8px 0 4px;
  font-size: 30px;
}
.intro h3 {
  margin: 0 0 8px;
  color: var(--text-2);
  font-weight: 500;
}
.intro p {
  color: var(--muted);
  margin: 0;
}
.intro-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--bg-4);
  display: grid;
  place-items: center;
}
.intro-icon svg {
  width: 40px;
  height: 40px;
}
.loading-older {
  padding: 8px;
}
.day-divider {
  display: flex;
  align-items: center;
  margin: 16px 16px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.day-divider::before,
.day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.day-divider span {
  padding: 0 8px;
}
.msg {
  position: relative;
  padding: 2px 48px 2px 16px;
  margin-top: 14px;
}
.msg.grouped {
  margin-top: 0;
}
.msg:hover {
  background: var(--bg-hover);
}
.msg.mentioned {
  background: var(--mention-bg);
  box-shadow: inset 2px 0 0 var(--mention-bar);
}
.msg.replying {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.msg.flash {
  animation: flash 1.5s;
}
@keyframes flash {
  0%,
  60% {
    background: var(--accent-soft);
  }
}
.msg-row {
  display: flex;
  gap: 16px;
}
.msg-avatar {
  margin-top: 2px;
  height: 40px;
  border-radius: 50%;
}
.msg-hover-time {
  width: 40px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  visibility: hidden;
  line-height: 22px;
}
.msg:hover .msg-hover-time {
  visibility: visible;
}
.msg-body {
  flex: 1;
  min-width: 0;
}
.msg-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.msg-author {
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.msg-author:hover {
  text-decoration: underline;
}
.msg-time {
  font-size: 12px;
  color: var(--muted);
}
.role-crown {
  color: var(--warning);
  display: inline-flex;
  margin-left: 4px;
  vertical-align: middle;
}
.role-crown svg {
  width: 14px;
  height: 14px;
}
.role-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--on-accent);
  margin-left: 4px;
  vertical-align: middle;
}
.pinned-tag svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}
.msg-content {
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}
.msg-content.jumbo {
  font-size: 44px;
  line-height: 1.2;
}
.edited {
  font-size: 11px;
  color: var(--muted);
}
.mention {
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 500;
  cursor: pointer;
}
:root[data-theme='light'] .mention {
  color: var(--accent-2);
}
.mention:hover {
  background: var(--accent);
  color: var(--on-accent);
}
code.inline {
  background: var(--bg-0);
  padding: 1px 4px;
  border-radius: 4px;
  font: 0.88em var(--mono);
}
.code-block {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 4px 0;
  font: 13px/1.45 var(--mono);
  white-space: pre-wrap;
  max-width: 90%;
  overflow-x: auto;
}
blockquote {
  margin: 2px 0;
  padding-left: 12px;
  border-left: 4px solid var(--bg-4);
}
.spoiler {
  background: var(--bg-4);
  color: transparent;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
}
.spoiler.revealed {
  background: var(--bg-hover);
  color: inherit;
  user-select: auto;
}
.reply-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 20px;
  padding-left: 36px;
  position: relative;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}
.reply-ref::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 30px;
  height: 10px;
  border-left: 2px solid var(--bg-4);
  border-top: 2px solid var(--bg-4);
  border-top-left-radius: 6px;
}
.reply-ref b {
  color: var(--text-2);
}
.reply-ref span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-ref:hover span {
  color: var(--text);
}
.attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  align-items: flex-start;
}
.att-img img {
  max-width: min(400px, 100%);
  max-height: 320px;
  border-radius: 8px;
  display: block;
}
.att-video {
  max-width: min(480px, 100%);
  max-height: 320px;
  border-radius: 8px;
}
.att-file {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  max-width: 420px;
}
.att-file svg {
  width: 30px;
  height: 30px;
  color: var(--accent);
}
.att-file div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.att-file small {
  color: var(--muted);
}
.att-file audio {
  margin-top: 6px;
  max-width: 300px;
}
.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.reaction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--bg-1);
  border: 1px solid transparent;
  font-size: 15px;
}
.reaction span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.reaction:hover {
  border-color: var(--bg-4);
}
.reaction.mine {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.reaction.add {
  opacity: 0;
  color: var(--muted);
}
.reaction.add svg {
  width: 16px;
  height: 16px;
}
.msg:hover .reaction.add {
  opacity: 1;
}
.msg-actions {
  position: absolute;
  right: 16px;
  top: -16px;
  display: none;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.msg:hover .msg-actions {
  display: flex;
}
.msg-actions button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--text-2);
}
.msg-actions button svg {
  width: 18px;
  height: 18px;
}
.msg-actions button:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.msg-actions button.danger:hover {
  color: var(--danger);
}
.edit-box textarea {
  margin: 4px 0;
  resize: none;
}
.edit-box small {
  color: var(--muted);
}

/* ---------- composer ---------- */
.composer {
  padding: 0 16px;
  flex-shrink: 0;
  position: relative;
}
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--bg-3);
  border-radius: 8px;
  padding: 6px 8px;
  position: relative;
}
.composer-extra:not(:empty) {
  background: var(--bg-1);
  border-radius: 8px 8px 0 0;
}
.composer-extra:not(:empty) + .composer-box {
  border-radius: 0 0 8px 8px;
}
#composer-input {
  flex: 1;
  resize: none;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: 15px/1.4 var(--font);
  padding: 6px 4px;
  max-height: 300px;
}
.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
}
.reply-bar b {
  color: var(--text-2);
}
.pending-files {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}
.pending-file {
  position: relative;
  width: 140px;
  flex-shrink: 0;
  background: var(--bg-3);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.pending-file img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
}
.pending-file > svg {
  width: 40px;
  height: 80px;
  margin: 0 auto;
  color: var(--accent);
}
.pending-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-file small {
  color: var(--muted);
}
.pending-file .icon-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  background: var(--bg-1);
}
.typing {
  height: 24px;
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dots {
  display: inline-flex;
  gap: 3px;
}
.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-2);
  animation: bounce 1.2s infinite;
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes bounce {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: none;
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.autocomplete {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: var(--bg-1);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 5;
}
.ac-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px 6px;
}
.ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
}
.ac-item small {
  color: var(--muted);
}
.ac-item.sel,
.ac-item:hover {
  background: var(--bg-active);
}
.drop-hint {
  position: absolute;
  inset: 12px;
  border: 3px dashed var(--accent);
  border-radius: 12px;
  background: rgba(26, 27, 32, 0.85);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  z-index: 10;
  pointer-events: none;
}

/* ---------- voz ---------- */
.voice-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--glow), var(--stripes), #050608;
  min-height: 0;
}
.voice-grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
}
.voice-tile {
  position: relative;
  width: 320px;
  aspect-ratio: 16 / 9;
  background: var(--bg-3);
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.voice-tile.has-video {
  width: min(640px, 100%);
  background: #000;
}
.voice-tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.voice-tile.waiting::after {
  content: 'Conectando vídeo…';
  position: absolute;
  color: var(--muted);
}
.vt-avatar {
  border-radius: 50%;
  display: inline-flex;
  box-shadow: 0 0 0 3px transparent;
  transition: box-shadow 0.1s;
}
.vt-avatar.speaking {
  box-shadow: 0 0 0 3px var(--success);
}
.vt-name {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.vt-name svg {
  width: 14px;
  height: 14px;
  color: var(--danger);
}
.call-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
}
.cc-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text);
  display: grid;
  place-items: center;
}
.cc-btn:hover {
  background: var(--bg-4);
}
.cc-btn.on {
  background: var(--success);
  color: #fff;
}
.cc-btn.off {
  background: #fff;
  color: var(--danger);
}
.cc-btn.hang {
  background: var(--danger);
  color: #fff;
}
.call-area {
  background: var(--stripes), #050608;
  border-bottom: 1px solid var(--border);
}
.voice-grid.compact {
  padding: 16px 16px 0;
}
.voice-grid.compact .voice-tile {
  width: 220px;
}
.voice-grid.compact .voice-tile.has-video {
  width: 400px;
}

/* ---------- painel direito ---------- */
.rp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.rp-body {
  padding: 8px;
}
.member {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 6px;
  text-align: left;
}
.member:hover {
  background: var(--bg-hover);
}
.member.offline {
  opacity: 0.45;
}
.member.offline:hover {
  opacity: 1;
}
.m-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.m-names b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.m-names small {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-msg {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-2);
  margin-bottom: 8px;
  cursor: pointer;
}
.mini-msg:hover {
  background: var(--bg-3);
}
.mini-msg .msg-content {
  font-size: 14px;
}

/* ---------- perfil ---------- */
.profile-card {
  width: 300px;
  background: var(--bg-1);
  border-radius: 10px;
  overflow: hidden;
}
.profile-card.panel {
  width: 100%;
  border-radius: 0;
  min-height: 100%;
}
.pc-banner {
  height: 60px;
  background: var(--accent);
}
.pc-avatar {
  margin: -40px 0 0 16px;
  width: max-content;
  border-radius: 50%;
  border: 6px solid var(--bg-1);
}
.pc-avatar .status-dot {
  border-color: var(--bg-1);
}
.pc-main {
  padding: 8px 16px 16px;
}
.pc-main h3 {
  margin: 0;
  font-size: 20px;
}
.pc-main > p {
  margin: 0;
}
.pc-status {
  margin-top: 8px !important;
  font-size: 14px;
}
.pc-section {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 10px;
}
.pc-section h4 {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
}
.pc-section p {
  margin: 0;
  font-size: 14px;
  white-space: pre-wrap;
}
.pc-extra {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.pc-mod {
  display: flex;
  gap: 8px;
}

/* ---------- popouts, menus, modais, toasts ---------- */
.popout {
  position: fixed;
  z-index: 40;
  background: var(--bg-1);
  border-radius: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-height: calc(100vh - 16px);
  overflow-y: auto;
}
.popout.profile-pop {
  padding: 0;
}
.menu,
.status-picker {
  min-width: 220px;
  padding: 6px;
}
.status-picker {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sp-profile {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
}
.sp-profile div {
  display: flex;
  flex-direction: column;
}
.sp-profile small {
  color: var(--muted);
}
.status-picker .input {
  margin: 4px 0 6px;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-2);
  text-align: left;
}
.menu-item span {
  flex: 1;
}
.menu-item svg {
  width: 16px;
  height: 16px;
}
.menu-item:hover {
  background: var(--accent);
  color: var(--on-accent);
}
.menu-item.danger {
  color: var(--danger);
}
.menu-item.danger:hover {
  background: var(--danger);
  color: #fff;
}
.menu-item.checked {
  background: var(--bg-active);
  color: var(--text);
}
.menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}
.emoji-picker {
  width: 340px;
  padding: 8px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
}
.emoji-btn {
  font-size: 22px;
  padding: 4px;
  border-radius: 6px;
}
.emoji-btn:hover {
  background: var(--bg-active);
}
.pins {
  width: 420px;
  padding: 12px;
}
.pins h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 16px;
}
.pins-list {
  max-height: 60vh;
  overflow-y: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 16px;
  animation: fade 0.12s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg-2);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
  animation: pop 0.15s;
}
@keyframes pop {
  from {
    transform: scale(0.96);
  }
}
.modal.wide {
  max-width: 920px;
}
.modal h2 {
  margin: 0 0 6px;
  text-align: center;
  font-size: 22px;
}
.modal-sub {
  text-align: center;
  color: var(--muted);
  margin: 0 0 18px;
}
.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 20px -24px -24px;
  padding: 14px 24px;
  background: var(--bg-1);
}
.lightbox {
  max-width: 100%;
  max-height: 75vh;
  display: block;
  margin: 0 auto 8px;
  border-radius: 6px;
}
.copy-row {
  display: flex;
  gap: 8px;
}
.invite-preview {
  text-align: center;
}
.invite-preview h2 {
  margin: 4px 0;
}
.guild-icon.big {
  width: 80px;
  height: 80px;
  font-size: 26px;
  margin: 0 auto 8px;
  border-radius: 24px;
}
.guild-icon.editable,
.editable-avatar {
  cursor: pointer;
  border-radius: 50%;
}
.radio-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.radio-cards label {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-1);
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
}
.radio-cards label:has(input:checked) {
  background: var(--bg-active);
}
.radio-cards label div {
  display: flex;
  flex-direction: column;
}
.radio-cards small {
  color: var(--muted);
}
.row-gap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.settings {
  display: flex;
  min-height: 460px;
  margin: -24px;
}
.settings-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-1);
  padding: 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 10px 0 0 10px;
}
.settings-nav h5 {
  margin: 0 10px 8px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}
.settings-nav button {
  text-align: left;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--text-2);
}
.settings-nav button:hover {
  background: var(--bg-hover);
}
.settings-nav button.active {
  background: var(--bg-active);
  color: var(--text);
}
.settings-nav button.danger {
  color: var(--danger);
}
.settings-content {
  flex: 1;
  padding: 24px 32px;
  min-width: 0;
}
.settings-content h3 {
  margin-top: 0;
}
.settings-content h4 {
  margin: 24px 0 12px;
}
.account-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--bg-1);
  padding: 16px;
  border-radius: 8px;
}
.account-card h3 {
  margin: 0;
}
.account-card p {
  margin: 0;
}
.member-row {
  cursor: default;
}
.meter {
  height: 10px;
  background: var(--bg-0);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}
.meter-bar {
  height: 100%;
  width: 0;
  background: var(--success);
  transition: width 0.05s;
}
.quick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-list {
  max-height: 50vh;
  overflow-y: auto;
}
.quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  color: var(--text-2);
}
.quick-item small {
  margin-left: auto;
  color: var(--muted);
}
.quick-item.sel,
.quick-item:hover {
  background: var(--bg-active);
  color: var(--text);
}

#toast-root {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 70;
  align-items: center;
}
.toast {
  background: var(--bg-4);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  animation: pop 0.15s;
}
.toast-actions {
  display: flex;
  gap: 6px;
}

/* ---------- telas menores ---------- */
@media (max-width: 1000px) {
  #right-panel:not(.search-panel) {
    display: none;
  }
}
@media (max-width: 700px) {
  #sidebar {
    width: 200px;
  }
  #guild-bar {
    width: 60px;
  }
  .guild-item {
    width: 60px;
  }
  .guild-icon {
    width: 42px;
    height: 42px;
  }
  .h-search,
  .h-topic {
    display: none;
  }
  #right-panel.search-panel {
    position: fixed;
    inset: 0;
    width: auto;
    z-index: 20;
  }
}

/* ================= Identidade Poleia Team (PLTM) ================= */
::selection {
  background: rgba(255, 122, 26, 0.35);
}
:root[data-theme='light'] .mention {
  color: #a8480a;
}

/* Tipografia: Rajdhani nos títulos e rótulos, Russo One nos letreiros. */
h1,
h2,
h3,
h4,
.modal h2 {
  font-family: var(--heading);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.section-title,
.settings-nav h5,
.field > span,
.ac-title,
.pc-section h4 {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
}
.btn {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.btn.small {
  font-size: 13px;
}
.tab {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
}
.h-title b {
  font-family: var(--heading);
  font-size: 18px;
  letter-spacing: 0.02em;
}
.guild-name {
  font-family: var(--heading);
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.intro h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  text-transform: uppercase;
}
.intro-icon {
  background: var(--accent-soft);
  color: var(--accent);
}
.guild-icon > span {
  font-family: var(--display);
  font-size: 15px;
}

/* Login */
/* Login: faixa de luz laranja suave e larga vindo de cima, atrás do logo (o brilho no meio ficava escondido pelo cartão
   e só aparecia nas beiradas, marrom). Mais paradas no degradê para não formar faixas. */
#auth {
  background: radial-gradient(
      170% 50% at 50% 0%,
      rgba(255, 122, 26, 0.17),
      rgba(255, 122, 26, 0.11) 25%,
      rgba(255, 122, 26, 0.06) 50%,
      rgba(255, 122, 26, 0.02) 68%,
      transparent 80%
    ),
    var(--stripes), var(--bg-0);
}
.auth-card {
  /* sólido e sem desfoque: o que está atrás não aparece através do cartão (o desfoque falhava em celulares) */
  background: #0d1016;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
}
:root[data-theme='light'] .auth-card {
  background: #ffffff;
}
.auth-brand {
  margin: 4px 0 22px;
}
.auth-brand .brand-split {
  font-size: 48px;
}
.auth-brand .brand-tag {
  margin-top: 14px;
}
.auth-card h1 {
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Carregamento */
#loading {
  background: var(--glow), var(--stripes), var(--bg-0);
}
.loading-brand {
  font-size: 44px;
  text-align: center;
  animation: brand-pulse 1.6s ease-in-out infinite;
}
@keyframes brand-pulse {
  50% {
    opacity: 0.55;
  }
}
/* barra de progresso das etapas da abertura (setLoadingStep em app.js) */
.loading-progress {
  width: min(240px, 60vw);
  height: 4px;
  border-radius: 2px;
  background: var(--bg-4);
  overflow: hidden;
}
.loading-progress i {
  display: block;
  height: 100%;
  width: var(--p, 5%);
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.35s ease;
}
#loading p {
  min-height: 1.4em;
  text-align: center;
}

/* Barra de servidores */
#guild-bar {
  background: var(--stripes), var(--bg-0);
  border-right: 1px solid var(--border);
}
.guild-pill {
  background: var(--accent);
}
.guild-icon.home {
  background: transparent;
  overflow: visible;
}
.guild-item:hover .guild-icon.home,
.guild-item.active .guild-icon.home {
  background: transparent;
  box-shadow: 0 0 0 2px var(--accent);
}
.guild-icon.home .brand-icon {
  border-radius: inherit;
}
.guild-sep {
  background: var(--accent);
  opacity: 0.5;
}

/* Detalhes */
.channel.active {
  box-shadow: inset 2px 0 0 var(--accent);
}
.pc-banner {
  background: var(--glow), var(--stripes), #1c0e04;
  border-bottom: 2px solid var(--accent);
}
.modal {
  border-top: 3px solid var(--accent);
}
.toast {
  border-left: 3px solid var(--accent);
}
.empty-state svg {
  color: var(--accent);
}
#user-panel {
  border-top: 1px solid var(--border);
}
.titlebar-name {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.titlebar-name {
  display: flex;
  align-items: center;
}
.titlebar-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  margin-right: 8px;
}
.titlebar-name b {
  font-weight: 400;
  color: var(--text);
}

/* Tela cheia de lives e câmeras */
.vt-full {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.vt-full svg {
  width: 18px;
  height: 18px;
}
.voice-tile:hover .vt-full,
.vt-full:focus-visible {
  opacity: 1;
}
.vt-full:hover {
  background: var(--accent);
  color: var(--on-accent);
}
.voice-tile.has-video {
  cursor: pointer;
}
.voice-tile:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
  cursor: default;
}
.voice-tile:fullscreen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.voice-tile:fullscreen .vt-name {
  left: 16px;
  bottom: 16px;
  font-size: 15px;
}
.voice-tile:fullscreen .vt-full {
  top: 16px;
  right: 16px;
}
/* Em tela cheia os controles somem até o mouse se mexer sobre o vídeo. */
.voice-tile:fullscreen:not(:hover) .vt-name {
  opacity: 0;
  transition: opacity 0.4s 1.5s;
}

/* Supressão de ruído */
.vp-btn.noise.on {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--bg-1);
  cursor: pointer;
}
.switch-row.small {
  padding: 8px 12px;
  font-size: 13px;
  background: none;
}
.switch-row input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.switch-row span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.switch-row.small span {
  display: inline;
}
.switch-row small {
  color: var(--muted);
}

/* ================= Layout da tela inicial (amigos, Ativo agora, painéis) ================= */
/* Subtítulo de atividade: "Em voz", "Transmitindo ao vivo", status */
.activity {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.activity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.activity.act-voice {
  color: var(--success);
}
.activity.act-live {
  color: var(--accent);
}
.dm-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.dm-item {
  padding: 6px 8px;
}

/* Painel de voz */
.vp-row {
  gap: 6px;
}
.vp-signal {
  color: var(--success);
  display: grid;
}
.vp-signal svg {
  width: 18px;
  height: 18px;
}
.vp-where {
  display: flex;
  align-items: center;
  gap: 4px;
}
.vp-where svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.icon-btn.noise.on {
  color: var(--accent);
}
.vp-buttons .vp-btn {
  height: 34px;
}

/* Painel do usuário: microfone/fone com setinha de dispositivo */
.up-group {
  display: flex;
  align-items: center;
  border-radius: 6px;
}
.up-group:hover {
  background: var(--bg-hover);
}
.up-group .icon-btn:hover {
  background: none;
}
.icon-btn.chevron {
  width: 16px;
  margin-left: -4px;
}
.icon-btn.chevron svg {
  width: 13px;
  height: 13px;
}
.device-menu {
  max-width: 300px;
}
.menu-title {
  padding: 6px 10px 4px;
  font: 700 12px var(--heading);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Cabeçalho da tela de amigos */
.h-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  margin: 0 6px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
}
.tab .badge.inline {
  margin-left: 0;
}
.tab.add {
  background: var(--accent);
  color: var(--on-accent);
}
.tab.add:hover {
  background: var(--accent-2);
}
.tab.add.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Lista de amigos */
.friends {
  padding: 16px 20px 16px 30px;
}
.friends-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-bottom: 18px;
}
.friends-search:focus-within {
  border-color: var(--accent);
}
.friends-search svg {
  width: 18px;
  height: 18px;
}
.friends-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font: inherit;
}
.friends-count {
  font: 700 13px var(--heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px 8px;
}
.friend-row {
  margin: 0 -10px;
  padding: 10px;
  border-top: 1px solid var(--border);
  border-radius: 8px;
}
.friend-row:hover {
  border-top-color: transparent;
}
.friend-row:hover + .friend-row {
  border-top-color: transparent;
}
.fr-names b {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.fr-username {
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.1s;
}
.friend-row:hover .fr-username {
  opacity: 1;
}
.round-btn {
  background: var(--bg-1);
}
.friend-row:hover .round-btn {
  background: var(--bg-0);
}
.round-btn:hover {
  color: var(--accent);
}
.round-btn.ok:hover {
  color: var(--success);
}
.round-btn.danger:hover {
  color: var(--danger);
}

/* Ativo agora */
#right-panel.active-now {
  width: 340px;
  border-left: 1px solid var(--border);
}
.an-body {
  padding: 16px;
}
.an-title {
  font-family: var(--heading);
  font-size: 20px;
  margin: 4px 0 14px;
}
.an-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.an-card:hover {
  border-color: var(--accent);
  background: var(--bg-3);
}
.an-card.is-live {
  box-shadow: inset 3px 0 0 var(--accent);
}
.an-head,
.an-where {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
}
.an-where {
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}
.an-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.an-text b,
.an-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.an-text small {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}
.an-text small svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.an-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-3);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--display);
  font-size: 12px;
}
.an-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.an-stack {
  display: flex;
  align-items: center;
}
.an-av {
  margin-left: -8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg-1);
  display: inline-flex;
}
.an-av:first-child {
  margin-left: 0;
}
.an-more {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.an-here {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  border-top: 1px solid var(--border);
}
.an-empty {
  text-align: center;
  padding: 24px 8px;
}
.an-empty b {
  font-family: var(--heading);
  font-size: 17px;
}
.an-empty p {
  color: var(--muted);
  font-size: 13px;
}

/* App desktop: título da tela no centro da barra */
#titlebar {
  position: relative;
}
.titlebar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 50%;
  font: 600 12px var(--font);
  color: var(--text-2);
  pointer-events: none;
}
.titlebar-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.titlebar-title svg {
  width: 14px;
  height: 14px;
}
@media (max-width: 1000px) {
  #right-panel.active-now {
    display: none;
  }
}

/* Barra lateral mais larga: cabe o nome com os controles de microfone/fone. */
#sidebar {
  width: 272px;
}


/* Sensibilidade de entrada */
.sens-meter {
  --t: 50%;
  position: relative;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  margin: 8px 0 6px;
  /* abaixo do limite (laranja): não transmite; acima (verde): transmite */
  background: linear-gradient(to right, rgba(255, 122, 26, 0.28) 0 var(--t), rgba(47, 182, 124, 0.3) var(--t) 100%);
}
.sens-level {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(255, 255, 255, 0.22);
  transition: width 0.05s linear;
}
.sens-meter.open .sens-level {
  background: rgba(47, 182, 124, 0.75);
}
.sens-meter input[type='range'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: ew-resize;
}
.sens-meter input[type='range']:disabled {
  cursor: default;
}
.sens-meter input[type='range']::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}
.sens-meter input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 6px;
  height: 30px;
  border-radius: 3px;
  background: var(--text);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
}
.sens-meter input[type='range']::-moz-range-thumb {
  width: 6px;
  height: 30px;
  border: 0;
  border-radius: 3px;
  background: var(--text);
}
.sens-meter.auto input[type='range']::-webkit-slider-thumb {
  background: var(--muted);
}
.sens-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.sens-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--offline);
}
.sens-info.open .sens-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(47, 182, 124, 0.25);
}
.sens-info.open [data-sens-status] {
  color: var(--success);
}
.sens-value {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* Configurações de voz: dispositivos, volumes, teste e perfil de entrada */
.voice-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
}
.voice-grid2 .field > span {
  display: flex;
  justify-content: space-between;
}
.voice-grid2 output {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
input[type='range'].vol {
  width: 100%;
  accent-color: var(--accent);
  height: 22px;
}
.mic-test {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0 8px;
}
.mic-test .btn {
  flex-shrink: 0;
  min-width: 170px;
}
.mic-test .btn.danger {
  background: var(--danger);
  color: #fff;
}
.mic-bars {
  flex: 1;
  height: 26px;
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.mic-bars i {
  flex: 1;
  border-radius: 2px;
  background: var(--bg-4);
  transition: background 0.05s;
}
.mic-bars i.on {
  background: var(--text-2);
}
.mic-bars i.on.open {
  background: var(--success);
}
.settings-sep {
  height: 1px;
  background: var(--border);
  margin: 22px 0 6px;
}
.profile-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.profile-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.profile-opt:hover {
  background: var(--bg-hover);
}
.profile-opt input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.profile-opt span,
.toggle-row > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-opt small,
.toggle-row small {
  color: var(--muted);
  font-size: 13px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.custom-audio > .toggle-row:first-child,
.sens-block > .toggle-row:first-child {
  border-top: 0;
}
.toggle-row select.input {
  width: 210px;
  flex-shrink: 0;
}
/* Chave liga/desliga */
input.switch {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: var(--bg-4);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
input.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
input.switch:checked {
  background: var(--accent);
}
input.switch:checked::after {
  transform: translateX(18px);
}
@media (max-width: 760px) {
  .voice-grid2 {
    grid-template-columns: 1fr;
  }
}

/* Seletor de tela/aplicativo para transmitir (app desktop) */
.source-picker .sp-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.source-picker .sp-tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: 700 15px var(--heading);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px 10px;
  cursor: pointer;
  margin-bottom: -1px;
}
.source-picker .sp-tabs button span {
  font-size: 12px;
  background: var(--bg-4);
  color: var(--text-2);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
}
.source-picker .sp-tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.source-picker .sp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: min(52vh, 460px);
  overflow-y: auto;
  padding: 2px;
}
.source-picker .sp-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--bg-3);
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--text-2);
  min-width: 0;
}
.source-picker .sp-item:hover {
  background: var(--bg-4);
  color: var(--text);
}
.source-picker .sp-item.selected {
  border-color: var(--accent);
  background: var(--bg-active);
  color: var(--text);
}
.source-picker .sp-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: var(--bg-0);
  border-radius: 6px;
  overflow: hidden;
  color: var(--muted);
}
.source-picker .sp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.source-picker .sp-thumb svg {
  width: 32px;
  height: 32px;
}
.source-picker .sp-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  min-width: 0;
}
.source-picker .sp-name img {
  width: 16px;
  height: 16px;
  flex: none;
}
.source-picker .sp-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-picker .sp-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
  padding: 30px 0;
}

/* ---------- Cargos ---------- */
.role-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.role-chips h4 {
  width: 100%;
  margin: 6px 0 2px;
  font: 700 12px var(--heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  max-width: 100%;
}
.role-chip i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rc);
  flex: none;
}
.role-chip button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 0 2px;
  font-size: 14px;
  line-height: 1;
}
.role-chip button:hover {
  color: var(--danger);
}
.role-chip.add {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-2);
  padding: 4px 9px;
}
.role-chip.add:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.roles-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  margin-top: 14px;
}
.roles-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
}
.roles-list .btn.block {
  margin-bottom: 8px;
}
.role-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: none;
  border: 0;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.role-item i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}
.role-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-item small {
  color: var(--muted);
  font-size: 12px;
}
.role-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.role-item.active {
  background: var(--bg-active);
  color: var(--text);
}
.role-lock {
  font-size: 11px;
  opacity: 0.7;
}
.role-lock svg {
  width: 12px;
  height: 12px;
}
.role-editor {
  min-width: 0;
}
.re-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.re-head h4 {
  margin: 0;
  font: 700 20px var(--heading);
}
.re-move {
  display: flex;
  gap: 4px;
}
.re-move .icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.re-note {
  background: rgba(255, 176, 46, 0.08);
  border: 1px solid rgba(255, 176, 46, 0.3);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--text-2);
}
.re-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.re-color {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.re-color.none {
  background: repeating-linear-gradient(135deg, var(--bg-4) 0 4px, var(--bg-3) 4px 8px);
}
.re-color.on {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg-2) inset;
}
.re-colors input.re-custom {
  flex: none;
  width: 36px;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
.re-group {
  margin: 22px 0 4px;
  font: 700 12px var(--heading);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.toggle-row.danger b {
  color: var(--danger);
}
/* Barra de salvar presa no rodapé da janela enquanto rola as permissões. */
.re-actions {
  display: flex;
  gap: 10px;
  margin: 18px -32px -24px;
  position: sticky;
  bottom: -24px;
  padding: 14px 32px 24px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 18px rgba(0, 0, 0, 0.25);
}
.composer-box.locked {
  opacity: 0.6;
}
.composer-box.locked textarea {
  cursor: not-allowed;
}
@media (max-width: 720px) {
  .roles-layout {
    grid-template-columns: 1fr;
  }
}

/* ======================= celular e tablet ======================= */
/* Gavetas: até 760 px, servidores + canais à esquerda; até 1000 px, membros/busca/perfil à direita.
   O JS (setNav/setRight em app.js) liga as classes nav-open / right-open no #app. */
#drawer-backdrop,
.nav-toggle,
.search-toggle {
  display: none;
}
#app {
  height: 100dvh;
}

@media (max-width: 1000px) {
  #right-panel,
  #right-panel:not(.search-panel),
  #right-panel.search-panel,
  #right-panel.active-now {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 88vw);
    z-index: 26;
    transform: translateX(105%);
    transition: transform 0.22s ease;
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
    border-left: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #right-panel[hidden] {
    display: none !important;
  }
  #app.right-open #right-panel {
    transform: none;
  }
  #app.nav-open #drawer-backdrop,
  #app.right-open #drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.55);
    animation: fade 0.15s;
  }
  /* Busca vira um botão; o campo abre ocupando o cabeçalho. */
  #main-header {
    position: relative;
  }
  .h-search {
    display: none;
  }
  .search-toggle {
    display: inline-flex;
  }
  #main-header.searching .h-search {
    display: flex;
    position: absolute;
    left: 8px;
    right: 8px;
    top: 7px;
    height: 34px;
    margin: 0;
    z-index: 2;
    padding: 0 10px;
    border: 1px solid var(--accent);
  }
  #main-header.searching .h-search input {
    width: 100%;
    font-size: 16px;
  }
  .h-topic,
  .h-sep {
    display: none;
  }
  .modal.wide {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  #app {
    position: relative;
  }
  #guild-bar,
  #sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 26;
    transform: translateX(calc(-100% - 120px)); /* bem fora da tela (a lista de canais começa a 72 px da borda) */
    transition: transform 0.22s ease;
    visibility: hidden;
  }
  #guild-bar {
    left: 0;
    width: 72px;
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .guild-item {
    width: 72px;
  }
  #sidebar {
    left: 72px;
    width: min(300px, calc(100vw - 72px - 44px));
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.45);
  }
  #user-panel {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  #app.nav-open #guild-bar,
  #app.nav-open #sidebar {
    transform: none;
    visibility: visible;
  }
  #main {
    width: 100%;
  }
  .nav-toggle {
    display: inline-flex;
    flex-shrink: 0;
  }
  #main-header {
    padding: 0 6px 0 10px;
    gap: 6px;
  }
  .h-title {
    min-width: 0;
  }
  .h-title b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Amigos: em cima menu, título e nova conversa; embaixo a faixa de abas (rola se faltar espaço). */
  #main-header:has(.h-tabs) {
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    row-gap: 4px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  #main-header .h-tabs {
    order: 3;
    flex-basis: 100%;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #main-header .h-tabs .tab {
    flex-shrink: 0;
    padding-left: 8px;
    padding-right: 8px;
  }
  #main-header .tab {
    flex-shrink: 0;
  }
  #main-header .h-dot {
    display: none;
  }
  /* Mensagens e campo de texto */
  .msg {
    padding-left: 12px !important;
    padding-right: 10px !important;
  }
  .composer {
    padding: 0 8px calc(6px + env(safe-area-inset-bottom));
  }
  #composer-input {
    font-size: 16px; /* evita o zoom automático do iPhone ao tocar no campo */
  }
  .att-img img,
  .att-video {
    max-width: 100%;
  }
  /* Voz: quadros ocupam a largura toda */
  .voice-grid {
    padding: 10px;
    gap: 8px;
  }
  .voice-tile {
    width: 100%;
    max-width: 100%;
  }
  .call-controls {
    gap: 8px;
    padding: 12px 8px calc(12px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }
  /* Janelas viram tela cheia */
  .modal-backdrop {
    padding: 0;
    place-items: stretch;
  }
  .modal,
  .modal.wide {
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }
  /* Configurações: menu de seções vira uma faixa rolável no topo */
  .settings {
    flex-direction: column;
    margin: -20px -16px;
    min-height: 0;
  }
  .settings-nav {
    width: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
    margin-right: 44px; /* a faixa termina antes do X de fechar (não rola por baixo dele) */
    border-radius: 0;
    scrollbar-width: none;
    gap: 4px;
  }
  .settings-nav h5,
  .settings-nav .menu-sep {
    display: none;
  }
  .settings-nav button {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .settings-content {
    padding: 18px 16px;
  }
  .re-actions {
    margin: 18px -16px -24px;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .member-row {
    flex-wrap: wrap;
  }
  .mr-actions {
    width: 100%;
    justify-content: flex-end;
  }
  /* Perfil abre como uma folha embaixo da tela */
  .popout.profile-pop {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-height: 80dvh;
  }
  .popout {
    max-width: calc(100vw - 16px);
  }
  #toast-root {
    left: 8px;
    right: 8px;
    transform: none;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .toast {
    max-width: 100%;
  }
  /* Login: o link de baixar o app para Windows não faz sentido no celular */
  #auth-download {
    display: none;
  }
  .auth-card {
    padding: 24px 18px;
  }
}

/* Telas de toque: ações da mensagem aparecem ao tocar nela (não existe "passar o mouse"). */
@media (hover: none) {
  .msg:hover .msg-actions {
    display: none;
  }
  .msg.show-actions .msg-actions {
    display: flex;
  }
  .msg.show-actions {
    background: var(--bg-hover);
  }
  .msg-actions button {
    width: 40px;
    height: 40px;
  }
}
/* Tablet: lista de canais um pouco mais estreita para sobrar espaço para o chat. */
@media (min-width: 761px) and (max-width: 1000px) {
  #sidebar {
    width: 236px;
  }
}

/* ---------- Voz: controles por pessoa (perfil) ---------- */
.vu-icon.server,
.vt-icon.server {
  color: var(--danger);
  filter: drop-shadow(0 0 4px rgba(239, 79, 90, 0.6));
}
.vt-icon {
  display: inline-flex;
  color: var(--danger);
}
.vt-icon svg {
  width: 14px;
  height: 14px;
}
.pc-voice {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pc-voice h4 {
  margin: 0;
  font: 700 12px var(--heading);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pv-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-2);
}
.pv-row b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pv-volume {
  width: 100%;
  accent-color: var(--accent);
}
.pv-volume:disabled {
  opacity: 0.4;
}
.pc-voice .pv-toggle {
  padding: 6px 0;
  border-top: 0;
}
.pv-hint {
  font-size: 12px;
  line-height: 1.4;
}

/* ---------- Lives: prévia, assistir e som ---------- */
/* Prévia parada: só a foto da live (escurecida); o vídeo nunca aparece se mexendo na prévia. */
.voice-tile.preview video {
  opacity: 0;
}
.vt-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0.5);
}
.voice-tile.preview {
  cursor: pointer;
}
.vt-watch {
  position: absolute;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 15px var(--heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
.vt-watch:hover {
  background: var(--accent-2);
  transform: scale(1.04);
}
.vt-watch svg {
  width: 18px;
  height: 18px;
}
.vt-stream-ctl {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.voice-tile:hover .vt-stream-ctl,
.voice-tile:focus-within .vt-stream-ctl,
.voice-tile:fullscreen .vt-stream-ctl {
  opacity: 1;
}
@media (hover: none) {
  .vt-stream-ctl {
    opacity: 1;
  }
}
.vt-sbtn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #fff;
  cursor: pointer;
}
.vt-sbtn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.vt-sbtn svg {
  width: 16px;
  height: 16px;
}
.vt-svol {
  width: 90px;
  accent-color: var(--accent);
}
.vt-svol:disabled {
  opacity: 0.4;
}
.voice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px 0;
}
.vtb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
}
.pv-svolume {
  width: 100%;
  accent-color: var(--accent);
}
.pv-svolume:disabled {
  opacity: 0.4;
}
.sp-audio {
  margin-top: 12px;
}
.vtb-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

/* Menu da live (clique na transmissão de alguém) */
.live-menu {
  width: 260px;
  padding: 6px;
}
.live-menu h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 6px 8px;
  font: 700 13px var(--heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.live-menu h4 svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.live-menu h4 span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-menu .menu-item {
  width: 100%;
}
.lm-sound {
  margin-top: 6px;
  padding: 10px 6px 2px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lm-sound .pv-toggle {
  padding: 4px 0;
  border-top: 0;
}

/* ---------- Live em destaque: ocupa a área da chamada (só a barra do topo fica de fora) ---------- */
.voice-grid.focus {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: stretch;
  gap: 8px;
  padding: 8px 12px;
  overflow: hidden;
}
/* O quadro segue o formato da live (16:9) e cresce até encostar na largura ou na altura disponível:
   a imagem preenche o quadro inteiro, sem faixas pretas. */
.voice-grid.focus {
  container-type: size; /* o quadro da live se mede pela área da chamada */
}
.voice-grid.focus .voice-tile.focused {
  flex: none;
  /* o maior 16:9 que cabe: limitado pela largura (100%) ou pela altura disponível */
  width: calc(min(100%, calc(100cqh * 16 / 9)) * var(--tile-scale, var(--live-scale, 1)));
  aspect-ratio: 16 / 9;
  align-self: center;
  margin: auto 0;
  border-radius: 8px;
}
/* com a faixa de miniaturas embaixo, desconta a altura dela (miniatura 16:9 de 168 px + espaço) */
.voice-grid.focus:has(.vt-strip) .voice-tile.focused {
  width: calc(min(100%, calc((100cqh - 104px) * 16 / 9)) * var(--tile-scale, var(--live-scale, 1)));
  margin: auto 0 0;
}
.voice-grid.focus:has(.vt-strip) .vt-strip {
  margin-bottom: auto;
}
@media (max-width: 760px) {
  .voice-grid.focus:has(.vt-strip) .voice-tile.focused {
    width: calc(min(100%, calc((100cqh - 78px) * 16 / 9)) * var(--tile-scale, var(--live-scale, 1)));
  }
}
.voice-grid.focus .voice-tile.focused video,
.voice-grid.focus .voice-tile.focused .vt-frame {
  object-fit: contain;
}
/* Os outros participantes: faixa de miniaturas embaixo */
.vt-strip {
  flex: none;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  justify-content: center;
  padding-bottom: 2px;
}
.vt-strip .voice-tile,
.vt-strip .voice-tile.has-video {
  flex: none;
  width: 168px;
}
.vt-strip .vt-avatar .avatar {
  --size: 44px !important;
}
.vt-strip .vt-watch {
  padding: 6px 10px;
  font-size: 11px;
}
.vt-strip .vt-watch span {
  display: none; /* só o ícone na miniatura */
}
.vt-strip .vt-stream-ctl .vt-svol {
  display: none;
}
@media (max-width: 760px) {
  .vt-strip .voice-tile,
  .vt-strip .voice-tile.has-video {
    width: 120px;
  }
}

/* ---------- Lives: lado a lado, tamanho e arrastar ---------- */
/* Lado a lado: as transmissões dividem a largura (2 por linha) e seguem o tamanho escolhido. */
.voice-grid.lives-grid .voice-tile.has-video {
  width: calc((50% - 8px) * var(--tile-scale, var(--live-scale, 1)));
}
.voice-grid:not(.focus):not(.lives-grid):not(.fit) .voice-tile.has-video {
  width: calc(min(960px, 100%) * var(--tile-scale, var(--live-scale, 1)));
}
.vtb-live {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.vtb-seg {
  display: inline-flex;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.vtb-seg button {
  border: 0;
  background: none;
  color: var(--text-2);
  font: 700 12.5px var(--heading);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.vtb-seg button.on {
  background: var(--accent);
  color: var(--on-accent);
}
.vtb-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.vtb-size button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.vtb-size button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.vtb-size input {
  width: 110px;
  accent-color: var(--accent);
}
.vtb-size b {
  font-size: 12.5px;
  color: var(--text-2);
  min-width: 36px;
  font-variant-numeric: tabular-nums;
}
.voice-tile.dragging {
  opacity: 0.45;
}
.voice-tile.drop-target {
  outline: 3px dashed var(--accent);
  outline-offset: -3px;
}
@media (hover: none) {
  .voice-tile[draggable='true'] {
    -webkit-user-drag: none;
  }
}
@media (max-width: 760px) {
  .voice-grid.lives-grid .voice-tile.has-video {
    width: calc(100% * var(--tile-scale, var(--live-scale, 1)));
  }
  .vtb-size input {
    width: 80px;
  }
}

/* Alça no canto da live: arrastar muda o tamanho (sempre 16:9) */
.vt-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  z-index: 3;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.15s;
  background: linear-gradient(135deg, transparent 0 50%, var(--accent) 50% 58%, transparent 58% 68%, var(--accent) 68% 76%, transparent 76%);
  border-bottom-right-radius: 8px;
}
.voice-tile:hover .vt-resize,
.voice-tile.resizing .vt-resize {
  opacity: 1;
}
@media (hover: none) {
  .vt-resize {
    opacity: 0.85;
    width: 30px;
    height: 30px;
  }
}
.voice-tile.resizing {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  user-select: none;
}
.voice-tile:fullscreen .vt-resize {
  display: none;
}
/* o controle de som da live sobe um pouco para não ficar em cima da alça */
.voice-tile .vt-stream-ctl {
  right: 26px;
}
/* Cada quadro mantém o próprio formato: a linha não estica todos para a altura do maior. */
.voice-grid:not(.focus) {
  align-items: center;
}

/* Qualidade da live: menu de quem assiste e barra de quem transmite */
.lm-quality {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding: 10px 6px 4px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-2);
}
.lm-quality .vtb-seg {
  display: flex;
}
.lm-quality .vtb-seg button {
  flex: 1;
  padding: 5px 4px;
  font-size: 11.5px;
}
.lm-quality small {
  font-size: 11.5px;
  line-height: 1.35;
}
.vtb-quality {
  width: auto;
  height: 28px;
  padding: 0 8px;
  font-size: 13px;
}

/* Janela "Começar live": prévia da tela e configurações (básicas e avançadas) */
.start-live h4 {
  margin: 0;
  font: 700 15px var(--heading);
  color: var(--text);
}
.sl-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 34vh;
  margin: 0 auto 14px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.sl-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.sl-change {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.65);
}
.sl-settings > h4 {
  margin-bottom: 4px;
}
.sl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.sl-row > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sl-row small {
  color: var(--muted);
  font-size: 12px;
}
.sl-seg {
  display: inline-flex;
  flex: none;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.sl-seg button {
  border: 0;
  background: none;
  color: var(--text-2);
  font: 700 13px var(--heading);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.sl-seg button:hover {
  color: var(--text);
}
.sl-seg button.on {
  background: var(--accent);
  color: var(--on-accent);
}
.sl-advanced {
  margin-top: 12px;
}
.sl-advanced summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}
.sl-advanced summary::-webkit-details-marker {
  display: none;
}
.sl-advanced summary h4 {
  color: var(--accent);
}
.sl-advanced summary::after {
  content: '';
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}
.sl-advanced[open] summary::after {
  transform: rotate(-135deg);
}
.sl-custom {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}
.sl-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.sl-stepper button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.sl-stepper button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.sl-stepper input {
  width: 76px;
  text-align: center;
}
.sl-stepper input::-webkit-outer-spin-button,
.sl-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sl-stepper input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.sl-stepper span {
  color: var(--muted);
  font-size: 12.5px;
}
@media (max-width: 560px) {
  .sl-row {
    flex-direction: column;
    align-items: stretch;
  }
  .sl-row .switch {
    align-self: flex-start;
  }
}

/* Chamada sem live em destaque: sem rolagem; os quadros se ajustam (proporcionais, 16:9) para caber
   todos na área. O tamanho vem de fitGrid() (--fit-w) e o ajuste de tamanho da live multiplica por cima. */
.voice-grid.fit {
  overflow: hidden;
}
.voice-grid.fit .voice-tile,
.voice-grid.fit .voice-tile.has-video {
  width: var(--fit-w, 320px);
  max-width: 100%;
}
.voice-grid.fit .voice-tile.has-video {
  width: calc(var(--fit-w, 320px) * var(--tile-scale, var(--live-scale, 1)));
}
/* Miniaturas embaixo da live em destaque: encolhem para caber, sem rolagem lateral */
.vt-strip {
  overflow: hidden;
}
.vt-strip .voice-tile,
.vt-strip .voice-tile.has-video {
  flex: 0 1 168px;
  min-width: 0;
}
@media (max-width: 760px) {
  .vt-strip .voice-tile,
  .vt-strip .voice-tile.has-video {
    flex-basis: 120px;
  }
}

/* Quem está falando: borda verde no quadro inteiro (aparece também com câmera ou live) */
.voice-tile {
  outline: 3px solid transparent;
  outline-offset: -3px;
  transition: outline-color 0.12s;
}
.voice-tile.speaking {
  outline-color: var(--success);
}

/* Doação por Pix */
.guild-icon.donate {
  color: #ff6b8a;
}
.guild-icon.donate:hover {
  background: #ff6b8a;
  color: #fff;
}
.settings-nav button.donate {
  color: #ff6b8a;
}
.donate > p {
  margin: 0 0 12px;
}
.dn-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.dn-amounts button {
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  font: 700 13px var(--heading);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.dn-amounts button:hover {
  color: var(--text);
  border-color: var(--accent);
}
.dn-amounts button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.dn-pay {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: 200px;
}
.dn-qr {
  flex: none;
  width: 200px;
  padding: 8px;
  background: #fff;
  border-radius: 10px;
}
.dn-qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.dn-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dn-info textarea {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  word-break: break-all;
  resize: none;
}
@media (max-width: 560px) {
  .dn-pay {
    flex-direction: column;
    align-items: center;
  }
}

/* Administrador da plataforma: escudo ao lado do nome e registro de ações */
.role-shield {
  color: var(--accent);
  display: inline-flex;
  margin-left: 4px;
  vertical-align: middle;
}
.role-shield svg {
  width: 13px;
  height: 13px;
}
.admin-log {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  max-height: 320px;
  overflow-y: auto;
}
.admin-log span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}

/* Escolha de microfone e alto-falante: nome do aparelho e o tipo embaixo */
.dev-select {
  position: relative;
}
.dev-current {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.dev-current > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.dev-current small {
  color: var(--muted);
  font-weight: 500;
  font-size: inherit;
}
.dev-current svg,
.dev-opt > svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
}
.dev-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.dev-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.dev-opt:hover,
.dev-opt.on {
  background: var(--bg-hover);
}
.dev-opt > span {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.dev-opt b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-opt small,
.dev-item small {
  color: var(--muted);
  font-size: 12px;
}
.dev-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  flex-shrink: 0;
}
.dev-check svg {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}
.dev-item > span {
  display: grid;
  gap: 1px;
}

/* App desktop desatualizado: tela por cima de tudo até atualizar */
.force-update {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--glow), var(--stripes), var(--bg-0);
  -webkit-app-region: drag;
}
.fu-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 420px;
  padding: 32px 28px;
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow);
  -webkit-app-region: no-drag;
}
.fu-brand {
  font: 28px var(--display);
  letter-spacing: 0.02em;
}
.fu-brand b {
  color: var(--accent);
  font-weight: inherit;
}
.fu-card h2 {
  margin: 0;
  font: 700 20px var(--heading);
}
.fu-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.fu-card small {
  color: var(--muted);
  font-size: 12px;
}

/* "Jogando X": na lista de membros e no perfil */
.m-names .m-game {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-names .m-game b {
  display: inline;
  font-weight: 700;
  font-size: inherit;
  color: inherit;
}
.pc-game-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pc-game-row svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}
.pc-game-row span {
  display: grid;
}
.pc-game-row small {
  color: var(--muted);
}

/* Abas de amigos: no computador ficam em linha no cabeçalho, como antes. */
.h-tabs {
  display: contents;
}

/* Criador do PoleiaTalk: nome em gradiente, selo de estrela e perfil com faixa animada e anel no avatar */
[data-creator] {
  background: linear-gradient(90deg, #ffb35c, #ff7a1a 45%, #ffd27a 70%, #ff7a1a);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  animation: creator-shine 6s linear infinite;
}
.creator-badge {
  display: inline-flex;
  margin-left: 4px;
  vertical-align: middle;
  color: #ffb35c;
  filter: drop-shadow(0 0 4px rgba(255, 122, 26, 0.6));
}
.creator-badge svg {
  width: 14px;
  height: 14px;
}
.profile-card.creator .pc-banner {
  background: linear-gradient(120deg, #7a2e00, #ff7a1a 40%, #ffb35c 55%, #ff7a1a 70%, #7a2e00) !important;
  background-size: 300% 100% !important;
  animation: creator-shine 8s linear infinite;
}
.profile-card.creator .pc-avatar .avatar {
  border-radius: 50%;
  box-shadow: 0 0 0 3px #ff7a1a, 0 0 18px 4px rgba(255, 122, 26, 0.55);
}
.pc-creator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font: 700 12px var(--heading);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffd27a;
  background: rgba(255, 122, 26, 0.16);
  border: 1px solid rgba(255, 122, 26, 0.45);
}
.pc-creator svg {
  width: 13px;
  height: 13px;
  color: #ffb35c;
}
@keyframes creator-shine {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-creator],
  .profile-card.creator .pc-banner {
    animation: none;
  }
}

/* "Atividade" no topo da lista de membros: cartões de quem está jogando, ao vivo ou em chamada */
.act-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.act-head:hover {
  color: var(--text);
}
.act-chevron {
  display: inline-flex;
  transition: transform 0.15s;
}
.act-chevron svg {
  width: 14px;
  height: 14px;
}
.act-chevron.closed {
  transform: rotate(-90deg);
}
.act-list {
  display: grid;
  gap: 6px;
  margin: 2px 0 10px;
}
.act-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}
.act-card:hover {
  background: var(--bg-3);
}
.act-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.act-who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  min-width: 0;
}
.act-who > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.act-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.act-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}
.act-meta svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.act-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  font: 700 16px var(--display);
  color: #fff;
  background: linear-gradient(135deg, #ff7a1a, #b84a00);
}
.act-thumb svg {
  width: 22px;
  height: 22px;
}
.act-thumb.live {
  background: linear-gradient(135deg, #ef4f5a, #8f1d26);
}
.act-thumb.voice {
  background: linear-gradient(135deg, #2fb67c, #146b47);
}

/* Capas dos jogos: no cartão de Atividade e no perfil */
.act-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.act-thumb:has(img) {
  background: var(--bg-3);
}
.pc-game-cover {
  width: 40px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Atalhos do teclado (configurações) */
.kb-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.kb-top .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.kb-top .btn svg {
  width: 16px;
  height: 16px;
}
.kb-info {
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 122, 26, 0.4);
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 13px;
  color: var(--text-2);
}
/* Linha: títulos em cima; lista e teclas lado a lado na mesma altura; lixeira e interruptor
   centralizados com eles; explicação da ação embaixo. */
.kb-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  grid-template-areas:
    'l1 l2 . .'
    'act keys del on'
    'hint hint . .';
  align-items: center;
  column-gap: 14px;
  row-gap: 6px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.kb-l1 {
  grid-area: l1;
}
.kb-l2 {
  grid-area: l2;
}
.kb-action {
  grid-area: act;
  height: 42px;
  min-width: 0;
}
.kb-row .kb-keys {
  grid-area: keys;
}
.kb-del {
  grid-area: del;
}
.kb-on {
  grid-area: on;
}
.kb-hint {
  grid-area: hint;
  font-size: 12px;
}
.kb-hint:empty {
  display: none;
}
.kb-row.off .kb-action,
.kb-row.off .kb-keys,
.kb-row.off .kb-label,
.kb-row.off .kb-hint {
  opacity: 0.55;
}
.kb-label {
  font: 700 12px var(--heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.kb-keys {
  box-sizing: border-box;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 6px 6px 12px;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  min-width: 0;
}
.kb-keys b {
  font-family: var(--mono);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kb-keys.recording {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.kb-keys.recording b {
  color: var(--accent);
}
.kb-del svg {
  width: 18px;
  height: 18px;
}
@media (max-width: 760px) {
  .kb-top {
    flex-direction: column;
  }
  .kb-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      'l1 l1 l1'
      'act act act'
      'hint hint hint'
      'l2 l2 l2'
      'keys del on';
  }
}
/* Lista de ações dos atalhos: mesmo fundo e borda da caixa das teclas, com seta própria */
.kb-row .kb-action {
  appearance: none;
  background: var(--bg-3)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8594' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 12px center / 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 38px 0 12px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.kb-row .kb-action:focus {
  border-color: var(--accent);
  outline: none;
}
.kb-row .kb-action option {
  background: var(--bg-2);
  color: var(--text);
}

/* Bloquear e denunciar */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.link-btn:hover {
  color: var(--text);
  text-decoration: underline;
}
.link-btn.danger {
  color: var(--danger);
}
.link-btn svg {
  width: 14px;
  height: 14px;
}
.blocked-msg .msg-row {
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}
.blocked-icon svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.pc-safety {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.report-form {
  display: grid;
  gap: 12px;
}
.report-quote {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--border);
  border-radius: 6px;
  background: var(--bg-3);
  font-size: 13px;
  min-width: 0;
}
.report-quote span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}
.report-reasons {
  display: grid;
  gap: 6px;
}
.report-reason,
.report-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-3);
  cursor: pointer;
  font-size: 14px;
}
.report-reason:hover {
  background: var(--bg-hover);
}
.report-reason:has(input:checked) {
  outline: 1px solid var(--accent);
}
.report-block {
  background: none;
  padding: 0;
}
.danger-zone {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: 10px;
}
.danger-zone h4 {
  margin-top: 0;
}
.delete-list {
  margin: 8px 0 16px;
  padding-left: 18px;
}

/* Painel reserva da OVH (painel.js): login e aviso nas páginas /status e /admin */
.pl-login {
  display: grid;
  gap: 12px;
  max-width: 380px;
  margin: 40px auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
}
.pl-login h2 {
  margin: 0;
  font-family: var(--heading);
}
.pl-login p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}
.pl-login .pl-error {
  color: var(--danger);
}
.pa-painel {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 14px;
}
.pa-painel.down {
  border-left-color: var(--danger);
}

/* Lives indisponíveis (servidor das lives fora do ar) */
.lives-down {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 176, 46, 0.45);
  border-radius: 8px;
  background: rgba(255, 176, 46, 0.1);
  color: var(--text-2);
  font-size: 13.5px;
}
.lives-down svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--warning);
}
.lives-down b {
  color: var(--text);
}
.vp-btn.unavailable,
.cc-btn.unavailable {
  opacity: 0.4;
}

/* Menu de status: "Mostrar o jogo que estou jogando" */
.sp-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

/* Barra de status do celular por cima do app (app Android/iPhone com viewport-fit=cover): o topo de
   cada coluna desce a altura dela. No computador e no navegador env(safe-area-inset-top) é 0. */
#main-header,
#sidebar-header {
  box-sizing: content-box;
  padding-top: env(safe-area-inset-top);
}
#right-panel {
  padding-top: env(safe-area-inset-top);
}
@media (max-width: 760px) {
  #main-header:has(.h-tabs) {
    padding-top: calc(6px + env(safe-area-inset-top));
  }
  .modal-backdrop {
    padding-top: env(safe-area-inset-top);
  }
  .modal,
  .modal.wide {
    max-height: calc(100dvh - env(safe-area-inset-top));
    height: calc(100dvh - env(safe-area-inset-top));
  }
}
#auth {
  padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
/* Celular: o limite da sensibilidade vai para a linha de baixo em vez de espremer no canto. */
@media (max-width: 760px) {
  .sens-info {
    flex-wrap: wrap;
  }
  .sens-info [data-sens-status] {
    flex: 1 1 0;
    min-width: 0;
  }
  .sens-value {
    flex-basis: 100%;
    margin-left: 17px;
    white-space: nowrap;
  }
}
/* Configurações no celular: a faixa de abas tem a cor da própria janela e ocupa a largura toda (antes
   era um retângulo de outro tom que terminava antes do X), sem a barrinha de rolagem do Android. */
@media (max-width: 760px) {
  .settings-nav {
    background: transparent;
    margin-right: 0;
    padding-right: 56px;
    border-bottom: 1px solid var(--border);
    /* as abas somem suavemente antes do X (e mostram que dá para arrastar para o lado) */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent calc(100% - 48px));
    mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent calc(100% - 48px));
  }
  .settings-nav::-webkit-scrollbar {
    display: none;
  }
  .modal-close {
    z-index: 2;
  }
}

/* Mostrar/esconder senha (js/password-toggle.js) */
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input {
  width: 100%;
  padding-right: 44px;
}
.pw-wrap input::-ms-reveal {
  display: none; /* o Edge tem o próprio olho: fica só o nosso */
}
.pw-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.pw-eye:hover,
.pw-eye[aria-pressed='true'] {
  color: var(--text);
}
.pw-eye svg {
  width: 18px;
  height: 18px;
}
/* Celular: o painel com o seu nome (rodapé do menu) tem a cor do próprio menu e uma altura que soma o
   espaço da barra de gestos do Android/iPhone, em vez de espremer o conteúdo contra ela. */
@media (max-width: 760px) {
  #user-panel {
    background: var(--bg-1);
    height: auto;
    min-height: 54px;
    padding-top: 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}
