/* ===== DotEcho — Dark Gray / Dark Orange Theme ===== */
:root {
    --bg-primary:    #2c2c2c;
    --bg-secondary:  #252525;
    --bg-tertiary:   #1a1a1a;
    --bg-accent:     #1f1f1f;
    --text-normal:   #e8e0d8;
    --text-muted:    #8a8078;
    --text-link:     #e07840;
    --text-positive: #6abf6a;
    --interactive-normal: #c8bfb5;
    --interactive-hover:  #e8e0d8;
    --brand:         #d4641a;
    --brand-hover:   #b8521a;
    --danger:        #d94040;
    --status-online: #6abf6a;
    --status-idle:   #d4a04a;
    --status-dnd:    #d94040;
    --status-offline:#8a8078;
    --channel-icon:  #8a8078;
    --border-radius: 6px;
    --border-radius-lg: 12px;
    --shadow-low:  0 1px 3px rgba(0,0,0,.35);
    --shadow-med:  0 4px 12px rgba(0,0,0,.50);
    --shadow-high: 0 8px 32px rgba(0,0,0,.65);
}

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

html, body, #app {
    height: 100%;
    width: 100%;
    font-family: 'Inter', Whitney, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-normal);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== AUTH PAGES ===== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-tertiary);
    padding: 16px;
}

.auth-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 36px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-high);
}

.auth-card .logo {
    text-align: center;
    margin-bottom: 20px;
}

.auth-card .logo span {
    font-size: 28px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -1px;
}

.auth-card h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--interactive-normal);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--border-radius);
    color: var(--text-normal);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(88,101,242,.25);
}

.btn-brand {
    width: 100%;
    padding: 10px;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .1s;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(88,101,242,.35);
    letter-spacing: .01em;
}

.btn-brand:hover {
    background: var(--brand-hover);
    box-shadow: 0 4px 14px rgba(88,101,242,.5);
    transform: translateY(-1px);
}
.btn-brand:active { transform: translateY(0); }
.btn-brand:disabled { opacity: .6; cursor: default; box-shadow: none; transform: none; }

.auth-footer {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.auth-footer a { color: var(--brand); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

.error-msg {
    background: rgba(237,66,69,.15);
    border: 1px solid var(--danger);
    border-radius: var(--border-radius);
    color: var(--danger);
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 14px;
}

/* ===== MAIN LAYOUT ===== */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Server list sidebar */
.server-sidebar {
    width: 72px;
    min-width: 72px;
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.server-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: var(--interactive-normal);
    transition: border-radius .2s cubic-bezier(.35,0,.25,1), background .15s, color .15s, box-shadow .15s;
    flex-shrink: 0;
    user-select: none;
    position: relative;
    text-decoration: none;
}

.server-icon::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 4px;
    height: 8px;
    border-radius: 0 4px 4px 0;
    background: #fff;
    transition: height .2s, transform .2s;
}

.server-icon:hover::before {
    height: 20px;
    transform: translateY(-50%) scaleY(1);
}

.server-icon.active::before {
    height: 40px;
    transform: translateY(-50%) scaleY(1);
}

.server-icon:hover,
.server-icon.active {
    border-radius: 30%;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 12px rgba(88,101,242,.35);
}

.server-icon.add-server {
    background: var(--bg-secondary);
    color: var(--text-positive);
    font-size: 22px;
}

.server-icon.add-server:hover {
    background: var(--text-positive);
    color: #fff;
    border-radius: 30%;
}

.server-divider {
    width: 32px;
    height: 2px;
    background: var(--bg-accent);
    border-radius: 1px;
    flex-shrink: 0;
}

/* Channel + content area */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Channel list sidebar */
.channel-sidebar {
    width: 270px;
    min-width: 270px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
}

.channel-sidebar-header {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    flex-shrink: 0;
}

.channel-sidebar-header .server-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channels-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.channel-category {
    padding: 16px 8px 4px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--channel-icon);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.channel-category:hover { color: var(--interactive-hover); }

.channel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 12px;
    border-radius: 6px;
    margin: 1px 8px;
    cursor: pointer;
    color: var(--channel-icon);
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background .1s, color .1s;
}

.channel-item:hover {
    background: rgba(255,255,255,.06);
    color: var(--interactive-hover);
}

.channel-item.active {
    background: rgba(255,255,255,.10);
    color: #fff;
    font-weight: 600;
}

.channel-icon-hash {
    font-size: 18px;
    font-weight: 400;
    color: inherit;
    flex-shrink: 0;
    line-height: 1;
}

.channel-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User panel at bottom of channel sidebar */
.user-panel {
    background: var(--bg-accent);
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-accent);
}

