@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800&display=swap");

:root {
    --font-ui: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-display: "Manrope", "Inter", "Segoe UI", sans-serif;
    --scrollbar-size: 8px;
    --scrollbar-track: rgba(255, 255, 255, 0.04);
    --scrollbar-thumb: rgba(255, 255, 255, 0.14);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.22);
    --motion-fast: 0.16s ease;
    --motion-normal: 0.22s ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: var(--font-ui);
    background: #1e1f22;
    color: #ffffff;
}

body {
    overflow: hidden;
}

a {
    color: #7c84ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
textarea {
    font: inherit;
}

img {
    max-width: 100%;
}

.hidden {
    display: none !important;
}

/* ==================================================
   LOGIN / REGISTER PAGE
================================================== */

.auth-page,
.login-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(88, 101, 242, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(59, 165, 93, 0.14), transparent 24%),
        #1e1f22;
    overflow: auto;
}

.auth-card,
.login-card {
    width: 100%;
    max-width: 440px;
    background: #2b2d31;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.auth-logo,
.login-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #5865f2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 18px;
}

.auth-title,
.login-title,
.auth-card h1,
.login-card h1 {
    font-family: var(--font-display);
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.2;
    font-weight: 800;
    color: #ffffff;
}

.auth-subtitle,
.login-subtitle {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.6;
    color: #b5bac1;
}

.form-group,
.auth-field,
.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-label,
.auth-label,
.login-label,
.auth-field label,
.login-field label {
    font-size: 13px;
    font-weight: 700;
    color: #dbdee1;
}

.input,
.auth-input,
.login-input,
.form-group input,
.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"],
.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    outline: none;
    background: #1f2023;
    color: #ffffff;
    padding: 13px 14px;
    border-radius: 12px;
    font-size: 15px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input::placeholder,
.auth-input::placeholder,
.login-input::placeholder,
.auth-card input::placeholder,
.login-card input::placeholder {
    color: #949ba4;
}

.input:focus,
.auth-input:focus,
.login-input:focus,
.auth-card input:focus,
.login-card input:focus {
    border-color: #5865f2;
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
    background: #232428;
}

.auth-actions,
.login-actions,
.auth-buttons,
.login-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.btn,
.auth-btn,
.login-btn,
.auth-card button,
.login-card button {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.btn-primary,
.auth-btn.primary,
.login-btn.primary,
.auth-submit,
.login-submit {
    background: #5865f2;
    color: #ffffff;
}

.btn-primary:hover,
.auth-btn.primary:hover,
.login-btn.primary:hover,
.auth-submit:hover,
.login-submit:hover {
    background: #4752c4;
}

.btn-secondary,
.auth-btn.secondary,
.login-btn.secondary {
    background: #404249;
    color: #ffffff;
}

.btn-secondary:hover,
.auth-btn.secondary:hover,
.login-btn.secondary:hover {
    background: #4c4f57;
}

.auth-footer,
.login-footer {
    margin-top: 18px;
    font-size: 14px;
    color: #b5bac1;
}

.message-box,
.auth-error,
.login-error,
.auth-success,
.login-success {
    display: none;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.message-box.error,
.auth-error {
    display: block;
    background: rgba(218, 55, 60, 0.14);
    border: 1px solid rgba(218, 55, 60, 0.26);
    color: #ffb3b5;
}

.message-box.success,
.auth-success,
.login-success {
    display: block;
    background: rgba(59, 165, 93, 0.12);
    border: 1px solid rgba(59, 165, 93, 0.24);
    color: #9ee2b1;
}

/* ==================================================
   APP LAYOUT
================================================== */

.app-layout {
    display: grid;
    grid-template-columns: 72px 260px 1fr 280px;
    width: 100vw;
    height: 100vh;
    background: #1e1f22;
    overflow: hidden;
}

.servers-sidebar {
    background: #111214;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 10px;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}

.channels-sidebar {
    position: relative;
    z-index: 20;
    background: #2b2d31;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: visible;
}

.chat-main {
    position: relative;
    background: #313338;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.users-sidebar {
    position: relative;
    z-index: 10;
    background: #2b2d31;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* ==================================================
   LEFT SERVERS SIDEBAR
================================================== */

.sidebar-top,
.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 1;
    transform: none;
    transition: opacity 160ms ease, transform 160ms ease;
}


.servers-list {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    overflow-y: auto;
    padding: 6px 0;
    min-height: 0;
}

.servers-list::-webkit-scrollbar {
    width: var(--scrollbar-size);
}

.servers-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
}

.server-btn,
.sidebar-action-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 16px;
    background: #313338;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.server-btn {
    overflow: hidden;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.server-btn:hover,
.sidebar-action-btn:hover {
    background: #5865f2;
    border-radius: 12px;
    transform: translateY(-1px);
}

.server-btn.active {
    background: #5865f2;
    border-radius: 12px;
}

.sidebar-action-btn.danger:hover {
    background: #da373c;
}

/* ==================================================
   CHANNELS SIDEBAR
================================================== */

.channels-header,
.users-header {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.channels-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.channels-header h2,
.users-header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    color: #f2f3f5;
}

.sidebar-subtitle {
    margin: 6px 0 0;
    font-size: 12px;
    color: #b5bac1;
}

.channels-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}


.users-toggle-btn {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: #383a40;
    color: #ffffff;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.users-toggle-btn::after {
    content: "▾";
    font-size: 12px;
    color: #b5bac1;
    transition: transform 0.16s ease;
}

.users-toggle-btn[aria-expanded="false"]::after {
    transform: rotate(-90deg);
}

.users-toggle-btn:hover {
    background: #404249;
    border-color: rgba(255, 255, 255, 0.12);
}

.users-panel {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.users-panel.hidden {
    display: none;
}

.mobile-users-panel {
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 10px;
}

.mobile-users-panel.hidden {
    display: none;
}

.users-panel.is-animating,
.mobile-users-panel.is-animating {
    overflow: hidden;
    transition: height 180ms ease, opacity 180ms ease, transform 180ms ease;
    transform-origin: top;
    will-change: height, opacity, transform;
}

.header-btn {
    border: none;
    border-radius: 10px;
    background: #404249;
    color: #ffffff;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.18s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    background: #5865f2;
}

.header-btn.danger {
    background: #da373c;
}

.header-btn.danger:hover {
    background: #b52d31;
}

.channels-section-title {
    padding: 14px 16px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #949ba4;
    flex-shrink: 0;
}

.channels-list {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 12px;
    min-height: 0;
}

.channels-list::-webkit-scrollbar,
.users-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: var(--scrollbar-size);
}

.channels-list::-webkit-scrollbar-thumb,
.users-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
}

.channel-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: #dbdee1;
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: 0.16s ease;
}

.channel-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.channel-btn.active {
    background: #404249;
    color: #ffffff;
}

/* ==================================================
   SERVER MENU
================================================== */

.server-menu-wrapper {
    position: relative;
    z-index: 120;
}

.server-menu-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #404249;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    transition: 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.server-menu-btn:hover {
    background: #5865f2;
}

.server-dropdown {
    position: absolute;
    top: 42px;
    right: 0;
    min-width: 210px;
    background: #1f2023;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 500;
}

.server-dropdown button {
    width: 100%;
    background: transparent;
    border: none;
    color: #ffffff;
    text-align: left;
    padding: 12px 14px;
    cursor: pointer;
    font-size: 14px;
}

.server-dropdown button:hover {
    background: rgba(255, 255, 255, 0.06);
}

.server-dropdown button.danger {
    color: #ff8080;
}

/* ==================================================
   CHAT MAIN
================================================== */

.chat-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: #313338;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
    flex-shrink: 0;
}


.voice-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mic-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #c9d1d9;
    font-size: 13px;
    font-weight: 600;
}

.mic-status::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #8f96a3;
    box-shadow: 0 0 0 0 rgba(87, 242, 135, 0.45);
}

.mic-status.active::before {
    background: #57f287;
    box-shadow: 0 0 0 4px rgba(87, 242, 135, 0.18);
}

.mic-status.muted::before {
    background: #ed4245;
    box-shadow: 0 0 0 4px rgba(237, 66, 69, 0.14);
}

.mic-status.server-muted::before {
    background: #ffb347;
    box-shadow: 0 0 0 4px rgba(255, 179, 71, 0.18);
}

.mic-status.disabled::before {
    background: #8f96a3;
    box-shadow: none;
}

.voice-toggle-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: #ffffff;
    background: #5865f2;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.voice-toggle-btn:hover {
    transform: translateY(-1px);
}

