:root {
    /* 核心品牌色 - Enterprise Blue (#0052D9) */
    --primary: #0052D9;
    --primary-hover: #003AB5;
    --primary-active: #00258D;
    --primary-light: rgba(0, 82, 217, 0.1);

    /* 玻璃拟态系统变量 */
    --glass-surface: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(0, 82, 217, 0.1);
    --glass-shadow-hover: 0 12px 40px 0 rgba(0, 82, 217, 0.15);
    --glass-blur: 20px;

    /* 文字系统 */
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --text-on-primary: #FFFFFF;

    /* 辅助色 */
    --danger: #D93025;
    --success: #188038;

    /* 页面与表面 */
    --bg-body: #F5F7FA;
    --mesh-1: hsla(216, 98%, 66%, 1);
    --mesh-2: hsla(213, 97%, 67%, 1);
    --mesh-3: hsla(210, 96%, 68%, 1);
    --surface: #FFFFFF;
    --border-subtle: #E5E7EB;
    --hover-subtle: rgba(0, 0, 0, 0.05);
    --divider: rgba(0, 0, 0, 0.1);
    --logo-glow: 0 1px 2px rgba(255, 255, 255, 0.8);
    --heading-gradient: linear-gradient(135deg, #0052D9 0%, #003AB5 100%);

    /* 表单 */
    --input-bg: rgba(255, 255, 255, 0.8);
    --input-bg-focus: #FFFFFF;
    --input-bg-disabled: rgba(255, 255, 255, 0.45);
    --input-border: rgba(0, 0, 0, 0.1);
    --placeholder: #A0A0A0;

    /* 组件 */
    --pill-bg: rgba(255, 255, 255, 0.9);
    --pill-border: rgba(0, 0, 0, 0.05);
    --alert-error-bg: #FEF2F2;
    --alert-error-border: #FEE2E2;
    --alert-success-bg: #F0FDF4;
    --alert-success-border: #DCFCE7;
}

/* 暗色主题：theme.js 启动时写入 data-theme，默认跟随系统偏好 */
:root[data-theme="dark"] {
    --primary: #4D8AFF;
    --primary-hover: #6EA1FF;
    --primary-active: #3B75E8;
    --primary-light: rgba(77, 138, 255, 0.16);

    --glass-surface: rgba(28, 28, 30, 0.65);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --glass-shadow-hover: 0 12px 40px 0 rgba(0, 0, 0, 0.55);

    --text-primary: #F5F5F7;
    --text-secondary: #A1A1A6;

    --danger: #F28B82;
    --success: #81C995;

    --bg-body: #0D0F14;
    --mesh-1: hsla(216, 70%, 22%, 1);
    --mesh-2: hsla(213, 65%, 18%, 1);
    --mesh-3: hsla(210, 60%, 15%, 1);
    --surface: #1C1C1E;
    --border-subtle: #3A3A3C;
    --hover-subtle: rgba(255, 255, 255, 0.08);
    --divider: rgba(255, 255, 255, 0.12);
    --logo-glow: none;
    --heading-gradient: linear-gradient(135deg, #6EA1FF 0%, #4D8AFF 100%);

    --input-bg: rgba(44, 44, 46, 0.8);
    --input-bg-focus: #2C2C2E;
    --input-bg-disabled: rgba(44, 44, 46, 0.45);
    --input-border: rgba(255, 255, 255, 0.12);
    --placeholder: #6E6E73;

    --pill-bg: rgba(44, 44, 46, 0.9);
    --pill-border: rgba(255, 255, 255, 0.08);
    --alert-error-bg: rgba(217, 48, 37, 0.15);
    --alert-error-border: rgba(217, 48, 37, 0.35);
    --alert-success-bg: rgba(24, 128, 56, 0.15);
    --alert-success-border: rgba(24, 128, 56, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    overflow-x: hidden;

    /* 动态网格渐变背景 */
    background-color: var(--bg-body);
    background-image:
        radial-gradient(at 0% 0%, var(--mesh-1) 0, transparent 50%),
        radial-gradient(at 50% 0%, var(--mesh-2) 0, transparent 50%),
        radial-gradient(at 100% 0%, var(--mesh-3) 0, transparent 50%);
    background-size: 200% 200%;
    animation: meshGradient 15s ease infinite alternate;
}

@keyframes meshGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Header 导航栏 - 完全透明 */
.top-header {
    width: 100%;
    padding: 1.5rem 2rem;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: var(--logo-glow);
}

.logout-btn {
    padding: 0.5rem;
    background: transparent;
    color: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: var(--primary-light);
}

/* 账户设置按钮 */
.account-btn {
    padding: 0.5rem;
    background: transparent;
    color: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
}

.account-btn:hover {
    background: var(--primary-light);
}

/* 主题切换按钮：亮色态显示月亮（点击切暗色），暗色态显示太阳 */
.theme-toggle {
    padding: 0.5rem;
    background: transparent;
    color: var(--primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--primary-light);
}

/* 登录页无 Header，按钮悬浮页面右上角 */
.theme-toggle--floating {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    z-index: 100;
}

.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* 抽屉面板 */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.drawer-panel.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
}

.drawer-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drawer-close {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close:hover {
    background: var(--hover-subtle);
    color: var(--text-primary);
}

.drawer-content {
    padding: 2rem;
}

.drawer-section {
    margin-bottom: 2rem;
}

.drawer-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drawer-section p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* 布局系统 */
.container-full {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* 玻璃拟态卡片核心 */
.glass-card {
    background: var(--glass-surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-card:hover {
    box-shadow: var(--glass-shadow-hover);
}

/* 头部样式 */
.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header img.logo {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    background: var(--primary);
    border-radius: 12px;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
    background: var(--heading-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 表单组件 */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    border-radius: 14px;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input::placeholder {
    color: var(--placeholder);
}

/* 输入框 Focus-ring 呼吸灯效 */
.form-input:focus {
    outline: none;
    background: var(--input-bg-focus);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    transition: color 0.3s;
}

.form-input:focus+.input-icon {
    color: var(--primary);
}

/* 按钮微动效（btn-primary 供 legacy-approve 授权确认页复用） */
.btn-submit,
.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 1rem;
}

.btn-submit:hover,
.btn-primary:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 82, 217, 0.3);
}

.btn-submit:active,
.btn-primary:active {
    transform: scale(0.98);
}

/* 次级按钮：legacy-approve 授权确认页"拒绝" */
.btn-secondary {
    width: 100%;
    padding: 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--divider);
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.75rem;
}

.btn-secondary:hover {
    color: var(--text-primary);
    background: var(--hover-subtle);
}

/* 成功页/首页 Bento Grid布局 */
.bento-grid {
    display: grid;
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
    grid-template-columns: repeat(4, 1fr);
    animation: slideUpFade 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-card {
    background: var(--glass-surface);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.bento-card.full-width {
    grid-column: span 4;
    padding: 3rem 2rem;
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow-hover);
}

.bento-card-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.bento-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.bento-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.notification-pill {
    background: var(--pill-bg);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--pill-border);
    margin-bottom: 2rem;
}

.notification-pill svg {
    color: var(--primary);
}

/* 其他登录方式分隔线 */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.5rem 0 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

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

/* 飞书登录按钮 */
.btn-feishu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary);
    background: var(--surface);
    font-size: 0.95rem;
    font-weight: 500;
}

/* 消息提示框 */
.alert-box {
    margin-bottom: 1.5rem;
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    text-align: center;
    border: 1px solid transparent;
}

.alert-error {
    background: var(--alert-error-bg);
    color: var(--danger);
    border-color: var(--alert-error-border);
}

.alert-message {
    background: var(--alert-success-bg);
    color: var(--success);
    border-color: var(--alert-success-border);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 安全中心特殊样式 */
.pwd-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    width: 100%;
    gap: 1rem;
}

.pwd-card-info {
    text-align: left;
    flex: 1;
}

.pwd-toggle-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-card.full-width {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-card.full-width {
        grid-column: span 1;
    }

    .glass-card {
        padding: 2rem;
    }

    .top-header {
        padding: 1rem;
    }

    /* 移动端安全中心优化 */
    .pwd-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pwd-toggle-btn {
        width: 100%;
    }

    .pwd-toggle-btn .btn-submit {
        width: 100% !important;
    }
}