:root {
    --manusa-brand: #4256f9;
    --manusa-brand-dark: #142457;
    --manusa-text: #142457;
    --manusa-muted: #74747b;
    --manusa-border: #142457;
    --manusa-danger: #c73535;
    --manusa-success: #248a57;
    --manusa-white: #ffffff;
    --manusa-page: #f6f7fb;
    --radius-field: 4px;
    --radius-pill: 800px;
    --shadow-panel: 0 24px 64px rgba(20, 36, 87, 0.18);
    --font-auth: Raleway, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-auth);
    color: var(--manusa-text);
    background: linear-gradient(135deg, #142457 0%, #4256f9 100%);
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.auth-page {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background-color: var(--manusa-page);
}

.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(20, 36, 87, 0.16)),
        image-set(
            url("/static/auth-background-1440.avif") type("image/avif") 1x,
            url("/static/auth-background-2560.avif") type("image/avif") 2x
        );
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.auth-page-password::before {
    background-image:
        linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(20, 36, 87, 0.16)),
        image-set(
            url("/static/password-background-1440.avif") type("image/avif") 1x,
            url("/static/password-background-2560.avif") type("image/avif") 2x
        );
    background-position: center, 84% 58%;
    background-size: cover, max(119vw, 167vh) auto;
}

.auth-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 90px;
    overflow: hidden;
}

.auth-panel {
    width: min(550px, calc(100vw - 48px));
    height: min(844px, calc(100vh - 180px));
    height: min(844px, calc(100dvh - 180px));
    min-height: 0;
    background: var(--manusa-white);
    box-shadow: var(--shadow-panel);
    padding: 62px 93px 44px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.auth-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-brand-mark {
    width: 65px;
    height: 65px;
    object-fit: contain;
}

.auth-header {
    text-align: center;
    margin-bottom: 54px;
}

.auth-title {
    margin: 0;
    color: var(--manusa-brand-dark);
    font-size: 24px;
    line-height: 28px;
    font-weight: 700;
    letter-spacing: 0;
    text-align: center;
}

.auth-subtitle {
    margin: 12px auto 0;
    max-width: 328px;
    color: var(--manusa-muted);
    font-size: 16px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0;
    text-align: center;
}

.auth-subtitle.is-hidden {
    display: none;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.auth-form.is-hidden,
.register-step.is-hidden {
    display: none;
}

.auth-field {
    position: relative;
}

.form-input {
    width: 100%;
    height: 56px;
    padding: 17px 16px 15px;
    border: 1px solid var(--manusa-border);
    border-radius: var(--radius-field);
    color: var(--manusa-text);
    background: var(--manusa-white);
    font-size: 16px;
    line-height: 20px;
    font-weight: 500;
    letter-spacing: 0;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-input::placeholder {
    color: var(--manusa-muted);
    opacity: 1;
}

.form-input:focus {
    border: 3px solid var(--manusa-brand);
    padding: 15px 14px 13px;
    box-shadow: 0 0 0 3px rgba(66, 86, 249, 0.12);
}

.form-input[readonly] {
    color: var(--manusa-muted);
    background: #f7f8ff;
}

.form-label {
    position: absolute;
    top: -8px;
    left: 12px;
    padding: 0 4px;
    border-radius: var(--radius-field);
    color: var(--manusa-brand);
    background: var(--manusa-white);
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    letter-spacing: 0;
    pointer-events: none;
}

.auth-field-password .form-input {
    padding-right: 58px;
}

.auth-field-password .form-input:focus {
    padding-right: 56px;
}

.password-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:focus-visible {
    outline: 2px solid var(--manusa-brand);
    outline-offset: 2px;
}

.password-toggle-icon {
    position: relative;
    width: 22px;
    height: 14px;
    border: 2px solid var(--manusa-muted);
    border-radius: 999px / 720px;
}

.password-toggle-icon::after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    left: 50%;
    top: 50%;
    border-radius: 50%;
    background: var(--manusa-muted);
    transform: translate(-50%, -50%);
}

.password-toggle.is-visible .password-toggle-icon::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 5px;
    width: 29px;
    height: 2px;
    background: var(--manusa-muted);
    transform: rotate(-35deg);
}

.auth-link-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--manusa-muted);
    font-size: 14px;
    line-height: 16px;
    font-weight: 500;
    text-align: center;
}

.auth-link-row-start {
    justify-content: flex-start;
    margin-top: -4px;
}

.auth-link {
    color: var(--manusa-muted);
    text-decoration: underline;
    text-underline-position: from-font;
    font-size: 14px;
    line-height: 16px;
    font-weight: 500;
}

.auth-link:hover,
.auth-link:focus-visible {
    color: var(--manusa-brand);
}

.auth-link-muted {
    color: var(--manusa-muted);
}

.auth-link-standalone {
    display: inline-flex;
    justify-content: center;
    margin-top: 2px;
}

.auth-button {
    min-height: 44px;
    width: 100%;
    max-width: 328px;
    align-self: center;
    border: 0;
    border-radius: var(--radius-pill);
    padding: 12px 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    letter-spacing: 0;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.auth-button-primary {
    background: var(--manusa-brand);
    color: var(--manusa-white);
    box-shadow: 0 10px 22px rgba(66, 86, 249, 0.22);
}

.auth-button-secondary {
    margin-top: -10px;
    color: var(--manusa-brand);
    background: rgba(66, 86, 249, 0.09);
}

.auth-button-ghost {
    color: var(--manusa-brand-dark);
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(20, 36, 87, 0.28);
}

.auth-button:hover:not(:disabled),
.auth-button:focus-visible:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(66, 86, 249, 0.26);
}

