* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, sans-serif; background: #f4f4f4; height: 100vh; }

/* Логин */
#login-container {
    max-width: 400px;
    margin: 100px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
#login-container input, #login-container button {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}
#login-container button {
    background: #007bff;
    color: #fff;
    border: none;
    cursor: pointer;
}

/* Чат */
#app {
    display: flex;
    height: 100vh;
}
#sidebar {
    width: 30%;
    background: #2c3e50;
    color: #fff;
    display: flex;
    flex-direction: column;
}
#user-info {
    padding: 15px;
    background: #1a252f;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#user-info button {
    background: #e74c3c;
    border: none;
    padding: 5px 10px;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}
#user-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}
#user-list h3 { margin-bottom: 10px; }
#user-list ul {
    list-style: none;
}
#user-list li {
    padding: 10px;
    border-bottom: 1px solid #34495e;
    cursor: pointer;
}
#user-list li:hover { background: #34495e; }

#chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ecf0f1;
}
#chat-header {
    padding: 15px;
    background: #bdc3c7;
    font-weight: bold;
}
#messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fff;
}
.msg {
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
}
.msg.mine {
    background: #3498db;
    color: #fff;
    align-self: flex-end;
    margin-left: auto;
}
.msg.theirs {
    background: #ecf0f1;
    align-self: flex-start;
}
#input-area {
    display: flex;
    padding: 10px;
    background: #bdc3c7;
}
#message-input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    resize: none;
}
#send-btn {
    padding: 10px 20px;
    margin-left: 10px;
    background: #2ecc71;
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    #app { flex-direction: column; }
    #sidebar {
        width: 100%;
        height: 40vh;
    }
    #chat {
        height: 60vh;
    }
    #user-list { overflow-y: auto; }
    #messages { max-height: 50vh; }
}