* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

/* ========== 布局 ========== */
.app-layout {
    display: grid;
    grid-template-columns: 200px 1fr 220px;
    min-height: 100vh;
    gap: 0;
}

/* ========== 左侧导航栏 ========== */
.left-sidebar {
    background: #fff;
    border-right: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    z-index: 100;
}

.sidebar-logo {
    text-align: center;
    padding: 0 15px 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.sidebar-logo h2 {
    font-size: 1.2rem;
    color: #333;
}

.sidebar-logo .logo-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.nav-menu {
    list-style: none;
    padding: 0 10px;
    flex: 1;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 12px;
    color: #666;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-link:hover {
    background: #f0f2f5;
    color: #333;
}

.nav-link.active {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    text-align: center;
    font-size: 0.75rem;
    color: #aaa;
}

/* ========== 主内容区 ========== */
.main-content {
    padding: 20px;
    overflow-y: auto;
    max-height: 100vh;
}

/* ========== 右侧统计栏 ========== */
.right-sidebar {
    background: #fff;
    border-left: 1px solid #e8e8e8;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    z-index: 100;
}

.right-sidebar-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.sidebar-stat {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
}

.sidebar-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.sidebar-stat.buy {
    border-left: 4px solid #4caf50;
}

.sidebar-stat.sell {
    border-left: 4px solid #f44336;
}

.sidebar-stat.hold {
    border-left: 4px solid #9e9e9e;
}

.sidebar-stat-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.sidebar-stat-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.sidebar-stat-count {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.sidebar-stat-list {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #888;
    max-height: 120px;
    overflow-y: auto;
    text-align: left;
}

.sidebar-stat-list .rec-name {
    color: #4caf50;
    font-weight: 600;
}

.sidebar-empty {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 8px;
}

/* ========== 通用组件 ========== */
.header {
    background: white;
    border-radius: 16px;
    padding: 20px 25px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.header h1 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 6px;
}

.subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.refresh-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.update-time {
    color: #999;
    font-size: 0.8rem;
}

.refresh-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.section-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

/* ========== 大盘情绪 ========== */
.mood-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 15px;
}

.mood-text {
    font-size: 1.05rem;
    text-align: center;
    color: #333;
    font-weight: 500;
}

.indices-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.index-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.index-card .name {
    font-weight: bold;
    color: #333;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.index-card .price {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 3px;
}

.index-card .change {
    font-size: 0.85rem;
}

.index-card .change.up { color: #e53935; }
.index-card .change.down { color: #1e88e5; }

.index-card .updown {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

/* ========== 搜索 ========== */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-box input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #eee;
    border-radius: 20px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #2196f3;
}

.search-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f8f9fa; }

.search-item .info { flex: 1; }
.search-item .name { font-weight: bold; color: #333; font-size: 0.9rem; }
.search-item .code { font-size: 0.8rem; color: #888; margin-left: 6px; }
.search-item .type { font-size: 0.75rem; color: #666; }

.add-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
}

.ac-btn {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* ========== 基金/股票卡片网格 ========== */
.funds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.fund-card {
    background: #f8f9fa;
    border-radius: 14px;
    padding: 16px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.fund-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.fund-card.action-buy {
    border-top: 4px solid #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #fff 100%);
}

.fund-card.action-sell {
    border-top: 4px solid #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #fff 100%);
}

.fund-card.action-fixed_invest {
    border-top: 4px solid #2196f3;
    background: linear-gradient(135deg, #e3f2fd 0%, #fff 100%);
}

.fund-card.action-error {
    border-top: 4px solid #ff9800;
    background: linear-gradient(135deg, #fff3e0 0%, #fff 100%);
}

.stock-card {
    border-left: 4px solid #ff9800;
}

.fund-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.fund-name {
    font-weight: bold;
    font-size: 1rem;
    color: #333;
}

.fund-code {
    font-size: 0.8rem;
    color: #888;
}

.action-badge {
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: bold;
}

.action-badge.buy { background: #4caf50; color: white; }
.action-badge.sell { background: #f44336; color: white; }
.action-badge.hold { background: #9e9e9e; color: white; }
.action-badge.fixed_invest { background: #2196f3; color: white; }

.fund-info { margin-bottom: 10px; }

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.info-label { color: #888; }
.info-value { font-weight: bold; }
.info-value.up { color: #e53935; }
.info-value.down { color: #1e88e5; }

.fund-reason {
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.8rem;
    color: #555;
    line-height: 1.4;
}

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

.fund-card:hover .delete-btn { opacity: 1; }
.delete-btn:hover { background: rgba(244, 67, 54, 0.2); }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #888;
    grid-column: 1 / -1;
}

.empty-icon { font-size: 3rem; margin-bottom: 10px; }
.empty-state p { margin-bottom: 8px; font-size: 0.9rem; }
.empty-hint { font-size: 0.8rem; }

.empty-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.3s;
}

/* ========== 定投推荐 ========== */
.dip-suggestion {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #2e7d32;
    line-height: 1.5;
}

.dip-subtitle {
    font-weight: bold;
    color: #333;
    margin: 12px 0 8px;
    font-size: 0.9rem;
}

.dip-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dip-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s;
}

.dip-item:hover { background: #e3f2fd; }

.dip-rank {
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    flex-shrink: 0;
}

.dip-rank-index {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.dip-info { flex: 1; min-width: 0; }
.dip-name {
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dip-code { font-size: 0.75rem; color: #888; }
.dip-return { font-weight: bold; font-size: 0.85rem; }
.dip-return.up { color: #e53935; }
.dip-return.down { color: #43a047; }
.dip-add { padding: 4px 8px; font-size: 0.8rem; }

/* ========== 热门/新势力列表 ========== */
.trending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.trending-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 14px;
    transition: all 0.3s;
}

.trending-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.trending-card .name {
    font-weight: bold;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 4px;
}

.trending-card .code {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 8px;
}

.trending-card .change {
    font-size: 1rem;
    font-weight: bold;
}

/* ========== Tab切换 ========== */
.tab-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* ========== 模态框 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show { display: flex; }

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 { margin: 0; color: #333; font-size: 1rem; }

.modal-body { padding: 16px 20px; }

.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #333;
    font-size: 0.85rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 0.9rem;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #2196f3;
}

.form-group .hint {
    font-size: 0.75rem;
    color: #888;
    margin-left: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
}

.cancel-btn {
    background: #f0f0f0;
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.85rem;
}

.confirm-btn {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.85rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
}

/* ========== A/C分析 ========== */
.ac-result { padding: 8px 0; }
.ac-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 6px;
}

.ac-fund-name { font-size: 1rem; font-weight: bold; color: #333; }
.ac-fund-code { font-size: 0.8rem; color: #888; font-weight: normal; }

.ac-badge {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.ac-badge.ac-a { background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%); }
.ac-badge.ac-c { background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%); }
.ac-badge.ac-neutral { background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%); }

.ac-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.ac-metric {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

.ac-metric-value { font-size: 1.1rem; font-weight: bold; color: #333; }
.ac-metric-label { font-size: 0.75rem; color: #888; margin-top: 3px; }

.ac-section-title { font-weight: bold; color: #333; margin-bottom: 6px; font-size: 0.85rem; }

.ac-reasons {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.ac-reasons ul {
    margin: 0;
    padding-left: 18px;
    color: #555;
    font-size: 0.85rem;
    line-height: 1.5;
}

.ac-suggestion {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.ac-suggestion p { color: #1565c0; font-size: 0.85rem; line-height: 1.5; margin: 0; }

.ac-tips {
    background: #fff8e1;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.5;
}

.ac-tips p { margin-bottom: 6px; }
.ac-tips p:last-child { margin-bottom: 0; }

/* ========== 加载动画 ========== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #888;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    color: #aaa;
    font-size: 0.75rem;
    padding: 15px;
    margin-top: 10px;
}

.footer p { margin-bottom: 4px; }

.dual-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.dual-card {
    margin-bottom: 0;
}

.dual-card .trending-grid {
    grid-template-columns: 1fr;
}

.dual-card .dip-list {
    max-height: 400px;
    overflow-y: auto;
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 60px 1fr;
    }
    .right-sidebar { display: none; }
    .nav-link span { display: none; }
    .sidebar-logo h2 { display: none; }
    .sidebar-logo .logo-icon { font-size: 1.5rem; }
}

@media (max-width: 768px) {
    .dual-section {
        grid-template-columns: 1fr;
    }
    .app-layout {
        grid-template-columns: 1fr;
    }
    .left-sidebar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        height: auto;
        flex-direction: row;
        padding: 5px 0;
        border-right: none;
        border-top: 1px solid #e8e8e8;
        z-index: 200;
    }
    .sidebar-logo { display: none; }
    .nav-menu {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        width: 100%;
    }
    .nav-item { margin: 0; }
    .nav-link {
        flex-direction: column;
        padding: 6px 10px;
        font-size: 0.7rem;
        gap: 2px;
    }
    .nav-icon { font-size: 1.1rem; }
    .sidebar-footer { display: none; }
    .main-content {
        padding: 15px;
        padding-bottom: 80px;
        max-height: none;
    }
    .funds-grid {
        grid-template-columns: 1fr;
    }
}
