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

:root {
    --bg: #0c0c10;
    --surface: #13131a;
    --surface2: #1c1c26;
    --surface3: #242432;
    --border: #252535;
    --border-light: #2e2e44;
    --accent: #5b5bd6;
    --accent-h: #7575e0;
    --accent-glow: rgba(91, 91, 214, 0.18);
    --text: #eeeef4;
    --text-secondary: #a0a0bc;
    --muted: #5e5e78;
    --mine-bg: linear-gradient(135deg, #4040b8, #5b5bd6);
    --their-bg: #1c1c26;
    --danger: #e05555;
    --green: #3fcf8e;
    --green-glow: rgba(63, 207, 142, 0.15);
    --radius: 14px;
    --radius-sm: 10px;
    --font:
        -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
        "Helvetica Neue", Arial, sans-serif;
    --font-mono:
        "SF Mono", "Cascadia Code", "Fira Code", "Consolas", "Courier New",
        monospace;
    --sidebar-w: 300px;
    --transition: 0.2s ease;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

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

/* ════════════════════════════════════════
   AUTH PAGE
════════════════════════════════════════ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: auto;
    background: var(--bg);
    background-image:
        radial-gradient(
            ellipse 60% 40% at 50% -10%,
            rgba(91, 91, 214, 0.2) 0%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 40% 30% at 80% 80%,
            rgba(63, 207, 142, 0.05) 0%,
            transparent 50%
        );
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 40px 80px rgba(0, 0, 0, 0.6);
    margin: 1rem;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(91, 91, 214, 0.5),
        transparent
    );
}

.logo {
    font-size: 1.9rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text), var(--accent-h));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 2rem;
    letter-spacing: 0.01em;
}

.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 1.5rem;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--muted);
    padding: 0.5rem;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font);
    transition: all var(--transition);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 12px rgba(91, 91, 214, 0.35);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.72rem 1rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font);
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group small {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    margin-top: 0.3rem;
    line-height: 1.5;
}

.btn-primary {
    width: 100%;
    padding: 0.8rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition:
        background var(--transition),
        transform 0.1s,
        box-shadow var(--transition);
    margin-top: 0.5rem;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 20px rgba(91, 91, 214, 0.3);
}

.btn-primary:hover {
    background: var(--accent-h);
    box-shadow: 0 6px 24px rgba(91, 91, 214, 0.45);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.error-msg {
    background: rgba(224, 85, 85, 0.08);
    border: 1px solid rgba(224, 85, 85, 0.25);
    color: var(--danger);
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-size: 0.84rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* ════════════════════════════════════════
   APP SHELL
════════════════════════════════════════ */
.chat-page {
    height: 100vh;
    overflow: hidden;
}

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 20;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    font-size: 1.2rem;
}

.brand-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text), var(--accent-h));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-actions {
    display: flex;
    gap: 0.35rem;
}

.icon-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 9px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--surface3);
    border-color: var(--border-light);
    color: var(--text);
}

.icon-btn--danger:hover {
    background: rgba(224, 85, 85, 0.1);
    border-color: rgba(224, 85, 85, 0.3);
    color: var(--danger);
}

.my-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

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

.my-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-username {
    font-size: 0.75rem;
    color: var(--muted);
    font-family: var(--font-mono);
    margin-top: 1px;
}

.conv-list-header {
    padding: 0.9rem 1.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    flex-shrink: 0;
}

.conv-list {
    flex: 1;
    overflow-y: auto;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1.1rem;
    cursor: pointer;
    transition: background var(--transition);
    border-radius: 0;
    position: relative;
}

.conv-item::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 1.1rem;
    right: 1.1rem;
    height: 1px;
    background: var(--border);
}

.conv-item:hover {
    background: var(--surface2);
}

.conv-item.active {
    background: var(--accent-glow);
}

.conv-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

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

.conv-name {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-preview {
    display: block;
    font-size: 0.74rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.18rem;
}

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

/* ── Avatar ── */
.avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-h));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    user-select: none;
    position: relative;
    box-shadow: 0 2px 8px rgba(91, 91, 214, 0.25);
}

.avatar--lg {
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 1rem;
}

.avatar--status::after {
    content: "";
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--surface);
}

/* ── Online dot ── */
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.online-dot.online {
    background: var(--green);
    box-shadow: 0 0 6px rgba(63, 207, 142, 0.6);
}

.online-dot.offline {
    background: var(--muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    color: var(--muted);
    padding: 3rem 1.5rem;
    font-size: 0.84rem;
    line-height: 1.7;
}

.empty-state-icon {
    font-size: 2rem;
    opacity: 0.5;
}

/* ════════════════════════════════════════
   MAIN AREA
════════════════════════════════════════ */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--bg);
    background-image: radial-gradient(
        ellipse 50% 50% at 50% 100%,
        rgba(91, 91, 214, 0.04) 0%,
        transparent 60%
    );
}

/* Mobile topbar - hidden on desktop */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 8px;
    transition: color var(--transition);
}

.mobile-menu-btn:hover {
    color: var(--text);
}

.mobile-brand {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* No chat selected */
.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    gap: 0.75rem;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.no-chat-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(
        circle,
        rgba(91, 91, 214, 0.06) 0%,
        transparent 60%
    );
    border-radius: 50%;
    pointer-events: none;
}

.no-chat-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 20px rgba(91, 91, 214, 0.3));
}

