.auth-page {
    margin: 0;
    color: var(--color-text-primary);
    font-family: var(--body-font);
    font-size: 16px;
    font-weight: var(--font-weight-regular);
    line-height: 1.3;
    -webkit-font-smoothing: antialiased;
    background: var(--color-background);
}

html.auth-page:not(.fonts-ready) body {
    visibility: hidden;
}

html.auth-page,
body.auth-page {
    height: 100dvh;
    overflow: hidden;
}

.auth-start {
    height: 100dvh;
    overflow: hidden;
    background: var(--color-background);
}

.auth-main {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.auth-hero,
.auth-form-panel {
    box-sizing: border-box;
    min-width: 0;
}

.auth-hero {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: clamp(24px, 8vh, 80px) clamp(24px, 8vw, 148px);
    background: var(--color-marketing-bg);
    overflow: hidden;
}

@media (min-width: 1024px) {
    .auth-main {
        flex-direction: row;
        align-items: stretch;
    }

    .auth-hero {
        display: flex;
    }

    .auth-hero,
    .auth-form-panel {
        flex: 0 0 50%;
        width: 50%;
        max-width: 50%;
        height: 100%;
        min-height: 0;
    }
}

#auth-hero {
    position: relative;
    overflow: hidden;
}

@media (min-width: 1024px) {
    #auth-hero:not(.auth-hero-ready) {
        visibility: hidden;
    }
}

#auth-hero > * {
    position: relative;
    z-index: 1;
}

.auth-intro {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 4vh, 32px);
    width: 100%;
    max-width: 480px;
}

.auth-heading {
    margin: 0;
    font-family: var(--display-font);
    font-size: clamp(32px, 5vw, 56px);
    font-weight: var(--font-weight-regular);
    line-height: 1.1;
    letter-spacing: -0.05em;
    color: var(--color-text-heading);
}

.auth-hero .auth-heading {
    display: inline;
    line-height: 1.2;
    padding: 0.45em 0.75em;
    background: var(--color-accent);
    color: var(--color-on-accent);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.auth-form-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: clamp(24px, 5vh, 48px) 24px clamp(12px, 2vh, 24px);
    background: var(--color-background);
}

.auth-form-panel-body {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .auth-form-panel {
        padding: clamp(32px, 8vh, 120px) 48px clamp(16px, 3vh, 40px);
        border-left: 1px solid var(--color-border);
    }
}

.auth-form-wrap {
    width: 100%;
    max-width: 427px;
    max-height: 100%;
}

@media (max-height: 700px) {
    .auth-form {
        gap: 12px;
    }

    .auth-divider {
        margin: 4px 0;
    }

    .auth-signin-link {
        margin-top: 12px;
    }
}

@media (max-height: 600px) {
    .auth-form-panel {
        padding: 16px 20px;
    }

    .auth-form {
        gap: 10px;
    }

    .auth-button-outline,
    .auth-button-solid {
        height: 36px;
    }
}

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

.auth-form-lead {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-text-muted);
}

.auth-fields-row {
    display: flex;
    gap: 16px;
}

.auth-fields-row > .auth-field-block {
    flex: 1;
    min-width: 0;
}

.auth-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.auth-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--color-accent-soft);
    color: var(--color-text-heading);
    font-family: var(--mono-font);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.04em;
    overflow: hidden;
}

.auth-avatar--image {
    background: var(--color-hairline);
}

.auth-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-avatar-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.auth-avatar-upload {
    width: auto;
    min-width: 7rem;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

.auth-ghost-link {
    display: inline-block;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font-family: var(--body-font);
    font-size: 12px;
    color: var(--color-text-heading);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.auth-ghost-link:hover {
    color: var(--color-primary-hover);
}

@media (max-width: 479px) {
    .auth-fields-row {
        flex-direction: column;
    }
}

.auth-social-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.auth-button-outline,
.auth-button-solid,
.auth-field-block {
    width: 100%;
}

.auth-button-outline,
.auth-button-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.auth-button-outline {
    border: 1px solid var(--color-border);
    background: var(--color-button-secondary-bg);
    color: var(--color-text-primary);
    font-family: var(--button-font-family);
    font-size: var(--button-font-size);
    font-weight: var(--button-font-weight);
    line-height: var(--button-line-height);
    letter-spacing: var(--button-letter-spacing);
    text-transform: uppercase;
}

.auth-button-outline:hover:not(:disabled) {
    background: var(--color-surface);
}

.auth-button-outline:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.auth-button-solid {
    background: var(--color-button-primary-bg);
    color: var(--color-button-primary-text);
    font-family: var(--button-font-family);
    font-size: var(--button-font-size);
    font-weight: var(--button-font-weight);
    line-height: var(--button-line-height);
    letter-spacing: var(--button-letter-spacing);
    text-transform: uppercase;
}

.auth-button-solid:hover:not(:disabled) {
    background: var(--color-button-primary-bg-hover);
}

.auth-button-solid:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 8px 0;
    color: var(--color-text-muted);
    font-family: var(--brand-font);
    font-size: 14px;
    line-height: 1.3;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* --- Fields (security-textfield parity) ---------------------------------- */

.auth-field-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.auth-field-label {
    display: block;
    font-family: var(--body-font);
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    color: var(--color-text-muted);
}

.auth-textfield {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.auth-textfield:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.auth-textfield-input {
    width: 100%;
    min-height: 40px;
    padding: 0 16px;
    border: none;
    border-radius: 4px;
    background: transparent;
    font-family: var(--body-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: var(--color-text-heading);
    outline: none;
}

.auth-textfield-input::placeholder {
    color: var(--color-text-muted);
}

.auth-password-textfield {
    position: relative;
}

.auth-password-textfield .auth-textfield-input {
    padding-right: 40px;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.auth-password-toggle:hover {
    color: var(--color-text-heading);
}

.auth-password-toggle svg {
    width: 18px;
    height: 18px;
}

.auth-helper-text {
    margin: -4px 0 0;
    font-family: var(--body-font);
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-text-muted);
}

.auth-forgot-link {
    margin: -4px 0 0;
    font-family: var(--body-font);
    font-size: 14px;
    line-height: 1.3;
    text-align: right;
}

.auth-forgot-link a {
    color: var(--color-primary);
    text-decoration: none;
}

.auth-forgot-link a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.auth-signin-link {
    margin: 16px 0 0;
    font-family: var(--body-font);
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
    color: var(--color-text-muted);
}

.auth-signin-link a {
    color: var(--color-primary);
    text-decoration: none;
}

.auth-signin-link a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.auth-legal-footer {
    flex-shrink: 0;
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    padding-top: 16px;
}

.auth-legal-notice {
    margin: 0;
    font-family: var(--body-font);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    color: var(--color-text-muted);
}

.auth-legal-notice a {
    color: var(--color-primary);
    text-decoration: none;
}

.auth-legal-notice a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.auth-flash {
    display: none;
    margin-bottom: 16px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-family: var(--body-font);
    font-size: 14px;
    line-height: 1.5;
}

.auth-flash.is-visible {
    display: block;
}

.auth-flash--error {
    border-color: color-mix(in srgb, var(--color-danger) 45%, transparent);
    background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface));
    color: color-mix(in srgb, var(--color-danger) 80%, var(--palette-black));
}

.auth-flash--success {
    border-color: var(--color-primary);
    background: var(--color-surface-secondary);
    color: var(--color-primary);
}

.hidden {
    display: none !important;
}
