@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #000000;
    --primary-blue: #3b82f6;
    --accent-purple: #6366f1;
    --accent-violet: #8b5cf6;
    --bg-body: #f7f9fc;
    --bg-surface: #ffffff;
    --bg-hover: #f3f4f6;
    --border: rgba(0, 0, 0, 0.08);
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --safe-bottom: max(16px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }

html, body { 
    background: var(--bg-body); 
    color: var(--text-main); 
    font-family: 'Inter', sans-serif; 
    margin: 0; 
    height: 100dvh;
    overflow: hidden; 
    -webkit-text-size-adjust: 100%;
}

/* ===== 布局框架 ===== */
.app-container { 
    display: flex; 
    height: 100%; 
    width: 100%; 
    overflow: hidden; 
}

.page-content { 
    flex: 1; 
    display: none; 
    flex-direction: column; 
    overflow: hidden; 
    background: var(--bg-body); 
    position: relative;
    min-width: 0;
}
.page-content.active { display: flex; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== 侧边栏 ===== */
.sidebar { 
    width: 300px; 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(20px); 
    border-right: 1px solid var(--border); 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    z-index: 10; 
    flex-shrink: 0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    margin: 0 -20px;
    padding: 0 20px;
    -webkit-overflow-scrolling: touch;
}

.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }

.logo-title { 
    font-size: 18px; 
    font-weight: 800; 
    margin-bottom: 16px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    flex-shrink: 0;
}
.logo-title span { 
    background: var(--primary-blue); 
    color: white; 
    padding: 4px 8px; 
    border-radius: 8px; 
    font-size: 14px; 
}

.nav-section { 
    font-size: 11px; 
    font-weight: 700; 
    color: var(--text-light); 
    letter-spacing: 0.5px; 
    text-transform: uppercase; 
    margin: 16px 0 8px; 
    flex-shrink: 0;
}

.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 10px 14px; 
    border-radius: var(--radius-sm); 
    font-weight: 600; 
    font-size: 14px; 
    color: var(--text-muted); 
    cursor: pointer; 
    transition: all 0.2s; 
    margin-bottom: 6px; 
    flex-shrink: 0;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-main); }
.nav-item.active { 
    background: var(--bg-surface); 
    color: var(--primary); 
    box-shadow: var(--shadow);
    border: 1px solid var(--border); 
}

/* 技能子菜单 */
#skillsSubMenu {
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
#skillsSubMenu .nav-item {
    opacity: 0.9;
    padding-left: 28px;
}
.skill-master {
    border: 1px dashed #cbd5e1;
}
.skill-master:hover {
    border-color: var(--primary-blue);
    background: #f8fafc;
}

/* ===== 表单组件 ===== */
.setting-input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid var(--border); 
    border-radius: var(--radius-sm); 
    font-size: 12px; 
    margin-bottom: 8px; 
    background: #f9fafb;
    font-family: inherit;
}
.setting-input:focus { 
    outline: none; 
    border-color: var(--primary-blue); 
    background: #fff; 
}

/* 自定义选择器 */
.custom-select-wrapper { 
    position: relative; 
    width: 100%; 
    user-select: none; 
    margin-bottom: 12px; 
    flex-shrink: 0;
}
.custom-select-trigger { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    width: 100%; 
    padding: 10px 14px; 
    background: rgba(255, 255, 255, 0.85); 
    backdrop-filter: blur(10px); 
    border: 1px solid var(--border); 
    border-radius: 12px; 
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 600; 
    color: #1e293b; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.02); 
    transition: all 0.3s; 
}
.custom-select-trigger:hover, .custom-select-wrapper.open .custom-select-trigger { 
    border-color: var(--primary-blue); 
    background: #ffffff;  
}
.trigger-left { display: flex; align-items: center; gap: 10px; }
.model-icon { width: 20px; height: 20px; object-fit: contain; }
.arrow-icon { width: 16px; height: 16px; transition: transform 0.3s ease; }
.custom-select-wrapper.open .arrow-icon { transform: rotate(180deg); }

