* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: #1f2937;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Hiragino Sans",
        "Yu Gothic",
        sans-serif;
    background: #f1f5f9;
}

a {
    color: inherit;
}

.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 16px;
    background:
        radial-gradient(circle at top left,
            #dbeafe,
            transparent 40%),
        linear-gradient(135deg,
            #f8fafc,
            #eef2ff);
}

.auth-container {
    width: 100%;
    max-width: 460px;
}

.auth-card {
    padding: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 20px 50px rgb(15 23 42 / 12%);
}

.site-name {
    display: inline-block;
    margin-bottom: 24px;
    color: #4f46e5;
    font-size: 18px;
    font-weight: 800;
    text-decoration: none;
}

.auth-card h1 {
    margin: 0;
    font-size: 28px;
}

.auth-description {
    margin: 10px 0 26px;
    color: #64748b;
    line-height: 1.7;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: white;
    font: inherit;
    outline: none;
}

.auth-form input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgb(99 102 241 / 12%);
}

.auth-form button,
.primary-link {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    padding: 0 20px;
    color: white;
    border: 0;
    border-radius: 12px;
    background: #4f46e5;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.auth-form button:hover,
.primary-link:hover {
    background: #4338ca;
}

.optional {
    margin-left: 4px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: normal;
}

.error-message,
.success-message {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 12px;
    line-height: 1.6;
}

.error-message {
    color: #991b1b;
    border: 1px solid #fecaca;
    background: #fef2f2;
}

.error-message ul {
    margin: 0;
    padding-left: 20px;
}

.success-message {
    color: #166534;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
}

@media (max-width: 520px) {
    .auth-card {
        padding: 26px 20px;
        border-radius: 18px;
    }
}
.auth-footer {
    margin: 22px 0 0;
    color: #64748b;
    font-size: 14px;
    text-align: center;
}

.auth-footer a {
    color: #4f46e5;
    font-weight: 700;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 72px;
    padding: 0 6%;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.92);
}

.header-logo {
    color: #4f46e5;
    font-size: 20px;
    font-weight: 900;
    text-decoration: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
}

.header-nav a {
    text-decoration: none;
}

.header-nav form {
    margin: 0;
}

.header-primary,
.logout-button {
    padding: 10px 16px;
    color: white;
    border: 0;
    border-radius: 10px;
    background: #4f46e5;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.home-main {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    padding: 60px 8%;
    background:
        radial-gradient(
            circle at top left,
            #dbeafe,
            transparent 38%
        ),
        linear-gradient(
            135deg,
            #f8fafc,
            #eef2ff
        );
}

.hero {
    width: 100%;
    max-width: 760px;
}

.hero-label {
    color: #4f46e5;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.hero h1 {
    margin: 14px 0 20px;
    color: #0f172a;
    font-size: clamp(42px, 7vw, 76px);
    line-height: 1.15;
}

.hero-description {
    max-width: 620px;
    margin-bottom: 32px;
    color: #64748b;
    font-size: 17px;
    line-height: 1.9;
}

.hero-buttons {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hero-button,
.hero-secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 52px;
    padding: 0 24px;
    border-radius: 12px;
    font-weight: 800;
    text-decoration: none;
}

.hero-button {
    color: white;
    background: #4f46e5;
}

.hero-secondary {
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    background: white;
}

@media (max-width: 600px) {
    .top-header {
        padding: 0 18px;
    }

    .header-nav span {
        display: none;
    }

    .home-main {
        padding: 40px 22px;
    }

    .hero-buttons {
        align-items: stretch;
        flex-direction: column;
    }
}
.header-text-link {
    color: #475569;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-main {
    min-height: calc(100vh - 72px);
    padding: 50px 7%;
    background:
        radial-gradient(
            circle at top left,
            #dbeafe,
            transparent 35%
        ),
        #f8fafc;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 36px;
}

.dashboard-label {
    margin: 0 0 8px;
    color: #4f46e5;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.dashboard-header h1 {
    margin: 0;
    color: #0f172a;
    font-size: 38px;
}

