* {
    box-sizing: border-box;
}

:root {
    --auth-bg: #fff4ec;
    --auth-surface: rgba(255, 255, 255, 0.76);
    --auth-surface-strong: rgba(255, 255, 255, 0.9);
    --auth-surface-soft: rgba(255, 244, 236, 0.78);
    --auth-panel: #fff7f0;
    --auth-brand: #ff5b12;
    --auth-brand-soft: #ff8a2f;
    --auth-brand-light: #ffc978;
    --auth-text: #27213e;
    --auth-muted: #757496;
    --auth-border: rgba(255, 117, 38, 0.16);
    --auth-border-strong: rgba(255, 117, 38, 0.28);
    --auth-danger-bg: rgba(255, 241, 242, 0.92);
    --auth-danger-border: #fecaca;
    --auth-danger-text: #b91c1c;
    --auth-shadow: 0 26px 70px rgba(111, 49, 17, 0.16);
}

html[data-theme='dark'] {
    --auth-bg: #17111f;
    --auth-surface: rgba(31, 41, 55, 0.76);
    --auth-surface-strong: rgba(31, 41, 55, 0.9);
    --auth-surface-soft: rgba(67, 39, 24, 0.72);
    --auth-panel: #18111f;
    --auth-brand: #fb923c;
    --auth-brand-soft: #f97316;
    --auth-brand-light: #fdba74;
    --auth-text: #fff7ed;
    --auth-muted: #d6d3e6;
    --auth-border: rgba(251, 146, 60, 0.22);
    --auth-border-strong: rgba(251, 146, 60, 0.34);
    --auth-danger-bg: #3f1d24;
    --auth-danger-border: #7f1d1d;
    --auth-danger-text: #fecaca;
    --auth-shadow: 0 28px 72px rgba(0, 0, 0, 0.34);
}

html,
body {
    min-height: 100%;
}

body.auth-page {
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    font-family: "Be Vietnam Pro", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at 76% 78%, rgba(226, 192, 255, 0.38) 0, transparent 30%),
        radial-gradient(circle at 64% 36%, rgba(255, 150, 88, 0.18) 0, transparent 32%),
        linear-gradient(90deg, #ff5a0a 0%, #ff8b27 49.8%, #fff7f0 49.9%, #fff8f2 100%);
    color: var(--auth-text);
}

.login-shell {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(420px, 1fr);
}

.auth-theme-toggle {
    position: fixed;
    top: 52px;
    right: 48px;
    z-index: 20;
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255, 117, 38, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    color: #f59e0b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 18px 42px rgba(111, 49, 17, 0.12);
    backdrop-filter: blur(18px);
}

.theme-toggle-icon {
    font-size: 20px;
    line-height: 1;
}

.login-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px;
    overflow: hidden;
    color: #ffffff;
    background:
        radial-gradient(circle at 68% 40%, rgba(255, 201, 120, 0.72) 0, transparent 24%),
        linear-gradient(135deg, #ff4f00 0%, #ff7b16 55%, #ffb45c 100%);
}

.login-brand::before,
.login-brand::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
}

.login-brand::before {
    width: 92%;
    height: 52%;
    left: -20%;
    bottom: -10%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    transform: rotate(12deg);
}

.login-brand::after {
    width: 120%;
    height: 72%;
    left: -26%;
    bottom: -24%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: rotate(10deg);
}

.login-brand-glow {
    position: absolute;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(36px);
}

.login-brand-glow-one {
    width: 220px;
    height: 220px;
    right: 16%;
    top: 34%;
    background: rgba(255, 201, 91, 0.62);
}