.status-online  { background: var(--status-online); }
.status-idle    { background: var(--status-idle); }
.status-dnd     { background: var(--status-dnd); }
.status-offline { background: var(--status-offline); }

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-info .username {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .user-status {
    font-size: 11px;
    color: var(--text-muted);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--interactive-normal);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--border-radius);
    font-size: 18px;
    line-height: 1;
    transition: color .1s;
}

.icon-btn:hover { color: var(--interactive-hover); }

/* ===== CHAT AREA ===== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    position: relative; /* anchors absolute picker popups */
}

.chat-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(0,0,0,.3);
    flex-shrink: 0;
    background: var(--bg-primary);
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    z-index: 1;
}

.chat-header .channel-hash {
    font-size: 22px;
    color: var(--channel-icon);
}

.chat-header .channel-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.chat-header .channel-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 8px;
    border-left: 1px solid var(--bg-tertiary);
    padding-left: 12px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
}

.messages-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0;
}

.message-group {
    padding: 2px 16px 2px 72px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.message-group {
    animation: msgFadeIn .15s ease;
}

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

.message-group:hover { background: rgba(255,255,255,.03); }

.message-group.first-in-group {
    margin-top: 16px;
    padding-top: 2px;
}

.message-avatar {
    position: absolute;
    left: 16px;
    top: 2px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

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

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

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

.message-timestamp {
    font-size: 11px;
    color: var(--text-muted);
}

.message-content {
    font-size: 15px;
    line-height: 1.4;
    color: var(--text-normal);
    word-break: break-word;
    white-space: pre-wrap;
}

.message-edited-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 4px;
}

.message-actions {
    display: none;
    position: absolute;
    right: 16px;
    top: 0;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 8px;
    padding: 2px 4px;
    gap: 2px;
    box-shadow: var(--shadow-med);
}

.message-group:hover .message-actions { display: flex; }

.msg-action-btn {
    background: none;
    border: none;
    color: var(--interactive-normal);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--border-radius);
    font-size: 14px;
}

.msg-action-btn:hover { color: var(--interactive-hover); background: var(--bg-accent); }
.msg-action-btn.danger:hover { color: var(--danger); }

/* Chat input */
.chat-input-container {
    padding: 0 16px 24px 16px;
    flex-shrink: 0;
    position: relative;
}

.chat-input-box {
    background: var(--bg-accent);
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 10px;
    display: flex;
    align-items: flex-end;
    padding: 0 16px;
    gap: 8px;
    transition: border-color .15s, box-shadow .15s;
}

.chat-input-box:focus-within {
    border-color: rgba(88,101,242,.4);
    box-shadow: 0 0 0 2px rgba(88,101,242,.12);
}

.chat-input-box textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-normal);
    font-size: 15px;
    line-height: 1.375;
    padding: 11px 0;
    max-height: 200px;
    resize: none;
    font-family: inherit;
}

.chat-input-box textarea::placeholder { color: var(--text-muted); }

.chat-input-box .send-btn {
    background: none;
    border: none;
    color: var(--interactive-normal);
    cursor: pointer;
    font-size: 22px;
    padding: 8px 0;
    transition: color .15s;
}

.chat-input-box .send-btn:hover { color: var(--brand); }

/* ===== INPUT TOOLBAR BUTTONS (file, GIF, emoji) ===== */
.input-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    padding: 0 6px;
    cursor: pointer;
    border-radius: 4px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
    align-self: flex-end;
    padding-bottom: 10px;
    line-height: 1;
}
.input-action-btn:hover       { color: var(--interactive-hover); background: rgba(255,255,255,.06); }
.input-action-btn:disabled    { opacity: .4; cursor: not-allowed; }
.input-action-btn.attach-btn  { font-size: 22px; font-weight: 300; }
.input-action-btn.gif-btn {
    font-size:  11px;
    font-weight: 700;
    letter-spacing: .5px;
    border: 1.5px solid var(--text-muted);
    border-radius: 4px;
    padding: 2px 5px;
    line-height: 1;
    margin-bottom: 10px;
}
.input-action-btn.gif-btn:hover { border-color: var(--interactive-hover); background: transparent; }

/* ===== PICKER POPUP BASE ===== */
.picker-popup {
    position: absolute;
    bottom: 72px;
    right: 16px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.55);
    z-index: 99;
    overflow: hidden;
    animation: picker-in .12s ease;
}
@keyframes picker-in {
    from { opacity: 0; transform: scale(.95) translateY(6px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);   }
}

/* ===== EMOJI PICKER ===== */
.emoji-picker-popup {
    width: 336px;
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
}
.emoji-picker-popup::-webkit-scrollbar       { width: 5px; }
.emoji-picker-popup::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.picker-category-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 8px 4px 3px;
}
.emoji-grid  { display: flex; flex-wrap: wrap; gap: 1px; }
.emoji-item  {
    font-size: 20px;
    width: 33px;
    height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: background .1s;
    user-select: none;
}
.emoji-item:hover { background: rgba(255,255,255,.08); }

