/* LOF基金折溢价监控系统 - 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #4a90d9;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #2c3e50;
    --text2: #7f8c8d;
    --border: #e1e8ed;
    --pos: #e74c3c;
    --neg: #27ae60;
    --zero: #333;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; transition: background-color 0.3s ease, color 0.3s ease; }
.container { max-width: 1600px; margin: 0 auto; padding: 20px; }

/* Header */
.header { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 20px 30px; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3); }
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.header h1 { font-size: 1.8rem; font-weight: 600; }
.header-info { display: flex; align-items: center; gap: 10px; }
.status-text { font-size: 0.9rem; opacity: 0.9; }
.auto-refresh-label { font-size: 0.85rem; opacity: 0.9; }
.refresh-status { font-size: 0.85rem; opacity: 0; transition: opacity 0.3s ease; min-width: 60px; }
.refresh-status.show { opacity: 1; }

/* 深色模式按钮 */
.btn-dark-mode {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    min-width: 36px;
    height: 32px;
}
.btn-dark-mode:hover { background: rgba(255,255,255,0.25); transform: scale(1.05); }
.btn-dark-mode:active { transform: scale(0.95); }

/* 刷新按钮 */
.btn-manual-refresh {
    background: transparent; border: none; cursor: pointer;
    padding: 0; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: transform 0.2s ease;
}
.btn-manual-refresh:hover { transform: scale(1.1); }
.btn-manual-refresh:active { transform: scale(0.95); }
.btn-manual-refresh:disabled { opacity: 0.6; cursor: not-allowed; }
.refresh-icon { width: 32px; height: 32px; display: block; }
.refresh-icon.bouncing { animation: ingot-bounce 0.5s ease; }
@keyframes ingot-bounce {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    15% { transform: translateY(-8px) scale(1.15) rotate(-10deg); }
    30% { transform: translateY(0) scale(0.9) rotate(5deg); }
    45% { transform: translateY(-12px) scale(1.1) rotate(-5deg); }
    60% { transform: translateY(0) scale(0.95) rotate(3deg); }
    75% { transform: translateY(-4px) scale(1.05) rotate(-2deg); }
    90% { transform: translateY(0) scale(0.98) rotate(0deg); }
}

/* Status Bar */
.status-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
.status-item { background: var(--card); padding: 15px 20px; border-radius: 8px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: background 0.3s ease, box-shadow 0.3s ease; }
.status-label { display: block; font-size: 0.85rem; color: var(--text2); margin-bottom: 5px; }
.status-value { display: block; font-size: 1.3rem; font-weight: 600; color: var(--primary); }

