/* ═══════════════════════════════════════════
   创元Quant — 白底黑字 简洁时尚主题
   ═══════════════════════════════════════════ */

:root {
    /* ── 背景 ── */
    --bg-primary: #ffffff;
    --bg-secondary: #f7f8fa;
    --bg-card: #ffffff;
    --bg-card-hover: #fafbfc;
    --bg-elevated: #ffffff;

    /* ── 文字 ── */
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #9a9aae;

    /* ── 主色 ── */
    --accent-gradient: linear-gradient(135deg, #667eea, #764ba2);
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-cyan: #06b6d4;

    /* ── 信号色 ── */
    --accent-buy: #ff4757;
    --accent-sell: #2ed573;
    --accent-hold: #ffa502;
    --accent-buy-bg: rgba(255,71,87,0.08);
    --accent-sell-bg: rgba(46,213,115,0.08);
    --accent-hold-bg: rgba(255,165,2,0.08);

    /* ── 界面 ── */
    --border-subtle: #e8eaee;
    --border-hover: #d0d4dd;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-glow: rgba(102,126,234,0.15);
    --btn-bg: #f0f1f3;
    --btn-hover: #e4e6ea;
    --font-mono: Arial, 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
}

/* ════════════════════ 导航 ════════════════════ */

.navbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 15px 24px;
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 22px !important;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.navbar-brand span {
    font-weight: 300;
}

.navbar-row {
    display: flex;
    align-items: center;
    flex: 1;
}

.navbar-links {
    display: flex;
    gap: 4px;
    flex: 1;
}

.navbar-links a {
    padding: 6px 18px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 20px !important;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.navbar-links a:hover {
    color: var(--text-primary);
    background: var(--btn-bg);
}

.navbar-links a.active {
    color: var(--accent-primary);
    background: rgba(102,126,234,0.08);
}

.navbar-time {
    font-size: 14px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ════════════════════ 容器 ════════════════════ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* ════════════════════ 卡片 ════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.25s;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 首页收藏列表标题 +4px */
.section > .card-header > .card-title {
    font-size: 19px !important;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* ════════════════════ 网格 ════════════════════ */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ════════════════════ 平板适配 ════════════════════ */

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════ 移动端适配 ════════════════════ */

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    .navbar { padding: 12px 12px; gap: 10px; }
    .navbar-brand { font-size: 18px !important; }
    .navbar-links { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .navbar-links a { padding: 5px 10px; font-size: 16px !important; white-space: nowrap; }
    .navbar-time { display: none; }

    .container { padding: 12px; }

    .card { padding: 14px; border-radius: 10px; }
    .card-header { margin-bottom: 10px; padding-bottom: 8px; flex-wrap: wrap; gap: 8px; }
    .card-title { font-size: 14px; }
    .signal-toggle-btn { font-size: 13px; padding: 4px 10px; }
    .signal-toggle-group { border-radius: 6px; }

    th { padding: 8px 8px; font-size: 11px; }
    td { padding: 8px 8px; font-size: 13px; }

    #etfTable th:nth-child(n+7), #etfTable td:nth-child(n+7) { display: none; }
    #favTable th:nth-child(6), #favTable td:nth-child(6),
    #favTable th:nth-child(7), #favTable td:nth-child(7),
    #favTable th:nth-child(8), #favTable td:nth-child(8) { display: none; }

    #holdingTable th:nth-child(6), #holdingTable td:nth-child(6),
    #holdingTable th:nth-child(7), #holdingTable td:nth-child(7) { display: none; }

    #transactionBody ~ table th:nth-child(7),
    #transactionBody ~ table td:nth-child(7) { display: none; }

    .index-scroll { margin: 0 -12px; padding: 0 12px; }
    .index-grid { gap: 8px; }
    .index-card { padding: 10px; }
    .index-card .index-price { font-size: 15px; }
    .index-card .index-change { font-size: 12px; }

    .detail-header { gap: 4px; }
    .detail-name { font-size: 20px; }
    .header-price { font-size: 26px; }
    .header-price-row { gap: 8px; }
    .market-volume-area { padding: 4px 10px; }
    .market-vol-value { font-size: 12px; }
    #compScoreCircle { width: 50px; height: 50px; }
    #compScore { font-size: 16px; }
    #compSignal { font-size: 8px; }
    #ytdCircle { min-width: 50px; padding: 6px 10px; }
    .ytd-value { font-size: 11px; }
    .win-rate-box { min-width: 50px; padding: 6px 10px; }
    .win-rate-value { font-size: 11px; }
    .sell-win-rate-box { min-width: 50px; padding: 6px 10px; }
    .sell-win-rate-value { font-size: 11px; }

    .factor-grid { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
    .factor-label { font-size: 11px; }
    .factor-val { font-size: 11px; }
    .composite-history-row { gap: 10px; justify-content: center; }
    .stat-value { font-size: 14px; }

    .indicator-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .indicator-item { padding: 8px 4px; }
    .indicator-item .value { font-size: 14px; }

    .signal-item { flex-wrap: wrap; gap: 6px; padding: 8px 0; }
    .signal-date { min-width: 70px; font-size: 11px; }

    .tab { padding: 8px 6px; font-size: 12px; }

    .btn { padding: 10px 14px; font-size: 13px; min-height: 40px; }
    .btn-sm { padding: 6px 10px; font-size: 12px; min-height: 32px; }

    .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .metric-item { padding: 12px; }
    .metric-item .value { font-size: 18px; }

    .modal { width: 94%; padding: 16px; }
    .modal-title { font-size: 16px; }
    .modal-actions { margin-top: 16px; }

    #holdingTable th:nth-child(n+5), #holdingTable td:nth-child(n+5) { display: none; }

    #factorTable th:nth-child(n+5), #factorTable td:nth-child(n+5) { display: none; }

    .form-input, .form-select { font-size: 16px; padding: 10px 12px; }
}

@media (max-width: 420px) {
    .indicator-grid { grid-template-columns: repeat(2, 1fr); }
    .navbar-links a { padding: 4px 8px; font-size: 14px; }
    .factor-grid { grid-template-columns: 1fr 1fr; gap: 8px 10px; }
}

/* ════════════════════ 表格 ════════════════════ */

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

/* 收藏列表序号与名称间距缩小 2/3 */
#favTable td:first-child {
    padding-right: 4px;
    width: 28px;
}
#favTable td:nth-child(2) {
    padding-left: 4px;
}

tr:hover td { background: var(--bg-card-hover); }

/* ════════════════════ 数字颜色 ════════════════════ */

.up { color: var(--accent-buy); }
.down { color: var(--accent-sell); }
.neutral { color: var(--text-secondary); }
.gold { color: #d4a017; }
.mono { font-family: var(--font-mono); }

/* ════════════════════ 标签 ════════════════════ */

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.tag-buy { background: var(--accent-buy-bg); color: var(--accent-buy); }
.tag-sell { background: var(--accent-sell-bg); color: var(--accent-sell); }
.tag-hold { background: var(--accent-hold-bg); color: var(--accent-hold); }
.tag-bullish { background: var(--accent-buy-bg); color: var(--accent-buy); }
.tag-bearish { background: var(--accent-sell-bg); color: var(--accent-sell); }
.tag-neutral { background: rgba(212,160,23,0.1); color: #b8960f; }

/* ════════════════════ 按钮 ════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--btn-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover { background: var(--btn-hover); border-color: var(--border-hover); }
.btn-primary {
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(102,126,234,0.25);
}
.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(102,126,234,0.35);
    transform: translateY(-1px);
}
.btn-danger {
    background: rgba(255,71,87,0.08);
    color: var(--accent-buy);
    border-color: rgba(255,71,87,0.2);
}
.btn-success {
    background: rgba(46,213,115,0.08);
    color: var(--accent-sell);
    border-color: rgba(46,213,115,0.2);
}
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ════════════════════ 加载/空状态 ════════════════════ */

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ════════════════════ 表单 ════════════════════ */

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }

.form-select, .form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus, .form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9aae' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    cursor: pointer;
}

.form-select:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.form-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 8px;
}

.form-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ════════════════════ 指数行情卡片 — 横向滚动 ════════════════════ */

.index-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
    padding-bottom: 4px;
    margin-bottom: -4px;
}

.index-scroll::-webkit-scrollbar { height: 4px; }
.index-scroll::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.index-grid {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    min-width: min-content;
    padding: 2px 0;
}

.index-card {
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.index-card .index-name { font-size: 13px; color: var(--text-muted); }
.index-card .index-price { font-size: 18px; font-weight: 700; font-family: var(--font-mono); margin: 4px 0; color: var(--text-primary); }
.index-card .index-change { font-size: 14px; }

/* ════════════════════ 详情页 ════════════════════ */

.detail-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.detail-header-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.detail-name { font-size: 24px; font-weight: 700; }
.detail-code { font-size: 14px; color: var(--text-muted); margin-left: 8px; }

.signal-main-tag {
    display: inline-block;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
}

.signal-main-tag.tag-buy { background: var(--accent-buy-bg); color: var(--accent-buy); }
.signal-main-tag.tag-sell { background: var(--accent-sell-bg); color: var(--accent-sell); }
.signal-main-tag.tag-neutral { background: rgba(212,160,23,0.1); color: #b8960f; }

/* ════════════════════ 指标 ════════════════════ */

.indicator-btn-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(102,126,234,0.12);
    color: var(--accent-primary);
    font-size: 12px;
    line-height: 1;
    margin-top: 1px;
}

.indicator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.indicator-item {
    padding: 14px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-align: center;
}

.indicator-item .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.indicator-item .value { font-size: 19px; font-weight: 600; font-family: var(--font-mono); margin-top: 4px; }

/* ════════════════════ 指标弹窗 ════════════════════ */

.indicator-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.indicator-overlay.show { display: flex; }

.indicator-modal {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.indicator-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.indicator-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.indicator-close-btn:hover { color: var(--text-primary); background: var(--btn-bg); }

.indicator-modal-body {
    padding: 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* ════════════════════ 组合策略评分卡片 ════════════════════ */

.composite-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.composite-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--text-muted);
    transition: background 0.3s;
}

.composite-card.score-pos::before {
    background: var(--accent-buy);
    box-shadow: 0 0 16px rgba(255,71,87,0.2);
}

.composite-card.score-neg::before {
    background: var(--accent-sell);
    box-shadow: 0 0 16px rgba(46,213,115,0.2);
}

/* ════════════════════ 详情页头部行情 ════════════════════ */

.header-price-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.header-price {
    font-size: 32px;
    font-weight: 700;
    font-family: Arial, sans-serif;
    line-height: 1.1;
}

.header-price.up { color: var(--accent-buy); }
.header-price.down { color: var(--accent-sell); }

.header-change {
    font-size: 13px;
    display: flex;
    gap: 8px;
}

.change-pct { font-weight: 600; font-family: var(--font-mono); }
.change-amt { font-weight: 400; font-size: 13px; }
.change-pct.up, .change-amt.up { color: var(--accent-buy); }
.change-pct.down, .change-amt.down { color: var(--accent-sell); }

/* ════════════════════ 评分圆圈 + 成交量行 ════════════════════ */

.composite-market {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.market-volume-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-hover);
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
    flex-shrink: 0;
}

.market-volume-area:hover {
    background: #f0f0f4;
    border-color: var(--border-hover);
}

.market-volume-area:active {
    transform: scale(0.97);
}

.market-vol-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.market-vol-value {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* ════════════════════ 买入胜率框 ════════════════════ */

.win-rate-box {
    border-radius: 10px;
    border: 1.5px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    min-width: 60px;
    flex-shrink: 0;
    background: var(--bg-card-hover);
    transition: all 0.3s ease;
}

.win-rate-box.positive {
    border-color: var(--accent-buy);
    background: var(--accent-buy-bg);
    box-shadow: 0 0 20px rgba(255,71,87,0.1);
}

.win-rate-box.negative {
    border-color: var(--accent-sell);
    background: var(--accent-sell-bg);
    box-shadow: 0 0 20px rgba(46,213,115,0.1);
}

.win-rate-value {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    line-height: 1.1;
}

.win-rate-box.positive .win-rate-value { color: var(--accent-buy); }
.win-rate-box.negative .win-rate-value { color: var(--accent-sell); }

.win-rate-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin-top: 1px;
}

/* ════════════════════ 卖出胜率框 ════════════════════ */

.sell-win-rate-box {
    border-radius: 10px;
    border: 1.5px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    min-width: 60px;
    flex-shrink: 0;
    background: var(--bg-card-hover);
    transition: all 0.3s ease;
}

.sell-win-rate-box.positive {
    border-color: var(--accent-sell);
    background: var(--accent-sell-bg);
    box-shadow: 0 0 20px rgba(46,213,115,0.1);
}

.sell-win-rate-box.negative {
    border-color: var(--accent-buy);
    background: var(--accent-buy-bg);
    box-shadow: 0 0 20px rgba(255,71,87,0.1);
}

.sell-win-rate-value {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    line-height: 1.1;
}

.sell-win-rate-box.positive .sell-win-rate-value { color: var(--accent-sell); }
.sell-win-rate-box.negative .sell-win-rate-value { color: var(--accent-buy); }

.sell-win-rate-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin-top: 1px;
}

