:root {
    --auth-ink: #172033;
    --auth-muted: #667085;
    --auth-border: #d9e0ea;
    --auth-soft: #f4f6f9;
    --auth-blue: #1769e0;
    --auth-blue-dark: #0f56bd;
    --auth-green: #16835a;
    --auth-error: #c63632;
}

.auth-body {
    --auth-input-surface: #ffffff;
    --auth-input-text: #1d293d;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    padding: 0 !important;
    background: #ffffff;
    color: var(--auth-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
}

.auth-body *,
.auth-body *::before,
.auth-body *::after {
    box-sizing: border-box;
    letter-spacing: 0;
}

.page-header {
    display: none;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 8px;
    left: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #ffffff;
    color: var(--auth-blue-dark);
    font-weight: 700;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.auth-topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: max(24px, calc((100vw - 1080px) / 2));
    padding-left: max(24px, calc((100vw - 1080px) / 2));
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #e4e8ef;
}

.auth-brand {
    color: inherit;
    text-decoration: none;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.auth-brand img {
    width: 40px;
    height: 40px;
    display: block;
    border-radius: 8px;
}

.auth-brand-copy {
    display: grid;
    gap: 0;
    line-height: 1.15;
}

.auth-brand-copy strong {
    font-size: 18px;
    font-weight: 750;
    color: #152033;
}

.auth-brand-copy span {
    margin-top: 3px;
    color: #6b7485;
    font-size: 11px;
}

.auth-page {
    width: calc(100% - 48px);
    max-width: 1040px;
    min-height: calc(100svh - 184px);
    margin: 0 auto;
    padding: 56px 0 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
    align-items: center;
    gap: 72px;
}

.auth-story {
    max-width: 500px;
}

.auth-kicker {
    margin: 0 0 14px;
    color: var(--auth-blue);
    font-size: 13px;
    font-weight: 750;
}

.auth-story h1 {
    max-width: 480px;
    margin: 0;
    color: #152033;
    font-size: 40px;
    line-height: 1.24;
    font-weight: 760;
}

.auth-story-copy {
    max-width: 460px;
    margin: 18px 0 0;
    color: #5d687a;
    font-size: 16px;
    line-height: 1.75;
}

.auth-benefits {
    display: grid;
    gap: 18px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
}

.auth-benefits li {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.auth-benefit-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eaf7f1;
    color: var(--auth-green);
}

.auth-benefit-icon svg {
    width: 16px;
    height: 16px;
}

.auth-benefits strong,
.auth-benefits small {
    display: block;
}

.auth-benefits strong {
    color: #283449;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 700;
}

.auth-benefits small {
    margin-top: 2px;
    color: #7a8494;
    font-size: 13px;
    line-height: 1.5;
}

.auth-trust-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 30px 0 0;
    color: #7a8494;
    font-size: 12px;
    line-height: 1.55;
}

.auth-trust-line svg {
    width: 15px;
    height: 15px;
    margin-top: 2px;
    flex: 0 0 auto;
}

.login-card {
    width: 100%;
    padding: 30px 32px 28px;
    background: #ffffff;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(30, 43, 66, 0.10), 0 2px 8px rgba(30, 43, 66, 0.05);
}

.auth-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 26px;
    padding: 4px;
    border-radius: 8px;
    background: #eef2f6;
}

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

.auth-switch-item {
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #738095;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.auth-switch-item.active {
    background: #ffffff;
    color: var(--auth-blue);
    box-shadow: 0 1px 3px rgba(31, 45, 70, 0.12);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: auth-enter 220ms ease-out;
}

.auth-form[hidden],
.auth-step[hidden] {
    display: none !important;
}

@keyframes auth-enter {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-form-head {
    margin-bottom: 24px;
}

.auth-form-head-with-back {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
}

.auth-form-title {
    margin: 0;
    color: #1d293d;
    font-size: 22px;
    line-height: 1.35;
    font-weight: 750;
}

.auth-form-sub {
    margin: 6px 0 0;
    color: #727d8e;
    font-size: 13px;
    line-height: 1.5;
}

.icon-back-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    margin: -4px 0 0 -6px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #5e697a;
    cursor: pointer;
}

.icon-back-btn svg {
    width: 20px;
    height: 20px;
}

.form-group {
    margin: 0 0 16px;
}

.form-group > label,
.field-head label {
    display: block;
    color: #344054;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 700;
}

.field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 7px;
}

.auth-field-action {
    display: flex;
    justify-content: flex-end;
    min-height: 20px;
    margin-top: 8px;
}

.form-group > label {
    margin-bottom: 7px;
}

.label-hint {
    color: #8a94a4;
    font-size: 12px;
    font-weight: 500;
}

.field-hint {
    margin: -3px 0 7px;
    color: #818b9a;
    font-size: 12px;
    line-height: 1.45;
}

