/* VATIS - 高级投资组合优化系统 - 深色主题 */
:root {
    /* 主色调 */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;

    /* 辅助色 */
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* 深色主题 */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-card-hover: #2d3748;

    /* 文字颜色 */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-muted: #64748b;

    /* 边框和分隔线 */
    --border-color: #374151;
    --border-light: #4b5563;
    --divider: #374151;

    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.2);

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* 过渡动画 */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* 字体 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

    /* 图表颜色 */
    --chart-1: #6366f1;
    --chart-2: #8b5cf6;
    --chart-3: #10b981;
    --chart-4: #f59e0b;
    --chart-5: #ef4444;
    --chart-6: #3b82f6;
    --chart-7: #ec4899;
    --chart-8: #14b8a6;
}

/* ===== 重置和基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 排版 ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary);
}

/* ===== 工具类 ===== */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }

.bg-primary { background-color: var(--bg-primary) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }
.bg-tertiary { background-color: var(--bg-tertiary) !important; }
.bg-card { background-color: var(--bg-card) !important; }

.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* ===== 布局容器 ===== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ===== 头部样式 ===== */
.header {
    padding: var(--spacing-xl) 0 var(--spacing-lg) 0;
    border-bottom: 1px solid var(--divider);
    margin-bottom: var(--spacing-xl);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.header-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--bg-tertiary);
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-title-text {
    display: flex;
    flex-direction: column;
}

.title-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.header-title-text h1 {
    font-size: 2.25rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-xs);
}

.version-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: rgba(199, 210, 254, 0.98);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    margin-bottom: var(--spacing-xs);
}

.header-subtitle {
    color: var(--text-tertiary);
    font-size: 1rem;
}

/* ===== 状态栏 ===== */
.status-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    background-color: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.status-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.status-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-value.status-success { color: var(--success); }
.status-value.status-warning { color: var(--warning); }
.status-value.status-error { color: var(--danger); }
.status-value.status-info { color: var(--info); }

.hidden {
    display: none !important;
}

.data-banner {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    font-weight: 500;
}

.data-banner.info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    color: rgba(191, 219, 254, 0.95);
}

.data-banner.simulated {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.35);
    color: rgba(253, 230, 138, 0.98);
}

/* ===== 控制栏 ===== */
.control-bar {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    outline: none;
}

.btn-sm {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.btn-icon {
    padding: var(--spacing-sm);
    border-radius: var(--radius-full);
}

/* ===== 仪表板网格 ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

/* ===== 卡片组件 ===== */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateY(-4px);
}

.card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header.column-header {
    align-items: flex-start;
    gap: var(--spacing-md);
}

.card-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 600;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: var(--spacing-lg);
}

/* ===== 图表容器 ===== */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

.chart-container-medium {
    height: 280px;
}


/* ===== 表格样式 ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.table thead {
    background-color: var(--bg-secondary);
}

.table th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.table tbody tr {
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== 页脚 ===== */
.footer {
    padding: var(--spacing-xl) 0;
    border-top: 1px solid var(--divider);
    margin-top: var(--spacing-2xl);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.footer-text {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    max-width: 600px;
    line-height: 1.6;
}

.footer-disclaimer {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    max-width: 600px;
}

/* ===== 加载状态 ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    color: var(--text-tertiary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .lab-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }

    .header-title-text h1 {
        font-size: 1.75rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .lab-grid,
    .metric-grid,
    .info-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .control-bar {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .chart-legend {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }

    .legend-item {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .status-bar {
        grid-template-columns: 1fr;
    }

    .header-title {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .legend-item {
        max-width: 100%;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .legend-item span:last-child {
        font-size: 0.8125rem;
    }
}

/* ===== 自定义滚动条 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== 信息网格样式 ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.info-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.info-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.info-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ===== 图表控制 ===== */
.chart-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* ===== Strategy lab / professional panels ===== */
.lab-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--spacing-md);
}

.lab-panel,
.metric-tile,
.summary-line,
.contribution-row {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.lab-panel {
    padding: var(--spacing-md);
}

.lab-panel-title,
.subsection-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.kv-stack,
.summary-stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.kv-line,
.summary-line {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding: 0.8rem 0.95rem;
    color: var(--text-secondary);
}

.kv-line strong,
.summary-line strong {
    color: var(--text-primary);
    text-align: right;
}

.pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.data-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(99, 102, 241, 0.28);
    background: rgba(99, 102, 241, 0.10);
    color: rgba(224, 231, 255, 0.95);
    font-size: 0.82rem;
    font-weight: 600;
}

.data-pill.clickable {
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.data-pill.clickable:hover {
    transform: translateY(-1px);
    border-color: rgba(129, 140, 248, 0.8);
    background: rgba(99, 102, 241, 0.16);
}

button.data-pill {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.data-pill.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.45);
    color: rgba(209, 250, 229, 0.98);
}

