:root {
    --bg: #F8F5F0;
    --panel: #F7F5F1;
    --border: #dcd7cf;
    --text: #222;
    --text-soft: #666;
    --accent: #B03A2E;
    --accent-light: #f5e3e1;
    --hover: #ebe7df;
    --active: #e3ded6;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: var(--bg); color: var(--text); }
.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar { width: 260px; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-header { padding: 12px 16px; font-weight: bold; border-bottom: 1px solid var(--border); }
.users-list { flex: 1; overflow-y: auto; padding: 8px; }
.user-item { padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.user-item:hover { background: var(--hover); border-color: var(--border); }
.user-item.selected { background: var(--active); border-color: var(--border); font-weight: bold; }
.online-indicator { font-size: 12px; }
.chat { flex: 1; display: flex; flex-direction: column; }
.chat-header { padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--border); }
.messages { flex: 1; overflow-y: auto; padding: 12px 16px; }
.message { margin-bottom: 8px; padding: 8px 10px; background: #fff; border: 1px solid var(--border); border-radius: 10px; max-width: 62%; width: fit-content; }
.message.from { margin-left: auto; background: var(--accent-light); border-color: #e6c9c6; }
.message .author { font-size: 11px; font-weight: bold; color: var(--accent); }
.message .time { font-size: 10px; color: var(--text-soft); margin-top: 4px; }
.composer { padding: 12px 16px; background: var(--panel); border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.composer textarea { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 14px; font-family: inherit; resize: none; }
.file-attach { background: #ddd; padding: 8px 12px; border-radius: 20px; cursor: pointer; border: none; }
button { background: var(--accent); color: white; border: none; padding: 6px 14px; border-radius: 14px; cursor: pointer; }
.progress-bar { width: 100%; height: 4px; background: #ddd; border-radius: 2px; margin-top: 8px; }
.progress-fill { width: 0%; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; }
.login-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-card { background: white; padding: 32px; border-radius: 16px; width: 300px; text-align: center; }
.login-card input { width: 100%; padding: 8px; margin: 8px 0; border: 1px solid #ccc; border-radius: 8px; }
.status { font-size: 12px; padding: 4px 16px; background: #eee; color: #555; }
/* Для компьютеров (по умолчанию) */
.preview-img, .message img {
    max-width: 400px;
    max-height: 400px;
    border-radius: 8px;
    cursor: pointer;
}

/* Для телефонов */
@media (max-width: 700px) {
    .preview-img, .message img {
        max-width: 250px;
        max-height: 250px;
    }
}

/* Мобильная версия */
@media (max-width: 700px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transition: left 0.2s ease;
    }
    .sidebar.open {
        left: 0;
    }
    .chat {
        width: 100%;
    }
    .message {
        max-width: 85%;
        font-size: 14px;
    }
    .composer textarea {
        font-size: 16px;
    }
    .menu-toggle {
        display: block;
        position: static;
        background: transparent;
        border: 1px solid var(--accent);
        border-radius: 8px;
        width: 36px;
        height: 36px;
        font-size: 20px;
        cursor: pointer;
        margin-right: 12px;
        color: var(--accent);
        line-height: 1;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
@media (min-width: 701px) {
    .menu-toggle {
        display: none;
    }
}
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(20px); }
}