/* ==========================================================================
   FILA HUB 4 - layout de 4 colunas (servidores · canais · conversa · membros)
   Tema escuro fixo, neutros puxados para o roxo da Filadélfia.
   ========================================================================== */

:root {
    color-scheme: dark;

    --bg-0: #0f0e12;
    --bg-1: #16141a;
    --bg-2: #1d1a22;
    --bg-3: #26222c;
    --bg-4: #312c38;
    --line: rgba(236, 228, 248, 0.07);
    --line-2: rgba(236, 228, 248, 0.13);

    --fg: #ece8f1;
    --fg-2: #b6aec1;
    --fg-3: #847b90;

    --accent: #9a5ac6;
    --accent-2: #b37ddb;
    --accent-soft: rgba(154, 90, 198, 0.16);
    --ok: #3aa565;
    --warn: #d9a23c;
    --bad: #d9534f;
    --speak: #3fbf73;

    --f-body: "Archivo", -apple-system, "Segoe UI", Roboto, sans-serif;
    --f-display: "Big Shoulders Display", "Archivo Narrow", "Arial Narrow", sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

    --r-sm: 4px;
    --r-md: 8px;
}

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

html,
body {
    height: 100%;
}

body.hub {
    background: var(--bg-0);
    color: var(--fg);
    font: 15px/1.45 var(--f-body);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

a {
    color: var(--accent-2);
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-4);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-track {
    background: transparent;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-4) transparent;
}

/* ---------- Estrutura ---------- */

.app {
    display: grid;
    grid-template-columns: 72px 248px minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
}

/* ---------- Coluna de servidores ---------- */

.guilds {
    background: var(--bg-0);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    overflow-y: auto;
    scrollbar-width: none;
}

.guilds::-webkit-scrollbar {
    display: none;
}

.guild-home img {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: block;
    transition: border-radius 0.15s;
}

.guild-home:hover img {
    border-radius: 18px;
}

.guild-sep {
    width: 32px;
    height: 2px;
    background: var(--line-2);
    border-radius: 2px;
}

.guild-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guild {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-3);
    display: grid;
    place-items: center;
    font-family: var(--f-display);
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.02em;
    color: var(--fg);
    transition: border-radius 0.15s, background 0.15s;
}

.guild img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.guild:hover,
.guild.active {
    border-radius: 16px;
    background: var(--c, var(--accent));
}

.guild::before {
    content: "";
    position: absolute;
    left: -12px;
    width: 4px;
    height: 0;
    border-radius: 0 4px 4px 0;
    background: var(--fg);
    transition: height 0.15s;
}

.guild.unread::before {
    height: 8px;
}

.guild:hover::before {
    height: 20px;
}

.guild.active::before {
    height: 40px;
}

.guild.offline {
    opacity: 0.7;
}

.guild .badge {
    position: absolute;
    right: -4px;
    bottom: -4px;
    border: 3px solid var(--bg-0);
}

.guild-voice {
    position: absolute;
    right: -4px;
    top: -4px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    font-size: 10px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
    border: 3px solid var(--bg-0);
    box-sizing: content-box;
}

.guild-add {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-3);
    color: var(--ok);
    font-size: 18px;
    transition: border-radius 0.15s, background 0.15s, color 0.15s;
}

.guild-add:hover {
    border-radius: 16px;
    background: var(--ok);
    color: #fff;
}

.badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--bad);
    color: #fff;
    font: 700 11px/18px var(--f-body);
    text-align: center;
    font-style: normal;
}

/* ---------- Coluna de canais ---------- */

.sidebar {
    background: var(--bg-1);
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.server-header {
    height: 52px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    transition: background 0.12s;
}

.server-header:hover,
.server-header.open {
    background: var(--bg-3);
}

.server-header-name {
    font-family: var(--f-display);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.server-header i {
    font-size: 12px;
    color: var(--fg-2);
    transition: transform 0.15s;
}

.server-header.open i {
    transform: rotate(180deg);
}

.server-menu {
    position: absolute;
    top: 56px;
    left: 10px;
    right: 10px;
    z-index: 30;
    background: var(--bg-0);
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
    padding: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.server-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    font-size: 14px;
    color: var(--fg-2);
    text-align: left;
}

.server-menu button i {
    width: 16px;
    text-align: center;
}

.server-menu button:hover {
    background: var(--accent);
    color: #fff;
}

.server-menu button.danger {
    color: var(--bad);
}

.server-menu button.danger:hover {
    background: var(--bad);
    color: #fff;
}

.server-stats {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--fg-3);
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid var(--line);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}

.dot.on {
    background: var(--ok);
}

.dot.wait {
    background: var(--warn);
}

.channel-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 8px 16px;
}

.cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 8px 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fg-3);
}

.cat-add {
    color: var(--fg-3);
    font-size: 12px;
    padding: 2px 4px;
}

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

.ch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin: 1px 0;
    border-radius: var(--r-sm);
    color: var(--fg-3);
    cursor: pointer;
    position: relative;
    user-select: none;
}

.ch:hover {
    background: var(--bg-3);
    color: var(--fg-2);
}

.ch.active {
    background: var(--bg-4);
    color: var(--fg);
}

.ch.unread {
    color: var(--fg);
}

.ch.unread .ch-name {
    font-weight: 700;
}

.ch.unread::before {
    content: "";
    position: absolute;
    left: -8px;
    width: 4px;
    height: 8px;
    border-radius: 0 4px 4px 0;
    background: var(--fg);
}

.ch.joined {
    color: var(--fg);
}

.ch.joined .ch-icon {
    color: var(--ok);
}

.ch-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex: none;
}

.ch-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.ch-count {
    font: 500 11px var(--f-mono);
    color: var(--fg-3);
    background: var(--bg-0);
    padding: 1px 6px;
    border-radius: 9px;
    font-variant-numeric: tabular-nums;
}

.ch-del {
    display: none;
    color: var(--fg-3);
    font-size: 12px;
    padding: 2px;
}

.ch:hover .ch-del {
    display: block;
}

.ch-del:hover {
    color: var(--bad);
}

.ch-users {
    padding: 2px 0 6px 26px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ch-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    font-size: 14px;
    color: var(--fg-2);
    cursor: pointer;
}

.ch-user:hover {
    background: var(--bg-3);
    color: var(--fg);
}

.ch-user-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.off {
    color: var(--bad);
    font-size: 12px;
}

.live-chip {
    background: var(--bad);
    color: #fff;
    font: 800 10px/1 var(--f-body);
    letter-spacing: 0.04em;
    padding: 3px 5px;
    border-radius: 3px;
}

/* Avatar */

.avatar {
    --c: var(--accent);
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 50%;
    background: var(--c);
    color: #fff;
    display: inline-grid;
    place-items: center;
    font-family: var(--f-display);
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
    transition: box-shadow 0.1s;
}

.avatar.sm {
    width: 24px;
    height: 24px;
    font-size: 13px;
}

.avatar.xl {
    width: 80px;
    height: 80px;
    font-size: 36px;
}

.avatar.speaking,
.speaking > .avatar {
    box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--speak);
}

/* Painel de voz conectada */

.voice-panel {
    flex: none;
    background: var(--bg-0);
    border-top: 1px solid var(--line);
    padding: 10px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.voice-panel-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-panel-status {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

#vp-status {
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

#vp-status.ok {
    color: var(--ok);
}

#vp-status.wait {
    color: var(--warn);
}

.vp-where {
    font-size: 12px;
    color: var(--fg-3);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vp-where:hover {
    color: var(--fg);
    text-decoration: underline;
}

.voice-panel-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    grid-auto-flow: column;
    gap: 8px;
}

.vp-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    border-radius: var(--r-sm);
    background: var(--bg-3);
    color: var(--fg-2);
    font-size: 13px;
    font-weight: 600;
}

.vp-action:hover {
    background: var(--bg-4);
    color: var(--fg);
}

.vp-action.live {
    background: var(--bad);
    color: #fff;
}

/* Barra do usuário */

.icon-btn {
    width: 32px;
    height: 32px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    color: var(--fg-2);
    font-size: 15px;
    position: relative;
}

.icon-btn:hover {
    background: var(--bg-4);
    color: var(--fg);
}

.icon-btn.off {
    color: var(--bad);
}

.icon-btn.on {
    color: var(--fg);
}

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

.userbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: #121116;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.userbar-me {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: var(--r-sm);
    text-align: left;
}

.userbar-me:hover {
    background: var(--bg-3);
}