.data-pill.muted {
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.22);
    color: var(--text-tertiary);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.metric-tile {
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.metric-name {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-tile strong {
    font-size: 1.15rem;
    color: var(--text-primary);
}

.subsection-block {
    margin-top: var(--spacing-md);
}

.contribution-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.contribution-row {
    padding: var(--spacing-sm) var(--spacing-md);
}

.contribution-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.contribution-label strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.contribution-bar-track {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-full);
    background: rgba(148, 163, 184, 0.14);
    overflow: hidden;
}

.contribution-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.compact-table .table {
    min-width: 100%;
}

#comparison-metric-select {
    min-width: 160px;
}

.empty-state {
    color: var(--text-tertiary);
    padding: var(--spacing-md);
    background-color: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}

/* ===== 卡片副标题 ===== */
.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: var(--spacing-xs);
}

/* ===== 月份选择器 ===== */
.history-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.month-info {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-style: italic;
}

.month-info.warning {
    color: var(--warning);
}

.hero-shell {
    position: relative;
    overflow: hidden;
}

.hero-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.22), transparent 38%),
        radial-gradient(circle at top right, rgba(16, 185, 129, 0.14), transparent 34%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.96));
    pointer-events: none;
}

.hero-shell .card-body {
    position: relative;
    z-index: 1;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) repeat(4, minmax(0, 1fr));
    gap: var(--spacing-md);
    align-items: stretch;
}

.hero-highlight,
.hero-stat-card,
.preset-feature,
.spotlight-row,
.alert-pill {
    backdrop-filter: blur(10px);
}

.hero-highlight {
    min-height: 100%;
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(129, 140, 248, 0.24);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(49, 46, 129, 0.34));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
}

.hero-highlight h2 {
    margin-top: var(--spacing-sm);
    font-size: 1.9rem;
}

.hero-highlight p {
    margin: var(--spacing-sm) 0 var(--spacing-md);
    max-width: 52ch;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-full);
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: rgba(224, 231, 255, 0.95);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.hero-stat-card {
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92));
    border: 1px solid rgba(148, 163, 184, 0.14);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 164px;
}

.hero-stat-label {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.hero-stat-card strong {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-top: var(--spacing-sm);
}

.hero-stat-card small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.preset-feature {
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(129, 140, 248, 0.18);
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.88));
    box-shadow: var(--shadow-md);
}

.preset-feature.return {
    border-color: rgba(16, 185, 129, 0.25);
    background: linear-gradient(160deg, rgba(6, 95, 70, 0.18), rgba(15, 23, 42, 0.95));
}

.preset-feature.robust {
    border-color: rgba(59, 130, 246, 0.25);
    background: linear-gradient(160deg, rgba(30, 64, 175, 0.18), rgba(15, 23, 42, 0.95));
}

.preset-kicker {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preset-title {
    margin-top: var(--spacing-sm);
    font-size: 1.35rem;
    font-weight: 700;
}

.preset-stack,
.preset-source,
.preset-actions-note,
.research-note {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.preset-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
}

.preset-metric {
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.44);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.preset-metric span {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.preset-metric strong {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.05rem;
}

.preset-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    padding: 0.55rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.preset-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(129, 140, 248, 0.55);
    background: rgba(30, 41, 59, 0.88);
}

.research-note {
    margin-bottom: var(--spacing-md);
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.4);
}

.market-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.market-summary-card,
.insight-card {
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    box-shadow: var(--shadow-sm);
}

.market-summary-card span,
.insight-card-label {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}

.market-summary-card strong,
.insight-card strong {
    color: var(--text-primary);
    font-size: 1.15rem;
}

.market-watch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-md);
}

.market-panel {
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.market-panel-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.market-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.market-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.market-symbol {
    font-weight: 800;
    color: var(--text-primary);
}

.market-meta {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.market-primary {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    text-align: right;
}

.market-primary.positive {
    color: var(--success);
}

.market-primary.negative {
    color: var(--danger);
}

.insight-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--spacing-md);
}

.insight-card-symbol {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.insight-card-sub {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.table-tools {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.search-input {
    width: 100%;
    max-width: 260px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    border-color: rgba(129, 140, 248, 0.7);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

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

.metric-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-xs);
}

.metric-help-btn {
    position: relative;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.metric-help-btn:hover {
    color: var(--text-primary);
    border-color: rgba(129, 140, 248, 0.55);
}

.metric-help-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    width: min(260px, 70vw);
    padding: 0.7rem 0.8rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: var(--shadow-lg);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 20;
    white-space: normal;
    text-transform: none;
    letter-spacing: normal;
}

.metric-help-btn:hover::after,
.metric-help-btn:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

.metric-decoder-banner {
    margin-top: var(--spacing-sm);
    padding: 0.8rem 0.95rem;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(129, 140, 248, 0.28);
    background: rgba(15, 23, 42, 0.45);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

#weights-table tbody tr {
    cursor: pointer;
}

#weights-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.06);
}

#weights-table tbody tr.active-holding td {
    background: rgba(99, 102, 241, 0.12);
}

