* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: #f4f5f7;
    color: #1f2430;
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-form {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    width: 320px;
}

.auth-form h1 {
    font-size: 1.4rem;
    margin-top: 0;
}

.auth-form label {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.auth-form input {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.auth-form button {
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.6rem;
    border: none;
    border-radius: 4px;
    background: #2f6fed;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.auth-form .error {
    background: #fdeaea;
    color: #b3261e;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.auth-form .switch {
    text-align: center;
    font-size: 0.85rem;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e0e2e7;
}

.chat-layout {
    display: flex;
    height: calc(100vh - 53px);
}

.chat-error {
    background: #fdeaea;
    color: #b3261e;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    border-bottom: 1px solid #f3c9c7;
}

.chat-sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #e0e2e7;
    padding: 1rem;
    overflow-y: auto;
}

.chat-sidebar h2 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    margin: 1rem 0 0.5rem;
}

.chat-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.chat-sidebar li {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.chat-sidebar li:hover {
    background: #f0f2f5;
}

.chat-sidebar li.active {
    background: #e8efff;
    color: #2f6fed;
    font-weight: 600;
}

.chat-sidebar li.empty {
    color: #999;
    cursor: default;
}

.new-channel-form {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.new-channel-form input {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
}

.new-channel-form button {
    padding: 0.35rem 0.6rem;
    border: none;
    border-radius: 4px;
    background: #2f6fed;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
}

.messages {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e0e2e7;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
}

.message {
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}

.message .sender {
    font-weight: 600;
    margin-right: 0.4rem;
}

.message .time {
    color: #999;
    font-size: 0.75rem;
    margin-left: 0.4rem;
}

.message.own .sender {
    color: #2f6fed;
}

.message-form {
    display: flex;
    gap: 0.5rem;
}

.message-form input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.message-form button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    background: #2f6fed;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
