* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;

    width: 100%;
    height: 100%;

    font-family: Arial, sans-serif;

    background: #f4f5f7;
    color: #222;
}

.hidden {
    display: none !important;
}

.screen {
    width: 100%;
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;

    background: white;

    border-radius: 12px;

    padding: 30px;

    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, 0.08);
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 10px;
}

.login-box p {
    color: #666;
    margin-bottom: 25px;
}

input {
    width: 100%;

    border: 1px solid #ccc;
    border-radius: 8px;

    padding: 12px 14px;

    font-size: 16px;

    outline: none;
}

input:focus {
    border-color: #555;
}

button {
    border: none;

    border-radius: 8px;

    padding: 12px 18px;

    font-size: 16px;

    cursor: pointer;

    background: #222;
    color: white;
}

button:hover {
    opacity: 0.9;
}

.login-box button {
    width: 100%;
    margin-top: 12px;
}

#login-error {
    margin-top: 12px;
    color: #b00020;
}

.chat-screen {
    width: 100%;
    height: 100vh;

    display: flex;
    flex-direction: column;
}

.topbar {
    height: 60px;

    background: white;

    border-bottom: 1px solid #ddd;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 20px;
}

#connection-status {
    font-size: 14px;
    color: #666;
}

.layout {
    flex: 1;

    display: flex;

    min-height: 0;
}

.sidebar {
    width: 240px;

    background: white;

    border-right: 1px solid #ddd;

    padding: 20px;

    overflow-y: auto;
}

.sidebar h2 {
    font-size: 16px;
    margin-top: 0;
}

.user {
    padding: 8px 0;

    border-bottom: 1px solid #eee;
}

.chat {
    flex: 1;

    display: flex;
    flex-direction: column;

    min-width: 0;
}

.messages {
    flex: 1;

    overflow-y: auto;

    padding: 20px;
}

.message {
    max-width: 700px;

    margin-bottom: 12px;

    background: white;

    border-radius: 10px;

    padding: 10px 14px;

    box-shadow:
        0 1px 2px
        rgba(0, 0, 0, 0.04);
}

.message-header {
    display: flex;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 5px;
}

.message-user {
    font-weight: bold;
}

.message-time {
    font-size: 12px;
    color: #888;
}

.message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.system-message {
    margin-bottom: 10px;

    text-align: center;

    color: #888;

    font-size: 13px;
}

.message-form {
    display: flex;

    gap: 10px;

    padding: 15px;

    background: white;

    border-top: 1px solid #ddd;
}

.message-form input {
    flex: 1;
}

@media (max-width: 700px) {

    .sidebar {
        display: none;
    }

    .messages {
        padding: 12px;
    }

    .message-form {
        padding: 10px;
    }

    .message-form button {
        padding-left: 12px;
        padding-right: 12px;
    }

}