.userbar-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.userbar-text strong {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.userbar-text small {
    font-size: 12px;
    color: var(--fg-3);
}

.userbar-buttons {
    display: flex;
}

/* ---------- Área principal ---------- */

.main {
    background: var(--bg-2);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.topbar {
    height: 52px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid var(--line);
    min-width: 0;
}

.topbar-icon {
    color: var(--fg-3);
    font-size: 18px;
}

.topbar-title {
    font-size: 16px;
    white-space: nowrap;
}

.topbar-topic {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    color: var(--fg-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 12px;
    margin-left: 4px;
    border-left: 1px solid var(--line-2);
}

.topbar-topic:empty {
    border: 0;
}

.topbar-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.only-mobile {
    display: none;
}

.net-banner {
    flex: none;
    background: var(--warn);
    color: #1b1406;
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
    padding: 6px 16px;
}

.main-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.members-open .main-body {
    grid-template-columns: minmax(0, 1fr) 248px;
}

/* ---------- Chat ---------- */

.text-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 0 8px;
    overflow-wrap: anywhere;
}

.msg-intro {
    padding: 24px 16px 12px;
}

.intro-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-4);
    display: grid;
    place-items: center;
    font-size: 28px;
    margin-bottom: 12px;
}

.msg-intro h3 {
    font-family: var(--f-display);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-bottom: 4px;
}

.msg-intro p {
    color: var(--fg-3);
    max-width: 60ch;
}

.day-sep {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 16px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-3);
}

.day-sep::before,
.day-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line-2);
}

.msg {
    position: relative;
    display: flex;
    gap: 14px;
    padding: 6px 48px 4px 16px;
    margin-top: 10px;
}

.msg.grouped {
    margin-top: 0;
    padding-top: 2px;
    padding-bottom: 2px;
}

.msg:hover {
    background: rgba(0, 0, 0, 0.14);
}

.msg.mention {
    background: rgba(217, 162, 60, 0.09);
    box-shadow: inset 2px 0 0 var(--warn);
}

.msg-avatar .avatar {
    width: 40px;
    height: 40px;
    font-size: 19px;
}

.msg-avatar {
    flex: none;
    align-self: flex-start;
    margin-top: 2px;
}

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

.msg-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.msg-author {
    font-weight: 700;
    font-size: 15px;
}

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

.msg-head time {
    font-size: 12px;
    color: var(--fg-3);
}

.msg-text {
    color: var(--fg);
    line-height: 1.45;
    min-width: 0;
}

.msg.grouped .msg-text {
    padding-left: 54px;
}

.msg-side {
    position: absolute;
    left: 0;
    width: 70px;
    text-align: center;
    top: 5px;
    font-size: 11px;
    color: var(--fg-3);
    opacity: 0;
    font-variant-numeric: tabular-nums;
}

.msg.grouped:hover .msg-side {
    opacity: 1;
}

.msg-text code {
    font: 13px var(--f-mono);
    background: var(--bg-0);
    padding: 1px 5px;
    border-radius: 3px;
}

.mention-tag {
    background: var(--accent-soft);
    color: var(--accent-2);
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 600;
}

.msg-del {
    position: absolute;
    right: 12px;
    top: 4px;
    width: 28px;
    height: 28px;
    border-radius: var(--r-sm);
    background: var(--bg-1);
    border: 1px solid var(--line-2);
    color: var(--fg-3);
    font-size: 12px;
    display: none;
}

.msg:hover .msg-del {
    display: grid;
    place-items: center;
}

.msg-del:hover {
    color: var(--bad);
}

.composer-wrap {
    flex: none;
    padding: 0 16px calc(4px + env(safe-area-inset-bottom, 0px));
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-3);
    border-radius: var(--r-md);
    padding: 6px 6px 6px 16px;
}

.composer textarea {
    flex: 1;
    min-width: 0;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 6px 0;
    max-height: 200px;
    line-height: 1.4;
}

.composer textarea::placeholder {
    color: var(--fg-3);
}

.composer-send {
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    color: var(--fg-2);
}

.composer-send:hover {
    background: var(--accent);
    color: #fff;
}

.typing {
    height: 22px;
    font-size: 12.5px;
    color: var(--fg-2);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
}

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

.typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--fg-2);
    animation: blink 1.2s infinite;
}

.typing-dots i:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots i:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 80%, 100% { opacity: 0.25; }
    40% { opacity: 1; }
}