.input-wrapper {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid #cfd7e3;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.input-wrapper:focus-within {
    border-color: var(--auth-blue);
    box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.input-wrapper.is-invalid {
    border-color: var(--auth-error);
    box-shadow: 0 0 0 3px rgba(198, 54, 50, 0.10);
}

.input-icon {
    width: 19px;
    height: 19px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: #8792a4;
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.input-wrapper:focus-within .input-icon {
    color: var(--auth-blue);
}

.auth-body .form-input {
    width: auto;
    min-width: 0;
    min-height: 0;
    height: 48px;
    flex: 1 1 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    color: var(--auth-input-text);
    font: inherit;
    font-size: 15px;
    box-shadow: none;
    transition: none;
}

.auth-body .form-input:focus {
    border: 0;
    outline: 0;
    box-shadow: none;
}

.auth-body .form-input:autofill,
.auth-body .form-input:-webkit-autofill,
.auth-body .form-input:-webkit-autofill:hover,
.auth-body .form-input:-webkit-autofill:focus {
    background-color: transparent;
    -webkit-text-fill-color: var(--auth-input-text);
    caret-color: var(--auth-input-text);
    -webkit-box-shadow: 0 0 0 1000px var(--auth-input-surface) inset;
    box-shadow: 0 0 0 1000px var(--auth-input-surface) inset;
}

html.site-theme-dark body.auth-body {
    --auth-input-surface: var(--surface);
    --auth-input-text: var(--text);
}

.auth-body .form-input::placeholder {
    color: #9aa4b3;
}

.forgot-pwd-link,
.auth-flow-prompt button,
.back-link,
.auth-email-summary button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--auth-blue);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.form-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 2px;
    padding: 0 18px;
    border: 1px solid var(--auth-blue);
    border-radius: 8px;
    background: var(--auth-blue);
    color: #ffffff;
    font: inherit;
    font-size: 15px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(23, 105, 224, 0.18);
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.form-btn:disabled {
    border-color: #a9b8ce;
    background: #a9b8ce;
    box-shadow: none;
    cursor: wait;
}

.auth-oauth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: #94a3b8;
    font-size: 12px;
}

.auth-oauth-divider::before,
.auth-oauth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.afdian-login-btn {
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid #8156d8;
    border-radius: 6px;
    background: #ffffff;
    color: #6340ad;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.afdian-login-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 5px;
}

.afdian-login-btn:disabled {
    cursor: wait;
    opacity: 0.65;
}

.auth-flow-prompt {
    margin: 18px 0 0;
    color: #6f7a8b;
    text-align: center;
    font-size: 13px;
}

.auth-flow-prompt button {
    margin-left: 4px;
}

.back-link {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 13px auto 0;
    color: #6c7788;
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
}

.msg {
    min-height: 22px;
    margin: 2px 0 8px;
    font-size: 13px;
    line-height: 1.5;
}

.msg:empty {
    min-height: 10px;
    margin-bottom: 6px;
}

.msg.error {
    color: var(--auth-error);
}

.msg.success {
    color: var(--auth-green);
}

.auth-stepper {
    display: grid;
    grid-template-columns: max-content minmax(24px, 1fr) max-content;
    align-items: center;
    gap: 10px;
    margin: -5px 0 24px;
}

.auth-stepper-item {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #8a94a4;
}

.auth-stepper-item span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid #cbd3df;
    border-radius: 50%;
    background: #ffffff;
    font-size: 12px;
    font-weight: 750;
}

.auth-stepper-item strong {
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.auth-stepper-item.active,
.auth-stepper-item.complete {
    color: var(--auth-blue);
}

.auth-stepper-item.active span {
    border-color: var(--auth-blue);
    background: var(--auth-blue);
    color: #ffffff;
}

.auth-stepper-item.complete span {
    border-color: #9ac8b4;
    background: #eaf7f1;
    color: var(--auth-green);
}

.auth-stepper-line {
    height: 1px;
    background: #dce2eb;
}

.auth-step.active {
    animation: auth-enter 180ms ease-out;
}

.auth-email-summary {
    display: grid;
    gap: 3px;
    margin: 0 0 20px;
    padding: 13px 14px;
    border-left: 3px solid var(--auth-green);
    background: #f1f8f5;
    color: #697587;
    font-size: 12px;
    line-height: 1.45;
}

.auth-email-summary strong {
    overflow-wrap: anywhere;
    color: #254738;
    font-size: 14px;
}

.auth-email-summary button {
    width: max-content;
    margin-top: 3px;
    color: #247253;
}

.code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
}

.code-input {
    font-variant-numeric: tabular-nums;
}

