:root {
    --bg-primary: #1e1f22;
    --bg-secondary: #2b2d31;
    --bg-tertiary: #313338;
    --bg-hover: #3f4147;
    --text-primary: #f2f3f5;
    --text-secondary: #b5bac1;
    --text-muted: #949ba4;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --success: #23a559;
    --danger: #da373c;
    --warning: #f0b232;
    --border: #3f4147;
    --shadow: rgba(0,0,0,0.3);
    --online: #23a559;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f2f3f5;
    --bg-tertiary: #e3e5e8;
    --bg-hover: #d4d7dc;
    --text-primary: #060607;
    --text-secondary: #4e5058;
    --text-muted: #6d6f78;
    --border: #d4d7dc;
    --shadow: rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

html.chat-page,
body.chat-page {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Auth */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}

.auth-container { width: 100%; max-width: 420px; padding: 1rem; }

.auth-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px var(--shadow);
}

.auth-card h1 { text-align: center; margin-bottom: 0.5rem; font-size: 1.5rem; }
.auth-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 1.5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-secondary); font-size: 0.9rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-success { background: var(--success); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-icon { background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 0.3rem; border-radius: 6px; }
.btn-icon:hover { background: var(--bg-hover); }
.btn-icon.active { background: rgba(218,55,60,0.2); border-radius: 6px; }

.profile-icon {
    color: #39FF14;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-shadow: none;
    box-shadow: none;
    filter: none;
}
.profile-icon:hover,
.profile-icon:focus {
    color: #32E612;
    background: var(--bg-hover);
    text-shadow: none;
    box-shadow: none;
    filter: none;
}
.profile-icon svg { display: block; }

.profile-menu-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.profile-menu-link .profile-icon-svg {
    color: #39FF14;
    flex-shrink: 0;
    text-shadow: none;
    filter: none;
}

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: rgba(218,55,60,0.15); color: var(--danger); border: 1px solid var(--danger); }
.alert-success { background: rgba(35,165,89,0.15); color: var(--success); border: 1px solid var(--success); }

/* Chat Layout */
.chat-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h2 { font-size: 1.1rem; }
.sidebar-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.sidebar-header-title h2 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-actions { display: flex; gap: 0.25rem; align-items: center; }
.sidebar-close {
    display: none;
    color: #39FF14;
    text-shadow: none;
    box-shadow: none;
    filter: none;
}
.sidebar-close:hover,
.sidebar-close:focus {
    color: #32E612;
    text-shadow: none;
    box-shadow: none;
    filter: none;
}

.sidebar-overlay {
    display: none;
}

.sidebar-mobile-actions {
    display: none;
    padding: 1rem;
    border-top: 1px solid var(--border);
    gap: 0.5rem;
    flex-direction: column;
}

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

.online-menu-bar {
    display: none;
    width: 100%;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    flex-shrink: 0;
    transition: background 0.2s;
}

.online-menu-bar:active {
    background: var(--bg-hover);
}

.online-menu-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--online);
    box-shadow: 0 0 0 3px rgba(35, 165, 89, 0.25);
    flex-shrink: 0;
    animation: onlineDotPulse 2s ease-in-out infinite;
}

@keyframes onlineDotPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(35, 165, 89, 0.25); }
    50% { box-shadow: 0 0 0 6px rgba(35, 165, 89, 0.12); }
}

.online-menu-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 0.1rem;
}

.online-menu-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.online-menu-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.online-menu-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.5rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 999px;
    flex-shrink: 0;
}

.online-menu-chevron {
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    flex-shrink: 0;
}

.mobile-online-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    vertical-align: middle;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.chat-header-left h1 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.online-section {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    min-height: 0;
}

.online-list { list-style: none; }
.online-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
}
.online-list li:hover { background: var(--bg-hover); }
.online-dot { color: var(--online); font-size: 0.6rem; }

.current-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* Messages */
.messages-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    animation: fadeIn 0.3s ease;
}
.message:hover { background: var(--bg-secondary); }

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

.message-avatar { flex-shrink: 0; }
.avatar-small, .avatar-tiny {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
}
.avatar-tiny { width: 24px; height: 24px; vertical-align: middle; margin-right: 0.25rem; }
.avatar-placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 700; font-size: 0.9rem;
}
.avatar-placeholder.large { width: 80px; height: 80px; font-size: 2rem; }

