/* ========== 主题变量 ========== */
:root {
    /* 深色主题（默认） */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    --info: #3b82f6;
    --info-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: linear-gradient(145deg, #1e293b 0%, #1a2332 100%);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #475569;
    --border-glow: rgba(99, 102, 241, 0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --login-left-bg: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    --login-right-bg: #0f172a;
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* 明亮主题 */
[data-theme="light"] {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-glow: rgba(79, 70, 229, 0.2);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.1);
    --login-left-bg: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%);
    --login-right-bg: #f8fafc;
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

body {
    font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 登录页面 - 左右布局 ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    background: var(--login-right-bg);
}

/* 左侧品牌展示区 */
.login-left {
    flex: 1;
    background: var(--login-left-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 40px;
}

.login-left-content {
    text-align: center;
    color: white;
    z-index: 2;
    position: relative;
}

.brand-logo {
    font-size: 80px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.login-left-content h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.brand-subtitle {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 48px;
}

.features-list {
    text-align: left;
    max-width: 280px;
    margin: 0 auto;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 15px;
    opacity: 0.9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-icon {
    font-size: 20px;
}

/* 浮动背景装饰 */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -100px;
    right: -100px;
    animation: morph 15s ease-in-out infinite;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    left: -50px;
    animation: morph 12s ease-in-out infinite reverse;
}

.shape-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    left: 50%;
    animation: morph 10s ease-in-out infinite;
}

@keyframes morph {

    0%,
    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }

    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

/* 右侧登录区 */
.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    background: var(--bg-primary);
}

.theme-toggle-login {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.theme-toggle-login:hover {
    transform: scale(1.1);
    background: var(--primary);
}

.login-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    animation: cardSlideUp 0.5s ease-out;
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 12px;
}

/* 主题切换按钮 */
.theme-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.1);
    background: var(--primary);
}

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-input,
select,
textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-normal);
}

.form-input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-color);
}

.form-input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--border-glow);
    background: var(--bg-secondary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.remember-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.remember-row label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: var(--warning-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: var(--danger-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-info {
    background: var(--info-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== 管理面板 ========== */
.admin-panel {
    display: none;
    min-height: 100vh;
}

.admin-panel.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 70px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-nav {
    display: flex;
    gap: 6px;
}

.nav-tab {
    padding: 10px 18px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.nav-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition-normal);
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-tab:hover::after {
    width: 60%;
}

.nav-tab.active {
    color: white;
    background: var(--primary-gradient);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.nav-tab.active::after {
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.alert-badge {
    position: relative;
    cursor: pointer;
    font-size: 22px;
    padding: 8px;
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.alert-badge:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

.alert-badge .count {
    position: absolute;
    top: 2px;
    right: 0;
    background: var(--danger-gradient);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.main-content {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ========== 页面 ========== */
.page {
    display: none;
    animation: fadeIn 0.3s;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.stat-card .icon.blue {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.stat-card .icon.green {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.stat-card .icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.stat-card .icon.orange {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.stat-card .icon.red {
    background: linear-gradient(135deg, #ef4444, #f87171);
}

.stat-card .icon.cyan {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========== 图表 ========== */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    height: 280px;
}

/* ========== 表格 ========== */
.table-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.data-table th,
.data-table td {
    padding: 16px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.data-table td {
    font-size: 14px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr {
    transition: all var(--transition-fast);
}

.data-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.05);
}

.data-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ========== 徽章 ========== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all var(--transition-fast);
}

.badge:hover {
    transform: scale(1.05);
}

.badge-unused {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.15));
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-used {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(96, 165, 250, 0.15));
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-disabled {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(248, 113, 113, 0.15));
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-expired {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.15));
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-time {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.15));
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-count {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(34, 211, 238, 0.15));
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-permanent {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.15));
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* ========== 工具栏 ========== */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar .form-input,
.toolbar select {
    width: auto;
    min-width: 150px;
    padding: 10px 14px;
    font-size: 13px;
}

.batch-bar {
    display: none;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    align-items: center;
}

.batch-bar.show {
    display: flex;
}

.batch-bar span {
    color: white;
    font-size: 14px;
}

.batch-bar .btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
}

.batch-bar .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 20px;
}

.pagination button {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
    animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-lg {
    max-width: 720px;
}

.modal-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ========== 卡密列表 ========== */
.keys-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
}

.key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.key-item code {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    color: var(--primary-light);
}

/* ========== 设置区块 ========== */
.section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.section:hover {
    box-shadow: var(--shadow);
    border-color: var(--border-glow);
}

.section h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== 模板卡片 ========== */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.template-card {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.template-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.template-card:hover::before {
    opacity: 1;
}

.template-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 3px var(--border-glow);
}

.template-card.selected::before {
    opacity: 1;
}

.template-card .name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
}

.template-card .desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.template-card .meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========== 告警列表 ========== */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--info);
    align-items: flex-start;
}

.alert-item.warning {
    border-left-color: var(--warning);
}

.alert-item.danger {
    border-left-color: var(--danger);
}

.alert-item .icon {
    font-size: 24px;
}

.alert-item .content {
    flex: 1;
}

.alert-item .title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-item .text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.alert-item .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 16px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.1));
    border-left: 4px solid var(--success);
}

.toast.error {
    border-color: var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(248, 113, 113, 0.1));
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.1));
    border-left: 4px solid var(--warning);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state .title {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state .desc {
    font-size: 14px;
}

/* ========== 代码 ========== */
code {
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 13px;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }

    .login-left {
        display: none;
    }

    .login-right {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .top-nav {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .main-content {
        padding: 16px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-right {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ========== 文档页面 ========== */
.docs-container {
    max-width: 900px;
    margin: 0 auto;
}

.docs-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.docs-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.docs-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 12px 0;
    color: var(--primary-light);
}

.docs-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.docs-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.docs-card ul li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-secondary);
}

.docs-card ul li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: var(--primary);
}

.code-block {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
    position: relative;
}

.code-block pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-all;
}

.code-block .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.code-block .copy-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.code-block .lang-tag {
    position: absolute;
    top: 8px;
    left: 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ========== API密钥管理 ========== */
.api-key-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin: 12px 0;
    border: 1px solid var(--border-color);
}

.api-key-display code {
    flex: 1;
    font-size: 14px;
    word-break: break-all;
    background: transparent;
    padding: 0;
}

.api-key-display .btn-group {
    flex-shrink: 0;
}

.api-key-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.api-key-info-item {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.api-key-info-item .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.api-key-info-item .value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* 延期按钮样式 */
.btn-extend {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    color: white;
}

.btn-extend:hover {
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* 明亮主题特殊调整 */
[data-theme="light"] .code-block {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

[data-theme="light"] .code-block pre {
    color: #334155;
}

[data-theme="light"] .login-left-content {
    color: white;
}

[data-theme="light"] .toast.success {
    background: rgba(16, 185, 129, 0.1);
}

[data-theme="light"] .toast.error {
    background: rgba(239, 68, 68, 0.1);
}

[data-theme="light"] .toast.warning {
    background: rgba(245, 158, 11, 0.1);
}