.voice-toggle-btn.disconnect {
    background: #da373c;
}

.voice-toggle-btn.secondary {
    background: #4f545c;
}


.voice-toggle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.mobile-burger-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: #404249;
    color: #ffffff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
    transition: background 0.16s ease;
}

.mobile-burger-btn:hover {
    background: #4c4f57;
}

.mobile-nav-backdrop {
    display: none;
}

.chat-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #f2f3f5;
}

#chatMeta {
    margin: 6px 0 0;
    font-size: 13px;
    color: #b5bac1;
}

.messages-container {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 20px;
    min-height: 0;
    height: 0;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    text-align: center;
    color: #b5bac1;
    padding: 24px;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 24px;
    color: #ffffff;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
    max-width: 420px;
    line-height: 1.5;
}

.typing-indicator {
    min-height: 24px;
    padding: 0 20px 10px;
    font-size: 13px;
    color: #b5bac1;
    flex-shrink: 0;
}

/* ==================================================
   MESSAGE
================================================== */

.message {
    display: flex;
    gap: 14px;
    padding: 10px 0;
    position: relative;
}

.message:hover .message-body {
    background: rgba(255, 255, 255, 0.02);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #5865f2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    overflow: hidden;
}

.message-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}

.message-body {
    padding: 4px 10px 8px 0;
    border-radius: 10px;
    transition: background 0.16s ease;
}

.message-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding-right: 44px;
}

.message-username {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.message-time {
    font-size: 12px;
    color: #949ba4;
}

.message-reply-preview {
    width: 100%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #dfe3ea;
    border-left: 3px solid rgba(88, 101, 242, 0.9);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    cursor: pointer;
}

.message-reply-preview strong {
    font-size: 12px;
    color: #cfd5ff;
}

.message-reply-preview span {
    font-size: 13px;
    color: #c8ccd4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-text {
    font-size: 15px;
    line-height: 1.55;
    color: #dbdee1;
    word-break: break-word;
    white-space: pre-wrap;
}

.message-image {
    display: block;
    margin-top: 10px;
    max-width: min(360px, 100%);
    max-height: 320px;
    border-radius: 14px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-menu-btn {
    position: absolute;
    top: 4px;
    right: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #232428;
    color: #ffffff;
    cursor: pointer;
    font-size: 18px;
    display: none;
    align-items: center;
    justify-content: center;
}

.message:hover .message-menu-btn {
    display: flex;
}

.message-menu-btn:hover {
    background: #404249;
}

.message-dropdown {
    position: absolute;
    top: 42px;
    right: 0;
    min-width: 190px;
    background: #1f2023;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    z-index: 20;
}

.message-dropdown button {
    width: 100%;
    border: none;
    background: transparent;
    color: #ff8080;
    text-align: left;
    padding: 12px 14px;
    cursor: pointer;
    font-size: 14px;
}

.message-dropdown button:hover {
    background: rgba(255, 255, 255, 0.06);
}

.message-dropdown-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.message-dropdown-actions-row button {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
    border-radius: 10px;
    text-align: center;
    padding: 10px 8px;
}

/* ==================================================
   CHAT INPUT
================================================== */

.chat-input-area {
    padding: 0 20px 20px;
    background: #313338;
    flex-shrink: 0;
}

.composer-edit-bar,
.composer-reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(88, 101, 242, 0.16);
    border: 1px solid rgba(88, 101, 242, 0.28);
}

.composer-edit-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.composer-edit-text strong {
    font-size: 13px;
}

.composer-edit-text span {
    font-size: 12px;
    color: #c8cbff;
}

.composer-cancel-btn {
    border: none;
    border-radius: 10px;
    padding: 9px 12px;
    background: #4b4d55;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.composer-cancel-btn:hover {
    background: #5a5d68;
}

.image-preview-container {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    max-width: 100%;
}

.image-preview {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.remove-image-btn {
    border: none;
    background: #da373c;
    color: #ffffff;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.remove-image-btn:hover {
    background: #bf2f33;
}

.chat-input-shell {
    position: relative;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #383a40;
    border-radius: 16px;
    padding: 10px 12px;
}

.chat-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.message-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    align-self: stretch;
}

.upload-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #4b4d55;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.16s ease;
    flex-shrink: 0;
    font-size: 18px;
}

.upload-btn:hover {
    background: #5865f2;
}

.upload-btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.emoji-button {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    background: #3f4248;
    color: #b9bec7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1;
}

.emoji-button:hover {
    background: #464950;
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.emoji-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18);
}

.message-input {
    width: 100%;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.45;
    padding: 9px 4px;
    resize: none;
    overflow-y: hidden;
    min-height: 42px;
    max-height: calc(1.45em * 5 + 18px);
    font-family: inherit;
    display: block;
}

.message-input::placeholder {
    color: #a2a7ad;
}

.message-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.message-input::-webkit-scrollbar {
    width: 6px;
}

.message-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.send-btn {
    border: none;
    border-radius: 12px;
    background: #5865f2;
    color: #ffffff;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: #4752c4;
}

.send-btn:disabled {
    background: #4b4d55;
    color: #a2a7ad;
    cursor: not-allowed;
}

.mention-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-radius: 14px;
    background: #232428;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
    z-index: 20;
}

.mention-suggestion-item {
    border: none;
    background: transparent;
    color: #ffffff;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.mention-suggestion-item:hover,
.mention-suggestion-item.active {
    background: rgba(88, 101, 242, 0.22);
}

.mention-suggestion-name {
    font-weight: 700;
}

.mention-suggestion-role {
    font-size: 12px;
    color: #aeb4ff;
}

.emoji-picker {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: 280px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    border-radius: 16px;
    background: #232428;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
    z-index: 18;
}

.emoji-picker-btn {
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    min-height: 40px;
    cursor: pointer;
    font-size: 20px;
}

.emoji-picker-btn:hover {
    background: rgba(88, 101, 242, 0.22);
}


.message-mention {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border: none;
    border-radius: 8px;
    background: rgba(88, 101, 242, 0.16);
    color: #d7dcff;
    font-weight: 700;
    cursor: pointer;
}

.message-mention.is-own-mention {
    background: rgba(250, 166, 26, 0.18);
    color: #ffd78a;
}

.message-own-mention .message-body {
    background: rgba(250, 166, 26, 0.08);
}

.message-highlight-flash .message-body {
    animation: messageFlash 1.4s ease;
}

@keyframes messageFlash {
    0% { background: rgba(88, 101, 242, 0.32); }
    100% { background: rgba(255, 255, 255, 0.02); }
}

/* ==================================================
   USERS SIDEBAR
================================================== */

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    min-height: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    transition: 0.16s ease;
}

.user-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-card.offline {
    opacity: 0.68;
}