.dashboard-header p {
    margin: 10px 0 0;
    color: #64748b;
}

.dashboard-actions,
.empty-actions {
    display: flex;
    gap: 12px;
}

.dashboard-primary,
.dashboard-secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.dashboard-primary {
    color: white;
    background: #4f46e5;
}

.dashboard-primary:hover {
    background: #4338ca;
}

.dashboard-secondary {
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    background: white;
}

.empty-card {
    max-width: 760px;
    margin: 80px auto;
    padding: 55px 30px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background: white;
    text-align: center;
    box-shadow: 0 20px 50px rgb(15 23 42 / 8%);
}

.empty-icon {
    margin-bottom: 16px;
    font-size: 52px;
}

.empty-card h2 {
    margin: 0;
    color: #0f172a;
    font-size: 25px;
}

.empty-card p {
    margin: 14px 0 26px;
    color: #64748b;
    line-height: 1.8;
}

.empty-actions {
    justify-content: center;
}

.chat-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.chat-card {
    padding: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    box-shadow: 0 12px 30px rgb(15 23 42 / 6%);
}

.chat-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-avatar {
    width: 52px;
    height: 52px;
    display: flex;
    flex: 0 0 auto;
    justify-content: center;
    align-items: center;
    color: white;
    border-radius: 16px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    font-size: 21px;
    font-weight: 900;
}

.chat-card h2 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 19px;
}

.chat-code {
    margin: 0;
    color: #64748b;
    font-size: 12px;
}

.chat-card-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
    color: #64748b;
    font-size: 12px;
}

.chat-card-info span {
    padding: 6px 9px;
    border-radius: 8px;
    background: #f1f5f9;
}

.chat-card-info .owner-badge {
    color: #92400e;
    background: #fef3c7;
}

.chat-card-info .free-badge {
    color: #166534;
    background: #dcfce7;
}

