/**
 * Chart Spec - 图表设计规范
 * A professional chart design specification
 * Modern, Clean, Elegant
 */

/* ==================== CSS Variables ==================== */
:root {
    /* 主色调 */
    --primary: #5B8FF9;
    --primary-light: #409CFF;
    --primary-dark: #0051D4;
    
    /* 功能色 - AntV 语义色 */
    --success: #5AD8A6;
    --warning: #F6BD16;
    --danger: #E86452;
    --info: #6DC8EC;
    
    /* 图表色板 - AntV 官方分类色板 */
    --chart-blue: #5B8FF9;      /* 分类1 - 蓝 */
    --chart-green: #5AD8A6;     /* 分类2 - 绿 */
    --chart-gray: #5D7092;      /* 分类3 - 灰蓝 */
    --chart-yellow: #F6BD16;    /* 分类4 - 黄 */
    --chart-red: #E86452;       /* 分类5 - 红 */
    --chart-cyan: #6DC8EC;      /* 分类6 - 青 */
    --chart-purple: #945FB9;    /* 分类7 - 紫 */
    --chart-orange: #FF9845;    /* 分类8 - 橙 */
    --chart-teal: #1E9493;      /* 分类9 - 青绿 */
    --chart-pink: #FF99C3;      /* 分类10 - 粉 */
    
    /* 灰度 */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    /* 背景 */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F5F7;
    --bg-tertiary: #FBFBFD;
    --bg-sidebar: rgba(255, 255, 255, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-dark: rgba(0, 0, 0, 0.85);
    
    /* 文字 */
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --text-tertiary: #AEAEB2;
    
    /* 边框 */
    --border-light: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.1);
    --border-dark: rgba(0, 0, 0, 0.18);
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);
    
    /* 动画 */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* 布局 - 统一尺寸 */
    --sidebar-width: 240px;
    --header-height: 48px;
    --content-max-width: 1200px; /* 增大最大宽度，让图表更大 */
    --chart-height-sm: 220px; /* 增大小型图表高度 */
    --chart-height-md: 300px; /* 增大中型图表高度 */
    --chart-height-lg: 380px; /* 增大大型图表高度 */
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 10px;
    --border-radius-xl: 12px;
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", 
                 "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.nav-ready {
    opacity: 1;
}

/* ==================== Typography ==================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== Layout System ==================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-secondary);
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right: 0.5px solid rgba(0,0,0,0.08);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0 !important;
    }
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: #FFF;
    position: relative;
    padding-bottom: 80px;
}

.app-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 40px 24px;
    /* 确保内容居中，左右边距平衡 */
    /* 简化居中逻辑：使用margin auto居中，padding保持对称 */
    padding-left: 24px;
    padding-right: 24px;
}

/* Sidebar Styling */
.sidebar-nav {
    padding: 24px 16px;
}

.nav-group {
    margin-bottom: 32px;
}

.nav-group-title {
    padding: 0 12px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: none;
    letter-spacing: 0.02em;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 113, 227, 0.06);
    color: var(--apple-blue);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    background: var(--apple-blue);
    border-radius: 0 4px 4px 0;
}

.nav-item-icon {
    display: none;
}

