* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: #1f2937;
    background: #f3f6fb;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 18px;
}

.auth-card {
    position: relative;
    width: min(440px, 100%);
    padding: 34px 32px 30px;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.12);
}

.social-exchange-status {
    display: none;
    min-height: 230px;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
}

.social-exchange-status h1,
.social-exchange-status p {
    margin: 0;
}

.social-exchange-status h1 {
    color: #111827;
    font-size: 22px;
}

.social-exchange-status p {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.7;
}

.social-exchange-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #dbeafe;
    border-top-color: var(--theme-primary, #409eff);
    border-radius: 50%;
    animation: social-exchange-spin 0.8s linear infinite;
}

.social-ticket-pending .social-exchange-status {
    display: grid;
}

.social-ticket-pending .auth-card > :not(.social-exchange-status) {
    display: none !important;
}

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

.site-link {
    position: absolute;
    top: 18px;
    left: 20px;
    color: #409eff;
    font-size: 13px;
    text-decoration: none;
}

.auth-mode-switch {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
    width: 68px;
    height: 68px;
    padding: 9px 9px 30px 30px;
    border: 0;
    color: #7f8a99;
    background: linear-gradient(225deg, #eef1f5 0 49%, transparent 50%);
    cursor: pointer;
}

.auth-mode-switch::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    border-top: 1px solid #d9dee6;
    border-right: 1px solid #d9dee6;
}

.auth-mode-switch:hover {
    color: var(--theme-primary, #409eff);
}

.auth-mode-switch:focus-visible {
    outline: 2px solid var(--theme-primary, #409eff);
    outline-offset: -4px;
}

.auth-mode-switch svg {
    position: relative;
    z-index: 1;
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.auth-switch-qr,
.auth-mode-switch.account-mode .auth-switch-account {
    display: none;
}

.auth-mode-switch.account-mode .auth-switch-qr {
    display: block;
}

.wechat-qr-panel {
    min-height: 440px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 10px;
    padding-top: 18px;
    text-align: center;
}

.wechat-qr-stage {
    position: relative;
    width: min(274px, 76vw);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    margin-bottom: 6px;
    overflow: hidden;
    background: #fff;
}

.wechat-qr-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.wechat-qr-loading {
    display: grid;
    justify-items: center;
    gap: 14px;
    color: #a0a8b3;
    font-size: 13px;
}

.wechat-qr-loading span {
    width: 38px;
    height: 38px;
    border: 3px solid #e6edf6;
    border-top-color: var(--theme-primary, #409eff);
    border-radius: 50%;
    animation: social-exchange-spin 0.8s linear infinite;
}

.wechat-qr-loading p,
.wechat-qr-panel h1,
.wechat-qr-panel > p {
    margin: 0;
}

.wechat-qr-panel h1 {
    color: #111827;
    font-size: 22px;
}

.wechat-qr-panel > p {
    color: #a0a8b3;
    font-size: 13px;
    line-height: 1.7;
}

.wechat-qr-footer {
    margin-top: 48px;
    color: #a0a8b3;
    font-size: 13px;
}

.wechat-qr-footer button,
.wechat-qr-retry {
    padding: 0;
    border: 0;
    color: var(--theme-primary, #409eff);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.wechat-login-bridge.bridge-only {
    position: absolute;
    width: 1px;
    height: 1px;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.wechat-login-bridge.frame-visible {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.wechat-qr-panel.iframe-fallback .wechat-qr-stage {
    /* Keep the complete provider QR in view; hide its page chrome with the
       overlay below instead of moving the iframe and clipping QR modules. */
    width: min(274px, 76vw);
    height: 310px;
    aspect-ratio: auto;
    background: #fff;
}

.wechat-qr-panel.iframe-fallback .wechat-login-bridge.frame-visible {
    position: absolute;
    top: 0;
    left: 50%;
    width: 360px;
    height: 520px;
    margin-left: -180px;
    overflow: hidden;
    transform: scale(0.76);
    transform-origin: top center;
}

.wechat-qr-frame-mask {
    display: none;
}

.wechat-qr-panel.iframe-fallback .wechat-qr-frame-mask {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: block;
    border-style: solid;
    border-width: 94px 13px 14px;
    border-color: #fff;
    pointer-events: none;
}

.wechat-qr-retry {
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--theme-primary, #409eff) 38%, #dcdfe6);
    border-radius: 5px;
}

.account-auth-panel {
    padding-top: 12px;
}

.auth-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-mark {
    position: relative;
    overflow: hidden;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #6d5dfc 58%, #8b5cf6 100%);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 25px;
    font-style: italic;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.26);
}

.auth-mark::after {
    content: "";
    position: absolute;
    inset: 8px 8px auto;
    height: 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
    transform: rotate(-18deg);
}

.auth-heading p,
.auth-heading h1 {
    margin: 0;
}

.auth-heading p {
    color: #909399;
    font-size: 13px;
}

.auth-heading h1 {
    margin-top: 3px;
    color: #111827;
    font-size: 24px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 20px;
    padding: 4px;
    border-radius: 6px;
    background: #f5f7fa;
}

.auth-tab {
    height: 38px;
    border: 0;
    border-radius: 4px;
    color: #606266;
    background: transparent;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.auth-tab.active {
    color: #fff;
    background: #409eff;
    box-shadow: 0 8px 18px rgba(64, 158, 255, 0.22);
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form-section {
    display: grid;
    gap: 14px;
}

.auth-inline-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: -4px;
}

.auth-link-button {
    border: 0;
    padding: 0;
    color: #409eff;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.auth-link-button.centered {
    justify-self: center;
    margin-top: 2px;
}

.auth-hint {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.7;
}

.auth-form label,
.auth-field {
    display: grid;
    gap: 7px;
    color: #606266;
    font-size: 14px;
    font-weight: 700;
}

.auth-field > label {
    display: block;
}

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

.auth-form input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    color: #303133;
    font-size: 15px;
    outline: none;
}

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

.password-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 0 3px 3px 0;
    color: #6b7280;
    background: #fff;
    cursor: pointer;
}

.password-toggle:hover {
    color: var(--theme-primary, #409eff);
    background: #f5f7fa;
}

.password-toggle:focus-visible {
    color: var(--theme-primary, #409eff);
    outline: 2px solid color-mix(in srgb, var(--theme-primary, #409eff) 38%, transparent);
    outline-offset: -3px;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.password-toggle-hide {
    display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle-show {
    display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle-hide {
    display: block;
}

.auth-form input:focus {
    border-color: #409eff;
    box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.12);
}

.auth-submit {
    height: 42px;
    margin-top: 6px;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: #409eff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.auth-submit:hover {
    background: #2f8ded;
}

.social-login-section {
    display: grid;
    gap: 12px;
}

.social-login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #909399;
    font-size: 12px;
}

.social-login-divider::before,
.social-login-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #ebeef5;
}

.social-login-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.social-login-button {
    height: 40px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    color: #303133;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.social-login-button:hover {
    border-color: #409eff;
    color: #409eff;
    background: #f4f9ff;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 20;
    max-width: min(420px, calc(100vw - 32px));
    padding: 12px 16px;
    border-radius: 4px;
    color: #fff;
    background: rgba(17, 24, 39, 0.94);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
}

.toast.error {
    background: rgba(185, 28, 28, 0.96);
}

.toast.success {
    background: rgba(22, 163, 74, 0.96);
}

.hidden {
    display: none !important;
}

@media (max-width: 560px) {
    .auth-card {
        padding: 30px 20px 24px;
    }
}