.user-card.offline .user-avatar {
    filter: grayscale(100%);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3ba55d;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.user-status {
    font-size: 12px;
    color: #3ba55d;
    margin-top: 2px;
}

.user-status.offline {
    color: #8f96a3;
}

.current-user-box {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px;
    background: #232428;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.current-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #5865f2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

.current-user-info {
    min-width: 0;
}

.current-user-label {
    font-size: 12px;
    color: #949ba4;
    margin-bottom: 6px;
}

.current-user-name {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    word-break: break-word;
}

.current-user-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.current-user-audio-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.quick-action-btn {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.quick-action-btn span {
    line-height: 1;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.quick-action-btn.call-active.active {
    background: rgba(87, 242, 135, 0.16);
    border-color: rgba(87, 242, 135, 0.34);
}

.quick-action-btn.call-active.muted {
    background: rgba(237, 66, 69, 0.16);
    border-color: rgba(237, 66, 69, 0.34);
}

.quick-action-btn.settings {
    margin-left: auto;
}

/* ==================================================
   AVATARS
================================================== */

.avatar-image,
.server-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

/* ==================================================
   RESPONSIVE
================================================== */

@media (max-width: 1200px) {
    .app-layout {
        grid-template-columns: 72px 240px 1fr;
    }

    .users-sidebar {
        display: none;
    }
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

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

    .channels-sidebar {
        width: 100%;
    }

    .chat-main {
        display: none;
    }
}

@media (max-width: 640px) {
    .app-layout {
        grid-template-columns: 64px 1fr;
    }

    .servers-sidebar {
        padding: 10px 8px;
    }

    .server-btn,
    .sidebar-action-btn {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .channels-header {
        flex-direction: column;
        align-items: stretch;
    }

    .channels-header-actions {
        justify-content: flex-start;
    }

    .auth-card,
    .login-card {
        padding: 22px 18px;
        border-radius: 16px;
    }

    .auth-title,
    .login-title,
    .auth-card h1,
    .login-card h1 {
        font-size: 26px;
    }

    .auth-actions,
    .login-actions {
        flex-direction: column;
    }

    .btn,
    .auth-btn,
    .login-btn {
        width: 100%;
    }
}
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.message-username-wrap,
.user-name-row,
.role-member-name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}

.modal-card {
    width: min(1100px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #1e1f22;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
    padding: 22px;
}

.modal-header,
.role-definition-item,
.role-member-top,
.role-create-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.role-manager-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
    margin-top: 18px;
}

.role-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
}

.role-definition-list,
.role-members-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.role-member-card,
.role-definition-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 12px;
}

.role-member-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-input {
    background: #111214;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 10px;
    padding: 10px 12px;
}

.role-color-input {
    width: 54px;
    height: 40px;
    border: none;
    background: transparent;
    padding: 0;
}

.member-role-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-role-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.danger-btn {
    background: rgba(240, 71, 71, 0.14);
}

.empty-state.compact {
    padding: 10px;
}

@media (max-width: 980px) {
    .role-manager-grid {
        grid-template-columns: 1fr;
    }
}


.message-dropdown button {
    color: #ffffff;
}

.message-dropdown button.danger {
    color: #ff8080;
}

.member-actions-modal {
    width: min(520px, 100%);
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
}

.member-actions-role-list {
    margin-top: 18px;
}

.role-banned-title {
    margin: 18px 0 10px;
    font-size: 15px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}


.channels-group-title {
    margin: 16px 0 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.settings-section h3 {
    margin: 0;
    font-size: 16px;
}

.settings-inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}


.channel-entry {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


.channel-entry-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-drag-handle {
    width: 14px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    cursor: grab;
    flex: 0 0 auto;
    position: relative;
}

.channel-drag-handle::before {
    content: "⋮⋮";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.55);
}

.channel-entry.dragging {
    opacity: 0.55;
}

.channel-menu-btn {
    height: 32px;
    width: 32px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    flex: 0 0 auto;
}

.channel-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.channel-dropdown {
    position: relative;
    margin-left: 22px;
    margin-top: 6px;
    background: #1e1f22;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.38);
}

.channel-dropdown button {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: #e3e5e8;
    cursor: pointer;
    font-size: 13px;
}

.channel-dropdown button:hover {
    background: rgba(255, 255, 255, 0.06);
}

.channels-group-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


.voice-members-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: -2px 0 8px 18px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.voice-members-list-inline {
    margin: 14px auto 0;
    padding-left: 0;
    border-left: none;
    max-width: 360px;
    text-align: left;
}

.voice-member-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    font-size: 13px;
    line-height: 1.3;
    color: #b5bac1;
    word-break: break-word;
}

.voice-member-item.self {
    color: #ffffff;
}

.voice-member-item.speaking .voice-member-name {
    color: #57f287;
}

.voice-member-item.speaking .voice-member-avatar {
    box-shadow: 0 0 0 2px #57f287, 0 0 0 4px rgba(87, 242, 135, 0.18);
}

.voice-member-item.muted .voice-member-avatar {
    filter: grayscale(1);
    opacity: 0.65;
}

.voice-member-item.muted .voice-member-name {
    color: #f0b6b8;
}

.voice-member-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #5865f2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

.voice-member-name {
    flex: 1;
}

.voice-member-indicators {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.voice-member-indicator {
    font-size: 12px;
    line-height: 1;
}

.voice-member-item.server-muted .voice-member-avatar {
    box-shadow: 0 0 0 2px #ffb347, 0 0 0 4px rgba(255, 179, 71, 0.12);
}

.messages-container.voice-stage-mode {
    padding: 24px;
    align-items: stretch;
    justify-content: flex-start;
}

.voice-stage {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100%;
}

.voice-stage-hero {
    padding: 22px 24px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(88, 101, 242, 0.18), rgba(88, 101, 242, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.22);
}

.voice-stage-hero h3 {
    margin: 0 0 8px;
    font-size: 28px;
    color: #ffffff;
}

.voice-stage-hero p {
    margin: 0;
    color: #cfd5dd;
    font-size: 15px;
    line-height: 1.5;
}

.voice-stage-empty {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 280px;
    padding: 32px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.voice-stage-empty h4 {
    margin: 0 0 10px;
    font-size: 22px;
    color: #ffffff;
}

.voice-stage-empty p {
    margin: 0;
    color: #b5bac1;
    max-width: 460px;
    line-height: 1.6;
}

.voice-stage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.voice-user-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 22px 18px 18px;
    border-radius: 22px;
    background: rgba(30, 31, 34, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.24);
}

.voice-user-card.self {
    border-color: rgba(88, 101, 242, 0.42);
}

.voice-user-card.muted {
    background: rgba(28, 29, 32, 0.92);
}

.voice-user-card.server-muted {
    border-color: rgba(255, 179, 71, 0.34);
}

.voice-user-card.speaking {
    transform: translateY(-2px);
}

.voice-user-avatar-xl {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #5865f2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 800;
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.voice-user-card.speaking .voice-user-avatar-xl {
    box-shadow: 0 0 0 4px #57f287, 0 0 0 10px rgba(87, 242, 135, 0.18);
}

.voice-user-card.server-muted .voice-user-avatar-xl {
    box-shadow: 0 0 0 4px #ffb347, 0 0 0 10px rgba(255, 179, 71, 0.12);
}

.voice-user-card.muted .voice-user-avatar-xl {
    filter: grayscale(0.25);
    opacity: 0.9;
}

.voice-user-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    word-break: break-word;
}

.voice-user-meta {
    min-height: 20px;
    color: #c9d1d9;
    font-size: 14px;
    text-align: center;
}

.voice-user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.voice-user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #f2f3f5;
    font-size: 12px;
    font-weight: 700;
}

.voice-user-badge.role-owner {
    background: rgba(255, 209, 102, 0.2);
    color: #ffd166;
}

.voice-user-badge.role-admin {
    background: rgba(88, 101, 242, 0.22);
    color: #d7dcff;
}

.voice-user-badge.danger {
    background: rgba(237, 66, 69, 0.16);
    color: #ffb3b8;
}

.voice-user-volume {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.voice-user-volume-label {
    font-size: 13px;
    font-weight: 600;
    color: #cfd5dd;
}

.voice-user-volume-slider {
    width: 100%;
    accent-color: #5865f2;
    cursor: pointer;
}

.voice-user-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 2px;
}

.voice-card-action-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    background: rgba(79, 84, 92, 0.95);
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.voice-card-action-btn:hover {
    transform: translateY(-1px);
}

.voice-card-action-btn.active {
    background: #da373c;
}


.version-badge {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1200;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 16, 20, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #d7dcff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    user-select: none;
}

.auth-page .version-badge {
    top: 18px;
    right: 18px;
}


/* ==================================================
   0.2.1 OVERRIDES
================================================== */

.remember-me-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
    color: #dbdee1;
    font-size: 14px;
}

.remember-me-row input {
    width: 16px;
    height: 16px;
    accent-color: #5865f2;
}

.channel-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.channel-btn-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-unread-badge {
    flex-shrink: 0;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #5865f2;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.message-edited {
    margin-top: 6px;
    font-size: 12px;
    color: #949ba4;
}

.message-text a {
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    body {
        overflow: auto;
    }

    .app-layout {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .servers-sidebar,
    .channels-sidebar,
    .chat-main {
        width: 100%;
    }

    .servers-sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }

    .sidebar-top,
    .sidebar-bottom {
        flex-direction: row;
    }

    .servers-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        padding: 0 8px;
    }

    .channels-sidebar,
    .users-sidebar {
        border: none;
    }

    .chat-main {
        display: flex;
        min-height: 60vh;
    }

    .messages-container {
        height: auto;
    }

    .chat-header {
        padding: 14px 16px 12px;
    }

    .chat-header h1 {
        font-size: 18px;
        word-break: break-word;
    }

    .chat-input-area {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .message-image {
        max-width: 100%;
    }
}


