/* ========================================
   微信账单分析器 - 全局样式
   Version: 1.1.13
   ======================================== */

/* CSS变量 - 主题系统 */
:root {
    /* 浅色主题 */
    --primary-500: #4F46E5;
    --primary-400: #6366F1;
    --primary-300: #818CF8;
    
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 深色主题 */
[data-theme="dark"] {
    --primary-500: #6366F1;
    --primary-400: #818CF8;
    --primary-300: #A5B4FC;
    
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    
    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(51, 65, 85, 0.3);
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-400);
}

/* 顶部导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1920px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version-badge {
    background: var(--primary-500);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary-500);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: auto;
    height: 40px;
    padding: 0 12px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}

.theme-toggle:hover {
    background: var(--primary-500);
    color: white;
}

.theme-toggle:hover .sun-icon,
.theme-toggle:hover .moon-icon {
    transform: rotate(180deg);
}

.theme-toggle-text {
    font-size: 0.75rem;
    font-weight: 500;
}

.sun-icon { display: none; }
.moon-icon { display: block; }

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

.mobile-menu-btn {
    display: none;
    height: 40px;
    padding: 0 14px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
}

.mobile-menu-text {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

/* 主内容区 */
.main-content {
    margin-top: 64px;
    min-height: calc(100vh - 64px);
    padding: 24px 24px 48px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-outline {
    background: transparent;
    color: var(--primary-500);
    border: 1px solid var(--primary-500);
}

.btn-outline:hover {
    background: var(--primary-500);
    color: white;
}

/* 上传区域 */
.upload-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-tertiary);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-500);
    background: rgba(79, 70, 229, 0.05);
}

.upload-icon {
    color: var(--primary-400);
    margin-bottom: 16px;
}

.upload-zone h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.file-input-hidden {
    display: none;
}

/* 上传进度 */
.upload-progress {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-300));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* 已上传文件列表 */
.uploaded-files {
    margin-top: 24px;
}

.uploaded-files h4 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-item-name {
    font-weight: 500;
}