/* ===== GIF PICKER ===== */
.gif-picker-popup {
    width: 352px;
    max-height: 480px;
    display: flex;
    flex-direction: column;
}
/* Header row: GIPHY logo + search */
.gif-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.gif-search-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 4px;
    color: var(--text-normal);
    padding: 5px 10px;
    font-size: 13px;
    min-width: 0;
}
.gif-search-input:focus { outline: none; border-color: var(--brand); }
/* Category chips */
.gif-cats {
    display: flex;
    gap: 5px;
    padding: 6px 8px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.gif-cats::-webkit-scrollbar { display: none; }
.gif-cat-chip {
    white-space: nowrap;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-accent);
    border: 1px solid rgba(255,255,255,.08);
    color: var(--text-normal);
    cursor: pointer;
    transition: background .1s, border-color .1s;
    flex-shrink: 0;
}
.gif-cat-chip:hover { background: var(--bg-modifier-hover); border-color: rgba(255,255,255,.18); }
.gif-cat-chip.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
/* Results grid */
.gif-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 6px 8px;
    overflow-y: auto;
    flex: 1;
}
.gif-grid::-webkit-scrollbar       { width: 5px; }
.gif-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.gif-thumb {
    width: 100%;
    height: 105px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    display: block;
    background: var(--bg-tertiary);
}
.gif-thumb:hover { opacity: .85; transform: scale(1.025); }
.gif-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
    font-size: 13px;
    flex: 1;
}
/* Attribution */
.gif-attribution {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 5px 10px;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

/* ===== PENDING ATTACHMENT PREVIEW ===== */
.attachment-preview {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 16px 0;
    flex-shrink: 0;
}
.attachment-preview-img   { max-width: 200px; max-height: 160px; border-radius: 6px; object-fit: contain; }
.attachment-preview-video { max-width: 220px; max-height: 140px; border-radius: 6px; }
.attachment-preview-file  {
    background: var(--bg-accent);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.attachment-remove-btn {
    background: rgba(0,0,0,.45);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: background .15s;
}
.attachment-remove-btn:hover { background: var(--danger); }

/* ===== INLINE MESSAGE ATTACHMENTS ===== */
.msg-attachment-img   {
    max-width: 400px; max-height: 300px; border-radius: 4px;
    display: block; margin-top: 6px;
    cursor: zoom-in;
    transition: opacity .15s;
}
.msg-attachment-img:hover { opacity: .88; }

.msg-video-wrapper    { position: relative; display: inline-block; margin-top: 6px; }
.msg-attachment-video { max-width: 400px; border-radius: 4px; display: block; }

/* Lazy-load video placeholder */
.msg-video-placeholder {
    position: relative;
    max-width: 400px;
    min-width: 200px;
    min-height: 113px;
    background: #111;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.msg-video-thumb {
    max-width: 400px;
    width: 100%;
    display: block;
    border-radius: 4px;
}
.msg-video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.25);
    transition: background .15s;
    border-radius: 4px;
}
.msg-video-placeholder:hover .msg-video-play-overlay { background: rgba(0,0,0,.45); }
.msg-video-placeholder:hover .msg-video-play-btn { transform: scale(1.08); }
.msg-video-play-btn {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s;
    flex-shrink: 0;
}
.msg-video-placeholder .msg-video-duration {
    position: absolute;
    bottom: 6px; right: 8px;
    font-size: 11px;
    color: #fff;
    background: rgba(0,0,0,.6);
    padding: 1px 5px;
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
}
.msg-video-expand-btn {
    position: absolute;
    top: 6px; right: 6px;
    background: rgba(0,0,0,.55);
    border: none;
    color: #fff;
    font-size: 15px;
    width: 28px; height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity .15s;
}
.msg-video-wrapper:hover .msg-video-expand-btn { opacity: 1; }
.msg-attachment-file  {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 4px;
    padding: 8px 12px;
    color: var(--brand);
    text-decoration: none;
    font-size: 13px;
    margin-top: 6px;
    max-width: 360px;
    word-break: break-all;
}
.msg-attachment-file:hover { background: var(--bg-accent); }

/* ===== LIGHTBOX / MEDIA VIEWER ===== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    cursor: zoom-out;
    animation: picker-in .12s ease;
}
.lightbox-img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    cursor: default;
    box-shadow: 0 8px 48px rgba(0,0,0,.7);
}
.lightbox-video {
    max-width: 92vw;
    max-height: 90vh;
    border-radius: 4px;
    cursor: default;
    box-shadow: 0 8px 48px rgba(0,0,0,.7);
}
.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    z-index: 9999;
}
.lightbox-close:hover { background: var(--danger); }

.typing-indicator {
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-muted);
    height: 20px;
    margin-bottom: 4px;
}

/* ===== MEMBER LIST ===== */
.members-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-secondary);
    overflow-y: auto;
    padding: 16px 0;
}

