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

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #1e1e1e;
    color: #f0f0f0;
    overflow: hidden;
}

/* Auth Screen */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background-color: #2b2b2b;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 400px;
}

    .auth-box h1 {
        text-align: center;
        margin-bottom: 30px;
        color: #fff;
    }

.auth-form h2 {
    margin-bottom: 20px;
    color: #f0f0f0;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    color: #f0f0f0;
    font-size: 14px;
}

    .auth-form input:focus {
        outline: none;
        border-color: #5865f2;
    }

.auth-form button {
    width: 100%;
    padding: 12px;
    background-color: #5865f2;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .auth-form button:hover {
        background-color: #4752c4;
    }

.auth-form p {
    margin-top: 15px;
    text-align: center;
    color: #aaa;
}

.auth-form a {
    color: #5865f2;
    text-decoration: none;
}

    .auth-form a:hover {
        text-decoration: underline;
    }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 4px;
    color: #6b7280;
    font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    margin-top: 12px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
}
.btn-google:hover {
    background: #f8f8f8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Top Navigation */
.top-nav-container {
    position: relative;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    height: 50px;
    background-color: #3a3a3a;
    border-bottom: 2px solid #555;
    overflow-x: auto;
}

.left-section, .right-section {
    display: flex;
    gap: 8px;
}

.space-rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex: 1;
    padding: 0 10px;
}

    .space-rail button, .top-nav .logo-btn, .right-section button {
        position: relative;
        flex: 0 0 auto;
        width: 40px;
        height: 40px;
        background: #4a4a4a;
        color: #f0f0f0;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 14px;
        transition: background-color 0.2s, border-radius 0.2s;
    }

        .space-rail button:hover, .top-nav .logo-btn:hover, .right-section button:hover {
            background: #5a5a5a;
            border-radius: 16px;
        }

        .space-rail button.active {
            background: #5865f2;
            border-radius: 16px;
        }

.top-nav .logo-btn img {
    height: 32px;
    width: 32px;
}

/* User Status Bar */
.user-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    height: 45px;
    background-color: #2a2a2a;
    border-bottom: 1px solid #444;
}

.user-profile {
    width: 32px;
    height: 32px;
    background: #5865f2;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 160px;
    max-width: 160px;
}

    .user-info .username {
        font-size: 14px;
        font-weight: 600;
    }

    .user-info .status {
        font-size: 12px;
        color: #b0b0b0;
    }

.toggle-button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background-color: #3c3c3c;
    color: #b0b0b0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

    .toggle-button:hover {
        background-color: #4a4a4a;
    }

    .toggle-button.active {
        background-color: rgb(54, 33, 39);
        color: #fff;
    }

#app-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.top-nav-container {
    flex-shrink: 0;
}

.user-status {
    flex-shrink: 0;
}

/* Main Layout */
.main-container {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Channels Panel */
.channels-panel {
    width: 220px;
    background-color: #2b2b2b;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #222;
    position: relative;
}

.server-name {
    font-weight: 700;
    font-size: 16px;
    padding: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #3a3a3a;
    color: #fff;
}

.channel-category {
    font-size: 12px;
    font-weight: 700;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #888;
    text-transform: uppercase;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
}

.drag-handle {
    opacity: 0;
    cursor: grab;
    padding: 0 4px;
    color: #888;
    font-size: 14px;
    transition: opacity 0.1s;
    user-select: none;
    flex-shrink: 0;
    line-height: 1;
}

.channel-button:hover .drag-handle,
.channel-category:hover .drag-handle {
    opacity: 0.5;
}

.drag-handle:hover {
    opacity: 1 !important;
}

.drag-ghost {
    opacity: 0.4;
}

.drag-drop-indicator {
    height: 2px;
    background: var(--accent, #5865f2);
    border-radius: 1px;
    margin: 1px 4px;
    pointer-events: none;
}

.channel-button {
    width: 200px;
    padding: 8px 10px;
    margin: 2px 0;
    background-color: transparent;
    color: #96989d;
    border: none;
    border-radius: 4px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s, color 0.15s;
}

    .channel-button:hover {
        background-color: #3a3a3a;
        color: #dcddde;
    }

    .channel-button.active {
        background-color: #404249;
        color: #fff;
    }

.create-channel-btn {
    margin-top: auto;
    padding: 8px;
    background-color: #3a3a3a;
    color: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

    .create-channel-btn:hover {
        background-color: #4a4a4a;
    }

/* Messages Panel */
.messages-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #36393f;
}

.messages-panel-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #202225;
    background-color: #36393f;
    flex-shrink: 0;
}

.channel-header {
    flex: 1;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 16px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-back-btn {
    display: none;
}

.messages-container {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s;
}

    .messages-container.drag-over {
        background-color: #2b2d31;
        border: 2px dashed #5865f2;
        border-radius: 8px;
    }

.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
    padding: 2px 2px;
    transition: background-color 0.15s;
    min-width: 0;
}

    .message:hover {
        background-color: #32353b;
    }

.message.mention-highlight {
    background-color: rgba(250, 166, 26, 0.06);
    border-left: 3px solid #faa61a;
    padding-left: 12px;
}
.message.mention-highlight:hover {
    background-color: rgba(250, 166, 26, 0.1);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.message-author {
    font-weight: 600;
    font-size: 15px;
    color: #fff;
}

.message-timestamp {
    font-size: 12px;
    color: #72767d;
    margin-left: 6px;
}

.message-content {
    margin-left: 48px;
    font-size: 15px;
    line-height: 1.4;
    color: #dcddde;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
}

/* ── Markdown ───────────────────────────────────────────────────────────────── */

/* Headers inside messages */
.msg-h1, .msg-h2, .msg-h3 {
    display: block;
    font-weight: 700;
    color: #f2f3f5;
    margin: 8px 0 2px;
    line-height: 1.375;
}
.msg-h1 { font-size: 24px; }
.msg-h2 { font-size: 20px; }
.msg-h3 { font-size: 16px; }

/* Blockquotes */
.msg-blockquote {
    display: flex;
    align-items: stretch;
    margin: 4px 0;
}
.msg-bq-bar {
    width: 4px;
    min-height: 100%;
    border-radius: 4px;
    background: #4e5058;
    flex-shrink: 0;
    margin-right: 12px;
}
.msg-bq-text {
    color: #dbdee1;
    min-width: 0;
}

/* Inline code */
.msg-inline-code {
    background: #1e1f22;
    border: 1px solid #2e3035;
    border-radius: 3px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.875em;
    padding: 0.05em 4px;
    white-space: pre-wrap;
    color: #e06c75;
}

/* Code blocks */
.msg-code-block {
    display: block;
    margin: 4px 0;
    background: #1e1f22;
    border: 1px solid #2e3035;
    border-radius: 4px;
    overflow: hidden;
    max-width: min(90%, 680px);
}
.msg-code-lang {
    background: #2b2d31;
    color: #80848e;
    font-size: 11px;
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 4px 12px;
    border-bottom: 1px solid #2e3035;
    text-transform: lowercase;
}
.msg-code-block pre {
    margin: 0;
    padding: 8px 12px;
    overflow-x: auto;
}
.msg-code-block code {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.875em;
    color: #dbdee1;
    white-space: pre;
    background: none;
    border: none;
    padding: 0;
}

/* Subtext (-# ) */
.msg-subtext {
    display: block;
    font-size: 12px;
    color: #949ba4;
    line-height: 1.4;
}

/* Spoiler */
.msg-spoiler {
    background: #202225;
    border-radius: 3px;
    cursor: pointer;
    color: transparent;
    padding: 0 2px;
    user-select: none;
    transition: color 0.1s, background 0.1s;
}
.msg-spoiler.revealed {
    background: #404249;
    color: inherit;
    cursor: default;
}

/* Lists */
.msg-list {
    margin: 4px 0 4px 24px;
    padding: 0;
}
.msg-list li { margin: 2px 0; }

/* Input Area Container */
.input-area {
    margin: 8px 16px;
}

/* File Preview - appears above input bar */
.file-preview {
    display: none;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 8px;
    background-color: #2b2d31;
    border-radius: 8px;
}

/* Input Bar - stays at bottom */
.input-bar {
    display: flex;
    gap: 8px;
    padding: 12px;
    background-color: #40444b;
    border-radius: 8px;
    align-items: flex-end;
    position: relative;
}

    .input-bar textarea#messageInput {
        flex: 1;
        padding: 10px;
        border-radius: 4px;
        border: none;
        background-color: #40444b;
        color: #dcddde;
        font-size: 14px;
        resize: none;
        overflow-y: hidden;
        line-height: 1.4;
        max-height: 200px;
        overflow-y: auto;
        font-family: inherit;
        display: block;
    }

        .input-bar textarea#messageInput:focus {
            outline: none;
        }

    .input-bar button {
        padding: 10px 20px;
        border: none;
        border-radius: 4px;
        background-color: #5865f2;
        color: #fff;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.2s;
        flex-shrink: 0;
    }

        .input-bar button:hover {
            background-color: #4752c4;
        }

