/* ============================================================
   回测抽屉：全屏覆盖面板 / 体检报告叙事 / 免费&PRO分层
   ============================================================ */

/* ---------- 覆盖层 ---------- */
.bt-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5);
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.bt-overlay.open { opacity: 1; visibility: visible; }

/* ---------- 抽屉面板 ---------- */
.bt-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 520px; max-width: 100vw;
  background: var(--bg-base, #0F1014);
  border-left: 1px solid var(--line-soft);
  z-index: 2001;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(0.22, 0.61, 0.36, 1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.bt-overlay.open .bt-drawer { transform: translateX(0); }

/* 头部 */
.bt-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.bt-head-title {
  font-size: 17px; font-weight: 900;
  display: flex; align-items: center; gap: 8px;
}
.bt-head-title svg { width: 18px; height: 18px; color: var(--c-gold); }
.bt-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--bg-soft);
  color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s;
}
.bt-close:hover { background: var(--line-strong); }
.bt-close svg { width: 16px; height: 16px; }

/* 滚动内容区 */
.bt-body {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

/* ---------- 加载态 ---------- */
.bt-loading {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; text-align: center;
}
.bt-loading-spinner {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid var(--line-soft);
  border-top-color: var(--c-gold);
  animation: bt-spin 0.8s linear infinite;
  margin-bottom: 20px;
}
@keyframes bt-spin { to { transform: rotate(360deg); } }
.bt-loading-text { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.bt-loading-sub { font-size: 13px; color: var(--ink-3); }
.bt-progress-bar {
  width: 200px; height: 4px; border-radius: 2px;
  background: var(--bg-soft); overflow: hidden;
  margin: 16px auto 0;
}
.bt-progress-bar i {
  display: block; height: 100%; background: var(--c-gold);
  border-radius: 2px; transition: width .3s;
}

/* 错误态 */
.bt-error {
  text-align: center; padding: 40px 20px;
}
.bt-error-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,111,111,0.12);
  display: inline-grid; place-items: center;
  margin-bottom: 14px; color: var(--c-rose);
}
.bt-error-icon svg { width: 24px; height: 24px; }
.bt-error-title { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.bt-error-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 16px; }
.bt-error-retry {
  padding: 9px 24px; border-radius: 999px;
  background: var(--grad-brand); color: #fff;
  border: none; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}

/* ---------- 体检头部 ---------- */
.bt-report-head {
  text-align: center; padding: 8px 0 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 20px;
}
.bt-grade-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 900;
  margin-bottom: 12px;
}
.bt-grade-badge.good {
  background: rgba(82,196,141,0.12); color: var(--c-mint);
}
.bt-grade-badge.ok {
  background: rgba(247,169,37,0.12); color: var(--c-gold);
}
.bt-grade-badge.caution {
  background: rgba(255,143,177,0.12); color: var(--c-rose);
}
.bt-report-summary {
  font-size: 15px; font-weight: 700; line-height: 1.7;
  max-width: 400px; margin: 0 auto;
}
.bt-report-warning {
  margin-top: 10px; font-size: 12.5px; color: var(--c-rose);
  background: rgba(255,143,177,0.06);
  padding: 8px 14px; border-radius: 10px;
  display: inline-block;
}

