* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f0f2f5; color: #333; }

/* Toast */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; min-width: 200px; animation: toastSlide 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.toast-success { background: #52c41a; }
.toast-error { background: #ff4d4f; }
.toast-info { background: #1890ff; }
@keyframes toastSlide { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Loading */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.7); z-index: 9998; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.loading-spinner { width: 48px; height: 48px; border: 4px solid #e6f7ff; border-top-color: #1890ff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 登录页 */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #1890ff 0%, #096dd9 50%, #0050b3 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,0.2); width: 420px; max-width: 90vw; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.login-logo-icon { width: 48px; height: 48px; background: linear-gradient(135deg, #1890ff, #096dd9); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; font-weight: 800; }
.login-title { font-size: 28px; font-weight: 700; color: #1890ff; text-align: center; }
.login-subtitle { font-size: 14px; color: #999; text-align: center; margin-bottom: 24px; }
.login-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #f0f0f0; }
.login-tab-btn { flex: 1; padding: 10px; border: none; background: transparent; cursor: pointer; font-size: 14px; color: #999; transition: all 0.2s; }
.login-tab-btn.active { color: #1890ff; border-bottom: 2px solid #1890ff; font-weight: 500; }
.login-form { display: none; flex-direction: column; gap: 16px; }
.login-form.active { display: flex; }
.input-group { display: flex; flex-direction: column; gap: 4px; }
.input-group label { font-size: 13px; color: #666; font-weight: 500; }
.input-group input { padding: 10px 14px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px; transition: all 0.2s; }
.input-group input:focus { border-color: #1890ff; outline: none; box-shadow: 0 0 0 3px rgba(24,144,255,0.1); }
.login-submit { padding: 12px; background: linear-gradient(135deg, #1890ff, #096dd9); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 16px; font-weight: 500; transition: all 0.2s; }
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(24,144,255,0.4); }
.login-error { font-size: 14px; color: #ff4d4f; text-align: center; margin-top: 12px; min-height: 20px; }
.login-demo-hint { margin-top: 16px; padding: 8px 12px; background: #e6f7ff; border-radius: 6px; text-align: center; font-size: 12px; color: #1890ff; }

/* 主应用 - 侧边栏布局 */
#app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar { width: 220px; background: linear-gradient(180deg, #001529 0%, #002140 100%); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; transition: width 0.3s ease; box-shadow: 2px 0 8px rgba(0,0,0,0.15); }
.sidebar-header { padding: 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { width: 36px; height: 36px; background: linear-gradient(135deg, #1890ff, #096dd9); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; font-weight: 800; }
.sidebar-title { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: transparent; color: rgba(255,255,255,0.65); cursor: pointer; border-radius: 8px; font-size: 14px; transition: all 0.2s; margin-bottom: 2px; }
.sidebar-nav-item:hover { background: rgba(24,144,255,0.15); color: #fff; }
.sidebar-nav-item.active { background: linear-gradient(135deg, #1890ff, #096dd9); color: #fff; font-weight: 500; box-shadow: 0 2px 8px rgba(24,144,255,0.3); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-text { white-space: nowrap; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-search-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: rgba(24,144,255,0.2); color: #69c0ff; cursor: pointer; border-radius: 8px; font-size: 14px; transition: all 0.2s; margin-bottom: 12px; }
.sidebar-search-btn:hover { background: rgba(24,144,255,0.3); color: #fff; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.sidebar-user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #1890ff, #096dd9); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 600; }
.sidebar-user-info { flex: 1; }
.sidebar-user-name { font-size: 13px; color: rgba(255,255,255,0.85); margin-bottom: 2px; }
.sidebar-logout { font-size: 12px; color: #ff4d4f; background: transparent; border: none; cursor: pointer; padding: 0; }
.sidebar-logout:hover { text-decoration: underline; }

/* 主内容区 */
.main-content { flex: 1; margin-left: 220px; padding: 24px 32px; min-height: 100vh; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 26px; font-weight: 700; color: #1f2329; margin-bottom: 4px; }
.page-header h2 { font-size: 20px; font-weight: 600; color: #1f2329; }
.page-header p { font-size: 14px; color: #999; }

/* Tab内容 */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeInUp 0.4s ease; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

h3 { font-size: 16px; margin: 16px 0 8px; color: #1f2329; }

/* Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); cursor: pointer; transition: all 0.3s; display: flex; gap: 16px; align-items: center; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.stat-icon { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: #fff; }
.stat-icon-blue { background: linear-gradient(135deg, #1890ff, #096dd9); }
.stat-icon-green { background: linear-gradient(135deg, #52c41a, #389e0d); }
.stat-icon-purple { background: linear-gradient(135deg, #722ed1, #531dab); }
.stat-icon-orange { background: linear-gradient(135deg, #fa8c16, #d4380d); }
.stat-label { font-size: 16px; font-weight: 600; color: #1f2329; margin-bottom: 4px; }
.stat-desc { font-size: 12px; color: #999; line-height: 1.4; }

.quick-actions { margin-top: 24px; }
.quick-action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.quick-action-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; background: #fff; border: 1px solid #f0f0f0; border-radius: 12px; cursor: pointer; transition: all 0.3s; }
.quick-action-btn:hover { border-color: #1890ff; box-shadow: 0 4px 16px rgba(24,144,255,0.12); transform: translateY(-2px); }
.qa-icon { width: 40px; height: 40px; border-radius: 8px; background: #e6f7ff; color: #1890ff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }

/* 表单 */
.form-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.form-select, .form-input { padding: 8px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; transition: all 0.2s; }
.form-select:focus, .form-input:focus { border-color: #1890ff; outline: none; box-shadow: 0 0 0 2px rgba(24,144,255,0.1); }
.btn-primary { padding: 8px 20px; background: #1890ff; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.btn-primary:hover { background: #40a9ff; box-shadow: 0 2px 8px rgba(24,144,255,0.3); }
.btn-secondary { padding: 8px 16px; background: #fff; color: #1890ff; border: 1px solid #1890ff; border-radius: 6px; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.btn-secondary:hover { background: #e6f7ff; }
.action-bar { display: flex; gap: 8px; margin-bottom: 16px; }

/* 结果容器 */
.results-container { margin-top: 12px; }

/* 步骤卡片 */
.step-card { background: #fff; padding: 24px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 16px; }
.step-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.step-number { width: 32px; height: 32px; border-radius: 50%; background: #1890ff; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; }

/* AI 区域 */
.ai-section { background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 16px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; margin-top: 12px; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
th { background: #fafafa; font-weight: 600; color: #1f2329; }
tr:hover { background: #f5f5f5; }
tr:last-child td { border-bottom: none; }

/* 商品项 */
.product-item { background: #fff; padding: 16px; border-radius: 8px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 4px rgba(0,0,0,0.04); transition: all 0.2s; }
.product-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.product-item .name { font-weight: 500; flex: 1; }
.product-item .price { color: #1890ff; font-weight: 600; margin: 0 12px; }
.btn-import { padding: 4px 12px; background: #52c41a; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; transition: all 0.2s; }
.btn-import:hover { background: #73d13d; }

/* 结果框 */
.result-box { background: #fff; padding: 16px; border-radius: 8px; margin-top: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.result-box-error { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }
.result-box-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }

/* 空状态 */
.empty-state { text-align: center; padding: 40px 20px; color: #999; }

/* 财务概览 */
.finance-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.finance-card { background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: center; transition: all 0.3s; }
.finance-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.finance-card-label { font-size: 14px; color: #999; margin-bottom: 8px; }
.finance-card-value { font-size: 24px; font-weight: 700; color: #1f2329; }
.finance-value-red { color: #ff4d4f; }
.finance-value-green { color: #52c41a; }
.finance-value-blue { color: #1890ff; }

/* 搜索弹窗 */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: flex; justify-content: center; align-items: flex-start; padding-top: 60px; backdrop-filter: blur(4px); animation: modalFadeIn 0.3s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { background: #fff; border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,0.2); max-height: 85vh; overflow-y: auto; animation: modalSlideIn 0.3s ease; }
@keyframes modalSlideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.search-modal-content { width: 800px; max-width: 90vw; padding: 24px 32px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 20px; font-weight: 600; color: #1f2329; }
.modal-close { width: 32px; height: 32px; border: none; background: #f5f5f5; border-radius: 50%; cursor: pointer; font-size: 16px; color: #666; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #ff4d4f; color: #fff; }

/* 搜索引擎 */
.search-engine { width: 100%; }
.search-box-wrap { display: flex; gap: 8px; margin-bottom: 16px; }
.search-box-input { flex: 1; padding: 12px 16px; border: 2px solid #d9d9d9; border-radius: 24px; font-size: 16px; transition: all 0.2s; }
.search-box-input:focus { border-color: #1890ff; outline: none; box-shadow: 0 0 0 3px rgba(24,144,255,0.1); }
.search-box-btn { padding: 12px 28px; background: linear-gradient(135deg, #1890ff, #096dd9); color: #fff; border: none; border-radius: 24px; cursor: pointer; font-size: 16px; font-weight: 500; transition: all 0.2s; }
.search-box-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(24,144,255,0.4); }
.search-type-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.search-type-btn { padding: 8px 20px; border: none; background: transparent; cursor: pointer; font-size: 14px; color: #666; border-bottom: 2px solid transparent; transition: all 0.2s; }
.search-type-btn:hover { color: #1890ff; }
.search-type-btn.active { color: #1890ff; border-bottom-color: #1890ff; font-weight: 500; }
.search-hot-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; align-items: center; }
.hot-tag-label { font-size: 13px; color: #999; }
.hot-tag { padding: 4px 12px; background: #f5f5f5; border: 1px solid #e8e8e8; border-radius: 16px; cursor: pointer; font-size: 13px; color: #666; transition: all 0.2s; }
.hot-tag:hover { background: #e6f7ff; border-color: #1890ff; color: #1890ff; }

/* 搜索结果卡片 */
.search-results { margin-top: 16px; }
.search-result-card { background: #fff; padding: 16px 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 12px; transition: all 0.3s; }
.search-result-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-1px); }
.search-result-title { font-size: 16px; font-weight: 600; color: #1f2329; margin-bottom: 6px; }
.search-result-desc { font-size: 14px; color: #595959; line-height: 1.6; margin-bottom: 8px; }
.search-result-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.search-result-meta-item { display: flex; align-items: center; gap: 4px; }
.search-result-meta-label { color: #999; }
.search-result-meta-value { color: #1890ff; font-weight: 500; }
.search-result-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; margin-right: 6px; }
.badge-product { background: #e6f7ff; color: #1890ff; }
.badge-trend { background: #fff7e6; color: #fa8c16; }
.badge-category { background: #f6ffed; color: #52c41a; }
.badge-ai { background: #f9f0ff; color: #722ed1; }
.search-result-price { color: #ff4d4f; font-weight: 600; font-size: 16px; }
.search-result-sales { color: #52c41a; font-weight: 500; }

/* 趋势图 */
.trend-chart { display: flex; align-items: flex-end; gap: 4px; height: 80px; margin: 12px 0; padding: 0 8px; }
.trend-bar { flex: 1; background: linear-gradient(180deg, #1890ff, #69c0ff); border-radius: 4px 4px 0 0; min-height: 4px; transition: all 0.3s; }
.trend-bar:hover { background: linear-gradient(180deg, #096dd9, #1890ff); }

/* 品类分析卡片 */
.category-analysis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0; }
.category-metric { background: #fafafa; padding: 12px; border-radius: 8px; text-align: center; }
.category-metric-label { font-size: 12px; color: #999; margin-bottom: 4px; }
.category-metric-value { font-size: 20px; font-weight: 700; color: #1890ff; }

/* AI分析结果 */
.ai-analysis-result { background: linear-gradient(135deg, #f9f0ff, #f0f5ff); padding: 20px; border-radius: 12px; border-left: 4px solid #722ed1; }
.ai-analysis-result p { margin-bottom: 8px; line-height: 1.8; }

/* 响应式 */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-action-grid { grid-template-columns: repeat(2, 1fr); }
    .finance-summary { grid-template-columns: repeat(2, 1fr); }
    .category-analysis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-title, .nav-text, .sidebar-user-info, .sidebar-search-btn .nav-text { display: none; }
    .sidebar-search-btn { justify-content: center; padding: 10px; }
    .sidebar-nav-item { justify-content: center; padding: 10px 8px; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .quick-action-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; align-items: stretch; }
    .form-row select, .form-row input, .form-row button { width: 100%; }
    .finance-summary { grid-template-columns: 1fr; }
    .category-analysis { grid-template-columns: 1fr; }
    .search-type-tabs { overflow-x: auto; }
}
