@layer legacy {
/* 持仓页以账户总览和逐币估值为主，成交历史通过二级路由进入独立页面。 */
.portfolio-page { margin-top: -6px; }
.portfolio-heading { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; }
.portfolio-heading .eyebrow { font-size: 9px; letter-spacing: 1.6px; margin-bottom: 6px; }
.portfolio-heading h1 { font-size: 24px; font-weight: 550; }
.portfolio-history-button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  padding: 8px 11px; color: var(--accent); background: transparent; border: 1px solid var(--line);
  border-radius: 9px; font-size: 12px; flex-shrink: 0; }
.portfolio-history-button:hover { background: var(--soft-surface); }
.portfolio-overview { padding: 22px 20px 18px; border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(145deg, var(--tonal), var(--surface) 65%); }
.portfolio-eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--muted); font-size: 12px; }
.portfolio-value { display: flex; align-items: baseline; gap: 9px; margin: 10px 0 20px;
  font-size: clamp(36px, 11vw, 46px); font-weight: 500; line-height: 1.15;
  color: var(--text); letter-spacing: -1.6px; font-variant-numeric: tabular-nums; }
.portfolio-value small { font-size: 11px; letter-spacing: .5px; color: var(--muted); }
.portfolio-stats { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: 18px;
  border-bottom: 1px solid var(--soft-line); gap: 16px; }
.portfolio-stats > div { min-width: 0; }
.portfolio-stats > div:last-child { border-left: 1px solid var(--soft-line); padding-left: 16px; }
.portfolio-stats > div > span { font-size: 11px; color: var(--muted); }
.portfolio-stats strong { display: block; font-size: 18px; font-weight: 500; margin-top: 5px;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.portfolio-stats strong > small { font-size: 9px; font-weight: 400; }
.portfolio-return { display: inline-block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.portfolio-allocation-title { display: flex; justify-content: space-between; color: var(--muted);
  font-size: 10px; margin: 16px 0 9px; }
.portfolio-allocation-bar { display: flex; gap: 3px; height: 5px; border-radius: 4px; overflow: hidden; }
.portfolio-allocation-bar > span { flex-basis: 0; }
.allocation-tone-0 { background: var(--accent); }
.allocation-tone-1 { background: var(--muted); }
.allocation-tone-2 { background: var(--border); }
.portfolio-allocation-legend { display: flex; flex-wrap: wrap; gap: 6px 14px;
  list-style: none; padding: 0; margin: 11px 0 0; }
.portfolio-allocation-legend li { display: flex; gap: 4px; align-items: center; font-size: 9px; }
.portfolio-allocation-legend i { width: 5px; height: 5px; border-radius: 50%; }
.portfolio-allocation-legend strong { font-weight: 400; color: var(--muted); }
.portfolio-list-heading { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 23px 0 6px; }
.portfolio-list-heading h2 { font-size: 16px; font-weight: 550; }
.portfolio-list-heading h2 > span { color: var(--muted); font-size: 11px; margin-left: 5px; }
.portfolio-list-heading nav { display: flex; gap: 12px; }
.portfolio-list-heading nav a { display: inline-flex; align-items: center; min-height: 40px;
  font-size: 11px; color: var(--muted); }
.portfolio-list-heading nav a[aria-current] { color: var(--accent); }
.portfolio-position { display: block; padding: 17px 0; border-bottom: 1px solid var(--soft-line); }
.portfolio-position:hover { background: var(--soft-surface); }
.portfolio-position-top { display: flex; align-items: center; gap: 10px; }
.portfolio-position-top > img { width: 38px; height: 38px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.portfolio-position-name { flex: 1; min-width: 0; }
.portfolio-position-name h3 { font-size: 15px; font-weight: 550; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; }
.portfolio-position-name > span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.portfolio-position-value { text-align: right; font-variant-numeric: tabular-nums; }
.portfolio-position-value strong { font-size: 18px; font-weight: 550; }
.portfolio-position-value > span { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.portfolio-position-bottom { display: flex; gap: 10px; justify-content: space-between;
  margin: 12px 0 0 48px; font-variant-numeric: tabular-nums; }
.portfolio-position-bottom dl { display: flex; gap: 20px; margin: 0; }
.portfolio-position-bottom dt { font-size: 10px; color: var(--muted); }
.portfolio-position-bottom dd { margin: 3px 0 0; font-size: 11px; }
.portfolio-position-pnl { text-align: right; }
.portfolio-position-pnl strong { display: block; font-size: 12px; font-weight: 500; }
.portfolio-position-pnl > span:not(.sr-only) { display: block; font-size: 10px; margin-top: 3px; }

/* 独立交易记录页使用页面滚动，筛选与返回持仓排序写入路由。 */
.launch-history-page .launch-back { margin-bottom: 12px; }
.launch-history-page .portfolio-heading { margin-bottom: 14px; }
.history-filter-bar { position: sticky; top: 0; z-index: 1; background: var(--bg);
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  margin-top: 0; border-bottom: 1px solid var(--soft-line); }
.history-filters { display: flex; gap: 18px; }
.history-filters a { display: inline-flex; align-items: center; border-bottom: 2px solid transparent;
  padding: 10px 0; min-height: 44px; color: var(--muted); font-size: 13px; }
.history-filters a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.history-filter-bar > span { color: var(--muted); font-size: 11px; }
.history-record { border-bottom: 1px solid var(--soft-line); }
.history-record summary { display: flex; align-items: center; gap: 10px; padding: 19px 0;
  list-style: none; cursor: pointer; }
.history-record summary::-webkit-details-marker { display: none; }
.history-record summary > img { width: 36px; height: 36px; object-fit: cover; border-radius: 9px; flex-shrink: 0; }
.history-record-name { min-width: 0; flex: 1; }
.history-record-name strong { font-size: 13px; font-weight: 550; }
.history-record-name em { font-style: normal; font-size: 10px; color: var(--accent); margin-left: 6px; }
.history-record-name > small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.history-record-amount { text-align: right; font-variant-numeric: tabular-nums; }
.history-record-amount strong { font-size: 14px; font-weight: 500; }
.history-record-amount strong small { font-size: 8px; }
.history-record-amount > small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.history-record-chevron { color: var(--muted); }
.history-record[open] .history-record-chevron { transform: rotate(180deg); }
.history-record dl { margin: 0 0 0 46px; padding: 12px 0 0; border-top: 1px solid var(--soft-line); }
.history-record dl > div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.history-record dt, .history-record dd { margin: 0; font-size: 11px; }
.history-record dt { color: var(--muted); }
.history-view-token { display: flex; justify-content: end; align-items: center; min-height: 44px; font-size: 11px; }
.history-empty { text-align: center; padding: 60px 12px; color: var(--muted); }
.history-empty h3 { font-size: 16px; margin: 14px 0 8px; color: var(--text); }
.history-empty p { font-size: 12px; }
@media (max-width: 360px) {
  .portfolio-overview { padding: 18px 16px; }
  .portfolio-position-bottom { margin-left: 0; }
  .portfolio-position-bottom dl { gap: 18px; }
  .portfolio-history-button { font-size: 11px; padding-inline: 8px; }
  .history-record summary { gap: 7px; }
  .history-record-name > small { max-width: 100px; }
}

}
