* { box-sizing: border-box; }
html, body {
    height: 100%;
}
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f2f4f7;
    color: #1a1a1a;
}
a { color: #2563eb; text-decoration: none; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1f2937;
    color: #fff;
    gap: 10px;
}
.topbar a { color: #fff; }
.admin-bar { background: #7c2d12; }

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1f2937;
}
.auth-box {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    width: 100%;
    max-width: 360px;
}
.auth-box h1 { text-align: center; margin-top: 0; }
.auth-box label { display: block; margin-bottom: 14px; font-size: 14px; }
.auth-box input {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
}
.auth-box button, .button {
    width: 100%;
    padding: 10px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    display: inline-block;
}
.error { color: #dc2626; font-size: 14px; }
.success { color: #16a34a; font-size: 14px; }

.room-list ul, .list { list-style: none; padding: 0; }
.room-list li, .list li {
    background: #fff;
    padding: 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    position: relative;
}
.messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    padding-bottom: 76px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.message {
    background: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 80%;
    align-self: flex-start;
}
.message .meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 2px;
}
.message .author { font-weight: 600; color: #374151; }
.message .delete-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
}
.message .text { white-space: pre-wrap; word-break: break-word; }

.send-form {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 8px;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    will-change: transform;
}
.send-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 16px;
}
.send-form button {
    padding: 10px 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 20px;
}
.supervise-note {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    padding: 6px;
    margin: 0;
    flex-shrink: 0;
}
.status.on { color: #16a34a; font-weight: 600; }
.status.off { color: #dc2626; font-weight: 600; }

.admin-dashboard { padding: 16px; max-width: 700px; margin: 0 auto; }
.admin-dashboard section { margin-bottom: 28px; }

form.inline { display: inline; }
.form-box {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    max-width: 400px;
    margin: 16px 0;
}
.form-box label { display: block; margin-bottom: 10px; font-size: 14px; }
.form-box input, .form-box select {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 6px;
}