/* ========== CSS 变量 / 主题 ========== */
:root {
    --sidebar-width: 272px;
    --sidebar-collapsed: 78px;
    --topbar-height: 68px;

    /* 亮色主题 */
    --bg-primary: #f4f6fb;
    --bg-card: #ffffff;
    --bg-input: #f0f2f8;

    --text-primary: #1e293b;
    --text-secondary: #64748b;

    --border-color: #e8ecf4;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 20px 48px rgba(15, 23, 42, 0.1);

    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.08);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --bg-accent-glow: rgba(99, 102, 241, 0.06);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    /* 侧边栏亮色（默认） */
    --sidebar-bg: #ffffff;
    --sidebar-bg-solid: #ffffff;
    --sidebar-hover: rgba(99, 102, 241, 0.06);
    --sidebar-active: rgba(99, 102, 241, 0.1);
    --sidebar-text: #64748b;
    --sidebar-text-hover: #1e293b;
    --sidebar-border: #e8ecf4;
    --sidebar-section: rgba(0, 0, 0, 0.3);
    --sidebar-icon-bg: transparent;
    --sidebar-icon-bg-hover: rgba(99, 102, 241, 0.08);
    --sidebar-active-icon-bg: linear-gradient(135deg, #6366f1, #8b5cf6);
    --sidebar-active-icon-color: #ffffff;
    --sidebar-active-text: #1e293b;
    --sidebar-user-bg: rgba(99, 102, 241, 0.06);
    --sidebar-user-name: #1e293b;
    --sidebar-user-role: #64748b;
    --sidebar-dot: #94a3b8;
}

/* 全局暗色主题（含侧边栏） */
[data-theme="dark"] {
    --bg-primary: #0c0e1a;
    --bg-card: #151829;
    --bg-input: #1c2038;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;

    --border-color: #1e2240;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.5);

    /* 暗色侧边栏 */
    --sidebar-bg: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    --sidebar-bg-solid: #1a1a2e;
    --bg-accent-glow: rgba(99, 102, 241, 0.12);
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(99, 102, 241, 0.18);
    --sidebar-text: #8b92a5;
    --sidebar-text-hover: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-section: rgba(255, 255, 255, 0.25);
    --sidebar-icon-bg: transparent;
    --sidebar-icon-bg-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active-icon-bg: linear-gradient(135deg, #6366f1, #8b5cf6);
    --sidebar-active-icon-color: #ffffff;
    --sidebar-active-text: #ffffff;
    --sidebar-user-bg: rgba(255, 255, 255, 0.04);
    --sidebar-user-name: #ffffff;
    --sidebar-user-role: #8b92a5;
    --sidebar-dot: #8b92a5;
}

/* ========== 基础重置 ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; background: none; }
input, select { font-family: inherit; outline: none; }

/* ========== 侧边栏 ========== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width var(--transition), background var(--transition);
    overflow: hidden;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 14px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.logo-icon i { font-size: 20px; color: #fff; }

.sidebar-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--sidebar-user-name);
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition);
    letter-spacing: -0.3px;
}

.sidebar.collapsed .sidebar-title { opacity: 0; width: 0; }

/* 导航 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.15); border-radius: 3px; }

/* ===== 单栏可展开菜单（截图同款圆润胶囊风格） ===== */
.nav-section-title {
    padding: 22px 22px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0.9;
}

.sidebar.collapsed .nav-section-title { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.nav-item { margin: 3px 12px; }

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 14px;
    color: var(--sidebar-text);
    transition: all var(--transition);
    gap: 14px;
    position: relative;
    white-space: nowrap;
}

.nav-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    transition: all var(--transition);
    background: transparent;
    color: var(--sidebar-text);
}

.nav-link span {
    flex: 1;
    opacity: 1;
    font-size: 13.5px;
    font-weight: 500;
    transition: opacity var(--transition);
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link .arrow { opacity: 0; width: 0; overflow: hidden; }

.nav-link:hover {
    background: rgba(99, 102, 241, 0.06);
    color: var(--sidebar-text-hover);
}

.nav-link:hover .nav-icon { background: rgba(99, 102, 241, 0.08); color: var(--accent); }

/* 激活态：浅紫圆角胶囊 + 紫色渐变图标 */
.nav-item.active > .nav-link,
.nav-link.active {
    background: rgba(99, 102, 241, 0.13);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.12);
    font-weight: 600;
}