@media (max-width: 768px) {
    .composer-edit-bar,
.composer-reply-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .chat-input-row {
        flex-wrap: wrap;
    }

    .message-input-wrap {
        width: 100%;
        order: 3;
    }

    .chat-input-actions {
        margin-left: auto;
    }

    .emoji-picker {
        left: 0;
        right: 0;
        width: auto;
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}


/* ==================================================
   0.2.1.3ch MOBILE CHAT OVERRIDES
================================================== */

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    body {
        overflow: hidden;
    }

    .version-badge {
        display: none;
    }

    .auth-page .version-badge,
    .login-page .version-badge {
        display: none;
    }

    .mobile-burger-btn {
        display: inline-flex;
        width: 38px;
        height: 38px;
        border-radius: 12px;
        background: #383a40;
        border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.52);
        z-index: 120;
    }

    .app-layout {
        position: relative;
        display: block;
        width: 100vw;
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
    }

    .servers-sidebar,
    .channels-sidebar {
        position: fixed;
        left: 0;
        width: min(340px, 88vw);
        transform: translateX(calc(-100% - 18px));
        transition: transform 0.22s ease, opacity 0.18s ease, visibility 0.18s ease;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        z-index: 140;
    }

    .servers-sidebar {
        top: 0;
        height: auto;
        padding: 12px;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        background: #111214;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        overflow: hidden;
    }

    .servers-sidebar .sidebar-top,
    .servers-sidebar .sidebar-bottom {
        flex-direction: row;
        gap: 8px;
    }

    .servers-sidebar .servers-list {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 2px;
    }

    .channels-sidebar {
        top: 74px;
        bottom: 0;
        height: calc(100dvh - 74px);
        background: #2b2d31;
        border-right: 1px solid rgba(255,255,255,0.06);
        box-shadow: 18px 0 32px rgba(0, 0, 0, 0.35);
    }

    body.mobile-nav-open .servers-sidebar,
    body.mobile-nav-open .channels-sidebar {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .chat-main {
        display: flex;
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
        margin-left: 0;
        overflow: hidden;
    }

    .chat-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        min-height: 60px;
    }

    .chat-header > div:first-of-type {
        min-width: 0;
        flex: 1;
    }

    .chat-header h1 {
        font-size: 17px;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #chatMeta {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .messages-container {
        padding: 12px 10px;
        flex: 1 1 auto;
        min-height: 0;
        height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .message {
        gap: 10px;
    }

    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .message-top {
        gap: 8px;
        padding-right: 36px;
        flex-wrap: wrap;
    }

    .message-reply-preview {
    width: 100%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #dfe3ea;
    border-left: 3px solid rgba(88, 101, 242, 0.9);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    cursor: pointer;
}

.message-reply-preview strong {
    font-size: 12px;
    color: #cfd5ff;
}

.message-reply-preview span {
    font-size: 13px;
    color: #c8ccd4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-text {
        font-size: 14px;
        line-height: 1.45;
    }

    .empty-state {
        min-height: 180px;
        padding: 18px;
    }

    .empty-state h3 {
        font-size: 20px;
    }

    .typing-indicator {
        padding: 0 12px 8px;
    }

    .chat-input-area {
        position: relative;
        z-index: 18;
        padding: 0 10px calc(10px + env(safe-area-inset-bottom));
    }

    .chat-input-shell {
        width: 100%;
    }

    .chat-input-row {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr) 36px 38px;
        align-items: end;
        gap: 8px;
        padding: 8px 10px;
        border-radius: 18px;
    }

    .chat-input-actions {
        grid-column: 3;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        margin-left: 0;
    }

    .message-input-wrap {
        width: 100%;
        min-width: 0;
        order: 0;
    }

    .message-input {
        padding: 9px 2px;
        font-size: 16px;
        min-height: 38px;
        max-height: calc(1.45em * 5 + 16px);
    }

    .upload-btn,
    .emoji-button {
        width: 36px;
        height: 36px;
        border-radius: 11px;
        font-size: 17px;
    }

    .emoji-button {
        background: #383a40;
        border: 1px solid rgba(255, 255, 255, 0.05);
        color: #aeb4bc;
    }

    .send-btn {
        grid-column: 4;
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0;
        line-height: 1;
        justify-self: end;
        align-self: end;
    }

    .send-btn::before {
        content: "➜";
        font-size: 16px;
        font-weight: 700;
    }

    .voice-controls {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 8px;
        margin-top: 10px;
        margin-left: 0;
        justify-content: stretch;
    }

    .mic-status {
        width: 100%;
        justify-content: center;
    }

    .voice-toggle-btn {
        flex: 1 1 calc(50% - 4px);
        min-height: 42px;
        padding: 10px 12px;
        border-radius: 12px;
    }

    .mention-suggestions,
    .emoji-picker {
        left: 0;
        right: 0;
        width: auto;
        max-width: 100%;
    }

    .emoji-picker {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .servers-sidebar,
    .channels-sidebar {
        width: 100vw;
    }

    .channels-sidebar {
        top: 70px;
        height: calc(100dvh - 70px);
    }

    .servers-sidebar {
        padding: 10px 10px 9px;
    }

    .server-btn,
    .sidebar-action-btn {
        width: 40px;
        height: 40px;
        border-radius: 13px;
    }

    .chat-input-area {
        padding-left: 8px;
        padding-right: 8px;
    }

    .chat-input-row {
        grid-template-columns: 34px minmax(0, 1fr) 34px 36px;
        gap: 6px;
        padding: 8px 8px;
    }

    .upload-btn,
    .emoji-button {
        width: 34px;
        height: 34px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .emoji-picker {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
        padding: 10px;
    }
}


@media (max-width: 420px) {
    .chat-header {
        padding: 10px;
    }

    .chat-header h1 {
        font-size: 16px;
    }

    #chatMeta {
        font-size: 11px;
    }

    .voice-controls {
        gap: 6px;
    }

    .voice-toggle-btn {
        flex-basis: 100%;
        min-height: 40px;
        font-size: 13px;
    }

    .current-user-actions {
        gap: 10px;
    }

    .quick-action-btn {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .chat-input-area {
        padding-left: 6px;
        padding-right: 6px;
    }

    .chat-input-row {
        grid-template-columns: 32px minmax(0, 1fr) 32px 34px;
        gap: 5px;
        padding: 7px;
    }

    .upload-btn,
    .emoji-button {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 16px;
    }

    .send-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .message-input {
        padding: 10px 2px;
        font-size: 15px;
    }
}

/* ==================================================
   0.2.2 SOCIAL UPDATE
================================================== */

.server-btn {
    position: relative;
}

.server-btn-content {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.server-unread-badge {
    position: absolute;
    right: -4px;
    bottom: -4px;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #5865f2;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    border: 2px solid #111214;
}

.server-unread-badge.has-mention,
.channel-unread-badge.has-mention {
    background: #f0b232;
    color: #1e1f22;
}

.pinned-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
}

.pinned-bar-text {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pinned-bar-label {
    color: #ffd78a;
    font-weight: 700;
}

#pinnedBarMeta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #c9ced7;
    font-size: 14px;
}

.pinned-bar-btn {
    border: none;
    border-radius: 10px;
    background: #404249;
    color: #ffffff;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    flex-shrink: 0;
}

.pinned-bar-btn:hover {
    background: #4b4d55;
}

.pins-modal-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pin-item {
    border: none;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    padding: 14px;
    color: #ffffff;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pin-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.pin-item strong {
    font-size: 14px;
}

.pin-item span {
    font-size: 13px;
    color: #b5bac1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: #ffd78a;
    font-size: 12px;
    font-weight: 700;
}

.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.message-reaction,
.message-reaction-add {
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    min-height: 32px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.message-reaction strong {
    font-size: 12px;
}

.message-reaction.active {
    background: rgba(88, 101, 242, 0.22);
    color: #dfe3ff;
}

.message-reaction:hover,
.message-reaction-add:hover {
    background: rgba(255, 255, 255, 0.12);
}

.message-reaction-picker {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    background: #232428;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-reaction-picker-btn {
    border: none;
    border-radius: 10px;
    min-height: 36px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-size: 18px;
}

.message-reaction-picker-btn:hover {
    background: rgba(88, 101, 242, 0.22);
}

.unread-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0;
    color: #ffb648;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.unread-divider::before,
.unread-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(240, 178, 50, 0.35);
}

.unread-divider::before {
    margin-right: 10px;
}

.unread-divider::after {
    margin-left: 10px;
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .pinned-bar {
        padding: 9px 12px;
        gap: 8px;
    }

    .pinned-bar-text {
        display: grid;
        gap: 4px;
    }

    #pinnedBarMeta {
        font-size: 12px;
    }

    .message-reaction,
    .message-reaction-add {
        min-height: 30px;
        padding: 5px 9px;
        font-size: 13px;
    }

    .message-reaction-picker {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


.site-logo-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.file-preview-badge {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(88, 101, 242, 0.16);
    font-size: 24px;
    flex-shrink: 0;
}

.file-preview-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-preview-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    word-break: break-word;
}

.file-preview-meta {
    font-size: 12px;
    color: #a2a7ad;
}

.message-file-card {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-decoration: none;
    max-width: min(360px, 100%);
}

.message-file-card:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
}