/* ════════════════════ 评分圆 ════════════════════ */

#compScoreCircle {
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

#compScoreCircle.score-pos {
    background: var(--accent-buy-bg);
    border-color: var(--accent-buy);
    box-shadow: 0 0 24px rgba(255,71,87,0.15);
}

#compScoreCircle.score-neg {
    background: var(--accent-sell-bg);
    border-color: var(--accent-sell);
    box-shadow: 0 0 24px rgba(46,213,115,0.15);
}

#compScore {
    font-size: 20px;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1.1;
}

#compSignal {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
}

/* ════════════════════ 组合策略头部 ════════════════════ */

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

.composite-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.composite-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.composite-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ════════════════════ 今年收益率方块 ════════════════════ */

#ytdCircle {
    border-radius: 10px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-card-hover);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    min-width: 60px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

#ytdCircle.positive {
    border-color: var(--accent-buy);
    background: var(--accent-buy-bg);
    box-shadow: 0 0 20px rgba(255,71,87,0.1);
}

#ytdCircle.negative {
    border-color: var(--accent-sell);
    background: var(--accent-sell-bg);
    box-shadow: 0 0 20px rgba(46,213,115,0.1);
}

.ytd-value {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    line-height: 1.1;
}

#ytdCircle.positive .ytd-value { color: var(--accent-buy); }
#ytdCircle.negative .ytd-value { color: var(--accent-sell); }