/* ---------- Sala de voz ---------- */

.voice-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: #0d0c10;
    position: relative;
}

.stage {
    position: relative;
    flex: 1 1 60%;
    min-height: 220px;
    margin: 12px 12px 0;
    background: #000;
    border-radius: var(--r-md);
    overflow: hidden;
    display: flex;
}

.stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.stage:fullscreen {
    margin: 0;
    border-radius: 0;
}

.stage-wait {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    text-align: center;
    color: var(--fg-2);
    background: #000;
}

.stage-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 24px 12px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: opacity 0.2s;
}

.stage:hover .stage-bar,
.stage:focus-within .stage-bar {
    opacity: 1;
}

@media (hover: none) {
    .stage-bar {
        opacity: 1;
    }
}

.live-tag {
    background: var(--bad);
    color: #fff;
    font: 800 11px/1 var(--f-body);
    letter-spacing: 0.05em;
    padding: 4px 6px;
    border-radius: 3px;
}

.stage-who {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.stage-spacer {
    flex: 1;
}

.stage-vol {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-2);
}

.stage.is-self .stage-vol {
    display: none;
}

.stage-vol input {
    width: 100px;
    accent-color: var(--accent-2);
}

.tiles {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-auto-rows: minmax(170px, auto);
    gap: 12px;
    align-content: center;
}

.voice-view.has-stage .tiles {
    flex: none;
    max-height: 34%;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-auto-rows: 110px;
    align-content: start;
}

.voice-view.has-stage .tile .avatar.xl {
    width: 48px;
    height: 48px;
    font-size: 22px;
}

.tile {
    --c: var(--accent);
    position: relative;
    background: color-mix(in srgb, var(--c) 18%, var(--bg-2));
    border-radius: var(--r-md);
    display: grid;
    place-items: center;
    overflow: hidden;
    outline: 2px solid transparent;
    outline-offset: -2px;
    transition: outline-color 0.1s;
}

@supports not (background: color-mix(in srgb, red 10%, blue)) {
    .tile {
        background: var(--bg-3);
    }
}

.tile.speaking {
    outline-color: var(--speak);
}

.tile.speaking .avatar {
    box-shadow: 0 0 0 3px var(--speak);
}

.tile.watching {
    outline-color: var(--accent-2);
}

.tile-foot {
    position: absolute;
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.55);
    padding: 3px 8px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 600;
}

.tile-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.tile-live {
    position: absolute;
    top: 8px;
    left: 8px;
}

.tile-state {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: var(--r-sm);
    background: rgba(0, 0, 0, 0.55);
    color: var(--warn);
}

.tile-state.bad {
    color: #ffb3b0;
    background: rgba(217, 83, 79, 0.3);
}

button.tile-state:hover {
    text-decoration: underline;
}

.tile-state.relay {
    color: var(--fg-2);
}

.tile-watch {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: var(--fg);
    color: #111;
    font-size: 12.5px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: var(--r-sm);
    display: flex;
    gap: 6px;
    align-items: center;
}

.tile-watch:hover {
    background: #fff;
}

.tile-watch.on {
    background: var(--bg-4);
    color: var(--fg);
}

.tile.is-live .tile-foot {
    max-width: calc(100% - 140px);
}

.voice-dock {
    flex: none;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
}

.dock-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-3);
    color: var(--fg);
    font-size: 18px;
    transition: background 0.12s;
}

.dock-btn:hover {
    background: var(--bg-4);
}

.dock-btn.off {
    background: #fff;
    color: var(--bad);
}

.dock-btn.live {
    background: var(--ok);
    color: #fff;
}

.dock-btn.danger {
    background: var(--bad);
    color: #fff;
}

.dock-btn.danger:hover {
    background: #c0403c;
}

/* ---------- Membros ---------- */

.members {
    display: none;
    background: var(--bg-1);
    overflow-y: auto;
    padding: 8px 8px 24px;
    min-height: 0;
}

.members-open .members {
    display: block;
}

.members h4 {
    padding: 16px 8px 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fg-3);
    font-variant-numeric: tabular-nums;
}

.member {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border-radius: var(--r-sm);
    text-align: left;
}

.member:hover {
    background: var(--bg-3);
}

.member.off {
    opacity: 0.45;
}

.member.off:hover {
    opacity: 0.85;
}

.member-av {
    position: relative;
    flex: none;
}