.login-brand-glow-two {
    width: 360px;
    height: 180px;
    right: -60px;
    bottom: 14%;
    background: rgba(255, 220, 158, 0.34);
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-logo-box {
    width: min(330px, 100%);
    aspect-ratio: 1.48 / 1;
    margin: 0 auto 42px;
    border-radius: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 24px 70px rgba(111, 49, 17, 0.14);
    backdrop-filter: blur(10px);
}

.login-logo-box img {
    width: min(250px, 78%);
    height: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.login-logo-fallback {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    letter-spacing: 0.06em;
}

.login-tagline {
    margin: 0;
    font-size: clamp(18px, 2.1vw, 26px);
    line-height: 1.6;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.94);
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100dvh;
    overflow: hidden;
    padding: clamp(34px, 6vh, 64px) clamp(34px, 5vw, 64px);
    background:
        radial-gradient(circle at 74% 70%, rgba(222, 187, 255, 0.34) 0, transparent 34%),
        radial-gradient(circle at 42% 44%, rgba(255, 122, 64, 0.12) 0, transparent 30%),
        rgba(255, 248, 242, 0.82);
}

.login-form-wrap {
    width: min(520px, 100%);
    max-height: calc(100dvh - 68px);
    overflow: hidden;
    padding: clamp(24px, 4vh, 42px);
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.56);
    box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(22px);
}

.login-title {
    margin: 0 0 30px;
    font-size: clamp(32px, 4vw, 44px);
    line-height: 1.15;
    font-weight: 800;
    color: var(--auth-brand);
}

.login-alert {
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid var(--auth-danger-border);
    border-radius: 14px;
    background: var(--auth-danger-bg);
    color: var(--auth-danger-text);
    font-size: 14px;
    line-height: 1.5;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--auth-text);
}

.login-input-wrap {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    border: 1px solid rgba(39, 33, 62, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 12px 26px rgba(111, 49, 17, 0.06);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-input-wrap:focus-within {
    border-color: rgba(255, 91, 18, 0.46);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(255, 91, 18, 0.12), 0 14px 28px rgba(111, 49, 17, 0.08);
}

.login-input-wrap i {
    width: 20px;
    color: var(--auth-brand);
    font-size: 17px;
    text-align: center;
    flex: 0 0 20px;
}

.login-field input[type="email"],
.login-field input[type="password"],
.login-field input[type="text"] {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--auth-text);
    font: inherit;
    font-size: 17px;
}

.login-field input::placeholder {
    color: var(--auth-muted);
}

.login-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 24px;
    color: var(--auth-muted);
    font-size: 17px;
    cursor: pointer;
}

.login-toggle input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--auth-brand);
    cursor: pointer;
}

.login-submit,
.auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 60px;
    padding: 14px 18px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-soft) 100%);
    color: #ffffff;
    font-size: 19px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 16px 34px rgba(255, 91, 18, 0.22);
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.login-submit:hover,
.auth-link:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
    box-shadow: 0 20px 38px rgba(255, 91, 18, 0.28);
}

.demo-account-card {
    margin-top: 22px;
    padding: 20px 22px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 18px;
    background: rgba(255, 247, 237, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 12px 28px rgba(111, 49, 17, 0.08);
}

.demo-account-title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 800;
    color: var(--auth-brand);
}

.demo-account-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.demo-account-row + .demo-account-row {
    margin-top: 12px;
}

.demo-account-label {
    color: var(--auth-muted);
    font-size: 16px;
}

.demo-account-value {
    color: var(--auth-text);
    font-size: 16px;
    word-break: break-word;
    text-align: right;
}

.forbidden-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--auth-surface-soft);
}

.forbidden-card {
    width: min(460px, 100%);
    padding: 28px;
    background: var(--auth-surface-strong);
    border: 1px solid var(--auth-border-strong);
    border-radius: 18px;
    text-align: center;
    box-shadow: var(--auth-shadow);
}

.forbidden-title {
    margin: 0 0 12px;
    font-size: 28px;
}

.forbidden-message {
    margin: 0 0 18px;
    line-height: 1.6;
    color: var(--auth-muted);
}