.ytd-label {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin-top: 1px;
}

/* ════════════════════ 置信度 ════════════════════ */

.composite-confidence {
    font-size: 12px;
    padding: 4px 14px;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.composite-confidence.high {
    background: rgba(46,213,115,0.12);
    color: #1db954;
}

.composite-confidence.medium {
    background: rgba(255,165,2,0.12);
    color: var(--accent-hold);
}

.composite-confidence.low {
    background: var(--bg-card-hover);
    color: var(--text-muted);
}

.composite-factors {
    margin-top: 2px;
}

/* ════════════════════ 两列因子网格 ════════════════════ */

.factor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.factor-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.factor-top {
    display: flex;
    align-items: baseline;
    gap: 0;
    min-width: 0;
}

.factor-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.factor-pct {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-right: auto;
    white-space: pre;
}

.factor-val {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-mono);
    min-width: 28px;
    text-align: right;
    flex-shrink: 0;
}

.factor-bar {
    height: 4px;
    width: 100%;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
}

.factor-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* ════════════════════ 因子提示 ════════════════════ */

.factor-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.35;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ════════════════════ 因子详情弹框 ════════════════════ */

#factorModalBody { display: block; }
.fd-current-section { margin-bottom: 16px; }
.fd-history-section { margin-top: 0; }
.fd-section-label { font-size: 13px; color: var(--text-primary); font-weight: 600; margin-bottom: 8px; }
.fd-current-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.fd-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card-hover);
}