.custom-select-options { 
    position: absolute; 
    top: calc(100% + 6px); 
    left: 0; 
    width: 100%; 
    background: #ffffff; 
    border: 1px solid rgba(0,0,0,0.08); 
    border-radius: 12px; 
    box-shadow: 0 12px 32px rgba(0,0,0,0.12); 
    opacity: 0; 
    visibility: hidden; 
    transform: translateY(-10px); 
    transition: all 0.3s; 
    z-index: 100; 
    max-height: 240px; 
    overflow-y: auto; 
    padding: 6px; 
}
.custom-select-wrapper.open .custom-select-options { 
    opacity: 1; 
    visibility: visible; 
    transform: translateY(0); 
}

.custom-option { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 8px 10px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-size: 13px; 
    font-weight: 500; 
    color: #334155; 
    transition: background 0.2s; 
}
.custom-option:hover { background: #f1f5f9; color: #0f172a; }
.custom-option.active { background: #eff6ff; color: #2563eb; font-weight: 600; }

.btn-quick { 
    width: 100%; 
    text-align: left; 
    padding: 10px 14px; 
    background: var(--bg-surface); 
    border: 1px solid var(--border); 
    border-radius: var(--radius-sm); 
    font-size: 13px; 
    color: var(--text-main); 
    margin-bottom: 8px; 
    cursor: pointer; 
    font-weight: 500;
    flex-shrink: 0;
}

/* ===== 聊天界面 ===== */
.chat-container { 
    display: flex; 
    flex-direction: column; 
    flex: 1; 
    height: 100%; 
    background: var(--bg-surface);  
    border-left: 1px solid var(--border); 
    overflow: hidden; 
    position: relative;
}

.chat-box { 
    flex: 1; 
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.chat-box::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb { 
    background: rgba(0,0,0,0.15); 
    border-radius: 3px; 
}
.chat-box::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

.msg-wrapper { 
    display: flex; 
    gap: 12px; 
    width: 100%; 
    max-width: 100%;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.msg-wrapper.user { flex-direction: row-reverse; }

.avatar { 
    width: 36px; 
    height: 36px; 
    border-radius: 10px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    font-size: 13px; 
    font-weight: bold; 
    color: white; 
    flex-shrink: 0; 
}
.avatar.bot { background: #000; }
.avatar.user { background: var(--primary-blue); }

.msg-bubble { 
    position: relative; 
    max-width: 85%; 
    line-height: 1.6; 
    font-size: 14.5px; 
    color: var(--text-main); 
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.user .msg-bubble { 
    background: #f3f4f6; 
    padding: 12px 16px; 
    border-radius: 16px; 
    border-top-right-radius: 4px; 
}

.copy-all-btn { 
    position: absolute; 
    top: -22px; 
    font-size: 11px; 
    border: 1px solid #e5e7eb; 
    background: #f9fafb; 
    color: var(--text-muted); 
    padding: 2px 8px; 
    border-radius: 6px; 
    cursor: pointer; 
    transition: 0.2s; 
    font-family: 'JetBrains Mono', monospace; 
    font-weight: 600; 
    display: inline-flex; 
    align-items: center; 
    height: 20px;
}
.copy-all-btn:hover { background: #e5e7eb; color: var(--text-main);}
.bot .copy-all-btn { right: 0; } 
.user .copy-all-btn { left: 0; } 

/* 代码块 */
.msg-bubble pre { 
    background: #1e1e1e; 
    color: #abb2bf; 
    border-radius: 12px; 
    padding: 14px; 
    overflow-x: auto; 
    margin: 12px 0; 
    border: 1px solid #333; 
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5); 
    max-width: 100%;
}
.msg-bubble pre code { 
    font-family: 'JetBrains Mono', Consolas, monospace; 
    font-size: 13px; 
    color: inherit; 
    background: transparent;
    padding: 0;
}
.msg-bubble code { 
    font-family: 'JetBrains Mono', monospace; 
    font-size: 13px; 
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}
.msg-bubble img { max-width: 100%; border-radius: 8px; height: auto; }

/* 输入面板 */
.input-panel { 
    padding: 16px; 
    border-top: 1px solid var(--border); 
    background: #fff; 
    flex-shrink: 0; 
    padding-bottom: var(--safe-bottom);
}

.input-area { 
    display: flex; 
    background: #f9fafb; 
    border: 1px solid #e5e7eb; 
    border-radius: 12px; 
    padding: 6px; 
    align-items: center;
    gap: 4px;
}

.chat-input { 
    flex: 1; 
    border: none; 
    outline: none; 
    padding: 8px 12px; 
    background: transparent; 
    font-size: 15px; 
    min-width: 0;
    -webkit-appearance: none;
    font-family: inherit;
}

.btn-send { 
    background: #000; 
    color: white; 
    border: none; 
    border-radius: 10px; 
    padding: 0 16px; 
    font-weight: 600; 
    cursor: pointer; 
    height: 36px; 
    flex-shrink: 0;
    font-size: 14px;
    transition: opacity 0.2s;
}
.btn-send:hover { opacity: 0.9; }

.tool-btn { 
    background: transparent; 
    border: none; 
    font-size: 20px; 
    cursor: pointer; 
    border-radius: 8px; 
    display: flex; 
    color: #4b5563; 
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s;
}
.tool-btn:hover { background: #f3f4f6; }
.tool-btn:active { transform: scale(0.95); }

@keyframes pulse { 
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 
    70% { box-shadow: 0 0 0 8px transparent; } 
    100% { box-shadow: 0 0 0 0 transparent; } 
}
.recording { 
    color: #ef4444 !important; 
    animation: pulse 1.5s infinite; 
    background: #fee2e2 !important; 
    border-radius: 50%; 
}

/* 上传和附件 */
.upload-bar { 
    display: none; 
    background: #f3f4f6; 
    border-radius: 8px; 
    padding: 8px 12px; 
    margin-bottom: 10px; 
    align-items: center; 
    font-size: 12px; 
    color: #4b5563; 
}
.upload-bar .progress-wrap { 
    flex: 1; 
    margin: 0 10px; 
    background: #e5e7eb; 
    height: 4px; 
    border-radius: 2px; 
    overflow: hidden;
}
.upload-bar .progress-inner { 
    width: 0%; 
    background: #000; 
    height: 100%; 
    transition: 0.2s;
}

#attachmentsPreview { 
    display: none; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-bottom: 10px; 
}
.attached-item { 
    background: #e0f2fe; 
    color: #0369a1; 
    border: 1px solid #bae6fd; 
    font-size: 12px; 
    padding: 4px 10px; 
    border-radius: 20px; 
    display: flex; 
    gap: 6px; 
    font-weight: 600;
    align-items: center;
}
.del-file-btn { cursor: pointer; color: #ef4444; font-weight: bold; font-size: 16px; line-height: 1; }

.token-block { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    margin-top: 10px; 
    padding: 4px 10px; 
    background: #f8fafc; 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    font-size: 11px; 
    color: #64748b; 
    font-weight: 600;
}

/* 历史会话 */
.session-list { 
    margin-top: 8px; 
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    -webkit-overflow-scrolling: touch;
}

.session-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 12px; 
    font-size: 13px; 
    color: var(--text-muted); 
    cursor: pointer; 
    border-radius: 8px; 
    margin-bottom: 4px; 
    transition: 0.2s;
    border: 1px solid transparent;
}
.session-item:hover { 
    background: var(--bg-hover); 
    color: var(--text-main); 
    border-color: var(--border);
}
.session-item.active { 
    background: #e0f2fe; 
    color: #0369a1; 
    font-weight: 600; 
    border-color: #bae6fd;
}

.btn-del-session { 
    color: #ef4444; 
    font-size: 14px; 
    background: none; 
    border: none; 
    cursor: pointer; 
    display: none; 
    padding: 4px;
    border-radius: 4px;
}
.btn-del-session:hover { background: rgba(239,68,68,0.1); }
.session-item:hover .btn-del-session { display: flex; }

.msg-action-bar { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
    flex-wrap: wrap; 
    margin-top: 12px; 
    border-top: 1px dashed #e2e8f0; 
    padding-top: 8px; 
}
.mini-tool-btn { 
    display: inline-flex; 
    align-items: center; 
    gap: 4px; 
    padding: 4px 10px; 
    background: #fff; 
    border: 1px solid #e2e8f0; 
    border-radius: 6px; 
    font-size: 11px; 
    color: #64748b; 
    font-weight: 600; 
    cursor: pointer; 
    transition: 0.2s; 
}
.mini-tool-btn:hover { 
    background: #f8fafc; 
    color: #0f172a; 
    border-color: #cbd5e1; 
}

/* ===== 小红书卡片 ===== */
.xhs-card { 
    background: #fff; 
    border: 1px solid #eee; 
    border-radius: 16px; 
    padding: 20px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); 
    max-width: 600px; 
    margin-bottom: 20px; 
}
.xhs-input { 
    width: 100%; 
    border: 1px solid #e5e7eb; 
    border-radius: 10px; 
    padding: 12px; 
    margin-bottom: 15px; 
    font-size: 14px; 
    background: #f9fafb; 
    font-family: inherit;
}
.xhs-input:focus { outline: none; border-color: #ff2442; background: #fff; }
.xhs-btn { 
    width: 100%; 
    background: #ff2442; 
    color: #fff; 
    padding: 12px; 
    border: none; 
    border-radius: 10px; 
    font-weight: 600; 
    font-size: 15px; 
    cursor: pointer; 
    transition: 0.2s; 
}
.xhs-btn:hover { background: #df1b35; }

/* ===== 投资组合页面 ===== */
.portfolio-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f1f5f9;
}

.portfolio-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* 移动端头部 */
.portfolio-mobile-header {
    display: none;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    justify-content: space-between;
    align-items: center;
}
.portfolio-mobile-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 资产主卡片 */
.asset-hero-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 24px;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.asset-value-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 8px;
}

.currency {
    font-size: 24px;
    font-weight: 600;
}

.editable-number {
    background: transparent;
    border: none;
    color: white;
    font-size: 36px;
    font-weight: 700;
    width: 100%;
    font-family: inherit;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    transition: border-color 0.3s;
}
.editable-number:focus {
    outline: none;
    border-color: white;
}

.asset-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

/* 收入网格 */
.income-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.income-item {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 16px;
}

.income-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.progress-pill {
    background: rgba(0,0,0,0.2);
    border-radius: 20px;
    height: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    font-size: 11px;
    padding: 0 8px;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255,255,255,0.5);
    border-radius: 20px;
    transition: width 0.3s;
}

/* 收益率卡片 */
.rate-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.rate-card {
    border-radius: 16px;
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.rate-card.teal {
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
}

.rate-card.green {
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
    color: #064e3b;
}

.rate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
}

.rate-icon {
    font-size: 20px;
}

.rate-value {
    font-size: 28px;
    font-weight: 700;
}

/* 图表和持仓 */
.chart-card, .holdings-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

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

.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.chart-container {
    height: 220px;
    position: relative;
}

.legend-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #6b7280;
    flex-wrap: wrap;
}

.dot {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot.received::before { background: #14b8a6; }
.dot.announced::before { background: #f59e0b; }
.dot.predicted::before { background: #86efac; }

/* 持仓列表 */
.holdings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.holding-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
    transition: all 0.2s;
    cursor: pointer;
}
.holding-item:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.holding-main h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: #111827;
}

.holding-code {
    color: #9ca3af;
    font-size: 13px;
    font-weight: 400;
}

.holding-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #6b7280;
}

.holding-value {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    display: block;
    text-align: right;
}

.holding-yield {
    font-size: 13px;
    color: #10b981;
    font-weight: 600;
    text-align: right;
    display: block;
}

.holding-months {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.month-badge, .month-tag-compact {
    font-size: 11px;
    padding: 2px 8px;
    background: #dbeafe;
    color: #0369a1;
    border-radius: 4px;
    font-weight: 600;
}

.btn-del-compact {
    position: absolute;
    top: 12px;
    right: 12px;
    background: white;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.holding-compact:hover .btn-del-compact {
    opacity: 1;
}
.btn-del-compact:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* 底部操作 */
.portfolio-actions-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #000;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.btn-add, .btn-add-mobile {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal.active { display: flex; }

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { margin: 0; font-size: 18px; }

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
}

.modal form {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.form-group { margin-bottom: 16px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* 月份选择器 */
.month-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.month-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.month-chip input {
    position: absolute;
    opacity: 0;
}
.month-chip:has(input:checked) {
    background: #dbeafe;
    border-color: var(--primary-blue);
    color: #0369a1;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.btn-secondary {
    flex: 1;
    padding: 12px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== 响应式适配 ===== */

/* 平板和移动端 (< 992px) */
@media (max-width: 992px) {
    .app-container { 
        flex-direction: column; 
        height: 100dvh;
    }
    
    .sidebar { 
        width: 100%; 
        border-right: none; 
        border-bottom: 1px solid var(--border); 
        padding: 12px 16px;
        max-height: 45vh;
        flex-shrink: 0;
    }
    
    .sidebar-content {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .logo-title { 
        margin-bottom: 12px; 
        font-size: 16px; 
    }
    
    .nav-section, .btn-quick { display: none; }
    
    .mobile-nav-scroll { 
        display: flex; 
        gap: 8px; 
        overflow-x: auto; 
        padding-bottom: 8px;
        margin-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-shrink: 0;
    }
    .mobile-nav-scroll::-webkit-scrollbar { display: none; }
    
    .nav-item { 
        white-space: nowrap; 
        padding: 8px 14px; 
        font-size: 13px; 
        margin: 0; 
        background: #f3f4f6;
    }
    .nav-item.active { 
        background: #000; 
        color: #fff;
    }
    
    #skillsSubMenu {
        display: none;
        width: calc(100% - 32px);
        margin: 8px 16px 12px;
        padding: 8px;
        background: rgba(59,130,246,0.03);
        border-radius: 8px;
        max-height: 180px;
    }
    
    .page-content { 
        flex: 1; 
        min-height: 0;
    }
    
    .chat-container { border-left: none; }
    
    .chat-box { 
        padding: 16px; 
        gap: 16px;
    }
    
    .avatar { 
        width: 32px; 
        height: 32px; 
        font-size: 12px;
    }
    
    .msg-bubble { 
        max-width: 88%; 
        font-size: 15px;
        line-height: 1.5;
    }
    
    .user .msg-bubble { 
        padding: 10px 14px; 
    }
    
    .input-panel { 
        padding: 12px; 
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .chat-input { 
        font-size: 16px;
        padding: 10px;
    }
    
    .btn-send { 
        padding: 0 14px; 
        height: 38px;
    }
    
    .tool-btn { 
        font-size: 22px; 
        width: 38px;
        height: 38px;
        padding: 0;
    }
    
    .msg-bubble pre {
        max-width: calc(100vw - 100px);
    }
    
    .session-list { max-height: 120px; }
}

/* 小屏幕手机 (< 480px) */
@media (max-width: 480px) {
    .sidebar { max-height: 40vh; padding: 10px 12px; }
    .msg-bubble { max-width: 90%; font-size: 15px; }
    .tool-btn { font-size: 20px; width: 36px; height: 36px; }
    .custom-select-trigger { padding: 8px 12px; font-size: 13px; }
}

/* 宽屏优化 (>= 1200px) */
@media (min-width: 1200px) {
    .sidebar {
        width: 260px;
        min-width: 260px;
        height: 100vh;
        border-right: 1px solid #e5e7eb;
        padding: 20px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.02);
    }
    
    .page-content {
        flex: 1;
        height: 100vh;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }
    
    .page-content::-webkit-scrollbar { width: 6px; }
    .page-content::-webkit-scrollbar-track { background: transparent; }
    .page-content::-webkit-scrollbar-thumb {
        background-color: #cbd5e1;
        border-radius: 20px;
        border: 2px solid transparent;
        background-clip: content-box;
    }
    .page-content::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }
    
    /* 投资组合桌面端布局 */
    .portfolio-wrapper {
        padding: 24px 32px 32px;
        min-height: 100vh;
        background: #f1f5f9;
    }
    
    .portfolio-content {
        display: grid;
        grid-template-columns: 1.5fr 1fr;
        gap: 24px;
        max-width: 1400px;
        margin: 0 auto;
        padding: 0;
        overflow: visible;
    }
    
    .portfolio-mobile-header { display: none; }
    .portfolio-actions-mobile { display: none; }
    
    /* 顶部横幅 */
    .asset-hero-card {
        grid-column: 1 / -1;
        padding: 40px 48px;
        border-radius: 24px;
        position: relative;
        overflow: hidden;
    }
    .asset-hero-card::before {
        content: '';
        position: absolute;
        top: -50%;
        right: -10%;
        width: 600px;
        height: 600px;
        background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
        pointer-events: none;
    }
    
    .asset-value-row { gap: 8px; }
    .editable-number { font-size: 56px; }
    
    .income-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-top: 24px;
    }
    
    /* 指标卡片 */
    .rate-grid {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    .rate-card {
        padding: 28px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.05);
        transition: transform 0.3s, box-shadow 0.3s;
    }
    .rate-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(0,0,0,0.1);
    }
    
    .rate-value { font-size: 36px; }
    
    /* 图表区域 */
    .chart-card {
        grid-column: 1;
        height: 500px;
        display: flex;
        flex-direction: column;
        padding: 32px;
    }
    .chart-container {
        flex: 1;
        height: auto;
    }
    
    /* 持仓列表 */
    .holdings-card {
        grid-column: 2;
        grid-row: span 2;
        max-height: 600px;
        overflow-y: auto;
        padding: 28px;
    }
    
    .holding-item {
        flex-direction: row;
        padding: 20px;
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    .holding-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    }
    
    /* 浮动按钮 */
    .portfolio-actions {
        position: fixed;
        bottom: 32px;
        right: 32px;
        display: flex;
        gap: 12px;
    }
    
    .fab-btn {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        border: none;
        background: #0f172a;
        color: white;
        font-size: 20px;
        cursor: pointer;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
        transition: all 0.3s;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .fab-btn:hover {
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    }
    .fab-btn.secondary {
        background: white;
        color: #0f172a;
        border: 1px solid #e2e8f0;
    }
}

/* 超宽屏 (>= 1600px) */
@media (min-width: 1600px) {
    .portfolio-content {
        grid-template-columns: 2fr 1fr;
        gap: 32px;
    }
    .editable-number { font-size: 64px; }
    .chart-card { height: 600px; }
    .holdings-card { max-height: 700px; }
}

/* 安全区域适配 */
@supports (padding-top: env(safe-area-inset-top)) {
    .sidebar { padding-top: max(12px, env(safe-area-inset-top)); }
    .input-panel { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}
/* 投资组合样式 - 添加到 style.css 末尾 */

/* ========== 基础容器 ========== */
.portfolio-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* 自定义滚动条 */
.portfolio-container::-webkit-scrollbar {
    width: 8px;
}
.portfolio-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.02);
}
.portfolio-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

/* ========== 头部资产卡片 ========== */
.portfolio-header {
    margin-bottom: 24px;
}

.asset-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 32px;
    color: white;
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

/* 装饰性背景元素 */
.asset-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.asset-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.asset-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.asset-input-wrapper {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.currency {
    font-size: 24px;
    font-weight: 600;
    opacity: 0.9;
}

.asset-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 48px;
    font-weight: 700;
    width: 300px;
    font-family: 'Inter', sans-serif;
    padding: 0;
    transition: all 0.3s;
}

.asset-input:focus {
    outline: none;
    border-color: white;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 0 12px;
}

/* 操作按钮 */
.asset-actions {
    display: flex;
    gap: 12px;
}

.btn-icon-action {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.btn-icon-action:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* 收入网格 */
.income-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.income-box {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    padding: 20px;
}

.income-box.secondary {
    background: rgba(255,255,255,0.08);
}

.income-label {
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 6px;
}

.income-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.income-subtitle {
    font-size: 12px;
    opacity: 0.7;
}

/* 进度条 */
.progress-pill {
    background: rgba(0,0,0,0.15);
    height: 24px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255,255,255,0.4);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.progress-text {
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

/* ========== 指标卡片网格 ========== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid rgba(0,0,0,0.04);
}

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

.metric-card.price-yield {
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    color: white;
}

.metric-card.cost-yield {
    background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
    color: #064e3b;
}

.metric-icon {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 6px;
    font-weight: 500;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-desc {
    font-size: 12px;
    opacity: 0.7;
}

/* ========== 主内容区 ========== */
.portfolio-main {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

.section-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.04);
    height: 100%;
    box-sizing: border-box;
}

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

.card-header-custom h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-total {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.year-total strong {
    color: #111827;
    font-size: 20px;
    margin-left: 4px;
}

/* ========== 图表区域 ========== */
.chart-wrapper {
    height: 300px;
    position: relative;
    margin-bottom: 16px;
}

.chart-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    font-size: 13px;
    color: #6b7280;
}

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

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot.received { background: #14b8a6; }
.dot.announced { background: #f59e0b; }
.dot.predicted { background: #86efac; }

/* ========== 持仓列表 ========== */
.btn-add-new {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-add-new:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.holdings-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

/* 持仓项 - 紧凑卡片风格 */
.holding-compact {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.holding-compact:hover {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateX(4px);
}

.holding-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.holding-name {
    font-weight: 700;
    font-size: 15px;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.holding-code {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
}

.holding-yield-tag {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.holding-value-main {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.holding-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #6b7280;
}

.holding-shares-detail {
    display: flex;
    gap: 12px;
}

.holding-dividend {
    color: #059669;
    font-weight: 600;
}

.holding-months-compact {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.month-tag-compact {
    font-size: 11px;
    padding: 2px 8px;
    background: white;
    border: 1px solid #d1d5db;
    color: #4b5563;
    border-radius: 4px;
    font-weight: 500;
}

/* 删除按钮 */
.btn-del-compact {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    font-size: 14px;
}

.holding-compact:hover .btn-del-compact {
    opacity: 1;
}

.btn-del-compact:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

/* ========== 模态框 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.btn-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.modal-form {
    padding: 24px;
    overflow-y: auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.months-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hint {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

.months-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.month-checkbox {
    position: relative;
    cursor: pointer;
}

.month-checkbox input {
    position: absolute;
    opacity: 0;
}

.month-checkbox span {
    display: block;
    padding: 10px;
    text-align: center;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.2s;
}

.month-checkbox input:checked + span {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid #f3f4f6;
}

.btn-secondary {
    flex: 1;
    padding: 12px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-primary {
    flex: 2;
    padding: 12px;
    background: #111827;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 移动端悬浮按钮 */
.fab-mobile {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    border: none;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

/* ========== 响应式适配 ========== */

/* 平板 (<= 1024px) */
@media (max-width: 1024px) {
    .portfolio-container {
        padding: 16px;
    }
    
    .asset-input {
        font-size: 36px;
        width: 240px;
    }
    
    .income-grid {
        grid-template-columns: 1fr;
    }
    
    .portfolio-main {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper {
        height: 250px;
    }
    
    .holdings-list-container {
        max-height: 300px;
    }
}

/* 手机 (<= 640px) */
@media (max-width: 640px) {
    .portfolio-container {
        padding: 12px;
        padding-bottom: 80px; /* 为底部悬浮按钮留空间 */
    }
    
    .asset-card {
        padding: 24px 20px;
        border-radius: 20px;
    }
    
    .asset-input {
        font-size: 32px;
        width: 200px;
    }
    
    .asset-actions {
        display: none; /* 移动端隐藏顶部操作按钮，使用底部悬浮 */
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-value {
        font-size: 24px;
    }
    
    .section-card {
        padding: 20px;
        border-radius: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .months-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .modal-container {
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        animation: slideUpMobile 0.3s ease;
    }
    
    @keyframes slideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    .fab-mobile {
        display: flex;
    }
}
/* 空状态样式 - 添加到 style.css 末尾 */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 4px;
}
.empty-desc {
    font-size: 14px;
}
.asset-total-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-size: 15px;
    font-weight: 700;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    vertical-align: middle;
}
/* 金额和占比容器 */
.holding-value-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 占比百分比标签 */
.holding-percentage {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    font-size: 13px;
    font-weight: 700;
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* 调整 holding-top 布局确保对齐 */
.holding-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.holding-name {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.holding-value-main {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
}
/* 头部操作按钮组 */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 图标文字按钮 */
.btn-icon-text {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-text:hover {
    background: #e5e7eb;
    color: #111827;
    transform: translateY(-1px);
}

/* 响应式：小屏幕隐藏文字只显示图标 */
@media (max-width: 640px) {
    .btn-icon-text {
        padding: 6px;
    }
    .btn-icon-text::after {
        content: attr(title);
        display: none;
    }
}