﻿
    :root {
      --bg-primary: #09090b;
      --bg-secondary: #18181b;
      --bg-tertiary: #27272a;
      --bg-card: #1c1917;
      --border-subtle: #3f3f46;
      --border-soft: #27272a;
      --text-primary: #fafafa;
      --text-secondary: #a1a1aa;
      --text-muted: #71717a;
      --accent-amber: #f59e0b;
      --accent-emerald: #10b981;
      --accent-rose: #f43f5e;
      --accent-violet: #8b5cf6;
      --accent-cyan: #06b6d4;
      --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
      --gradient-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
      --gradient-rose: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
      --gradient-violet: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
      --shadow-card: 0 4px 24px -4px rgba(0,0,0,0.4);
      --shadow-glow-amber: 0 0 32px rgba(245,158,11,0.15);
      --shadow-glow-emerald: 0 0 32px rgba(16,185,129,0.15);
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    /* ── 自定义滚动条样式 ── */
    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }
    ::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.02);
      border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
      transition: background 0.2s;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 255, 255, 0.2);
    }
    /* Firefox 滚动条 */
    * {
      scrollbar-width: thin;
      scrollbar-color: rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.02);
    }

    body {
      font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
      background: var(--bg-primary);
      color: var(--text-primary);
      min-height: 100vh;
      padding: 32px;
      background-image: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(245,158,11,0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(139,92,246,0.06) 0%, transparent 50%);
    }

    /* Header */
    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 32px;
      animation: slideDown 0.5s ease-out;
    }

    @keyframes slideDown {
      from { opacity: 0; transform: translateY(-20px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .header-left { display: flex; align-items: center; gap: 18px; }

    .logo {
      width: 52px; height: 52px;
      border-radius: 16px;
      background: var(--gradient-gold);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      box-shadow: var(--shadow-glow-amber);
    }

    .title-group { }

    .title { 
      font-size: 26px; 
      font-weight: 700; 
      background: linear-gradient(135deg, #fafafa 0%, #a1a1aa 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .subtitle { 
      font-size: 13px; 
      color: var(--text-muted); 
      margin-top: 4px;
      font-weight: 400;
      letter-spacing: 0.3px;
    }

    .header-right { display: flex; align-items: center; gap: 14px; }

    .btn {
      padding: 10px 18px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
      display: inline-flex;
      align-items: center;
      gap: 8px;
      border: none;
    }

    .btn-primary {
      background: var(--gradient-gold);
      color: #18181b;
      box-shadow: var(--shadow-glow-amber);
    }

    .btn-primary:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(245,158,11,0.25);
    }

    .btn-primary:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }

    .btn-secondary {
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      border: 1px solid var(--border-subtle);
    }

    .btn-secondary:hover {
      background: var(--bg-secondary);
      color: var(--text-primary);
      border-color: var(--text-muted);
    }

    .update-badge {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      background: var(--bg-secondary);
      border: 1px solid var(--border-soft);
      border-radius: 24px;
      font-size: 12px;
      color: var(--text-muted);
    }

    .pulse-dot {
      width: 6px; height: 6px;
      background: var(--accent-emerald);
      border-radius: 50%;
      animation: pulse 2s infinite;
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.5; transform: scale(0.9); }
    }

    /* Cards */
    .cards {
      display: flex !important;
      flex-wrap: wrap !important;
      gap: 20px;
      margin-bottom: 28px;
      width: 100% !important;
      box-sizing: border-box !important;
      overflow: visible !important;
      visibility: visible !important;
      opacity: 1 !important;
      z-index: 10 !important;
      align-items: stretch !important;
      min-height: 230px !important;
    }

    .card {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 20px;
      padding: 24px;
      position: relative;
      overflow: visible !important;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      opacity: 1 !important;
      visibility: visible !important;
      box-sizing: border-box !important;
      display: flex !important;
      flex-direction: column !important;
      justify-content: space-between;
      flex: 0 1 calc(25% - 15px) !important;
      min-height: 200px !important;
      height: auto !important;
      align-items: stretch !important;
    }

    .card:nth-child(1) { animation-delay: 0.05s; }
    .card:nth-child(2) { animation-delay: 0.1s; }
    .card:nth-child(3) { animation-delay: 0.15s; }
    .card:nth-child(4) { animation-delay: 0.2s; }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(16px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .card:hover {
      transform: translateY(-4px);
      border-color: var(--border-subtle);
      box-shadow: var(--shadow-card);
    }

    .card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 3px;
      border-radius: 20px 20px 0 0;
    }

    .card.total-cost::before { background: var(--gradient-violet); }
    .card.total-value::before { background: var(--gradient-cyan); }
    .card.total-profit::before { background: var(--c, var(--gradient-emerald)); }
    .card.today-profit::before { background: var(--c2, var(--gradient-gold)); }

    .card-glow {
      position: absolute;
      top: -50%;
      right: -50%;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      opacity: 0.03;
      pointer-events: none;
    }

    .card:hover .card-glow { opacity: 0.06; }

    .card-label { 
      font-size: 12px; 
      color: var(--text-muted); 
      margin-bottom: 12px; 
      text-transform: uppercase;
      letter-spacing: 1px;
      font-weight: 500;
    }

    .card-value { 
      font-size: 32px; 
      font-weight: 700; 
      color: var(--text-primary);
      line-height: 1.2;
      font-family: 'JetBrains Mono', monospace;
      margin: 8px 0;
      min-height: 40px;
      height: auto !important;
      display: flex !important;
      align-items: center;
    }

    .card-header {
      font-size: 13px;
      color: var(--text-secondary);
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 8px;
      min-height: 18px;
      height: auto !important;
      display: flex !important;
      align-items: center;
      line-height: 1.4;
    }

    .card-percent {
      font-size: 14px;
      color: var(--text-secondary);
      font-weight: 500;
      margin-top: auto;
      padding-top: 8px;
      min-height: 20px;
      height: auto !important;
      display: flex !important;
      align-items: center;
      line-height: 1.4;
    }

    .card-value.up { 
      color: var(--accent-rose); 
    }

    .card-value.down { 
      color: var(--accent-emerald); 
    }

    .card-sub { 
      font-size: 13px; 
      color: var(--text-secondary); 
      margin-top: 10px;
      font-weight: 400;
    }

    .card-sub.up { color: var(--accent-rose); }
    .card-sub.down { color: var(--accent-emerald); }

    .card-icon {
      position: absolute;
      right: 20px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 36px;
      opacity: 0.08;
    }

    /* Table */
    .table-wrap {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 20px;
      overflow: hidden;
      animation: fadeIn 0.5s ease-out 0.25s backwards;
    }

    .table-header-bar {
      display: flex;
      align-items: center;
      padding: 20px 24px;
      border-bottom: 1px solid var(--border-soft);
      gap: 12px;
    }

    .header-dot {
      width: 8px; height: 8px;
      border-radius: 50%;
    }

    .header-dot.rose { background: var(--accent-rose); }
    .header-dot.amber { background: var(--accent-amber); }
    .header-dot.emerald { background: var(--accent-emerald); }

    .table-title {
      font-size: 14px;
      color: var(--text-secondary);
      font-weight: 500;
      letter-spacing: 0.3px;
    }

    table { 
      width: 100%; 
      border-collapse: collapse; 
    }

    thead th {
      padding: 14px 20px;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      text-align: right;
      background: rgba(0,0,0,0.2);
      text-transform: uppercase;
      letter-spacing: 1px;
      cursor: pointer;
      user-select: none;
      transition: background 0.2s;
    }

    thead th:hover {
      background: rgba(245, 158, 11, 0.15);
    }

    thead th.sortable {
      cursor: pointer;
    }

    thead th.sortable:hover {
      background: rgba(245, 158, 11, 0.2);
    }

    thead th:first-child { text-align: left; }

    .sort-indicator {
      display: inline-block;
      margin-left: 6px;
      font-size: 10px;
      opacity: 0.5;
      transition: opacity 0.2s;
    }

    .sort-indicator.active {
      opacity: 1;
      color: var(--accent-amber);
    }

    .fund-row { 
      transition: background 0.2s; 
    }

    .fund-row:hover { 
      background: rgba(255,255,255,0.02); 
    }

    .fund-row td {
      padding: 18px 20px;
      font-size: 13px;
      text-align: right;
      border-bottom: 1px solid var(--border-soft);
    }

    .fund-row:last-child td { border-bottom: none; }
    .fund-row td:first-child { text-align: left; }

    .fund-name { 
      font-weight: 600; 
      color: var(--text-primary); 
      font-size: 14px;
    }

    .fund-code { 
      font-size: 11px; 
      color: var(--text-muted); 
      margin-top: 4px; 
      font-family: 'JetBrains Mono', monospace;
    }

    .num { 
      font-family: 'JetBrains Mono', monospace; 
      font-size: 13px; 
      color: var(--text-secondary);
    }

    .trend-cell { 
      display: flex; 
      align-items: center; 
      justify-content: flex-end; 
      gap: 6px; 
    }

    .trend-icon { font-size: 11px; }
    .trend-val { font-weight: 600; font-size: 15px; }

    .up .trend-val, td.up { color: var(--accent-rose); }
    .down .trend-val, td.down { color: var(--accent-emerald); }
    .up .trend-icon { color: var(--accent-rose); }
    .down .trend-icon { color: var(--accent-emerald); }

    .trend-bar-wrap {
      height: 3px;
      background: var(--bg-tertiary);
      border-radius: 2px;
      margin-top: 6px;
      width: 72px;
      margin-left: auto;
    }

    .trend-bar { 
      height: 100%; 
      border-radius: 2px; 
      transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); 
    }

    .profit-label { 
      font-size: 10px; 
      color: var(--text-muted); 
      margin-top: 3px;
      font-weight: 400;
    }

    .time-cell { 
      font-size: 11px; 
      color: var(--text-muted); 
      font-family: 'JetBrains Mono', monospace;
    }

    .footer { 
      margin-top: 24px; 
      text-align: center; 
      font-size: 12px; 
      color: var(--text-muted);
      letter-spacing: 0.3px;
    }

    .loading, .error, .empty { 
      text-align: center; 
      padding: 60px 20px; 
      color: var(--text-muted); 
      font-size: 14px;
    }

    @media (max-width: 1100px) {
      .cards { flex-wrap: wrap; }
    }

    @media (max-width: 768px) {
      body { padding: 16px; }
      .cards { flex-wrap: wrap; }
      .header { flex-direction: column; gap: 16px; align-items: flex-start; }
      .header-right { width: 100%; flex-wrap: wrap; }
      .btn { flex: 1; justify-content: center; }
      .update-badge { width: 100%; justify-content: center; }
      .card { padding: 20px; }
      .card-value { font-size: 28px; }

      /* 手机卡片模式 */
      .table-wrap { display: none; }
      .mobile-card-grid {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 12px;
      }
      
      .fund-card {
        background: var(--bg-card);
        border: 1px solid var(--border-soft);
        border-radius: 16px;
        padding: 16px;
        transition: all 0.2s;
      }
      
      .fund-card:active {
        transform: scale(0.98);
        border-color: var(--accent-amber);
      }
      
      .fund-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
      }
      
      .fund-card-title {
        font-weight: 600;
        color: var(--text-primary);
      }
      
      .fund-card-code {
        font-size: 11px;
        color: var(--text-muted);
      }
      
      .fund-card-badge {
        font-size: 11px;
        padding: 4px 8px;
        border-radius: 6px;
        background: rgba(255,255,255,0.05);
      }
      
      .fund-card-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 12px;
      }
      
      .fund-card-stat {
        background: rgba(255,255,255,0.02);
        padding: 10px;
        border-radius: 10px;
        text-align: center;
      }
      
      .fund-card-stat-label {
        font-size: 11px;
        color: var(--text-muted);
        margin-bottom: 4px;
      }
      
      .fund-card-stat-value {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-primary);
        font-family: 'JetBrains Mono', monospace;
      }
      
      .fund-card-stat-value.up {
        color: var(--accent-rose);
      }
      
      .fund-card-stat-value.down {
        color: var(--accent-emerald);
      }
      
      .fund-card-actions {
        display: flex;
        gap: 8px;
      }
      
      .fund-card-action-btn {
        flex: 1;
        padding: 10px;
        background: rgba(245,158,11,0.12);
        border: 1px solid rgba(245,158,11,0.3);
        border-radius: 8px;
        color: var(--accent-amber);
        font-size: 12px;
        cursor: pointer;
        transition: all 0.2s;
      }
      
      .fund-card-action-btn:active {
        background: rgba(245,158,11,0.2);
      }
    }

    @media (max-width: 640px) {
      body { padding: 12px; }
      .header-left { gap: 12px; }
      .logo { width: 40px; height: 40px; font-size: 20px; }
      .title { font-size: 20px; }
      .subtitle { font-size: 12px; }
      .card { padding: 16px; }
      .card-value { font-size: 24px; }
      .card-label { font-size: 11px; }
      .card-sub { font-size: 12px; }

      /* 表格横向滚动优化 */
      .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        border-radius: 12px;
        position: relative;
        scroll-behavior: smooth;
      }
      .table-wrap::after {
        content: '';
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        color: var(--accent-amber);
        pointer-events: none;
        opacity: 0.6;
        z-index: 5;
        font-weight: 500;
      }
      table { 
        min-width: 1100px;
        display: table;
        border-collapse: separate;
        border-spacing: 0;
      }
      
      /* 固定第一列 - 基金名称 */
      thead th:first-child,
      .fund-row td:first-child {
        position: sticky;
        left: 0;
        z-index: 10;
        background: var(--bg-card);
      }
      
      thead th:first-child {
        background: rgba(0,0,0,0.3);
        z-index: 11;
      }
      
      thead th { 
        padding: 12px 14px; 
        font-size: 9px; 
        white-space: nowrap;
      }
      .fund-row td { 
        padding: 12px 14px; 
        font-size: 11px; 
      }
      .fund-row td:first-child {
        min-width: 100px;
        max-width: 120px;
      }
      .fund-name { font-size: 12px; }
      .fund-code { font-size: 9px; }
      .num { font-size: 11px; }
      .trend-val { font-size: 12px; }
      .table-header-bar { padding: 12px 14px; font-size: 12px; }
      
      /* 超小屏隐藏涨跌列和今日收益列 */
      thead th:nth-child(3),
      thead th:nth-child(4),
      .fund-row td:nth-child(3),
      .fund-row td:nth-child(4) {
        display: none;
      }
    }

    /* ── 收益贡献度分析面板 ── */
    .contribution-panel {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 20px;
      padding: 24px;
      margin-bottom: 28px;
      animation: fadeIn 0.5s ease-out 0.3s backwards;
    }

    .contribution-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border-soft);
    }

    .contribution-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .contribution-tabs {
      display: flex;
      gap: 8px;
    }

    .contribution-tab {
      padding: 8px 16px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid transparent;
      color: var(--text-secondary);
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      transition: all 0.2s;
    }

    .contribution-tab:hover {
      background: rgba(245, 158, 11, 0.1);
      color: var(--accent-amber);
    }

    .contribution-tab.active {
      background: rgba(245, 158, 11, 0.15);
      color: var(--accent-amber);
      border-color: var(--accent-amber);
    }

    .contribution-content {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 32px;
      align-items: center;
    }

    .contribution-chart-wrap {
      position: relative;
      height: 280px;
    }

    .contribution-legend {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .contribution-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      background: rgba(255, 255, 255, 0.02);
      border-radius: 8px;
      transition: all 0.2s;
    }

    .contribution-item:hover {
      background: rgba(245, 158, 11, 0.08);
      transform: translateX(4px);
    }

    .contribution-dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .contribution-info {
      flex: 1;
      min-width: 0;
    }

    .contribution-name {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .contribution-code {
      font-size: 11px;
      color: var(--text-muted);
      font-family: 'JetBrains Mono', monospace;
    }

    .contribution-stats {
      display: flex;
      gap: 12px;
      align-items: center;
    }

    .contribution-amount {
      text-align: right;
      font-family: 'JetBrains Mono', monospace;
    }

    .contribution-amount-value {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-primary);
    }

    .contribution-amount-percent {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .contribution-bar {
      width: 60px;
      height: 4px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 2px;
      overflow: hidden;
    }

    .contribution-bar-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @media (max-width: 768px) {
      .contribution-content {
        grid-template-columns: 1fr;
        gap: 20px;
      }

      .contribution-chart-wrap {
        height: 240px;
      }

      .contribution-panel {
        padding: 16px;
      }

      .contribution-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
      }

      .contribution-tabs {
        width: 100%;
      }

      .contribution-tab {
        flex: 1;
        justify-content: center;
        text-align: center;
      }
    }

    @media (max-width: 360px) {
      body { padding: 8px; }
      .card { padding: 12px; }
      .card-value { font-size: 20px; }
      table { min-width: 1000px; }
      .table-wrap::after {
        font-size: 11px;
        right: 8px;
      }
    }

    /* 购买记录展开 */
    .purchase-history {
      display: none;
      background: rgba(139,92,246,0.05);
      padding: 12px 20px;
      font-size: 12px;
      border-top: 1px solid var(--border-soft);
    }

    .purchase-history.show {
      display: block;
    }

    .history-title {
      font-size: 11px;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      font-weight: 600;
      margin-bottom: 8px;
    }

    .history-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .history-item {
      display: grid;
      grid-template-columns: auto 1fr 1fr 1fr;
      gap: 12px;
      align-items: center;
      padding: 6px 8px;
      background: rgba(255,255,255,0.02);
      border-radius: 6px;
      color: var(--text-secondary);
    }

    .history-date {
      font-family: 'JetBrains Mono', monospace;
      color: var(--text-muted);
      min-width: 90px;
    }

    .history-stat {
      text-align: right;
      font-family: 'JetBrains Mono', monospace;
    }

    .expand-btn {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: none;
      border: none;
      color: var(--accent-violet);
      cursor: pointer;
      font-size: 12px;
      padding: 0;
      transition: all 0.2s;
    }

    .expand-btn:hover {
      color: var(--accent-cyan);
    }

    .expand-btn.expanded::before {
      content: '▼';
      display: inline-block;
    }

    .expand-btn:not(.expanded)::before {
      content: '▶';
      display: inline-block;
    }

    /* 基金详情弹窗 */
    .fund-detail-modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.7);
      z-index: 2000;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(6px);
      padding: 20px;
      overflow-y: auto;
    }

    .fund-detail-modal.show {
      display: flex;
    }

    /* 通用 Modal 样式 */
    .modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.7);
      z-index: 2000;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(6px);
      padding: 20px;
      overflow-y: auto;
    }
    .modal.show {
      display: flex;
    }

    .modal-content {
      position: relative;  /* 为关闭按钮定位提供参考 */
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 24px;
      padding: 32px;
      width: 100%;
      max-width: 900px;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 24px 64px rgba(0,0,0,0.6);
      animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes slideUp {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 28px;
      border-bottom: 1px solid var(--border-soft);
      padding-bottom: 16px;
      position: relative;
    }

    .modal-title-group {
      flex: 1;
      padding-right: 50px;  /* 为关闭按钮留空间 */
    }

    .modal-title {
      font-size: 24px;
      font-weight: 700;
      color: var(--text-primary);
      margin-bottom: 4px;
    }

    .modal-subtitle {
      font-size: 13px;
      color: var(--text-muted);
    }

    .modal-close-btn {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      font-size: 18px;
      cursor: pointer;
      color: var(--text-muted);
      transition: all 0.2s;
      padding: 6px 10px;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
      flex-shrink: 0;
    }

    .modal-close-btn:hover {
      color: var(--text-primary);
      background: rgba(244, 63, 94, 0.15);
      border-color: rgba(244, 63, 94, 0.3);
      transform: scale(1.05);
    }

    /* 通用关闭按钮样式（用于简单弹窗） */
    .modal-close {
      position: absolute;
      top: 16px;
      right: 16px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      font-size: 20px;
      cursor: pointer;
      color: var(--text-muted);
      transition: all 0.2s;
      padding: 6px 12px;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
      z-index: 10;
    }

    .modal-close:hover {
      color: var(--text-primary);
      background: rgba(244, 63, 94, 0.15);
      border-color: rgba(244, 63, 94, 0.3);
      transform: scale(1.05);
    }

    .modal-sections {
      display: grid;
      grid-template-columns: 1fr;
      gap: 28px;
    }

    .modal-section {
      padding: 20px;
      background: rgba(255,255,255,0.02);
      border: 1px solid var(--border-soft);
      border-radius: 16px;
      transition: all 0.2s ease;
      position: relative;
    }

    /* 可拖拽状态 */
    .modal-section.dragging {
      opacity: 0.7;
      transform: scale(0.98);
      border-color: var(--accent-amber);
      background: rgba(245,158,11,0.05);
    }

    .modal-section.drag-over {
      border-color: var(--accent-amber);
      background: rgba(245,158,11,0.1);
    }

    /* 拖拽把手 */
    .section-drag-handle {
      position: absolute;
      left: 0;
      top: 0;
      width: 4px;
      height: 100%;
      background: var(--accent-amber);
      border-radius: 16px 0 0 16px;
      opacity: 0;
      cursor: grab;
      transition: opacity 0.2s;
    }

    .modal-section:hover .section-drag-handle {
      opacity: 1;
    }

    .modal-section.dragging .section-drag-handle {
      opacity: 1;
    }

    /* 折叠/展开按钮 */
    .section-toggle-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 6px;
      border: 1px solid var(--border-soft);
      background: rgba(255,255,255,0.02);
      color: var(--text-secondary);
      cursor: pointer;
      transition: all 0.2s;
      margin-left: auto;
      flex-shrink: 0;
    }

    .section-toggle-btn:hover {
      background: rgba(255,255,255,0.05);
      border-color: var(--accent-amber);
      color: var(--accent-amber);
    }

    .section-toggle-btn.collapsed::before {
      content: '▼';
      display: inline-block;
      font-size: 12px;
      transition: transform 0.2s;
    }

    .section-toggle-btn:not(.collapsed)::before {
      content: '▲';
      display: inline-block;
      font-size: 12px;
    }

    /* 折叠内容 */
    .section-content {
      max-height: 1000px;
      opacity: 1;
      transition: all 0.3s ease;
      overflow: hidden;
    }

    .section-content.collapsed {
      max-height: 0;
      opacity: 0;
      padding: 0;
      margin: 0;
    }

    .section-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-secondary);
      margin-bottom: 16px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    /* 时间周期选择器 */
    .period-selector {
      display: flex;
      gap: 12px;
      margin-bottom: 16px;
      flex-wrap: wrap;
    }

    .period-radio {
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
    }

    .period-radio input[type="radio"] {
      cursor: pointer;
      accent-color: var(--accent-amber);
    }

    .period-radio label {
      cursor: pointer;
      font-size: 13px;
      color: var(--text-secondary);
      transition: color 0.2s;
    }

    .period-radio input[type="radio"]:checked + label {
      color: var(--accent-amber);
      font-weight: 600;
    }

    .chart-container {
      position: relative;
      height: 300px;
      margin-bottom: 16px;
    }

    .fund-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
      margin-bottom: 20px;
    }

    .stat-item {
      padding: 12px;
      background: rgba(0,0,0,0.2);
      border-radius: 8px;
      text-align: center;
    }

    .stat-label {
      font-size: 11px;
      color: var(--text-muted);
      margin-bottom: 4px;
      text-transform: uppercase;
    }

    .stat-value {
      font-size: 18px;
      font-weight: 700;
      color: var(--text-primary);
      font-family: 'JetBrains Mono', monospace;
    }

    .stat-value.up {
      color: var(--accent-rose);
    }

    .stat-value.down {
      color: var(--accent-emerald);
    }

    .purchase-records-list {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .purchase-record-item {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr 1fr;
      gap: 12px;
      padding: 12px;
      background: rgba(0,0,0,0.3);
      border-radius: 8px;
      align-items: center;
      border-left: 3px solid var(--accent-violet);
    }

    .record-field {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .record-label {
      font-size: 10px;
      color: var(--text-muted);
      text-transform: uppercase;
      font-weight: 600;
    }

    .record-value {
      font-size: 13px;
      color: var(--text-secondary);
      font-family: 'JetBrains Mono', monospace;
      font-weight: 500;
    }

    .no-records {
      text-align: center;
      padding: 24px 12px;
      color: var(--text-muted);
      font-size: 13px;
    }

    @media (max-width: 768px) {
      .modal-content {
        padding: 20px;
        border-radius: 16px;
      }

      .modal-title {
        font-size: 20px;
      }

      .fund-stats {
        grid-template-columns: repeat(2, 1fr);
      }

      .purchase-record-item {
        grid-template-columns: 1fr;
        gap: 8px;
      }

      .chart-container {
        height: 250px;
      }

      .period-selector {
        gap: 8px;
      }

      .period-radio label {
        font-size: 12px;
      }
    }

    @media (max-width: 640px) {
      .modal-content {
        padding: 16px;
        max-height: 100vh;
      }

      .modal-header {
        margin-bottom: 20px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
      }

      .modal-close-btn {
        align-self: flex-end;
        margin-top: -8px;
      }

      .chart-container {
        height: 220px;
      }

      .modal-sections {
        gap: 16px;
      }

      .modal-section {
        padding: 16px;
      }
    }

    /* ── 收益贡献度分析面板 ── */
    .contribution-panel {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 20px;
      padding: 24px;
      margin-bottom: 28px;
      animation: fadeIn 0.5s ease-out 0.3s backwards;
    }

    .contribution-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border-soft);
    }

    .contribution-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .contribution-tabs {
      display: flex;
      gap: 8px;
    }

    .contribution-tab {
      padding: 8px 16px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid transparent;
      color: var(--text-secondary);
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      transition: all 0.2s;
    }

    .contribution-tab:hover {
      background: rgba(245, 158, 11, 0.1);
      color: var(--accent-amber);
    }

    .contribution-tab.active {
      background: rgba(245, 158, 11, 0.15);
      color: var(--accent-amber);
      border-color: var(--accent-amber);
    }

    .contribution-content {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 32px;
      align-items: center;
    }

    .contribution-chart-wrap {
      position: relative;
      height: 280px;
    }

    .contribution-legend {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .contribution-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      background: rgba(255, 255, 255, 0.02);
      border-radius: 8px;
      transition: all 0.2s;
    }

    .contribution-item:hover {
      background: rgba(245, 158, 11, 0.08);
      transform: translateX(4px);
    }

    .contribution-dot {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .contribution-info {
      flex: 1;
      min-width: 0;
    }

    .contribution-name {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .contribution-code {
      font-size: 11px;
      color: var(--text-muted);
      font-family: 'JetBrains Mono', monospace;
    }

    .contribution-stats {
      display: flex;
      gap: 12px;
      align-items: center;
    }

    .contribution-amount {
      text-align: right;
      font-family: 'JetBrains Mono', monospace;
    }

    .contribution-amount-value {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-primary);
    }

    .contribution-amount-percent {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .contribution-bar {
      width: 60px;
      height: 4px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 2px;
      overflow: hidden;
    }

    .contribution-bar-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @media (max-width: 768px) {
      .contribution-content {
        grid-template-columns: 1fr;
        gap: 20px;
      }

      .contribution-chart-wrap {
        height: 240px;
      }

      .contribution-panel {
        padding: 16px;
      }

      .contribution-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
      }

      .contribution-tabs {
        width: 100%;
      }

      .contribution-tab {
        flex: 1;
        justify-content: center;
        text-align: center;
      }
    }

    /* ── 基金基本信息面板 ── */
    .fund-info-panel {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 20px;
      padding: 24px;
      margin-bottom: 28px;
      animation: fadeIn 0.5s ease-out 0.4s backwards;
    }

    .fund-info-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 24px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--border-soft);
    }

    .fund-info-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-primary);
    }

    .fund-info-content {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 24px;
    }

    .fund-info-section {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .fund-info-section-title {
      font-size: 12px;
      font-weight: 600;
      text-transform: uppercase;
      color: var(--text-muted);
      letter-spacing: 0.5px;
      padding-bottom: 8px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .fund-info-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 16px;
    }

    .fund-info-label {
      font-size: 13px;
      color: var(--text-secondary);
      font-weight: 500;
    }

    .fund-info-value {
      font-size: 14px;
      color: var(--text-primary);
      font-weight: 600;
      text-align: right;
      flex: 1;
      font-family: 'JetBrains Mono', monospace;
    }

    .fund-info-badge {
      display: inline-block;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
    }

    .fund-info-badge.low-risk {
      background: rgba(16, 185, 129, 0.15);
      color: var(--accent-emerald);
      border: 1px solid var(--accent-emerald);
    }

    .fund-info-badge.medium-risk {
      background: rgba(245, 158, 11, 0.15);
      color: var(--accent-amber);
      border: 1px solid var(--accent-amber);
    }

    .fund-info-badge.high-risk {
      background: rgba(244, 63, 94, 0.15);
      color: var(--accent-rose);
      border: 1px solid var(--accent-rose);
    }

    .fund-info-size {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .fund-info-badge-group {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    @media (max-width: 1024px) {
      .fund-info-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
      }
    }

    @media (max-width: 768px) {
      .fund-info-content {
        grid-template-columns: 1fr;
        gap: 16px;
      }

      .fund-info-panel {
        padding: 16px;
      }

      .fund-info-section {
        gap: 12px;
      }

      .fund-info-item {
        flex-direction: column;
        align-items: flex-start;
      }

      .fund-info-value {
        text-align: left;
      }
    }

    /* ── 快速操作按钮 ── */
    .action-cell {
      white-space: nowrap;
      text-align: center;
    }

    .action-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      background: rgba(255,255,255,0.04);
      border: 1px solid var(--border-soft);
      border-radius: 7px;
      cursor: pointer;
      font-size: 13px;
      color: var(--text-muted);
      transition: all 0.18s ease;
      margin: 0 2px;
    }

    .action-btn:hover {
      background: rgba(139,92,246,0.15);
      border-color: var(--accent-violet);
      color: var(--accent-violet);
      transform: translateY(-1px);
    }

    .action-btn.compare-active {
      background: rgba(245,158,11,0.15);
      border-color: var(--accent-amber);
      color: var(--accent-amber);
    }

    /* ── 对比面板顶部浮动栏 ── */
    .compare-bar {
      display: none;
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--bg-card);
      border: 1px solid var(--accent-amber);
      border-radius: 16px;
      padding: 12px 20px;
      box-shadow: 0 8px 32px rgba(245,158,11,0.2);
      z-index: 500;
      align-items: center;
      gap: 12px;
      animation: slideUp 0.3s ease;
    }

    .compare-bar.show {
      display: flex;
    }

    .compare-bar-text {
      font-size: 13px;
      color: var(--text-secondary);
    }

    .compare-bar-tags {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .compare-tag {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(245,158,11,0.1);
      border: 1px solid var(--accent-amber);
      border-radius: 8px;
      padding: 3px 10px;
      font-size: 12px;
      color: var(--accent-amber);
    }

    .compare-tag-remove {
      cursor: pointer;
      opacity: 0.7;
      font-size: 10px;
    }

    .compare-tag-remove:hover {
      opacity: 1;
    }

    .compare-bar-btn {
      padding: 7px 18px;
      border-radius: 10px;
      border: none;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      transition: opacity 0.2s;
    }

    .compare-bar-btn.primary {
      background: var(--gradient-gold);
      color: #18181b;
    }

    .compare-bar-btn.secondary {
      background: rgba(255,255,255,0.06);
      color: var(--text-secondary);
      border: 1px solid var(--border-soft);
    }

    .compare-bar-btn:hover { opacity: 0.85; }

    /* ── 对比弹窗 ── */
    .compare-modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.75);
      z-index: 3000;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(8px);
      padding: 20px;
      overflow-y: auto;
    }

    .compare-modal.show { display: flex; }

    .compare-modal-content {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 24px;
      padding: 32px;
      width: 100%;
      max-width: 1100px;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 24px 64px rgba(0,0,0,0.6);
      animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
    }

    .compare-modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 28px;
      border-bottom: 1px solid var(--border-soft);
      padding-bottom: 16px;
      position: relative;
    }

    .compare-modal-title {
      font-size: 20px;
      font-weight: 700;
      color: var(--text-primary);
    }

    .compare-grid {
      display: grid;
      gap: 20px;
    }

    .compare-cards-row {
      display: grid;
      gap: 16px;
    }

    .compare-fund-card {
      background: rgba(255,255,255,0.02);
      border: 1px solid var(--border-soft);
      border-radius: 16px;
      padding: 20px;
      transition: border-color 0.2s;
    }

    .compare-fund-card:hover {
      border-color: var(--accent-violet);
    }

    .compare-fund-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }

    .compare-fund-name {
      font-size: 15px;
      font-weight: 600;
      color: var(--text-primary);
    }

    .compare-fund-code {
      font-size: 12px;
      color: var(--text-muted);
      font-family: 'JetBrains Mono', monospace;
      margin-top: 2px;
    }

    .compare-metrics {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
    }

    .compare-metric {
      background: rgba(255,255,255,0.03);
      border-radius: 10px;
      padding: 12px;
      text-align: center;
    }

    .compare-metric-label {
      font-size: 11px;
      color: var(--text-muted);
      margin-bottom: 4px;
    }

    .compare-metric-value {
      font-size: 16px;
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
    }

    .compare-chart-section {
      margin-top: 24px;
    }

    .compare-chart-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-secondary);
      margin-bottom: 12px;
    }

    .compare-chart-wrap {
      height: 280px;
      position: relative;
    }

    .compare-table-section {
      margin-top: 24px;
      overflow-x: auto;
    }

    .compare-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }

    .compare-table th {
      padding: 10px 14px;
      text-align: left;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      border-bottom: 1px solid var(--border-soft);
      background: rgba(255,255,255,0.02);
    }

    .compare-table td {
      padding: 12px 14px;
      border-bottom: 1px solid rgba(255,255,255,0.04);
      color: var(--text-secondary);
    }

    .compare-table tr:last-child td { border-bottom: none; }

    .compare-table td.highlight-col {
      background: rgba(245,158,11,0.04);
    }

    .compare-table .fund-col-header {
      color: var(--accent-amber);
      font-weight: 600;
      font-size: 12px;
    }

    /* ── 止盈策略样式 ── */
    .stop-profit-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: 12px;
      font-size: 11px;
      font-weight: 600;
      background: rgba(245,158,11,0.08);
      border: 1px solid rgba(245,158,11,0.3);
      color: var(--accent-amber);
    }

    .stop-profit-badge.warning {
      background: rgba(244,63,94,0.1);
      border-color: rgba(244,63,94,0.3);
      color: var(--accent-rose);
    }

    .stop-profit-badge.success {
      background: rgba(16,185,129,0.1);
      border-color: rgba(16,185,129,0.3);
      color: var(--accent-emerald);
    }

    .strategy-settings-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 8px 16px;
      background: rgba(139,92,246,0.1);
      border: 1px solid var(--accent-violet);
      border-radius: 10px;
      color: var(--accent-violet);
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }

    .strategy-settings-btn:hover {
      background: rgba(139,92,246,0.2);
      transform: translateY(-1px);
    }

    /* ── 止盈策略配置弹窗 ── */
    .strategy-modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.75);
      z-index: 3000;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(8px);
      padding: 20px;
      overflow-y: auto;
    }

    .strategy-modal.show { display: flex; }

    .strategy-modal-content {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 24px;
      padding: 32px;
      width: 100%;
      max-width: 800px;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 24px 64px rgba(0,0,0,0.6);
    }

    .strategy-modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 28px;
      border-bottom: 1px solid var(--border-soft);
      padding-bottom: 16px;
      position: relative;
    }

    .strategy-modal-title {
      font-size: 20px;
      font-weight: 700;
      color: var(--text-primary);
    }

    .strategy-list {
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .strategy-card {
      background: rgba(255,255,255,0.02);
      border: 1px solid var(--border-soft);
      border-radius: 16px;
      padding: 20px;
      transition: all 0.2s;
    }

    .strategy-card:hover {
      border-color: var(--accent-violet);
    }

    .strategy-card.enabled {
      border-color: var(--accent-amber);
      background: rgba(245,158,11,0.04);
    }

    .strategy-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }

    .strategy-name {
      font-size: 16px;
      font-weight: 600;
      color: var(--text-primary);
    }

    .strategy-desc {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    .strategy-toggle {
      position: relative;
      width: 48px;
      height: 24px;
      background: rgba(255,255,255,0.1);
      border-radius: 12px;
      cursor: pointer;
      transition: background 0.2s;
    }

    .strategy-toggle.active {
      background: var(--accent-amber);
    }

    .strategy-toggle::after {
      content: '';
      position: absolute;
      width: 20px;
      height: 20px;
      background: white;
      border-radius: 50%;
      top: 2px;
      left: 2px;
      transition: transform 0.2s;
    }

    .strategy-toggle.active::after {
      transform: translateX(24px);
    }

    .strategy-params {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
      margin-top: 16px;
      padding-top: 16px;
      border-top: 1px solid rgba(255,255,255,0.06);
    }

    .strategy-param {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .strategy-param-label {
      font-size: 11px;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .strategy-param-value {
      font-size: 18px;
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
      color: var(--text-primary);
    }

    .strategy-param-value.target {
      color: var(--accent-amber);
    }

    .strategy-param-value.stoploss {
      color: var(--accent-emerald);
    }

    /* 可视化配置滑块 */
    .strategy-slider-wrap {
      margin-top: 16px;
      padding: 16px;
      background: rgba(255,255,255,0.02);
      border-radius: 12px;
      border: 1px solid var(--border-soft);
    }

    .strategy-slider-item {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 16px;
    }

    .strategy-slider-item:last-child {
      margin-bottom: 0;
    }

    .strategy-slider-label {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12px;
      color: var(--text-secondary);
    }

    .strategy-slider-value {
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
      color: var(--accent-amber);
    }

    .strategy-slider {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 6px;
      background: rgba(255,255,255,0.1);
      border-radius: 3px;
      outline: none;
    }

    .strategy-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 18px;
      height: 18px;
      background: var(--accent-amber);
      border-radius: 50%;
      cursor: pointer;
      transition: all 0.2s;
    }

    .strategy-slider::-webkit-slider-thumb:hover {
      transform: scale(1.1);
      box-shadow: 0 0 0 6px rgba(245,158,11,0.2);
    }

    .strategy-slider::-moz-range-thumb {
      width: 18px;
      height: 18px;
      background: var(--accent-amber);
      border-radius: 50%;
      cursor: pointer;
      border: none;
    }

    .strategy-slider.stoploss-slider::-webkit-slider-thumb {
      background: var(--accent-emerald);
    }

    .strategy-slider.stoploss-slider::-moz-range-thumb {
      background: var(--accent-emerald);
    }

    /* 多条件选择器 */
    .strategy-conditions {
      margin-top: 16px;
      padding: 16px;
      background: rgba(255,255,255,0.02);
      border-radius: 12px;
      border: 1px solid var(--border-soft);
    }

    .strategy-condition-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      background: rgba(255,255,255,0.02);
      border-radius: 10px;
      margin-bottom: 10px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .strategy-condition-item:last-child {
      margin-bottom: 0;
    }

    .strategy-condition-item:hover {
      background: rgba(139,92,246,0.06);
    }

    .strategy-condition-item.selected {
      background: rgba(139,92,246,0.12);
      border: 1px solid var(--accent-violet);
    }

    .strategy-condition-checkbox {
      width: 20px;
      height: 20px;
      border: 2px solid var(--border-soft);
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      color: var(--accent-violet);
      transition: all 0.2s;
    }

    .strategy-condition-item.selected .strategy-condition-checkbox {
      background: var(--accent-violet);
      border-color: var(--accent-violet);
    }

    .strategy-condition-text {
      flex: 1;
      font-size: 13px;
      color: var(--text-secondary);
    }

    .strategy-condition-item.selected .strategy-condition-text {
      color: var(--text-primary);
      font-weight: 600;
    }

    /* 历史回测面板 */
    .backtest-panel {
      margin-top: 24px;
      padding: 20px;
      background: rgba(255,255,255,0.02);
      border: 1px solid var(--border-soft);
      border-radius: 16px;
    }

    .backtest-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }

    .backtest-title {
      font-size: 15px;
      font-weight: 700;
      color: var(--text-primary);
    }

    .backtest-btn {
      padding: 8px 16px;
      background: linear-gradient(135deg, #06b6d4, #0891b2);
      border: none;
      border-radius: 10px;
      color: white;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
    }

    .backtest-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(6,182,212,0.3);
    }

    /* 策略模式选项卡 */
    .strategy-mode-tab {
      padding: 7px 4px;
      font-size: 11px;
      font-weight: 600;
      background: rgba(255,255,255,0.04);
      border: 1px solid var(--border-soft);
      border-radius: 8px;
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.2s;
      text-align: center;
    }
    .strategy-mode-tab:hover {
      background: rgba(139,92,246,0.1);
      color: var(--text-secondary);
    }
    .strategy-mode-tab.active {
      background: rgba(139,92,246,0.18);
      border-color: var(--accent-violet);
      color: var(--accent-violet);
    }

    /* 策略卡片中的模式徽章 */
    .strategy-mode-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 11px;
      font-weight: 600;
      margin-left: 6px;
      vertical-align: middle;
    }
    .strategy-mode-badge.index  { background: rgba(99,102,241,0.15); color: #818cf8; }
    .strategy-mode-badge.active { background: rgba(16,185,129,0.15);  color: #34d399; }
    .strategy-mode-badge.sector { background: rgba(245,158,11,0.15);  color: #fbbf24; }
    .strategy-mode-badge.simple { background: rgba(255,255,255,0.08); color: var(--text-muted); }

    /* 基金类型标签 */
    .fund-type-badge {
      display: inline-block;
      padding: 2px 7px;
      border-radius: 5px;
      font-size: 10px;
      font-weight: 600;
      white-space: nowrap;
    }
    .fund-type-badge.index  { background: rgba(99,102,241,0.15); color: #818cf8; }
    .fund-type-badge.active { background: rgba(16,185,129,0.15);  color: #34d399; }
    .fund-type-badge.sector { background: rgba(245,158,11,0.15);  color: #fbbf24; }
    .fund-type-badge.unknown { background: rgba(255,255,255,0.05); color: var(--text-muted); }


    .backtest-results {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
      margin-top: 16px;
    }

    .backtest-result-item {
      padding: 16px;
      background: rgba(255,255,255,0.03);
      border-radius: 12px;
      text-align: center;
    }

    .backtest-result-label {
      font-size: 11px;
      color: var(--text-muted);
      margin-bottom: 8px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .backtest-result-value {
      font-size: 24px;
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
    }

    .backtest-result-value.positive {
      color: var(--accent-rose);
    }

    .backtest-result-value.negative {
      color: var(--accent-emerald);
    }

    /* ── 收益计算器 ── */
    .calculator-modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.75);
      z-index: 3000;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(8px);
      padding: 20px;
      overflow-y: auto;
    }

    .calculator-modal.show { display: flex; }

    .calculator-modal-content {
      position: relative;  /* 为关闭按钮定位提供参考 */
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 24px;
      padding: 32px;
      width: 100%;
      max-width: 700px;
      box-shadow: 0 24px 64px rgba(0,0,0,0.6);
    }

    .calc-options {
      display: grid;
      gap: 12px;
      margin: 24px 0;
    }

    .calc-option {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px;
      background: rgba(255,255,255,0.02);
      border: 1px solid var(--border-soft);
      border-radius: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .calc-option:hover {
      border-color: var(--accent-violet);
      background: rgba(139,92,246,0.04);
    }

    .calc-option.selected {
      border-color: var(--accent-amber);
      background: rgba(245,158,11,0.08);
    }

    .calc-option-icon {
      font-size: 20px;
    }

    .calc-option-content {
      flex: 1;
    }

    .calc-option-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 4px;
    }

    .calc-option-desc {
      font-size: 12px;
      color: var(--text-muted);
    }

    .calc-input-group {
      margin-top: 20px;
      padding: 16px;
      background: rgba(255,255,255,0.02);
      border: 1px solid var(--border-soft);
      border-radius: 12px;
    }

    .calc-input-label {
      font-size: 12px;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    .calc-input {
      width: 100%;
      padding: 10px 14px;
      background: rgba(0,0,0,0.2);
      border: 1px solid var(--border-soft);
      border-radius: 8px;
      color: var(--text-primary);
      font-size: 16px;
      font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
    }

    .calc-input:focus {
      outline: none;
      border-color: var(--accent-amber);
    }

    .calc-result {
      margin-top: 24px;
      padding: 20px;
      background: rgba(245,158,11,0.04);
      border: 1px solid rgba(245,158,11,0.2);
      border-radius: 16px;
      display: none;
    }

    .calc-result.show { display: block; }

    .calc-result-header {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-secondary);
      margin-bottom: 16px;
    }

    .calc-result-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
    }

    .calc-result-item {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .calc-result-label {
      font-size: 11px;
      color: var(--text-muted);
      text-transform: uppercase;
    }

    .calc-result-value {
      font-size: 20px;
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
    }

    .calc-result-value.profit {
      color: var(--accent-rose);
    }

    .calc-result-value.loss {
      color: var(--accent-emerald);
    }

    /* ── 止盈提醒栏改为底部 Toast ── */
    .stop-profit-alert-bar {
      display: none;
      position: fixed;
      bottom: 24px;
      right: 24px;
      left: auto;
      max-width: 360px;
      background: linear-gradient(135deg, rgba(244, 63, 94, 0.95) 0%, rgba(239, 68, 68, 0.95) 100%);
      border: 1px solid rgba(244, 63, 94, 0.5);
      border-radius: 16px;
      padding: 16px 20px;
      color: white;
      z-index: 9999;
      align-items: center;
      justify-content: space-between;
      box-shadow: 0 12px 32px rgba(244, 63, 94, 0.4);
      animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
      backdrop-filter: blur(10px);
    }

    .stop-profit-alert-bar.show {
      display: flex;
    }

    .stop-profit-alert-content {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .stop-profit-alert-icon {
      font-size: 24px;
      flex-shrink: 0;
    }

    .stop-profit-alert-text {
      font-size: 14px;
      font-weight: 500;
      line-height: 1.4;
    }

    .stop-profit-alert-close {
      background: rgba(255,255,255,0.2);
      border: none;
      color: white;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      cursor: pointer;
      font-size: 16px;
      transition: all 0.2s;
      flex-shrink: 0;
      margin-left: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .stop-profit-alert-close:hover {
      background: rgba(255,255,255,0.35);
      transform: scale(1.1);
    }

    .stop-profit-alert-close:active {
      transform: scale(0.95);
    }

    @keyframes slideDown {
      from { transform: translateY(-100%); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    @keyframes slideUp {
      from { opacity: 0; transform: translateY(100px) scale(0.9); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    .stop-profit-alert-bar.hide {
      animation: slideOut 0.3s ease-out forwards;
    }

    @keyframes slideOut {
      from { opacity: 1; transform: translateX(0); }
      to { opacity: 0; transform: translateX(400px); }
    }

    /* ── 加载状态动画 ── */
    @keyframes shimmer {
      0% { background-position: -1200px 0; }
      100% { background-position: 1200px 0; }
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.5; }
    }

    @keyframes spin {
      from { transform: rotate(0deg); }
      to { transform: rotate(360deg); }
    }

    /* 骨架屏容器 */
    .skeleton-screen {
      display: grid;
      gap: 12px;
    }

    /* 骨架屏卡片 */
    .skeleton-card {
      background: var(--bg-card);
      border: 1px solid var(--border-soft);
      border-radius: 12px;
      padding: 16px;
      display: flex;
      gap: 12px;
      align-items: center;
    }

    /* 骨架屏圆形 */
    .skeleton-avatar {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--border-subtle) 50%, var(--bg-tertiary) 100%);
      background-size: 1200px 100%;
      animation: shimmer 2s infinite;
      flex-shrink: 0;
    }

    /* 骨架屏文本行 */
    .skeleton-line {
      height: 14px;
      border-radius: 4px;
      background: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--border-subtle) 50%, var(--bg-tertiary) 100%);
      background-size: 1200px 100%;
      animation: shimmer 2s infinite;
      flex: 1;
    }

    .skeleton-line.short {
      width: 60%;
    }

    .skeleton-line.medium {
      width: 80%;
    }

    /* 加载中指示 */
    .loading-indicator {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      padding: 24px;
      color: var(--text-secondary);
      font-size: 14px;
    }

    .loading-spinner {
      width: 20px;
      height: 20px;
      border: 2px solid var(--border-soft);
      border-top-color: var(--accent-amber);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }

    /* 实时更新指示 */
    .update-pulse {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent-emerald);
      animation: pulse 2s ease-in-out infinite;
      display: inline-block;
      margin-right: 6px;
    }

    /* 加载遮罩 */
    .loading-overlay {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.2);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(2px);
    }

    /* 手机端适配 */
    @media (max-width: 640px) {
      .stop-profit-alert-bar {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
      }
    }

    /* 🚨 紧急强制显示规则 - 确保关键元素始终可见 */
    #cards { display: flex !important; flex-wrap: wrap !important; visibility: visible !important; opacity: 1 !important; min-height: 230px !important; gap: 20px !important; width: 100% !important; box-sizing: border-box !important; }
    .header { display: flex !important; visibility: visible !important; opacity: 1 !important; }
    tbody#tableBody { display: table-row-group !important; visibility: visible !important; }
    
    /* 响应式显示：桌面端显示表格，移动端显示卡片 */
    @media (min-width: 769px) {
      .table-wrap { display: block !important; visibility: visible !important; opacity: 1 !important; }
      #mobileCardContainer { display: none !important; }
    }
    @media (max-width: 768px) {
      .table-wrap { display: none !important; }
      #mobileCardContainer { display: grid !important; visibility: visible !important; opacity: 1 !important; }
    }
    
    /* 确保弹窗默认被隐藏，不覆盖内容 */
    #apiKeyModal[style*="display: none"] {
      pointer-events: none !important;
      background: transparent !important;
    }

    /* 🔥 临时调试：显示所有元素的边界，以便诊断 */
    * {
      /* outline: 1px solid rgba(255, 255, 255, 0.1) !important; */
    }
    
    /* 确保主要容器可见 */
    .cards, .table-wrap, .header, .mobile-card-grid {
      background: transparent !important;
      opacity: 1 !important;
      visibility: visible !important;
    }
    
    /* 策略单元格样式 */
    .strategy-cell {
      text-align: center;
      padding: 12px 8px;
      transition: all 0.2s;
    }
    .strategy-cell:hover {
      background: rgba(139, 92, 246, 0.1);
    }
    .strategy-tag {
      display: inline-block;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 500;
    }
    .strategy-cell.has-strategy .strategy-tag {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(124, 58, 237, 0.2) 100%);
      color: var(--accent-violet);
      border: 1px solid rgba(139, 92, 246, 0.3);
    }
    .strategy-cell.no-strategy .strategy-tag {
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-muted);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* 基金类型单元格样式 */
    .fund-type-cell {
      text-align: center;
      padding: 12px 6px;
    }