.fd-value-row .fd-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.fd-value-row .fd-value { font-size: 15px; font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); }

.factor-detail-history {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.fd-table { width: 100%; border-collapse: collapse; }
.fd-table th {
    font-size: 11px;
    padding: 6px 12px;
    text-align: left;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
}
.fd-table td {
    font-size: 13px;
    padding: 5px 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
}
.fd-table tr:last-child td { border-bottom: none; }
.fd-table tbody tr:hover { background: var(--bg-card-hover); }

/* ════════════════════ 历史统计 ════════════════════ */

.composite-history {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.composite-history-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.history-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.stat-value.gold { color: #d4a017; }
.stat-value.up { color: var(--accent-sell); }
.stat-value.down { color: var(--accent-buy); }

/* ════════════════════ 信号切换 ════════════════════ */

.signal-toggle-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.signal-toggle-btn {
    padding: 5px 14px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
}

.signal-toggle-btn:first-child {
    border-right: 1px solid var(--border-subtle);
}

.signal-toggle-btn.active {
    background: rgba(102,126,234,0.08);
    color: var(--accent-primary);
    font-weight: 600;
}

.signal-toggle-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 6px;
    right: 6px;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 1px;
}

.signal-toggle-btn:hover:not(.active) {
    background: var(--btn-bg);
    color: var(--text-secondary);
}

/* ════════════════════ 信号时间轴 ════════════════════ */

.signal-timeline {
    position: relative;
    padding-left: 20px;
}

.signal-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--border-subtle);
    border-radius: 1px;
}