.members-category {
    padding: 16px 8px 4px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--channel-icon);
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 12px;
    border-radius: var(--border-radius);
    margin: 1px 8px;
    cursor: pointer;
}

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

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.member-info .name { font-size: 14px; font-weight: 500; color: var(--text-normal); }
.member-info .role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}
.member-status {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-top: 1px;
}
.member-status-online  { color: var(--status-online); }
.member-status-idle    { color: var(--status-idle); }
.member-status-dnd     { color: var(--status-dnd); }
.member-status-offline { color: var(--text-muted); }
.member-status-voice   { color: var(--brand); text-transform: none; }

/* ── User profile preview lightbox ────────────────────────────── */
.user-preview-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    animation: fadeIn .12s ease;
}
.user-preview-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 32px 28px;
    min-width: 260px;
    max-width: 340px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-high);
    position: relative;
}
.user-preview-bigavatar {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 40px; color: #fff;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.user-preview-bigavatar .status-dot {
    width: 16px; height: 16px;
    bottom: 4px; right: 4px;
    border-width: 3px;
    border-color: var(--bg-secondary);
}
.user-preview-name { font-size: 20px; font-weight: 700; color: #fff; margin-top: 4px; }
.user-preview-role { font-size: 12px; color: var(--text-muted); text-transform: capitalize; }
.user-preview-status { font-size: 13px; display: flex; align-items: center; gap: 5px; }

/* ===== WELCOME / EMPTY STATE ===== */
.welcome-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-muted);
    text-align: center;
    padding: 32px;
}

.welcome-state .big-icon { font-size: 64px; }
.welcome-state h2 { font-size: 24px; color: #fff; }
.welcome-state p { font-size: 16px; max-width: 400px; }

/* ===== RECONNECT OVERLAY ===== */
.reconnect-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.reconnect-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 40px 56px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,.7);
}

.reconnect-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255,255,255,.12);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: reconnect-spin 0.85s linear infinite;
    margin: 0 auto;
}

@keyframes reconnect-spin { to { transform: rotate(360deg); } }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.modal-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.modal-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }

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

.btn-secondary {
    padding: 8px 16px;
    background: none;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-normal);
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover { text-decoration: underline; }

.btn-danger {
    padding: 8px 16px;
    background: var(--danger);
    border: none;
    border-radius: var(--border-radius);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

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

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-accent); }

/* ===== LOADING ===== */
.loading-spin {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Edit message input */
.edit-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 2px solid var(--brand);
    border-radius: var(--border-radius);
    color: var(--text-normal);
    padding: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
}

.edit-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.edit-hint a { color: var(--brand); cursor: pointer; }

/* ===== VOICE CHANNELS ===== */
.voice-channel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 16px;
    border-radius: var(--border-radius);
    margin: 1px 8px;
    cursor: pointer;
    color: var(--channel-icon);
    font-size: 15px;
    transition: background .1s, color .1s;
}

.voice-channel-item:hover { background: var(--bg-accent); color: var(--interactive-hover); }
.voice-channel-item.active { background: rgba(79,84,92,.6); color: #fff; }

.voice-channel-panel {
    background: var(--bg-secondary);
    border-top: 1px solid var(--bg-tertiary);
}

.voice-channel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-normal);
    border-radius: var(--border-radius);
    transition: background .12s;
}
.voice-channel-header.clickable-header {
    cursor: pointer;
}
.voice-channel-header.clickable-header:hover {
    background: var(--bg-modifier-hover);
    color: var(--interactive-hover);
}

/* ===== DM LIST ===== */
.dm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 12px;
    border-radius: var(--border-radius);
    margin: 1px 8px;
    cursor: pointer;
    color: var(--interactive-normal);
    transition: background .1s, color .1s;
}

.dm-item:hover { background: var(--bg-accent); color: var(--interactive-hover); }
.dm-item.active { background: rgba(79,84,92,.6); color: #fff; }

.dm-item .dm-username { font-size: 14px; font-weight: 500; }

/* ===== INVITE BADGE ===== */
.role-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--brand);
    color: #fff;
}

/* ===== UNREAD BADGES ===== */
.server-icon-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    width: 48px;
    flex-shrink: 0;
}

.unread-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ed4245;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border: 2px solid var(--bg-primary);
    box-sizing: border-box;
    line-height: 1;
}

.unread-badge.server-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
}

.unread-badge.channel-badge {
    position: static;
    margin-left: auto;
    flex-shrink: 0;
    border: none;
}

.unread-badge.dm-badge {
    position: static;
    margin-left: auto;
    flex-shrink: 0;
    border: none;
}

/* ===== MENTION POPUP ===== */
.mention-popup {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 8px;
    right: 8px;
    background: var(--bg-floating);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    z-index: 200;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
}

