/* ========================================== */
/* 0. 全局基础样式与视图切换 (SPA)            */
/* ========================================== */
:root {
    --bg-color: #f8f9fa;       
    --card-bg: #ffffff;        
    --text-main: #212529;      
    --text-sub: #6c757d;       
    --up-color: #2ebd85;       
    --down-color: #e0294a;     
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 15px;
    box-sizing: border-box;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 50px;
}

/* 视图切换核心逻辑：隐藏与显示 */
.view-section { display: none; animation: fadeIn 0.3s ease; }
.view-active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ========================================== */
/* 1. 版块 A：顶部 4 宫格仪表盘样式           */
/* ========================================== */
.dashboard-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-bottom: 25px;
}

.grid-card {
    background-color: var(--card-bg); border-radius: 16px; padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); 
    display: flex; flex-direction: column; justify-content: space-between;
    height: 105px; box-sizing: border-box; transition: transform 0.2s ease; cursor: pointer;
}
.grid-card:active { transform: scale(0.98); }

.card-header { display: flex; justify-content: space-between; align-items: center; }
.asset-name { font-weight: 800; font-size: 16px; color: var(--text-main); }
.header-right { display: flex; align-items: center; gap: 8px; }
.asset-price { font-size: 16px; font-weight: 700; color: var(--text-main); letter-spacing: -0.5px; }

.edit-btn {
    background: transparent; border: none; color: #ced4da; 
    font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.edit-btn:hover { color: var(--text-sub); }

.card-body { flex-grow: 1; display: flex; align-items: flex-end; padding-top: 10px; }
.sparkline { width: 100%; height: 40px; pointer-events: none; } /* 避免线阻挡点击事件 */

/* ========================================== */
/* 2. 版块 B：中间分类胶囊菜单样式            */
/* ========================================== */
.category-menu {
    display: flex; overflow-x: auto; gap: 10px; margin-bottom: 20px; padding-bottom: 5px; 
}
.category-menu::-webkit-scrollbar { display: none; }
.category-btn {
    padding: 8px 18px; border-radius: 20px; border: none; 
    background: #e9ecef; color: var(--text-sub); font-weight: 600;
    cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.category-btn.active { background: var(--text-main); color: #ffffff; }

/* ========================================== */
/* 3. 版块 C：底部资产列表样式                */
/* ========================================== */
.asset-list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
    background: var(--card-bg); border-radius: 16px; padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02); gap: 10px; cursor: pointer;
}
.list-col-left { flex: 1; display: flex; flex-direction: column; }
.list-symbol { font-weight: 700; font-size: 15px; color: var(--text-main); }
.list-name { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.list-col-mid { flex: 1; display: flex; align-items: center; justify-content: center; height: 35px; }
.sparkline-mini { width: 100%; height: 100%; pointer-events: none; }
.list-col-right { flex: 1; display: flex; flex-direction: column; align-items: flex-end; }
.list-price { font-weight: 700; font-size: 15px; color: var(--text-main); }
.asset-change { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; margin-top: 2px; }
.change-up { background-color: rgba(46, 189, 133, 0.15); color: #209669; }
.change-down { background-color: rgba(224, 41, 74, 0.1); color: #c91c3a; }
.action-btn {
    background: transparent; border: none; font-size: 18px; cursor: pointer;
    padding: 5px; color: #adb5bd; transition: 0.2s;
}
.action-btn:hover { color: #f5a623; transform: scale(1.1); }

/* ========================================== */
/* 4. 详情页样式 (新增)                       */
/* ========================================== */
.detail-header {
    display: flex; align-items: center; gap: 15px; margin-bottom: 20px;
}
.back-btn {
    background: var(--card-bg); border: none; border-radius: 50%;
    width: 40px; height: 40px; font-size: 20px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); color: var(--text-main);
}
.detail-title { font-size: 24px; font-weight: 800; margin: 0; }

@media (min-width: 600px) { .dashboard-grid { grid-template-columns: repeat(4, 1fr); } }