.signal-timeline-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    position: relative;
}

.signal-timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 1;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.signal-timeline-item.buy .timeline-dot { background: var(--accent-buy); border-color: rgba(255,71,87,0.25); box-shadow: 0 0 8px rgba(255,71,87,0.2); }
.signal-timeline-item.sell .timeline-dot { background: var(--accent-sell); border-color: rgba(46,213,115,0.25); box-shadow: 0 0 8px rgba(46,213,115,0.2); }

.timeline-date {
    font-size: 14px;
    color: var(--text-muted);
    min-width: 65px;
    font-weight: 500;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    line-height: 1.4;
}

.tl-date-year {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-block;
}

.tl-date-md {
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-tag {
    font-size: 15px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 4px;
    flex-shrink: 0;
}

.timeline-tag.buy { background: var(--accent-buy-bg); color: var(--accent-buy); }
.timeline-tag.sell { background: var(--accent-sell-bg); color: var(--accent-sell); }

.timeline-name {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.timeline-name.name-sm { font-size: 10px; }
.timeline-name.name-xs { font-size: 8px; }

/* 时间轴内容布局 */
.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.timeline-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.timeline-score {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

/* ════════════════════ 名称单元格 ════════════════════ */

.name-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    font-weight: 600;
    line-height: 1.3;
    font-size: 16px;
}

.name-cell.name-sm { font-size: 13px; }
.name-cell.name-xs { font-size: 11px; }

/* 组合信号名称评分等级 */
.timeline-name.score-strong-buy { color: var(--accent-buy); font-weight: 700; }
.timeline-name.score-buy { color: #d4a017; font-weight: 600; }
.timeline-name.score-hold { color: var(--accent-sell); }
.timeline-name.score-sell { color: var(--text-muted); }

/* ════════════════════ 卖出收益率 ════════════════════ */

.timeline-return {
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-mono);
    flex-shrink: 0;
    white-space: nowrap;
}

.timeline-return.up { color: var(--accent-buy); }
.timeline-return.down { color: var(--accent-sell); }

.timeline-exec {
    font-size: 11px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    flex-shrink: 0;
    margin-left: auto;
    white-space: nowrap;
}

/* ════════════════════ 信号统计栏 ════════════════════ */

.signal-summary-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 0 14px;
    margin-bottom: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.signal-summary-bar .count-buy { color: var(--accent-buy); font-weight: 600; }
.signal-summary-bar .count-sell { color: var(--accent-sell); font-weight: 600; }

.signal-summary-bar .sentiment-tag {
    margin-left: auto;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 4px;
}

.signal-summary-bar .sentiment-tag.bullish { background: var(--accent-buy-bg); color: var(--accent-buy); }
.signal-summary-bar .sentiment-tag.bearish { background: var(--accent-sell-bg); color: var(--accent-sell); }
.signal-summary-bar .sentiment-tag.neutral { background: rgba(212,160,23,0.1); color: #b8960f; }

/* ════════════════════ 旧信号列表（兼容） ════════════════════ */

.signal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.signal-item:last-child { border-bottom: none; }
.signal-date { font-size: 12px; color: var(--text-muted); min-width: 90px; }

/* ════════════════════ 回测指标 ════════════════════ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.metric-item {
    padding: 16px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-align: center;
}

.metric-item .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.metric-item .value { font-size: 23px; font-weight: 700; font-family: var(--font-mono); margin-top: 4px; }

/* ════════════════════ Tab 切换 ════════════════════ */

.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-subtle);
}

.tab {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
}

.tab.active { background: rgba(102,126,234,0.08); color: var(--accent-primary); }
.tab:hover:not(.active) { color: var(--text-primary); }

/* ════════════════════ 弹窗 ════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

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

.modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.modal-actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }

/* 确认弹框 */
.confirm-modal .modal { max-width: 380px; }
.confirm-msg { text-align: center; color: var(--text-secondary); font-size: 14px; line-height: 1.6; padding: 4px 0; }

/* ════════════════════ 权重滑块 ════════════════════ */

.weight-row {
    margin-bottom: 14px;
}

.weight-row:last-child { margin-bottom: 0; }

.weight-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-subtle);
    outline: none;
    cursor: pointer;
}

.weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: 2px solid rgba(102,126,234,0.3);
    cursor: pointer;
    transition: all 0.2s;
}

.weight-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.weight-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: 2px solid rgba(102,126,234,0.3);
    cursor: pointer;
}