.nav-item.active > .nav-link .nav-icon,
.nav-link.active .nav-icon {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.nav-item.active > .nav-link span,
.nav-link.active span { color: var(--accent); }

.nav-link .arrow {
    font-size: 18px;
    transition: transform var(--transition);
    opacity: 0.45;
    color: var(--sidebar-text);
}

.nav-item.open > .nav-link .arrow { transform: rotate(180deg); }

/* 子菜单 */
.submenu { max-height: 0; overflow: hidden; transition: max-height var(--transition); }
.nav-item.open .submenu { max-height: 900px; }

.submenu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 24px;
    margin: 2px 12px 2px 50px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 400;
    transition: all var(--transition);
    white-space: nowrap;
    border-radius: 10px;
}

.sidebar.collapsed .submenu { display: none; }

.submenu li a:hover { background: rgba(99, 102, 241, 0.06); color: var(--sidebar-text-hover); }

.submenu li a.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    font-weight: 600;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.08);
    transition: all var(--transition);
    cursor: pointer;
    user-select: none;
}

.sidebar-user:hover { background: rgba(99, 102, 241, 0.16); transform: translateY(-1px); }
.sidebar-user:active { transform: translateY(0); }

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.15);
    flex-shrink: 0;
}

.sidebar-user-info { display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--sidebar-user-name); white-space: nowrap; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-user-role); white-space: nowrap; }
.sidebar-user-cog { font-size: 16px; color: var(--sidebar-user-role); opacity: .75; transition: all var(--transition); }
.sidebar-user:hover .sidebar-user-cog { opacity: 1; transform: rotate(45deg); color: var(--accent); }
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-user-cog { display: none; }

/* ========== 主内容区 ========== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left var(--transition);
}

.sidebar.collapsed ~ .main-wrapper { margin-left: var(--sidebar-collapsed); }


/* ========== 顶部导航 ========== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 900;
    transition: background var(--transition), border-color var(--transition);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.toggle-btn {
    font-size: 20px;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.toggle-btn:hover { background: var(--accent-light); color: var(--accent); }

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    gap: 10px;
    min-width: 280px;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-card);
}

.search-box i { color: var(--text-secondary); font-size: 18px; }

.search-box input {
    border: none;
    background: none;
    font-size: 13px;
    color: var(--text-primary);
    width: 100%;
}

.search-box input::placeholder { color: var(--text-secondary); }

.search-box kbd {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    white-space: nowrap;
}

.topbar-right { display: flex; align-items: center; gap: 4px; }

.topbar-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.topbar-item:hover { background: var(--accent-light); color: var(--accent); }

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* 通知弹窗 */
.notification-popup {
    position: absolute;
    top: calc(100% + 12px);
    right: -60px;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all var(--transition);
    z-index: 1001;
    overflow: hidden;
}

.notification-item:hover .notification-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.notification-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

.notification-popup-header h4 { font-size: 14px; font-weight: 700; }
.notification-popup-header a { font-size: 12px; color: var(--accent); font-weight: 500; }

.notification-popup-body { max-height: 260px; overflow-y: auto; }

.notification-item-row {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    transition: background var(--transition);
    border-left: 3px solid transparent;
}

.notification-item-row:hover { background: var(--accent-light); }
.notification-item-row.unread { border-left-color: var(--accent); background: var(--accent-light); }

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    color: #fff;
}

.notification-icon.bg-primary { background: var(--accent); }
.notification-icon.bg-success { background: var(--success); }
.notification-icon.bg-warning { background: var(--warning); }

.notification-content p { font-size: 12.5px; color: var(--text-primary); line-height: 1.4; }
.notification-content span { font-size: 11px; color: var(--text-secondary); margin-top: 2px; display: block; }

.topbar-divider { width: 1px; height: 28px; background: var(--border-color); margin: 0 8px; }

/* 用户头像 */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
}

.user-profile:hover { background: var(--accent-light); }

.avatar { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--accent-light); }

.user-text { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.user-role { font-size: 10.5px; color: var(--text-secondary); }
.user-profile > i { font-size: 18px; color: var(--text-secondary); }

/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all var(--transition);
    z-index: 1000;
}

.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition);
}

.dropdown-menu a:hover { background: var(--accent-light); color: var(--accent); }
.dropdown-menu a i { width: 18px; text-align: center; color: var(--text-secondary); font-size: 16px; }
.dropdown-menu a:hover i { color: var(--accent); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 4px 0; }
.text-danger { color: var(--danger) !important; }
.text-danger:hover { background: rgba(239, 68, 68, 0.08) !important; color: var(--danger) !important; }