/* ==================== Sidebar ==================== */
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.sidebar-logo-text {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-logo-version {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Search Box */
.sidebar-search {
    padding: 16px 20px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 36px;
    background: var(--gray-100);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    background: var(--bg-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
    font-size: 14px;
    pointer-events: none;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 20px;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.02em;
    color: var(--text-tertiary);
}

.nav-item-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}

/* ==================== Back Button ==================== */
.back-nav {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 8px 24px 0;
    box-sizing: border-box;
    width: 100%;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.back-btn:hover {
    color: var(--brand-color);
}

.back-btn:active {
    opacity: 0.7;
}

.back-btn svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

/* ==================== Page Header ==================== */
.page-header {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 12px;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
    width: 100%;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.page-header .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.tech-stack {
    display: inline-flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.tech-tag {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tech-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ==================== Chart Type Badge ==================== */
.chart-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1) 0%, rgba(88, 86, 214, 0.1) 100%);
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.chart-type-badge .icon {
    font-size: 12px;
}

.chart-type-badge .text {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
}

/* ==================== Cards ==================== */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 18px;
}

/* ==================== Chart Cards ==================== */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.chart-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    text-decoration: none;
    color: inherit;
    display: block;
    box-sizing: border-box;
    width: 100%; /* 确保卡片占满容器宽度 */
    max-width: 100%; /* 确保不超出容器 */
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.chart-card-preview {
    height: 70px;
    background: linear-gradient(180deg, var(--gray-50) 0%, var(--gray-100) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chart-card-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 100%, rgba(0, 122, 255, 0.05) 0%, transparent 70%);
}

.chart-card-preview .icon {
    font-size: 28px;
    filter: grayscale(20%);
    transition: all var(--transition-normal);
}

.chart-card:hover .chart-card-preview .icon {
    transform: scale(1.1);
    filter: grayscale(0%);
}

.chart-card-content {
    padding: 10px 12px;
}

.chart-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chart-card-subtitle {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 400;
}

.chart-card-desc {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

/* Featured Card */
.chart-card.featured {
    grid-column: span 2;
    background: linear-gradient(135deg, #0071E3 0%, #0051D4 100%);
}

.chart-card.featured .chart-card-preview {
    background: rgba(255, 255, 255, 0.1);
}

.chart-card.featured .chart-card-preview::before {
    background: radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
}

.chart-card.featured .chart-card-title {
    color: white;
}

.chart-card.featured .chart-card-subtitle {
    color: rgba(255, 255, 255, 0.6);
}

.chart-card.featured .chart-card-desc {
    color: rgba(255, 255, 255, 0.8);
}

.chart-card.featured:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .chart-card.featured { grid-column: span 1; }
}

/* ==================== Category Sections ==================== */
.category-section {
    margin-bottom: 24px;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.category-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.category-icon.special { 
    background: linear-gradient(135deg, #0071E3 0%, #0051D4 100%);
    box-shadow: 0 2px 8px rgba(118, 75, 162, 0.25);
}
.category-icon.basic { 
    background: linear-gradient(135deg, #0071E3 0%, #0051D4 100%);
    box-shadow: 0 2px 8px rgba(91, 143, 249, 0.25);
}
.category-icon.proportion { 
    background: linear-gradient(135deg, #F6BD16 0%, #D9A00C 100%);
    box-shadow: 0 2px 8px rgba(246, 189, 22, 0.25);
}
.category-icon.statistical { 
    background: linear-gradient(135deg, #5AD8A6 0%, #36B389 100%);
    box-shadow: 0 2px 8px rgba(90, 216, 166, 0.25);
}
.category-icon.analysis { 
    background: linear-gradient(135deg, #E86452 0%, #C74B3B 100%);
    box-shadow: 0 2px 8px rgba(232, 100, 82, 0.25);
}
.category-icon.other { 
    background: linear-gradient(135deg, #9270CA 0%, #7654B0 100%);
    box-shadow: 0 2px 8px rgba(146, 112, 202, 0.25);
}

.category-info {
    flex: 1;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.category-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ==================== Status Badge ==================== */
.status-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.status-badge.ready {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}

.status-badge.draft {
    background: rgba(255, 149, 0, 0.15);
    color: var(--warning);
}

/* ==================== Spec Section ==================== */
.spec-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 16px 20px; /* 增大内边距 */
    margin-bottom: 16px; /* 增大间距 */
    border: 1px solid var(--border-light);
    padding-left: 20px; /* 确保左侧padding，让内容向右移动 */
    padding-right: 20px;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
    /* 确保规范区块居中，左右边距平衡 */
    width: 100%;
    box-sizing: border-box;
}

.spec-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spec-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 2px;
}

/* Spec Table */
.spec-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11px;
}

.spec-table th {
    background: var(--gray-50);
    color: var(--text-secondary);
    padding: 8px 12px;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid var(--border-light);
}

.spec-table th:first-child {
    border-radius: var(--border-radius-sm) 0 0 0;
}

.spec-table th:last-child {
    border-radius: 0 var(--border-radius-sm) 0 0;
}

.spec-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.spec-table tr:last-child td {
    border-bottom: none;
}

.spec-table tr.highlight td {
    background: rgba(0, 122, 255, 0.04);
}

.spec-table code {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", "Fira Code", "Monaco", monospace;
    font-size: 10px;
}

/* ==================== Code Block ==================== */
.code-block {
    background: var(--gray-900);
    color: #E6E8EB;
    padding: 12px 14px;
    border-radius: var(--border-radius-md);
    font-family: "SF Mono", "Fira Code", "Monaco", monospace;
    font-size: 10px;
    line-height: 1.6;
    overflow-x: auto;
}

.code-block .comment { color: #6A737D; }
.code-block .keyword { color: #FF7B72; }
.code-block .string { color: #A5D6FF; }
.code-block .number { color: #79C0FF; }
.code-block .function { color: #D2A8FF; }
.code-block .property { color: #FFA657; }

/* ==================== Chart Container ==================== */
/* 统一图表容器布局 - PC和移动端 */
.chart-container {
    margin-bottom: 20px;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    /* 确保图表容器居中，左右边距平衡 */
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .chart-container {
        margin-bottom: 12px;
        padding: 0 4px;
    }
}

/* 统一图表卡片头部 - PC和移动端 */
.chart-card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
    gap: 12px;
    min-height: 44px;
}

@media (max-width: 768px) {
    .chart-card-header {
        padding: 10px 12px;
        gap: 8px;
        min-height: 40px;
    }
}

.chart-card-header .header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.chart-card-header .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-tag {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.chart-tag.blue { background: rgba(0, 113, 227, 0.1); color: var(--chart-blue); }
.chart-tag.green { background: rgba(52, 199, 89, 0.1); color: var(--chart-green); }
.chart-tag.yellow { background: rgba(255, 149, 0, 0.1); color: var(--chart-yellow); }
.chart-tag.red { background: rgba(255, 59, 48, 0.1); color: var(--chart-red); }
.chart-tag.purple { background: rgba(88, 86, 214, 0.1); color: var(--chart-purple); }

/* 查看代码按钮 */
.btn-view-code {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--gray-100);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-view-code:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.btn-view-code.active {
    background: var(--chart-blue);
    color: white;
    border-color: var(--chart-blue);
}

.btn-view-code svg {
    width: 14px;
    height: 14px;
}

/* 代码展示区 */
.chart-code-panel {
    display: none;
    background: var(--gray-900);
    border-top: 1px solid var(--border-light);
    max-height: 300px;
    overflow: auto;
}

.chart-code-panel.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 300px; }
}

.chart-code-panel pre {
    margin: 0;
    padding: 16px;
    font-family: "SF Mono", "Fira Code", "Monaco", monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #E6E8EB;
    white-space: pre-wrap;
    word-break: break-all;
}

.chart-code-panel .code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.chart-code-panel .code-header span {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
}

.btn-copy-code {
    padding: 4px 8px;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-copy-code:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.btn-copy-code.copied {
    background: var(--chart-green);
    color: white;
}

/* Chart Meta - 统一布局 */
.chart-meta {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    background: var(--gray-50);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 44px;
}

.chart-meta:empty {
    display: none;
}

.chart-meta-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.chart-meta-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.chart-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    align-items: center;
}

.chart-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==================== 统一筛选系统 ==================== */
/* 筛选控件区域 - 统一使用筛选按钮，不再使用分散的dropdown */
.chart-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* 统一筛选按钮 */
.filter-wrapper {
    position: relative;
    display: inline-block;
}

.filter-unified-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-unified-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-unified-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-unified-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 2px;
}

.filter-unified-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* 筛选面板 - 使用fixed定位，紧贴按钮，不遮挡图表 */
.filter-modal {
    position: fixed;
    z-index: 10000;
    display: none;
    pointer-events: none;
    margin-top: 0; /* 确保紧贴按钮，0px间隙 */
}

.filter-modal.show {
    display: block;
    pointer-events: auto;
}

.filter-panel {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    max-width: 320px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-panel-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
    cursor: move;
    user-select: none;
}

.filter-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-panel-drag-handle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    color: var(--text-tertiary);
}

.filter-panel-drag-handle svg {
    width: 100%;
    height: 100%;
}

.filter-panel-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-panel-close:hover {
    color: var(--text-primary);
}

.filter-panel-body {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.filter-dimension {
    margin-bottom: 12px;
}

.filter-dimension:last-child {
    margin-bottom: 0;
}

.filter-dimension.collapsed .filter-dimension-content {
    display: none;
}

.filter-dimension-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    cursor: pointer;
    user-select: none;
}

.filter-dimension-header:hover {
    background: var(--gray-50);
    border-radius: 4px;
}

.filter-dimension-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.filter-dimension-toggle {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
}

.filter-dimension.collapsed .filter-dimension-toggle {
    transform: rotate(-90deg);
}

.filter-dimension-content {
    padding: 8px 4px 10px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-option {
    padding: 5px 12px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: white;
    font-size: 11px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.filter-option:hover {
    border-color: var(--primary);
    background: rgba(91, 143, 249, 0.08);
}

.filter-option.selected {
    background: rgba(91, 143, 249, 0.15);
    color: var(--primary);
    border-color: var(--primary);
}

.filter-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-range-input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 11px;
    height: 28px;
    box-sizing: border-box;
}

.filter-range-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(91, 143, 249, 0.1);
}

.filter-range span {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.filter-panel-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.filter-btn {
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.filter-btn-reset {
    background: transparent;
    color: var(--text-tertiary);
}

.filter-btn-reset:hover {
    color: var(--text-primary);
}

.filter-btn-apply {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.filter-btn-apply:hover {
    background: rgba(91, 143, 249, 0.08);
    border-color: var(--primary-light);
    color: var(--primary-light);
}

/* 筛选摘要 */
.filter-summary {
    display: none;
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.4;
}

.filter-summary.has-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.filter-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    color: var(--text-primary);
}

.filter-summary-label {
    color: var(--text-tertiary);
    font-size: 10px;
}

.filter-summary-value {
    color: var(--text-primary);
    font-size: 10px;
}

.filter-summary-clear {
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 12px;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all var(--transition-fast);
    margin-left: 2px;
}

.filter-summary-clear:hover {
    color: var(--text-primary);
    background: var(--gray-100);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .filter-modal {
        min-width: 300px;
        max-width: calc(100vw - 24px);
    }
    
    .filter-panel {
        max-height: 75vh;
    }
    
    .chart-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* 统一所有标记为方形 */
.chart-meta-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 2px; /* 改为方形，统一设计 */
    background: var(--chart-blue);
    display: inline-block;
}

/* Chart Body - 统一高度和布局 */
.chart-body {
    position: relative;
    height: var(--chart-height-md);
    padding: 16px; /* 增大内边距，让图表有更多空间 */
    /* 平衡左右padding，让图表内容居中显示，右侧为图例留出空间 */
    padding-left: 10px; /* 减少左侧padding，让图表向右移动 */
    padding-right: 20px; /* 横向图例不需要太多右侧空间 */
    background: var(--bg-primary);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* 外部标签图表需要允许overflow visible */
.chart-body[style*="overflow: visible"],
.chart-body .has-outer-labels {
    overflow: visible;
    padding: 20px; /* 增加padding为外部标签留出空间 */
}

.chart-body.sm { height: var(--chart-height-sm); }
.chart-body.md { height: var(--chart-height-md); }
.chart-body.lg { height: var(--chart-height-lg); }
.chart-body.xl { height: 450px; } /* 超大型图表，用于桑基图等复杂图表 */

@media (max-width: 768px) {
    .chart-body {
        padding: 8px 6px 12px;
        padding-left: 6px; /* 移动端也减少左侧padding */
        padding-right: 6px; /* 移动端横向图例不需要太多右侧空间 */
    }
    .chart-body.sm { height: 200px; }
    .chart-body.md { height: 260px; }
    .chart-body.lg { height: 300px; }
}

/* ==================== Annotation System ==================== */
.annotation-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.chart-card:hover .annotation-layer,
.chart-body:hover .annotation-layer {
    opacity: 1;
    visibility: visible;
}

.hover-hint {
    display: none !important; /* 完全隐藏悬停提示，避免遮挡图表 */
    position: absolute;
    top: 8px;
    right: 180px; /* 调整位置，避免与图例和Y轴标签重叠 */
    font-size: 10px;
    color: var(--primary);
    background: rgba(0, 122, 255, 0.1);
    padding: 4px 10px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 0; /* 降低z-index，确保不遮挡图表 */
    white-space: nowrap; /* 防止文字换行重叠 */
    pointer-events: none; /* 不阻挡交互 */
}

.chart-body:hover .hover-hint {
    display: none !important; /* 悬停时也保持隐藏 */
    opacity: 0;
}

/* Params Panel - 优化尺寸和位置 */
.params-panel {
    position: absolute;
    background: var(--bg-glass-dark);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: white;
    padding: 10px 12px;
    border-radius: var(--border-radius-md);
    font-size: 10px;
    line-height: 1.6;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    z-index: 200;
    min-width: 140px;
    max-width: 180px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* 预定义位置类 - 确保不会超出边界 */
.params-panel.top-left { top: 8px; left: 8px; }
.params-panel.top-right { top: 8px; right: 8px; }
.params-panel.top-center { top: 8px; left: 50%; transform: translateX(-50%); }
.params-panel.bottom-left { bottom: 8px; left: 8px; }
.params-panel.bottom-right { bottom: 8px; right: 8px; }
.params-panel.bottom-center { bottom: 8px; left: 50%; transform: translateX(-50%); }
.params-panel.center-left { top: 50%; left: 8px; transform: translateY(-50%); }
.params-panel.center-right { top: 50%; right: 8px; transform: translateY(-50%); }

.params-panel-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 6px;
}

.params-panel-title::before {
    content: '';
    width: 2px;
    height: 12px;
    background: var(--primary-light);
    border-radius: 1px;
}

.params-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    gap: 8px;
}

.params-row .label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 10px;
    white-space: nowrap;
}

.params-row .value {
    font-family: "SF Mono", monospace;
    color: var(--chart-green);
    font-weight: 500;
    font-size: 10px;
    text-align: right;
}

.params-row .value.highlight {
    color: var(--chart-yellow);
}

.params-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.params-section {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    margin: 8px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==================== Chart Summary ==================== */
/* 统一图表摘要布局 - PC和移动端 */
.chart-summary {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--gray-50);
    text-align: center;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 768px) {
    .chart-summary {
        padding: 8px 12px;
        font-size: 10px;
        gap: 8px;
        min-height: 36px;
    }
}

.chart-summary .summary-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.chart-summary .summary-label {
    color: var(--text-secondary);
}

.chart-summary .summary-value {
    font-weight: 600;
    color: var(--text-primary);
}

.chart-summary .summary-value.blue { color: var(--chart-blue); }
.chart-summary .summary-value.green { color: var(--chart-green); }

/* ==================== Custom Legend ==================== */
/* 统一图例位置：所有图表的图例统一在右侧对齐，不遮挡图表 */
/* 图例面板靠右，但图例项内文字靠左对齐 */
.custom-legend {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* 图例项内内容左对齐 */
    gap: 8px;
    z-index: 1; /* 最低z-index，确保不遮挡图表内容 */
    max-width: 200px; /* 横向图例增加最大宽度，避免遮挡 */
    font-size: 11px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    max-width: 140px;
    pointer-events: auto; /* 确保图例可交互 */
    /* 确保图例在图表容器外，不遮挡数据区域 */
    transform: translateX(0);
}

/* 图例横向布局（适用于某些图表） */
.custom-legend.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end; /* 横向布局时面板靠右 */
    max-width: calc(100% - 60px); /* 增加左侧空间，确保文字不被截断 */
    top: 4px; /* 进一步上移，避免遮挡图表顶部 */
    right: 50px; /* 增加右边距，为右Y轴单位标签留出更多空间，避免文字被截断 */
    left: auto;
    z-index: 0; /* 降低z-index，确保不遮挡图表 */
    pointer-events: none; /* 禁用交互，避免遮挡图表交互 */
    padding: 6px 12px; /* 增加内边距，确保文字有足够空间显示 */
    font-size: 10px; /* 稍微减小字体，让图例更紧凑 */
    white-space: nowrap; /* 防止文字换行 */
}

/* 横向布局时，图例项内文字仍左对齐 */
.custom-legend.horizontal .legend-item {
    justify-content: flex-start;
    width: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 确保文字靠左对齐 */
    gap: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 2px 4px; /* 增加左右padding，确保文字有足够空间 */
    white-space: nowrap; /* 防止文字换行 */
    width: auto; /* 允许图例项根据内容自适应宽度 */
    min-width: fit-content; /* 确保文字不被截断 */
}

.legend-item:hover { 
    opacity: 0.7; 
    transform: translateX(-2px);
}

.legend-item.disabled { 
    opacity: 0.3; 
    cursor: not-allowed;
}

.legend-text {
    font-size: 11px;
    color: var(--text-primary);
    font-weight: 400;
}

/* 统一图例标记为圆形 - 所有图表统一使用圆形标记 */
.legend-icon-square,
.legend-icon-circle,
.legend-icon-line-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%; /* 统一使用圆形，border-radius: 50% 为圆形 */
    flex-shrink: 0;
    display: inline-block;
}

/* 线条图例也使用方形标记 */
.legend-icon-line {
    width: 16px;
    height: 2px;
    border-radius: 1px;
    flex-shrink: 0;
    position: relative;
}

/* 移除圆形标记的伪元素 */
.legend-icon-line-dot::after {
    display: none;
}

/* ==================== Axis Labels ==================== */
.axis-unit {
    position: absolute;
    background: var(--gray-100);
    color: var(--text-primary);
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 50;
    pointer-events: none;
    font-weight: 500;
}

/* Y轴单位标签 - 规范位置：Y轴顶部右侧，紧贴Y轴标签 */
.axis-unit.y-left { 
    top: 6px; /* 图表顶部，与Y轴顶部对齐 */
    left: 28px; /* 左Y轴右侧，紧贴Y轴标签（根据padding[3]=20px，Y轴标签在20-25px位置，单位标签在其右侧） */
    right: auto;
    z-index: 5; /* 降低z-index，避免遮挡图表 */
}
.axis-unit.y-right { 
    top: 6px; /* 图表顶部，与Y轴顶部对齐 */
    right: 50px; /* 右Y轴右侧，留出足够空间避免被切断，不遮挡图表标签 */
    left: auto;
    z-index: 5; /* 降低z-index，避免遮挡图表 */
    white-space: nowrap; /* 防止文字换行 */
}
.axis-unit.x-bottom { 
    bottom: 6px; 
    right: 6px; 
    z-index: 5; /* 降低z-index，避免遮挡图表 */
}

/* X轴字段标签 - 应该在X轴右下角位置 */
.x-field-label {
    position: absolute;
    bottom: 6px; /* X轴底部位置 */
    right: 50px; /* 增加右边距，避免遮挡图表内容，为滚动条留出空间 */
    left: auto;
    background: var(--gray-100);
    color: var(--text-primary);
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 5; /* 降低z-index，避免遮挡图表 */
    pointer-events: none;
    white-space: nowrap; /* 防止文字换行 */
}

/* ==================== Use Cases & Variants ==================== */
.use-case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 10px 0;
}

.use-case-item {
    background: var(--gray-50);
    padding: 8px 10px;
    border-radius: var(--border-radius-sm);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.use-case-item:hover {
    background: var(--gray-100);
}

.use-case-item::before {
    content: '✓';
    color: var(--success);
    font-weight: bold;
    font-size: 10px;
}

.variant-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 12px 0;
}

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

/* ==================== 使用场景卡片 ==================== */
.usage-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 16px 0;
}

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

.usage-card {
    background: #FBFBFD;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #E8E8ED;
}

.usage-card.do {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.05) 0%, rgba(52, 199, 89, 0.02) 100%);
    border-color: rgba(52, 199, 89, 0.2);
}

.usage-card.dont {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.05) 0%, rgba(255, 59, 48, 0.02) 100%);
    border-color: rgba(255, 59, 48, 0.2);
}

.usage-header {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-card.do .usage-header {
    color: #34C759;
}

.usage-card.dont .usage-header {
    color: #FF3B30;
}

.usage-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.usage-card li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #1D1D1F;
    line-height: 1.5;
}

.usage-card li:last-child {
    margin-bottom: 0;
}

.usage-card li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #86868B;
}

.usage-card.do li::before {
    background: #34C759;
}

.usage-card.dont li::before {
    background: #FF3B30;
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0;
    }
    
    .app-content {
        padding: 24px;
    }
    
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* 页面整体 */
    body { padding: 10px 6px; }
    
    /* 移动端简化padding计算 */
    .spec-section {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .back-nav,
    .page-header,
    .chart-container {
        padding-left: 16px;
        padding-right: 16px;
    }
    .page-header { padding-top: 6px; margin-bottom: 14px; }
    .page-header h1 { font-size: 18px; line-height: 1.3; }
    .page-header .subtitle { font-size: 11px; margin-bottom: 8px; line-height: 1.4; }
    
    /* 规范区块 */
    .spec-section { padding: 10px 8px; margin-bottom: 10px; border-radius: 10px; }
    .spec-title { font-size: 13px; margin-bottom: 10px; }
    
    /* 图表卡片 - 移动端优化 */
    .chart-card { margin: 0; border-radius: 10px; overflow: hidden; }
    .chart-card-header { padding: 10px 10px 6px; }
    .chart-title { font-size: 13px; }
    .chart-meta { 
        padding: 8px 10px; 
        flex-direction: column; 
        gap: 8px; 
        align-items: flex-start;
        min-height: auto;
    }
    .chart-meta-info { font-size: 10px; }
    .chart-filters { 
        display: flex; 
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* 移动端图例优化 - 面板靠右，文字左对齐 */
    .custom-legend {
        position: relative;
        top: auto;
        right: auto;
        margin: 8px 0;
        padding: 6px 10px;
        max-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end; /* 面板靠右 */
        align-items: flex-start; /* 图例项内内容左对齐 */
        font-size: 10px;
        z-index: 10; /* 移动端也降低z-index */
    }
    
    .custom-legend.horizontal {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .custom-legend .legend-item {
        justify-content: flex-start; /* 移动端图例项内文字左对齐 */
    }
    
    /* 移动端筛选面板 - 紧贴按钮 */
    .filter-modal.positioned {
        left: 12px !important;
        right: auto !important;
    }
    
    /* 图表主体 - 移动端高度适配 */
    .chart-body { 
        height: 300px; /* 移动端也增大高度 */
        padding: 12px 8px; 
        /* 移动端统一左右padding，图表内容居中 */
        padding-left: 8px;
        padding-right: 8px;
        overflow: visible;
    }
    .chart-body.xl { height: 400px; } /* 移动端超大型图表 */
    .chart-body.lg { height: 360px; } /* 移动端大型图表 */
    .chart-body.md { height: 300px; } /* 移动端中型图表 */
    .chart-body.sm { height: 240px; } /* 移动端小型图表 */
    
    /* 图例优化 - 移动端简化（已在上面统一处理） */
    .legend-item { gap: 4px; }
    .legend-icon-square, .legend-icon-line-dot, .legend-icon-circle {
        width: 10px;
        height: 10px;
        border-radius: 2px; /* 移动端也统一为方形 */
    }
    .legend-text { font-size: 10px; }
    
    /* 汇总信息 */
    .chart-summary { 
        padding: 8px 10px; 
        flex-wrap: wrap; 
        gap: 6px 12px;
        font-size: 10px;
    }
    .summary-item { font-size: 10px; }
    .summary-label { font-size: 10px; }
    .summary-value { font-size: 11px; }
    
    /* 表格适配 - 移动端紧凑显示 */
    .spec-section { overflow-x: auto; }
    .spec-table { 
        font-size: 12px; 
        width: 100%;
        min-width: 320px;
        table-layout: fixed;
    }
    .spec-table th, .spec-table td { 
        padding: 10px 8px; 
        white-space: normal;
        word-break: break-word;
        vertical-align: middle;
        line-height: 1.5;
    }
    .spec-table code { font-size: 10px; padding: 2px 4px; word-break: break-all; }
    .spec-table tr { height: auto !important; }
    .spec-table td[rowspan] { vertical-align: middle; }
    /* 覆盖内联样式 */
    .spec-table th[style], .spec-table td[style] {
        width: auto !important;
    }
    
    /* 变体网格 - 单列显示 */
    .variant-grid { 
        grid-template-columns: 1fr !important; 
        gap: 10px; 
    }
    
    /* 代码面板 - 可滚动 */
    .chart-code-panel { max-height: 200px; overflow-y: auto; }
    .chart-code-panel pre { font-size: 9px; padding: 8px; line-height: 1.4; }
    
    /* 技术标签 */
    .tech-stack { gap: 4px; flex-wrap: wrap; justify-content: center; }
    .tech-tag { font-size: 9px; padding: 3px 6px; }
    
    /* 筛选器 - 移动端隐藏 */
    .filter-select { font-size: 10px; padding: 3px 6px; }
    .filter-label { font-size: 10px; }
    .filter-item { display: none; }
    
    /* 坐标轴单位 */
    .axis-unit { font-size: 8px; }
    .axis-unit.y-left { left: 22px; top: 4px; } /* 移动端：根据padding[3]=20px，单位标签在Y轴标签右侧 */
    .axis-unit.y-right { right: 28px; top: 4px; left: auto; } /* 移动端：右Y轴单位标签在右上角，留出空间避免被切断 */
    
    /* X轴字段标签 - 移动端位置 */
    .x-field-label {
        right: 6px; /* 移动端：X轴右下角，更靠右 */
        left: auto;
        bottom: 4px;
    }
    
    /* 标注面板 - 移动端优化 */
    .params-panel {
        font-size: 9px;
        padding: 6px 8px;
        min-width: 100px;
    }
    .params-panel .params-title { font-size: 10px; margin-bottom: 4px; }
    .params-panel .params-row { padding: 2px 0; }
    
    /* 代码块 */
    .code-block { font-size: 9px; padding: 8px; overflow-x: auto; }
    
    /* 使用场景 */
    .use-case-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .use-case-item { font-size: 10px; padding: 6px 8px; }
    
    /* 进度条相关 */
    .progress-grid { grid-template-columns: 1fr !important; gap: 10px; }
    .progress-demo { padding: 12px; }
    
    /* 指标卡相关 */
    .indicator-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
}

/* ==================== 移动端参数规范表 ==================== */
.mobile-spec-section {
    background: linear-gradient(135deg, rgba(91, 143, 249, 0.05) 0%, rgba(91, 143, 249, 0.02) 100%);
    border: 1px solid rgba(91, 143, 249, 0.2);
    border-radius: var(--border-radius-lg);
    padding: 14px 16px;
    margin-bottom: 14px;
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
}

.mobile-spec-section .spec-title {
    color: var(--primary);
}

.mobile-spec-section .spec-title::before {
    background: linear-gradient(135deg, var(--primary) 0%, #4A7CE8 100%);
}

.mobile-spec-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    text-transform: uppercase;
}

.mobile-spec-badge::before {
    content: '📱';
    font-size: 10px;
}

/* 对比表格样式 */
.compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 11px;
}

.compare-table th {
    background: var(--gray-50);
    color: var(--text-secondary);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
}

.compare-table th:first-child {
    border-radius: var(--border-radius-sm) 0 0 0;
}

.compare-table th:last-child {
    border-radius: 0 var(--border-radius-sm) 0 0;
}

.compare-table th.desktop-col {
    background: var(--gray-100);
    color: var(--text-primary);
}

.compare-table th.mobile-col {
    background: linear-gradient(135deg, rgba(91, 143, 249, 0.15) 0%, rgba(91, 143, 249, 0.1) 100%);
    color: var(--primary);
}

.compare-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.compare-table tr:last-child td {
    border-bottom: none;
}

.compare-table tr.highlight td {
    background: rgba(91, 143, 249, 0.04);
}

.compare-table .value-desktop {
    color: var(--text-secondary);
}

.compare-table .value-mobile {
    color: var(--primary);
    font-weight: 600;
}

.compare-table .value-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--success);
}

.compare-table .value-change.decrease {
    color: var(--danger);
}

.compare-table .value-change::before {
    content: '→';
    color: var(--text-tertiary);
}

/* 移动端配置卡片 */
.mobile-config-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 12px;
}

.mobile-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(91, 143, 249, 0.08) 0%, rgba(91, 143, 249, 0.03) 100%);
    border-bottom: 1px solid var(--border-light);
}