/* ---------- 净值图 ---------- */
.bt-chart-section {
  margin-bottom: 20px;
}
.bt-chart-section h4 {
  font-size: 14px; font-weight: 800; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.bt-chart-section h4 svg { width: 14px; height: 14px; color: var(--c-gold); }
.bt-nav-canvas {
  display: block; width: 100%; height: 240px;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
}
.bt-chart-legend {
  display: flex; gap: 20px; margin-top: 8px;
  font-size: 11px; color: var(--ink-3); font-weight: 600;
}
.bt-chart-legend span::before {
  content: ''; display: inline-block;
  width: 10px; height: 3px; border-radius: 2px;
  margin-right: 4px; vertical-align: middle;
}
.bt-chart-legend .bt-legend-strat::before { background: var(--c-gold); }
.bt-chart-legend .bt-legend-bench::before { background: var(--ink-3); }

/* ---------- 关键指标5卡 ---------- */
.bt-metrics {
  margin-bottom: 20px;
}
.bt-metrics h4 {
  font-size: 14px; font-weight: 800; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.bt-metrics h4 svg { width: 14px; height: 14px; color: var(--c-gold); }
.bt-metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.bt-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
}
.bt-metric-val {
  font-size: 26px; font-weight: 900; font-family: var(--font-num);
  line-height: 1.2;
}
.bt-metric-val.masked-blur {
  filter: blur(6px); user-select: none;
}
.bt-metric-label {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  margin-top: 4px;
}
.bt-metric-plain {
  font-size: 11px; color: var(--ink-3); font-weight: 600;
  margin-top: 4px; line-height: 1.5;
}

/* ---------- 情景表现 ---------- */
.bt-scenarios {
  margin-bottom: 20px;
}
.bt-scenarios h4 {
  font-size: 14px; font-weight: 800; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.bt-scenarios h4 svg { width: 14px; height: 14px; color: var(--c-gold); }
.bt-scenario-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.bt-scenario-item:last-child { border-bottom: none; }
.bt-scenario-label {
  font-size: 13px; font-weight: 700; min-width: 70px;
}
.bt-scenario-bar-wrap {
  flex: 1; height: 24px; border-radius: 4px;
  background: var(--bg-soft); overflow: hidden;
  position: relative;
}
.bt-scenario-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width .5s;
}
.bt-scenario-bar-val {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 800; font-family: var(--font-num);
}

/* ---------- 锁定覆盖层 ---------- */
.bt-locked-section {
  position: relative;
  margin-bottom: 20px;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  text-align: center;
}
.bt-locked-mask {
  filter: blur(8px); user-select: none; pointer-events: none;
}
.bt-locked-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(15,16,20,0.6);
  border-radius: 16px;
}
.bt-locked-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--grad-brand);
  display: grid; place-items: center;
  margin-bottom: 10px;
}
.bt-locked-icon svg { width: 20px; height: 20px; color: #fff; }
.bt-locked-text {
  font-size: 14px; font-weight: 800; margin-bottom: 4px;
}
.bt-locked-sub {
  font-size: 12px; color: var(--ink-3); margin-bottom: 12px; font-weight: 600;
}
.bt-locked-btn {
  padding: 9px 22px; border-radius: 999px;
  background: var(--grad-brand); color: #fff;
  border: none; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow-pop);
  transition: transform .18s;
}
.bt-locked-btn:hover { transform: scale(1.04); }

/* ---------- 底栏信任说明 ---------- */
.bt-trust {
  margin-top: 20px; padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: 12px;
  font-size: 11.5px; color: var(--ink-3);
  line-height: 1.7; font-weight: 600;
  display: flex; gap: 8px;
}
.bt-trust svg {
  width: 16px; height: 16px; color: var(--c-gold);
  flex: none; margin-top: 1px;
}

/* ---------- 底栏操作按钮 ---------- */
.bt-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  display: flex; gap: 10px;
  flex: none;
}
.bt-action-btn {
  flex: 1; padding: 11px 14px; border-radius: 12px;
  font-size: 13px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.bt-action-btn.primary {
  background: var(--grad-brand); color: #fff;
  border: none; box-shadow: var(--shadow-pop);
}
.bt-action-btn.primary:hover { transform: translateY(-1px); }
.bt-action-btn.secondary {
  background: var(--bg-card); color: var(--ink-2);
  border: 1px solid var(--line-strong);
}
.bt-action-btn.secondary:hover { border-color: var(--c-gold); }
.bt-action-btn svg { width: 14px; height: 14px; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
  .bt-drawer {
    top: auto; right: 0; bottom: 0; left: 0;
    width: 100%; height: 92vh;
    border-left: none; border-top: 1px solid var(--line-soft);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }
  .bt-overlay.open .bt-drawer { transform: translateY(0); }
  .bt-body { padding: 16px; }
  .bt-head { padding: 14px 16px; }
  .bt-metric-cards {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }
  .bt-metric-card { padding: 12px 10px; }
  .bt-metric-val { font-size: 22px; }
  .bt-nav-canvas { height: 200px; }
  .bt-actions { padding: 12px 16px; }
}

@media (max-width: 400px) {
  .bt-metric-cards { grid-template-columns: repeat(2, 1fr); }
}