/* ========== 页面内容 ========== */
.content { flex: 1; padding: 28px; }

/* ========== 欢迎横幅 ========== */
.welcome-banner {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -5%;
    width: 280px;
    height: 280px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -60%;
    right: 15%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.welcome-text h2 { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.welcome-text p { color: rgba(255, 255, 255, 0.8); font-size: 13.5px; }

.welcome-actions { display: flex; gap: 10px; position: relative; z-index: 1; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-ghost { background: rgba(255, 255, 255, 0.15); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.25); }

.btn-accent { background: #fff; color: var(--accent); }
.btn-accent:hover { background: rgba(255, 255, 255, 0.9); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }

.btn-outline {
    padding: 10px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ========== 统计卡片 ========== */
.stats-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }

/* 统计卡片：柔和渐变背景 + 高对比白字 + 毛玻璃点缀 */
.stat-card {
    border-radius: var(--radius-xl);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    cursor: default;
    color: #fff;
    box-shadow: 0 10px 22px rgba(0,0,0,.08);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(0,0,0,.14); }

.stat-card-bg { position: absolute; inset: 0; pointer-events: none; }
.stat-card-shape { position: absolute; border-radius: 50%; background: #fff; opacity: .10; filter: blur(18px); }
.shape-1 { width: 150px; height: 150px; top: -55px; right: -35px; }
.shape-2 { width: 110px; height: 110px; bottom: -45px; left: -30px; }

.stat-card-content { position: relative; z-index: 1; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }

.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
    transition: all var(--transition);
}
.stat-card:hover .stat-icon-wrap { transform: scale(1.06) rotate(2deg); background: rgba(255,255,255,.26); }

.stat-trend {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.14);
    padding: 4px 10px;
    border-radius: 20px;
    color: #fff;
    transition: all var(--transition);
}
.stat-trend.up { color: #d1fae5; background: rgba(16,185,129,.25); border-color: rgba(16,185,129,.18); }
.stat-trend.down { color: #ffe4e6; background: rgba(244,63,94,.25); border-color: rgba(244,63,94,.18); }

.stat-value { font-size: 32px; font-weight: 800; color: #fff; line-height: 1.2; margin-bottom: 4px; text-shadow: 0 1px 2px rgba(0,0,0,.08); letter-spacing: -.5px; }
.stat-label { font-size: 13px; color: rgba(255,255,255,.86); margin-bottom: 16px; font-weight: 500; }
.stat-bar { height: 4px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: rgba(255,255,255,.55); border-radius: 4px; transition: width 1s ease; }

/* 卡片渐变主题（饱和度适中，保证白字清晰） */
.card-gradient-purple { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); }
.card-gradient-green { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); }
.card-gradient-amber { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); }
.card-gradient-rose { background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%); }
.card-gradient-blue { background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%); }
.card-gradient-indigo { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); }
.card-gradient-teal { background: linear-gradient(135deg, #14b8a6 0%, #2dd4bf 100%); }
.card-gradient-orange { background: linear-gradient(135deg, #f97316 0%, #fb923c 100%); }

/* ========== 图表卡片 ========== */
.charts-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-bottom: 20px; }
.charts-row.reverse { grid-template-columns: 1fr 1.6fr; }

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all var(--transition);
}

.chart-card:hover { box-shadow: var(--shadow-md); border-color: transparent; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.card-header h3 > i { color: var(--accent); }
.card-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.card-actions { display: flex; align-items: center; gap: 6px; }
.card-body { padding: 20px 24px 24px; }

.btn-sm {
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-input);
    color: var(--text-secondary);
    transition: all var(--transition);
    border: 1px solid transparent;
}

.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px var(--accent-glow); }

/* 危险操作按钮：红色描边，悬停红色填充白字 */
.btn-danger {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}
.btn-sm.btn-danger { padding: 5px 12px; }
.btn-outline.btn-danger { background: var(--bg-card); }

.card-body { padding: 16px 24px 24px; }
.card-body.no-pad { padding: 0; }
.chart-center { display: flex; align-items: center; justify-content: center; }
.chart-card canvas { max-height: 280px; }

/* ========== 表格卡片 ========== */
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 24px;
    transition: all var(--transition);
}