.mobile-config-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-config-title .icon {
    font-size: 16px;
}

.mobile-config-body {
    padding: 16px;
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.config-row:last-child {
    border-bottom: none;
}

.config-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.config-values {
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-value {
    font-size: 12px;
    font-family: "SF Mono", monospace;
    padding: 4px 8px;
    border-radius: 4px;
}

.config-value.desktop {
    background: var(--gray-100);
    color: var(--text-secondary);
}

.config-value.mobile {
    background: rgba(91, 143, 249, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.config-arrow {
    color: var(--text-tertiary);
    font-size: 12px;
}

/* 移动端优化提示 */
.mobile-tips {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.08) 0%, rgba(52, 199, 89, 0.03) 100%);
    border: 1px solid rgba(52, 199, 89, 0.2);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    margin-top: 12px;
}

.mobile-tips-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-tips-title::before {
    content: '💡';
}

.mobile-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-tips-list li {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px 0;
    padding-left: 16px;
    position: relative;
}

.mobile-tips-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

.chart-card {
    animation: fadeIn 0.5s ease forwards;
}

.chart-card:nth-child(1) { animation-delay: 0s; }
.chart-card:nth-child(2) { animation-delay: 0.05s; }
.chart-card:nth-child(3) { animation-delay: 0.1s; }
.chart-card:nth-child(4) { animation-delay: 0.15s; }
.chart-card:nth-child(5) { animation-delay: 0.2s; }
.chart-card:nth-child(6) { animation-delay: 0.25s; }

.nav-item {
    animation: slideIn 0.4s ease forwards;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ==================== 问答演示（所有图表复用）- ChatBI风格 ==================== */
.btn-qa-demo {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 12px; font-size: 12px; border-radius: 4px;
    border: 1px solid #D9D9D9; background: #fff; color: #262626;
    cursor: pointer; font-family: inherit; margin-left: 8px;
}
.btn-qa-demo:hover { border-color: #1890FF; color: #1890FF; }
.qa-demo-overlay {
    position: fixed; left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 9998; display: none;
}
.qa-demo-overlay.show { display: block; }
.qa-demo-modal {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 0; max-width: 480px; width: 90%; z-index: 9999; display: none;
    overflow: hidden;
}
.qa-demo-modal.show { display: block; }
.qa-demo-modal.qa-modal-has-card {
    max-width: 560px;
}
.qa-demo-modal.qa-modal-has-card .qa-chat-list {
    max-height: 58vh;
}
.qa-demo-modal.qa-modal-has-card .qa-answer {
    max-width: 100%;
}
.qa-demo-modal .qa-header {
    padding: 16px 20px; background: #F5F5F5; border-bottom: 1px solid #E8E8E8;
    display: flex; justify-content: space-between; align-items: center;
}
.qa-demo-modal .qa-title {
    font-size: 14px; font-weight: 600; color: #262626;
    display: flex; align-items: center; gap: 8px;
}
.qa-demo-modal .qa-title::before {
    content: '💬'; font-size: 16px;
}
.qa-demo-modal .qa-close-btn {
    width: 24px; height: 24px; border: none; background: transparent;
    cursor: pointer; font-size: 18px; color: #8C8C8C; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
}
.qa-demo-modal .qa-close-btn:hover { background: #E8E8E8; color: #262626; }
.qa-demo-modal .qa-chat-list {
    padding: 20px; max-height: 50vh; min-height: 120px; overflow-y: auto;
}
.qa-demo-modal .qa-input-area {
    padding: 12px 16px; border-top: 1px solid #E8E8E8; background: #FAFAFA;
    display: flex; align-items: flex-end; gap: 10px;
}
.qa-demo-modal .qa-input {
    flex: 1; min-height: 40px; max-height: 100px; padding: 10px 12px;
    font-size: 14px; line-height: 1.5; border: 1px solid #D9D9D9; border-radius: 8px;
    resize: none; font-family: inherit;
}
.qa-demo-modal .qa-input:focus {
    outline: none; border-color: #1890FF; box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}
.qa-demo-modal .qa-send-btn {
    padding: 10px 20px; font-size: 14px; font-weight: 500;
    background: #1890FF; color: #fff; border: none; border-radius: 8px;
    cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.qa-demo-modal .qa-send-btn:hover { background: #40A9FF; }
.qa-demo-modal .qa-message {
    margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px;
}
.qa-demo-modal .qa-message:last-child { margin-bottom: 0; }
.qa-demo-modal .qa-question {
    align-self: flex-end; max-width: 85%;
    font-size: 14px; color: #fff; line-height: 1.5;
    padding: 10px 14px; background: #1890FF;
    border-radius: 12px 12px 0 12px; word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 4px rgba(24,144,255,0.2);
}
.qa-demo-modal .qa-question::before {
    content: '问：'; font-weight: 500; margin-right: 4px; opacity: 0.9;
}
.qa-demo-modal .qa-answer {
    align-self: flex-start; max-width: 85%;
    font-size: 14px; color: #262626; line-height: 1.6;
    padding: 12px 14px; background: #F5F5F5;
    border-radius: 0 12px 12px 12px; word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.qa-demo-modal .qa-answer::before {
    content: '答：'; font-weight: 500; color: #1890FF; margin-right: 4px;
}
.qa-demo-modal .qa-answer .qa-highlight {
    color: #1890FF; font-weight: 500; background: rgba(24,144,255,0.1);
    padding: 0 2px; border-radius: 2px;
}
/* 回答内嵌卡片/图表：文字 + 卡片/图表区域 */
.qa-demo-modal .qa-answer-inner {
    display: flex; flex-direction: column; gap: 10px; width: 100%;
}
.qa-demo-modal .qa-answer-text {
    margin-bottom: 0; word-wrap: break-word;
}
.qa-demo-modal .qa-answer-card {
    margin-top: 0; margin-bottom: 10px; border-radius: 8px; overflow: hidden;
    border: 1px solid #E8E8E8; background: #fff;
    max-height: 320px; overflow-y: auto; padding: 12px;
    box-sizing: border-box;
}
.qa-demo-modal .qa-answer-card .kpi-card,
.qa-demo-modal .qa-answer-card .kpi-group,
.qa-demo-modal .qa-answer-card .indicator-card {
    max-width: 100%; box-sizing: border-box;
}
.qa-demo-modal .qa-answer-card .indicator-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0;
    margin: 0;
}
.qa-demo-modal .qa-answer-card .indicator-with-sub {
    max-width: 100%; box-sizing: border-box;
}
.qa-demo-modal .qa-answer-card .qa-demo-card-clone {
    pointer-events: none; max-width: 100%;
}
/* 零部件旁的小问答入口 */
.qa-demo-trigger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; margin-left: 4px; vertical-align: middle;
    font-size: 11px; color: #8C8C8C; border: 1px solid #E8E8E8; border-radius: 4px;
    background: #FAFAFA; cursor: pointer; font-family: inherit;
}
.qa-demo-trigger:hover { color: #1890FF; border-color: #1890FF; background: #E6F7FF; }

/* ==================== Print Styles ==================== */
@media print {
    .app-sidebar { display: none; }
    .app-main { margin-left: 0; }
    .annotation-layer { opacity: 1 !important; visibility: visible !important; }
    .hover-hint { display: none; }
}