.member-av .status {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--fg-3);
    border: 3px solid var(--bg-1);
    box-sizing: content-box;
    width: 8px;
    height: 8px;
}

.member-av .status.on {
    background: var(--ok);
}

.member-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.member-text strong {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--fg-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member:hover .member-text strong {
    color: var(--fg);
}

.member-text em {
    font-style: normal;
    color: var(--fg-3);
    font-weight: 400;
}

.act {
    font-size: 12px;
    color: var(--fg-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act.live {
    color: #ff9e9b;
}

.crown {
    color: var(--warn);
    font-size: 12px;
}

.drawer-shade {
    display: none;
}

/* ---------- Modais ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(5, 4, 8, 0.78);
    display: grid;
    place-items: center;
    padding: 16px;
    overflow-y: auto;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.modal-card.wide {
    max-width: 600px;
}

.modal-card.narrow {
    max-width: 400px;
}

.modal-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
}

.modal-card h2 {
    font-family: var(--f-display);
    font-weight: 800;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    text-wrap: balance;
    padding-right: 28px;
}

.modal-sub {
    color: var(--fg-2);
    font-size: 14.5px;
    max-width: 52ch;
}

.modal-hint {
    font-size: 13px;
    color: var(--fg-3);
}

.modal-hint code,
.pop-id code {
    font-family: var(--f-mono);
    color: var(--fg);
    background: var(--bg-0);
    padding: 1px 6px;
    border-radius: 3px;
}

.modal-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--fg-3);
    font-size: 18px;
}

.modal-x:hover {
    color: var(--fg);
    background: var(--bg-3);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field > span {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fg-2);
}

.field > span em {
    font-style: normal;
    font-family: var(--f-mono);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--fg-3);
}

.field input[type="text"],
.field select,
.copy-row input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    background: var(--bg-0);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    outline: 0;
}

.field input[type="text"]:focus,
.field select:focus,
.copy-row input:focus {
    border-color: var(--accent-2);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent-2);
}

.field-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 12px;
}

.preview-line {
    font-size: 13.5px;
    color: var(--fg-3);
}

.preview-line strong {
    color: var(--fg);
}

.btn-primary,
.btn-secondary,
.btn-danger {
    height: 42px;
    padding: 0 18px;
    border-radius: var(--r-sm);
    font-weight: 700;
    font-size: 14.5px;
    white-space: nowrap;
    transition: background 0.12s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #8a4bb5;
}

.btn-secondary {
    background: var(--bg-4);
    color: var(--fg);
}

.btn-secondary:hover {
    background: #3b3543;
}

.btn-danger {
    background: var(--bad);
    color: #fff;
}

.btn-danger:hover {
    background: #c0403c;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.or-line {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--fg-3);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.or-line::before,
.or-line::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line-2);
}

.radio-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-3);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    cursor: pointer;
    min-width: 0;
}

.radio-card:hover {
    background: var(--bg-4);
}

.radio-card:has(input:checked) {
    border-color: var(--accent-2);
    background: var(--accent-soft);
}

.radio-card input {
    accent-color: var(--accent-2);
    flex: none;
}

.radio-card i {
    font-size: 18px;
    color: var(--fg-2);
    width: 20px;
    text-align: center;
}

.radio-card span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.radio-card strong {
    font-size: 14.5px;
}

.radio-card small {
    font-size: 12px;
    color: var(--fg-3);
}

.copy-row {
    display: flex;
    gap: 8px;
}

.copy-row input {
    flex: 1;
    min-width: 0;
    font-family: var(--f-mono);
    font-size: 13px;
}

.tip {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--fg-2);
}

.tip summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--fg);
}

.tip summary i {
    color: var(--warn);
    margin-right: 6px;
}

.tip ol {
    margin: 10px 0 8px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tip p {
    font-size: 13px;
    color: var(--fg-3);
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Configurações */

.settings-card {
    max-width: 560px;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line-2);
    margin: -6px 36px 4px 0;
}

.settings-tab {
    padding: 8px 12px;
    font-weight: 600;
    color: var(--fg-3);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.settings-tab:hover {
    color: var(--fg);
}

.settings-tab.active {
    color: var(--fg);
    border-bottom-color: var(--accent-2);
}

.settings-pane {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.swatch.on {
    box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--fg);
}

.seg {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--bg-0);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 3px;
}

.seg button {
    padding: 8px 6px;
    font-size: 13px;
    border-radius: 3px;
    color: var(--fg-2);
}

.seg button.on {
    background: var(--bg-4);
    color: var(--fg);
    font-weight: 600;
}

.meter-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meter {
    position: relative;
    height: 10px;
    background: var(--bg-0);
    border-radius: 5px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    width: 0;
    background: var(--warn);
    transition: width 0.06s linear;
}

.meter-fill.hot {
    background: var(--ok);
}

.meter-thr {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--fg);
}

.toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--fg-2);
    cursor: pointer;
}

.toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-2);
}

.diag {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 8px 16px;
    font-size: 13.5px;
    background: var(--bg-1);
    border-radius: var(--r-md);
    padding: 14px;
}

.diag dt {
    color: var(--fg-3);
    overflow-wrap: anywhere;
}

.diag dd {
    color: var(--fg);
    overflow-wrap: anywhere;
}

.diag code {
    font-family: var(--f-mono);
    font-size: 12.5px;
}

.diag-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Cartão de usuário */

.user-pop {
    position: fixed;
    z-index: 90;
    width: 280px;
    background: var(--bg-0);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.pop-banner {
    height: 56px;
    background: var(--c);
}

.pop-body {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pop-body > .avatar {
    margin-top: -40px;
    border: 6px solid var(--bg-0);
    box-sizing: content-box;
}

.pop-name {
    font-size: 18px;
}

.pop-id,
.pop-status {
    font-size: 13px;
    color: var(--fg-2);
}

.pop-vol {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg-2);
    border-top: 1px solid var(--line-2);
    padding-top: 10px;
}

.pop-vol span {
    display: flex;
    justify-content: space-between;
}

.pop-vol em {
    font-style: normal;
    font-family: var(--f-mono);
    font-weight: 500;
}

/* Avisos */

.audio-unlock {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    background: var(--warn);
    color: #1b1406;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: var(--r-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-width: calc(100% - 32px);
}

.toasts {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%);
    z-index: 130;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100% - 32px);
    pointer-events: none;
}

.toast {
    background: var(--fg);
    color: #17141c;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: var(--r-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: none;
}

/* ---------- Mensagens diretas ---------- */

.guild-home {
    position: relative;
    border-radius: 50%;
}

.guild-home img {
    border-radius: 50%;
}

.guild-home:hover img,
.guild-home.active img {
    border-radius: 16px;
}

.guild-home .badge {
    position: absolute;
    right: -4px;
    bottom: -4px;
    border: 3px solid var(--bg-0);
}

.guild-site {
    margin-top: auto;
    color: var(--fg-3);
    font-size: 16px;
    display: grid;
    place-items: center;
}

.guild-site:hover {
    background: var(--bg-4);
    color: var(--fg);
}

.server-header:disabled {
    opacity: 1;
    cursor: default;
}

.server-header:disabled i {
    display: none;
}

.server-header:disabled:hover {
    background: none;
}

.dm-item {
    padding: 6px 8px;
    gap: 10px;
}

.dm-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.dm-text small {
    font-size: 12px;
    color: var(--fg-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-item .member-av .status {
    border-color: var(--bg-1);
}

.dm-empty {
    padding: 24px 12px;
    font-size: 13.5px;
    color: var(--fg-3);
}

.dm-empty strong {
    color: var(--fg-2);
}

.dm-home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 24px;
    text-align: center;
    color: var(--fg-3);
}

.dm-home > i {
    font-size: 48px;
    color: var(--bg-4);
}

.dm-home h3 {
    font-family: var(--f-display);
    font-size: 30px;
    font-weight: 800;
    color: var(--fg);
    text-transform: uppercase;
}

.dm-home p {
    max-width: 46ch;
}

.msg-intro > .avatar.xl {
    margin-bottom: 12px;
}

/* ---------- Imagens no chat ---------- */

.composer-attach {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    color: var(--fg-2);
    font-size: 20px;
    margin-left: -10px;
}

.composer-attach:hover:not(:disabled) {
    color: var(--fg);
}

.attach-preview {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    background: var(--bg-3);
    border-radius: var(--r-md) var(--r-md) 0 0;
    padding: 10px 10px 0;
    margin-bottom: -4px;
}

.attach-preview img {
    max-height: 120px;
    max-width: 220px;
    border-radius: var(--r-sm);
    object-fit: cover;
}

.msg-img {
    display: block;
    margin-top: 6px;
    max-width: min(420px, 100%);
    border-radius: var(--r-md);
    overflow: hidden;
    cursor: zoom-in;
}

.msg-img img {
    display: block;
    max-width: 100%;
    max-height: 340px;
    object-fit: contain;
    background: var(--bg-0);
}

.msg-img-gone,
.msg-pending {
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--fg-3);
    display: flex;
    gap: 6px;
    align-items: center;
}