.message-file-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(88, 101, 242, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.message-file-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-file-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    word-break: break-word;
}

.message-file-meta {
    font-size: 12px;
    color: #a2a7ad;
}

.message-file-card.is-video-file {
    margin-top: 12px;
}

.message-video-player {
    display: block;
    /* На ПК видео не должно занимать почти всю ширину чата.
       Делаем более компактный контейнер, как у обычных мессенджеров. */
    width: min(360px, 100%);
    max-width: 100%;
    max-height: min(70vh, 520px);
    height: auto;
    margin-top: 12px;
    border-radius: 16px;
    background: #0f1014;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    object-fit: contain;
}

.message-embed-card {
    position: relative;
    /* Встраиваемые ролики со сторонних сервисов на ПК тоже делаем компактнее,
       чтобы они не съедали весь экран чата. */
    width: min(520px, 100%);
    max-width: 100%;
    max-height: 420px;
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    background: #0f1014;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    aspect-ratio: 16 / 9;
}

.message-embed-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #0f1014;
}

@media (max-width: 768px) {
    .message-video-player,
    .message-embed-card {
        width: 100%;
        border-radius: 14px;
    }
}

.chat-input-shell.drag-over .chat-input-row {
    outline: 2px dashed rgba(88, 101, 242, 0.58);
    outline-offset: 2px;
    background: #3e4148;
}


/* ==================================================
   0.2.4.2 UX HOTFIX
================================================== */

.scroll-to-bottom-btn {
    position: absolute;
    right: 22px;
    bottom: 96px;
    z-index: 35;
    border: none;
    border-radius: 999px;
    background: rgba(15, 16, 20, 0.94);
    color: #ffffff;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.scroll-to-bottom-btn:hover {
    background: rgba(35, 36, 40, 0.98);
    transform: translateY(-1px);
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .scroll-to-bottom-btn {
        right: 12px;
        bottom: calc(78px + env(safe-area-inset-bottom));
        padding: 9px 12px;
        font-size: 12px;
    }
}


/* ==================================================
   0.2.4.3 CHAT / MOBILE / ANTISPAM HOTFIX
================================================== */

.mobile-users-section {
    display: none;
    margin-top: 0;
    flex: none;
}

.mute-notice {
    position: absolute;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%);
    z-index: 42;
    max-width: min(520px, calc(100% - 40px));
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(218, 55, 60, 0.96);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}

.scroll-to-bottom-btn {
    right: 18px;
    bottom: 92px;
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .channels-sidebar {
        overflow-y: auto;
    }

    .mobile-users-section {
        display: block;
        flex: none;
    }

    .scroll-to-bottom-btn {
        right: 12px;
        bottom: calc(82px + env(safe-area-inset-bottom));
    }

    .mute-notice {
        bottom: calc(78px + env(safe-area-inset-bottom));
        max-width: calc(100% - 24px);
        font-size: 12px;
        padding: 9px 12px;
    }
}


/* ==================================================
   0.2.4.5 MEMBERS / CONFIRM / ROLE COLORS HOTFIX
================================================== */

.role-create-btn {
    min-width: 44px;
    padding: 9px 12px;
    font-size: 22px;
    line-height: 1;
}

.role-definition-item {
    border-left: 4px solid rgba(255,255,255,0.08);
}

.role-definition-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.role-definition-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.role-badge {
    background: rgba(255, 255, 255, 0.04);
}

.message-dropdown-actions-row {
    align-items: stretch;
}

.message-dropdown-actions-row button.danger {
    color: #ff8080;
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .mobile-users-section {
        display: block;
        padding: 12px 10px 16px;
        border-top: 1px solid rgba(255,255,255,0.06);
        margin-top: 8px;
    }

    .mobile-users-list {
        flex: none;
        overflow: visible;
        max-height: none;
        padding: 0;
    }

    .mobile-users-list .user-card {
        padding: 8px 10px;
    }

    .users-toggle-btn-mobile {
        width: 100%;
    }
}

/* === Settings tabs / 2FA === */
.settings-modal-card {
    width: min(980px, 100%);
}

.settings-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 18px;
    margin-top: 18px;
}

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

.settings-tab-btn {
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #dbdee1;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    font-weight: 700;
}

.settings-tab-btn.active,
.settings-tab-btn:hover {
    background: rgba(88, 101, 242, 0.2);
    color: #fff;
}

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

.settings-panel.active {
    display: flex;
}

.settings-profile-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.settings-profile-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-profile-meta strong {
    font-size: 18px;
}

.settings-profile-meta span {
    color: #b5bac1;
}

.settings-textarea {
    min-height: 96px;
    resize: vertical;
}

.settings-2fa-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-backup-codes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-backup-codes-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.settings-backup-codes-list code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 10px;
    background: #111214;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #d7dcff;
    font-size: 13px;
    padding: 8px 10px;
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .settings-tabs {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.settings-profile-grid {
    display: grid;
    gap: 14px;
}

.member-profile-card-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1198;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 160ms ease;
}

.member-profile-card-backdrop.visible {
    opacity: 1;
}

.member-profile-card {
    position: fixed;
    z-index: 1199;
    width: min(320px, calc(100vw - 24px));
    background: #232428;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    transition: opacity 160ms ease, transform 160ms ease;
}

.member-profile-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.member-profile-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
}

.member-profile-card-title {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.member-profile-card-presence,
.member-profile-card-text-status,
.member-profile-card-bio,
.member-profile-card-registration {
    font-size: 14px;
    line-height: 1.45;
    color: #c9ced6;
}

.member-profile-card-presence.online {
    color: #57f287;
}

.user-card {
    cursor: pointer;
}


html {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 999px;
}

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

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
}

h1, h2, h3, .server-title, .chat-header h1, .channels-header h2 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

.server-btn,
.sidebar-action-btn,
.channel-btn,
.header-btn,
.send-btn,
.upload-btn,
.voice-toggle-btn,
.users-toggle-btn,
.server-menu-btn,
.modal-card,
.current-user-box,
.message,
.pinned-bar,
.chat-input-shell {
    transition: transform var(--motion-fast), box-shadow var(--motion-normal), background var(--motion-fast), border-color var(--motion-fast), opacity var(--motion-fast);
}

.server-btn:hover,
.sidebar-action-btn:hover,
.channel-btn:hover,
.header-btn:hover,
.send-btn:hover,
.upload-btn:hover,
.voice-toggle-btn:hover,
.users-toggle-btn:hover,
.server-menu-btn:hover {
    transform: translateY(-1px);
}

.message {
    animation: messageFadeIn 0.18s ease;
    transform-origin: left center;
}

.chat-input-shell,
.pinned-bar,
.current-user-box,
.modal-card {
    backdrop-filter: blur(10px);
}

@keyframes messageFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


@media (max-width: 900px) {
    .messages-container.voice-stage-mode {
        padding: 16px;
    }

    .voice-stage-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .voice-stage-hero h3 {
        font-size: 24px;
    }

    .voice-user-avatar-xl {
        width: 84px;
        height: 84px;
        font-size: 28px;
    }
}

.voice-placeholder-mode .chat-input-area,
.voice-placeholder-mode .typing-indicator {
    display: none !important;
}


/* ==================================================
   alpha-0.5.0 CHANNEL COUNTS / ROLE MANAGER / PROFILE ROLES
================================================== */

.channel-btn-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.channel-voice-occupancy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #d7dcff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.channel-voice-occupancy.is-full {
    background: rgba(218, 55, 60, 0.18);
    color: #ffb3b8;
}

.channel-btn.renamable {
    user-select: none;
}

.member-profile-card-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: -2px;
}