.table-card:hover { box-shadow: var(--shadow-md); }
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 20px; text-align: left; white-space: nowrap; }

.data-table th {
    background: var(--bg-input);
    font-weight: 700;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td { font-size: 13px; border-bottom: 1px solid var(--border-color); transition: background var(--transition-fast); }
.data-table tbody tr { transition: all var(--transition-fast); }
.data-table tbody tr:hover td { background: var(--accent-light); }

.data-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; border-radius: 4px; }
.order-id { font-weight: 600; color: var(--accent); }

/* ==================== 模型弹窗（移植自 SiteGo 后台 ai_model） ==================== */
/* 注意：pages.css 中也定义了 .modal-mask 且为 display:flex，会覆盖本文件的隐藏态。
   故用 #modelModal 提升特异性来保持默认隐藏；JS 设置 inline display:flex 仍可正常显示。 */
#modelModal { display: none; }
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.55);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-panel {
    background: var(--bg-card);
    border-radius: 18px;
    max-width: 800px;
    width: 94%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(15,23,42,0.18);
    animation: modalSlideIn 0.25s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 顶部栏 */
.modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
    border-radius: 18px 18px 0 0;
    backdrop-filter: blur(8px);
}
.modal-top-left { display: flex; align-items: center; gap: 14px; }
.modal-top-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(99,102,241,0.3);
}
.modal-top-icon i { font-size: 22px; color: #fff; }
.modal-top-left h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0; line-height: 1.3; }
.modal-top-left p { font-size: 12px; color: var(--text-secondary); margin: 2px 0 0; }
.modal-close-btn {
    width: 36px; height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); font-size: 18px;
    transition: all 0.15s;
}
.modal-close-btn:hover { background: rgba(239,68,68,0.08); border-color: #ef4444; color: #ef4444; }

/* 静态弹窗标题栏内的 X 关闭按钮：靠右对齐 */
.modal-box > .modal-title .modal-close-btn {
    margin-left: auto;
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: 8px;
    font-size: 16px;
}

/* ==================== 区块通用 ==================== */
.m-section { padding: 10px 28px 18px; border-bottom: 1px solid var(--border-color); }
.m-sec-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 0 12px;
    font-size: 14px; font-weight: 700; color: var(--text-primary);
}
.m-sec-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.m-sec-head i { color: var(--accent); font-size: 16px; }
.m-sec-body { padding: 4px 0 8px; }

/* ==================== 表单字段 ==================== */
.m-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .m-row-2 { grid-template-columns: 1fr; } }
.m-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.m-field label { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.m-field input, .m-field select {
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 13.5px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.15s;
    width: 100%;
}
.m-field input:focus, .m-field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
    outline: none;
}
.m-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.m-sub-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }

/* ==================== 接口类型卡片 ==================== */
.api-type-selector { display: flex; gap: 12px; margin-bottom: 18px; }
@media (max-width: 500px) { .api-type-selector { flex-direction: column; } }
.api-type-card {
    flex: 1;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.api-type-card:hover { border-color: var(--accent); background: rgba(99,102,241,0.02); }
.api-type-card.checked {
    border-color: var(--accent);
    background: rgba(99,102,241,0.04);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.06);
}
.api-type-card input { display: none; }
.atc-icon {
    width: 42px; height: 42px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.atc-icon i { font-size: 20px; color: #fff; }
.atc-icon.alt { background: linear-gradient(135deg, #10b981, #34d399); }
.atc-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.atc-text strong { font-size: 13px; color: var(--text-primary); }
.atc-text small { font-size: 11px; color: var(--text-secondary); }
.atc-check { color: var(--border-color); font-size: 22px; transition: color 0.2s; }
.api-type-card.checked .atc-check { color: var(--accent); }

/* ==================== 分辨率芯片 ==================== */
.m-chip-group { display: flex; gap: 10px; flex-wrap: wrap; }
.m-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.18s;
    font-size: 13px; font-weight: 600;
    background: var(--bg-card);
    user-select: none;
}
.m-chip:hover { border-color: var(--accent); background: rgba(99,102,241,0.03); }
.m-chip:has(input:checked) {
    border-color: var(--accent);
    background: rgba(99,102,241,0.07);
    color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}
.m-chip input { display: none; }

.m-pts-list { display: flex; flex-direction: column; gap: 8px; }
.m-pts-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    animation: ptsSlideIn 0.2s ease;
}
@keyframes ptsSlideIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.m-pts-tag { font-size: 13px; font-weight: 700; color: var(--accent); min-width: 30px; }
.m-pts-row input {
    max-width: 110px; padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px; font-size: 13px;
    background: var(--bg-card); color: var(--text-primary);
    transition: all 0.15s; text-align: center;
}
.m-pts-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); outline: none; }
.m-pts-row span:last-child { font-size: 12px; color: var(--text-secondary); }