.mention-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    cursor: pointer;
    transition: background .1s;
}
.mention-suggestion:hover { background: var(--bg-modifier-hover); }

.mention-avatar {
    width: 28px; height: 28px; min-width: 28px;
    background: var(--brand);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
}
.mention-name { font-size: 14px; font-weight: 600; color: var(--text-normal); }
.mention-role { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* Inline @mention highlight inside messages */
.mention {
    color: #7289da;
    background: rgba(114,137,218,.15);
    border-radius: 3px;
    padding: 0 3px;
    font-weight: 600;
    cursor: default;
}
.mention:hover { background: rgba(114,137,218,.3); }

/* ===== UPLOAD PROGRESS ===== */
.upload-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 16px 2px;
}

.upload-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-modifier-accent);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 3px;
    transition: width .12s ease;
}

.upload-progress-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
}

/* ===== SETTINGS MODAL ===== */
.sett-overlay {
    position: fixed; inset: 0; z-index: 500; display: flex;
    background: var(--bg-secondary);
}
.sett-sidebar {
    width: 218px; min-width: 180px; flex-shrink: 0;
    background: var(--bg-secondary);
    padding: 60px 8px 80px; overflow-y: auto;
    display: flex; flex-direction: column;
}
.sett-server-name {
    padding: 0 8px 4px; font-size: 15px; font-weight: 700;
    color: var(--text-normal); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.sett-cat-label {
    padding: 16px 8px 4px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted);
}
.sett-nav-item {
    display: block; width: 100%; text-align: left;
    padding: 8px 10px; border-radius: 4px;
    background: none; border: none;
    color: var(--interactive-normal); font-size: 15px;
    cursor: pointer; transition: background .1s, color .1s;
}
.sett-nav-item:hover { background: var(--bg-modifier-hover); color: var(--interactive-hover); }
.sett-nav-item.active { background: var(--bg-modifier-selected); color: #fff; }
.sett-nav-item.danger { color: var(--danger); }
.sett-nav-item.danger:hover { background: rgba(237,66,69,.1); }
.sett-divider { height: 1px; background: var(--bg-modifier-accent); margin: 8px 4px; }
.sett-main { display: flex; flex: 1; overflow: hidden; }
.sett-content {
    flex: 1; background: var(--bg-primary);
    padding: 60px 40px 80px; overflow-y: auto;
    max-width: 740px; min-width: 0;
}
.sett-close-col {
    width: 80px; padding: 60px 16px 0; display: flex;
    flex-direction: column; align-items: center; gap: 6px;
    background: var(--bg-primary); flex-shrink: 0;
}
.sett-heading {
    font-size: 20px; font-weight: 700; color: var(--text-normal);
    margin-bottom: 16px; margin-top: 0;
}
.sett-divider-h { height: 1px; background: var(--bg-modifier-accent); margin: 16px 0; }
.sett-actions { margin-top: 20px; }
.sett-section-label {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted); margin-bottom: 8px;
}
.sett-select {
    width: 100%; padding: 8px 10px; background: var(--bg-tertiary);
    border: 1px solid rgba(0,0,0,.3); border-radius: 4px;
    color: var(--text-normal); font-size: 14px; outline: none; margin-bottom: 4px;
}
.sett-range { width: 100%; accent-color: var(--brand); }
.sett-search {
    width: 100%; padding: 8px 10px; background: var(--bg-tertiary);
    border: 1px solid rgba(0,0,0,.3); border-radius: 4px;
    color: var(--text-normal); font-size: 14px; outline: none; margin-bottom: 12px;
}
/* Close button */
.sett-close-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-tertiary); border: none;
    color: var(--interactive-normal); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.sett-close-btn:hover { background: var(--bg-accent); color: var(--text-normal); }
.sett-close-hint { font-size: 11px; color: var(--text-muted); letter-spacing: .05em; }
/* Toggle switch */
.toggle-switch {
    position: relative; display: inline-block;
    width: 42px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; background: var(--bg-modifier-accent);
    border-radius: 24px; cursor: pointer; transition: .2s;
}
.toggle-slider::before {
    content: ''; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--brand); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