.role-manager-modal-card {
    width: min(1180px, calc(100vw - 32px));
    max-height: min(92vh, 920px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.role-manager-modal-card .modal-header {
    flex-wrap: wrap;
    align-items: flex-start;
}

.role-manager-modal-card .role-manager-grid {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
}

.role-manager-modal-card .role-panel {
    min-width: 0;
    max-height: calc(92vh - 180px);
    overflow: auto;
}

.role-manager-modal-card .role-panel .header-btn,
.role-manager-modal-card .role-create-form .header-btn,
.role-manager-modal-card .role-definition-actions .header-btn,
.role-manager-modal-card .role-member-actions .header-btn {
    width: auto;
    min-width: 0;
    text-align: center;
}

.role-manager-modal-card .role-create-form {
    align-items: stretch;
    flex-wrap: wrap;
}

.role-manager-modal-card .role-create-form .modal-input {
    flex: 1 1 220px;
    min-width: 0;
}

.role-definition-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.role-definition-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.role-definition-note {
    font-size: 12px;
    color: #b5bac1;
}

.role-definition-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.role-definition-name-input {
    min-width: 0;
}

.role-definition-color-input {
    width: 48px;
    min-width: 48px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
}

.role-member-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.role-member-summary-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.role-member-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #5865f2;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: 0 0 auto;
}

.role-member-summary-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.role-member-presence {
    font-size: 12px;
    color: #b5bac1;
}

.role-member-presence.online {
    color: #57f287;
}

.role-member-counter,
.role-summary-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #d7dcff;
    font-size: 12px;
    font-weight: 700;
}

.role-member-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.role-dropdown-section {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.role-dropdown-section summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    font-weight: 700;
    color: #f2f3f5;
}

.role-dropdown-section summary::-webkit-details-marker {
    display: none;
}

.role-dropdown-section[open] summary {
    background: rgba(88, 101, 242, 0.12);
}

.role-dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 14px 14px;
}

.role-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-field-label {
    font-size: 12px;
    font-weight: 700;
    color: #b5bac1;
    letter-spacing: 0.01em;
}

.member-role-dropdown-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.member-role-option {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.member-role-option .role-badge {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-member-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.role-member-actions .danger,
.role-member-actions .danger-btn {
    background: rgba(240, 71, 71, 0.14);
}

.role-manager-modal-card .role-members-list {
    gap: 14px;
}

.role-manager-modal-card .role-banned-title {
    margin-top: 22px;
}

@media (max-width: 980px) {
    .role-manager-modal-card {
        width: min(100vw - 16px, 100%);
        max-height: calc(100vh - 16px);
        padding: 18px;
    }

    .role-manager-modal-card .role-panel {
        max-height: none;
    }

    .role-definition-actions {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .role-definition-actions .role-definition-name-input {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .role-definition-actions {
        grid-template-columns: 1fr 1fr;
    }

    .role-definition-actions .role-definition-name-input,
    .role-definition-actions .role-definition-color-input {
        grid-column: 1 / -1;
    }

    .role-manager-modal-card .role-member-actions .header-btn {
        flex: 1 1 100%;
    }

    .member-role-dropdown-list {
        grid-template-columns: 1fr;
    }

    .channel-voice-occupancy {
        min-width: 40px;
        padding-inline: 7px;
    }
}



/* ==================================================
   alpha-0.5.0 SETTINGS / CHANNEL MENU / ROLE PICKERS
================================================== */

.settings-limit-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #b5bac1;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    color: #d7dcff;
}

.settings-2fa-qr-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 0 4px;
}

.settings-2fa-qr-image {
    width: 220px;
    height: 220px;
    max-width: min(100%, 220px);
    border-radius: 18px;
    background: #ffffff;
    padding: 10px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.role-definition-color-input {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    cursor: pointer;
    overflow: hidden;
}

.role-definition-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.role-definition-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.role-definition-color-input::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}

.channel-entry {
    position: relative;
}

.channel-entry-row {
    align-items: stretch;
}

.channel-menu-btn {
    align-self: stretch;
}

.channel-dropdown {
    margin-left: 0;
    margin-top: 8px;
}

.channel-dropdown button {
    display: block;
}

.channel-dropdown button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.role-dropdown-section summary::after {
    content: "▾";
    font-size: 12px;
    opacity: 0.72;
    transition: transform 0.16s ease;
}

.role-dropdown-section:not([open]) summary::after {
    transform: rotate(-90deg);
}

/* ==================================================
   alpha-0.6.1 BUGFIX / MOBILE SETTINGS / MEDIA SHORTCUTS
================================================== */

.header-btn.icon-only {
    min-width: 40px;
    padding-inline: 10px;
}

.sidebar-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
}

#mobileSettingsBtn {
    display: none;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-header-main {
    min-width: 0;
    flex: 1 1 auto;
}

.chat-header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: min(420px, 42vw);
    margin-left: auto;
}

.chat-header-search-input {
    width: 100%;
    min-width: 180px;
    border: 1px solid rgba(255,255,255,0.08);
    background: #1f2023;
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}

.chat-header-search-input:focus {
    border-color: rgba(88, 101, 242, 0.72);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.16);
}

.users-media-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 8px 0;
    padding: 12px 8px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.users-media-btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

.empty-state-with-actions {
    max-width: 720px;
    margin: 40px auto;
}

.empty-state-channel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 18px;
}

.empty-state-channel-btn {
    border: 1px solid rgba(255,255,255,0.08);
    background: #2f3136;
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}

.empty-state-channel-btn:hover {
    background: #404249;
}

.channel-access-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 184, 108, 0.14);
    color: #ffd28a;
    font-size: 11px;
    font-weight: 800;
}

.channel-access-chip.voice {
    background: rgba(88, 101, 242, 0.14);
    color: #d7dcff;
}

.invite-preview-card {
    width: min(540px, 100%);
    margin: 38px auto;
    padding: 28px;
    border-radius: 22px;
    background: #2b2d31;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 46px rgba(0,0,0,0.28);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.invite-preview-avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    overflow: hidden;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.invite-preview-card h3 {
    margin: 0;
    font-size: 28px;
}

.invite-preview-card p {
    margin: 0;
    color: #b5bac1;
}

.invite-preview-join-btn {
    min-width: 190px;
    min-height: 44px;
}

.search-results-modal-card {
    width: min(980px, 100%);
}

.dynamic-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(70vh, 760px);
    overflow: auto;
    padding-top: 10px;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-result-card,
.media-library-card {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.08);
    background: #232428;
    color: #fff;
    border-radius: 16px;
    padding: 14px;
    text-align: left;
    cursor: pointer;
}

.search-result-card:hover,
.media-library-card:hover {
    background: #2d2f34;
}

.search-result-card-top,
.search-result-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #b5bac1;
    font-size: 12px;
}

.search-result-card-body {
    margin: 8px 0;
    color: #f2f3f5;
    line-height: 1.45;
    word-break: break-word;
}

.media-library-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.media-library-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 14px;
    overflow: hidden;
    background: #111214;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.media-library-image-preview,
.media-library-video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-library-file-icon {
    font-size: 36px;
}

.media-library-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #b5bac1;
    font-size: 12px;
}

.media-library-meta strong {
    color: #fff;
    font-size: 14px;
    word-break: break-word;
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    #mobileSettingsBtn {
        display: inline-flex;
    }

    .chat-header {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .chat-header-main {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
    }

    .chat-header-search {
        order: 3;
        min-width: 100%;
        margin-left: 0;
    }

    .voice-controls {
        order: 2;
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
    }

    .settings-modal-card,
    .search-results-modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 100dvh;
        border-radius: 18px 18px 0 0;
        padding: 16px;
    }

    .settings-modal-card .modal-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .settings-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .settings-tab-btn {
        flex: 1 0 auto;
        min-width: 132px;
        white-space: nowrap;
    }

    .settings-panels {
        min-width: 0;
    }

    .settings-profile-preview {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-profile-avatar {
        width: 64px;
        height: 64px;
    }

    .settings-inline-actions {
        flex-direction: column;
    }

    .settings-inline-actions .header-btn {
        width: 100%;
        justify-content: center;
    }

    .settings-2fa-qr-image {
        width: min(100%, 220px);
        height: auto;
    }

    .dynamic-modal-body {
        max-height: calc(100dvh - 120px);
    }

    .invite-preview-card {
        margin: 20px auto;
        padding: 20px;
        border-radius: 18px;
    }

    .invite-preview-card h3 {
        font-size: 24px;
    }

    .users-media-shortcuts {
        margin-inline: 4px;
        padding-inline: 4px;
    }

    .users-media-btn {
        width: 100%;
    }
}
.chat-header .voice-controls {
    margin-left: 0;
    flex: 0 0 auto;
}
.empty-state-channel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================================================
   alpha-0.7.0 DIRECT MESSAGES / FRIENDS / GROUP CHATS
