:root {
    --auth-page: #f5f2ed;
    --auth-page-soft: #faf8f4;
    --auth-card: #ffffff;
    --auth-panel: #eee5d8;
    --auth-panel-deep: #e2d1bb;
    --auth-text: #292724;
    --auth-muted: #817970;
    --auth-border: #e6ded4;
    --auth-input: #fbfaf8;
    --auth-accent: #bd996a;
    --auth-accent-hover: #a98457;
    --auth-soft: #f3eee7;
    --auth-shadow: rgba(66, 49, 27, 0.10);
    --auth-danger-bg: #fff3f1;
    --auth-danger-text: #a84f45;
    --auth-success-bg: #eff7f0;
    --auth-success-text: #47764e;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --auth-page: #151412;
    --auth-page-soft: #1c1a17;
    --auth-card: #24211d;
    --auth-panel: #302a23;
    --auth-panel-deep: #3b3127;
    --auth-text: #eee9e2;
    --auth-muted: #aaa198;
    --auth-border: #464038;
    --auth-input: #2b2824;
    --auth-accent: #bf9867;
    --auth-accent-hover: #d0a873;
    --auth-soft: #312d28;
    --auth-shadow: rgba(0, 0, 0, 0.34);
    --auth-danger-bg: #3c2724;
    --auth-danger-text: #efaaa1;
    --auth-success-bg: #233429;
    --auth-success-text: #9bc4a1;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--auth-page) !important;
}

body {
    color: var(--auth-text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "PingFang SC",
        "Hiragino Sans GB",
        "Microsoft YaHei",
        Arial,
        sans-serif;
}

body > div.min-h-screen {
    background: transparent !important;
}

.aicm-password-page,
.aicm-password-page * {
    box-sizing: border-box;
}

.aicm-password-page {
    min-height: 100vh;
    color: var(--auth-text);
    background:
        radial-gradient(
            circle at 25% 15%,
            var(--auth-page-soft) 0,
            var(--auth-page) 56%
        );
}

.aicm-password-topbar {
    height: 82px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--auth-border);
    background: color-mix(in srgb, var(--auth-card) 92%, transparent);
    backdrop-filter: blur(14px);
}

.aicm-password-topbar-inner {
    width: calc(100% - 48px);
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aicm-password-logo {
    color: var(--auth-text);
    font-size: 23px;
    font-weight: 500;
    letter-spacing: 4px;
    text-decoration: none;
    white-space: nowrap;
}

.aicm-password-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aicm-password-home {
    height: 42px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    color: var(--auth-text);
    border-radius: 11px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.aicm-password-home:hover {
    color: var(--auth-accent-hover);
    background: var(--auth-soft);
}

.aicm-menu-picker {
    position: relative;
}

.aicm-control-button {
    min-width: 42px;
    height: 42px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--auth-muted);
    border: 1px solid var(--auth-border);
    border-radius: 11px;
    background: var(--auth-card);
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.aicm-control-button:hover {
    color: var(--auth-accent-hover);
    border-color: var(--auth-accent);
    background: var(--auth-soft);
    transform: translateY(-1px);
}

.aicm-language-button {
    min-width: 58px;
    font-size: 13px;
    font-weight: 600;
}

.aicm-dropdown {
    position: absolute;
    top: calc(100% + 11px);
    right: 0;
    z-index: 80;
    width: 158px;
    padding: 7px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-card);
    box-shadow: 0 18px 44px var(--auth-shadow);
    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0.18s ease;
}

.aicm-dropdown.is-open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.aicm-dropdown-option {
    width: 100%;
    height: 42px;
    padding: 0 11px;
    display: grid;
    grid-template-columns: 22px 1fr 17px;
    align-items: center;
    gap: 7px;
    color: var(--auth-muted);
    border: 0;
    border-radius: 9px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.aicm-dropdown-option:hover {
    color: var(--auth-text);
    background: var(--auth-soft);
}

.aicm-dropdown-option.is-active {
    color: var(--auth-accent-hover);
    background: var(--auth-soft);
}

.aicm-dropdown-check {
    opacity: 0;
    font-size: 11px;
}

.aicm-dropdown-option.is-active .aicm-dropdown-check {
    opacity: 1;
}

.aicm-password-main {
    min-height: calc(100vh - 82px);
    padding: 54px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aicm-password-card {
    width: 100%;
    max-width: 1080px;
    min-height: 570px;
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    overflow: hidden;
    border: 1px solid var(--auth-border);
    border-radius: 26px;
    background: var(--auth-card);
    box-shadow:
        0 24px 65px var(--auth-shadow),
        0 3px 10px rgba(50, 38, 23, 0.04);
}

.aicm-password-brand {
    position: relative;
    min-height: 570px;
    padding: 58px 52px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        linear-gradient(
            145deg,
            var(--auth-panel) 0%,
            var(--auth-panel-deep) 100%
        );
}

.aicm-password-brand::before,
.aicm-password-brand::after {
    content: "";
    position: absolute;
    border: 1px solid var(--auth-accent);
    border-radius: 50%;
    opacity: 0.35;
}

.aicm-password-brand::before {
    width: 320px;
    height: 320px;
    right: -130px;
    top: -120px;
}

.aicm-password-brand::after {
    width: 210px;
    height: 210px;
    left: -95px;
    bottom: -85px;
}

.aicm-password-brand-content,
.aicm-password-brand-list {
    position: relative;
    z-index: 2;
}

.aicm-password-kicker {
    margin-bottom: 22px;
    color: var(--auth-accent-hover);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
}

.aicm-password-brand-title {
    max-width: 390px;
    margin: 0;
    color: var(--auth-text);
    font-size: clamp(35px, 3.5vw, 49px);
    font-weight: 700;
    line-height: 1.22;
}

.aicm-password-brand-description {
    max-width: 390px;
    margin: 24px 0 0;
    color: var(--auth-muted);
    font-size: 16px;
    line-height: 1.85;
}

.aicm-password-brand-list {
    display: grid;
    gap: 15px;
}

.aicm-password-brand-item {
    display: flex;
    align-items: center;
    gap: 13px;
    color: var(--auth-muted);
    font-size: 14px;
}

.aicm-password-brand-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-accent-hover);
    border-radius: 50%;
    background: color-mix(
        in srgb,
        var(--auth-card) 58%,
        transparent
    );
}

.aicm-password-form-panel {
    min-height: 570px;
    padding: 58px 70px;
    display: flex;
    align-items: center;
    background: var(--auth-card);
}

.aicm-password-form-inner {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
}

.aicm-password-heading {
    margin-bottom: 32px;
}

.aicm-password-title {
    margin: 0;
    color: var(--auth-text);
    font-size: 34px;
    font-weight: 700;
    line-height: 1.3;
}

.aicm-password-subtitle {
    margin: 10px 0 0;
    color: var(--auth-muted);
    font-size: 15px;
    line-height: 1.75;
}

.aicm-password-alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: 11px;
    font-size: 13px;
    line-height: 1.65;
}

