* {
    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;
    }
}
.message-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.role-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
}

.role-badge.guest {
    background: #374151;
    color: #e5e7eb;
}

.role-badge.member,
.role-badge.user {
    background: #1d4ed8;
    color: #ffffff;
}

.role-badge.admin {
    background: #b91c1c;
    color: #ffffff;
}

.role-badge.moderator {
    background: #7c3aed;
    color: #ffffff;
}

.message.guest {
    border-right: 4px solid #6b7280;
}

.message.member,
.message.user {
    border-right: 4px solid #2563eb;
}

.message.admin {
    border-right: 4px solid #dc2626;
}

.message.moderator {
    border-right: 4px solid #8b5cf6;
}

.presence-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.presence-name {
    font-weight: 600;
    word-break: break-word;
}
.role-badge.system {
    background: #334155;
    color: #fff;
}

.message.system {
    background: #0f172a;
    border: 1px dashed rgba(255,255,255,0.15);
    text-align: center;
}

.system-text {
    color: #cbd5e1;
    font-style: italic;
    line-height: 1.8;
}

.local-only {
    opacity: 0.9;
}
.role-badge.private {
    background: #f59e0b;
    color: #111827;
}

.message.private {
    border-right: 4px solid #f59e0b;
    background: #1f2937;
}

.message.private .text {
    color: #fde68a;
}
.role-badge.private {
    background: #f59e0b;
    color: #111827;
}

.message.private {
    border-right: 4px solid #f59e0b;
    background: #1f2937;
}

.message.private .text {
    color: #fde68a;
}
.role-badge.private {
    background: #f59e0b;
    color: #111827;
}

.message.private {
    border-right: 4px solid #f59e0b;
    background: #1f2937;
}

.message.private .text {
    color: #fde68a;
}
.page-clock-wrap,
.header-clock-wrap {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 14px;
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.page-clock-wrap {
    margin-bottom: 20px;
}

.page-clock-label,
.header-clock-label {
    font-size: 12px;
    opacity: 0.8;
}

.page-clock,
.header-clock {
    font-size: 14px;
    font-weight: bold;
}

.chat-header-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.admin-page {
    background:#0f172a;
    color:#fff;
    font-family: system-ui;
}

.admin-container {
    max-width:1000px;
    margin:auto;
    padding:20px;
}

.stats-grid {
    display:grid;
    grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
    gap:10px;
    margin-bottom:20px;
}

.stat-box {
    background:#1e293b;
    padding:15px;
    border-radius:10px;
    text-align:center;
    font-weight:bold;
}

.tabs {
    display:flex;
    gap:10px;
    margin-bottom:15px;
}

.tabs button {
    flex:1;
    padding:10px;
    border:none;
    border-radius:8px;
    background:#1e293b;
    color:#fff;
    cursor:pointer;
}

.tabs button.active {
    background:#3b82f6;
}

.tab-content {
    display:none;
}

.tab-content.active {
    display:block;
}

.item-row {
    background:#1e293b;
    padding:10px;
    border-radius:8px;
    margin-bottom:8px;
    display:flex;
    justify-content:space-between;
}

.badge {
    padding:4px 8px;
    border-radius:6px;
    font-size:12px;
}

.online { background:#22c55e; }
.guest { background:#f59e0b; }

.card {
    background:#1e293b;
    padding:15px;
    border-radius:10px;
}

.message {
    background:#1e293b;
    padding:10px;
    margin-bottom:8px;
    border-radius:8px;
}