/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    height: 100dvh;
    background: #313338;
    color: #dcddde;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    overflow: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }

/* ===== 3-COLUMN SHELL ===== */
.app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/* ===== COL 1: SERVER ICON STRIP ===== */
#server-list {
    width: 72px;
    min-width: 72px;
    background: #1e1f22;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

#server-list::-webkit-scrollbar { width: 0; }

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #313338;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dcddde;
    font-size: 18px;
    font-weight: 700;
    border: none;
    transition: border-radius 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
    position: relative;
}

.server-icon:hover,
.server-icon.active {
    border-radius: 16px;
    background: #5865f2;
    color: white;
}

.server-icon img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.server-icon.dragging { opacity: 0.35; }
.server-icon.drag-over { outline: 2px solid #5865f2; border-radius: 16px; }

/* Personal server — always first, not draggable */
.server-icon.personal-server { cursor: pointer; }

/* Flashing invite tip */
.personal-server-tip {
    position: fixed;
    left: 80px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #5865f2;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transform: translateY(-50%);
    animation: tip-flash 1.2s ease-in-out infinite;
}
.personal-server-tip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #5865f2;
    border-left: none;
}
.personal-server-tip.hidden { display: none; }
.personal-server-tip button {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.8;
}
.personal-server-tip button:hover { opacity: 1; }

@keyframes tip-flash {
    0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
    50% { box-shadow: 0 4px 24px rgba(88,101,242,0.8), 0 0 0 4px rgba(88,101,242,0.3); }
}