.aicm-password-alert-success {
    color: var(--auth-success-text);
    background: var(--auth-success-bg);
}

.aicm-password-alert-error {
    color: var(--auth-danger-text);
    background: var(--auth-danger-bg);
}

.aicm-password-alert-error ul {
    margin: 0;
    padding-left: 18px;
}

.aicm-password-field {
    margin-bottom: 20px;
}

.aicm-password-label {
    margin-bottom: 8px;
    display: block;
    color: var(--auth-text);
    font-size: 13px;
    font-weight: 600;
}

.aicm-password-input-wrap {
    position: relative;
}

.aicm-password-input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    color: var(--auth-text);
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    outline: none;
    background: var(--auth-input);
    font-size: 15px;
}

.aicm-password-input::placeholder {
    color: var(--auth-muted);
    opacity: 0.75;
}

.aicm-password-input:focus {
    border-color: var(--auth-accent);
    background: var(--auth-card);
    box-shadow: 0 0 0 4px rgba(189, 153, 106, 0.14);
}

.aicm-password-input.has-toggle {
    padding-right: 52px;
}

.aicm-password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-muted);
    border: 0;
    border-radius: 9px;
    background: transparent;
    transform: translateY(-50%);
    cursor: pointer;
}

.aicm-password-toggle:hover {
    color: var(--auth-accent-hover);
    background: var(--auth-soft);
}