.no-chat-selected h2 {
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.no-chat-selected p {
    line-height: 1.7;
    font-size: 0.88rem;
    max-width: 280px;
}

.btn-start {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition:
        background var(--transition),
        box-shadow var(--transition);
    box-shadow: 0 4px 20px rgba(91, 91, 214, 0.3);
}

.btn-start:hover {
    background: var(--accent-h);
    box-shadow: 0 6px 24px rgba(91, 91, 214, 0.45);
}

/* ════════════════════════════════════════
   CHAT PANEL
════════════════════════════════════════ */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.back-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: color var(--transition);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.back-btn:hover {
    color: var(--text);
}

.chat-other-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
}

.chat-other-name {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-status {
    font-size: 0.74rem;
    color: var(--muted);
    margin-top: 1px;
}

.e2e-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--green);
    background: var(--green-glow);
    padding: 0.28rem 0.65rem;
    border-radius: 20px;
    border: 1px solid rgba(63, 207, 142, 0.2);
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
}

/* ════════════════════════════════════════
   MESSAGES
════════════════════════════════════════ */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    animation: msgIn 0.15s ease;
}

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

.message.mine {
    align-self: flex-end;
    align-items: flex-end;
}

.message.theirs {
    align-self: flex-start;
    align-items: flex-start;
}

.bubble {
    padding: 0.65rem 1rem;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.message.mine .bubble {
    background: var(--mine-bg);
    border-bottom-right-radius: 4px;
    color: white;
    box-shadow: 0 2px 12px rgba(91, 91, 214, 0.25);
}

.message.theirs .bubble {
    background: var(--their-bg);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text);
}

.meta {
    font-size: 0.67rem;
    color: var(--muted);
    margin-top: 0.2rem;
    padding: 0 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tick {
    color: var(--accent-h);
}

/* ── File Bubbles ── */
.bubble.file-msg {
    padding: 0.35rem;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.file-bubble {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.7rem 0.85rem;
    min-width: 210px;
    max-width: 300px;
    transition: border-color var(--transition);
}

.file-bubble:hover {
    border-color: var(--accent);
}

.message.mine .file-bubble {
    background: rgba(91, 91, 214, 0.15);
    border-color: rgba(91, 91, 214, 0.3);
}

.file-icon {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
}

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

.file-name {
    font-size: 0.83rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.file-download-btn {
    background: var(--accent);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition:
        background var(--transition),
        transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(91, 91, 214, 0.3);
}

.file-download-btn:hover {
    background: var(--accent-h);
    transform: scale(1.08);
}

.file-download-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* ════════════════════════════════════════
   TYPING INDICATOR
════════════════════════════════════════ */
.typing-indicator {
    padding: 0 1.25rem 0.6rem;
    flex-shrink: 0;
}

.typing-bubble {
    display: inline-flex;
    align-items: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 0.55rem 0.9rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--muted);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-6px);
    }
}

/* ════════════════════════════════════════
   UPLOAD PROGRESS
════════════════════════════════════════ */
.upload-progress {
    display: flex;
    align-items: center;
    padding: 0.55rem 1.25rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.upload-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.upload-spinner svg {
    animation: spin 0.8s linear infinite;
    color: var(--accent);
}

.upload-name {
    color: var(--text);
    font-weight: 600;
}

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

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

/* ════════════════════════════════════════
   MESSAGE INPUT
════════════════════════════════════════ */
.message-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.attach-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attach-btn:hover {
    background: var(--surface3);
    border-color: var(--border-light);
    color: var(--text);
}

#msg-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 22px;
    color: var(--text);
    padding: 0.65rem 1.1rem;
    font-size: 0.92rem;
    font-family: var(--font);
    resize: none;
    max-height: 120px;
    outline: none;
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
    line-height: 1.5;
}

#msg-input::placeholder {
    color: var(--muted);
}

#msg-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.send-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    background: var(--accent);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition:
        background var(--transition),
        transform 0.15s,
        box-shadow var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(91, 91, 214, 0.35);
}

.send-btn:hover {
    background: var(--accent-h);
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(91, 91, 214, 0.5);
}

.send-btn:active {
    transform: scale(0.95);
}

/* ════════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(6px);
    padding: 1rem;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 24px 60px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.2s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-close {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--surface3);
    color: var(--text);
}

.search-input-wrap {
    position: relative;
    border-bottom: 1px solid var(--border);
}

.search-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 0.85rem 1.1rem 0.85rem 2.75rem;
    background: var(--surface2);
    border: none;
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
    font-family: var(--font);
}

#search-input::placeholder {
    color: var(--muted);
}

.search-results {
    max-height: 320px;
    overflow-y: auto;
}

.search-hint {
    text-align: center;
    color: var(--muted);
    padding: 2rem 1rem;
    font-size: 0.84rem;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.search-result-item:hover {
    background: var(--surface2);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* ════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════ */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* ════════════════════════════════════════
   MOBILE / RESPONSIVE
════════════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 19;
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    :root {
        --sidebar-w: 280px;
    }

    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 20;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.4);
    }

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

    .sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .mobile-topbar {
        display: flex;
    }

    .main-area {
        flex: 1;
        height: calc(100vh - 57px);
    }

    .back-btn {
        display: flex;
    }

    .message {
        max-width: 85%;
    }

    .e2e-badge {
        display: none;
    }

    .no-chat-selected {
        padding: 3rem 1.5rem;
    }

    .messages {
        padding: 1rem;
    }

    .message-input-area {
        padding: 0.7rem 0.75rem;
    }

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

    .file-bubble {
        min-width: 180px;
        max-width: 250px;
    }

    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        border-radius: 18px 18px 0 0;
        max-width: 100%;
        width: 100%;
        animation: modalSlideUp 0.25s ease;
    }

    @keyframes modalSlideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .search-results {
        max-height: 50vh;
    }
}

@media (max-width: 400px) {
    .message {
        max-width: 90%;
    }

    .chat-other-name {
        font-size: 0.88rem;
    }
}