.file-upload-btn {
    background-color: #3a3a3a !important;
    padding: 10px 12px !important;
    font-size: 18px;
}

    .file-upload-btn:hover {
        background-color: #4a4a4a !important;
    }

.file-preview-item {
    position: relative;
    background: #40444b;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 100px;
    max-width: 150px;
}

.preview-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

.file-preview-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: #3a3a3a;
    border-radius: 4px;
}

.file-preview-name {
    font-size: 11px;
    color: #dcddde;
    text-align: center;
    word-break: break-all;
    max-width: 100%;
}

.file-preview-size {
    font-size: 10px;
    color: #888;
}

.remove-file-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ed4245;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

    .remove-file-btn:hover {
        background: #c03537;
    }

/* Message Attachments */
.message-attachment {
    margin-top: 8px;
    max-width: 400px;
}

    .message-attachment a {
        text-decoration: none;
        color: inherit;
    }

.attachment-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}

    .attachment-image:hover {
        opacity: 0.9;
    }

.file-attachment {
    background: #2b2d31;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

    .file-attachment:hover {
        background: #32353b;
    }

    .file-attachment a {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

.file-icon {
    width: 48px;
    height: 48px;
    background: #3a3a3a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    color: #dcddde;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.edited-tag {
    font-size: 11px;
    color: #72767d;
    margin-left: 4px;
}

/* Members Panel */
.members-panel {
    width: 240px;
    background-color: #2b2b2b;
    padding: 10px;
    overflow-y: auto;
    border-left: 1px solid #222;
}

.member-role {
    font-size: 12px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    padding: 8px;
    margin-top: 10px;
}

.member {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s;
}

    .member:hover {
        background-color: #3a3a3a;
    }

.member-av-wrap {
    position: relative;
    flex-shrink: 0;
    margin-right: 8px;
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.member-name {
    font-size: 14px;
    color: #b9bbbe;
}

.member-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    bottom: 0;
    right: 0;
    border: 2px solid #2b2b2b;
}

    .member-status.online {
        background-color: #43b581;
    }

    .member-status.idle {
        background-color: #faa61a;
    }

    .member-status.dnd {
        background-color: #f04747;
    }

    .member-status.offline {
        background-color: #747f8d;
    }

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background-color: #202225;
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background-color: #1a1c1e;
    }

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #888;
}

/* Error */
.error-message {
    background-color: #ed4245;
    color: #fff;
    padding: 12px;
    border-radius: 4px;
    margin: 10px;
    text-align: center;
}

/* ── Server Header & Dropdown ──────────────────────────────────────────── */
.server-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 10px 8px;
    border-bottom: 1px solid #3a3a3a;
    margin-bottom: 4px;
}

    .server-header .server-name {
        font-weight: 700;
        font-size: 15px;
        color: #fff;
        padding: 0;
        border: none;
        margin: 0;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.server-menu-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

    .server-menu-btn:hover {
        background: #3a3a3a;
        color: #fff;
    }

.server-dropdown {
    position: absolute;
    top: 49px;
    left: 8px;
    right: 8px;
    background: #1e1f22;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    z-index: 100;
}

    .server-dropdown button {
        display: block;
        width: 100%;
        padding: 10px 14px;
        background: none;
        border: none;
        color: #dcddde;
        text-align: left;
        cursor: pointer;
        font-size: 14px;
        transition: background 0.15s;
    }

        .server-dropdown button:hover {
            background: #3a3a3a;
        }

        .server-dropdown button:last-child {
            color: #ed4245;
        }

            .server-dropdown button:last-child:hover {
                background: #ed424520;
            }

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal {
    background: #2b2d31;
    border-radius: 10px;
    width: 520px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.modal-sm {
    width: 380px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
}

    .modal-header h2 {
        font-size: 18px;
        color: #fff;
        margin: 0;
    }

.modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

    .modal-close:hover {
        background: #3a3a3a;
        color: #fff;
    }

.modal-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-hint {
    color: #b5bac1;
    font-size: 14px;
    margin: 0;
}

.modal-input {
    width: 100%;
    padding: 12px;
    background: #1e1f22;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #f0f0f0;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 40px;
}

    .modal-input:focus {
        outline: none;
        border-color: #5865f2;
    }

textarea.modal-input {
    line-height: 1.4;
}

/* Code inputs like invite codes */
#joinCodeInput {
    letter-spacing: 2px;
    text-transform: uppercase;
}

.modal-error {
    background: #ed424520;
    border: 1px solid #ed4245;
    color: #ed4245;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
}

/* ── Invite list ─────────────────────────────────────────────────────────── */
.invite-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-empty {
    color: #888;
    font-size: 14px;
    margin: 0;
}

.invite-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e1f22;
    border-radius: 6px;
    padding: 10px 14px;
    gap: 12px;
}

.invite-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.invite-code {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
}

.invite-meta {
    font-size: 12px;
    color: #888;
}