/* 详情页权重滑块 */
.detail-weight-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--border-subtle); outline: none; cursor: pointer; }
.detail-weight-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-gradient); border: 2px solid rgba(102,126,234,0.3); cursor: pointer; transition: all 0.2s; }
.detail-weight-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.detail-weight-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent-gradient); border: 2px solid rgba(102,126,234,0.3); cursor: pointer; }

/* 权重弹框内容 */
#weightModal .indicator-modal-body { display: block; }

/* ════════════════════ 标签按钮（权重/算法/置信度） ════════════════════ */

.tag-btn {
    font-size: 11px;
    padding: 3px 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border: 1px solid var(--border-subtle);
    line-height: 1.5;
}

.weight-gear {
    background: rgba(102,126,234,0.08);
    color: var(--text-primary);
}

.weight-gear:hover {
    background: rgba(102,126,234,0.15);
    border-color: var(--border-hover);
}

.algo-btn {
    background: rgba(212,160,23,0.08);
    color: var(--text-primary);
}

.algo-btn:hover {
    background: rgba(212,160,23,0.15);
    border-color: var(--border-hover);
}

/* ════════════════════ 算法说明弹框 ════════════════════ */

.algo-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 70vh;
}

.algo-section { margin-bottom: 18px; }
.algo-section:last-child { margin-bottom: 0; }

.algo-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
}

.algo-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.algo-text strong { color: var(--text-primary); }

.algo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.algo-table th {
    text-align: left;
    padding: 5px 8px;
    background: var(--bg-card-hover);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
}

.algo-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.algo-table td:first-child { font-weight: 600; color: var(--text-primary); }

.algo-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.algo-tag.buy { background: var(--accent-buy-bg); color: var(--accent-buy); }
.algo-tag.sell { background: var(--accent-sell-bg); color: var(--accent-sell); }
.algo-tag.hold { background: var(--btn-bg); color: var(--text-muted); }

/* ════════════════════ 进度条 ════════════════════ */

.progress-bar {
    height: 6px;
    background: var(--border-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ════════════════════ 滚动条 ════════════════════ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ════════════════════ 响应式表格容器 ════════════════════ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ════════════════════ 收藏星星 ════════════════════ */

.fav-star {
    color: var(--text-muted);
    transition: all 0.2s;
    user-select: none;
    line-height: 1;
}

.fav-star:hover { color: #d4a017; transform: scale(1.2); }
.fav-star.starred { color: #d4a017; text-shadow: 0 0 8px rgba(212,160,23,0.3); }
.fav-star-sm { font-size: 14px; }

/* ════════════════════ ETF 选择 ════════════════════ */

.etf-option:hover { background: var(--bg-card-hover); }
.etf-option.selected { background: rgba(102,126,234,0.08); }
#etfList::-webkit-scrollbar { width: 4px; }
#etfList::-webkit-scrollbar-track { background: transparent; }
#etfList::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

/* 周期按钮紧凑 */
#periodBtns .tab { padding: 6px 10px; font-size: 12px; }

/* 优化结果 */
#optimizeResult .loading { padding: 10px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* ════════════════════ 加载更多 ════════════════════ */

.load-more-btn {
    display: block;
    margin: 20px auto;
    padding: 8px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--btn-bg);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.load-more-btn:hover:not(:disabled) {
    background: var(--btn-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.load-more-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ════════════════════ 详情页搜索 ════════════════════ */

.detail-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.15s;
    padding: 0;
    color: var(--text-muted);
}

.detail-search-btn:hover {
    color: var(--text-primary);
    background: var(--btn-bg);
}

.search-popup {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    white-space: nowrap;
}

.search-popup input {
    width: 225px;
    padding: 8px 12px;
    font-size: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.search-popup input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(102,126,234,0.12);
}

.search-popup input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.search-popup .btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    height: 36px;
}

@media (max-width: 768px) {
    .detail-search-btn { width: 30px; height: 30px; font-size: 15px; }
    .search-popup { padding: 10px 12px; gap: 8px; }
    .search-popup input { width: 162px; font-size: 16px; padding: 6px 10px; }
    .search-popup .btn-sm { padding: 6px 12px; font-size: 13px; height: 32px; }
}

/* ════════════════════ 骨架屏 ════════════════════ */

.skeleton-block {
    border-radius: 4px;
    background: linear-gradient(90deg, var(--border-subtle) 25%, #f0f1f5 50%, var(--border-subtle) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
