* {
    box-sizing: border-box;
    font-family: Tahoma, Arial, sans-serif;
}

body {
    margin: 0;
    background: #111827;
    color: #fff;
}

.login-page,
.chat-page {
    min-height: 100vh;
}

.login-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.card {
    background: #1f2937;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.card h2 {
    margin-top: 0;
}

input,
button {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border-radius: 10px;
    border: none;
}

input[type="checkbox"] {
    width: auto;
    margin: 0;
}

input {
    background: #f3f4f6;
    color: #111;
}

button {
    background: #2563eb;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    opacity: 0.92;
}

.terms-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    text-align: right;
}

.alert {
    max-width: 700px;
    margin: 15px auto;
    padding: 12px;
    border-radius: 10px;
}

.alert.error {
    background: #7f1d1d;
}

.alert.success {
    background: #14532d;
}

.alert.warn {
    background: #78350f;
}

.small-alert {
    margin: 10px 20px;
}

.chat-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #0f172a;
    padding: 20px;
    border-left: 1px solid rgba(255,255,255,0.08);
}

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    padding: 16px 20px;
    background: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #111827;
}

.message {
    background: #1f2937;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    word-break: break-word;
}

.message .name {
    color: #60a5fa;
    font-weight: bold;
    margin-bottom: 6px;
}

.message .text {
    line-height: 1.6;
}

.message .time {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 6px;
}

.chat-form {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #1e293b;
}

.chat-form input {
    flex: 1;
    margin-top: 0;
}

.chat-form button {
    width: 140px;
}

.logout-link,
.admin-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    padding: 12px;
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}

.logout-link {
    background: #dc2626;
}

.admin-link {
    background: #7c3aed;
}

.user-badge {
    background: #1e293b;
    border-radius: 10px;
    padding: 12px;
    margin-top: 15px;
}

.user-badge small {
    display: block;
    margin-top: 5px;
    opacity: .8;
}

#presenceList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#presenceList li {
    background: #1e293b;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.admin-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-box {
    background: #1f2937;
    padding: 18px;
    border-radius: 12px;
    font-weight: bold;
}

.admin-messages {
    margin-top: 15px;
}

@media (max-width: 768px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-left: none;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .chat-main {
        height: auto;
        min-height: 70vh;
    }
}