.message-body { flex: 1; min-width: 0; }
.message-header { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.15rem; flex-wrap: wrap; }
.message-author { font-weight: 700; font-size: 0.9rem; }
.message-time { font-size: 0.7rem; color: var(--text-muted); flex: 1; }
.message-delete {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.55;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    line-height: 1;
}
.message-delete:hover { opacity: 1; background: rgba(218,55,60,0.15); }
.message:hover .message-delete { opacity: 0.85; }
.message-content { font-size: 0.95rem; word-wrap: break-word; }
.message-content img.message-image {
    max-width: 100%; max-height: 300px; border-radius: 8px; margin-top: 0.25rem; cursor: zoom-in;
    transition: opacity 0.2s;
}
.message-content img.message-image:hover { opacity: 0.9; }

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: lightboxFadeIn 0.2s ease;
}
.image-lightbox.hidden { display: none !important; }
.image-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.image-lightbox-close {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top));
    right: max(1rem, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.image-lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.message-content .youtube-embed {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    margin-top: 0.25rem;
    background: #000;
}
.message-content .youtube-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Audio Player */
.audio-player {
    display: flex; align-items: center; gap: 0.75rem;
    background: var(--bg-tertiary); padding: 0.5rem 0.75rem;
    border-radius: 8px; margin-top: 0.25rem; max-width: 360px;
}
.audio-player button {
    background: var(--accent); color: #fff; border: none;
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 0.8rem;
}
.audio-player .progress-bar {
    flex: 1; height: 4px; background: var(--border); border-radius: 2px; cursor: pointer; position: relative;
}
.audio-player .progress-fill {
    height: 100%; background: var(--accent); border-radius: 2px; width: 0; transition: width 0.1s;
}
.audio-player .audio-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

.message-content .message-text a {
    color: var(--accent);
    word-break: break-all;
}

/* Input Area */
.chat-input-area {
    padding: 0.75rem 1.25rem 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.input-toolbar { display: flex; gap: 0.25rem; margin-bottom: 0.5rem; }

.input-row { display: flex; gap: 0.5rem; align-items: flex-end; }
.input-row textarea {
    flex: 1; resize: none; padding: 0.65rem 0.85rem;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg-tertiary); color: var(--text-primary);
    font-size: 0.95rem; font-family: inherit; max-height: 120px;
}
.input-row textarea:focus { outline: none; border-color: var(--accent); }

.preview-area { margin-bottom: 0.5rem; }
.preview-area img { max-height: 120px; border-radius: 8px; }
.hidden { display: none !important; }

/* YouTube */
.btn-youtube { color: #ff0000; }
.link-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.link-panel label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.link-panel-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.link-panel-row input {
    flex: 1;
    min-width: 180px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}
.link-panel-row input:focus { outline: none; border-color: var(--accent); }

.youtube-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.youtube-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.youtube-preview .youtube-embed {
    position: relative;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}
.youtube-preview .youtube-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Voice Panel */
.voice-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-top: 0.5rem;
}

.voice-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    padding: 0.25rem 0;
}

.voice-idle-icon {
    font-size: 1.75rem;
}

.voice-idle-text {
    font-size: 0.95rem;
    font-weight: 700;
}