.file-item-size {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.file-item-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* 数据摘要 */
.data-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.summary-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-300));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-icon.income {
    background: linear-gradient(135deg, var(--success), #34D399);
}

.summary-icon.expense {
    background: linear-gradient(135deg, var(--danger), #F87171);
}

.summary-info {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.income-value {
    color: var(--success);
}

.expense-value {
    color: var(--danger);
}

/* 表格控制区 */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.sort-controls {
    display: flex;
    gap: 8px;
}

/* 表格容器 */
.table-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.data-table th:hover {
    background: var(--border-color);
}

.data-table td {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.page-size-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

/* 关键指标卡片 */
.key-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-300));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
}

/* 周期选择器 */
.period-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.period-btn {
    padding: 10px 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.period-btn:hover {
    border-color: var(--primary-500);
    color: var(--primary-500);
}

.period-btn.active {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    color: white;
    border-color: transparent;
}

/* 图表网格 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
}

.chart-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.chart-container.large {
    grid-column: span 2;
}

.chart-container h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.chart-container canvas {
    max-height: 400px;
}

/* 分类管理 */
.category-management {
    margin-top: 32px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.category-management h3 {
    margin-bottom: 16px;
}

.category-rules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.category-rule {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.category-rule:hover {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-sm);
}

.category-rule-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.category-rule-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 4px;
}

.category-rule-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-rule-keywords {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.category-rule-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 8px;
}

.category-rule-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid transparent;
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-overlay[style*="display: flex"] {
    display: flex;
}

.modal-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input[type="color"] {
    width: 48px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 4px;
}

.form-row {
    display: flex;
    gap: 16px;
}

/* 筛选面板 */
.filter-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-item input,
.filter-item select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
}

.filter-item input:focus,
.filter-item select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.filter-results {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.results-summary {
    display: flex;
    gap: 24px;
    font-size: 0.875rem;
    flex-wrap: wrap;
    align-items: center;
}

.results-summary strong {
    color: var(--primary-500);
}

/* 交叉查询导出按钮区域 */
.results-export {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-success {
    background: linear-gradient(135deg, #10B981, #34D399);
    color: white;
    border: none;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 报告样式 */
.report-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.report-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.report-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.report-header h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.report-date,
.report-period {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.report-section {
    margin-bottom: 32px;
}

.report-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary-500);
}

.report-section div {
    color: var(--text-primary);
    line-height: 1.8;
}

.report-section ul {
    margin-left: 24px;
    margin-top: 8px;
}

.report-section li {
    margin-bottom: 8px;
}

.income-color {
    color: var(--success);
}

.expense-color {
    color: var(--danger);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container.large {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 13px;
    }
    
    /* ★ v1.1.13: 移动端品牌名称独立置顶栏 */
    .nav-brand-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 42px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        z-index: 1001;
        padding: 0 16px;
    }
    
    .nav-brand-bar-title {
        font-size: 1rem;
        font-weight: 600;
        background: linear-gradient(135deg, var(--primary-500), var(--primary-300));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    /* 导航栏下移，让出品牌栏空间 */
    .navbar {
        top: 42px;
        height: 56px;
    }
    
    /* 原有navbar内的品牌文字隐藏（移动端已提取到置顶栏） */
    .nav-brand .nav-title,
    .nav-brand .version-badge {
        display: none;
    }
    
    /* logo缩小适配 */
    .nav-brand .logo {
        width: 26px;
        height: 26px;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .main-content {
        margin-top: 98px;
        padding: 16px;
    }
    
    .upload-section,
    .filter-panel,
    .report-content {
        padding: 16px;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sort-controls {
        flex-wrap: wrap;
    }
    
    .data-table {
        font-size: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
    
    .key-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .key-metrics {
        grid-template-columns: 1fr;
    }
    
    .data-summary {
        grid-template-columns: 1fr;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .report-actions {
        flex-direction: column;
    }
    
    .report-actions .btn {
        width: 100%;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .status-bar,
    .report-actions,
    .table-controls,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .report-content {
        box-shadow: none;
        border: none;
        padding: 20px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: var(--text-primary);
    color: var(--bg-secondary);
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   交易类型管理面板样式
   ======================================== */
.type-management-panel {
    margin-top: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.type-mgmt-section {
    padding: 20px 24px;
}

.type-mgmt-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-builtin {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-500);
}

.badge-user {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-new {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.type-mgmt-subsection {
    margin-top: 20px;
}

.type-mgmt-subsection h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.type-mgmt-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.type-mgmt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.type-mgmt-item.unknown {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
}

.type-mgmt-item.user {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
}

.type-mgmt-item.builtin {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.type-mgmt-item.builtin-header {
    background: rgba(79, 70, 229, 0.06);
    border-color: rgba(79, 70, 229, 0.2);
    cursor: pointer;
}

.type-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.type-item-name {
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-primary);
}

.type-item-count {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.type-item-inferred {
    color: var(--warning);
    font-size: 0.75rem;
}

.type-item-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.type-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.type-category-select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}

.type-category-select:focus {
    outline: none;
    border-color: var(--primary-500);
}

.hidden { display: none !important; }

/* ========================================
   一键清除数据区域样式
   ======================================== */
.clear-data-area {
    margin-top: 24px;
}

.clear-data-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-shadow: var(--shadow-sm);
    gap: 12px;
    flex-wrap: wrap;
}

.clear-data-box svg {
    color: var(--danger);
    flex-shrink: 0;
    opacity: 0.8;
}

.clear-data-box span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.clear-data-box strong {
    color: var(--danger);
}

.btn-danger-clear {
    padding: 10px 24px;
    border: 2px solid var(--danger);
    background: rgba(239, 68, 68, 0.05);
    color: var(--danger);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-danger-clear:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger-clear:active {
    transform: translateY(0);
}

/* 筛选面板 - 动态提示文字 */
.filter-dynamic-hint {
    font-size: 0.7rem;
    color: var(--primary-400);
    font-weight: normal;
}

/* ========================================
   v1.1.13: 移动端独立品牌名称置顶栏
   ======================================== */
.nav-brand-bar {
    display: none;
}
.tutorial-area {
    margin-bottom: 20px;
    position: relative;
}

.tutorial-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.tutorial-trigger:hover {
    border-color: var(--primary-400);
    background: rgba(79, 70, 229, 0.04);
    box-shadow: var(--shadow-md);
}

.tutorial-trigger svg:first-child {
    color: var(--primary-500);
    flex-shrink: 0;
}

.tutorial-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.tutorial-area.active .tutorial-arrow {
    transform: rotate(180deg);
}

.tutorial-popup {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 14px;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-color);
    z-index: 900;
    max-height: 60vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease-out;
}

.tutorial-area.active .tutorial-popup {
    display: block;
}

.tutorial-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.tutorial-popup-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tutorial-popup-close {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.tutorial-popup-close:hover {
    background: var(--danger);
    color: white;
}

.tutorial-popup-body {
    padding: 20px;
}

.tutorial-step {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
}

.tutorial-step:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.tutorial-step-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tutorial-step-text {
    flex: 1;
    color: var(--text-primary);
}

.tutorial-step-text strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.tutorial-step-text p {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tutorial-step-text code {
    background: var(--bg-tertiary);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--primary-500);
    border: 1px solid var(--border-color);
}

.tutorial-tips {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.tutorial-tips p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.tutorial-tips p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .tutorial-popup {
        position: fixed;
        top: 50%;
        left: 16px;
        right: 16px;
        transform: translateY(-50%);
        max-height: 80vh;
    }

    .tutorial-area.active .tutorial-popup {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
    }

    /* 移动端弹出时背景蒙版 */
    .tutorial-area.active::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 899;
        animation: fadeIn 0.2s ease;
    }
}