.aicm-password-submit {
    width: 100%;
    height: 54px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff !important;
    border: 1px solid var(--auth-accent) !important;
    border-radius: 12px;
    background: var(--auth-accent) !important;
    box-shadow: 0 8px 20px rgba(189, 153, 106, 0.24);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.aicm-password-submit:hover {
    color: #ffffff !important;
    border-color: var(--auth-accent-hover) !important;
    background: var(--auth-accent-hover) !important;
    transform: translateY(-1px);
}

.aicm-password-back {
    margin-top: 22px;
    text-align: center;
}

.aicm-password-back a {
    color: var(--auth-muted);
    font-size: 13px;
    text-decoration: none;
}

.aicm-password-back a:hover {
    color: var(--auth-accent-hover);
}

@media (max-width: 900px) {
    .aicm-password-card {
        max-width: 650px;
        grid-template-columns: 1fr;
    }

    .aicm-password-brand {
        min-height: auto;
        padding: 42px;
    }

    .aicm-password-brand-list {
        margin-top: 32px;
        grid-template-columns: repeat(3, 1fr);
    }

    .aicm-password-brand-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .aicm-password-form-panel {
        min-height: auto;
        padding: 50px 56px 58px;
    }
}

@media (max-width: 640px) {
    .aicm-password-topbar {
        height: 70px;
    }

    .aicm-password-topbar-inner {
        width: calc(100% - 28px);
    }

    .aicm-password-logo {
        font-size: 18px;
        letter-spacing: 3px;
    }

    .aicm-password-actions {
        gap: 7px;
    }

    .aicm-password-home {
        display: none;
    }

    .aicm-control-button {
        min-width: 38px;
        height: 38px;
        padding: 0 9px;
        border-radius: 9px;
    }

    .aicm-dropdown {
        right: -12px;
    }

    .aicm-password-main {
        min-height: calc(100vh - 70px);
        padding: 24px 14px 40px;
        align-items: flex-start;
    }

    .aicm-password-card {
        border-radius: 19px;
    }

    .aicm-password-brand {
        padding: 34px 26px;
    }

    .aicm-password-brand-title {
        font-size: 32px;
    }

    .aicm-password-brand-list {
        grid-template-columns: 1fr;
    }

    .aicm-password-brand-item {
        align-items: center;
        flex-direction: row;
    }

    .aicm-password-form-panel {
        padding: 38px 25px 44px;
    }

    .aicm-password-title {
        font-size: 29px;
    }
}

/* 修复手机端语言和主题菜单被内容卡片遮挡 */
.aicm-password-topbar {
    position: relative;
    z-index: 1000;
    overflow: visible;
}

.aicm-password-topbar-inner,
.aicm-password-actions,
.aicm-menu-picker {
    overflow: visible;
}

.aicm-menu-picker {
    z-index: 1001;
}

.aicm-dropdown {
    z-index: 1100 !important;
}

.aicm-password-main {
    position: relative;
    z-index: 1;
}

@media (max-width: 640px) {
    .aicm-password-topbar {
        position: relative;
        z-index: 1000;
        overflow: visible;
    }

    .aicm-password-actions {
        position: relative;
        z-index: 1001;
    }

    .aicm-dropdown {
        top: calc(100% + 10px);
        right: 0;
        z-index: 1100 !important;
    }

    .aicm-password-main {
        position: relative;
        z-index: 1;
    }
}

/* ========================================
   SX IMAGE 认证页面扩展
   ======================================== */

.aicm-register-card {
    min-height: 680px;
}

.aicm-register-card .aicm-password-brand,
.aicm-register-card .aicm-password-form-panel {
    min-height: 680px;
}

.aicm-register-card .aicm-password-form-panel {
    padding-top: 42px;
    padding-bottom: 42px;
}

.aicm-register-card .aicm-password-heading {
    margin-bottom: 24px;
}

.aicm-register-card .aicm-password-field {
    margin-bottom: 16px;
}

.aicm-compact-auth-card {
    min-height: 560px;
}

.aicm-compact-auth-card .aicm-password-brand,
.aicm-compact-auth-card .aicm-password-form-panel {
    min-height: 560px;
}

.aicm-auth-status-icon {
    width: 62px;
    height: 62px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-accent-hover);
    border: 1px solid var(--auth-border);
    border-radius: 18px;
    background: var(--auth-soft);
    font-size: 23px;
}

.aicm-auth-secondary-form {
    margin-top: 13px;
}

.aicm-auth-secondary-button {
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-muted);
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.aicm-auth-secondary-button:hover {
    color: var(--auth-accent-hover);
    border-color: var(--auth-accent);
    background: var(--auth-soft);
}

.aicm-password-back {
    color: var(--auth-muted);
}

.aicm-password-back a {
    margin-left: 5px;
    color: var(--auth-accent-hover);
    font-weight: 600;
}

@media (max-width: 900px) {
    .aicm-register-card,
    .aicm-compact-auth-card {
        min-height: auto;
    }

    .aicm-register-card .aicm-password-brand,
    .aicm-register-card .aicm-password-form-panel,
    .aicm-compact-auth-card .aicm-password-brand,
    .aicm-compact-auth-card .aicm-password-form-panel {
        min-height: auto;
    }
}

@media (max-width: 640px) {
    .aicm-register-card .aicm-password-form-panel {
        padding-top: 36px;
        padding-bottom: 42px;
    }

    .aicm-auth-status-icon {
        width: 54px;
        height: 54px;
        margin-bottom: 20px;
        border-radius: 15px;
        font-size: 20px;
    }
}

/* SX mobile auth dropdown layer fix */

.aicm-password-topbar {
    position: relative !important;
    z-index: 1000 !important;
    overflow: visible !important;
}

.aicm-password-topbar-inner,
.aicm-password-actions,
.aicm-menu-picker {
    position: relative;
    overflow: visible !important;
}

.aicm-password-actions {
    z-index: 1001;
}

.aicm-menu-picker {
    z-index: 1002;
}

.aicm-menu-picker:has(.aicm-dropdown.is-open) {
    z-index: 1010;
}

.aicm-dropdown {
    z-index: 9999 !important;
}

.aicm-password-main,
.aicm-password-card {
    position: relative;
    z-index: 1;
}

@media (max-width: 640px) {
    .aicm-password-topbar {
        isolation: isolate;
    }

    .aicm-dropdown {
        position: absolute !important;
        top: calc(100% + 9px) !important;
        right: 0 !important;
        z-index: 9999 !important;
    }

    .aicm-menu-picker:nth-last-child(2) .aicm-dropdown {
        right: -46px !important;
    }
}
