/* GG Call — acabamento da casca e da navegação (barra de servidores, barra de canais, topo,
   membros, amigos, painéis de voz/usuário, chamada e acesso). Carregado depois de features.css
   e antes de motion.css; aqui ficam só ajustes de layout, truncagem e estados. */

/* ---------- acesso */
.auth-screen { padding: 32px 24px; }
.auth-card { width: min(480px, 100%); padding: 32px; border-radius: 8px; margin: auto; }
.auth-card h1 { font-size: 1.5rem; line-height: 1.25; }
.auth-sub { margin: 8px 0 20px; font-size: 1rem; }
.auth-brand { margin-bottom: 20px; }
.auth-card .forgot { display: inline-block; margin: -10px 0 16px; font-size: 0.875rem; }
.auth-server { margin: 0 0 20px; }
.auth-server summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; border-radius: 4px; }
.auth-server summary::-webkit-details-marker { display: none; }
.auth-server summary::before { content: ''; width: 0; height: 0; border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.15s ease; }
.auth-server[open] summary::before { transform: rotate(90deg); }
.auth-server summary:hover { color: var(--text-strong); }
.auth-switch { margin-top: 10px; }
.auth-card .form-error { padding: 8px 12px; border-radius: 4px; background: rgba(237, 66, 69, 0.12); border-left: 3px solid var(--red); }
[data-theme='light'] .auth-screen { background: radial-gradient(1200px 600px at 20% 0%, #6d77f5, transparent), radial-gradient(900px 500px at 100% 100%, #4752c4, transparent), var(--brand); }
@media (max-height: 640px) {
  .auth-card { padding: 24px 32px; }
  .auth-brand { margin-bottom: 12px; }
  .auth-sub { margin: 4px 0 14px; }
  .auth-card .field { margin-bottom: 12px; gap: 6px; }
}

/* ---------- barra de servidores */
.rail { gap: 8px; padding: 12px 0; }
.rail-item { height: 48px; flex: none; align-items: center; }
.rail-pill { left: 0; width: 4px; border-radius: 0 4px 4px 0; }
.rail-item.unread .rail-pill { height: 8px; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.active .rail-pill { height: 40px; }
.rail-btn { width: 48px; height: 48px; flex: none; font-size: 1.0625rem; letter-spacing: -0.01em; }
.rail-btn.home { color: var(--text-strong); }
.rail-item.active .rail-btn.home, .rail-btn.home:hover { background: var(--brand); color: var(--on-brand); }
.rail-btn.add { background: var(--bg-chat); }
.rail-btn.has-icon:hover, .rail-item.active .rail-btn.has-icon { background: none; }
.rail-sep { width: 32px; height: 2px; margin: 0 auto; border-radius: 1px; background: var(--bg-active); }
[data-theme='light'] .rail-btn:not(.has-icon):not(:hover) { background: #fff; }
[data-theme='light'] .rail-item.active .rail-btn:not(.has-icon) { background: var(--brand); color: var(--on-brand); }
[data-theme='light'] .rail-btn.add:not(:hover) { background: #fff; }
.rail-item .badge { right: 6px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; font-size: 0.75rem; box-shadow: 0 0 0 4px var(--bg-rail); pointer-events: none; }
.rail-item .badge.live { min-width: 20px; padding: 0; }
.rail-btn:focus-visible { outline-offset: 2px; border-radius: 16px; }

/* ---------- barra de canais */
.sidebar-header { padding: 0; }
.guild-header-btn { padding: 0 12px 0 16px; border-radius: 0; font-size: 0.9375rem; line-height: 1.25; transition: background-color 0.12s ease; }
.guild-header-btn .icon { flex: none; transition: transform 0.18s ease; }
.guild-header-btn[aria-expanded='true'] .icon { transform: rotate(180deg); }
.guild-name { flex: 1; min-width: 0; text-align: left; }
.sidebar-header:has(.switcher-btn) { padding: 0 10px; }
.switcher-btn { height: 28px; font-size: 0.8125rem; transition: color 0.12s ease; }
.switcher-btn:hover { color: var(--text); }
.sidebar-scroll { padding: 8px 8px 16px 8px; }
/* barras de rolagem finas, que só aparecem com o ponteiro em cima */
.sidebar-scroll::-webkit-scrollbar, .side-panel::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb, .side-panel::-webkit-scrollbar-thumb { background-color: transparent; border-width: 2px; }
.sidebar-scroll:hover::-webkit-scrollbar-thumb, .side-panel:hover::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.35); }
[data-theme='light'] .sidebar-scroll:hover::-webkit-scrollbar-thumb, [data-theme='light'] .side-panel:hover::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.2); }

.section-head { gap: 4px; min-height: 40px; padding: 16px 8px 4px; align-items: flex-end; line-height: 16px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.section-head .icon-btn { width: 18px; height: 16px; border-radius: 3px; color: var(--text-muted); background: none; }
.section-head .icon-btn:hover { color: var(--text-strong); background: none; }
.section-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-count { flex: none; }
.section-head.member-group { justify-content: flex-start; gap: 4px; min-height: 0; padding: 20px 8px 4px; margin: 0; }
.section-head.member-group:first-child { padding-top: 16px; }
.section-head.member-group .section-name { flex: 0 1 auto; }

.section-head.category { padding: 16px 0 4px 0; }
.category-toggle { flex: 1; min-width: 0; gap: 2px; padding: 0; line-height: 16px; color: var(--text-muted); }
.category-toggle .icon { width: 12px; flex: none; margin: 0 2px 0 0; }
.section-head.category.collapsed .category-toggle .icon { transform: rotate(-90deg); }
.section-head.category .icon-btn { margin-right: 8px; }

.nav-row { position: relative; min-height: 32px; gap: 6px; padding: 0 8px; margin-top: 2px; font-size: 0.9375rem; font-weight: 500; line-height: 20px; }
.nav-row.channel { min-height: 34px; padding: 0 6px 0 8px; margin-top: 1px; }
.nav-row:not(.channel) { min-height: 42px; gap: 12px; }
.nav-main { gap: 6px; min-height: 32px; }
.nav-main > .icon:first-child { color: var(--text-muted); opacity: 0.9; }
.nav-row.active .nav-main > .icon:first-child, .nav-row.unread .nav-main > .icon:first-child, .nav-row:hover .nav-main > .icon:first-child { color: inherit; opacity: 1; }
.nav-main > .icon:last-child:not(:first-child) { color: var(--text-muted); }
.nav-row.unread::before { content: ''; position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--text-strong); }
.nav-row .badge.inline { flex: none; min-width: 16px; height: 16px; font-size: 0.6875rem; }
.nav-row.connected .nav-name { color: var(--green); }
.nav-row .nav-name { line-height: 20px; }
.nav-row .row-action { width: 20px; height: 20px; border-radius: 3px; opacity: 0; color: var(--text-muted); }
.nav-row .row-action:hover { background: none; color: var(--text-strong); }
.nav-row.active .row-action { opacity: 0; }
.nav-row:hover .row-action, .nav-row:focus-within .row-action, .nav-row .row-action:focus-visible { opacity: 1; }
.nav-row.dm .nav-name, .nav-row.dm .nav-title { display: block; }
.nav-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-name small { line-height: 16px; margin-top: 0; font-weight: 400; white-space: nowrap; }
.nav-row:not(.channel) > .icon:first-child { margin-left: 4px; }
.nav-row:not(.channel) .nav-name { font-weight: 500; }
.nav-row.unread:not(.channel) .nav-name, .nav-row.active:not(.channel) .nav-name { color: var(--text-strong); }

/* tópicos: recuados, sem ícone, com linha guia saindo do canal */
.channel-wrap { position: relative; }
.channel-wrap.is-thread .nav-row { margin-left: 28px; width: calc(100% - 28px); min-height: 30px; font-size: 0.875rem; }
.channel-wrap.is-thread .nav-main { min-height: 30px; }
.channel-wrap.is-thread::before { content: ''; position: absolute; left: 18px; top: -6px; width: 9px; height: calc(50% + 6px); border-left: 1px solid var(--text-muted); border-bottom: 1px solid var(--text-muted); border-bottom-left-radius: 8px; opacity: 0.45; pointer-events: none; }
.channel-wrap.is-thread:has(+ .channel-wrap.is-thread)::after { content: ''; position: absolute; left: 18px; top: 50%; bottom: -1px; border-left: 1px solid var(--text-muted); opacity: 0.45; pointer-events: none; }

/* participantes de voz */
.voice-user { position: relative; min-height: 30px; gap: 8px; padding: 3px 8px 3px 8px; margin: 1px 0 1px 28px; width: calc(100% - 28px); font-size: 0.875rem; line-height: 18px; }
button.voice-user { width: calc(100% - 28px); }
.voice-user .nav-name { flex: 1; min-width: 0; }
.voice-user-icons { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--text-muted); }
.voice-user .live-tag { flex: none; }
.live-tag { display: inline-flex; align-items: center; gap: 4px; height: 16px; padding: 0 6px; border-radius: 8px; font-size: 0.625rem; letter-spacing: 0.02em; line-height: 16px; white-space: nowrap; }
.live-tag.call { padding: 0 4px; background: var(--green); animation: none; }