.send-code-btn {
    min-width: 104px;
    padding: 0 12px;
    border: 1px solid #bdd1ec;
    border-radius: 8px;
    background: #f5f9ff;
    color: var(--auth-blue);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.send-code-btn:disabled {
    border-color: #d8dee8;
    background: #f4f5f7;
    color: #8b95a5;
    cursor: wait;
}

.code-tip {
    min-height: 17px;
    margin: 6px 0 0;
    color: #798496;
    font-size: 11px;
    line-height: 1.45;
}

.auth-consent-group {
    display: grid;
    gap: 10px;
    margin: 4px 0 18px;
    padding: 17px 0 0;
    border: 0;
    border-top: 1px solid #e2e7ee;
}

.auth-consent-group legend {
    padding: 0;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.auth-consent-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    color: #667085;
    font-size: 12px;
    line-height: 1.55;
    cursor: pointer;
}

.auth-consent-checkbox {
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    accent-color: var(--auth-blue);
}

.auth-consent-checkbox[aria-invalid="true"] {
    outline: 2px solid rgba(198, 54, 50, 0.45);
    outline-offset: 2px;
}

.auth-consent-item a {
    color: var(--auth-blue-dark);
}

.auth-body .site-footer {
    margin-top: 0;
    padding: 22px 24px;
    border-top: 1px solid #e4e8ef;
    background: #ffffff;
}

.auth-body .site-footer-inner {
    max-width: 1040px;
}

.auth-body .footer-brand-name,
.auth-body .footer-brand-desc,
.auth-body .footer-legal a,
.auth-body .footer-contact,
.auth-body .footer-contact a {
    font-size: 12px;
}

.auth-brand:focus-visible,
.auth-switch-item:focus-visible,
.forgot-pwd-link:focus-visible,
.auth-flow-prompt button:focus-visible,
    .back-link:focus-visible,
.icon-back-btn:focus-visible,
.auth-email-summary button:focus-visible,
.send-code-btn:focus-visible,
.form-btn:focus-visible,
.afdian-login-btn:focus-visible,
.auth-consent-checkbox:focus-visible {
    outline: 3px solid rgba(23, 105, 224, 0.30);
    outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
    .back-link:hover,
    .forgot-pwd-link:hover,
    .auth-flow-prompt button:hover,
    .auth-email-summary button:hover {
        color: var(--auth-blue-dark);
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    .auth-switch-item:hover:not(.active),
    .icon-back-btn:hover {
        background: #e4e9f0;
        color: #334155;
    }

    .form-btn:hover:not(:disabled) {
        border-color: var(--auth-blue-dark);
        background: var(--auth-blue-dark);
        box-shadow: 0 7px 18px rgba(23, 105, 224, 0.23);
        transform: translateY(-1px);
    }

    .afdian-login-btn:hover:not(:disabled) {
        border-color: #6340ad;
        background: #f7f3ff;
        color: #4d2e91;
    }

    .send-code-btn:hover:not(:disabled) {
        border-color: #91b4e4;
        background: #eaf3ff;
    }
}

@media (max-width: 900px) {
    .auth-page {
        width: min(100% - 40px, 520px);
        min-height: 0;
        padding: 40px 0 56px;
        grid-template-columns: minmax(0, 1fr);
        gap: 34px;
    }

    .auth-story {
        max-width: none;
    }

    .auth-story h1 {
        max-width: 500px;
        font-size: 32px;
    }

    .auth-story-copy {
        margin-top: 12px;
    }

    .auth-benefits {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
        margin-top: 24px;
    }

    .auth-benefits li {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 9px;
    }

    .auth-benefits small {
        display: none;
    }

    .auth-trust-line {
        margin-top: 20px;
    }
}

@media (max-width: 600px) {
    .auth-topbar {
        height: 60px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .auth-brand img {
        width: 36px;
        height: 36px;
    }

    .auth-brand-copy strong {
        font-size: 17px;
    }

    .auth-page {
        width: min(100% - 28px, 480px);
        padding: 26px 0 40px;
        gap: 24px;
    }

    .auth-kicker {
        margin-bottom: 8px;
        font-size: 12px;
    }

    .auth-story h1 {
        font-size: 27px;
        line-height: 1.3;
    }

    .auth-story-copy {
        font-size: 14px;
        line-height: 1.65;
    }

    .auth-benefits,
    .auth-trust-line {
        display: none;
    }

    .login-card {
        padding: 24px 20px 22px;
        box-shadow: 0 12px 34px rgba(30, 43, 66, 0.09), 0 2px 6px rgba(30, 43, 66, 0.04);
    }

    .auth-form-title {
        font-size: 20px;
    }

    .auth-body .form-input {
        font-size: 16px;
    }

    .auth-body .site-footer {
        padding: 20px 16px;
    }
}

@media (max-width: 360px) {
    .auth-brand-copy span {
        display: none;
    }

    .login-card {
        padding-right: 16px;
        padding-left: 16px;
    }

    .auth-stepper {
        gap: 6px;
    }

    .auth-stepper-item strong {
        font-size: 11px;
    }

    .code-row {
        grid-template-columns: minmax(0, 1fr) 96px;
        gap: 6px;
    }

    .send-code-btn {
        min-width: 0;
        padding: 0 7px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-form.active,
    .auth-step.active {
        animation: none;
    }

    .auth-switch-item,
    .input-wrapper,
    .afdian-login-btn,
    .form-btn {
        transition: none;
    }
}
