* {
    box-sizing: border-box;
}

body {
    position: relative;
    margin: 0;
    min-height: 100vh;
    color: #182235;
    background: #07111f;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.auth-photo-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(73, 177, 245, .96), rgba(14, 116, 144, .72)),
        #49b1f5;
    pointer-events: none;
}

.auth-photo-bg .hero-photo-wall,
.auth-photo-bg .hero-photo-grid,
.auth-photo-bg .hero-photo-card {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    pointer-events: none;
}

.auth-photo-bg .hero-photo-card {
    overflow: hidden;
    margin: 0;
    border: 0;
    background: rgba(255, 255, 255, .28);
}

.auth-photo-bg .hero-photo-card:not(:first-child) {
    display: none;
}

.auth-photo-bg img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.08) contrast(1.04);
}

.auth-photo-bg .hero-photo-empty {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background:
        radial-gradient(circle at 22% 20%, rgba(255, 255, 255, .34), transparent 28%),
        linear-gradient(135deg, rgba(73, 177, 245, .98), rgba(14, 116, 144, .78));
    color: rgba(255, 255, 255, .92);
    font-size: 18px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(7, 17, 27, .25);
}

.auth-photo-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(5, 22, 48, .46), rgba(5, 22, 48, .12) 45%, rgba(5, 22, 48, .4)),
        linear-gradient(180deg, rgba(5, 22, 48, .48), rgba(5, 22, 48, .14) 44%, rgba(5, 22, 48, .62));
}

.auth-photo-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 16%, rgba(255, 255, 255, .2), transparent 28%),
        linear-gradient(115deg, rgba(255, 255, 255, .12) 0 1px, transparent 1px 96px);
    opacity: .72;
}

a {
    color: inherit;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    position: relative;
    z-index: 1;
}

.auth-card,
.admin-panel {
    width: min(100%, 460px);
    background: rgba(255, 255, 255, .84);
    border: 1px solid rgba(255, 255, 255, .48);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(7, 17, 27, .28);
    padding: 28px;
    backdrop-filter: blur(18px) saturate(1.08);
}

.auth-card.wide {
    width: min(100%, 920px);
    padding: 0;
    overflow: hidden;
}

.admin-panel {
    width: min(100%, 1180px);
}

.auth-heading h1,
.admin-header h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    color: #111827;
}

.auth-heading h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
}

.auth-heading h1 .fa,
.auth-heading h2 .fa,
.admin-header h1 .fa,
.register-side h1 .fa {
    margin-right: 8px;
    color: #0f766e;
}

.register-side h1 .fa {
    color: #facc15;
}

.auth-heading p,
.admin-header p {
    color: #64748b;
}

.auth-heading.compact p {
    margin-bottom: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: #0f766e;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    font-size: 14px;
    font-weight: 650;
}

label small {
    color: #64748b;
    font-weight: 500;
    line-height: 1.45;
}

.form-control,
.filter-bar input,
.filter-bar select {
    width: 100%;
    border: 1px solid #cfd9e7;
    border-radius: 6px;
    padding: 10px 12px;
    color: #0f172a;
    background: #fff;
    font: inherit;
}

.form-control:focus,
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
    outline: none;
}

.checkbox-field {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: fit-content;
    color: #475569;
    cursor: pointer;
}

.checkbox-field span {
    line-height: 1;
}

.checkbox-input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #2563eb;
}

textarea.form-control {
    resize: vertical;
}

.primary-btn,
.ghost-btn,
.action {
    border: 0;
    border-radius: 6px;
    padding: 11px 16px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.primary-btn {
    background: linear-gradient(135deg, #0f766e, #2563eb);
    color: white;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .25);
}

.primary-btn:hover {
    filter: brightness(1.05);
}

.primary-btn.small {
    padding: 10px 14px;
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d6dce5;
    background: white;
}

.guest-login-form {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.guest-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(15, 118, 110, .24);
    border-radius: 999px;
    background: rgba(240, 253, 250, .88);
    color: #0f766e;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68);
    transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}

.guest-btn:hover {
    transform: translateY(-1px);
    background: #ecfeff;
    box-shadow: 0 12px 24px rgba(15, 118, 110, .16);
}

.guest-login-form small {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    color: #0f766e;
    font-size: 14px;
}

.register-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 590px;
}

.register-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 34px;
    color: white;
    background:
        linear-gradient(145deg, rgba(10, 18, 34, .86), rgba(15, 118, 110, .76));
}

.register-side h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.15;
}

.register-side p {
    color: rgba(255, 255, 255, .82);
    line-height: 1.8;
}

.register-side .eyebrow {
    color: #facc15;
}

.review-steps {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.review-steps span {
    display: block;
    padding: 10px 12px;
    border-left: 3px solid #facc15;
    background: rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .92);
    font-size: 14px;
}

.register-main {
    padding: 34px;
    background: rgba(255, 255, 255, .9);
}

.auth-links.single {
    justify-content: flex-start;
}