/* painel de voz conectada */
.voice-panel { padding: 8px 8px 8px; border-bottom: 1px solid var(--border); }
.voice-status { gap: 2px; min-height: 36px; }
.voice-where { gap: 0; padding: 2px 4px; border-radius: 4px; }
.voice-where strong { min-width: 0; font-size: 0.875rem; line-height: 18px; white-space: nowrap; }
.voice-where strong span { overflow: hidden; text-overflow: ellipsis; }
.voice-where small { display: block; line-height: 16px; }
.voice-status .icon-btn { width: 32px; height: 32px; }
.voice-ping { height: 32px; justify-content: center; padding: 0 2px; border-radius: 4px; cursor: default; }
.voice-ping span:empty { display: none; }
.voice-note { margin: 2px 4px 0; line-height: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-actions { gap: 8px; margin-top: 8px; }

/* painel do usuário */
.user-panel { height: 52px; padding: 0 8px; gap: 0; }
.user-btn { margin-left: -4px; padding: 4px 4px 4px 4px; gap: 8px; margin-right: 4px; }
.user-names { flex: 1; line-height: 1.25; }
.user-names strong { font-size: 0.875rem; font-weight: 600; }
.user-names small { font-size: 0.75rem; }
.user-panel .icon-btn { width: 32px; height: 32px; }
.user-panel .avatar .status-dot, .sidebar .avatar .status-dot { border-color: var(--bg-sidebar); }
.user-panel .avatar .status-dot { border-color: var(--bg-account); }
.group-avatar { color: #fff; }

/* ---------- topo */
.topbar { gap: 8px; padding: 0 8px 0 16px; }
.topbar-title { gap: 8px; }
.topbar-title > .icon:first-child, .topbar-title > .avatar:first-child { flex: none; color: var(--text-muted); }
.topbar-title h1 { flex: 0 1 auto; min-width: 48px; max-width: 60%; font-size: 1rem; font-weight: 600; line-height: 20px; }
.topbar-title.home { flex: none; }
.topbar-title.home h1 { max-width: none; overflow: visible; }
.topbar-title .crumb { flex: 0 1 auto; min-width: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title > .icon:not(:first-child) { flex: none; color: var(--text-muted); }
.topbar-lock { display: inline-flex; flex: none; color: var(--text-muted); }
.topic { flex: 1 1 0; min-width: 0; margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--bg-active); line-height: 20px; }
.topbar-divider { flex: none; width: 1px; height: 24px; margin: 0 8px; background: var(--bg-active); }
.topbar-tools { gap: 8px; }
.topbar .icon-btn { width: 32px; height: 32px; color: var(--text-channel); }
.topbar .icon-btn:hover { background: none; color: var(--text-strong); }
.topbar .icon-btn.on { background: none; color: var(--text-strong); }
.search-box { margin-left: 4px; }
.search-input { width: 144px; height: 24px; padding: 0 26px 0 8px; border-radius: 4px; background: var(--bg-rail); color: var(--text-strong); transition: width 0.25s var(--ease-out, ease); }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus, .search-input:not(:placeholder-shown) { width: 240px; }
.search-input:focus { outline: none; box-shadow: 0 0 0 1px var(--brand); }
[data-theme='light'] .search-input { background: var(--bg-input); }
@media (max-width: 1100px) {
  .search-input:focus, .search-input:not(:placeholder-shown) { width: 180px; }
}

/* abas de amigos no topo */
.people-tabs { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; border: 0; overflow: hidden; }
.people-tabs .tab { flex: none; height: 24px; padding: 0 8px; border: 0; border-radius: 4px; font-size: 0.9375rem; font-weight: 500; line-height: 24px; color: var(--text-channel); white-space: nowrap; }
.people-tabs .tab:hover { background: var(--bg-hover); color: var(--text); }
.people-tabs .tab.active { background: var(--bg-active); color: var(--text-strong); border: 0; }
.people-tabs .tab .badge { min-width: 16px; height: 16px; font-size: 0.6875rem; }
.people-tabs .tab.accent { background: var(--green); color: #fff; }
.people-tabs .tab.accent:hover { background: #2f8a4c; color: #fff; }
.people-tabs .tab.accent.active { background: none; color: var(--green); }
@media (max-width: 1000px) {
  .people-tabs { gap: 4px; }
  .people-tabs .tab { padding: 0 6px; font-size: 0.875rem; }
}

/* ---------- conteúdo */
.main { min-width: 0; }
.content { min-width: 0; }

/* ---------- amigos */
.people { padding: 16px 20px 0 30px; }
.people-list { padding-right: 10px; margin-right: -10px; }
.people .section-head.people-count { min-height: 0; padding: 0 10px 0 10px; margin: 0 0 8px; line-height: 16px; }
.person { position: relative; gap: 12px; min-height: 62px; padding: 0 10px; margin: 0; border-top: 1px solid var(--bg-active); border-radius: 8px; transition: background-color 0.1s ease; }
.person:hover, .person:focus-within { background: var(--bg-hover); border-top-color: transparent; }
.person:hover + .person, .person:focus-within + .person { border-top-color: transparent; }
.person-main { align-self: stretch; padding: 8px 0; border-radius: 4px; }
.person-names { gap: 2px; }
.person-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.person-line strong { min-width: 0; font-size: 0.9375rem; font-weight: 600; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-username { flex: none; max-width: 40%; font-size: 0.8125rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity 0.1s ease; }
.person:hover .person-username, .person:focus-within .person-username { opacity: 1; }
.person-names small { font-size: 0.8125rem; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-actions { gap: 10px; margin-left: 8px; }
.person .btn.person-round { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: var(--bg-sidebar); color: var(--text-channel); font-size: 0; gap: 0; flex: none; }
.person .btn.person-round:hover { color: var(--text-strong); background: var(--bg-rail); }
.person:hover .btn.person-round, .person:focus-within .btn.person-round { background: var(--bg-rail); }
[data-theme='light'] .person .btn.person-round { background: var(--bg-input); }
[data-theme='light'] .person:hover .btn.person-round { background: #fff; }
.person .btn.person-round.accept:hover { color: var(--green); }
.person .btn.person-round.decline:hover { color: var(--red); }
.people-title { margin: 4px 0 8px; font-size: 1rem; font-weight: 700; line-height: 20px; }
.people-sub { margin: 0 0 16px; font-size: 0.875rem; color: var(--text-channel); }
.people.add .people-list { padding-bottom: 16px; }
.people-add-form { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 0; margin-bottom: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-rail); }
.people-add-form:focus-within { border-color: var(--brand); }
.people-add-form .input { flex: 1; min-width: 0; min-height: 50px; padding: 0 12px; border: 0; background: none; box-shadow: none; font-size: 1rem; }
.people-add-form .input:focus { box-shadow: none; }
.people-add-form .btn { flex: none; min-height: 32px; padding: 0 16px; white-space: nowrap; }
[data-theme='light'] .people-add-form { background: #fff; }
.people.add .people-list > div > .person { min-height: 56px; }
.people .empty-state { margin: auto; }
.people-list:has(> .empty-state) { display: flex; flex-direction: column; }

/* ---------- painel lateral: membros, busca e fixadas */
.side-panel { width: 240px; padding: 0 8px 16px; }
.side-panel.search { width: 360px; padding: 0 12px 16px; }
@media (max-width: 1100px) { .side-panel.search { width: 300px; } }
/* Em janelas estreitas a busca/fixadas flutua sobre o chat em vez de espremê-lo. */
@media (max-width: 1000px) {
  .content { position: relative; }
  .side-panel.search { position: absolute; top: 0; right: 0; bottom: 0; z-index: 5; width: min(340px, 100%); box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3); }
}
.side-head { position: sticky; top: 0; z-index: 1; min-height: 48px; gap: 8px; padding: 8px 4px 8px 8px; margin: 0 -12px 8px; padding-left: 20px; padding-right: 12px; background: var(--bg-sidebar); box-shadow: 0 1px 0 var(--border); }
.side-head h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9375rem; }
.side-head .icon-btn { flex: none; }
.member { gap: 12px; min-height: 42px; padding: 0 8px; margin: 1px 0; }
.member .avatar .status-dot { border-color: var(--bg-sidebar); }
.member:hover .avatar .status-dot { border-color: var(--bg-sidebar); }
.member-text { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.member-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.member-name { min-width: 0; font-size: 0.9375rem; font-weight: 500; line-height: 20px; color: var(--text-channel); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member:hover .member-name:not([style*='color']) { color: var(--text); }
.owner-tag { display: inline-flex; flex: none; color: #f0b232; }
.member small.member-sub { display: block; min-width: 0; font-size: 0.75rem; line-height: 16px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-sub .icon { display: inline-block; vertical-align: -2px; margin-right: 4px; }
.member.offline { opacity: 0.4; }
.member.offline:hover { opacity: 1; }

.search-result { margin-bottom: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-chat); overflow: hidden; }
.search-result:hover { border-color: var(--brand); }
.result-main { gap: 4px; padding: 10px 12px; min-width: 0; }
.result-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 0.75rem; line-height: 16px; color: var(--text-muted); }
.result-channel { min-width: 0; font-weight: 600; color: var(--text-channel); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-time { flex: none; white-space: nowrap; }
.result-time::before { content: '·'; margin-right: 6px; }
.result-author { min-width: 0; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-text { line-height: 1.375; color: var(--text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.result-action { flex: none; margin: 6px 6px 0 0; }

/* ---------- estados vazios e carregamento */
.empty-state { gap: 8px; padding: 32px 16px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; line-height: 20px; }
.empty-state p { line-height: 18px; text-wrap: balance; }
.empty-state .btn { margin-top: 8px; }
.empty-icon { width: 72px; height: 72px; margin-bottom: 8px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-sidebar); color: var(--text-muted); }
.side-panel .empty-icon { background: var(--bg-chat); width: 64px; height: 64px; }
.side-panel .empty-state { padding: 40px 12px; }
.spinner-wrap { padding: 24px 16px; }

/* ---------- chamada */
.callview { background: #000; }
.call-stage { padding: 16px 16px 8px; }
.call-stage > .empty-state h3 { color: #fff; }
.call-stage > .empty-state p { color: #b5bac1; }
.call-stage > .empty-state .empty-icon { background: #232428; color: #b5bac1; }
.call-grid { gap: 8px; align-content: center; justify-items: center; }
.call-grid > .tile { width: 100%; max-height: 100%; }
.call-grid:has(> .tile:only-child) > .tile { max-width: min(100%, 960px); }
.tile { background: #232428; border-radius: 8px; border: 0; box-shadow: none; }
.tile.speaking { box-shadow: inset 0 0 0 2px var(--green), 0 0 0 1px var(--green); }
.tile:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.tile-label { left: 8px; bottom: 8px; max-width: calc(100% - 16px); height: 24px; gap: 6px; padding: 0 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); font-size: 0.8125rem; font-weight: 600; line-height: 24px; color: #fff; }
.tile-label .tile-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-label .icon, .tile-label .live-tag { flex: none; }
.tile-label .icon { color: #f23f43; }
.call-strip { height: 112px; }
.call-strip .tile { aspect-ratio: 16 / 9; }
.call-controls { gap: 16px; padding: 12px 16px 24px; align-items: center; }
.round-btn { width: 56px; height: 56px; flex: none; background: #2b2d31; color: #fff; }
.round-btn:hover { background: #3a3c42; }
.round-btn.off { background: #fff; color: var(--red); }
.round-btn.off:hover { background: #e3e5e8; }
.round-btn.on { background: #fff; color: #000; }
.round-btn.on:hover { background: #e3e5e8; }
.round-btn.hangup { width: 64px; background: var(--red); border-radius: 28px; margin-left: 8px; }
.round-btn.hangup:hover { background: #c93b3e; }
.call-controls .btn.success { min-height: 44px; padding: 0 24px; border-radius: 22px; }
@media (max-height: 600px) {
  .call-controls { padding: 8px 16px 14px; gap: 12px; }
  .round-btn { width: 48px; height: 48px; }
  .round-btn.hangup { width: 56px; }
}

/* ---------- barra de título */
.native .titlebar { height: var(--titlebar-h); font-size: 0.6875rem; }