/* Main Content */
.main-content { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--card); border-radius: 12px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); transition: background 0.3s ease, box-shadow 0.3s ease; }
.panel-title { font-size: 1rem; font-weight: 600; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.ranking-panel .panel-title { color: var(--pos); font-size: 0.9rem; margin-bottom: 8px; }
.ranking-panel .panel-title-neg { color: var(--neg); }
.ranking-dual { display: flex; gap: 12px; }
.ranking-col { flex: 1; min-width: 0; }
.ranking-col .rankings-list { border-top: none; padding-top: 0; }
.ranking-col .ranking-item { padding: 6px 0; }
.ranking-col .rank-num { width: 20px; height: 20px; font-size: 0.7rem; }
.rank-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.ranking-col .rank-code { font-size: 0.82rem; font-weight: 600; }
.ranking-col .rank-premium { font-size: 0.85rem; }

/* Rankings */
.rankings-list { display: flex; flex-direction: column; gap: 10px; }
.ranking-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: #f8f9fa; border-radius: 8px; transition: transform 0.2s; }
.ranking-item:hover { transform: translateX(5px); }
.rank-num { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.8rem; font-weight: 600; color: white; background: #bdc3c7; }
.rank-num.rank-1 { background: linear-gradient(135deg, #f39c12, #e74c3c); }
.rank-num.rank-2 { background: linear-gradient(135deg, #95a5a6, #7f8c8d); }
.rank-num.rank-3 { background: linear-gradient(135deg, #cd7f32, #a0522d); }
.rank-num.rank-4, .rank-num.rank-5 { background: var(--primary); }
.rank-code { display: block; font-size: 0.85rem; font-weight: 600; }
.rank-name { display: block; font-size: 0.75rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-premium { font-weight: 700; font-size: 0.95rem; color: var(--pos); }
.rank-discount { color: var(--neg) !important; }

/* Legend */
.legend-items { display: flex; flex-direction: column; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.legend-color { width: 16px; height: 16px; border-radius: 4px; }
.legend-color.premium-positive { background: var(--pos); }
.legend-color.premium-negative { background: var(--neg); }
.legend-color.premium-zero { background: var(--zero); }

/* Content */
.content { background: var(--card); border-radius: 12px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); transition: background 0.3s ease, box-shadow 0.3s ease; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; gap: 15px; }
.search-box { flex: 1; max-width: 400px; position: relative; }
.search-box input { width: 100%; padding: 10px 45px 10px 15px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; transition: border-color 0.3s; background: var(--card); color: var(--text); }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,217,0.1); }
.btn-settings { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: var(--primary); color: white; border: none; padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; line-height: 1; white-space: nowrap; display: flex; align-items: center; gap: 3px; }
.btn-settings:hover { background: #357abd; }
.mobile-sort-btns { display: none; gap: 6px; flex-direction: column; }
.sort-btn-row { display: flex; gap: 4px; align-items: stretch; }
.sort-btn-row .btn-sort-mode { flex: 1; }
.btn-sort-mode {
    padding: 7px 16px; border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
    background: var(--card); color: var(--text2); white-space: nowrap;
}
.btn-sort-mode.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-sort-mode:active { transform: scale(0.96); }
.btn-arb-help {
    display: flex; align-items: center; justify-content: center;
    width: 28px; min-width: 28px; border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--card); color: var(--text2); font-size: 0.82rem; font-weight: 700;
    cursor: pointer; padding: 0; transition: all 0.15s; flex-shrink: 0;
}
.btn-arb-help:hover { border-color: var(--primary); color: var(--primary); background: #eef4ff; }
/* Arb help popup */
.arb-help-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2100;
    display: flex; align-items: center; justify-content: center;
}
.arb-help-popup {
    background: var(--card); border-radius: 14px; width: 90%; max-width: 400px;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    animation: fd-fadein 0.2s ease;
}
.arb-help-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--card); border-radius: 14px 14px 0 0;
}
.arb-help-header h3 { font-size: 1.05rem; color: var(--text); margin: 0; }
.arb-help-close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
    color: var(--text2); line-height: 1; padding: 0 2px;
}
.arb-help-close:hover { color: var(--text); }
.arb-help-body { padding: 16px 20px 20px; font-size: 0.88rem; line-height: 1.7; color: var(--text); }
.arb-help-body .arb-step { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; }
.arb-help-body .arb-step-num {
    flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 0.75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.arb-help-body .arb-step-text { flex: 1; }
.arb-help-body .arb-warn {
    margin-top: 14px; padding: 10px 14px; background: #fff8e1; border-radius: 8px;
    font-size: 0.82rem; color: #b45309; line-height: 1.6;
}
.dark-mode .arb-help-body .arb-warn { background: #2d2510; color: #fbbf24; }
.dark-mode .arb-help-popup { box-shadow: 0 12px 40px rgba(0,0,0,0.5); }
.dark-mode .btn-arb-help:hover { background: #1a2a48; }
.pagination-info { font-size: 0.9rem; color: var(--text2); }

/* Settings Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: var(--card); border-radius: 12px; width: 90%; max-width: 400px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-header h3 { font-size: 1.1rem; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text2); cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; }
.input-with-unit { display: flex; align-items: center; gap: 8px; }
.input-with-unit input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; background: var(--bg); color: var(--text); transition: border-color 0.3s, background 0.3s, color 0.3s; }
.input-with-unit input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,217,0.1); }
.input-with-unit .unit { color: var(--text2); font-size: 0.9rem; }
.form-hint { font-size: 0.8rem; color: var(--text2); margin-top: 6px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.btn-primary:hover { background: #357abd; }
.btn-secondary { background: #f0f0f0; color: var(--text); border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.btn-secondary:hover { background: #e0e0e0; }

/* Table */
.table-container { overflow-x: auto; }
.fund-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: fixed; }
.fund-table thead { background: #f8f9fa; position: sticky; top: 0; z-index: 10; }
.fund-table th { padding: 12px 10px; text-align: left; font-weight: 600; color: var(--text2); border-bottom: 2px solid var(--border); user-select: none; white-space: nowrap; }
.fund-table th.sortable { cursor: pointer; position: relative; padding-right: 18px; }
.fund-table th.sortable:hover { color: var(--primary); }
.fund-table th.active { color: var(--primary); }
.fund-table th.sort-asc::after, .fund-table th.sort-desc::after { content: ''; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); opacity: 0.6; font-size: 10px; }
.fund-table th.sort-asc::after { content: '▲'; opacity: 1; }
.fund-table th.sort-desc::after { content: '▼'; opacity: 1; }
.fund-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.fund-row { transition: background-color 0.2s; }
.fund-row:hover { background-color: #f8f9fa; }
.col-code { width: 68px; font-weight: 600; }
.col-name { width: 15%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-price, .col-nav, .col-change, .col-premium, .col-avg-premium { width: 8%; }
.col-amount { width: 9%; }
.col-est-profit-rate, .col-est-profit-amount { width: 9%; }
.col-status { width: 60px; }
.col-time { width: 72px; }
.fund-table td { font-size: 0.83rem; }
.col-price, .col-nav { text-align: right; width: 100px; }
.col-change, .col-premium, .col-avg-premium, .col-amount, .col-est-profit-rate, .col-est-profit-amount { text-align: right; }
.col-status { width: 80px; }
.col-time { width: 130px; font-size: 0.85rem; color: var(--text2); }
.premium-positive { color: var(--pos); font-weight: 600; }
.premium-negative { color: var(--neg); font-weight: 600; }
.premium-zero { color: var(--zero); }
.settings-divider { border: 0; border-top: 1px dotted #ccc; margin: 16px 0; }
.change.up { color: var(--pos); }
.change.down { color: var(--neg); }
.nav-badge { display: inline-block; font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; margin-left: 4px; background: #e8f4f8; color: var(--primary); }
.status-badge { display: inline-block; font-size: 0.75rem; padding: 3px 8px; border-radius: 4px; }
.status-badge.溢价 { background: #fdeaea; color: var(--pos); }
.status-badge.折价 { background: #e8f5e9; color: var(--neg); }
.status-badge.平价 { background: #f5f5f5; color: var(--zero); }
.empty-state { text-align: center; padding: 60px 20px !important; color: var(--text2); }
.empty-state .icon { font-size: 3rem; display: block; margin-bottom: 10px; }
.loading-hint { font-size: 0.85rem; color: var(--text2); margin-top: 8px; opacity: 0.7; }
.loading-spinner-icon { animation: spin-slow 2s linear infinite; display: block; }
@keyframes spin-slow { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Loader */
.loader-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.95); display: flex; align-items: center; justify-content: center; z-index: 1000; transition: background 0.3s ease; }
.loader-content { text-align: center; }
.spinner { width: 50px; height: 50px; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loader-hint { font-size: 0.85rem; color: #999; margin-top: 8px; }

/* Error */
.error-container { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.98); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.error-content { text-align: center; }
.error-icon { font-size: 4rem; margin-bottom: 20px; }
.btn-retry { margin-top: 20px; padding: 12px 30px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; }
.btn-retry:hover { background: #357abd; }

/* Pagination */
.pagination-bar { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 15px; padding: 12px 0; border-top: 1px solid var(--border); }
.page-btn { padding: 6px 16px; border: 1px solid var(--border); background: white; border-radius: 6px; cursor: pointer; font-size: 0.9rem; color: var(--text); transition: all 0.2s; }
.page-btn:hover:not(:disabled) { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 0.9rem; color: var(--text2); }
.page-size-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; color: var(--text); background: white; cursor: pointer; margin-left: 10px; }

/* Footer */
.footer { margin-top: 30px; text-align: center; color: var(--text2); font-size: 0.85rem; }
.footer p { margin: 5px 0; }
.footer .risk-warning { color: #e74c3c; font-weight: 600; font-size: 0.9rem; margin: 8px 0; }
.footer .legal-links { margin: 8px 0; }
.footer .legal-links a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
.footer .legal-links a:hover { color: #357abd; text-decoration: underline; }
.footer .legal-links .divider { margin: 0 8px; color: var(--border); }

/* Responsive */
@media (max-width: 1200px) { .main-content { grid-template-columns: 1fr; } .sidebar { flex-direction: row; } .sidebar .panel { flex: 1; } }

/* ========== 移动端 ========== */
@media (max-width: 768px) {
    .container { padding: 0; }
    .header { border-radius: 0; padding: 14px 16px; margin-bottom: 0; }
    .header h1 { font-size: 1.15rem; }
    .status-text { font-size: 0.75rem; }
    .status-bar { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px 12px; margin-bottom: 0; background: var(--bg); }
    .status-item { padding: 10px 12px; border-radius: 8px; }
    .status-label { font-size: 0.75rem; }
    .status-value { font-size: 1.05rem; }
    .status-item:nth-child(3),
    .status-item:nth-child(4) { display: none; }
    .sidebar { display: none !important; }
    .table-container { display: none !important; }
    .mobile-card-list { display: flex; flex-direction: column; gap: 0; }
    .mobile-card { display: flex; flex-wrap: wrap; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--card); transition: background 0.15s; gap: 4px; position: relative; overflow: hidden; cursor: pointer; }
    .mobile-card:active { background: #f0f2f5; }
    .mobile-card::after { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(74,144,217,0.15); transform: translate(-50%, -50%); transition: width 0.5s ease, height 0.5s ease, opacity 0.5s ease; pointer-events: none; }
    .mobile-card:active::after { width: 600px; height: 600px; opacity: 0; transition: 0s; }
    .mc-top-row { flex: 1 1 auto; display: flex; align-items: baseline; gap: 6px; min-width: 0; flex-wrap: wrap; }
    .mc-code { font-size: 0.85rem; font-weight: 700; color: var(--text); }
    .mc-name { font-size: 0.8rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 4px; }
    .mc-status-badge { font-size: 0.65rem; padding: 1px 5px; border-radius: 3px; }
    .mc-right { display: flex; align-items: flex-start; justify-content: flex-end; flex-shrink: 0; }
    .mc-premium { font-size: 1.3rem; font-weight: 700; }
    .mc-premium.mc-pos { color: var(--pos); }
    .mc-premium.mc-neg { color: var(--neg); }
    .mc-premium.mc-zero { color: var(--zero); }
    .mc-profit-row { width: 100%; display: flex; align-items: center; gap: 6px; padding-top: 4px; }
    .mc-profit-label { font-size: 0.75rem; color: var(--text2); }
    .mc-profit-val { font-size: 0.85rem; font-weight: 600; }
    .mc-profit-val.mc-pos { color: var(--pos); }
    .mc-profit-val.mc-neg { color: var(--neg); }
    .mc-profit-help {
        display: inline-flex; align-items: center; justify-content: center;
        width: 18px; height: 18px; border-radius: 50%;
        border: 1.5px solid #aaa; background: transparent;
        color: #888; font-size: 11px; font-weight: bold;
        cursor: pointer; padding: 0; line-height: 1;
        transition: all 0.15s; flex-shrink: 0;
    }
    .mc-profit-help:hover { border-color: var(--primary); color: var(--primary); background: #e8f4ff; }
    .mobile-empty { text-align: center; padding: 60px 20px; color: var(--text2); }
    .mobile-empty .icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }
    .toolbar { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
    .search-box { max-width: 100%; flex: 1 1 100%; }
    .search-box input { padding: 8px 50px 8px 12px; font-size: 0.85rem; border-radius: 8px; }
    .btn-settings { padding: 4px 8px; font-size: 0.7rem; border-radius: 4px; right: 4px; }
    .mobile-sort-btns { display: flex; flex: 1 1 100%; flex-direction: row; }
    .sort-btn-row { flex: 1; }
    .btn-sort-mode { text-align: center; padding: 8px 12px; font-size: 0.82rem; width: 100%; }
    .btn-arb-help { width: 26px; min-width: 26px; font-size: 0.78rem; }
    .pagination-info { font-size: 0.75rem; white-space: nowrap; }
    .content { border-radius: 0; padding: 0; box-shadow: none; }
    .pagination-bar { padding: 10px 8px; gap: 4px; flex-wrap: nowrap; }
    .page-btn { padding: 6px 10px; font-size: 0.78rem; white-space: nowrap; flex-shrink: 0; }
    .page-info { font-size: 0.75rem; white-space: nowrap; flex-shrink: 0; }
    .page-size-select { display: none; }
    .footer { margin-top: 0; padding: 16px 12px; font-size: 0.75rem; }
    /* Settings Modal - 移动端固定高度滑动式 */
    .modal-content { width: 100%; max-width: 100%; height: 85vh; max-height: 85vh; border-radius: 16px 16px 0 0; margin-top: auto; }
    .modal-overlay { align-items: flex-end; }
    .modal-body { padding: 16px 20px; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .modal-header { padding: 16px 20px; }
    .modal-footer { padding: 12px 20px; }
    .form-group { margin-bottom: 16px; }
    .form-group label { font-size: 0.85rem; }
    .form-hint { font-size: 0.75rem; }
    .input-with-unit input { padding: 10px 12px; font-size: 0.95rem; border-radius: 8px; }
    .btn-primary, .btn-secondary { padding: 10px 24px; font-size: 0.9rem; border-radius: 8px; }
    .modal-close { font-size: 1.6rem; padding: 4px 8px; }
}

@media (min-width: 769px) {
    .mobile-card-list { display: none; }
}

/* ===== 预计收益详情弹窗 ===== */
.btn-profit-info {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    border: 1px solid #aaa; background: transparent;
    color: #888; font-size: 11px; font-weight: bold;
    cursor: pointer; margin-left: 4px; vertical-align: middle;
    line-height: 1; padding: 0; transition: all 0.15s;
}
.btn-profit-info:hover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }

.profit-popover-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.profit-popover-card {
    background: #fff; border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    max-width: 380px; width: 90%; max-height: 80vh;
    overflow-y: auto; position: relative; padding: 20px;
    animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.profit-popover-close {
    position: absolute; top: 12px; right: 14px;
    width: 28px; height: 28px; border-radius: 50%;
    border: none; background: #f0f0f0; color: #666;
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.profit-popover-close:hover { background: #e0e0e0; }

.profit-detail { font-size: 14px; color: #333; }
.profit-detail-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; padding-right: 24px; }
.profit-detail-section { background: #f8f9fa; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.profit-detail-subtitle { font-size: 13px; font-weight: 600; color: #555; margin-bottom: 6px; }
.profit-detail-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; color: #666; }
.profit-detail-row span:last-child { font-family: 'Menlo', 'Consolas', monospace; font-size: 13px; }
.profit-detail-row.plus span:last-child { color: var(--pos); font-weight: 500; }
.profit-detail-row.minus span:last-child { color: var(--neg); font-weight: 500; }
.profit-detail-row.highlight { background: #e8f4f8; border-radius: 4px; padding: 4px 6px; margin: 2px -6px; font-weight: 500; color: #333; }
.profit-detail-row.total { border-top: 1px solid #e0e0e0; margin-top: 4px; padding-top: 6px; font-weight: 700; font-size: 14px; color: #333; }
.profit-detail-row.hint { font-size: 11px; color: #999; }
.profit-detail-footer { font-size: 11px; color: #999; text-align: center; margin-top: 8px; }

/* ========== 深色模式样式 ========== */
.dark-mode {
    --bg: #1a1a2e;
    --card: #16213e;
    --text: #e0e0e0;
    --text2: #8899aa;
    --border: #2a2a4a;
    --pos: #ff6b6b;
    --neg: #51cf66;
    --zero: #aaa;
    --primary: #5c9eff;
}
.dark-mode body { background: var(--bg); color: var(--text); }
.dark-mode .header { background: linear-gradient(135deg, #1a1a40 0%, #2d1b69 100%); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); }
.dark-mode .btn-dark-mode { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.dark-mode .btn-dark-mode:hover { background: rgba(255,255,255,0.2); }
.dark-mode .status-bar { background: var(--bg); }
.dark-mode .status-item { background: var(--card); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.dark-mode .panel { background: var(--card); box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
.dark-mode .content { background: var(--card); box-shadow: 0 2px 12px rgba(0,0,0,0.15); }
.dark-mode .ranking-item { background: #1e2a4a; }
.dark-mode .ranking-item:hover { background: #253358; }
.dark-mode .fund-table thead { background: #1a1a38; }
.dark-mode .fund-table td { border-bottom-color: var(--border); }
.dark-mode .fund-table th { border-bottom-color: var(--border); color: var(--text2); }
.dark-mode .fund-row:hover { background-color: #1e2a4a; }
.dark-mode .search-box input { background: var(--bg); color: var(--text); border-color: var(--border); }
.dark-mode .input-with-unit input { background: var(--bg); color: var(--text); border-color: var(--border); }
.dark-mode .modal-content { background: var(--card); color: var(--text); }
.dark-mode .modal-header { border-bottom-color: var(--border); }
.dark-mode .modal-footer { border-top-color: var(--border); }
.dark-mode .btn-secondary { background: #2a2a4a; color: var(--text); }
.dark-mode .btn-secondary:hover { background: #3a3a5a; }
.dark-mode .page-btn { background: var(--card); color: var(--text); border-color: var(--border); }
.dark-mode .page-btn:hover:not(:disabled) { background: var(--primary); color: white; }
.dark-mode .page-size-select { background: var(--card); color: var(--text); border-color: var(--border); }
.dark-mode .nav-badge { background: #1a3a5c; color: var(--primary); }
.dark-mode .status-badge.溢价 { background: #3d1a1a; color: var(--pos); }
.dark-mode .status-badge.折价 { background: #1a3d22; color: var(--neg); }
.dark-mode .status-badge.平价 { background: #2a2a2a; color: var(--zero); }
.dark-mode .empty-state { color: var(--text2); }
.dark-mode .mobile-card { background: var(--card); border-bottom-color: var(--border); }
.dark-mode .mobile-card:active { background: #1e2a4a; }
.dark-mode .mobile-empty { color: var(--text2); }
.dark-mode .toolbar { background: transparent; }
.dark-mode .pagination-bar { border-top-color: var(--border); }
.dark-mode .settings-divider { border-top-color: var(--border); }
.dark-mode .profit-popover-card { background: var(--card); color: var(--text); }
.dark-mode .profit-popover-close { background: #2a2a4a; color: var(--text2); }
.dark-mode .profit-popover-close:hover { background: #3a3a5a; }
.dark-mode .profit-detail { color: var(--text); }
.dark-mode .profit-detail-section { background: #1a1a38; }
.dark-mode .profit-detail-subtitle { color: var(--text2); }
.dark-mode .profit-detail-row { color: var(--text2); }
.dark-mode .profit-detail-row.highlight { background: #1a2a48; color: var(--text); }
.dark-mode .profit-detail-row.total { border-top-color: var(--border); color: var(--text); }
.dark-mode .profit-detail-footer { color: var(--text2); }
.dark-mode .btn-profit-info { border-color: #555; color: #888; }
.dark-mode .btn-profit-info:hover { border-color: var(--primary); color: var(--primary); background: #1a2a48; }
.dark-mode .legend-color.premium-zero { background: var(--zero); }
.dark-mode .loader-overlay { background: rgba(26, 26, 46, 0.95); }
.dark-mode .error-container { background: rgba(26, 26, 46, 0.98); }
.dark-mode .spinner { border-color: #2a2a4a; border-top-color: var(--primary); }
.dark-mode .loader-hint { color: #666; }
.dark-mode .footer { color: var(--text2); }
.dark-mode .footer .legal-links a { color: var(--primary); }
.dark-mode .form-hint { color: var(--text2); }
.dark-mode .loading-hint { color: var(--text2); }
/* 详情弹窗 */
.dark-mode .fund-detail-modal { box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.dark-mode .fd-kpi-item { background: #1a2a4a; }
.dark-mode .fd-profit-section { background: linear-gradient(135deg, #1a2a4a, #16213e); }
.dark-mode .fd-code-name:hover { color: var(--primary); }
.dark-mode .fd-profit-help { border-color: #555; color: #888; }
.dark-mode .fd-profit-help:hover { border-color: var(--primary); color: var(--primary); background: #1a2a48; }
.dark-mode .fd-info-icon { border-color: #555; color: #888; }
.dark-mode .fd-info-icon:hover { border-color: var(--primary); color: var(--primary); background: #1a2a48; }
.dark-mode .fd-fee-breakdown { border-top-color: var(--border); }
.dark-mode .fd-skeleton-kpi span,
.dark-mode .fd-skeleton-grid { background: linear-gradient(90deg, #2a2a4a 25%, #3a3a5a 50%, #2a2a4a 75%); background-size: 200% 100%; }
.dark-mode .mc-profit-help { border-color: #555; color: #888; }
.dark-mode .mc-profit-help:hover { border-color: var(--primary); color: var(--primary); background: #1a2a48; }

/* 强制浅色模式（覆盖系统偏好） */
.light-mode {
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #2c3e50;
    --text2: #7f8c8d;
    --border: #e1e8ed;
    --pos: #e74c3c;
    --neg: #27ae60;
    --zero: #333;
    --primary: #4a90d9;
}

/* ===== 复制成功软弹窗 ===== */
.copy-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.7); color: #fff; padding: 10px 24px;
    border-radius: 20px; font-size: 0.9rem; z-index: 99999;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease, top 0.2s ease;
    top: 30px;
}
.copy-toast.show { opacity: 1; top: 20px; }

/* 深色模式 ripple 适配 */
.dark-mode .mobile-card::after { background: rgba(92,158,255,0.2); }

/* ===== 基金详情弹窗 ===== */
.fund-detail-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: flex; align-items: safe center; justify-content: center;
    padding: 24px 0;
}
.fund-detail-modal {
    overscroll-behavior: contain;
    background: var(--card); border-radius: 16px;
    max-width: 680px; width: 95%; max-height: calc(100vh - 48px);
    overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fd-fadein 0.25s ease;
}
@keyframes fd-fadein { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* 基金详情弹窗滚动条 */
.fund-detail-modal::-webkit-scrollbar { width: 6px; }
.fund-detail-modal::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
.fund-detail-modal::-webkit-scrollbar-thumb { background: #c0c4cc; border-radius: 3px; }
.fund-detail-modal::-webkit-scrollbar-thumb:hover { background: #909399; }
.dark-mode .fund-detail-modal::-webkit-scrollbar-thumb { background: #3a4a6a; }
.dark-mode .fund-detail-modal::-webkit-scrollbar-thumb:hover { background: #556688; }

/* 全局滚动条 */
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: var(--bg); }
body::-webkit-scrollbar-thumb { background: #c0c4cc; border-radius: 4px; }
body::-webkit-scrollbar-thumb:hover { background: #909399; }
.dark-mode body::-webkit-scrollbar-track { background: #0d1b2e; }
.dark-mode body::-webkit-scrollbar-thumb { background: #2a3f5f; }
.dark-mode body::-webkit-scrollbar-thumb:hover { background: #3d5a80; }

.fd-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--card); border-radius: 16px 16px 0 0; z-index: 1;
}
.fd-header h3 { font-size: 1.2rem; color: var(--text); }
.fd-close {
    background: none; border: none; font-size: 1.8rem; cursor: pointer;
    color: var(--text2); line-height: 1; padding: 0 4px; transition: color 0.2s;
}
.fd-close:hover { color: var(--pos); }

.fd-skeleton { display: none; padding: 24px; }
.fd-skeleton.show { display: block; }
.fd-skeleton-kpi {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    margin-bottom: 20px;
}
.fd-skeleton-kpi span {
    display: block; height: 56px; border-radius: 8px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: fd-shimmer 1.5s ease-in-out infinite;
}
.fd-skeleton-grid {
    height: 240px; border-radius: 8px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: fd-shimmer 1.5s ease-in-out infinite;
}
@keyframes fd-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.fd-phase { padding: 20px 24px; }
.fd-phase.hidden { display: none; }
#fdPhase2 { display: none; opacity: 0; transition: opacity 0.3s ease; }
#fdPhase2.visible { opacity: 1; }

.fd-kpi-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.fd-kpi-item {
    background: #f8f9fc; border-radius: 10px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.fd-kpi-label { font-size: 0.75rem; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
.fd-kpi-value { font-size: 1rem; font-weight: 600; color: var(--text); }
.fd-kpi-value.fd-pos { color: var(--pos); }
.fd-kpi-value.fd-neg { color: var(--neg); }
.fd-kpi-value.fd-change-up { color: var(--pos); }
.fd-kpi-value.fd-change-down { color: var(--neg); }
.fd-code-name { cursor: pointer; user-select: all; transition: color 0.15s; }
.fd-code-name:hover { color: var(--primary); }

.fd-profit-section {
    margin-top: 16px; background: linear-gradient(135deg, #f6f8fc, #eef2f7);
    border-radius: 12px; padding: 16px; position: relative;
}
.fd-profit-header {
    display: flex; align-items: center; gap: 8px;
}
.fd-profit-title { font-size: 0.85rem; color: var(--text2); font-weight: 500; }
.fd-profit-val { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.fd-profit-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    border: 1.5px solid #aaa; background: transparent;
    color: #888; font-size: 12px; font-weight: bold;
    cursor: pointer; padding: 0; line-height: 1; transition: all 0.15s;
    flex-shrink: 0;
}
.fd-profit-help:hover { border-color: var(--primary); color: var(--primary); background: #e8f4ff; }

.fd-fee-breakdown {
    display: none; position: absolute; z-index: 15; top: 100%; left: 0; margin-top: 4px;
    width: max-content; min-width: 200px;
    background: var(--card); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.fd-fee-breakdown.show { display: block; }
.dark-mode .fd-fee-breakdown { background: #162d50; border-color: #334466; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.fd-fee-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; }
.fd-fee-table td { padding: 5px 0; }
.fd-fee-label { color: var(--text2); }
.fd-fee-val { text-align: right; font-family: 'Menlo','Consolas',monospace; color: var(--text); }
.fd-fee-sep td { padding: 2px 0; border-top: 1px solid var(--border); }
.fd-fee-total td { font-weight: 700; font-size: 0.9rem; }
.fd-fee-total .fd-pos { color: var(--pos); }
.fd-fee-total .fd-neg { color: var(--neg); }

.fd-chart-legend {
    display: flex; gap: 16px; margin-bottom: 8px; font-size: 0.85rem;
    color: var(--text); align-items: center;
}
.fd-legend-item { display: flex; align-items: center; gap: 4px; }
.fd-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.fd-info-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    border: 1px solid #aaa; background: transparent;
    color: #888; font-size: 10px; font-weight: bold;
    cursor: pointer; padding: 0; line-height: 1; transition: all 0.15s;
}
.fd-info-icon:hover { border-color: var(--primary); color: var(--primary); background: #e8f4ff; }

.fd-chart-container { width: 100%; height: 320px; margin-top: 4px; position: relative; }
.fd-chart-container canvas { width: 100% !important; height: 100% !important; }

/* Arbitrage tooltip */
.fd-arb-tooltip {
    position: absolute; z-index: 10; pointer-events: none;
    bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 8px; width: max-content; max-width: calc(100% - 20px);
    background: var(--card); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12); font-size: 0.78rem;
    display: none; color: var(--text);
    text-align: center;
}
.dark-mode .fd-arb-tooltip { background: #162d50; border-color: #334466; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.arb-tooltip-date { font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; color: var(--text); }
.arb-tooltip-row { display: flex; justify-content: space-between; padding: 2px 0; }
.arb-tooltip-row span:first-child { color: var(--text2); }
.arb-tooltip-row span:last-child { font-weight: 500; font-variant-numeric: tabular-nums; }
.arb-tooltip-sep { border-top: 1px solid var(--border); margin: 6px 0; }
.arb-tooltip-title { font-weight: 600; color: var(--primary); margin-bottom: 2px; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.arb-tooltip-subtitle { font-size: 0.72rem; color: var(--text2); margin: 4px 0 2px; font-weight: 600; }
.arb-tooltip-profit span:last-child { font-size: 0.9rem; font-weight: 700; }
.arb-pos { color: #e74c3c; }
.arb-neg { color: #27ae60; }

/* Chart controls: indicator dropdown left, range dropdown right */
.fd-chart-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
.fd-ind-select, .fd-range-select { padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font-size: 0.82rem; cursor: pointer; outline: none; transition: border-color 0.2s; }
.fd-ind-select:hover, .fd-range-select:hover { border-color: var(--primary); }
.fd-ind-select:focus, .fd-range-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(24,144,255,0.15); }
.dark-mode .fd-ind-select, .dark-mode .fd-range-select { background: #1a2a4a; border-color: #334466; color: #c8d6e5; }

/* Full-width chart */
.fd-phase { width: 100%; position: relative; }

.fd-custom-tip {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.85); color: #fff; padding: 12px 20px;
    border-radius: 10px; font-size: 0.85rem; max-width: 400px;
    text-align: center; z-index: 2001; cursor: pointer;
    animation: fd-tipin 0.2s ease;
}
@keyframes fd-tipin { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

@media (max-width: 600px) {
    .fund-detail-modal {
        max-width: 100%; width: 100%; border-radius: 20px 20px 0 0; margin-bottom: 0; align-self: flex-end;
        max-height: 92vh; overflow-x: hidden;
    }
    .fd-header { padding: 14px 16px; }
    .fd-header h3 { font-size: 1.05rem; }
    .fd-phase { padding: 14px 16px; }
    .fd-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .fd-kpi-item { padding: 8px 10px; border-radius: 8px; }
    .fd-kpi-label { font-size: 0.7rem; letter-spacing: 0.3px; }
    .fd-kpi-value { font-size: 0.92rem; }
    .fd-mobile-hide { display: none; }
    .fd-mobile-span { grid-column: 1 / -1; }
    .fd-profit-section { margin-top: 10px; padding: 12px 14px; }
    .fd-profit-val { font-size: 1.15rem; }
    .fd-chart-legend { gap: 10px; font-size: 0.78rem; }
    .fd-chart-controls { gap: 6px; }
    .fd-ind-select, .fd-range-select { padding: 5px 8px; font-size: 0.72rem; }
    .fd-chart-container { height: 200px; }
    /* 移动端滚动条适配 */
    .fund-detail-modal::-webkit-scrollbar { width: 3px; }
    .fund-detail-modal::-webkit-scrollbar-thumb { border-radius: 2px; }
    body::-webkit-scrollbar { width: 4px; }
    body::-webkit-scrollbar-thumb { border-radius: 2px; }
    .fd-skeleton { padding: 16px; }
    .fd-skeleton-kpi { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .fd-skeleton-grid { height: 180px; }
}

/* Extracted inline styles */
.form-hint--margin { margin-bottom: 12px; }
.footer-credit { text-align: right; font-size: 12px; color: #999; margin-top: 8px; }
.fd-legend-dot--price { background: #ff7a45; }
.fd-legend-dot--nav { background: #40a9ff; }