.msg.grouped .msg-body {
    padding-left: 54px;
}

.msg.grouped .msg-body .msg-text {
    padding-left: 0;
}

.text-view.dropping {
    outline: 2px dashed var(--accent-2);
    outline-offset: -8px;
}

.lightbox {
    background: rgba(0, 0, 0, 0.9);
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 64px);
    border-radius: var(--r-md);
}

.lightbox .modal-x {
    position: fixed;
    color: #fff;
}

/* ---------- Câmera ---------- */

.tile-video {
    position: absolute;
    inset: 0;
    background: #000;
}

.tile-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tile-video video.mirror {
    transform: scaleX(-1);
}

.tile.has-video.speaking {
    outline-width: 3px;
}

.cam-ico {
    font-size: 11px;
    color: var(--fg-3);
}

.dock-btn.live {
    background: var(--ok);
}

.vp-action.live {
    background: var(--ok);
    color: #fff;
}

#vp-share.live {
    background: var(--bad);
}

/* ---------- Cargos ---------- */

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.role-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    background: var(--bg-1);
}

.role-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--rc);
    flex: none;
    margin-right: 4px;
}

.role-name {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    font-weight: 600;
    line-height: 1.25;
}

.role-name small {
    font-weight: 400;
    font-size: 12px;
    color: var(--fg-3);
}

.role-row .dim {
    opacity: 0.35;
}

.role-form {
    border-top: 1px solid var(--line-2);
    padding-top: 14px;
}

.pop-roles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid var(--line-2);
    padding-top: 10px;
}

.pop-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fg-2);
}

.role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    background: var(--bg-3);
    font-size: 12px;
    color: var(--fg-3);
    border: 1px dashed var(--line-2);
}

.role-chip i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rc);
}

.role-chip.on {
    color: var(--fg);
    border: 1px solid transparent;
    background: var(--bg-4);
}

button.role-chip:hover {
    color: var(--fg);
}

.user-pop .btn-primary,
.user-pop .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.update-bar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 140;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: var(--r-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    max-width: calc(100% - 32px);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ---------- Responsivo ---------- */

@media (max-width: 1100px) {
    .members-open .main-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .members {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(280px, 85vw);
        z-index: 40;
        box-shadow: -12px 0 32px rgba(0, 0, 0, 0.5);
        padding-top: calc(8px + env(safe-area-inset-top, 0px));
    }

    .members-open .drawer-shade {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(0, 0, 0, 0.5);
    }
}

@media (max-width: 860px) {
    .app {
        grid-template-columns: minmax(0, 1fr);
    }

    .guilds,
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-110%);
        transition: transform 0.22s ease;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .guilds {
        left: 0;
        width: 72px;
    }

    .sidebar {
        left: 72px;
        width: min(280px, calc(100vw - 88px));
        transform: translateX(calc(-100% - 80px));
    }

    .drawer-open .guilds,
    .drawer-open .sidebar {
        transform: none;
    }

    .drawer-open .drawer-shade {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(0, 0, 0, 0.55);
    }

    .only-mobile {
        display: grid;
    }

    .topbar {
        padding: 0 8px;
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(52px + env(safe-area-inset-top, 0px));
    }

    .topbar-topic {
        display: none;
    }

    .msg {
        padding-right: 16px;
    }

    .msg-del {
        right: 6px;
    }

    .tiles {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        grid-auto-rows: 140px;
        padding: 12px;
        gap: 8px;
    }

    .avatar.xl {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .stage {
        margin: 8px 8px 0;
        min-height: 200px;
    }

    .stage-vol input {
        width: 70px;
    }

    .radio-cards,
    .toggles {
        grid-template-columns: 1fr;
    }

    .field-row {
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .modal-card {
        padding: 24px 16px 18px;
    }
}

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