/* ==================== 底部操作栏 ==================== */
.m-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px;
    border-top: 1px solid rgba(0,0,0,0.08);
    position: sticky; bottom: 0; background: var(--bg-card);
    border-radius: 0 0 18px 18px;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.05);
}
.m-actions { display: flex; gap: 12px; }
.m-footer .btn-outline {
    background: var(--bg-card);
    border: 1.5px solid rgba(100, 116, 139, 0.35);
    color: var(--text-primary);
}
.m-footer .btn-outline:hover {
    border-color: rgba(100, 116, 139, 0.6);
    background: rgba(100, 116, 139, 0.06);
}

/* Toggle 开关 */
.m-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.m-switch input { display: none; }
.m-switch-track {
    width: 44px; height: 24px;
    border-radius: 12px;
    background: #d1d5db;
    position: relative;
    transition: background 0.2s;
}
.m-switch-thumb {
    position: absolute;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    top: 2px; left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.m-switch input:checked + .m-switch-track { background: var(--accent); }
.m-switch input:checked + .m-switch-track .m-switch-thumb { transform: translateX(20px); }
.m-switch-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* ==================== 模型表格（仅本页） ==================== */
.model-table { width: 100%; border-collapse: collapse; }
.model-table thead th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-secondary); padding: 10px 16px; text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.model-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); font-size: 13px; }
.model-row { transition: background 0.15s; }
.model-row:hover { background: var(--bg-primary); }
.model-row:last-child td { border-bottom: none; }
.model-id {
    font-size: 11px; color: var(--text-secondary); background: var(--bg-primary);
    padding: 2px 8px; border-radius: 4px; font-family: 'SF Mono','Consolas',monospace;
}
.model-tag {
    background: var(--bg-primary); padding: 3px 10px; border-radius: 4px;
    font-size: 12px; color: var(--text-primary);
    font-family: 'SF Mono','Consolas',monospace; border: 1px solid var(--border-color);
}
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.status-dot.on  { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.status-dot.off { background: #94a3b8; }
.btn-icon {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--text-secondary);
    cursor: pointer; font-size: 15px; transition: all 0.15s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,0.06); }
.btn-icon-danger:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.06); }
.vtype-badge {
    display: inline-block; font-size: 10px; font-weight: 600;
    padding: 1px 7px; border-radius: 3px; margin-left: 6px;
    vertical-align: middle; line-height: 1.6;
}
.vtype-badge.openai { background: rgba(99,102,241,0.1); color: #6366f1; border: 1px solid rgba(99,102,241,0.25); }
.vtype-badge.agnes { background: rgba(245,158,11,0.1); color: #d97706; border: 1px solid rgba(245,158,11,0.25); }

.customer-info { display: flex; align-items: center; gap: 12px; }
.customer-info img { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--accent-light); }
.customer-info div { display: flex; flex-direction: column; }
.customer-name { font-weight: 600; font-size: 13px; }
.customer-email { font-size: 11px; color: var(--text-secondary); }
.amount { font-weight: 700; color: var(--text-primary); }

/* 操作日志页专用 */
.op-user { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-primary); font-weight: 500; }
.op-user i { color: var(--accent); font-size: 15px; }
.log-detail { display: inline-block; max-width: 420px; word-break: break-all; line-height: 1.5; color: var(--text-secondary); cursor: default; }
.log-detail-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-secondary); border-radius: 6px; padding: 4px 9px; font-size: 12px; cursor: pointer; transition: .2s ease; }
.log-detail-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft, rgba(99,102,241,.08)); }
.log-detail-btn i { font-size: 14px; color: var(--accent); }
.ip-chip { font-family: var(--font-mono, ui-monospace, monospace); font-size: 12px; color: var(--text-secondary); background: var(--bg-primary); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border-color); }

