:root {
    --bg: #f2f3f5;
    --bg-elevated: #ffffff;
    --bg-muted: #e9ebef;
    --bg-soft: #f7f8fa;
    --line: #d9dde3;
    --line-strong: #c5cad3;
    --text: #1f2430;
    --text-secondary: #5c6575;
    --text-muted: #8a93a3;
    --accent: #108cda;
    --accent-hover: #0d7bc0;
    --accent-soft: rgba(16, 140, 218, 0.12);
    --danger: #c23b3b;
    --danger-soft: #f8eaea;
    --success: #1f7a4d;
    --success-soft: #e7f4ee;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 18px 50px rgba(31, 36, 48, 0.08);
    --font: "Manrope", "PingFang SC", "Microsoft YaHei", sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(900px 420px at 10% -10%, rgba(16, 140, 218, 0.08), transparent 55%),
        radial-gradient(700px 360px at 100% 0%, rgba(16, 140, 218, 0.05), transparent 50%),
        linear-gradient(180deg, #f7f8fa 0%, var(--bg) 100%);
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
}

.auth-shell {
    width: min(100%, 420px);
    animation: rise-in 0.55s var(--ease) both;
}

.brand {
    text-align: center;
    margin-bottom: 22px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
}

.brand-mark:hover {
    color: inherit;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background:
        linear-gradient(145deg, var(--accent) 0%, #0b6fad 100%);
    box-shadow: 0 8px 18px rgba(16, 140, 218, 0.28);
    position: relative;
}

.brand-icon::after {
    content: "";
    position: absolute;
    inset: 9px 8px 9px 8px;
    border: 2px solid rgba(255, 255, 255, 0.92);
    border-radius: 4px;
    border-right-color: transparent;
    border-bottom-color: transparent;
    transform: rotate(45deg) translate(1px, -1px);
}

.brand-name {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.brand-tagline {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.auth-tab {
    display: grid;
    place-items: center;
    height: 40px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.auth-tab:hover {
    color: var(--text);
}

.auth-tab.is-active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 18px rgba(16, 140, 218, 0.28);
}

.auth-tab.is-active:hover {
    color: #fff;
}

.auth-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px 24px;
}

.auth-heading {
    margin-bottom: 22px;
}

.auth-heading h1 {
    margin: 0;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
    font-weight: 700;
}

.auth-heading p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 7px;
}

.field-label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.field-label em {
    font-style: normal;
    font-weight: 500;
    color: var(--text-muted);
}

.field input,
.field select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.98rem;
    outline: none;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.field select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #8a93a3 50%), linear-gradient(135deg, #8a93a3 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.field input::placeholder {
    color: #a0a8b6;
}

.field input:hover,
.field select:hover {
    border-color: #b4bbc7;
}

.field input:focus,
.field select:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 46px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.toggle-password:hover {
    color: var(--text-secondary);
    background: var(--bg-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 650;
    font-size: 0.98rem;
    cursor: pointer;
    transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 10px 22px rgba(16, 140, 218, 0.28);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    color: var(--text-secondary);
    background: var(--bg-soft);
    border-color: var(--line);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-muted);
}

.btn-block {
    width: 100%;
}

.auth-switch {
    margin: 4px 0 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.auth-switch a {
    font-weight: 650;
}

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.9rem;
}

.alert p {
    margin: 0;
}

.alert p + p {
    margin-top: 4px;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #efc5c5;
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid #c5e4d4;
}

.auth-footer {
    margin-top: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.welcome-shell {
    width: min(100%, 460px);
}

.welcome-panel {
    display: grid;
    gap: 18px;
}

.welcome-meta {
    margin: 0;
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--line);
}

.welcome-meta > div {
    display: grid;
    gap: 2px;
}

.welcome-meta dt {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.welcome-meta dd {
    margin: 0;
    font-weight: 600;
    word-break: break-all;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .auth-page {
        padding: 18px 14px 28px;
        align-items: start;
    }

    .auth-shell {
        width: 100%;
        margin-top: 18px;
    }

    .brand {
        margin-bottom: 18px;
    }

    .brand-name {
        font-size: 1.4rem;
    }

    .auth-panel {
        padding: 22px 16px 18px;
        border-radius: 12px;
    }

    .auth-heading h1 {
        font-size: 1.28rem;
    }

    .field input,
    .btn {
        height: 48px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-shell,
    .btn,
    .auth-tab,
    .field input {
        animation: none !important;
        transition: none !important;
    }
}