================================================== */

.dm-home-btn.active {
    background: rgba(88, 101, 242, 0.2);
    box-shadow: inset 0 0 0 1px rgba(88, 101, 242, 0.45);
}

.dm-entry {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    color: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.dm-entry:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(88, 101, 242, 0.22);
}

.dm-entry.active {
    background: rgba(88, 101, 242, 0.12);
    border-color: rgba(88, 101, 242, 0.36);
    box-shadow: inset 0 0 0 1px rgba(88, 101, 242, 0.12);
}

.dm-entry-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 16px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(88, 101, 242, 0.16), rgba(88, 101, 242, 0.08));
    color: #f4f6ff;
    overflow: hidden;
}

.dm-entry-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dm-entry-title {
    font-weight: 700;
    font-size: 14px;
    color: #f2f4f8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-entry-meta {
    color: #a7b0bf;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-home-view {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
}

.dm-home-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dm-home-header h3 {
    margin: 0;
    font-size: 28px;
}

.dm-home-header p {
    margin: 0;
    color: #9aa3b2;
}

.dm-home-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dm-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.dm-home-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dm-friends-list,
.dm-request-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dm-request-section h4 {
    margin: 0;
    font-size: 16px;
    color: #dce3f0;
}

.dm-friend-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.dm-friend-avatar {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    overflow: hidden;
}

.dm-friend-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.dm-friend-info strong {
    font-size: 16px;
    color: #f6f7fb;
}

.dm-friend-info span {
    color: #9aa3b2;
    font-size: 13px;
}

.dm-friend-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.dm-modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dm-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 340px;
    overflow: auto;
    padding-right: 4px;
}

.dm-modal-friend-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.dm-modal-friend-option small {
    color: #98a2b3;
}

.dm-modal-actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    .dm-friend-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .dm-friend-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .dm-home-view {
        padding: 14px;
        gap: 14px;
    }

    .dm-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .dm-home-tabs {
        gap: 8px;
    }

    .dm-home-tabs .header-btn,
    .dm-search-row .header-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==================================================
   alpha-0.7.2 DM / CALL FIXES
================================================== */

.dm-home-icon {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-home-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.servers-sidebar .sidebar-top {
    width: 100%;
    justify-content: flex-start;
}

.servers-sidebar .sidebar-bottom {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.sidebar-action-btn.accent {
    background: linear-gradient(180deg, rgba(88, 101, 242, 0.92), rgba(71, 82, 196, 0.92));
    box-shadow: 0 10px 22px rgba(88, 101, 242, 0.28);
}

.sidebar-action-btn.accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(88, 101, 242, 0.34);
}

.dm-home-view {
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
}

.dm-home-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(24, 25, 28, 0.96), rgba(24, 25, 28, 0.88));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.dm-home-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dm-home-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 18px;
}

.dm-home-tabs .header-btn {
    width: 100%;
    justify-content: center;
    border-radius: 14px;
    min-height: 42px;
}

.dm-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.dm-search-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.dm-search-actions .header-btn {
    min-width: 110px;
    justify-content: center;
}

.dm-friend-card.interactive {
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.dm-friend-card.interactive:hover {
    transform: translateY(-1px);
    border-color: rgba(88, 101, 242, 0.28);
    background: rgba(88, 101, 242, 0.08);
}

.dm-friend-card.interactive:focus-visible {
    outline: 2px solid rgba(88, 101, 242, 0.88);
    outline-offset: 2px;
}

.message-system-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 16px;
    margin: 0 auto 14px;
    max-width: min(520px, 100%);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.message-system-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(88, 101, 242, 0.18);
    color: #dfe4ff;
    font-size: 12px;
    font-weight: 700;
}

.message-system-text {
    color: #f3f5fb;
    font-weight: 600;
}

.message-system-time {
    color: #98a2b3;
    font-size: 12px;
}

.incoming-call-modal {
    backdrop-filter: blur(14px);
    background: rgba(10, 11, 14, 0.68);
}