.auth-button-secondary:hover:not(:disabled),
.auth-button-secondary:focus-visible:not(:disabled),
.auth-button-ghost:hover:not(:disabled),
.auth-button-ghost:focus-visible:not(:disabled) {
    box-shadow: inset 0 0 0 1px var(--manusa-brand), 0 10px 22px rgba(20, 36, 87, 0.12);
}

.auth-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.auth-terms {
    margin-top: auto;
    padding-top: 152px;
    text-align: center;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
}

.auth-alert-icon {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--manusa-white);
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
}

.auth-alert-error {
    color: #7d2020;
    background: #fff0f0;
    border: 1px solid rgba(199, 53, 53, 0.26);
}

.auth-alert-error .auth-alert-icon,
.auth-state-icon-error {
    background: var(--manusa-danger);
}

.auth-alert-success {
    color: #1f6a45;
    background: #effaf4;
    border: 1px solid rgba(36, 138, 87, 0.24);
}

.auth-alert-success .auth-alert-icon,
.auth-state-icon-success {
    background: var(--manusa-success);
}

.loading {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-top-color: var(--manusa-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.step-progress {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: -20px 0 4px;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d8dcff;
}

.step-dot.active {
    background: var(--manusa-brand);
}

.step-dot.completed {
    background: var(--manusa-success);
}

.register-step {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.auth-step-title,
.auth-help {
    margin: 0;
    color: var(--manusa-muted);
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
}

.auth-step-title {
    color: var(--manusa-brand-dark);
    text-align: center;
}

.auth-help-centered {
    text-align: center;
}

.verification-input {
    text-align: center;
    font-size: 22px;
    letter-spacing: 0.28em;
    font-weight: 700;
}

.verification-input::placeholder {
    font-size: 16px;
    letter-spacing: 0;
    font-weight: 500;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--manusa-muted);
    font-size: 14px;
    line-height: 18px;
    font-weight: 500;
}

.form-checkbox {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--manusa-brand);
}

.auth-state {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
}

.auth-state-centered {
    justify-content: center;
    gap: 24px;
    min-height: 560px;
}

.auth-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--manusa-white);
    font-size: 34px;
    line-height: 1;
    font-weight: 700;
}

.landing-container {
    width: 100%;
    min-height: 100vh;
    max-width: 500px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.landing-card {
    width: 100%;
    padding: 40px 36px 32px;
    border-radius: 16px;
    background: var(--manusa-white);
    color: var(--manusa-text);
    text-align: center;
    text-decoration: none;
    box-shadow: var(--shadow-panel);
}

.landing-card-static {
    cursor: default;
}

.landing-logo img {
    max-width: 220px;
    height: auto;
}

.landing-title {
    margin: 20px 0 8px;
    color: var(--manusa-brand-dark);
    font-size: 24px;
    line-height: 30px;
}

.landing-tagline {
    margin: 0 0 16px;
    color: var(--manusa-brand);
    font-size: 14px;
    line-height: 18px;
    font-weight: 600;
    text-transform: uppercase;
}

.landing-text {
    margin: 0 0 22px;
    color: var(--manusa-muted);
    font-size: 14px;
    line-height: 22px;
}

.landing-cta {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 22px;
    border-radius: var(--radius-pill);
    color: var(--manusa-white);
    background: var(--manusa-brand);
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    text-decoration: none;
}

.landing-cta-link {
    color: var(--manusa-white);
}

.landing-footnote {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}

@media (max-width: 900px) {
    .auth-page {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .auth-page::before {
        background: var(--manusa-white);
    }

    .auth-shell {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        align-items: stretch;
        justify-content: center;
        padding: 0;
        overflow: visible;
    }

    .auth-panel {
        width: 100%;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        box-shadow: none;
        padding: 88px 32px 24px;
    }

    .auth-header {
        margin-bottom: 54px;
    }

    .auth-form {
        gap: 24px;
    }

    .auth-terms {
        padding-top: 120px;
    }

    .auth-state-centered {
        min-height: 480px;
    }
}

@media (min-width: 1600px) {
    .auth-page::before {
        background-image:
            linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(20, 36, 87, 0.16)),
            image-set(
                url("/static/auth-background-1920.avif") type("image/avif") 1x,
                url("/static/auth-background-2560.avif") type("image/avif") 2x
            );
    }

    .auth-page-password::before {
        background-image:
            linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(20, 36, 87, 0.16)),
            image-set(
                url("/static/password-background-1920.avif") type("image/avif") 1x,
                url("/static/password-background-2560.avif") type("image/avif") 2x
            );
    }
}

@media (min-width: 901px) and (max-width: 1180px) {
    .auth-shell {
        justify-content: center;
        padding: 48px;
    }

    .auth-panel {
        height: min(844px, calc(100vh - 96px));
        height: min(844px, calc(100dvh - 96px));
    }
}

@media (min-width: 901px) and (max-height: 900px) {
    .auth-shell {
        padding-top: 32px;
        padding-bottom: 32px;
    }

    .auth-panel {
        height: calc(100vh - 64px);
        height: calc(100dvh - 64px);
        padding: 36px 72px 28px;
    }

    .auth-brand {
        margin-bottom: 16px;
    }

    .auth-header {
        margin-bottom: 32px;
    }

    .auth-form {
        gap: 18px;
    }

    .auth-terms {
        padding-top: 32px;
    }
}

@media (max-width: 420px) {
    .auth-panel {
        padding: 80px 28px 22px;
    }

    .auth-brand-mark {
        width: 64px;
        height: 64px;
    }

    .auth-title {
        font-size: 24px;
    }

    .auth-button {
        max-width: 100%;
    }

    .auth-terms {
        padding-top: 100px;
    }

    .landing-container {
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}