/* Toggle row */
.sett-toggle-row {
    display: flex; align-items: flex-start; gap: 16px; padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.sett-toggle-title { font-size: 15px; font-weight: 600; color: var(--text-normal); }
.sett-toggle-desc { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
/* Level meter */
.input-level-wrap { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sett-label-small { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.level-bar-bg {
    flex: 1; height: 8px; background: var(--bg-modifier-accent);
    border-radius: 4px; overflow: hidden;
}
.level-bar-fill {
    height: 100%; border-radius: 4px;
    transition: width .08s linear; background: var(--brand);
}
.level-bar-fill.level-med  { background: #faa61a; }
.level-bar-fill.level-high { background: var(--danger); }
.btn-mic-test {
    display: inline-flex; align-items: center; padding: 3px 9px;
    font-size: 12px; border-radius: 4px; border: 1px solid var(--interactive-muted);
    background: var(--bg-tertiary); color: var(--text-muted);
    cursor: pointer; transition: background .12s, color .12s, border-color .12s;
    white-space: nowrap;
}
.btn-mic-test:hover { background: var(--bg-modifier-hover); color: var(--text-normal); border-color: var(--interactive-normal); }
.btn-mic-test.active { background: var(--brand); color: #fff; border-color: transparent; }
.btn-mic-test.active:hover { background: var(--brand-560); }
/* Account card */
.account-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-tertiary); border-radius: 8px;
    padding: 16px; margin-bottom: 20px;
}
.account-avatar {
    width: 56px; height: 56px; min-width: 56px;
    background: var(--brand); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: #fff;
}
.account-username { font-size: 18px; font-weight: 700; color: var(--text-normal); }
/* Members table */
.members-table { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.members-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 4px; transition: background .1s;
}
.members-row:hover { background: var(--bg-accent); }
.members-name {
    font-size: 14px; font-weight: 600; color: var(--text-normal);
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.members-meta { font-size: 12px; color: var(--text-muted); }
.role-chip {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 1px 6px; border-radius: 10px;
    font-size: 11px; font-weight: 700;
}
.role-chip.owner { background: rgba(250,166,26,.15); color: #faa61a; }
.role-chip.admin { background: rgba(88,101,242,.15); color: var(--brand); }
.role-select {
    background: var(--bg-tertiary); border: 1px solid rgba(0,0,0,.3);
    border-radius: 4px; color: var(--text-normal);
    font-size: 12px; padding: 3px 6px; cursor: pointer;
}
/* Danger zone */
.danger-card {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; background: var(--bg-tertiary);
    border: 1px solid rgba(237,66,69,.3); border-radius: 8px; padding: 16px;
}
/* Misc */
.success-msg { color: #43b581; font-size: 13px; margin-top: 8px; }
.cat-add-btn {
    display: inline-flex; align-items: center; cursor: pointer;
    color: var(--interactive-normal); margin-left: auto; padding: 2px 4px; border-radius: 3px;
}
.cat-add-btn:hover { color: var(--interactive-hover); background: var(--bg-modifier-hover); }

/* ===== LINK PREVIEW ===== */
.lp-wrap {
    margin-top: 8px;
    border-radius: 4px;
    max-width: 480px;
    border-left: 4px solid var(--bg-modifier-accent);
}
.lp-wrap.lp-youtube { border-left-color: #ff0000; }
.lp-wrap.lp-spotify { border-left-color: #1db954; }
.lp-wrap.lp-tidal   { border-left-color: #00ffff; }

/* YouTube thumbnail card */
.lp-yt-card {
    background: var(--bg-tertiary);
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.lp-yt-card:hover { background: var(--bg-accent); }
.lp-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.lp-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.lp-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .25);
    transition: background .15s;
}
.lp-yt-card:hover .lp-play-overlay { background: rgba(0, 0, 0, .42); }
.lp-play-btn {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: rgba(220, 0, 0, .9);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,.5);
    transition: transform .12s;
}
.lp-yt-card:hover .lp-play-btn { transform: scale(1.08); }
.lp-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    background: var(--bg-tertiary);
    font-size: 12px;
}
.lp-host { font-weight: 700; color: var(--text-normal); }
.lp-hint { color: var(--text-muted); font-size: 11px; margin-left: auto; }

/* YouTube iframe player */
.lp-video-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}
.lp-video-wrap iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: none;
}

/* Spotify / Tidal frames */
.lp-spotify-frame,
.lp-tidal-frame {
    display: block;
    border: none;
    border-radius: 0;
    background: var(--bg-tertiary);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: var(--shadow-high);
    color: var(--text-normal);
    font-size: 14px;
    font-weight: 500;
    min-width: 240px;
    max-width: 380px;
    pointer-events: all;
}

.toast-enter { animation: toastIn .25s cubic-bezier(.21,1.02,.73,1) forwards; }
.toast-exit  { animation: toastOut .3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px) scale(.9); }
    to   { opacity: 1; transform: translateX(0)   scale(1);   }
}
@keyframes toastOut {
    to   { opacity: 0; transform: translateX(60px) scale(.9); }
}

.toast-success { border-left: 3px solid var(--text-positive); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--status-idle); }
.toast-info    { border-left: 3px solid var(--brand); }

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.toast-success .toast-icon { color: var(--text-positive); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--status-idle); }
.toast-info    .toast-icon { color: var(--brand); }

.toast-text { flex: 1; }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.toast-close:hover { color: var(--interactive-hover); background: rgba(255,255,255,.07); }

/* ===== SCROLL-TO-BOTTOM BUTTON ===== */
.scroll-down-btn {
    position: absolute;
    bottom: 88px;
    right: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,.10);
    color: var(--interactive-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-med);
    transition: background .15s, color .15s, transform .15s;
    z-index: 10;
    animation: fadeScaleIn .18s ease;
}
.scroll-down-btn:hover { background: var(--bg-tertiary); color: #fff; transform: scale(1.1); }

@keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(.7); }
    to   { opacity: 1; transform: scale(1); }
}