.voice-idle-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.voice-idle-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.voice-recording {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.voice-recording-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.voice-pulse {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    animation: voicePulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes voicePulse {
    0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(218,55,60,0.5); }
    50% { transform: scale(1.15); opacity: 0.85; box-shadow: 0 0 0 8px rgba(218,55,60,0); }
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 32px;
}

.voice-waveform span {
    display: block;
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
    animation: voiceBar 0.8s ease-in-out infinite;
}

.voice-waveform span:nth-child(1) { animation-delay: 0s; }
.voice-waveform span:nth-child(2) { animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { animation-delay: 0.3s; }
.voice-waveform span:nth-child(5) { animation-delay: 0.15s; }
.voice-waveform span:nth-child(6) { animation-delay: 0.25s; }
.voice-waveform span:nth-child(7) { animation-delay: 0.05s; }
.voice-waveform span:nth-child(8) { animation-delay: 0.35s; }

@keyframes voiceBar {
    0%, 100% { height: 8px; }
    50% { height: 28px; }
}

.voice-recording-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 100px;
}

.voice-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.voice-timer {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.voice-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.voice-preview-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
}

.voice-preview-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-preview-play:hover { background: var(--accent-hover); }

.voice-preview-track {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.voice-preview-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0;
    transition: width 0.1s linear;
}

.voice-preview-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.voice-preview-actions {
    display: flex;
    gap: 0.5rem;
}

/* Emoji Picker */
.emoji-picker {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.25rem;
    padding: 0.75rem; background: var(--bg-tertiary);
    border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: 0.5rem; max-height: 200px; overflow-y: auto;
}
.emoji-picker button {
    background: none; border: none; font-size: 1.4rem; cursor: pointer;
    padding: 0.25rem; border-radius: 4px;
}
.emoji-picker button:hover { background: var(--bg-hover); }

/* Profile & Admin Pages */
.page-container { max-width: 960px; margin: 0 auto; padding: 1.5rem; }
.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.5rem; }

.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.profile-card {
    background: var(--bg-secondary); border-radius: 12px;
    padding: 1.25rem; border: 1px solid var(--border);
}
.profile-card h2 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-secondary); }
.profile-form { margin-top: 0.75rem; }
.avatar-preview { text-align: center; margin-bottom: 1rem; }
.avatar-preview img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }

.info-list dt { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }
.info-list dd { font-weight: 600; }

/* Admin */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-secondary); border-radius: 12px; padding: 1.25rem;
    text-align: center; border: 1px solid var(--border);
}
.stat-card.online { border-color: var(--online); }
.stat-card.danger { border-color: var(--danger); }
.stat-value { display: block; font-size: 1.8rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

.admin-section { margin-bottom: 2rem; }
.admin-section h2 { font-size: 1.1rem; margin-bottom: 1rem; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td {
    padding: 0.6rem 0.75rem; text-align: left;
    border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.badge {
    display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
    font-size: 0.7rem; font-weight: 600;
}
.badge-admin { background: var(--accent); color: #fff; }
.badge-online { background: rgba(35,165,89,0.2); color: var(--success); }
.badge-offline { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-banned { background: rgba(218,55,60,0.2); color: var(--danger); }

.inline-form { display: inline; }
.inline-form-group { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.inline-form-group input {
    padding: 0.5rem 0.75rem; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg-tertiary); color: var(--text-primary);
}
.ban-list { list-style: none; }
.ban-list li {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem; background: var(--bg-secondary);
    border-radius: 8px; margin-bottom: 0.5rem;
}
.text-muted { color: var(--text-muted); font-size: 0.9rem; }

/* Mobile */
@media (max-width: 768px) {
    html.chat-page,
    body.chat-page {
        height: 100%;
        height: 100dvh;
        position: fixed;
        inset: 0;
        width: 100%;
    }

    body.chat-page.sidebar-open {
        overflow: hidden;
    }

    .chat-layout {
        height: 100%;
        height: 100dvh;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 88vw);
        max-height: none;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px var(--shadow);
        border-right: 1px solid var(--border);
        border-bottom: none;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: #39FF14;
    }

    .desktop-only {
        display: none !important;
    }

    .sidebar-mobile-actions.mobile-only {
        display: flex;
    }

    .online-menu-bar.mobile-only {
        display: flex;
    }

    .current-user {
        display: flex;
    }

    .online-section {
        padding: 0.75rem 1rem;
    }

    .online-list {
        display: block;
    }

    .online-list li {
        background: transparent;
        padding: 0.55rem 0.5rem;
    }

    .chat-main {
        flex: 1;
        min-height: 0;
        width: 100%;
    }

    .messages-container {
        flex: 1;
        min-height: 0;
        padding: 0.75rem 1rem;
    }

    .chat-header {
        padding: 0.6rem 1rem;
    }

    .chat-header-left h1 {
        font-size: 1rem;
    }

    .chat-input-area {
        padding: 0.6rem 1rem;
        padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
    }

    .input-row textarea { font-size: 16px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}