.btn-copy {
    flex-shrink: 0;
    padding: 7px 14px;
    background: #5865f2;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

    .btn-copy:hover {
        background: #4752c4;
    }

    .btn-copy.copied {
        background: #43b581;
    }

/* ── Invite create form ──────────────────────────────────────────────────── */
.invite-create {
    border-top: 1px solid #3a3a3a;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

    .invite-create h3 {
        font-size: 14px;
        font-weight: 700;
        color: #b5bac1;
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

.invite-options {
    display: flex;
    gap: 16px;
}

    .invite-options label {
        display: flex;
        flex-direction: column;
        gap: 6px;
        font-size: 13px;
        color: #b5bac1;
        flex: 1;
    }

    .invite-options select {
        padding: 8px 10px;
        background: #1e1f22;
        border: 1px solid #3a3a3a;
        border-radius: 6px;
        color: #f0f0f0;
        font-size: 14px;
        cursor: pointer;
    }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
    padding: 12px;
    background: #5865f2;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

    .btn-primary:hover {
        background: #4752c4;
    }

.btn-secondary {
    padding: 12px;
    background: #4e5058;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

    .btn-secondary:hover {
        background: #5d5f67;
    }

.btn-danger {
    padding: 12px;
    background: #ed4245;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

.modal-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

    .modal-buttons button {
        flex: 1;
    }

        .modal-buttons button:only-child {
            width: 100%;
        }

/* ── Typing indicator ────────────────────────────────────────────────────── */
.typing-indicator {
    padding: 0 16px 4px;
    font-size: 12px;
    color: #b5bac1;
    font-style: italic;
    min-height: 18px;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #23a55a;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 99999;
    pointer-events: none;
}

.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Top nav right section buttons ──────────────────────────────────────── */
.right-section button {
    width: auto;
    padding: 0 12px;
    font-size: 16px;
}
/* ── Channel type toggle ─────────────────────────────────────────────────── */
.channel-type-toggle {
    display: flex;
    gap: 12px;
}

.channel-type-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #1e1f22;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #b5bac1;
    transition: border-color 0.15s, color 0.15s;
}

    .channel-type-option:has(input:checked) {
        border-color: #5865f2;
        color: #fff;
    }

    .channel-type-option input[type="radio"] {
        accent-color: #5865f2;
    }
/* ── Owner crown ─────────────────────────────────────────────────────────── */
.owner-crown {
    margin-left: auto;
    font-size: 12px;
    line-height: 1;
    opacity: 0.85;
}

/* ── Context Menu ─────────────────────────────────────────────────────────── */
.ctx-menu {
    position: fixed;
    z-index: 99999;
    background: #111214;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 4px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    user-select: none;
}

.ctx-item {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    color: #dcddde;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

    .ctx-item:hover {
        background: #5865f2;
        color: #fff;
    }

    .ctx-item.ctx-danger {
        color: #ed4245;
    }

        .ctx-item.ctx-danger:hover {
            background: #ed4245;
            color: #fff;
        }

.ctx-divider {
    height: 1px;
    background: #3a3a3a;
    margin: 4px 0;
}

/* ── Inline Message Edit ─────────────────────────────────────────────────── */
.inline-edit-textarea {
    width: 100%;
    min-height: 44px;
    max-height: 300px;
    padding: 10px 12px;
    background: #383a40;
    border: 1px solid #5865f2;
    border-radius: 6px;
    color: #dcddde;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.4;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    outline: none;
}

    .inline-edit-textarea:disabled {
        opacity: 0.6;
    }

.inline-edit-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #72767d;
}

.inline-edit-link {
    color: #00aff4;
    cursor: pointer;
}

    .inline-edit-link:hover {
        text-decoration: underline;
    }

.inline-edit-error {
    margin-top: 4px;
    font-size: 12px;
    color: #ed4245;
}

/* ── Edit Attachments ────────────────────────────────────────────────────── */
.edit-attachments-label {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.edit-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.edit-att-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2b2d31;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 6px 10px;
    transition: border-color 0.15s, opacity 0.15s;
    max-width: 260px;
}

    .edit-att-item.edit-att-removed {
        opacity: 0.4;
        border-color: #ed4245;
        text-decoration: line-through;
    }

.edit-att-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.edit-att-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: #3a3a3a;
    border-radius: 4px;
    flex-shrink: 0;
}

.edit-att-name {
    font-size: 12px;
    color: #dcddde;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.edit-att-remove {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.edit-att-remove:hover {
    color: #ed4245;
    background: #ed424520;
}

.load-more-spinner {
    text-align: center;
    padding: 12px;
    color: #888;
    font-size: 13px;
}

.load-more-spinner {
    text-align: center;
    padding: 12px;
    color: #888;
    font-size: 13px;
}

.load-more-end {
    text-align: center;
    padding: 12px;
    color: #555;
    font-size: 12px;
    font-style: italic;
}

/* ── Reply bar ───────────────────────────────────────────────────────────── */
.reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2b2d31;
    border-left: 3px solid #5865f2;
    border-radius: 4px 4px 0 0;
    padding: 6px 12px;
    font-size: 13px;
    color: #b5bac1;
    gap: 8px;
}
.reply-bar-content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.reply-bar-label { color: #b5bac1; white-space: nowrap; }
.reply-bar-label strong { color: #f2f3f5; }
.reply-bar-preview {
    color: #72767d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reply-bar-close {
    background: none;
    border: none;
    color: #72767d;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    flex-shrink: 0;
    line-height: 1;
}
.reply-bar-close:hover { color: #f2f3f5; }

/* ── Reply reference (in message body) ──────────────────────────────────── */
.reply-reference {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    margin-left: 48px;
    font-size: 12px;
    color: #72767d;
    cursor: pointer;
    line-height: 1.4;
    max-width: 100%;
}
.reply-reference:hover .reply-ref-content { color: #b5bac1; }
.reply-ref-bar {
    width: 12px;
    height: 2px;
    border-left: 2px solid #4f545c;
    border-top: 2px solid #4f545c;
    border-radius: 2px 0 0 0;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 4px;
}
.reply-ref-author {
    color: #b5bac1;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.reply-ref-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #72767d;
}

/* ── Thread indicator ────────────────────────────────────────────────────── */
.thread-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    margin-left: 48px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #5865f2;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}
.thread-indicator:hover {
    background: #3c3f45;
    color: #7289da;
}

/* ── Thread panel input ──────────────────────────────────────────────────── */
.thread-panel-name {
    font-size: 12px;
    color: #72767d;
    margin-top: 2px;
}
.thread-panel-input {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-top: 1px solid #202225;
    flex-shrink: 0;
    background: #2f3136;
}
.thread-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.thread-panel-input textarea {
    flex: 1;
    background: #40444b;
    border: none;
    border-radius: 6px;
    color: #dcddde;
    font-size: 14px;
    padding: 8px 10px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    min-height: 36px;
    max-height: 120px;
    overflow-y: auto;
}
.thread-panel-input textarea:focus { outline: none; }
.thread-panel-input button {
    background: #5865f2;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}
.thread-panel-input button:hover { background: #4752c4; }

/* ── Highlight flash (scrollToMessage) ───────────────────────────────────── */
@keyframes highlightFlash {
    0%   { background: #5865f240; }
    100% { background: transparent; }
}
.highlight-flash { animation: highlightFlash 2s ease forwards; border-radius: 4px; }

/* ── Channel unread badges ───────────────────────────────────────────────── */
.channel-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.channel-badge.unread {
    width: 8px;
    height: 8px;
    background: #b5bac1;
    border-radius: 50%;
    flex-shrink: 0;
}

.channel-badge.mention {
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #ed4245;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.channel-button.has-unread {
    color: #dcddde;
}

/* ── Server unread badges ─────────────────────────────────────────────────── */
.server-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    border: 2px solid #3a3a3a;
    border-radius: 50%;
}

.server-badge.unread {
    width: 10px;
    height: 10px;
    background: #b5bac1;
}

.server-badge.mention {
    width: 12px;
    height: 12px;
    background: #ed4245;
}

/* ── @mention highlight in messages ──────────────────────────────────────── */
.mention {
    background: rgba(88, 101, 242, 0.3);
    color: #dee0fc;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 500;
}

.mention-me,
.mention-ping {
    background: rgba(250, 168, 26, 0.3);
    color: #faa61a;
}

/* ── Mobile Layout ─────────────────────────────────────────────────────────── */
/* Members toggle button + backdrop hidden on desktop */
.mobile-members-btn { display: none; }
.mobile-members-backdrop { display: none; }

@media (max-width: 768px) {
    /* ── Server list ── */
    .top-nav {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .top-nav::-webkit-scrollbar { display: none; }
    .space-rail {
        overflow-x: visible;
        flex-shrink: 0;
    }

    /* Use dynamic viewport height so mobile browser chrome doesn't hide the nav */
    #app-screen {
        height: 100dvh;
    }

    /* ── Server Settings — stack vertically on mobile ── */
    .settings-overlay {
        align-items: flex-start;
    }
    .settings-layout {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        min-height: 100dvh;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
    .settings-sidebar {
        width: 100%;
        padding: 8px 8px 0;
        overflow-y: visible;
    }
    .settings-sidebar-header { display: none; }
    .settings-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 2px;
        padding-bottom: 4px;
    }
    .settings-nav::-webkit-scrollbar { display: none; }
    .settings-nav-item {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 6px 12px;
    }
    .settings-nav-divider { display: none; }
    .settings-content {
        padding: 16px 20px;
    }
    .settings-close {
        top: 8px;
        right: 8px;
    }

    /* ── Main layout ── */
    .main-container {
        position: relative;
        overflow: hidden;
    }

    .channels-panel,
    .messages-panel {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        transition: transform 0.25s ease;
    }

    /* Default view: channels visible */
    .channels-panel {
        transform: translateX(0);
        border-right: none;
    }

    .messages-panel {
        transform: translateX(100%);
    }

    /* JS adds this class when a channel is selected */
    .main-container.mobile-show-messages .channels-panel {
        transform: translateX(-100%);
    }

    .main-container.mobile-show-messages .messages-panel {
        transform: translateX(0);
    }

    /* ── Members panel — slide-in drawer from the right ── */
    .members-panel {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        width: 75%;
        max-width: 280px;
        z-index: 200;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        border-left: 1px solid #222;
    }

    .members-panel.mobile-open {
        transform: translateX(0);
    }

    /* Backdrop behind the members drawer */
    .mobile-members-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 199;
    }

    .mobile-members-backdrop.visible {
        display: block;
    }

    /* ── Back button ── */
    .mobile-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #b5bac1;
        font-size: 22px;
        padding: 0 12px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .mobile-back-btn:hover { color: #fff; }

    /* ── Members toggle button ── */
    .mobile-members-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: #b5bac1;
        font-size: 20px;
        padding: 0 12px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .mobile-members-btn:hover { color: #fff; }

    /* Channel buttons take full panel width */
    .channel-button {
        width: 100%;
    }

    /* Prevent user-info from forcing width */
    .user-info {
        min-width: 0;
    }

    /* Auth box fits small screens */
    .auth-box {
        min-width: 0;
        width: 90vw;
    }
}

/* ── Server Settings Overlay ──────────────────────────────────────────────── */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.settings-layout {
    display: flex;
    width: 940px;
    max-width: 98vw;
    background: #2b2d31;
    border-radius: 8px;
    overflow: hidden;
    min-height: 600px;
    max-height: 90vh;
    position: relative;
}
.settings-sidebar {
    width: 220px;
    background: #1e1f22;
    padding: 16px 8px;
    flex-shrink: 0;
    overflow-y: auto;
}
.settings-sidebar-header {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    color: #949ba4;
    padding: 8px 10px 12px;
    letter-spacing: .03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settings-nav-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: #b5bac1;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.settings-nav-item:hover { background: #35373c; color: #dcddde; }
.settings-nav-item.active { background: #404249; color: #fff; }
.settings-nav-item.danger { color: #f23f43; }
.settings-nav-item.danger:hover { background: rgba(242,63,67,.1); }
.settings-nav-divider { height: 1px; background: #3d3f45; margin: 8px 10px; }
.settings-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
}
/* ── Emoji management tab ────────────────────────────────────────────────── */
.emoji-mgmt-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 16px;
}
.emoji-mgmt-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #2b2d31;
}
.emoji-mgmt-item:hover { background: #32353b; }
.emoji-mgmt-preview {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}
.emoji-mgmt-name {
    font-size: 13px;
    color: #dcddde;
    font-family: monospace;
}

.settings-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: 1px solid #4e5058;
    color: #b5bac1;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.settings-close:hover { background: #35373c; color: #fff; }
.settings-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #f2f3f5;
    margin-bottom: 24px;
}
.settings-field { margin-bottom: 20px; }
.settings-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: #949ba4;
    font-weight: 600;
    margin-bottom: 6px;
}
.settings-input {
    width: 100%;
    background: #1e1f22;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    padding: 10px 12px;
    color: #dbdee1;
    font-size: 14px;
}
.settings-input:focus { border-color: #5865f2; outline: none; }
.settings-btn {
    background: #5865f2;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    margin-right: 8px;
}
.settings-btn:hover { background: #4752c4; }
.settings-btn.danger { background: #da373c; }
.settings-btn.danger:hover { background: #a12d31; }
.settings-btn.secondary { background: #4e5058; }
.settings-btn.secondary:hover { background: #5c5f66; }

/* Roles tab */
.roles-layout { display: flex; gap: 16px; min-height: 400px; }
.roles-list-panel { width: 160px; flex-shrink: 0; }
.roles-list-panel .add-role-btn {
    display: block;
    width: 100%;
    background: none;
    border: 1px dashed #4e5058;
    color: #b5bac1;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-bottom: 8px;
    text-align: left;
}
.roles-list-panel .add-role-btn:hover { border-color: #5865f2; color: #5865f2; }
.role-item {
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: #b5bac1;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.role-item:hover { background: #35373c; }
.role-item.selected { background: #404249; color: #fff; }
.role-item.dragging { opacity: 0.4; }
.role-item.drag-over {
    outline: 2px solid #5865f2;
    outline-offset: -2px;
    border-radius: 4px;
}
.role-drag-handle {
    cursor: grab;
    color: #949ba4;
    font-size: 14px;
    flex-shrink: 0;
    padding-right: 2px;
    user-select: none;
}
.role-hoist-badge {
    margin-left: auto;
    font-size: 10px;
    background: #5865f2;
    color: #fff;
    border-radius: 3px;
    padding: 1px 4px;
    font-weight: 700;
}
.role-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.role-editor { flex: 1; }
.role-editor-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #6d6f78; font-size: 14px; }
.role-name-row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.role-name-row .settings-field { flex: 1; margin-bottom: 0; }
.perm-group-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #949ba4;
    margin: 16px 0 8px;
}
.perm-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #2e3035;
}
.perm-toggle-label .perm-toggle-name { font-size: 14px; color: #dbdee1; }
.perm-toggle-label .perm-toggle-desc { font-size: 12px; color: #949ba4; margin-top: 2px; }
.perm-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.perm-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.perm-toggle-slider {
    position: absolute;
    inset: 0;
    background: #4e5058;
    border-radius: 11px;
    cursor: pointer;
    transition: .2s;
}
.perm-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}
.perm-toggle input:checked + .perm-toggle-slider { background: #5865f2; }
.perm-toggle input:checked + .perm-toggle-slider::before { transform: translateX(18px); }

/* Members tab */
.members-search {
    width: 100%;
    background: #1e1f22;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    color: #dbdee1;
    font-size: 14px;
    margin-bottom: 16px;
}
.members-table { width: 100%; border-collapse: collapse; }
.members-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    color: #949ba4;
    padding: 0 8px 8px;
    font-weight: 600;
}
.members-table td {
    padding: 8px;
    border-bottom: 1px solid #2e3035;
    vertical-align: middle;
    font-size: 14px;
    color: #dbdee1;
}
.member-avatar-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.member-role-chip {
    display: inline-block;
    background: #404249;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    color: #dbdee1;
    margin: 2px;
    border-left: 3px solid var(--role-color, #5865f2);
}
.member-action-btn {
    background: #4e5058;
    border: none;
    color: #dbdee1;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    position: relative;
}
.member-action-btn:hover { background: #5865f2; }
.member-actions-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.member-actions-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: #dbdee1;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}
.member-actions-menu button:hover { background: #35373c; }
.member-actions-menu button.danger { color: #f23f43; }
.member-actions-menu button.danger:hover { background: rgba(242,63,67,.1); }
.role-assign-list { padding: 4px 0; }
.role-assign-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
}
.role-assign-item:hover { background: #35373c; }
.role-assign-item input[type=checkbox] { cursor: pointer; }

/* Bans sub-tab */
.bans-list { margin-top: 8px; }
.ban-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #2e3035;
}
.ban-row .ban-user { font-size: 14px; color: #dbdee1; }
.ban-row .ban-reason { font-size: 12px; color: #949ba4; margin-top: 2px; }

/* Danger Zone */
.danger-zone-card {
    border: 1px solid #da373c;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.danger-zone-card h3 { font-size: 15px; color: #f2f3f5; margin-bottom: 4px; }

/* ── Slash Command Autocomplete ──────────────────────────────────────────── */
.slash-dropdown { position:absolute; bottom:calc(100% + 4px); left:0; right:0; background:#2b2d31; border:1px solid #1e1f22; border-radius:6px; max-height:300px; overflow-y:auto; z-index:200; box-shadow:0 -4px 16px rgba(0,0,0,.4); }
.slash-item { display:flex; align-items:baseline; gap:8px; padding:8px 12px; cursor:pointer; }
.slash-item:hover, .slash-item.active { background:#404249; }
.slash-item-name { font-size:14px; color:#fff; font-weight:600; flex-shrink:0; }
.slash-item-desc { font-size:13px; color:#949ba4; flex:1; }
.slash-item-bot { font-size:11px; color:#5865f2; flex-shrink:0; }

/* ── Mention Autocomplete ─────────────────────────────────────────────────── */
.mention-dropdown { position:absolute; bottom:calc(100% + 4px); left:0; right:0; background:#2b2d31; border:1px solid #1e1f22; border-radius:6px; max-height:240px; overflow-y:auto; z-index:200; box-shadow:0 -4px 16px rgba(0,0,0,.4); }
.mention-item { display:flex; align-items:center; gap:8px; padding:8px 12px; cursor:pointer; }
.mention-item:hover, .mention-item.active { background:#404249; }
.mention-av { width:24px; height:24px; flex-shrink:0; }
.mention-av-img { width:24px; height:24px; border-radius:50%; object-fit:cover; }
.mention-av-init { display:flex; align-items:center; justify-content:center; width:24px; height:24px; border-radius:50%; background:#5865f2; color:#fff; font-size:10px; font-weight:700; }
.mention-name { font-size:14px; color:#dbdee1; font-weight:500; }
.mention-sub { font-size:12px; color:#949ba4; margin-left:auto; }

/* ── Emoji Shortcode Autocomplete ─────────────────────────────────────────── */
.emoji-dropdown { position:absolute; bottom:calc(100% + 4px); left:0; right:0; background:#2b2d31; border:1px solid #1e1f22; border-radius:6px; max-height:240px; overflow-y:auto; z-index:200; box-shadow:0 -4px 16px rgba(0,0,0,.4); }
.emoji-item { display:flex; align-items:center; gap:8px; padding:6px 12px; cursor:pointer; }
.emoji-item:hover, .emoji-item.active { background:#404249; }
.emoji-item-char { font-size:20px; width:28px; text-align:center; flex-shrink:0; line-height:1; }
.emoji-item-name { font-size:13px; color:#dbdee1; }
.emoji-section-header { font-size:11px; font-weight:700; color:#949ba4; text-transform:uppercase; padding:6px 12px 2px; letter-spacing:.5px; }

/* Inline emoji in message content */
.inline-emoji { width:20px; height:20px; object-fit:contain; vertical-align:middle; }
.emoji-char { font-size:1.1em; line-height:1; vertical-align:middle; }

/* ── Input Emoji Picker Panel ─────────────────────────────────────────────── */
.emoji-picker-btn { background:none; border:none; font-size:18px; cursor:pointer; padding:4px 6px; border-radius:4px; color:#b5bac1; transition:color .15s; flex-shrink:0; }
.emoji-picker-btn:hover { color:#dbdee1; }

.input-emoji-picker { position:absolute; bottom:calc(100% + 8px); right:0; width:380px; max-height:420px; background:#2b2d31; border:1px solid #1e1f22; border-radius:8px; box-shadow:0 -4px 24px rgba(0,0,0,.5); z-index:300; display:flex; flex-direction:column; overflow:hidden; }

.iep-search { padding:8px; border-bottom:1px solid #1e1f22; flex-shrink:0; }
.iep-search input { width:100%; background:#1e1f22; border:none; border-radius:4px; padding:6px 10px; color:#dbdee1; font-size:13px; outline:none; box-sizing:border-box; }
.iep-search input::placeholder { color:#72767d; }

.iep-body { display:flex; flex-direction:row; flex:1; overflow:hidden; }

.iep-tabs { display:flex; flex-direction:column; gap:1px; padding:4px 3px; border-right:1px solid #1e1f22; overflow-y:auto; flex-shrink:0; width:76px; scrollbar-width:none; }
.iep-tabs::-webkit-scrollbar { display:none; }
.iep-tab { background:none; border:none; font-size:18px; padding:4px; border-radius:4px; cursor:pointer; opacity:.45; transition:opacity .1s; flex-shrink:0; line-height:1; }
.iep-tab:hover { opacity:.85; }
.iep-tab.active { opacity:1; }

.iep-grid-wrap { overflow-y:auto; overflow-x:hidden; flex:1; min-width:0; padding:6px; scrollbar-width:thin; scrollbar-color:#4f545c transparent; }
.iep-grid-wrap::-webkit-scrollbar { width:4px; }
.iep-grid-wrap::-webkit-scrollbar-thumb { background:#4f545c; border-radius:2px; }
.iep-section-label { font-size:11px; font-weight:700; color:#949ba4; text-transform:uppercase; padding:4px 2px 4px; letter-spacing:.5px; }
.iep-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:1px; }
.input-emoji-picker .iep-btn { background:none; border:none; font-size:22px; padding:3px; border-radius:4px; cursor:pointer; line-height:1.2; text-align:center; color:inherit; }
.iep-btn img { width:22px; height:22px; object-fit:contain; vertical-align:middle; }

/* ── Avatar / Icon Images ─────────────────────────────────────────────────── */
.server-icon-img { width:100%; height:100%; border-radius:inherit; object-fit:cover; }
.member-av-img   { width:32px; height:32px; border-radius:50%; object-fit:cover; }
.message-av-img  { width:40px; height:40px; border-radius:50%; object-fit:cover; flex-shrink:0; }

/* ── Server Settings Icon Preview ────────────────────────────────────────── */
.settings-icon-preview { width:64px; height:64px; border-radius:8px; background:#5865f2; display:flex; align-items:center; justify-content:center; font-size:22px; font-weight:700; color:#fff; overflow:hidden; flex-shrink:0; }
.danger-zone-card p { font-size: 13px; color: #949ba4; }

/* ── Channel type splashes & input states ─────────────────────────────────── */
.channel-splash {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; gap: 12px; color: #b5bac1; user-select: none;
}
.channel-splash-icon { font-size: 64px; }
.channel-splash-name { font-size: 22px; font-weight: 700; color: #f2f3f5; }
.channel-splash-desc { font-size: 14px; }

#messageInput:disabled { opacity: 0.5; cursor: not-allowed; background: #1e1f22; }

/* ── Channel Permission Overrides Overlay ─────────────────────────────────── */
#channelPermsOverlay {
    position: fixed; inset: 0; z-index: 1000;
    background: #313338; display: flex; flex-direction: column;
}
.chperms-header {
    padding: 16px 20px; border-bottom: 1px solid #1e1f22;
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.chperms-header h2 { flex: 1; font-size: 16px; font-weight: 700; color: #f2f3f5; margin: 0; }
.chperms-close-btn {
    background: none; border: none; color: #b5bac1; font-size: 20px;
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.chperms-close-btn:hover { background: #3c3f45; color: #fff; }
.chperms-body { display: flex; flex: 1; overflow: hidden; }
.chperms-left { width: 220px; border-right: 1px solid #1e1f22; overflow-y: auto; padding: 12px 0; flex-shrink: 0; }
.chperms-target-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; cursor: pointer; color: #b5bac1; font-size: 14px;
    border-radius: 4px; margin: 1px 6px;
}
.chperms-target-item:hover { background: #3c3f45; color: #f2f3f5; }
.chperms-target-item.active { background: #404249; color: #f2f3f5; }
.chperms-target-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chperms-add-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; cursor: pointer; color: #b5bac1; font-size: 13px;
    margin: 4px 6px; border-radius: 4px; border: 1px dashed #4e5058;
}
.chperms-add-btn:hover { border-color: #5865f2; color: #5865f2; }
.chperms-right { flex: 1; overflow-y: auto; padding: 20px; }
.chperms-placeholder { color: #b5bac1; font-size: 14px; padding: 20px 0; }
.chperms-perm-section { margin-bottom: 24px; }
.chperms-perm-section-title {
    font-size: 11px; font-weight: 700; color: #b5bac1;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px;
}
.chperms-perm-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid #2b2d31;
}
.chperms-perm-name { color: #f2f3f5; font-size: 14px; }
.chperms-state-btns { display: flex; gap: 4px; }
.chperms-state-btn {
    width: 28px; height: 28px; border-radius: 4px; border: none;
    cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
    background: #2b2d31; color: #b5bac1;
}
.chperms-state-btn:hover { background: #3c3f45; }
.chperms-state-btn.active-allow { background: #23a559; color: #fff; }
.chperms-state-btn.active-deny  { background: #f23f43; color: #fff; }
.chperms-save-row { display: flex; gap: 8px; margin-top: 16px; }
.chperms-save-btn {
    padding: 8px 16px; border-radius: 4px; border: none; cursor: pointer;
    font-size: 14px; font-weight: 600;
}
.chperms-save-btn.primary { background: #5865f2; color: #fff; }
.chperms-save-btn.primary:hover { background: #4752c4; }
.chperms-save-btn.danger { background: #f23f43; color: #fff; }
.chperms-save-btn.danger:hover { background: #c0383b; }
.chperms-picker-overlay {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center;
}
.chperms-picker-box {
    background: #2b2d31; border-radius: 8px; padding: 20px;
    width: 340px; max-height: 480px; display: flex; flex-direction: column; gap: 12px;
}
.chperms-picker-box h3 { color: #f2f3f5; font-size: 15px; margin: 0; }
.chperms-picker-search {
    background: #1e1f22; border: 1px solid #3c3f45; border-radius: 4px;
    color: #f2f3f5; font-size: 14px; padding: 8px 10px; width: 100%; box-sizing: border-box;
}
.chperms-picker-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chperms-picker-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 4px; cursor: pointer; color: #b5bac1; font-size: 14px;
}
.chperms-picker-item:hover { background: #3c3f45; color: #f2f3f5; }
.chperms-picker-close {
    background: #4e5058; border: none; color: #f2f3f5; border-radius: 4px;
    padding: 8px 14px; cursor: pointer; font-size: 13px; align-self: flex-end;
}
.chperms-picker-close:hover { background: #5c6070; }

/* ── Forum / Media View ─────────────────────────────────────────────────────── */
#messagesContainer .fv-header {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 12px; border-bottom: 1px solid #1e1f22;
    position: sticky; top: 0; background: #313338; z-index: 10;
}
#messagesContainer .fv-title {
    flex: 1; font-size: 18px; font-weight: 700; color: #f2f3f5; margin: 0;
}
.fv-new-btn {
    background: #5865f2; color: #fff; border: none; border-radius: 4px;
    padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.fv-new-btn:hover { background: #4752c4; }
.fv-empty { color: #72767d; font-size: 14px; padding: 32px 20px; text-align: center; }

/* Forum list */
.fv-post-list { display: flex; flex-direction: column; padding: 8px 0; }
.fv-post-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; cursor: pointer; border-bottom: 1px solid #2b2d31;
    transition: background .1s;
}
.fv-post-row:hover { background: #2e3035; }
.fv-post-av { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.fv-av-img  { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.fv-av-init {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: #5865f2; color: #fff; font-size: 13px; font-weight: 700;
}
.fv-post-info  { flex: 1; min-width: 0; }
.fv-post-title { font-size: 15px; font-weight: 600; color: #f2f3f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-post-meta  { font-size: 12px; color: #72767d; margin-top: 2px; }
.fv-post-stats { text-align: right; flex-shrink: 0; }
.fv-reply-count { font-size: 16px; font-weight: 700; color: #b5bac1; display: block; }
.fv-reply-label { font-size: 11px; color: #72767d; }

/* Media grid */
.fv-media-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 4px; padding: 4px;
    align-content: start;
}
.fv-empty-grid { grid-column: 1 / -1; padding: 40px 0; }
.fv-media-card {
    background: #1e1f22; border-radius: 0; overflow: hidden;
    cursor: pointer; position: relative;
}
.fv-media-card:hover .fv-media-card-overlay { opacity: 1; }
.fv-media-card:hover .fv-media-thumb { transform: scale(1.04); }
.fv-media-thumb-wrap {
    width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
    background: #1e1f22; position: relative;
}
.fv-media-thumb {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .2s ease;
}
.fv-media-thumb-placeholder {
    width: 100%; height: 100%; display: flex; align-items: center;
    justify-content: center; font-size: 36px; color: #4e5058;
}
.fv-media-play-icon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 28px; color: rgba(255,255,255,0.85); pointer-events: none;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.fv-media-card-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    padding: 24px 10px 8px;
    display: flex; flex-direction: column; gap: 1px;
    opacity: 0; transition: opacity .18s ease;
    pointer-events: none;
}
.fv-media-overlay-name { font-size: 12px; font-weight: 600; color: #fff; }
.fv-media-overlay-meta { font-size: 11px; color: rgba(255,255,255,0.7); }

/* Thread view */
.fv-thread-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid #1e1f22;
    position: sticky; top: 0; background: #313338; z-index: 10;
}
.fv-back-btn {
    background: none; border: 1px solid #4e5058; color: #b5bac1;
    border-radius: 4px; padding: 5px 10px; cursor: pointer; font-size: 13px;
}
.fv-back-btn:hover { background: #3c3f45; color: #f2f3f5; }
.fv-thread-title { flex: 1; font-size: 16px; font-weight: 700; color: #f2f3f5; }
.fv-delete-post-btn {
    background: none; border: none; cursor: pointer; font-size: 16px;
    color: #72767d; padding: 4px 8px; border-radius: 4px;
}
.fv-delete-post-btn:hover { background: #f23f4320; color: #f23f43; }

.fv-thread-messages {
    flex: 1; overflow-y: auto; padding: 8px 0;
    max-height: calc(100% - 120px);
}
.fv-thread-msg {
    display: flex; gap: 12px; padding: 10px 20px;
    border-bottom: 1px solid #2b2d31;
}
.fv-opener { background: #2b2d31; }
.fv-msg-av { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.fv-msg-av-img  { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.fv-msg-av-init {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: #5865f2; color: #fff; font-size: 13px; font-weight: 700;
}
.fv-msg-body    { flex: 1; min-width: 0; }
.fv-msg-header  { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.fv-msg-username { font-weight: 700; color: #f2f3f5; font-size: 14px; }
.fv-msg-time     { font-size: 11px; color: #72767d; }
.fv-opener-badge {
    font-size: 10px; font-weight: 700; background: #5865f2; color: #fff;
    border-radius: 3px; padding: 1px 5px; text-transform: uppercase; letter-spacing: .4px;
}
.fv-msg-content { font-size: 14px; color: #dbdee1; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.fv-msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fv-msg-img { max-width: 360px; max-height: 240px; border-radius: 4px; display: block; object-fit: contain; }
.fv-msg-file {
    display: inline-flex; align-items: center; gap: 6px;
    background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px;
    padding: 6px 10px; color: #00aff4; font-size: 13px; text-decoration: none;
}
.fv-msg-file:hover { text-decoration: underline; }

/* Reply bar */
.fv-reply-bar {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 20px; border-top: 1px solid #1e1f22;
    background: #313338;
}
.fv-reply-input {
    flex: 1; background: #383a40; border: none; border-radius: 8px;
    color: #dbdee1; font-size: 14px; padding: 10px 14px;
    resize: none; outline: none; font-family: inherit; max-height: 120px;
}
.fv-reply-input::placeholder { color: #72767d; }
.fv-reply-send {
    background: #5865f2; color: #fff; border: none; border-radius: 4px;
    padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.fv-reply-send:hover { background: #4752c4; }

/* New post form */
.fv-new-post-form {
    display: flex; flex-direction: column; gap: 14px;
    padding: 20px; max-width: 720px; margin: 0 auto; width: 100%;
}
.fv-form-input {
    background: #1e1f22; border: 1px solid #3c3f45; border-radius: 4px;
    color: #f2f3f5; font-size: 15px; padding: 10px 14px; outline: none; width: 100%;
    box-sizing: border-box; font-family: inherit;
}
.fv-form-input:focus { border-color: #5865f2; }
.fv-form-textarea {
    background: #1e1f22; border: 1px solid #3c3f45; border-radius: 4px;
    color: #f2f3f5; font-size: 14px; padding: 10px 14px; outline: none; width: 100%;
    box-sizing: border-box; font-family: inherit; resize: vertical; min-height: 100px;
}
.fv-form-textarea:focus { border-color: #5865f2; }
.fv-form-files { display: flex; flex-wrap: wrap; gap: 8px; }
.fv-form-file-item {
    display: flex; align-items: center; gap: 6px;
    background: #2b2d31; border-radius: 4px; padding: 4px 8px;
    font-size: 12px; color: #b5bac1;
}
.fv-form-file-item button {
    background: none; border: none; color: #72767d; cursor: pointer; font-size: 12px;
}
.fv-form-file-item button:hover { color: #f23f43; }
.fv-form-file-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 3px; }
.fv-form-file-name  { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fv-form-actions { display: flex; align-items: center; gap: 8px; }
.fv-attach-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #2b2d31; border: 1px solid #4e5058; border-radius: 4px;
    color: #b5bac1; font-size: 13px; padding: 6px 12px; cursor: pointer;
}
.fv-attach-btn:hover { border-color: #5865f2; color: #5865f2; }
.fv-cancel-btn {
    background: none; border: 1px solid #4e5058; color: #b5bac1;
    border-radius: 4px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.fv-cancel-btn:hover { background: #3c3f45; color: #f2f3f5; }
.fv-submit-btn { padding: 7px 18px; font-size: 13px; }
.fv-post-error { color: #f23f43; font-size: 13px; }

/* Make messagesContainer a flex column for thread layout */
#messagesContainer:has(.fv-thread-header) {
    display: flex; flex-direction: column; overflow: hidden;
}
#messagesContainer:has(.fv-thread-messages) .fv-thread-messages {
    flex: 1; overflow-y: auto;
}

/* ── Message Pinning ────────────────────────────────────────────────────────── */
.pinned-message {
    background: rgba(255, 200, 0, 0.04);
    border-left: 2px solid #f0b132;
}
.pin-indicator {
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.7;
    vertical-align: middle;
}

/* ── Pins Side Panel ──────────────────────────────────────────────────────── */
.messages-panel { position: relative; }

.side-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 360px;
    height: 100%;
    background-color: #2f3136;
    border-left: 1px solid #202225;
    display: none;
    flex-direction: column;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.2s ease;
}
.side-panel.open { transform: translateX(0); }

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #202225;
    flex-shrink: 0;
}
.side-panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #f2f3f5;
    margin: 0;
}
.side-panel-close {
    background: none;
    border: none;
    color: #b5bac1;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}
.side-panel-close:hover { color: #f2f3f5; background: #4f545c; }

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.pins-loading {
    color: #72767d;
    font-size: 14px;
    text-align: center;
    padding: 24px 16px;
}
.pins-empty {
    color: #72767d;
    font-size: 14px;
    text-align: center;
    padding: 32px 16px;
}
.pin-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #3a3d44;
    position: relative;
}
.pin-item:hover { background: #34373c; }
.pin-body { flex: 1; min-width: 0; }
.pin-author { font-size: 13px; font-weight: 600; color: #f2f3f5; margin-bottom: 3px; }
.pin-content {
    font-size: 13px;
    color: #b5bac1;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
    margin-bottom: 4px;
}
.pin-meta { font-size: 11px; color: #72767d; }
.pin-remove-btn {
    background: none;
    border: none;
    color: #72767d;
    cursor: pointer;
    font-size: 14px;
    padding: 3px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s;
}
.pin-item:hover .pin-remove-btn { opacity: 1; }
.pin-remove-btn:hover { color: #f23f43; background: rgba(242, 63, 67, 0.1); }

/* Pins button in channel header */
.header-icon-btn {
    background: none;
    border: none;
    color: #b5bac1;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
}
.header-icon-btn:hover { color: #f2f3f5; background: #3c3f45; }

/* ── Custom User Status ─────────────────────────────────────────────────────── */
.member-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.member-custom-status {
    font-size: 11px;
    color: #72767d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
    line-height: 1.3;
}
#currentStatus {
    transition: color 0.15s;
}
#currentStatus.has-custom-status {
    color: #b5bac1;
    font-style: italic;
}
#currentStatus:hover { color: #f2f3f5; }

/* ── Inline links in message content ───────────────────────────────────────── */
.message-content a {
    color: #00aff4;
    text-decoration: none;
}
.message-content a:visited { color: #7eb8d4; }
.message-content a:hover { text-decoration: underline; }

/* ── Message dividers ────────────────────────────────────────────────────────── */
.msg-divider-date,
.msg-divider-new {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 4px;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 600;
    user-select: none;
}
.msg-divider-date::before,
.msg-divider-date::after,
.msg-divider-new::before,
.msg-divider-new::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #3d3d3d;
}
.msg-divider-date { color: #888; }
.msg-divider-date span { white-space: nowrap; }
.msg-divider-new { color: #f04747; }
.msg-divider-new::before,
.msg-divider-new::after { background: #f04747; opacity: 0.4; }
.msg-divider-new span { white-space: nowrap; }

/* ── Rich Link Embeds ───────────────────────────────────────────────────────── */
.msg-embeds { display: flex; flex-direction: column; gap: 6px; position: relative; }

.embed-dismiss-btn {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 4px;
    color: #aaa;
    cursor: pointer;
    padding: 1px 6px;
    font-size: 12px;
    line-height: 18px;
    z-index: 2;
}
.embed-dismiss-btn:hover { color: #fff; background: #3a3a3a; }
.msg-embeds:hover .embed-dismiss-btn { display: block; }

.msg-embed {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    border-left: 4px solid #5865f2;
    background: #2b2d31;
    border-radius: 0 4px 4px 0;
    padding: 10px 12px;
    max-width: 440px;
    margin-top: 4px;
}
.msg-embed-site {
    font-size: 12px;
    color: #b5bac1;
    text-transform: none;
}
.msg-embed-title {
    font-size: 14px;
    font-weight: 600;
    color: #00aff4;
    text-decoration: none;
    word-break: break-word;
}
.msg-embed-title:hover { text-decoration: underline; }
.msg-embed-description {
    font-size: 13px;
    color: #b5bac1;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.msg-embed-image {
    max-width: 400px;
    max-height: 300px;
    border-radius: 4px;
    object-fit: cover;
    margin-top: 6px;
}

/* ── Video embeds (YouTube / Twitch) ─────────────────────────────────────── */
.msg-embed-video-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 16 / 9;
    margin-top: 4px;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}
.msg-embed-video-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ── Video preview card (click-to-play) ─────────────────────────────────── */
.msg-embed-video-preview {
    display: inline-flex;
    flex-direction: column;
    max-width: 500px;
    border-radius: 4px;
    overflow: hidden;
    background: #1e1f22;
    margin-top: 4px;
    cursor: pointer;
}
.msg-embed-video-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #111;
    overflow: hidden;
}
.msg-embed-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.msg-embed-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    transition: background 0.15s;
}
.msg-embed-video-preview:hover .msg-embed-play-btn { background: rgba(0, 0, 0, 0.55); }
.msg-embed-play-btn::after {
    content: '';
    border-style: solid;
    border-width: 14px 0 14px 26px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.92);
    margin-left: 4px;
}
.msg-embed-video-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px 10px;
    background: #2b2d31;
}
.msg-embed-video-title {
    font-size: 14px;
    font-weight: 600;
    color: #00aff4;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-embed-video-title:hover { text-decoration: underline; }
.msg-embed-video-meta {
    font-size: 12px;
    color: #b5bac1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Spotify ─────────────────────────────────────────────────────────────── */
.msg-embed-spotify {
    margin-top: 4px;
    max-width: 500px;
    border-radius: 12px;
    overflow: hidden;
}
.msg-embed-spotify iframe {
    display: block;
    width: 100%;
    height: 152px;
    border: none;
    border-radius: 12px;
}
.msg-embed-spotify.tall iframe { height: 352px; }

/* ── SoundCloud ───────────────────────────────────────────────────────────── */
.msg-embed-soundcloud {
    margin-top: 4px;
    max-width: 500px;
}
.msg-embed-soundcloud iframe {
    display: block;
    width: 100% !important;
    border: none;
    border-radius: 4px;
}

/* ── Inline images (bare image URLs in message content) ─────────────────────── */
a.msg-image-link {
    display: block;
    width: fit-content;
    margin: 4px 0;
}
.msg-inline-image {
    display: block;
    max-width: min(400px, 100%);
    max-height: 300px;
    object-fit: contain;
    object-position: left top;
    border-radius: 4px;
    cursor: pointer;
}

/* ── Direct image / video ─────────────────────────────────────────────────── */
.msg-embed-direct-image {
    display: block;
    max-width: 400px;
    max-height: 300px;
    border-radius: 4px;
    margin-top: 4px;
    cursor: pointer;
    object-fit: contain;
}
.msg-embed-direct-video {
    display: block;
    max-width: 500px;
    border-radius: 4px;
    margin-top: 4px;
    background: #000;
}

/* ── Invite card ─────────────────────────────────────────────────────────── */
.msg-embed-invite {
    display: inline-flex;
    flex-direction: column;
    gap: 10px;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    padding: 14px 16px;
    max-width: 420px;
    margin-top: 4px;
}
.msg-embed-invite-header {
    font-size: 11px;
    font-weight: 700;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.msg-embed-invite-body {
    display: flex;
    align-items: center;
    gap: 12px;
}
.msg-embed-invite-icon-img,
.msg-embed-invite-icon-fallback {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    flex-shrink: 0;
}
.msg-embed-invite-icon-img { object-fit: cover; }
.msg-embed-invite-icon-fallback {
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}
.msg-embed-invite-info {
    flex: 1;
    min-width: 0;
}
.msg-embed-invite-name {
    font-size: 15px;
    font-weight: 700;
    color: #f2f3f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-embed-invite-meta {
    font-size: 12px;
    color: #b5bac1;
    margin-top: 2px;
}
.msg-embed-invite-expired {
    font-size: 12px;
    color: #f23f43;
    margin-top: 2px;
}
.msg-embed-invite-btn {
    background: #248046;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.msg-embed-invite-btn:hover:not(:disabled) { background: #1a6334; }
.msg-embed-invite-btn:disabled,
.msg-embed-invite-btn.joined { background: #4e5058; cursor: default; }

/* ── Audit Log Tab ──────────────────────────────────────────────────────────── */
.settings-loading { color: #949ba4; font-size: 14px; padding: 24px 0; }
.settings-empty   { color: #949ba4; font-size: 14px; padding: 16px 0; }
.settings-error   { color: #f23f43; font-size: 13px; margin-top: 6px; }

.audit-log-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
/* ── Report Cards (Server Settings) ─────────────────────────────────────── */
.report-card-list { display: flex; flex-direction: column; gap: 12px; }

.report-card {
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.report-card-tags {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.report-status-badge {
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.report-type-badge {
    background: #383a40;
    color: #b5bac1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.report-reason {
    font-size: 14px;
    font-weight: 600;
    color: #f2f3f5;
}

.report-date {
    font-size: 11px;
    color: #6d6f78;
    white-space: nowrap;
    flex-shrink: 0;
}

.report-card-who {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.report-who-item { display: flex; align-items: baseline; gap: 4px; }
.report-who-label { font-size: 11px; color: #6d6f78; text-transform: uppercase; letter-spacing: .3px; }
.report-who-value { font-size: 13px; color: #dbdee1; font-weight: 500; }
.report-who-sep { color: #4f545c; font-size: 13px; }

.report-message-preview {
    background: #1e1f22;
    border-left: 3px solid #4f545c;
    border-radius: 0 4px 4px 0;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-message-label {
    font-size: 11px;
    color: #6d6f78;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.report-message-text {
    margin: 0;
    font-size: 13px;
    color: #b5bac1;
    line-height: 1.5;
    word-break: break-word;
}

.report-details {
    padding: 6px 10px;
    background: #1e1f22;
    border-radius: 4px;
}

.report-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
    border-top: 1px solid #3f4147;
}

.report-action-btn { font-size: 12px !important; padding: 4px 12px !important; }
.report-escalate-btn { color: #f0b232 !important; }

.report-empty {
    color: #6d6f78;
    font-size: 14px;
    padding: 32px 0;
    text-align: center;
}

.audit-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
}
.audit-entry:hover { background: #2b2d31; }
.audit-entry-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.audit-entry-body { flex: 1; min-width: 0; }
.audit-entry-action { font-size: 14px; color: #dcddde; line-height: 1.4; }
.audit-actor { font-weight: 600; color: #f2f3f5; }
.audit-label { }
.audit-entry-time { font-size: 11px; color: #72767d; margin-top: 2px; }

/* ── Webhooks Tab ───────────────────────────────────────────────────────────── */
.webhook-create-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 6px;
}
.webhook-create-form .settings-input { flex: 1; min-width: 120px; }
.webhook-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.webhook-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #2b2d31;
    border-radius: 8px;
    gap: 12px;
}
.webhook-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.webhook-avatar-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.webhook-avatar-placeholder {
    background: #3c3f45;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.webhook-item-name { font-size: 14px; font-weight: 600; color: #f2f3f5; }
.webhook-item-channel { font-size: 12px; color: #72767d; margin-top: 2px; }
.webhook-item-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }
.settings-btn.small { padding: 4px 10px; font-size: 12px; }
.settings-btn.danger { background: #f23f43; }
.settings-btn.danger:hover { background: #da3034; }

.webhook-edit-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #3a3d44;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.webhook-item.editing { background: #2e3035; }
.webhook-edit-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.webhook-edit-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #b5bac1;
}
.webhook-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.webhook-url-input {
    flex: 1;
    font-family: monospace;
    font-size: 12px;
    color: #949ba4;
    cursor: text;
}
.webhook-edit-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.webhook-edit-error {
    font-size: 13px;
    color: #f23f43;
}
.settings-divider {
    border: none;
    border-top: 1px solid #3a3d44;
    margin: 16px 0;
}

/* ── Integrations ─────────────────────────────────────────────────────────── */
.integration-card {
    background: #2b2d31;
    border: 1px solid #3a3d44;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.integration-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}
.integration-icon {
    font-size: 32px;
    line-height: 1;
}
.integration-name {
    font-size: 16px;
    font-weight: 600;
    color: #f2f3f5;
}
.integration-status {
    font-size: 13px;
    margin-top: 2px;
}
.integration-status.connected { color: #23a55a; }
.integration-status.disconnected { color: #80848e; }
.integration-desc {
    font-size: 14px;
    color: #b5bac1;
    line-height: 1.5;
}
.dddice-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 6px;
}
.dddice-theme-card {
    background: #1e1f22;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s;
}
.dddice-theme-card:hover { border-color: #5865f2; }
.dddice-theme-card.active { border-color: #5865f2; background: #2d3055; }
.dddice-theme-preview {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    margin-bottom: 6px;
}
.dddice-theme-no-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: #2b2d31;
    border-radius: 4px;
}
.dddice-theme-name {
    font-size: 11px;
    color: #b5bac1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

