.bt-main [hidden], .bt-dialog [hidden] { display: none !important; }
.bt-card { padding: 16px 18px 18px; margin-bottom: 10px; min-width: 0; }
.bt-main .fund-ai-card { margin-bottom: 10px; }
.bt-card .fund-section-head { margin-bottom: 14px; }
.bt-config-top, .bt-editor-head, .bt-actions, .bt-head-actions, .bt-file-actions, .bt-benchmark, .bt-run-row, .bt-status-row { display: flex; align-items: center; gap: 8px; }
.bt-config-top, .bt-editor-head { justify-content: space-between; flex-wrap: wrap; }
.bt-config-top { margin-bottom: 18px; gap: 12px; }
.bt-config-top .fund-basic-tabs { margin: 0; }
.bt-label { display: block; font-size: 14px; font-weight: 650; color: #334155; margin-bottom: 7px; }
.bt-editor-head .bt-label { margin: 0; }
.bt-search-area { position: relative; }
.bt-main .input, .bt-main .select, .bt-dialog .input { min-height: 40px; font-size: 14px; }
.bt-main .fund-search-meta, .bt-dialog .fund-search-meta { margin: 8px 0 0; }
.bt-main .fund-suggest-panel { z-index: 20; }
.bt-search-area .fund-suggest-item { width: 100%; text-align: left; font: inherit; background: #fff; }
.bt-search-area .fund-suggest-item.is-active { background: #eff6ff; }
.bt-search-area .bt-more { width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 10px; }
.bt-editor { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 22px; margin-top: 18px; }
.bt-holdings { min-width: 0; }
.bt-editor-head { margin-bottom: 10px; }
.bt-empty { padding: 30px 14px; }
.bt-asset-table { min-width: 520px; }
.bt-asset-table th:first-child, .bt-asset-table td:first-child { min-width: 145px; max-width: 220px; white-space: normal; }
.bt-asset-table .input { width: 88px; min-height: 34px; text-align: center; padding: 5px 8px; }
.bt-remove { border: 0; background: none; color: #64748b; font-size: 18px; cursor: pointer; padding: 5px 10px; border-radius: 6px; }
.bt-remove:hover { background: #f1f5f9; color: #b91c1c; }
.bt-weight-status { margin: 8px 0 0; }
.bt-weight-status.is-valid { color: #15803d; }
.bt-weight-status.is-invalid { color: #b45309; }
.bt-allocation { min-width: 0; border-left: 1px solid var(--line); padding-left: 20px; }
.bt-allocation summary { font-size: 14px; font-weight: 650; color: #334155; cursor: pointer; }
.bt-donut { width: 160px; height: 160px; margin: 8px auto; }
.bt-donut svg { display: block; width: 100%; }
.bt-allocation-legend > div { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 6px; align-items: center; margin: 6px 0; font-size: 12px; }
.bt-allocation-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-color { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.bt-allocation .hint { font-size: 11px; text-align: center; margin: 12px 0 0; }
.bt-settings { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.bt-range-buttons { flex-wrap: wrap; gap: 6px; }
.bt-benchmark .select { min-width: 0; flex: 1; width: auto; }
.bt-benchmark > button, .bt-benchmark > label { flex-shrink: 0; }
.bt-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.bt-dates input { width: 100%; box-sizing: border-box; min-width: 0; }
.bt-dates label { min-width: 0; }
.bt-run-row { justify-content: space-between; margin-top: 18px; gap: 16px; }
.bt-run-row .primary-btn { min-height: 40px; flex-shrink: 0; }
.bt-assumption { font-size: 12px; margin: 0; }
.bt-status-row { align-items: baseline; flex-wrap: wrap; }
.bt-card .bt-result-meta { margin: 0 0 12px; overflow-wrap: anywhere; }
.bt-main .fund-rt-value { font-variant-numeric: tabular-nums; }
.bt-metric-note { color: #6b7280; font-size: 11px; margin-top: 5px; }
.bt-up { color: #dc2626; } .bt-down { color: #16a34a; } .bt-neutral { color: #334155; }
.bt-notice { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; color: #92400e; padding: 9px 12px; margin-top: 12px; font-size: 12px; line-height: 1.7; }
.bt-notice p { margin: 2px 0; }
.bt-refresh { margin-top: 8px; }
.bt-chart-toolbar { justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bt-chart-toolbar .bt-benchmark { width: 280px; }
.bt-chart-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 12px; margin: 12px 0; }
.bt-chart-legend > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bt-chart-legend i { width: 14px; height: 3px; border-radius: 2px; }
.bt-chart-legend i.bt-area { height: 9px; opacity: .65; }
.bt-chart { height: 310px; position: relative; }
.bt-chart canvas { width: 100%; height: 100%; display: block; }
.bt-chart canvas:focus-visible { outline: 2px solid #93c5fd; outline-offset: -2px; }
.bt-chart .fund-perf-tooltip { max-width: calc(100% - 24px); box-sizing: border-box; white-space: normal; }
.bt-chart .market-line-tip-date { font-weight: 650; margin-bottom: 4px; }
.bt-chart .market-line-tip-row { display: flex; justify-content: space-between; gap: 12px; }
.bt-summary-table { min-width: 440px; }
.bt-summary-table td { white-space: normal; overflow-wrap: anywhere; }
.bt-summary-table th, .bt-summary-table td { width: 33.33%; }
.bt-wide-table table { min-width: 980px; }
.bt-wide-table th:first-child, .bt-wide-table td:first-child, .bt-asset-table th:first-child, .bt-asset-table td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line); }
.bt-wide-table th:first-child, .bt-asset-table th:first-child { background: #f8fafc; z-index: 2; }
.bt-wide-table td:first-child { white-space: normal; min-width: 105px; max-width: 185px; }
.bt-wide-table small { display: block; color: #6b7280; margin-top: 3px; }
.bt-probability { display: flex; align-items: center; gap: 8px; min-width: 125px; }
.bt-probability-track { width: 70px; height: 6px; border-radius: 4px; background: #e2e8f0; overflow: hidden; }
.bt-probability-track i { display: block; height: 100%; background: #60a5fa; }
.portfolio-backtest-page .info-tip[data-tip]::after { left: auto; right: 0; transform: none; width: min(360px, calc(100vw - 64px)); text-align: left; overflow-wrap: anywhere; }
.bt-dialog { width: min(520px, calc(100vw - 32px)); box-sizing: border-box; border: 1px solid var(--line); border-radius: 12px; padding: 18px; color: var(--text); max-height: calc(100dvh - 40px); overflow-y: auto; }
.bt-dialog::backdrop { background: #0f172a66; }
.bt-dialog .fund-section-head { margin-bottom: 16px; }
.bt-dialog .fund-suggest-panel { position: static; width: auto; margin-top: 8px; max-height: 45vh; box-shadow: none; }
.bt-dialog .fund-search-wrap { display: block; }
.bt-dialog .fund-search-actions { top: 0; height: 40px; transform: none; }
@media (max-width: 767px) {
  .bt-card { padding: 14px; }
  .bt-editor { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .bt-allocation { border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; }
  .bt-allocation-legend { max-width: 310px; margin: auto; }
  .bt-settings { grid-template-columns: minmax(0, 1fr); }
  .bt-run-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .bt-chart-toolbar .bt-benchmark { width: 100%; }
  .bt-chart { height: 280px; }
  .bt-chart-legend { gap: 8px 12px; }
  .bt-main .fund-realtime-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 370px) {
  .bt-file-actions { width: 100%; }
  .bt-main .fund-rt-value { font-size: 21px; }
}

/* Supplementary research keeps the same cards, tables and spacing as fund pages. */
.bt-card .bt-enrichment-note { margin: 12px 0 0; line-height: 1.7; font-size: 12px; }
.bt-holdings-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.bt-holdings-toolbar .fund-basic-tabs { margin: 0; gap: 6px; }
.bt-holdings-toolbar .select { width: auto; }
.bt-correlation-table { --corr-cell: 88px; --corr-label-width: 176px; width: fit-content; max-width: 100%; margin: 0 auto; }
.bt-correlation-table table { width: calc(var(--corr-label-width) + var(--corr-count) * var(--corr-cell)); min-width: 0; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.bt-correlation-table .bt-corr-row-column { width: var(--corr-label-width); }
.bt-correlation-table .bt-corr-number-column { width: var(--corr-cell); }
.bt-correlation-table th, .bt-correlation-table td { box-sizing: border-box; }
.bt-correlation-table td { padding: 0; height: var(--corr-cell); font-variant-numeric: tabular-nums; }
.bt-corr-value { display: flex; align-items: center; justify-content: center; height: calc(var(--corr-cell) - 1px); font-size: 14px; font-weight: 550; }
.bt-correlation-table th { white-space: normal; }
.bt-correlation-table th:first-child { position: sticky; left: 0; z-index: 1; background: #f8fafc; box-shadow: 1px 0 0 var(--line); }
.bt-correlation-table thead th { height: 92px; padding: 8px 5px; vertical-align: middle; }
.bt-correlation-table tbody th { padding: 0 10px; }
.bt-corr-label { display: flex; flex-direction: column; align-items: center; gap: 4px; overflow: hidden; }
.bt-corr-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 17px; overflow-wrap: anywhere; }
.bt-corr-code { display: block; font-size: 10px; line-height: 13px; color: #64748b; font-weight: 400; white-space: nowrap; }
.bt-corr-legend { width: 220px; max-width: 100%; margin: 16px auto 0; }
.bt-corr-scale { height: 8px; border-radius: 3px; background: linear-gradient(to right, #2563eb, #f8fafc 50%, #dc2626); }
.bt-corr-scale-labels { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: #64748b; font-variant-numeric: tabular-nums; }
.bt-profile-table table { min-width: 1050px; }
.bt-profile-table td:nth-child(5) { max-width: 150px; white-space: normal; }
.bt-index-profile-table table { min-width: 760px; }
.bt-index-profile-table td:nth-child(5) { max-width: 220px; white-space: normal; }
.bt-profile-details-table table { min-width: 0; table-layout: fixed; }
.bt-profile-details-table th { width: 110px; white-space: normal; }
.bt-profile-details-table td { text-align: left; white-space: normal; overflow-wrap: anywhere; line-height: 1.8; }
.bt-profile-details-table tr:last-child th { border-bottom: 0; }
.bt-profile-expanded { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.bt-profile-expanded .hint { font-size: 12px; line-height: 1.7; }
.bt-profile-expanded .bt-profile-note { margin: 12px 0 0; }
.bt-fee-table { margin-top: 14px; }
.bt-fee-table table { min-width: 460px; }
.bt-coverage { font-size: 12px; color: #64748b; line-height: 1.8; margin-bottom: 16px; overflow-wrap: anywhere; }
.bt-coverage summary { cursor: pointer; display: list-item; }
.bt-coverage > div { padding: 7px 0 0; }
.bt-coverage-missing { color: #92400e; }
.bt-distribution { max-width: 720px; margin: 18px auto; display: grid; gap: 15px; }
.bt-distribution-row { display: grid; grid-template-columns: 105px minmax(0, 1fr) 78px; align-items: center; gap: 14px; font-size: 13px; }
.bt-distribution-row > span { overflow-wrap: anywhere; }
.bt-distribution-row strong { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.bt-distribution-track { background: #f1f5f9; height: 10px; border-radius: 4px; overflow: hidden; }
.bt-distribution-track i { display: block; height: 100%; background: #60a5fa; border-radius: inherit; }
.bt-overlap-table table { min-width: 700px; }
.bt-overlap-table .bt-contributors { white-space: normal; min-width: 230px; line-height: 1.9; text-align: left; }
@media (max-width: 767px) {
  .bt-correlation-table { --corr-cell: 64px; --corr-label-width: 120px; }
  .bt-correlation-table thead th { padding: 6px 3px; font-size: 12px; }
  .bt-correlation-table tbody th { padding: 0 6px; font-size: 12px; }
  .bt-corr-value { font-size: 13px; }
  .bt-profile-details-table th { width: 78px; }
  .bt-profile-expanded { padding: 12px; }
  .bt-distribution-row { grid-template-columns: 80px minmax(0, 1fr) 66px; gap: 8px; font-size: 12px; }
  .bt-holdings-toolbar .fund-basic-tabs { flex-wrap: wrap; }
}