/* 状态标签 */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-badge i { font-size: 14px; }
.status-badge.completed { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-badge.processing { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.status-badge.pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-badge.cancelled { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.action-btns { display: flex; gap: 4px; }

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition);
}

.action-btn.view { color: var(--info); }
.action-btn.view:hover { background: rgba(59, 130, 246, 0.1); transform: scale(1.1); }
.action-btn.edit { color: var(--warning); }
.action-btn.edit:hover { background: rgba(245, 158, 11, 0.1); transform: scale(1.1); }
.action-btn.delete { color: var(--danger); }
.action-btn.delete:hover { background: rgba(239, 68, 68, 0.1); transform: scale(1.1); }

.search-mini {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    gap: 8px;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.search-mini:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-mini i { color: var(--text-secondary); font-size: 16px; }
.search-mini input { border: none; background: none; font-size: 12px; color: var(--text-primary); width: 130px; }
.search-mini input::placeholder { color: var(--text-secondary); }

.filter-group { margin-right: 4px; }

.form-select {
    padding: 7px 32px 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: all var(--transition);
}

.form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.btn.btn-accent { background: var(--accent); color: #fff; }
.btn.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.pagination-info { font-size: 13px; color: var(--text-secondary); }
.pagination-info strong { color: var(--text-primary); }
.pagination-btns { display: flex; gap: 4px; }

.page-btn {
    min-width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
    font-weight: 500;
}

.page-btn:hover:not(:disabled):not(.dots) { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px var(--accent-glow); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== 后台通用分页器（admin-table.js 渲染 + gallery.html 等自定义分页器） ========== */
/* 结构1（admin-table.js）：<div.table-pager><span.pager-info>+<div.pager-btns><button>×N</button></div></div> */
/* 结构2（gallery.html 等）：<div.table-pager><button.pager-btn>+<span.pager-info>+<button.pager-btn></div> */
.table-pager {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; margin-top: 4px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}
.table-pager .pager-info {
    font-size: 13px; color: var(--text-secondary);
}
.table-pager .pager-info strong { color: var(--text-primary); font-weight: 600; }
.table-pager .pager-btns { display: flex; gap: 6px; align-items: center; }
.table-pager .pager-btns button,
.table-pager .pager-btn {
    min-width: 34px; height: 34px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.table-pager .pager-btns button i,
.table-pager .pager-btn i { font-size: 16px; }
.table-pager .pager-btns button:hover:not(:disabled),
.table-pager .pager-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}
.table-pager .pager-btns button:disabled,
.table-pager .pager-btn:disabled {
    opacity: 0.4; cursor: not-allowed;
}
/* 同时居中显示分页器（很多页面只有一个，居中更好看） */
.table-pager:has(> .pager-info:only-child) { justify-content: center; }
.page-btn.dots { border: none; cursor: default; }

/* ========== 页脚 ========== */
.footer { text-align: center; padding: 22px; font-size: 13px; color: var(--text-secondary); border-top: 1px solid var(--border-color); }
.footer-brand { font-weight: 700; color: var(--accent); }

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ========== 动画 ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.welcome-banner { animation: fadeInScale 0.5s ease forwards; }
.stat-card, .chart-card, .table-card { animation: fadeInUp 0.5s ease forwards; opacity: 0; }

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }
.stat-card:nth-child(6) { animation-delay: 0.3s; }
.stat-card:nth-child(7) { animation-delay: 0.35s; }
.stat-card:nth-child(8) { animation-delay: 0.4s; }
.charts-row:first-of-type { animation-delay: 0.25s; }
.charts-row:nth-of-type(2) { animation: fadeInUp 0.5s ease 0.3s forwards; opacity: 0; }
.table-card { animation-delay: 0.35s; }

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .charts-row, .charts-row.reverse { grid-template-columns: 1fr; }
    .search-box { display: none; }
    .welcome-banner { flex-direction: column; gap: 16px; text-align: center; }
    .notification-popup { right: -100px; width: 300px; }
}

@media (max-width: 768px) {
    .stats-cards { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .user-text { display: none; }
    .welcome-banner { padding: 20px; }
    .welcome-text h2 { font-size: 18px; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.show { display: block; }

/* ========== SiteGo 扩展 ========== */
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}
.text-muted { color: var(--text-secondary); }
.btn-accent-text { color: var(--accent); font-weight: 600; }
.btn-accent-text:hover { text-decoration: underline; }
.bg-primary-light { background: var(--accent-light); }

/* ========== 前台页面覆盖 ========== */
body.frontend {
    display: block; /* 前台无侧边栏，取消后台 flex 横向布局，避免 header/main/footer 被挤成竖条 */
}
/* 前台内容容器：居中 + 最大宽度，避免超宽屏扁长、窄屏贴边 */
body.frontend .content {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 40px);
}
/* 首页 Hero 等宽屏区块需突破内容宽度限制，可单独处理 */
body.frontend .content > .hero,
body.frontend .content > section { width: 100%; }

/* 全屏型页面（登录/注册）：突破 content 的内边距，铺满视口高度 */
body.frontend .content .login-page {
    margin: calc(clamp(20px, 4vw, 40px) * -1);
    min-height: calc(100vh - var(--topbar-height));
    border-radius: 0;
}
@media (max-width: 560px){
    body.frontend .content .login-page { margin: -20px; }
    .login-card { padding: 28px 22px !important; }
}

/* ========== 绘画工作区（image_gen.html）响应式 ========== */
.img-gen-workspace { display:grid; grid-template-columns:360px 1fr; gap:20px; align-items:start; }
@media (max-width: 900px){
    .img-gen-workspace { grid-template-columns:300px 1fr; }
}
@media (max-width: 680px){
    .img-gen-workspace { grid-template-columns:1fr; }
    .img-gen-panel { order:2; }            /* 手机上控制面板移到结果下方，先看结果 */
    .img-gen-result { order:1; min-height:auto; }
    #result { grid-template-columns:1fr; } /* 结果图手机单列，避免挤压扁长 */
}

/* ========== Toast 通知 ========== */
.toast-wrap {
    position: fixed;
    top: calc(var(--topbar-height) + 16px);
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: min(420px, calc(100vw - 40px));
}

.toast-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    overflow: hidden;
    transform: translateX(120%);
    opacity: 0;
    animation: toast-in var(--transition) forwards;
}

.toast-item.toast-out {
    animation: toast-out var(--transition-fast) forwards;
}

.toast-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast-item.success::before { background: linear-gradient(180deg, #10b981, #059669); }
.toast-item.error::before   { background: linear-gradient(180deg, #ef4444, #dc2626); }
.toast-item.warning::before { background: linear-gradient(180deg, #f59e0b, #d97706); }
.toast-item.info::before    { background: linear-gradient(180deg, #3b82f6, #2563eb); }

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.toast-item.success .toast-icon { background: rgba(16, 185, 129, 0.12); color: #059669; }
.toast-item.error .toast-icon   { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.toast-item.warning .toast-icon { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.toast-item.info .toast-icon    { background: rgba(59, 130, 246, 0.12); color: #2563eb; }

.toast-body {
    flex: 1;
    min-width: 0;
    padding-right: 18px;
}

.toast-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
}

.toast-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-top: 2px;
}

.toast-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.toast-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    left: 4px;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(0,0,0,0.06);
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left;
    animation: toast-progress 3s linear forwards;
}

.toast-item.success .toast-progress-bar { background: rgba(16, 185, 129, 0.55); }
.toast-item.error .toast-progress-bar   { background: rgba(239, 68, 68, 0.55); }
.toast-item.warning .toast-progress-bar { background: rgba(245, 158, 11, 0.55); }
.toast-item.info .toast-progress-bar    { background: rgba(59, 130, 246, 0.55); }

.toast-item:hover .toast-progress-bar { animation-play-state: paused; }

@keyframes toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; max-height: 120px; margin-bottom: 0; }
    to   { transform: translateX(120%); opacity: 0; max-height: 0; margin-bottom: -12px; padding-top: 0; padding-bottom: 0; }
}

@keyframes toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@media (max-width: 768px) {
    .toast-wrap {
        right: 16px;
        top: calc(var(--topbar-height) + 12px);
        max-width: calc(100vw - 32px);
    }
    .toast-item { padding: 12px 14px; }
}

/* 暗色主题下进度条背景更明显 */
[data-theme="dark"] .toast-progress { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .toast-close:hover { background: rgba(255,255,255,0.08); }

/* ==================== 统一模态框 / 确认框 / 输入弹窗 ==================== */
.ui-modal-mask {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.ui-modal-mask.show { opacity: 1; animation: uiFadeIn 0.25s ease; }
@keyframes uiFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ui-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: uiDialogIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes uiDialogIn { to { transform: translateY(0) scale(1); } }

.ui-dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
}
.ui-dialog-head h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 0; }
.ui-dialog-x {
  width: 30px; height: 30px; border: none; background: transparent;
  color: var(--text-secondary); border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  transition: all 0.2s;
}
.ui-dialog-x:hover { background: var(--bg-primary); color: var(--text-primary); }
.ui-dialog-body { padding: 20px; }

/* 公告弹窗 */
.ann-pop.ui-dialog, .ann-pop .ui-dialog { max-width: 540px; width: min(92vw, 540px); }
.ann-pop .ui-dialog-body { padding: 8px 4px 4px; }
.ann-pop-item {
  padding: 14px 16px; border-radius: 12px; background: var(--bg-input, rgba(99,102,241,.06));
  margin-bottom: 12px; border: 1px solid var(--border-color, rgba(99,102,241,.12));
  animation: cardIn .4s cubic-bezier(.16,1,.3,1) both;
}
.ann-pop-item:last-child { margin-bottom: 0; }
.ann-pop-title {
  display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700;
  color: var(--text-primary, #1e293b); margin-bottom: 6px;
}
.ann-pop-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #6366f1); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.ann-pop-content { font-size: 13px; line-height: 1.65; color: var(--text-secondary, #64748b); padding-left: 17px; }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.ui-confirm-text { font-size: 14px; color: var(--text-primary); line-height: 1.6; margin: 0 0 18px; }
.ui-dialog-actions { display: flex; gap: 12px; justify-content: flex-end; }

.ui-input {
  width: 100%; padding: 11px 14px; font-size: 14px;
  border: 1px solid var(--border-color); border-radius: 10px;
  background: var(--bg-input); color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s; margin-bottom: 18px;
}
.ui-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.ui-btn {
  padding: 9px 22px; font-size: 14px; font-weight: 600; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; transition: all 0.2s;
  position: relative; overflow: hidden;
}
.ui-btn-ghost { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-color); }
.ui-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.ui-btn-accent { background: var(--accent-gradient); color: #fff; }
.ui-btn-accent:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ui-btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.ui-btn-danger:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* 按钮涟漪 */
.btn, .ui-btn, .m-card, .shop-card { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, 0.45); transform: scale(0); animation: rippleAnim 0.6s ease-out;
}
@keyframes rippleAnim { to { transform: scale(2); opacity: 0; } }

/* 卡片入场（stagger 淡入上浮） */
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.anim-card { animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* 空状态插画 */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 20px; color: var(--text-secondary); text-align: center; gap: 12px;
}
.empty-state i { font-size: 46px; color: var(--border-color); }
.empty-state p { font-size: 14px; margin: 0; }

/* ==================== 用户中心视觉增强 ==================== */
/* 卡片通用 hover 抬升 + 光晕 */
.member-profile-card, .member-menu, .member-tab-content,
.shop-card, .m-card, .rec-row, .db-card, .stat-card, .invite-card, .sign-card {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s, border-color 0.28s;
}
.member-profile-card:hover, .member-tab-content:hover, .db-card:hover, .stat-card:hover {
  box-shadow: 0 14px 36px rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35);
}
.shop-card:hover, .m-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.4);
}
/* 会员中心左侧菜单项 hover */
.member-menu .menu-item { transition: background 0.2s, color 0.2s, border-color 0.2s, padding-left 0.2s; }
.member-menu .menu-item:hover { background: var(--accent-light); padding-left: 26px; }

/* 头像呼吸光晕 */
.member-profile-card > div:first-child {
  animation: avatarGlow 3.5s ease-in-out infinite;
}
@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 8px 32px rgba(139, 92, 246, 0.5); }
}

/* 统计数字强调（仅保留等宽数字特性） */
.stat-card .stat-num, .stat-value {
  font-variant-numeric: tabular-nums;
}

/* 按钮基础微交互增强 */
.btn { transition: transform 0.18s, box-shadow 0.2s, filter 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

/* 表格行 hover 高亮已具备，增加左侧强调条 */
.rec-row { position: relative; }
.rec-row::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent-gradient); opacity: 0; transition: opacity 0.2s;
  border-radius: 0 3px 3px 0;
}
.rec-row:hover::before { opacity: 1; }

/* 入场 stagger（配合 user-beautify.js 添加 .anim-card 与 --i） */
.anim-card { animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }

/* 骨架加载 */
@keyframes shimmer { 100% { background-position: -200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--accent-light) 37%, var(--bg-input) 63%);
  background-size: 200% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px;
}