.home-icon { background: #313338; color: #5865f2; }
.home-icon:hover { background: #5865f2; color: white; }

.add-server { background: #313338; color: #3ba55c; }
.add-server:hover { background: #3ba55c; color: white; }

.dm-indicator {
    background: #2b2d31 !important;
    border: 2px solid #3ba55c;
}
.dm-indicator:hover {
    background: #3ba55c !important;
    color: white !important;
    border-color: #3ba55c;
}

#dm-indicators:empty { display: none; }

.server-separator {
    width: 32px;
    height: 2px;
    background: #35373c;
    border-radius: 1px;
    flex-shrink: 0;
}

/* ===== COL 2: SIDEBAR (DMs or Channels) ===== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: #2b2d31;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 48px;
    border-bottom: 1px solid #1e1f22;
    font-weight: 600;
    font-size: 15px;
    color: #f2f3f5;
    flex-shrink: 0;
}

.server-name-header {
    font-size: 15px;
    font-weight: 700;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 8px 4px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #949ba4;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ===== ADD FRIEND FORM ===== */
.add-friend-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px 12px;
    border-bottom: 1px solid #1e1f22;
}

.add-friend-form input {
    background: #1e1f22;
    border: none;
    border-radius: 4px;
    color: #dcddde;
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    width: 100%;
}

.add-friend-form input::placeholder { color: #6d6f78; }

.form-error {
    padding: 4px 12px 8px;
    font-size: 12px;
    color: #ed4245;
}

.form-success {
    padding: 4px 12px 8px;
    font-size: 12px;
    color: #3ba55c;
}

/* ===== FRIEND REQUEST ITEMS ===== */
.friend-request-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 2px 8px;
    border-radius: 4px;
}

.friend-request-item:hover { background: #35373c; }

/* ===== DM LIST ===== */
.dm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 1px 8px;
    border-radius: 4px;
    color: #949ba4;
    font-size: 15px;
    font-weight: 500;
}

.dm-item:hover { background: #35373c; color: #dcddde; }
.dm-item.active { background: #404249; color: #f2f3f5; }

/* ===== CHANNEL LIST ===== */
.channel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin: 1px 8px;
    border-radius: 4px;
    color: #949ba4;
    font-size: 15px;
    font-weight: 500;
}

.channel-item:hover { background: #35373c; color: #dcddde; }
.channel-item.active { background: #404249; color: #f2f3f5; }

.channel-hash {
    font-size: 18px;
    color: #6d6f78;
    font-weight: 400;
    flex-shrink: 0;
}

.channel-item.active .channel-hash,
.channel-item:hover .channel-hash { color: #949ba4; }

.channel-row {
    display: flex;
    align-items: center;
    position: relative;
}
.channel-row .channel-item { flex: 1; }
.channel-gear-btn {
    position: absolute;
    right: 8px;
    opacity: 0;
    color: #b5bac1;
    padding: 4px;
    transition: opacity 0.15s;
}
.channel-row:hover .channel-gear-btn { opacity: 1; }
.channel-gear-btn:hover { color: #dcddde; }
.channel-delete-form { display: contents; }

/* Channel settings page extras */
.channel-rename-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.settings-input {
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 4px;
    color: #dcddde;
    padding: 8px 12px;
    font-size: 14px;
    flex: 1;
    max-width: 300px;
}
.settings-input:focus { border-color: #5865f2; outline: none; }
.settings-value {
    color: #dcddde;
    font-size: 16px;
    font-weight: 500;
}
.settings-description {
    color: #a3a6aa;
    font-size: 13px;
    margin: 0 0 14px;
    line-height: 1.5;
}
.settings-description code {
    background: #1e1f22;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    color: #dcddde;
}
.settings-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #dcddde;
    font-size: 14px;
}
.settings-status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}
.status-on { background: #248045; color: #fff; }
.status-off { background: #4f545c; color: #dcddde; }

.permissions-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 4px;
}
.permission-row:hover { background: #35373c; }
.permission-name {
    color: #dcddde;
    font-size: 14px;
}

.settings-danger {
    border: 1px solid #ed4245;
}
.btn-danger {
    background: #ed4245;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }

/* ===== FRIEND AVATAR ===== */
.friend-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    object-fit: cover;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* ===== SIDEBAR MISC ===== */
.sidebar-empty {
    padding: 24px 16px;
    color: #6d6f78;
    font-size: 13px;
    text-align: center;
}

.invite-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #1e1f22;
    font-size: 12px;
}

.invite-label { color: #949ba4; }
.invite-link { color: #5865f2; font-weight: 600; }
.invite-link:hover { text-decoration: underline; }

/* Welcome invite banner (personal server, <10 members) */
.welcome-invite-banner {
    background: linear-gradient(135deg, #2c2f3a 0%, #23272a 100%);
    border-bottom: 1px solid #3d4147;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}
.welcome-banner-dismiss {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #72767d;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    line-height: 1;
}
.welcome-banner-dismiss:hover { color: #dcddde; background: #3a3c41; }
.welcome-invite-banner-text { font-size: 13px; color: #dcddde; display: flex; flex-direction: column; gap: 2px; }
.welcome-invite-banner-text strong { color: #fff; font-size: 14px; }
.welcome-invite-banner-text span { color: #949ba4; font-size: 12px; }
.welcome-invite-banner-link { display: flex; gap: 8px; align-items: center; }
.welcome-invite-banner-input {
    flex: 1;
    background: #1e1f22;
    border: 1px solid #3d4147;
    border-radius: 4px;
    color: #b5bac1;
    font-size: 12px;
    padding: 6px 10px;
    font-family: monospace;
}

/* ===== COL 3: CONTENT AREA ===== */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #313338;
    overflow: hidden;
}

.content-header {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 16px;
    border-bottom: 1px solid #1e1f22;
    font-weight: 600;
    color: #f2f3f5;
    flex-shrink: 0;
}

.content-header .channel-hash { font-size: 22px; }
.content-header .friend-avatar { width: 24px; height: 24px; font-size: 11px; }

/* ===== MESSAGES ===== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.messages-container::-webkit-scrollbar { width: 8px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb { background: #1e1f22; border-radius: 4px; }

.message {
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.message:hover { background: #2e3035; }

.message-author {
    font-size: 13px;
    font-weight: 600;
    color: #f2f3f5;
    margin-bottom: 0;
}

.message.mine .message-author { color: #5865f2; }

.message-content { color: #dcddde; word-break: break-word; }

.message-time {
    font-size: 11px;
    color: #6d6f78;
    margin-left: 6px;
    font-weight: 400;
}

.typing-indicator {
    padding: 4px 16px;
    font-size: 12px;
    color: #949ba4;
    height: 20px;
    flex-shrink: 0;
}

/* ===== MESSAGE INPUT ===== */
.message-input-area {
    padding: 0 16px 24px;
    flex-shrink: 0;
}

.message-input-area form {
    display: flex;
    align-items: center;
    background: #383a40;
    border-radius: 8px;
    padding: 4px 4px 4px 16px;
    gap: 8px;
}

.message-input-area input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #dcddde;
    font-size: 15px;
    padding: 8px 0;
}

.message-input-area input::placeholder { color: #6d6f78; }

.message-input-area button {
    background: #5865f2;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
}

.message-input-area button:hover { background: #4752c4; }

.message-input-area .emoji-picker-btn {
    background: none;
    color: #3ba55c;
    padding: 4px 6px;
    border-radius: 4px;
}
.message-input-area .emoji-picker-btn:hover { background: #2a3c2c; color: #4fc36e; }

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #949ba4;
    text-align: center;
    padding: 32px;
    overflow-y: auto;
}

.welcome-screen::before {
    content: '';
    flex: 1;
}

.welcome-screen::after {
    content: '';
    flex: 1;
}

.welcome-icon { font-size: 64px; }
.welcome-screen h2 { color: #f2f3f5; font-size: 24px; }
.welcome-screen p { font-size: 15px; max-width: 400px; }

/* ===== GETTING STARTED TIPS ===== */
.getting-started-tips {
    margin-top: 24px;
    width: 100%;
    max-width: 440px;
}
.getting-started-tips h3 {
    color: #b5bac1;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.tip-cards { display: flex; flex-direction: column; gap: 8px; }
.tip-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #2b2d31;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
}
.tip-card-notice { background: rgba(250, 168, 26, 0.06); }
.tip-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tip-icon-green { background: rgba(59, 165, 92, 0.15); color: #3ba55c; }
.tip-icon-blue { background: rgba(88, 101, 242, 0.15); color: #5865f2; }
.tip-icon-purple { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.tip-icon-yellow { background: rgba(250, 168, 26, 0.15); color: #faa81a; }
.tip-text { font-size: 13px; color: #b5bac1; line-height: 1.4; }
.tip-text strong { display: block; color: #f2f3f5; font-size: 14px; margin-bottom: 2px; }
.tip-inline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    vertical-align: middle;
    margin: 0 2px;
}
.tip-inline-green { background: rgba(59, 165, 92, 0.2); color: #3ba55c; }
.tip-inline-blue { background: rgba(88, 101, 242, 0.2); color: #5865f2; }

/* ===== NEW HOME LAYOUT BLOCKS ===== */
.welcome-screen::before, .welcome-screen::after { display: none; }

.welcome-invite-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 400px;
    width: 100%;
}
.welcome-subtext { font-size: 15px; color: #949ba4; max-width: 360px; margin: 0; }
.welcome-cta-main {
    width: 100%;
    max-width: 280px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
}
.welcome-cta-secondary {
    width: 100%;
    max-width: 280px;
    padding: 10px 24px;
    font-size: 14px;
    border-radius: 8px;
}
.welcome-helper-text { font-size: 12px; color: #72767d; }

.invite-message-preview {
    background: #1e1f22;
    border: 1px solid #3c3f45;
    border-radius: 10px;
    padding: 14px 16px;
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}
.invite-msg-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #b5bac1;
    line-height: 1.5;
}
.invite-msg-url { color: #5865f2; word-break: break-all; font-size: 12px; }

.social-state-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #2b2d31;
    border-radius: 8px;
    padding: 12px 16px;
    max-width: 400px;
    width: 100%;
    font-size: 14px;
}
.social-state-label { color: #949ba4; }
.social-state-count { color: #3ba55c; font-weight: 600; }

.orb-social-hint { font-size: 12px; color: #72767d; margin: -4px 0 0; }

.welcome-secondary-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.welcome-secondary-label { font-size: 13px; color: #72767d; margin: 0; }
.welcome-add-friend-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    padding: 8px 20px;
}

.what-happens-next {
    max-width: 400px;
    width: 100%;
    background: #2b2d31;
    border-radius: 10px;
    padding: 16px 20px;
    text-align: left;
}
.what-happens-next h3 {
    color: #b5bac1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
}
.next-steps {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.next-steps li { font-size: 14px; color: #949ba4; line-height: 1.4; }

/* Add Friends CTA button on welcome screen */
.btn-add-friend-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #3ba55c;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.btn-add-friend-cta:hover {
    background: #2d8b4a;
    transform: scale(1.02);
}
.btn-add-friend-cta:active {
    transform: scale(0.98);
}

/* ===== INVITE PAGE ===== */
.invite-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #313338;
    padding: 24px;
}

.invite-card {
    background: #2b2d31;
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.invite-server-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: #5865f2;
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.invite-eyebrow {
    font-size: 13px;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin: 0;
}

.invite-server-name {
    font-size: 28px;
    font-weight: 800;
    color: #f2f3f5;
    margin: 0;
}

.invite-actions { width: 100%; margin-top: 8px; }

.invite-accept-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.invite-decline {
    font-size: 13px;
    color: #949ba4;
    text-decoration: none;
}
.invite-decline:hover { color: #dcddde; text-decoration: underline; }

/* ===== BUTTONS ===== */
.icon-btn {
    background: none;
    border: none;
    color: #949ba4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    flex-shrink: 0;
    cursor: pointer;
}

.icon-btn:hover { color: #dcddde; background: #35373c; }

.accept-btn:hover { color: #3ba55c; background: #2a3c2c; }
.reject-btn:hover { color: #ed4245; background: #3c2a2a; }

.friend-name { flex: 1; font-size: 14px; }

.btn-primary {
    background: #5865f2;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
}

.btn-primary:hover { background: #4752c4; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-cancel {
    background: transparent;
    color: #949ba4;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
}

.btn-cancel:hover { color: #dcddde; }

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: #313338;
    border-radius: 8px;
    padding: 32px;
    width: 440px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: #f2f3f5;
    text-align: center;
}

.modal-subtitle {
    font-size: 14px;
    color: #949ba4;
    text-align: center;
}

.modal-content input {
    background: #1e1f22;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    color: #dcddde;
    padding: 10px 12px;
    font-size: 15px;
    outline: none;
    width: 100%;
}

.modal-content input:focus { border-color: #5865f2; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== AUTH PAGES (Login/Register) ===== */
html:has(body.auth-page) {
    overflow: auto;
    height: auto;
}

body.auth-page {
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    height: auto;
    padding: 60px 16px 40px;
    box-sizing: border-box;
}

.auth-container {
    background: #2b2d31;
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 700;
    color: #f2f3f5;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #949ba4;
    letter-spacing: 0.04em;
}

.form-group input {
    background: #1e1f22;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    color: #dcddde;
    padding: 10px 12px;
    font-size: 15px;
    outline: none;
    width: 100%;
}

.form-group input:focus { border-color: #5865f2; }

/* ── Emoji styles ─────────────────────────────── */
.inline-emoji {
    width: 22px;
    height: 22px;
    vertical-align: middle;
    margin: 0 1px;
    object-fit: contain;
}

.server-icon-preview {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #36393f;
    display: flex;
    align-items: center;
    justify-content: center;
}
.server-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.server-icon-fallback {
    font-size: 2rem;
    font-weight: 600;
    color: #dcddde;
}
.server-icon-upload-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}

.emoji-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.emoji-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #2b2d31;
    border-radius: 6px;
    padding: 6px 10px;
}

.emoji-preview {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.emoji-name {
    font-size: 13px;
    color: #949ba4;
}

.emoji-delete-btn {
    font-size: 11px;
    color: #f04747;
}

.emoji-upload-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.emoji-upload-form input[type="text"] {
    background: #1e1f22;
    border: 1px solid #1e1f22;
    border-radius: 4px;
    color: #dcddde;
    padding: 7px 10px;
    font-size: 14px;
    width: 160px;
    outline: none;
}

.emoji-upload-form input[type="text"]:focus { border-color: #5865f2; }

.emoji-hint {
    font-size: 12px;
    color: #72767d;
    margin-top: 6px;
}

.badge-boosted {
    font-size: 11px;
    background: #f0b232;
    color: #111;
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: 8px;
    font-weight: 700;
}

.btn-boost {
    margin-top: 0;
    background: #f0b232;
    color: #111;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    transition: opacity 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-boost:hover { opacity: 0.85; }
.btn-boost .tier-detail {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.7;
}
.btn-boost-pro {
    background: linear-gradient(135deg, #f0b232, #e67e22);
}

/* ── Settings page ────────────────────────────── */
.settings-page {
    padding: 0 !important;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.settings-page > .content-header {
    padding: 12px 16px;
    flex-shrink: 0;
}
.settings-body {
    padding: 24px 32px;
    max-width: 660px;
    overflow-y: auto;
    flex: 1;
}
.settings-body.admin-body {
    max-width: 100%;
}
.settings-tab { display: none; }
.settings-tab.active { display: block; }
.settings-section {
    background: #2b2d31;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.settings-heading {
    font-size: 12px;
    font-weight: 700;
    color: #b5bac1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.badge-standard {
    font-size: 10px;
    background: #5865f2;
    color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 700;
    letter-spacing: 0;
}

/* Members list */
.member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}
.member-row:hover {
    background: #35373c;
}
.member-name {
    flex: 1;
    font-size: 14px;
    color: #dcddde;
    font-weight: 500;
}
.member-role {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.role-owner {
    background: #f0b232;
    color: #111;
}
.role-admin {
    background: #ed4245;
    color: #fff;
}
.role-moderator {
    background: #5865f2;
    color: #fff;
}
.role-member {
    background: #4f545c;
    color: #dcddde;
}

/* Audit log table */
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.audit-table th {
    text-align: left;
    color: #b5bac1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 8px 12px;
    border-bottom: 1px solid #3f4147;
}
.audit-table td {
    padding: 10px 12px;
    color: #dcddde;
    border-bottom: 1px solid #2f3136;
}
.audit-table tbody tr:hover {
    background: #35373c;
}
.admin-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.audit-time {
    color: #a3a6aa;
    font-size: 12px;
    white-space: nowrap;
}
.audit-action {
    font-weight: 600;
    text-transform: capitalize;
}

/* Alerts */
.alert-success {
    background: #248045;
    color: #fff;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid #57f287;
}

.alert-error {
    background: #6d1a1a;
    color: #fff;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid #ed4245;
}

/* ── Emoji picker ─────────────────────────────── */
.emoji-picker-btn {
    font-size: 18px;
    padding: 4px 6px;
    flex-shrink: 0;
}

.emoji-picker {
    position: absolute;
    bottom: 60px;
    left: 16px;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    width: 420px;
    height: 440px;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.emoji-search {
    margin: 8px 8px 0;
    padding: 6px 10px;
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 6px;
    color: #dcddde;
    font-size: 13px;
    outline: none;
    flex-shrink: 0;
}

.emoji-search::placeholder { color: #72767d; }
.emoji-search:focus { border-color: #5865f2; }

.emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 6px 8px 4px;
    border-bottom: 1px solid #1e1f22;
    overflow-x: auto;
    flex-shrink: 0;
}

.emoji-tabs::-webkit-scrollbar { height: 0; }

.emoji-tab {
    background: none;
    border: none;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
}

.emoji-tab:hover { opacity: 0.8; background: #404249; }
.emoji-tab.active { opacity: 1; background: #404249; }

.emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    align-content: flex-start;
}

.emoji-grid::-webkit-scrollbar { width: 6px; }
.emoji-grid::-webkit-scrollbar-thumb { background: #4f545c; border-radius: 3px; }
.emoji-grid::-webkit-scrollbar-track { background: transparent; }

.emoji-grid button {
    background: none;
    border: none;
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    font-size: 22px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s;
}

.emoji-grid button:hover { background: #404249; }

.emoji-category-label {
    width: 100%;
    font-size: 12px;
    font-weight: 600;
    color: #b5bac1;
    text-transform: uppercase;
    padding: 6px 4px 2px;
    letter-spacing: 0.02em;
}

.emoji-picker-empty {
    font-size: 13px;
    color: #72767d;
    padding: 12px;
    text-align: center;
}

.message-input-area { position: relative; }


/* ── Date separators ──────────────────────────── */
.date-separator {
    display: flex;
    align-items: center;
    margin: 16px 0 8px;
    gap: 8px;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #3f4147;
}

.date-separator span {
    font-size: 11px;
    font-weight: 600;
    color: #72767d;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Notification badge ───────────────────────── */
.home-icon { position: relative; }

.notif-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #ed4245;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    border: 2px solid #1e1f22;
}

@keyframes notif-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.notif-pulse { animation: notif-pulse 0.3s ease; }

/* ── Notification dropdown ────────────────────── */
.notif-bell-wrapper {
    position: relative;
}
.notif-bell-btn {
    background: none;
    border: none;
    color: #b5bac1;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    position: relative;
    transition: color 0.15s, background 0.15s;
}
.notif-bell-btn:hover {
    color: #f2f3f5;
    background: #35373c;
}
.notif-bell-btn .notif-bell-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #ed4245;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
}
.notif-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 420px;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 300;
    flex-direction: column;
    overflow: hidden;
}
.notif-dropdown.open {
    display: flex;
}
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #1e1f22;
    font-size: 14px;
    font-weight: 600;
    color: #f2f3f5;
}
.notif-mark-read {
    background: none;
    border: none;
    color: #5865f2;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.notif-mark-read:hover {
    background: rgba(88, 101, 242, 0.1);
}
.notif-dropdown-list {
    overflow-y: auto;
    flex: 1;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(30, 31, 34, 0.5);
    cursor: pointer;
    transition: background 0.1s;
}
.notif-item:hover {
    background: #35373c;
}
.notif-item.unread {
    background: rgba(88, 101, 242, 0.06);
}
.notif-item.unread::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5865f2;
    flex-shrink: 0;
    margin-top: 5px;
}
.notif-item-content {
    flex: 1;
    min-width: 0;
}
.notif-item-text {
    font-size: 13px;
    color: #dcddde;
    line-height: 1.3;
    word-break: break-word;
}
.notif-item-time {
    font-size: 11px;
    color: #949ba4;
    margin-top: 2px;
}
.notif-empty {
    padding: 32px 14px;
    text-align: center;
    color: #949ba4;
    font-size: 13px;
}

/* ── @mention autocomplete ────────────────────── */
.mention-list {
    position: absolute;
    bottom: 60px;
    left: 16px;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    min-width: 200px;
    max-width: 320px;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    overflow: hidden;
}

.mention-item {
    padding: 8px 12px;
    font-size: 14px;
    color: #dcddde;
    cursor: pointer;
    transition: background 0.1s;
}

.mention-item:hover,
.mention-item.active {
    background: #404249;
    color: #fff;
}

/* ── Upgrade tier buttons ─────────────────────── */
.upgrade-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.boost-form { margin-top: 0; }

.btn-boost-standard {
    background: #5865f2;
    color: #fff;
}
.btn-boost-standard:hover { opacity: 0.85; }

.btn-boost-pro {
    background: #f0b232;
    color: #111;
}
.btn-boost-pro:hover { opacity: 0.85; }

.tier-detail {
    font-size: 11px;
    font-weight: 400;
    margin-left: 6px;
    opacity: 0.8;
}

.badge-standard {
    font-size: 11px;
    background: #5865f2;
    color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: 8px;
    font-weight: 700;
}

/* ── Referral ─────────────────────────────────────────── */
.referral-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 12px;
}
.referral-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.referral-link-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 10px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
}
.referral-copied {
    color: #43b581;
    font-size: 12px;
    margin-top: 4px;
}
.referral-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.referral-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px 24px;
    min-width: 100px;
}
.referral-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}
.referral-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
    letter-spacing: .05em;
    text-align: center;
}
.referral-stat-commission .referral-stat-value { color: #43b581; }
.referral-commission-cell { color: #43b581; font-weight: 600; }

/* ── GIF picker ──────────────────────────────────────── */
.gif-picker {
    position: absolute;
    bottom: 60px;
    left: 60px;
    background: #2b2d31;
    border: 1px solid #1e1f22;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    width: 420px;
    height: 440px;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.gif-picker-header {
    padding: 8px 8px 0;
    flex-shrink: 0;
}

.gif-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    align-content: flex-start;
}

.gif-grid::-webkit-scrollbar { width: 6px; }
.gif-grid::-webkit-scrollbar-thumb { background: #4f545c; border-radius: 3px; }
.gif-grid::-webkit-scrollbar-track { background: transparent; }

.gif-thumb {
    width: calc(50% - 2px);
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.1s;
}

.gif-thumb:hover { opacity: 0.8; }

.gif-attribution {
    font-size: 10px;
    color: #72767d;
    text-align: center;
    padding: 4px;
    border-top: 1px solid #1e1f22;
    flex-shrink: 0;
}

/* ── Embedded GIFs / images in messages ──────────────── */
.embedded-gif {
    max-width: 400px;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 4px;
    display: block;
}

/* ── Twemoji inline ───────────────────────────────────── */
img.emoji {
    height: 1.1em;
    width: 1.1em;
    vertical-align: -0.15em;
    margin: 0 .05em;
}

/* ===== ORB ECONOMY ===== */
.orb-balance {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 183, 0, 0.12);
    color: #f0b232;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
}
.orb-balance:hover { background: rgba(255, 183, 0, 0.22); }
.orb-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: url('/images/orb.png') center/contain no-repeat;
    vertical-align: middle;
}
.orb-icon-lg {
    display: inline-block;
    width: 36px;
    height: 36px;
    background: url('/images/orb.png') center/contain no-repeat;
    vertical-align: middle;
}

/* Daily claim section on home page */
.orb-claim-section {
    margin-top: 24px;
    padding: 20px;
    background: #2b2d31;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 360px;
}
.orb-balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
}
.orb-balance-amount { font-size: 28px; font-weight: 700; color: #f0b232; }
.orb-balance-label { font-size: 16px; color: #b5bac1; }
.streak-display { color: #b5bac1; font-size: 14px; }

.btn-daily-claim {
    padding: 10px 28px;
    font-size: 16px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #f0b232, #e08a1e);
    color: #fff;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-daily-claim:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(240, 178, 50, 0.3);
}
.btn-daily-claim.claimed, .btn-daily-claim:disabled {
    background: #4e5058;
    color: #b5bac1;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.orb-links {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* Orb Shop */
.shop-container, .wallet-container {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 48px);
}
.shop-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.shop-subtitle { color: #b5bac1; font-size: 14px; margin-bottom: 20px; }

.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 720px;
    margin-bottom: 32px;
}

.shop-card {
    background: #2b2d31;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 2px solid transparent;
    transition: border-color 0.15s;
    position: relative;
}
.shop-card:hover { border-color: #f0b232; }
.shop-card.popular { border-color: #f0b232; }
.shop-card-badge {
    position: absolute;
    top: -10px;
    background: #f0b232;
    color: #1e1f22;
    padding: 2px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}
.shop-card-orbs { font-size: 28px; font-weight: 700; color: #f0b232; }
.shop-card-name { font-size: 16px; font-weight: 600; }
.shop-card-price { font-size: 20px; color: #b5bac1; margin-bottom: 8px; }

.shop-earn-section { max-width: 720px; }
.shop-earn-section h3 { font-size: 18px; margin-bottom: 12px; }
.earn-methods { display: flex; flex-direction: column; gap: 10px; }
.earn-method {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #2b2d31;
    border-radius: 8px;
    font-size: 14px;
}
.earn-icon { font-size: 20px; }

/* Wallet */
.wallet-success {
    background: rgba(87, 242, 135, 0.15);
    color: #57f287;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.wallet-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    max-width: 720px;
}

.wallet-balance-card, .wallet-stat-card {
    background: #2b2d31;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}
.wallet-balance-label, .wallet-stat-label {
    font-size: 13px;
    color: #b5bac1;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wallet-balance-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 28px;
    font-weight: 700;
    color: #f0b232;
}
.wallet-stat-value { font-size: 20px; font-weight: 600; }

.wallet-section-title { font-size: 16px; margin-bottom: 12px; }

.transaction-table { max-width: 720px; }

.transaction-header {
    display: grid;
    grid-template-columns: 140px 1fr 80px 160px;
    padding: 8px 12px;
    font-size: 12px;
    color: #b5bac1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #3f4147;
}

.transaction-row {
    display: grid;
    grid-template-columns: 140px 1fr 80px 160px;
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid #2b2d31;
    align-items: center;
}

.transaction-type { font-size: 12px; color: #b5bac1; }
.transaction-desc { color: #dcddde; }
.transaction-amount { font-weight: 600; text-align: right; }
.transaction-row.credit .transaction-amount { color: #57f287; }
.transaction-row.debit .transaction-amount { color: #ed4245; }
.transaction-date { font-size: 12px; color: #b5bac1; text-align: right; }

.wallet-empty {
    padding: 32px;
    text-align: center;
    color: #b5bac1;
    font-size: 14px;
}

/* ===== BADGES ===== */
.badges-container {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 48px);
    max-width: 960px;
}

/* Hero summary */
.badges-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #2b2d31;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 28px;
}
.badges-ring {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}
.badges-ring svg {
    width: 72px;
    height: 72px;
    transform: rotate(-90deg);
}
.badges-ring-bg {
    fill: none;
    stroke: #1e1f22;
    stroke-width: 6;
}
.badges-ring-fill {
    fill: none;
    stroke: #f0b232;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}
.badges-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #f0b232;
}
.badges-hero-info h2 {
    font-size: 18px;
    font-weight: 700;
    color: #f2f3f5;
    margin: 0 0 4px;
}
.badges-hero-sub {
    font-size: 13px;
    color: #b5bac1;
}

/* Category sections */
.badges-category {
    margin-bottom: 28px;
}
.badges-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.badges-category-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #b5bac1;
    margin: 0;
}
.badges-category-line {
    flex: 1;
    height: 1px;
    background: #3f4147;
}

/* Badge grid */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

/* Badge card */
.badge-card {
    background: #2b2d31;
    border-radius: 12px;
    padding: 20px 16px 16px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.badge-card:hover {
    transform: translateY(-2px);
}
.badge-card.earned {
    border-color: #f0b232;
    box-shadow: 0 0 16px rgba(240, 178, 50, 0.15);
}
.badge-card.earned:hover {
    box-shadow: 0 0 24px rgba(240, 178, 50, 0.25);
}
.badge-card.locked {
    opacity: 0.45;
}
.badge-card.locked:hover {
    opacity: 0.7;
}

/* Badge icon */
.badge-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: #1e1f22;
    border-radius: 50%;
}
.badge-card.earned .badge-icon {
    background: rgba(240, 178, 50, 0.12);
}

/* Badge text */
.badge-name {
    font-size: 14px;
    font-weight: 600;
    color: #f2f3f5;
    margin-bottom: 4px;
}
.badge-desc {
    font-size: 12px;
    color: #b5bac1;
    margin-bottom: 10px;
    line-height: 1.3;
}

/* Orb reward tag */
.badge-reward {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #f0b232;
    background: rgba(240, 178, 50, 0.1);
    border-radius: 10px;
    padding: 3px 8px;
    margin-bottom: 8px;
}
.badge-card.earned .badge-reward {
    color: #57f287;
    background: rgba(87, 242, 135, 0.1);
}

/* Earned state */
.badge-earned-date {
    font-size: 11px;
    color: #57f287;
    font-weight: 600;
}
.badge-earned-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #57f287;
    color: #111;
    font-size: 12px;
    font-weight: 700;
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Progress bar */
.badge-progress-bar {
    width: 100%;
    height: 6px;
    background: #1e1f22;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.badge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f0b232, #f5c860);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.badge-progress-text {
    font-size: 11px;
    color: #949ba4;
}

/* ===== ORB GIFT ===== */
.gift-modal {
    position: absolute;
    bottom: 60px;
    left: 80px;
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-radius: 12px;
    padding: 16px;
    width: 280px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.gift-modal-header { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.gift-modal-balance { font-size: 13px; color: #b5bac1; margin-bottom: 12px; }
.gift-modal label { font-size: 12px; color: #b5bac1; display: block; margin-bottom: 4px; margin-top: 8px; }
.gift-input {
    width: 100%;
    padding: 6px 10px;
    background: #1e1f22;
    border: 1px solid #3f4147;
    border-radius: 6px;
    color: #dcddde;
    font-size: 14px;
    outline: none;
}
.gift-input:focus { border-color: #5865f2; }
.gift-error { color: #ed4245; font-size: 13px; margin-top: 8px; }
.gift-modal-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }

/* Gift message in chat */
.gift-message {
    text-align: center;
    padding: 8px 16px;
}
.gift-message-content {
    display: inline-block;
    background: linear-gradient(135deg, rgba(240,178,50,0.15), rgba(88,101,242,0.15));
    border: 1px solid rgba(240,178,50,0.3);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
}

/* Gift particle animation */
.gift-animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}
.gift-particle {
    position: absolute;
    bottom: 20%;
    font-size: 20px;
    animation: giftFloat 1.5s ease-out forwards;
    opacity: 0;
}
@keyframes giftFloat {
    0% { transform: translateY(0) scale(0.5); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: translateY(-200px) translateX(calc(-50px + 100px * var(--r, 0))) scale(1.2); opacity: 0; }
}
.gift-particle:nth-child(odd) { --r: 0.3; }
.gift-particle:nth-child(even) { --r: 0.7; }
.gift-particle:nth-child(3n) { --r: 0.5; font-size: 24px; }
.gift-particle:nth-child(5n) { --r: 0.1; }
.gift-particle:nth-child(7n) { --r: 0.9; }

/* ===== MOBILE MENU BUTTON ===== */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #dcddde;
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    flex-shrink: 0;
    padding: 0;
}
.mobile-menu-btn:hover { background: #35373c; }

.mobile-only-header { display: none; }

/* ===== SIDEBAR BACKDROP (mobile) ===== */
.sidebar-backdrop {
    display: none;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }
    .mobile-only-header { display: flex; }

    .app-shell { position: relative; }

    #server-list {
        position: fixed;
        top: 0;
        left: -72px;
        height: 100vh;
        height: 100dvh;
        z-index: 200;
        transition: left 0.2s ease;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -240px;
        height: 100vh;
        height: 100dvh;
        z-index: 199;
        transition: left 0.2s ease;
    }

    .app-shell.sidebar-open #server-list { left: 0; }
    .app-shell.sidebar-open .sidebar { left: 72px; }
    .app-shell:not(:has(#server-list)).sidebar-open .sidebar { left: 0; }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 198;
    }

    .app-shell.sidebar-open .sidebar-backdrop { display: block; }

    .content-area {
        width: 100vw;
        min-width: 100vw;
        height: 100vh;
        height: 100dvh;
    }

    .members-sidebar { display: none; }

    /* Keep messages scrollable, input always visible */
    .messages-container {
        min-height: 0;
        flex: 1;
    }

    /* Pickers: full-width on mobile */
    .emoji-picker {
        width: calc(100vw - 32px);
        left: 16px;
        max-height: 50vh;
    }

    .gif-picker {
        width: calc(100vw - 32px);
        left: 16px;
        max-height: 50vh;
    }

    .gift-modal {
        width: calc(100vw - 32px);
        left: 16px;
    }

    .notif-dropdown {
        width: calc(100vw - 32px);
        right: -60px;
        max-height: 50vh;
    }

    .mention-list {
        left: 16px;
        max-width: calc(100vw - 32px);
    }

    /* Content header: prevent overflow on narrow screens */
    .content-header {
        gap: 4px;
        padding: 0 8px;
        overflow: visible;
    }

    .content-header .orb-balance {
        padding: 2px 6px;
        font-size: 12px;
    }

    /* Message input: tighter padding, always visible */
    .message-input-area { padding: 0 8px 12px; }

    /* Embedded images: constrain to viewport */
    .embedded-gif { max-width: 100%; }

    /* Smaller avatars on mobile */
    .message { grid-template-columns: 28px 1fr; column-gap: 8px; }
    .message-avatar-fallback { font-size: 11px; }

    /* Orb shop cards: stack vertically */
    .shop-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .shop-container, .wallet-container, .badges-container { padding: 16px; }

    /* Settings page: tighter padding on mobile */
    .settings-body { padding: 16px; max-width: 100%; }
    .settings-section { padding: 16px; }
    .audit-table { font-size: 12px; }
    .audit-table th, .audit-table td { padding: 8px 6px; }
    .member-row { padding: 6px 8px; }

    /* Badges: responsive */
    .badges-hero { padding: 16px; gap: 14px; }
    .badges-ring { width: 56px; height: 56px; }
    .badges-ring svg { width: 56px; height: 56px; }
    .badges-ring-text { font-size: 13px; }
    .badges-hero-info h2 { font-size: 16px; }
    .badges-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .badge-card { padding: 14px 12px 12px; }
    .badge-icon { width: 44px; height: 44px; font-size: 26px; }

    /* Wallet summary: stack vertically */
    .wallet-summary {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    /* Transaction table: horizontal scroll */
    .transaction-table { overflow-x: auto; max-width: 100%; }
    .transaction-header, .transaction-row { min-width: 520px; }

    /* Welcome screen: smaller padding */
    .welcome-screen { padding: 16px; }
    .welcome-screen h2 { font-size: 20px; }

    /* Modal: responsive */
    .modal-content {
        width: calc(100vw - 32px);
        max-width: 440px;
        padding: 24px;
    }

    /* Auth pages: responsive */
    .auth-container { width: 100%; }

    /* Profile responsive */
    .profile-container { padding: 16px; }
    .profile-banner { height: 120px; }
    .profile-avatar { width: 72px; height: 72px; margin-top: -36px; }
    .profile-form-actions { flex-direction: column; }
    .profile-form-actions .btn-primary { width: 100%; }
    .profile-color-picker { flex-wrap: wrap; }

    /* Admin pages: horizontally scrollable tables */
    .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .admin-table-wrap .audit-table { min-width: 560px; }

    /* Admin form row: stack on mobile */
    .admin-form-row { flex-direction: column; }
    .admin-form-row .btn { width: 100%; }

    /* Admin stat cards: 2-col grid on mobile */
    .referral-stats { gap: 12px; }
    .referral-stat { flex: 1 1 calc(50% - 12px); min-width: 0; padding: 12px 8px; }
    .referral-stat-value { font-size: 1.3rem; }
    .referral-stat-label { font-size: 10px; }
}

/* ===== PROFILE PAGE ===== */
.profile-container {
    padding: 24px;
    max-width: 660px;
    margin: 0 auto;
    overflow-y: auto;
    height: calc(100% - 48px);
}

.profile-preview-card {
    background: #2b2d31;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}

.profile-banner {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #5865f2 0%, #3ba55c 100%);
    position: relative;
    overflow: hidden;
}
.profile-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    color: white;
}
.profile-banner:hover .profile-upload-overlay { opacity: 1; }

.profile-avatar-section {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 0 16px 16px;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #5865f2;
    border: 4px solid #2b2d31;
    margin-top: -48px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.profile-avatar-initial {
    font-size: 36px;
    font-weight: 700;
    color: white;
}
.profile-avatar-upload {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    color: white;
    border-radius: 50%;
}
.profile-avatar:hover .profile-avatar-upload { opacity: 1; }

.profile-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 4px;
}
.profile-preview-displayname {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}
.profile-preview-username {
    font-size: 13px;
    color: #949ba4;
}
.profile-preview-pronouns {
    font-size: 12px;
    color: #949ba4;
    background: #1e1f22;
    padding: 2px 8px;
    border-radius: 12px;
    width: fit-content;
    margin-top: 2px;
}
.profile-preview-bio {
    padding: 0 16px 16px;
    font-size: 14px;
    color: #b5bac1;
    line-height: 1.4;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}
.profile-color-picker input[type="color"] {
    width: 40px;
    height: 40px;
    border: 2px solid #3f4147;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    padding: 2px;
}
.profile-color-hex {
    font-size: 13px;
    color: #949ba4;
    font-family: monospace;
}

.profile-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #3f4147;
}
.profile-form-actions .btn-primary {
    width: auto;
    padding: 10px 24px;
}

.form-hint {
    font-size: 12px;
    color: #72767d;
}

/* ===== PUBLIC PROFILE SECTIONS ===== */
.profile-section {
    background: #2b2d31;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}
.profile-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #949ba4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.profile-section-value {
    font-size: 14px;
    color: #dcddde;
}
.profile-badges-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.profile-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1e1f22;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: default;
}
.profile-badge-icon { font-size: 18px; }
.profile-badge-name { font-size: 13px; color: #b5bac1; }
.profile-badge:hover { background: #383a40; }
.profile-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.profile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #949ba4;
    transition: color 0.2s;
}
.profile-link:hover { color: #dcddde; }

/* ===== MFA SETUP ===== */
.mfa-section {
    background: #2b2d31;
    border-radius: 8px;
    padding: 20px;
}
.mfa-recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.mfa-recovery-code {
    background: #1e1f22;
    padding: 8px 12px;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-family: monospace;
    text-align: center;
}

/* ===== MESSAGE AVATARS ===== */
.message-avatar-link {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: start;
    padding-top: 2px;
    cursor: pointer;
    text-decoration: none;
    overflow: hidden;
}
.message-avatar {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.message-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #5865f2;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}
.message-author {
    grid-column: 2;
    min-width: 0;
}
.author-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.author-link:hover {
    text-decoration: underline;
}
.message-content {
    grid-column: 2;
}

/* ===== MESSAGE GROUPING ===== */
.message:not(.message-grouped) { margin-top: 17px; }
.message:has(+ .message-grouped) { padding-bottom: 0; }
.message-grouped { padding-top: 0; padding-bottom: 0; }
.message-grouped .message-avatar-link,
.message-grouped .message-author { display: none; }
.message-grouped .message-content { grid-column: 2; }

/* ===== MENTION HIGHLIGHTING ===== */
.message.message-mentioned {
    background: rgba(250, 168, 26, 0.08);
    box-shadow: inset 3px 0 0 #faa81a;
}
.message.message-mentioned:hover { background: rgba(250, 168, 26, 0.12); }
.mention-text {
    background: rgba(88, 101, 242, 0.3);
    color: #dee0fc;
    border-radius: 3px;
    padding: 0 2px;
    font-weight: 600;
    cursor: pointer;
}
a.mention-text {
    text-decoration: none;
    display: inline;
}
.mention-text:hover {
    background: #5865f2;
    color: #fff;
}

/* Hover time for grouped messages (no visible timestamp) */
.message-grouped {
    position: relative;
}
.message-grouped::before {
    content: attr(data-grouped-time);
    font-size: 0.62rem;
    color: var(--text-muted, #72767d);
    position: absolute;
    left: 0;
    width: 38px;
    text-align: right;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.1s;
    pointer-events: none;
    line-height: 1;
}
.message-grouped:hover::before {
    opacity: 1;
}

/* Clickable DM friend name in header */
.content-header-friend-name {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}
.content-header-friend-name:hover {
    text-decoration: underline;
}

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
    margin-top: auto;
    padding: 8px 10px;
    border-top: 1px solid #3f4147;
    display: flex;
    align-items: center;
    gap: 8px;
    /* The sidebar itself is the scroll container, so margin-top:auto alone
       stops pinning once the list overflows — sticky keeps it on screen. */
    position: sticky;
    bottom: 0;
    background: #2b2d31;
    z-index: 1;
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #b5bac1;
    font-size: 13px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.sidebar-footer a:hover { background: #35373c; color: #f2f3f5; }
.sidebar-footer svg { flex-shrink: 0; }

/* ===== SWITCH ACCOUNTS PANEL ===== */
.switch-accounts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.switch-accounts-overlay:not(.hidden) { opacity: 1; pointer-events: all; }

.switch-accounts-panel {
    position: fixed;
    bottom: 0;
    left: 72px;
    width: 280px;
    background: #2b2d31;
    border: 1px solid #3f4147;
    border-radius: 8px 8px 0 0;
    z-index: 1001;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch-accounts-panel.open { transform: translateY(0); }

.switch-accounts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #949ba4;
    border-bottom: 1px solid #3f4147;
}
.switch-accounts-close {
    background: none;
    border: none;
    color: #949ba4;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.switch-accounts-close:hover { color: #dcddde; }

.switch-accounts-current {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}
.switch-accounts-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.switch-accounts-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.switch-accounts-name {
    font-size: 14px;
    font-weight: 600;
    color: #f2f3f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.switch-accounts-badge {
    font-size: 11px;
    color: #3ba55c;
    font-weight: 600;
}
.switch-accounts-logout-btn {
    background: none;
    border: 1px solid #4f545c;
    color: #949ba4;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}
.switch-accounts-logout-btn:hover { border-color: #ed4245; color: #ed4245; }

.switch-accounts-divider { height: 1px; background: #3f4147; margin: 0 16px; }

.switch-accounts-inactive { opacity: 0.85; }
.switch-btn { border-color: #5865f2 !important; color: #5865f2 !important; }
.switch-btn:hover { border-color: #4752c4 !important; color: #fff !important; background: #5865f2 !important; }
.switch-accounts-remove-btn {
    background: none;
    border: none;
    color: #4f545c;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}
.switch-accounts-remove-btn:hover { color: #ed4245; }

.switch-accounts-add {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #949ba4;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    border-radius: 0 0 8px 8px;
    transition: background 0.15s, color 0.15s;
}
.switch-accounts-add:hover { background: #35373c; color: #f2f3f5; }

/* ===== RIGHT-CLICK CONTEXT MENU ===== */
.context-menu {
    position: fixed;
    z-index: 9999;
    background: #111214;
    border: 1px solid #2b2d31;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.6);
    padding: 6px;
    min-width: 180px;
    animation: ctxFadeIn .1s ease;
}
@keyframes ctxFadeIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #b5bac1;
    cursor: pointer;
    white-space: nowrap;
}
.context-menu-item:hover { background: #5865f2; color: #fff; }
.context-menu-item .ctx-icon { font-size: 16px; width: 20px; text-align: center; }
.context-menu-separator { height: 1px; background: #2b2d31; margin: 4px 6px; }
.context-menu-danger { color: #ed4245; }
.context-menu-danger:hover { background: #ed4245; color: #fff; }

/* ===== VOICE CHANNELS ===== */

/* Channel type selector in create form */
.channel-type-select {
    background: #1e1f22;
    color: #dcddde;
    border: 1px solid #3f4147;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 13px;
    outline: none;
}

/* Voice room layout */
.voice-room {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: calc(100% - 48px);
    background: #2b2d31;
}

.voice-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 16px;
    align-content: center;
    overflow-y: auto;
}

.voice-tile {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #1e1f22;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid transparent;
    transition: border-color 0.2s;
}

.voice-tile.speaking {
    border-color: #22c55e;
    animation: voice-pulse 1.5s infinite;
}

.voice-tile::after {
    content: '🎤';
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 14px;
    background: rgba(0,0,0,0.55);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.voice-tile.speaking::after {
    opacity: 1;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 12px 4px rgba(34, 197, 94, 0.2); }
}

.voice-tile-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.voice-tile-video.hidden { display: none; }

.voice-tile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
}

.voice-tile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.voice-tile-avatar.hidden { display: none; }

.voice-tile-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-tile-status {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.voice-tile-status .status-icon {
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Voice controls bar */
.voice-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: #1e1f22;
    border-top: 1px solid #3f4147;
}

.vc-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: #3f4147;
    color: #dcddde;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.vc-btn:hover { background: #4f545c; }
.vc-btn.active { background: #ed4245; color: #fff; }

.vc-btn-danger {
    background: #ed4245;
    color: #fff;
}
.vc-btn-danger:hover { background: #c03537; }

/* Voice error */
.voice-error {
    color: #ed4245;
    text-align: center;
    padding: 40px 20px;
    font-size: 15px;
}

/* Sidebar voice participants */
.voice-sidebar-participants {
    padding: 0 8px 4px 28px;
}

.voice-sidebar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 12px;
    color: #8e9297;
}

.voice-sidebar-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.voice-sidebar-avatar-fallback {
    background: #5865f2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

/* ===== VOICE FOCUS MODE ===== */
.voice-tile { cursor: pointer; }

.voice-grid--has-focus {
    display: flex;
    padding: 10px;
}
.voice-tile--focused {
    flex: 1;
    aspect-ratio: unset;
    border-color: #5865f2 !important;
}
.voice-filmstrip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 12px;
    background: #1e1f22;
    border-top: 1px solid #3f4147;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: #4e5058 transparent;
}
.voice-filmstrip .voice-tile {
    width: 130px;
    flex-shrink: 0;
    aspect-ratio: 4/3;
    opacity: 0.8;
    transition: opacity 0.15s, border-color 0.15s;
}
.voice-filmstrip .voice-tile:hover {
    opacity: 1;
    border-color: #5865f2;
}

/* ===== VOICE MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .voice-room { position: relative; }

    .voice-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 1fr;
        align-content: stretch;
        gap: 6px;
        padding: 6px 6px 80px;
    }
    .voice-grid[data-count="1"],
    .voice-grid[data-count="2"] {
        grid-template-columns: 1fr;
    }
    .voice-tile {
        aspect-ratio: unset;
        min-height: 130px;
    }
    .voice-tile-avatar {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    .voice-controls {
        position: absolute;
        bottom: 0; left: 0; right: 0;
        background: rgba(17, 18, 20, 0.9);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid rgba(255,255,255,0.07);
        padding: 10px 24px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        gap: 20px;
    }
    .vc-btn {
        width: 52px;
        height: 52px;
    }
    .vc-btn svg {
        width: 20px;
        height: 20px;
    }
    .voice-tile-name { font-size: 11px; }

    /* Focus mode on mobile: filmstrip above floating controls */
    .voice-grid--has-focus {
        padding: 6px 6px 80px;
    }
    .voice-filmstrip {
        position: absolute;
        bottom: 70px; left: 0; right: 0;
        background: rgba(17, 18, 20, 0.82);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255,255,255,0.07);
        padding: 6px 8px;
    }
    .voice-filmstrip .voice-tile {
        width: 90px;
        height: 68px;
        aspect-ratio: unset;
    }
}

/* ── Session Cards ───────────────────────────────────── */
.session-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #2b2d31;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid transparent;
}
.session-card.session-current {
    border-color: #3ba55d;
}
.session-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}
.session-info {
    flex: 1;
    min-width: 0;
}
.session-title {
    color: #f2f3f5;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.session-badge {
    background: #3ba55d;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.session-meta {
    color: #949ba4;
    font-size: 12px;
    margin-top: 2px;
    display: flex;
    gap: 12px;
}
@media (max-width: 768px) {
    .session-card { padding: 10px 12px; gap: 10px; }
    .session-icon { font-size: 20px; width: 32px; }
    .session-title { font-size: 13px; }
}

/* ===== PRESENCE / ONLINE STATUS ===== */
.avatar-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.presence-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #2b2d31;
}
.presence-dot.online { background: #23a55a; }
.presence-dot.offline { background: #80848e; }

/* ===== MEMBERS SIDEBAR (Channel page, Col 4) ===== */
.members-sidebar {
    width: 240px;
    min-width: 240px;
    background: #2b2d31;
    overflow-y: auto;
    padding: 12px 8px;
    border-left: 1px solid #1e1f22;
}
.members-section-header {
    color: #949ba4;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 16px 8px 4px;
    letter-spacing: 0.02em;
}
.members-section-header:first-child { padding-top: 4px; }
.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    color: #dbdee1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.member-item:hover { background: #35373c; }
.member-offline { opacity: 0.5; }
.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.member-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #5865f2;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}
.member-name {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== ONLINE FRIENDS SECTION (Welcome screen) ===== */
.online-friends-section {
    margin: 20px 0;
    text-align: left;
    width: 100%;
    max-width: 600px;
}
.online-friends-section h3 {
    color: #b5bac1;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.online-friends-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.online-friend-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #2b2d31;
    border-radius: 8px;
    color: #dbdee1;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}
.online-friend-card:hover { background: #35373c; }
.online-friend-card .friend-avatar {
    width: 28px;
    height: 28px;
    font-size: 13px;
}
.online-friend-card .presence-dot {
    border-color: #2b2d31;
}

/* ── Reply bar (above input) ─────────────────── */
.reply-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #2b2d31;
    border-left: 3px solid #5865f2;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 13px;
    color: #b5bac1;
}
.reply-bar.hidden { display: none; }
.reply-bar-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reply-bar-text strong { color: #f2f3f5; }
.reply-bar-cancel {
    background: none;
    border: none;
    color: #949ba4;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.reply-bar-cancel:hover { color: #f2f3f5; }

/* ── Reply reference block (in message) ──────── */
.message-reply-ref {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-bottom: 2px;
    border-left: 2px solid #5865f2;
    border-radius: 2px;
    background: rgba(88, 101, 242, 0.06);
    font-size: 12px;
    color: #949ba4;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.message-reply-ref:hover { background: rgba(88, 101, 242, 0.12); }
.reply-ref-author {
    color: #5865f2;
    font-weight: 600;
    flex-shrink: 0;
}
.reply-ref-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Message highlight flash ─────────────────── */
@keyframes msg-highlight {
    0%   { background: rgba(88, 101, 242, 0.3); }
    100% { background: transparent; }
}
.message-highlight {
    animation: msg-highlight 1.5s ease;
}

/* ── VC Stats cards ──────────────────────────── */
.vc-stat-card {
    background: #1e1f22;
    border-radius: 8px;
    padding: 16px 24px;
    text-align: center;
    min-width: 120px;
}
.vc-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #5865f2;
}
.vc-stat-label {
    font-size: 12px;
    color: #949ba4;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Feature Request status badges ──────────── */
.feature-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.feature-status-badge.status-pending {
    background: rgba(240, 178, 50, 0.15);
    color: #f0b232;
}
.feature-status-badge.status-reviewed {
    background: rgba(88, 101, 242, 0.15);
    color: #5865f2;
}
.feature-status-badge.status-planned {
    background: rgba(59, 165, 92, 0.15);
    color: #3ba55c;
}
.feature-status-badge.status-done {
    background: rgba(59, 165, 92, 0.25);
    color: #3ba55c;
}
.feature-status-badge.status-dismissed {
    background: rgba(148, 155, 164, 0.15);
    color: #949ba4;
}

/* ── Support Ticket status badges ──────────── */
.ticket-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.ticket-status-badge.status-open {
    background: rgba(88, 101, 242, 0.15);
    color: #5865f2;
}
.ticket-status-badge.status-inprogress {
    background: rgba(240, 178, 50, 0.15);
    color: #f0b232;
}
.ticket-status-badge.status-resolved {
    background: rgba(59, 165, 92, 0.25);
    color: #3ba55c;
}
.ticket-status-badge.status-closed {
    background: rgba(148, 155, 164, 0.15);
    color: #949ba4;
}

/* ── Voice bar (persistent voice indicator in sidebar) ───────────── */
.voice-bar {
    margin: 4px 8px 0;
    padding: 8px 10px;
    background: rgba(59, 165, 92, 0.12);
    border: 1px solid rgba(59, 165, 92, 0.25);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.voice-bar.hidden { display: none; }
.voice-bar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.voice-bar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ba55c;
    flex-shrink: 0;
    animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.voice-bar-status {
    font-size: 0.7rem;
    color: #3ba55c;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.voice-bar-channel {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}
.voice-bar-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.voice-bar-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 2px 5px;
    border-radius: 4px;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.voice-bar-btn:hover { color: var(--text-primary); background: var(--hover); }
.voice-bar-leave-btn:hover { color: #f04747; background: rgba(240, 71, 71, 0.1); }

/* Text channel view when browsing from voice channel */
#text-channel-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
#text-channel-view.hidden { display: none; }

/* ===== TORVEX GOLD ===== */
.gold-page-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.gold-hero {
    text-align: center;
    padding: 32px 0 8px;
}
.gold-hero-icon { font-size: 48px; }
.gold-hero-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #ffd700, #ffaa00, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.gold-hero-subtitle { color: #b5b5c3; font-size: 15px; margin-top: 4px; }

.gold-perks {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #2b2d31;
    border-radius: 12px;
    padding: 20px;
}
.gold-perk {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.gold-perk-icon { font-size: 24px; flex-shrink: 0; }
.gold-perk p { color: #b5b5c3; font-size: 13px; margin-top: 2px; }

.gold-status-card {
    background: #2b2d31;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.gold-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.gold-status-label { color: #b5b5c3; font-size: 14px; }
.gold-status-value { font-size: 14px; }
.gold-status-badge {
    font-size: 13px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
}
.gold-status-badge--active { background: rgba(255, 215, 0, 0.15); color: #ffd700; }
.gold-status-badge--cancelled { background: rgba(240, 71, 71, 0.15); color: #f04747; }

.gold-not-subscribed { color: #b5b5c3; text-align: center; }
.gold-subscribe-btn { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; }
.gold-cancel-btn { align-self: flex-start; }
.gold-cancel-note { font-size: 12px; color: #b5b5c3; }

.gold-banner {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
}
.gold-banner--success { background: rgba(67, 181, 129, 0.15); color: #43b581; border: 1px solid rgba(67, 181, 129, 0.3); }
.gold-banner--warn { background: rgba(240, 178, 71, 0.15); color: #f0b247; border: 1px solid rgba(240, 178, 71, 0.3); }

/* Gold badge in chat messages */
.gold-badge {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
    flex-shrink: 0;
    title: "Torvex Gold";
}

/* Animated gold avatar border */
@keyframes gold-rotate {
    from { --gold-angle: 0deg; }
    to   { --gold-angle: 360deg; }
}
@property --gold-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
.gold-avatar-border {
    padding: 2px;
    border-radius: 50%;
    background: conic-gradient(from var(--gold-angle), #ffd700, #ffaa00, #ffe066, #ffd700);
    animation: gold-rotate 3s linear infinite;
}
.gold-avatar-border img {
    display: block;
    border-radius: 50%;
}

/* ── Message Attachments ───────────────────────────────────────────── */
.attachment-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #2f3136;
    border-radius: 6px;
    margin: 0 8px 4px;
}
.attachment-preview-img {
    max-height: 80px;
    max-width: 120px;
    border-radius: 4px;
    object-fit: cover;
}
.attachment-audio-icon { font-size: 13px; color: #b5b5c3; flex: 1; }
.attachment-uploading  { font-size: 13px; color: #b5b5c3; }
.attachment-error      { font-size: 13px; color: #f04747; }
.attachment-dismiss {
    background: none;
    border: none;
    color: #b5b5c3;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}
.attachment-dismiss:hover { background: #40444b; color: #fff; }

.msg-attachment-img {
    display: block;
    max-width: 400px;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 6px;
    cursor: pointer;
    object-fit: contain;
}
.msg-attachment-audio {
    display: block;
    width: 100%;
    max-width: 400px;
    margin-top: 6px;
}

/* Drag-and-drop highlight */
.message-input-area.drag-over {
    outline: 2px dashed #7289da;
    outline-offset: -4px;
}