.spotlight-list,
.alert-stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.spotlight-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92));
    border: 1px solid rgba(148, 163, 184, 0.12);
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.spotlight-row:hover,
.spotlight-row.active-holding {
    transform: translateY(-1px);
    border-color: rgba(129, 140, 248, 0.45);
    background: linear-gradient(180deg, rgba(49, 46, 129, 0.22), rgba(15, 23, 42, 0.94));
}

.spotlight-symbol {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.spotlight-meta,
.spotlight-side {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.spotlight-side {
    text-align: right;
    font-family: var(--font-mono);
}

.alert-pill {
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
}

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

.alert-pill.warning {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(120, 53, 15, 0.22);
}

.alert-pill.info {
    border-color: rgba(59, 130, 246, 0.24);
    background: rgba(30, 64, 175, 0.18);
}

.alert-pill.success {
    border-color: rgba(16, 185, 129, 0.28);
    background: rgba(6, 95, 70, 0.18);
}

.holding-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(8px);
    z-index: 1200;
}

.holding-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(460px, 92vw);
    padding: var(--spacing-xl);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.985), rgba(30, 41, 59, 0.985));
    border-left: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: var(--shadow-xl);
    z-index: 1201;
    overflow-y: auto;
}

.holding-drawer.hidden,
.holding-drawer-overlay.hidden {
    display: none !important;
}

body.drawer-open {
    overflow: hidden;
}

.holding-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.holding-drawer-kicker {
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.76rem;
    font-weight: 700;
}

.holding-drawer-header h3 {
    margin-top: var(--spacing-xs);
    font-size: 1.75rem;
}

.holding-drawer-subtitle {
    margin-top: 0.35rem;
    margin-bottom: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.drawer-close-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.drawer-close-btn:hover {
    transform: scale(1.04);
    border-color: rgba(129, 140, 248, 0.45);
    background: rgba(30, 41, 59, 0.9);
}

.drawer-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.drawer-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.42rem 0.8rem;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: rgba(224, 231, 255, 0.98);
    font-size: 0.82rem;
    font-weight: 700;
}

.drawer-chip.muted {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.16);
    color: var(--text-secondary);
}

.drawer-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.drawer-metric {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-lg);
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.drawer-metric span {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.drawer-metric strong {
    display: block;
    margin-top: 0.32rem;
    font-size: 1.06rem;
    color: var(--text-primary);
}

.drawer-section {
    margin-top: var(--spacing-md);
}

.drawer-section-title {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.drawer-story {
    margin-bottom: 0;
    color: var(--text-secondary);
}

.drawer-signal-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.drawer-signal-item {
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.drawer-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: var(--spacing-lg);
}

.preset-stack-cell,
.preset-params-cell {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.preset-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.preset-inline-btn {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
}

.preset-inline-btn:hover {
    border-color: rgba(129, 140, 248, 0.55);
}

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

    .hero-highlight {
        grid-column: 1 / -1;
    }

    .research-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .market-watch-grid,
    .insight-card-grid,
    .market-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .hero-stat-card,
    .hero-highlight,
    .preset-feature {
        min-height: auto;
    }

    .history-selector,
    .table-tools {
        width: 100%;
    }

    .search-input {
        max-width: 100%;
    }

    .preset-actions-cell,
    .preset-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .holding-drawer {
        width: 100vw;
        padding: var(--spacing-lg);
    }

    .drawer-metric-grid,
    .research-grid,
    .market-watch-grid,
    .insight-card-grid,
    .market-summary-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .holding-drawer-header {
        align-items: center;
    }

    .metric-help-btn::after {
        width: min(220px, 72vw);
    }
}

/* ===== 实用类 ===== */
.neutral { color: var(--text-tertiary) !important; }

/* ===== Toast提示 ===== */
.toast {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    max-width: 400px;
}

.toast:before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-success:before {
    content: '\f058';
    color: var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-error:before {
    content: '\f057';
    color: var(--danger);
}

.toast-info {
    border-left: 4px solid var(--info);
}

.toast-info:before {
    content: '\f05a';
    color: var(--info);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-warning:before {
    content: '\f071';
    color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== 图表图例 ===== */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.legend-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
}

.legend-item span:last-child {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}