/* ===== VOICE CONNECTED BAR (above user panel) ===== */
.voice-connected-bar {
    background: rgba(35, 165, 89, .10);
    border-top: 1px solid rgba(35,165,89,.25);
    padding: 8px 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.vcb-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 2px;
}

.vcb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-online);
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(35,165,89,.3);
}

.vcb-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.vcb-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-positive);
    line-height: 1.2;
}

.vcb-channel {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vcb-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 2px;
}

.vcb-btn {
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--interactive-normal);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s;
    flex-shrink: 0;
}
.vcb-btn:hover   { background: rgba(255,255,255,.08); color: var(--interactive-hover); }
.vcb-btn-active  { color: var(--brand) !important; background: rgba(88,101,242,.15) !important; }
.vcb-btn-danger  { color: var(--danger) !important; }
.vcb-btn-danger:hover { background: rgba(237,66,69,.15) !important; }
.vcb-btn-leave   { color: var(--danger); margin-left: auto; }
.vcb-btn-leave:hover { background: rgba(237,66,69,.15); }

/* ===== REMOTE VIDEO GRID ===== */
.remote-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
    padding: 6px 0;
}

.remote-video-tile {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
}

.remote-video-inner {
    width: 100%;
    height: 100%;
}

.remote-video-label {
    position: absolute;
    bottom: 6px;
    left: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: rgba(0,0,0,.55);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}

/* ===== LOCAL SHARE PREVIEW ===== */
.local-share-preview {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    aspect-ratio: 16/9;
    margin: 4px 0;
    border: 1.5px solid var(--brand);
}

.local-share-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.local-share-label {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: .02em;
}

/* ===== SHARE SETTINGS MODAL ===== */
.share-settings-modal {
    max-width: 380px;
}

.share-select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--border-radius);
    color: var(--text-normal);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
}
.share-select:focus { border-color: var(--brand); }

.share-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-normal);
}

.share-toggle-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
}

/* ── hidden on desktop, shown via media query ── */
.mobile-header   { display: none; }
.mobile-menu-btn { display: none; }

/* ===== CHAT COLUMN (VideoStage + chat area stacked) ===== */
.chat-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ===== VIDEO STAGE ===== */
.video-stage {
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    max-height: 42vh;
    overflow: hidden;
    transition: max-height .2s ease;
}
.video-stage--collapsed {
    max-height: 40px;
}

.vs-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border-bottom: 1px solid rgba(0,0,0,.2);
}

.vs-header-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: .04em;
    flex: 1;
}

.vs-collapse-btn {
    margin-left: auto;
    flex-shrink: 0;
}

.vs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    padding: 8px 12px;
    overflow-y: auto;
}

/* ── Individual video tile ── */
.vs-tile {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
    display: flex;
    flex-direction: column;
    border: 1.5px solid rgba(255,255,255,.06);
}
.vs-tile--local {
    border-color: var(--brand);
}

.vs-video-container {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #111;
}
.vs-video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.vs-local-video {
    flex: 1;
    width: 100%;
    object-fit: contain;
    display: block;
    background: #111;
}