.field-error,
.form-errors {
    color: #b91c1c;
}

.form-errors ul {
    margin: 0;
    padding-left: 18px;
}

.messages {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(90vw, 520px);
    z-index: 10;
}

.message {
    margin-bottom: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #eef6ff;
    color: #1e3a8a;
    box-shadow: 0 8px 30px rgba(15, 23, 42, .18);
}

.admin-header,
.admin-actions,
.stats-row,
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-header {
    justify-content: space-between;
    margin-bottom: 22px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 16px;
}

.stat-card {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    text-decoration: none;
}

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

.stat-card strong {
    font-size: 24px;
}

.filter-bar {
    margin-bottom: 16px;
}

.filter-bar input {
    flex: 1;
}

.permission-panel {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: rgba(248, 250, 252, .86);
}

.permission-head h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #0f172a;
    font-size: 20px;
}

.permission-head h2 .fa {
    color: #0f766e;
}

.permission-head p {
    margin: 6px 0 14px;
    color: #64748b;
}

.permission-grid {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(110px, .6fr) minmax(110px, .6fr);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
}

.permission-grid > * {
    padding: 11px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.permission-grid > *:nth-last-child(-n + 3) {
    border-bottom: 0;
}

.permission-grid-head {
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 900;
}

.permission-entry {
    color: #0f172a;
    font-weight: 900;
}

.permission-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.permission-check input {
    width: 16px;
    height: 16px;
    accent-color: #0f766e;
}

.permission-save {
    margin-top: 12px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.user-table th,
.user-table td {
    padding: 13px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

.user-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
}

.user-table span,
.user-table small {
    display: block;
    color: #64748b;
    margin-top: 4px;
}

.user-table p {
    max-width: 340px;
    margin: 8px 0 0;
    color: #334155;
    white-space: pre-line;
}

.status-pill {
    display: inline-block !important;
    width: fit-content;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-pending {
    color: #92400e !important;
    background: #fef3c7;
}

.status-approved {
    color: #166534 !important;
    background: #dcfce7;
}

.status-rejected,
.status-suspended {
    color: #991b1b !important;
    background: #fee2e2;
}

.inline-form {
    display: inline;
}

.role-form {
    display: grid;
    gap: 8px;
    min-width: 116px;
}

.role-form select {
    width: 100%;
    border: 1px solid #cfd9e7;
    border-radius: 6px;
    padding: 8px 9px;
    color: #0f172a;
    background: #fff;
    font: inherit;
}

.action {
    margin: 0 4px 6px 0;
    padding: 7px 10px;
    font-size: 13px;
}

.action.approve {
    background: #16a34a;
    color: white;
}

.action.reject {
    background: #ef4444;
    color: white;
}

.action.suspend {
    background: #475569;
    color: white;
}

.action.role {
    width: fit-content;
    margin: 0;
    background: #0f766e;
    color: white;
}

.empty-state {
    text-align: center !important;
    color: #64748b;
}

@media (max-width: 760px) {
    .grid-form,
    .stats-row {
        grid-template-columns: 1fr;
    }

    .register-layout {
        grid-template-columns: 1fr;
    }

    .register-side {
        min-height: 260px;
        padding: 28px;
    }

    .register-main {
        padding: 26px 20px;
    }

    .admin-header,
    .filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .permission-grid {
        grid-template-columns: 1fr;
    }

    .permission-grid > * {
        border-bottom: 1px solid #e2e8f0;
    }

    .admin-actions {
        width: 100%;
    }

    .ghost-btn {
        flex: 1;
    }
}

@media (max-width: 760px) {
    body {
        overflow-x: hidden;
    }

    .auth-shell {
        padding: 18px 10px 24px;
    }

    .auth-card,
    .admin-panel {
        padding: 18px 14px;
        border-radius: 16px;
    }

    .auth-card.wide {
        width: 100%;
    }

    .auth-heading h1,
    .admin-header h1 {
        font-size: 24px;
    }

    .auth-form {
        gap: 12px;
    }

    .grid-form,
    .stats-row,
    .register-layout {
        grid-template-columns: 1fr;
    }

    .register-side {
        min-height: 220px;
        padding: 20px 16px;
    }

    .register-main {
        padding: 18px 14px;
    }

    .admin-header,
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .admin-actions {
        width: 100%;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .ghost-btn,
    .action.role {
        flex: 1 1 calc(50% - 4px);
    }

    .permission-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .auth-card,
    .admin-panel {
        padding: 16px 12px;
    }

    .auth-heading h1,
    .admin-header h1 {
        font-size: 22px;
    }

    .checkbox-field {
        width: 100%;
    }
}

.captcha-question {
    display: block;
    margin-top: 2px;
    padding: 9px 12px;
    border: 1px solid #cfd9e7;
    border-radius: 6px;
    background: rgba(15, 118, 110, .08);
    color: #0f766e;
    font-weight: 800;
}

.guest-login-form {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.guest-login-form .form-control {
    margin-top: 2px;
}