.incoming-call-card {
    width: min(420px, calc(100vw - 32px));
    padding: 28px 24px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(27, 29, 35, 0.98), rgba(20, 21, 26, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.incoming-call-avatar {
    width: 92px;
    height: 92px;
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: linear-gradient(180deg, rgba(88, 101, 242, 0.2), rgba(88, 101, 242, 0.08));
    color: #f6f8ff;
    box-shadow: 0 18px 34px rgba(88, 101, 242, 0.18);
}

.incoming-call-label {
    color: #aeb8c8;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.incoming-call-name {
    font-size: 28px;
    font-weight: 800;
    color: #fbfcff;
}

.incoming-call-subtitle {
    color: #b9c1cf;
    font-size: 14px;
    line-height: 1.5;
}

.incoming-call-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
    margin-top: 6px;
}

.incoming-call-actions .header-btn {
    min-width: 132px;
    justify-content: center;
}

.server-settings-card {
    margin-top: 18px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.server-settings-card-header h3 {
    margin: 0;
    font-size: 16px;
}

.server-settings-card-header p {
    margin: 6px 0 0;
    color: #b5bac1;
    font-size: 13px;
    line-height: 1.45;
}

.server-settings-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.server-emoji-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 24px;
}

.server-emoji-chip,
.server-emoji-preview-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.server-emoji-chip {
    font-size: 18px;
}

.server-emoji-preview-hint {
    color: #b5bac1;
    font-size: 13px;
}

.users-media-shortcuts {
    margin: 14px 12px 0;
    padding: 14px 10px 0;
    gap: 10px;
}

.users-media-btn {
    min-height: 42px;
    padding-inline: 14px;
}

@media (max-width: 720px) {
    .dm-entry {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        padding: 10px;
    }

    .incoming-call-card {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .incoming-call-avatar {
        width: 82px;
        height: 82px;
    }

    .incoming-call-name {
        font-size: 24px;
    }

    .incoming-call-actions {
        flex-direction: column-reverse;
    }

    .incoming-call-actions .header-btn {
        width: 100%;
    }
}

@media (max-width: 860px) {
    .servers-sidebar .sidebar-bottom {
        flex-direction: row;
        margin-top: 0;
        width: auto;
    }

    .dm-home-view {
        padding: 12px;
    }

    .dm-home-header {
        padding: 14px;
        border-radius: 20px;
    }

    .dm-search-row {
        grid-template-columns: 1fr;
    }

    .dm-search-actions {
        width: 100%;
        justify-content: space-between;
    }

    .dm-search-actions .header-btn {
        flex: 1 1 0;
    }

    .dm-home-tabs {
        position: sticky;
        top: 0;
    }

    .dm-friend-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 12px;
        padding: 12px 14px;
        border-radius: 16px;
    }

    .dm-friend-avatar {
        width: 46px;
        height: 46px;
        border-radius: 16px;
    }

    .dm-friend-info strong {
        font-size: 15px;
    }

    .dm-friend-actions {
        grid-column: 1 / -1;
        width: 100%;
    }

    .dm-friend-actions .header-btn {
        flex: 1 1 0;
        justify-content: center;
    }

    .settings-modal-card {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        padding: 14px 14px calc(20px + env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
    }

    .settings-modal-card .modal-header {
        position: sticky;
        top: 0;
        z-index: 2;
        padding-bottom: 10px;
        background: linear-gradient(180deg, rgba(31, 32, 35, 0.98), rgba(31, 32, 35, 0.9));
    }

    .settings-layout {
        display: flex;
        flex-direction: column;
        min-height: 0;
        gap: 12px;
    }

    .settings-tabs {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
        padding-bottom: 0;
    }

    .settings-tab-btn {
        min-width: 0;
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .settings-panels {
        min-height: 0;
        overflow: auto;
        padding-right: 2px;
    }
}

@media (max-width: 640px) {
    .servers-sidebar .sidebar-top {
        width: auto;
    }

    .servers-sidebar .sidebar-bottom {
        gap: 6px;
    }

    .dm-home-header {
        padding: 12px;
        gap: 12px;
    }

    .dm-home-tabs {
        gap: 6px;
        padding: 5px;
    }

    .dm-home-tabs .header-btn {
        min-height: 38px;
        padding-inline: 10px;
        font-size: 13px;
    }

    .dm-search-actions {
        gap: 8px;
    }

    .dm-search-actions .header-btn {
        min-width: 0;
    }

    .users-media-shortcuts {
        margin: 12px 10px 0;
        padding: 12px 8px 0;
    }
}

.header-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #f5f7fb;
}

.header-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* ==================================================
   alpha-0.7.4 DIRECT PATCH
================================================== */

.servers-divider {
    width: 30px;
    height: 1px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    margin: 2px 0 4px;
}

.servers-stack {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.servers-list {
    padding-bottom: 8px;
}

.servers-create-dock {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 12px 0 6px;
    margin-top: auto;
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(17, 18, 20, 0), rgba(17, 18, 20, 0.92) 36%, rgba(17, 18, 20, 1));
    backdrop-filter: blur(10px);
    z-index: 2;
}

.sidebar-bottom {
    margin-top: 0 !important;
    padding-top: 4px;
}

.dm-home-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dm-friend-card,
.dm-request-section {
    overflow: hidden;
}

.dm-friend-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 14px 16px;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.dm-friend-card:hover {
    transform: translateY(-1px);
    border-color: rgba(88, 101, 242, 0.35);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.dm-friend-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.dm-friend-info {
    min-width: 0;
}

.dm-friend-info strong {
    display: block;
    font-size: 17px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.dm-friend-info span {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dm-friend-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.member-profile-card {
    width: min(360px, calc(100vw - 24px));
}

.member-profile-card-header-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: start;
}

.member-profile-card-header-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.member-profile-card-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.member-profile-card-menu {
    position: absolute;
    z-index: 120;
    min-width: 180px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(30, 31, 34, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.member-profile-card-menu .header-btn {
    width: 100%;
    justify-content: center;
}

.user-card.speaking,
.user-card.in-call {
    border-color: rgba(87, 242, 135, 0.22);
}

.user-avatar.speaking,
.user-avatar.in-call {
    box-shadow: 0 0 0 3px rgba(87, 242, 135, 0.88), 0 0 0 8px rgba(87, 242, 135, 0.18);
}

.direct-call-inline {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(38, 40, 45, 0.96), rgba(32, 34, 39, 0.9));
    border: 1px solid rgba(87, 242, 135, 0.18);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.direct-call-inline-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.direct-call-inline-header strong,
.direct-call-inline-header span {
    display: block;
}

.direct-call-inline-header span {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 4px;
}

.direct-call-inline-members {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.direct-call-member {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.direct-call-member.speaking {
    border-color: rgba(87, 242, 135, 0.45);
    box-shadow: 0 0 0 1px rgba(87, 242, 135, 0.18) inset;
}

.direct-call-member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.direct-call-member.speaking .direct-call-member-avatar {
    box-shadow: 0 0 0 3px rgba(87, 242, 135, 0.92), 0 0 0 7px rgba(87, 242, 135, 0.18);
}

.direct-call-member-info {
    min-width: 0;
}

.direct-call-member-info strong,
.direct-call-member-info span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-call-member-info span {
    color: rgba(255, 255, 255, 0.68);
    margin-top: 3px;
}

@media (max-width: 900px) {
    .dm-home-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dm-search-row {
        grid-template-columns: 1fr;
    }

    .dm-search-actions {
        justify-content: stretch;
    }

    .dm-search-actions .header-btn {
        flex: 1 1 0;
    }
}

@media (max-width: 640px) {
    .servers-stack {
        flex: 1 1 auto;
    }

    .servers-create-dock {
        padding-bottom: 2px;
    }

    .member-profile-card-header-row {
        grid-template-columns: 1fr;
    }

    .member-profile-card-header-actions {
        justify-content: stretch;
    }

    .member-profile-card-header-actions .header-btn {
        flex: 1 1 0;
    }

    .direct-call-member {
        min-width: 0;
        width: 100%;
    }
}


/* ==================================================
   alpha-0.7.4 DM / MOBILE / VOICE FIXES
================================================== */

#dmBackBtn {
    flex-shrink: 0;
}

.servers-create-dock {
    display: none !important;
}

.create-server-btn {
    flex-shrink: 0;
}

.servers-stack {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

.servers-list {
    width: 100%;
    align-content: flex-start;
}

.member-profile-card {
    overflow: visible;
}

.member-profile-card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-left: auto;
}

.member-profile-card-header-actions .header-btn {
    min-height: 36px;
}

.member-profile-card-header-actions .header-btn:not(.icon-only) {
    min-width: 0;
    padding-inline: 12px;
}

.member-profile-card-header-actions .header-btn.icon-only {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    font-size: 18px;
}

.member-profile-card-header-actions .header-btn.compact {
    border-radius: 10px;
}

.member-profile-card-menu {
    position: fixed;
    z-index: 220;
}

@media (max-width: 860px) {
    .servers-sidebar {
        gap: 8px;
        align-items: center;
    }

    .servers-sidebar .sidebar-top,
    .servers-sidebar .sidebar-bottom {
        flex-shrink: 0;
        min-width: max-content;
        gap: 8px;
    }

    .servers-sidebar .servers-stack {
        flex: 1 1 auto;
        min-width: 0;
    }

    .servers-sidebar .servers-list {
        width: 100%;
        gap: 8px;
        padding: 0 4px;
    }

    .servers-divider {
        width: 22px;
        margin: 0 2px 0 0;
    }
}

@media (max-width: 640px) {
    .servers-sidebar {
        padding: 10px 8px 9px;
        gap: 6px;
    }

    .servers-sidebar .sidebar-top,
    .servers-sidebar .sidebar-bottom {
        gap: 6px;
    }

    .servers-sidebar .servers-list {
        gap: 6px;
        padding: 0 2px;
    }

    .member-profile-card {
        width: min(320px, calc(100vw - 20px));
    }

    .member-profile-card-header-row {
        grid-template-columns: 52px minmax(0, 1fr);
        align-items: center;
    }

    .member-profile-card-header-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .member-profile-card-header-actions .header-btn:not(.icon-only) {
        flex: 1 1 auto;
    }
}


/* ==================================================
   alpha-0.7.5 DM / CARD / CALL FIXES
================================================== */

.channels-list.dm-conversations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 12px;
}

.channels-list.dm-conversations-list .empty-state.compact {
    margin: 8px 2px 0;
}

.dm-entry {
    margin: 0;
}

.dm-home-view {
    max-width: none;
    width: 100%;
    margin: 0;
    gap: 16px;
    padding: 18px 20px;
}

.dm-home-header {
    position: static;
    padding: 0 0 16px;
    margin: 0 0 2px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

.dm-home-heading h3 {
    font-size: 32px;
    line-height: 1.1;
}

.dm-home-heading p {
    color: #a8b1c2;
}

.dm-home-tabs {
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.dm-home-tabs .header-btn {
    min-height: 40px;
    background: rgba(255, 255, 255, 0.06);
}

.member-profile-card {
    width: min(388px, calc(100vw - 24px));
}

.member-profile-card-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-profile-card-header-row {
    grid-template-columns: 60px minmax(0, 1fr) auto;
    gap: 12px;
}

.member-profile-card-header-actions {
    flex-wrap: nowrap;
    gap: 6px;
    margin-left: auto;
    align-self: flex-start;
}

.member-profile-card-header-actions .header-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
    line-height: 1;
}

.member-profile-card-header-actions .header-btn.compact {
    width: 34px;
    min-width: 34px;
    padding: 0;
    justify-content: center;
    font-size: 18px;
}

.member-profile-card-header-main {
    min-width: 0;
}

.dm-friend-actions .header-btn,
.member-profile-card-header-actions .header-btn {
    box-shadow: none;
}

@media (max-width: 860px) {
    .servers-sidebar {
        align-items: stretch;
        gap: 8px;
    }

    .servers-sidebar .servers-list {
        gap: 8px;
        padding: 0 2px;
    }
}

@media (max-width: 640px) {
    .dm-home-view {
        padding: 14px 14px 18px;
        gap: 14px;
    }

    .dm-home-header {
        padding-bottom: 14px;
        gap: 10px;
    }

    .dm-home-heading h3 {
        font-size: 26px;
    }

    .dm-home-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .member-profile-card {
        width: min(320px, calc(100vw - 20px));
    }

    .member-profile-card-header-row {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 10px;
    }

    .member-profile-card-header-actions {
        grid-column: 2;
        justify-content: flex-end;
        align-self: start;
    }

    .member-profile-card-header-actions .header-btn {
        padding: 0 10px;
        min-height: 32px;
        font-size: 12px;
    }

    .member-profile-card-header-actions .header-btn.compact {
        width: 32px;
        min-width: 32px;
        font-size: 17px;
    }
}