/* ── Tile bottom bar ── */
.vs-tile-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    padding: 5px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    gap: 6px;
}
.vs-tile-name {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vs-btn {
    background: rgba(255,255,255,.12);
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    padding: 3px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
    flex-shrink: 0;
}
.vs-btn:hover { background: rgba(255,255,255,.25); }

/* ===================================================================
   MOBILE RESPONSIVE  (≤ 768 px)
   =================================================================== */
@media (max-width: 768px) {

    /* ── Prevent overflow flash when nav slides in ── */
    .app-shell { overflow: hidden; }

    /* ── Left nav slides in from the left as a fixed overlay ── */
    .server-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100vw);
        transition: transform .25s cubic-bezier(.4,0,.2,1);
        z-index: 401;
        will-change: transform;
    }
    .channel-sidebar {
        position: fixed;
        top: 0; left: 72px; bottom: 0;
        width: 270px; min-width: 270px;
        transform: translateX(-100vw);
        transition: transform .25s cubic-bezier(.4,0,.2,1);
        z-index: 400;
        will-change: transform;
    }
    .app-shell.mobile-nav-open .server-sidebar,
    .app-shell.mobile-nav-open .channel-sidebar {
        transform: translateX(0);
        box-shadow: 6px 0 28px rgba(0,0,0,.7);
    }

    /* ── Semi-transparent backdrop behind nav ── */
    .mobile-nav-backdrop {
        position: fixed; inset: 0;
        z-index: 399;
        background: rgba(0,0,0,.72);
        animation: mbBackdropIn .2s ease;
    }
    @keyframes mbBackdropIn { from { opacity: 0; } to { opacity: 1; } }

    /* ── Members sidebar hidden (too narrow) ── */
    .members-sidebar { display: none !important; }

    /* ── Mobile header bar ── */
    .mobile-header {
        display: flex;
        align-items: center;
        height: 48px;
        min-height: 48px;
        padding: 0 12px;
        gap: 10px;
        background: var(--bg-primary);
        border-bottom: 1px solid rgba(0,0,0,.3);
        flex-shrink: 0;
        z-index: 5;
    }
    .mobile-header-title {
        font-size: 15px;
        font-weight: 700;
        color: #fff;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--interactive-normal);
        cursor: pointer;
        padding: 6px;
        border-radius: var(--border-radius);
        flex-shrink: 0;
    }
    .mobile-menu-btn:active { color: var(--interactive-hover); }

    /* ── Chat input ── */
    .chat-input-container { padding: 0 8px 16px; }
    .chat-header .channel-desc { display: none; } /* too cramped */

    /* ── Message layout – tighten left padding ── */
    .message-group          { padding: 2px 8px 2px 52px; }
    .message-group.first-in-group { margin-top: 12px; }
    .message-avatar         { left: 8px; width: 36px; height: 36px; font-size: 14px; }
    /* Always show message actions (no hover on touch screens) */
    .message-actions {
        display: flex;
        position: static;
        background: none;
        border: none;
        box-shadow: none;
        padding: 2px 0 0;
        margin-left: -4px;
    }

    /* ── Touch-friendly tap targets ── */
    .channel-item, .dm-item, .voice-channel-item { min-height: 44px; }
    .server-icon { touch-action: manipulation; }
    .channel-item, .dm-item { touch-action: manipulation; }

    /* ── Smooth momentum scrolling on iOS ── */
    .messages-container,
    .channels-list,
    .gif-grid {
        -webkit-overflow-scrolling: touch;
    }

    /* ── Modals: full-width ── */
    .modal-card {
        max-width: calc(100vw - 24px);
        margin: 0;
        padding: 20px 16px;
    }

    /* ── Pickers: bottom sheet ── */
    .picker-popup {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        border-radius: 14px 14px 0 0;
        width: 100%;
        max-width: 100%;
        animation: pickerSheetIn .2s ease;
    }
    @keyframes pickerSheetIn {
        from { transform: translateY(30px); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }
    .emoji-picker-popup {
        width: 100%;
        max-height: 55vh;
        border-radius: 14px 14px 0 0;
    }
    .gif-picker-popup {
        width: 100%;
        max-height: 65vh;
        border-radius: 14px 14px 0 0;
    }

    /* ── Settings modal → horizontal pill tabs at top ── */
    .sett-overlay { flex-direction: column; overflow-y: auto; }
    .sett-sidebar {
        width: 100%; min-width: unset; flex-shrink: 0;
        padding: 12px 8px 8px;
        flex-direction: row; flex-wrap: wrap; gap: 4px;
        overflow-y: unset; overflow-x: auto;
    }
    .sett-server-name { display: none; }
    .sett-cat-label   { display: none; }
    .sett-divider     { display: none; }
    .sett-nav-item {
        width: auto; display: inline-block;
        padding: 5px 14px; font-size: 13px;
        border-radius: 16px;
        background: var(--bg-tertiary);
        border: 1px solid rgba(255,255,255,.06);
    }
    .sett-nav-item.active { background: var(--brand); color: #fff; border-color: transparent; }
    .sett-main { flex-direction: column; overflow: unset; flex: unset; }
    .sett-content { padding: 16px 14px 60px; max-width: 100%; }
    .sett-close-col {
        position: fixed; top: 0; right: 0;
        width: auto; padding: 8px 12px;
        flex-direction: row; background: transparent; z-index: 10;
    }
    .sett-close-hint { display: none; }

    /* ── Voice controls bar wraps on very small screens ── */
    .vcb-actions { flex-wrap: wrap; }

    /* ── Toasts left-aligned on phone ── */
    .toast-container {
        top: auto; bottom: 16px;
        right: 8px; left: 8px;
    }
    .toast { min-width: unset; max-width: 100%; }

    /* ── Auth pages already responsive, just reduce padding ── */
    .auth-card { padding: 24px 18px; border-radius: 12px; }

    /* ── Message attachments fit the screen ── */
    .msg-attachment-img,
    .msg-video-placeholder,
    .msg-attachment-video { max-width: 100%; }
}