.chat-open-button {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    color: white;
    border-radius: 11px;
    background: #4f46e5;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

@media (max-width: 760px) {
    .dashboard-main {
        padding: 34px 18px;
    }

    .dashboard-header {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-actions,
    .empty-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-header h1 {
        font-size: 31px;
    }

    .empty-card {
        margin-top: 35px;
        padding: 40px 20px;
    }
}
.admin-main {
    min-height: calc(100vh - 72px);
    padding: 48px 7%;
    background:
        radial-gradient(circle at top left,
            #dbeafe,
            transparent 34%),
        #f8fafc;
}

.admin-heading {
    max-width: 1200px;
    margin: 0 auto 30px;
}

.admin-heading h1 {
    margin: 0;
    color: #0f172a;
    font-size: 38px;
}

.admin-heading>p:last-child {
    margin: 10px 0 0;
    color: #64748b;
}

.admin-stats {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 18px;
    max-width: 1200px;
    margin: 0 auto 30px;
}

.admin-stat-card {
    display: grid;
    gap: 10px;
    padding: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: white;
    box-shadow: 0 10px 25px rgb(15 23 42 / 6%);
}

.admin-stat-card span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.admin-stat-card strong {
    color: #0f172a;
    font-size: 34px;
}

.admin-section {
    max-width: 1200px;
    margin: 0 auto 30px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    box-shadow: 0 12px 30px rgb(15 23 42 / 6%);
}

.admin-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.admin-section-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: 21px;
}

.admin-section-heading span {
    color: #94a3b8;
    font-size: 12px;
}

.admin-table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.admin-table th,
.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.admin-table th {
    color: #64748b;
    background: #f8fafc;
    font-size: 12px;
}

.admin-table td {
    color: #334155;
    font-size: 13px;
}

.admin-badge,
.user-badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.admin-badge {
    color: #92400e;
    background: #fef3c7;
}

.user-badge {
    color: #475569;
    background: #e2e8f0;
}

.admin-empty {
    margin: 0;
    padding: 25px;
    color: #64748b;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
}

@media (max-width: 900px) {
    .admin-stats {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .admin-main {
        padding: 32px 16px;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-section {
        padding: 18px;
    }
}
.checkbox-label {
    display: flex !important;
    align-items: flex-start;
    grid-template-columns: none !important;
    gap: 10px !important;
    padding: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
}

.auth-form .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin: 2px 0 0;
    accent-color: #4f46e5;
}

.checkbox-label span {
    color: #334155;
    font-size: 14px;
    line-height: 1.6;
}

.password-fields {
    display: grid;
    gap: 18px;
}

.password-fields[hidden] {
    display: none;
}
.chat-body {
    height: 100vh;
    overflow: hidden;
    background: #e2e8f0;
}

.chat-page {
    width: min(100%, 900px);
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 40px rgb(15 23 42 / 12%);
}

.room-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    color: white;
    background:
        linear-gradient(
            135deg,
            #4f46e5,
            #7c3aed
        );
}

.room-back-button {
    width: 42px;
    height: 42px;
    display: flex;
    flex: 0 0 auto;
    justify-content: center;
    align-items: center;
    color: white;
    border-radius: 50%;
    font-size: 38px;
    line-height: 1;
    text-decoration: none;
}

.room-back-button:hover {
    background: rgb(255 255 255 / 12%);
}

.room-header-info {
    min-width: 0;
    flex: 1;
}

.room-header-info h1 {
    margin: 0;
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-header-info p {
    margin: 4px 0 0;
    font-size: 11px;
    opacity: 0.78;
}

.room-username {
    max-width: 150px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-area {
    overflow-y: auto;
    padding: 22px;
    background:
        radial-gradient(
            circle at top left,
            #eef2ff,
            transparent 40%
        ),
        #f8fafc;
}

.message-loading {
    padding: 30px;
    color: #94a3b8;
    text-align: center;
}

.message-row {
    display: flex;
    margin-bottom: 13px;
}

.message-mine {
    justify-content: flex-end;
}

.message-other {
    justify-content: flex-start;
}

.message-bubble {
    max-width: min(75%, 560px);
    padding: 10px 14px 8px;
    border-radius: 18px;
    overflow-wrap: anywhere;
    box-shadow: 0 4px 12px rgb(15 23 42 / 5%);
}

.message-mine .message-bubble {
    color: white;
    border-bottom-right-radius: 5px;
    background:
        linear-gradient(
            135deg,
            #4f46e5,
            #6366f1
        );
}

.message-other .message-bubble {
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 5px;
    background: white;
}

.message-username {
    margin-bottom: 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.message-text {
    font-size: 15px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.message-time {
    display: block;
    margin-top: 5px;
    font-size: 9px;
    text-align: right;
    opacity: 0.65;
}

.chat-error {
    padding: 9px 16px;
    color: #991b1b;
    border-top: 1px solid #fecaca;
    background: #fef2f2;
    font-size: 12px;
    text-align: center;
}

.message-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    background: white;
}

.message-form textarea {
    min-height: 46px;
    max-height: 140px;
    flex: 1;
    padding: 12px 15px;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    background: #f8fafc;
    font: inherit;
    line-height: 1.45;
    outline: none;
}

.message-form textarea:focus {
    border-color: #6366f1;
    background: white;
    box-shadow:
        0 0 0 4px rgb(99 102 241 / 10%);
}

.message-form button {
    min-width: 72px;
    height: 46px;
    padding: 0 17px;
    color: white;
    border: 0;
    border-radius: 23px;
    background: #4f46e5;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.message-form button:hover {
    background: #4338ca;
}

.message-form button:disabled {
    cursor: wait;
    opacity: 0.55;
}

@media (max-width: 600px) {
    .message-area {
        padding: 14px 11px;
    }

    .message-bubble {
        max-width: 86%;
    }

    .room-username {
        display: none;
    }

    .message-form {
        padding: 10px;
    }

    .message-form button {
        min-width: 60px;
        padding: 0 12px;
    }
}