html[data-theme='dark'] body.auth-page {
    background:
        radial-gradient(circle at 76% 78%, rgba(126, 76, 168, 0.28) 0, transparent 30%),
        radial-gradient(circle at 64% 36%, rgba(251, 146, 60, 0.12) 0, transparent 32%),
        linear-gradient(90deg, #7c2d12 0%, #9a3412 49.8%, #18111f 49.9%, #17111f 100%);
}

html[data-theme='dark'] .login-brand {
    background:
        radial-gradient(circle at 68% 40%, rgba(253, 186, 116, 0.38) 0, transparent 24%),
        linear-gradient(135deg, #7c2d12 0%, #c2410c 62%, #fb923c 100%);
}

html[data-theme='dark'] .auth-theme-toggle,
html[data-theme='dark'] .login-form-wrap,
html[data-theme='dark'] .login-input-wrap,
html[data-theme='dark'] .demo-account-card {
    border-color: rgba(251, 146, 60, 0.24);
}

html[data-theme='dark'] .login-panel {
    background:
        radial-gradient(circle at 74% 70%, rgba(126, 76, 168, 0.26) 0, transparent 34%),
        radial-gradient(circle at 42% 44%, rgba(251, 146, 60, 0.12) 0, transparent 30%),
        rgba(23, 17, 31, 0.92);
}

@media (max-width: 1100px) {
    .auth-theme-toggle {
        top: 24px;
        right: 24px;
    }

    .login-panel {
        padding: 44px 32px;
    }

    .login-brand {
        padding: 40px;
    }
}

@media (max-width: 860px) {
    body.auth-page {
        background:
            radial-gradient(circle at 50% 10%, rgba(255, 150, 88, 0.26) 0, transparent 34%),
            linear-gradient(180deg, #fff4ec 0%, #fff8f2 100%);
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand {
        display: none;
    }

    .login-logo-box {
        width: min(270px, 86vw);
        margin-bottom: 22px;
        border-radius: 28px;
    }

    .login-panel {
        height: 100dvh;
        min-height: 0;
        padding: 18px;
    }

    .login-form-wrap {
        max-height: calc(100dvh - 36px);
        padding: 22px 18px;
        border-radius: 22px;
    }

    .auth-theme-toggle {
        top: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .demo-account-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .demo-account-value {
        text-align: left;
    }
}

@media (max-width: 520px) {
    .login-title {
        margin-bottom: 22px;
        font-size: 28px;
    }

    .login-field {
        margin-bottom: 16px;
    }

    .login-input-wrap {
        min-height: 54px;
        border-radius: 16px;
    }

    .login-toggle {
        margin-bottom: 18px;
        font-size: 15px;
    }

    .login-submit,
    .auth-link {
        min-height: 56px;
        font-size: 17px;
    }

    .demo-account-card {
        margin-top: 16px;
        padding: 16px;
    }
}

@media (max-height: 760px) {
    .auth-theme-toggle {
        top: 18px;
        right: 24px;
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }

    .login-logo-box {
        width: min(280px, 82%);
        margin-bottom: 28px;
    }

    .login-tagline {
        font-size: 20px;
    }

    .login-form-wrap {
        width: min(500px, 100%);
        padding: 24px 32px;
    }

    .login-title {
        margin-bottom: 18px;
        font-size: 34px;
    }

    .login-field {
        margin-bottom: 14px;
    }

    .login-field label {
        margin-bottom: 7px;
        font-size: 14px;
    }

    .login-input-wrap {
        min-height: 48px;
        border-radius: 15px;
    }

    .login-toggle {
        margin: 2px 0 16px;
        font-size: 14px;
    }

    .login-submit,
    .auth-link {
        min-height: 50px;
        font-size: 17px;
    }

    .demo-account-card {
        margin-top: 16px;
        padding: 14px 18px;
    }

    .demo-account-title {
        margin-bottom: 10px;
        font-size: 16px;
    }

    .demo-account-row + .demo-account-row {
        margin-top: 7px;
    }

    .demo-account-label,
    .demo-account-value {
        font-size: 14px;
    }
}

.login-alert.is-success {
    border-color: rgba(34, 197, 94, 0.28);
    background: rgba(240, 253, 244, 0.94);
    color: #166534;
}

html[data-theme='dark'] .login-alert.is-success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(20, 83, 45, 0.34);
    color: #bbf7d0;
}

.login-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 24px;
}

.login-meta-row .login-toggle {
    margin: 0;
}

.auth-text-link {
    color: var(--auth-brand);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
}

.auth-text-link:hover {
    color: var(--auth-brand-soft);
}

.auth-helper-copy {
    margin: -6px 0 20px;
    color: var(--auth-muted);
    font-size: 15px;
    line-height: 1.65;
}

.auth-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: 18px;
}

@media (max-width: 720px) {
    .login-meta-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-actions-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
