:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dfe3e8;
  --text: #1f2937;
  --muted: #6b7280;
  --buy: #0f9f6e;
  --sell: #d64545;
  --hold: #a16207;
  --accent: #2563eb;
  --debate: #7c3aed;
  --sidebar-w: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  display: flex;
  min-height: 100vh;
}
/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: #1e293b;
  color: #e2e8f0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 8px;
  font-size: 17px;
  font-weight: 700;
  border-bottom: 1px solid #334155;
  letter-spacing: 1px;
}
.sidebar-subtitle {
  padding: 8px 20px 20px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}
.sidebar-nav { padding: 12px 0; flex: 1; }
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 14px;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-nav .nav-item:hover { background: #334155; color: #e2e8f0; }
.sidebar-nav .nav-item.active {
  background: #334155;
  color: #ffffff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-nav .nav-item .icon { font-size: 18px; width: 24px; text-align: center; }
/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 20px 24px;
  min-width: 0;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tab-header h2 { font-size: 20px; font-weight: 700; }
.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

header {
      border-bottom: 1px solid var(--line);
      background: #ffffff;
      padding: 16px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      position: sticky;
      top: 0;
      z-index: 10;
    }
    h1 { font-size: 20px; margin: 0; font-weight: 700; }
    main { padding: 18px 24px 28px; max-width: 1440px; margin: 0 auto; }
    .controls {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
    input, button {
      height: 36px;
      border: 1px solid var(--line);
      background: #fff;
      color: var(--text);
      padding: 0 10px;
      border-radius: 6px;
      font-size: 14px;
    }
    input#stock { width: 380px; }
    input#start, input#capital { width: 120px; }
    button {
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
      cursor: pointer;
      font-weight: 600;
    }
    button:disabled { opacity: 0.55; cursor: wait; }
    .grid {
      display: grid;
      grid-template-columns: repeat(12, 1fr);
      gap: 14px;
    }
    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 16px;
      min-width: 0;
    }
    .span-3 { grid-column: span 3; }
    .span-4 { grid-column: span 4; }
    .span-5 { grid-column: span 5; }
    .span-6 { grid-column: span 6; }
    .span-7 { grid-column: span 7; }
    .span-12 { grid-column: span 12; }
    .label {
      color: var(--muted);
      font-size: 13px;
      margin-bottom: 8px;
    }
    .info-icon {
      cursor: help;
      font-size: 14px;
      font-style: normal;
      opacity: 0.6;
      position: relative;
      display: inline-block;
    }
    .info-icon:hover { opacity: 1; }
    .info-icon .tooltip-text {
      visibility: hidden;
      opacity: 0;
      position: absolute;
      left: 50%;
      bottom: 130%;
      transform: translateX(-50%);
      background: #1e293b;
      color: #f1f5f9;
      font-size: 12px;
      font-weight: 400;
      padding: 6px 10px;
      border-radius: 6px;
      white-space: nowrap;
      pointer-events: none;
      transition: opacity 0.1s;
    }
    .info-icon:hover .tooltip-text {
      visibility: visible;
      opacity: 1;
    }
    .value {
      font-size: 26px;
      font-weight: 700;
      line-height: 1.2;
      word-break: break-word;
    }
    .sub {
      color: var(--muted);
      font-size: 13px;
      margin-top: 8px;
    }
    .buy { color: var(--buy); }
    .sell { color: var(--sell); }
    .hold { color: var(--hold); }
    .debate { color: var(--debate); }
    .chart {
      width: 100%;
      height: 430px;
    }
    .chart.short { height: 310px; }
    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 14px;
    }
    th, td {
      border-bottom: 1px solid var(--line);
      padding: 10px 8px;
      text-align: right;
      white-space: nowrap;
    }
    th:first-child, td:first-child { text-align: left; }
    th { color: var(--muted); font-weight: 600; background: #f8fafc; }
    /* 策略信号贡献度表格：全部列靠左显示 */
    #contributionBody td, #contributionBody th { text-align: left; }
    .status {
      padding: 12px 0;
      color: var(--muted);
      font-size: 14px;
    }
    .error {
      border-color: #f4b4b4;
      background: #fff5f5;
      color: #9b1c1c;
      display: none;
    }
    .dropdown {
      position: relative;
      display: inline-block;
    }
    .dropdown-content {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      background: white;
      border: 1px solid var(--line);
      border-radius: 4px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      z-index: 100;
      width: 280px;
      max-height: 240px;
      overflow-y: auto;
    }
    .dropdown-content.show { display: block; }
    .dropdown-item {
      padding: 8px 12px;
      cursor: pointer;
      font-size: 13px;
    }
    .dropdown-item:hover { background: #f3f4f6; }
    .dropdown-item .code { color: var(--muted); font-size: 11px; }
    .badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 10px;
      font-size: 11px;
      font-weight: 600;
    }
    .badge-buy { background: #dcfce7; color: #065f46; }
    .badge-sell { background: #fee2e2; color: #991b1b; }
    .badge-hold { background: #fef3c7; color: #92400e; }
    .badge-debate { background: #ede9fe; color: #5b21b6; }
    .mini-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; vertical-align: middle; margin-left: 6px; }
    @media (max-width: 980px) {
      header { align-items: flex-start; flex-direction: column; }
      .span-3, .span-4, .span-5, .span-6, .span-7 { grid-column: span 12; }
      main { padding: 14px; }
      .chart { height: 360px; }
      table { font-size: 13px; }
      th, td { padding: 8px 6px; }
      input#stock { width: 100%; }
    }
.report-container {
      max-width: 1200px;
      margin: 0 auto;
      padding: 20px;
    }
    .header-bar {
      background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
      color: #fff;
      padding: 24px 30px;
      border-radius: 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 16px;
      margin-bottom: 20px;
    }
    .header-bar .stock-info h2 { font-size: 24px; font-weight: 700; }
    .header-bar .stock-info .code { font-size: 14px; opacity: 0.8; margin-top: 4px; }
    .signal-badge {
      display: inline-block;
      padding: 8px 20px;
      border-radius: 20px;
      font-size: 18px;
      font-weight: 700;
    }
    .signal-buy { background: var(--buy); color: #fff; }
    .signal-sell { background: var(--sell); color: #fff; }
    .signal-hold { background: var(--hold); color: #fff; }
    .alpha-badge {
      background: rgba(255,255,255,0.15);
      padding: 6px 16px;
      border-radius: 10px;
      font-size: 14px;
    }
    .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
    .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
    .card {
      background: var(--panel);
      border-radius: 12px;
      padding: 20px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }
    .card h3 {
      font-size: 16px;
      font-weight: 700;
      margin-bottom: 16px;
      padding-bottom: 10px;
      border-bottom: 2px solid var(--line);
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .card h3 .icon { font-size: 20px; }
    .price-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }
    .price-item {
      background: #f8fafc;
      padding: 12px;
      border-radius: 8px;
      text-align: center;
    }
    .price-item .label { font-size: 12px; color: var(--muted); }
    .price-item .value { font-size: 18px; font-weight: 700; margin-top: 4px; }
    .price-item.buy-zone { border-left: 3px solid var(--buy); }
    .price-item.avoid-zone { border-left: 3px solid var(--sell); }
    .chart-wrapper { position: relative; height: 320px; }
    .chart-wrapper canvas { width: 100% !important; }
    .radar-wrapper { position: relative; height: 500px; }
    .radar-wrapper canvas { width: 100% !important; }
    .risk-bar { margin-bottom: 14px; }
    .risk-bar .bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
    .risk-bar .bar-bg { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; }
    .risk-bar .bar-fill { height: 100%; border-radius: 5px; transition: width 0.5s; }
    .bar-up { background: var(--buy); }
    .bar-down { background: var(--sell); }
    .bar-warn { background: #f59e0b; }
    .summary-block { margin-bottom: 14px; }
    .summary-block .title { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
    .summary-block .content { font-size: 13px; color: var(--text); line-height: 1.7; }
    .agent-bar-wrap { margin-bottom: 10px; }
    .agent-bar-wrap .agent-name { font-size: 12px; margin-bottom: 3px; display: flex; justify-content: space-between; }
    .agent-bar-wrap .bar-track { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
    .agent-bar-wrap .bar-fill { height: 100%; border-radius: 4px; }
    .bar-bull { background: var(--buy); }
    .bar-bear { background: var(--sell); }
    .verdict-box {
      text-align: center;
      padding: 20px;
      border-radius: 12px;
      margin-top: 12px;
    }
    .verdict-buy { background: #ecfdf5; border: 2px solid var(--buy); }
    .verdict-sell { background: #fef2f2; border: 2px solid var(--sell); }
    .verdict-hold { background: #fffbeb; border: 2px solid var(--hold); }
    .verdict-box .big-text { font-size: 28px; font-weight: 700; }
    .verdict-box .sub-text { font-size: 13px; color: var(--muted); margin-top: 4px; }
    /* 报告标题 */
    .report-header {
      display: flex; justify-content: space-between; align-items: flex-start;
      padding: 24px 28px;
      background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
      border-radius: 12px; margin-bottom: 20px; color: #fff;
    }
    .report-header-left { flex: 1; }
    .report-title { font-size: 22px; font-weight: 700; color: #fff; margin: 0 0 6px 0; }
    .report-code { font-size: 14px; color: rgba(255,255,255,0.75); margin-bottom: 8px; }
    .report-roles { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 6px; }
    .report-header-right { text-align: right; flex-shrink: 0; margin-left: 20px; }
    .btn-download {
      display: inline-flex; align-items: center; gap: 6px;
      padding: 8px 18px; background: var(--accent); color: #fff;
      border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
      cursor: pointer; transition: background 0.2s;
    }
    .btn-download:hover { background: #1d4ed8; }
    /* 核心指标 */
    .core-metric-row {
      display: flex; justify-content: space-between; align-items: center;
      padding: 8px 0; border-bottom: 1px solid #f3f4f6;
    }
    .core-metric-row:last-of-type { border-bottom: none; }
    .metric-label { font-size: 13px; color: var(--muted); font-weight: 600; }
    .metric-value { font-size: 14px; color: var(--text); }
    .decision-basis { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
    /* 风险仪表盘 */
    .risk-gauge-wrap { text-align: center; }
    .risk-gauge-wrap canvas { display: block; margin: 0 auto; }
    .risk-gauge-label { margin-top: 10px; font-size: 14px; }
    /* 置信度饼图 */
    .confidence-wrap { text-align: center; }
    .confidence-wrap canvas { display: block; margin: 0 auto; }
    .confidence-label { margin-top: 10px; }
    .confidence-score { font-size: 20px; font-weight: 700; color: var(--accent); }
    .confidence-tier { font-size: 13px; color: var(--muted); margin-top: 2px; }
    /* 股眼见观点总结 */
    .opinion-summary { margin-top: 12px; }
    .opinion-card { margin-bottom: 16px; padding: 18px 20px; text-align: left; }
    .opinion-card h3 { font-size: 15px; margin-bottom: 10px; }
    .opinion-card h4 { font-size: 14px; margin-top: 14px; margin-bottom: 8px; color: var(--accent); }
    .opinion-card ol { padding-left: 20px; margin: 8px 0; text-align: left; }
    .opinion-card ol li { margin-bottom: 6px; line-height: 1.6; text-align: left; }
    .opinion-card p { text-align: left; }
    .bull-card { border-left: 4px solid var(--buy); }
    .bear-card { border-left: 4px solid var(--sell); }
    .decision-card { border-left: 4px solid var(--accent); }
    .bull-title { color: var(--buy) !important; }
    .bear-title { color: var(--sell) !important; }
    .opinion-list { list-style: none; padding: 0; }
    .opinion-list li { padding: 6px 0; font-size: 13px; line-height: 1.7; border-bottom: 1px solid #f3f4f6; }
    .opinion-list li:last-child { border-bottom: none; }
    .decision-reason { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
    .reason-list, .action-list { padding-left: 20px; }
    .reason-list li, .action-list li { padding: 5px 0; font-size: 13px; line-height: 1.7; }
    .price-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
    .price-table th, .price-table td { border: 1px solid #e5e7eb; padding: 8px 12px; text-align: left; }
    .price-table th { background: #f9fafb; font-weight: 600; }
    .price-table tr:hover { background: #f9fafb; }
    .meta-row { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 8px; }
    .meta-tag { font-size: 12px; background: #f1f5f9; color: #1f2937; padding: 4px 10px; border-radius: 6px; }
    .controls-row {
      display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center;
    }
    .controls-row input, .controls-row select, .controls-row button {
      padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
    }
    .controls-row button {
      background: var(--accent); color: #fff; border: none; cursor: pointer; font-weight: 600;
    }
    .controls-row button:hover { opacity: 0.9; }
    #loading { text-align: center; padding: 40px; color: var(--muted); display: none; }
    #error { color: var(--sell); text-align: center; padding: 20px; display: none; }
    .progress-container { margin: 20px 0; display: none; }
    .progress-bar-wrap { height: 24px; background: #e5e7eb; border-radius: 12px; overflow: hidden; margin-bottom: 10px; position: relative; }
    .progress-bar-fill { height: 100%; background: linear-gradient(90deg, #2563eb, #0f9f6e); border-radius: 12px; width: 0%; transition: width 0.4s ease; }
    .progress-pct { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #1f2937; }
    .progress-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
    .progress-step .step-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
    .step-icon.wait { background: #e5e7eb; color: var(--muted); }
    .step-icon.active { background: #dbeafe; color: #2563eb; animation: pulse 1s infinite; }
    .step-icon.done { background: #d1fae5; color: #0f9f6e; }
    .step-icon.error { background: #fee2e2; color: #d64545; }
    @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
    .progress-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
    @media (max-width: 768px) {
      .grid-2, .grid-3 { grid-template-columns: 1fr; }
      .header-bar { flex-direction: column; text-align: center; }
    }
    @media (max-width: 980px) {
      .sidebar { width: 60px; }
      .sidebar-logo { font-size: 0; padding: 12px 8px 4px; }
      .sidebar-logo::after { content: "AI"; font-size: 14px; font-weight: 700; }
      .sidebar-subtitle { display: none; }
      .sidebar-nav .nav-item { font-size: 0; padding: 14px 8px; justify-content: center; }
      .sidebar-nav .nav-item .icon { font-size: 20px; }
      .main-content { margin-left: 60px; }
      .span-3, .span-4, .span-5, .span-6, .span-7 { grid-column: span 12; }
      .grid-2 { grid-template-columns: 1fr; }
      .chart { height: 360px; }
      table { font-size: 13px; }
      th, td { padding: 8px 6px; }
    }
    @media (max-width: 600px) {
      .sidebar { width: 0; overflow: hidden; }
      .main-content { margin-left: 0; }
    }

