/* 全 App 數字統一使用自然字距與比例數字。
   不人工收緊、不使用 1ch、不使用 tabular numerals。
   Rolling Number 僅做 Y 軸動畫；最終連續文字全程保留為唯一自然寬度基準。 */

/* ── 所有曾套用財務 tracking 的顯示區域統一回自然排版 ── */
#totalPct,
#dashMarketValue,
.daily-pnl-summary-value,
.daily-pnl-summary-rate,
.daily-pnl-detail-total,
.pool-stat > strong,
.allocation-mobile-metrics strong,
.income-holding-market,
.cashflow-target-head strong,
.cashflow-market-summary strong,
.rank-amount,
.trade-card .tc-market,
.monthly-dividend-title strong,
.monthly-dividend-amount,
.allocation-wealth-table .t-target,
.allocation-wealth-table .t-cost,
.allocation-mobile-market,
.progress-mobile-footer,
.trade-card .tc-price,
#totalText,
#totalGap,
.investment-progress-meta,
.wealth-gap-status,
.wealth-mobile-target-pct,
.income-holding-shares,
.income-holding-values,
.cashflow-target-gap-value,
.cashflow-forecast-item strong,
.rank-cost-value,
.rank-actual-pct,
.rank-target-pct,
.rank-progress-value,
.cashflow-forecast-detail-row-head > strong,
.cashflow-forecast-detail-amount > strong,
#dashSubText,
#dashGapText,
#dashRealizedBlock,
#dashCountList,
.dash-realized-total-value,
.quote-data-time,
.trade-card .tc-change,
.trade-card .tc-meta,
.trade-card .tc-cost,
.trade-card .tc-bottom,
.trade-card .tc-hist-count,
.trade-card .tc-stock-code,
.stock-lookup-code,
.txn-date,
.txn-price,
.txn-fee-value,
.txn-realized-gain,
.txn-shares,
.txn-cost,
.dividend-compact-date,
.dividend-compact-amount,
.modal-fee-display,
.buy-stock-cost-summary,
.daily-pnl-date,
.daily-pnl-day strong,
.daily-pnl-day small,
.daily-pnl-week-line-values > span,
.daily-pnl-week-row-line,
.daily-pnl-stat strong,
.daily-pnl-composition-value,
.monthly-dividend-value,
.monthly-dividend-date,
.monthly-dividend-financials,
.cashflow-forecast-details-head > span,
.cashflow-forecast-detail-formula{
  letter-spacing:normal !important;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
}

/* 表單輸入中的數字、日期與英數也維持正常文字排版。 */
input[type="number"],
input[type="text"],
input[type="search"],
input[type="date"],
input[type="month"]{
  letter-spacing:normal !important;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
}

/* ── Rolling Number：滾動與靜止使用同一套自然 typography ── */
.rolling-number-host{
  display:inline-block !important;
  position:relative;
  min-width:0;
  overflow:visible !important;
  vertical-align:baseline;
  white-space:nowrap;
  font-family:inherit !important;
  letter-spacing:normal !important;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
}

/* target text 始終以真正連續文字留在 normal flow，visibility:hidden 只隱藏
   glyph、不改變自然寬度。動畫 overlay 完全不參與水平排版。 */
.rolling-number-natural-text{
  display:inline;
  visibility:hidden;
  white-space:pre;
  font:inherit;
  letter-spacing:normal !important;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
}

.rolling-number-previous-probe{
  position:absolute;
  inset:0 auto auto 0;
  pointer-events:none;
}

.rolling-number-track{
  display:block;
  position:absolute;
  inset:0 auto auto 0;
  vertical-align:baseline;
  overflow:visible;
  white-space:pre;
  text-align:inherit;
  font-family:inherit !important;
  letter-spacing:normal !important;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
  pointer-events:none;
}

.rolling-number-char{
  position:absolute;
  display:block !important;
  min-width:0 !important;
  margin:0 !important;
  overflow:hidden !important;
  line-height:inherit;
  white-space:pre;
  letter-spacing:normal !important;
  font-family:inherit;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
}

.rolling-number-char.is-changing{
  position:absolute;
  display:block !important;
  min-width:0 !important;
  overflow:hidden !important;
  line-height:inherit;
  white-space:pre;
}

/* 每個 cell 都固定在 target 連續文字的 Range rect；只有內層做 Y 軸動畫。 */
.rolling-number-char-clip{
  position:absolute;
  inset:0;
  overflow:hidden;
  pointer-events:none;
}

.rolling-number-char-layer{
  position:absolute;
  inset:0;
  display:block;
  width:100%;
  min-width:0;
  line-height:inherit;
  white-space:pre;
  letter-spacing:normal !important;
  font-family:inherit;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
  text-align:left !important;
  pointer-events:none;
}

/* 每個 cell 內仍繪製一整行連續文字，再以 cell rect 裁出對應 glyph。
   這會保留瀏覽器對完整字串計算出的 kerning，而不是孤立 digit 的寬度。 */
.rolling-number-glyph-line{
  position:absolute;
  display:block;
  width:max-content;
  min-width:max-content;
  line-height:inherit;
  white-space:pre;
  letter-spacing:normal !important;
  font-family:inherit;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
  text-align:left !important;
  pointer-events:none;
}

/* 個股頁的 mobilePriorityAnchor 只用來讓 JS 記住桌面版插回位置；
   不可成為 .col 的 grid item，否則空節點仍會額外吃到一個欄位 gap，讓右欄首卡下沉。 */
body.trades-page #mobilePriorityAnchor{
  display:none;
}

/* 交割帳戶固定在 320px sidebar；摘要使用整張卡寬度，四欄依資訊密度分配空間。 */
body.trades-page #cashAccountCard .cash-account-overview{
  grid-template-columns:minmax(0,1fr);
}

body.trades-page #cashAccountCard .cash-account-settlement-head,
body.trades-page #cashAccountCard .cash-account-settlement-day{
  grid-template-columns:42px minmax(72px,1.05fr) minmax(52px,.78fr) minmax(78px,1.12fr);
  column-gap:8px;
}

/* 交割帳戶也不再例外使用等寬數字；右對齊保留，但字距與其他 App 數字一致。 */
body.trades-page #cashAccountCard .cash-account-settlement-value,
body.trades-page #cashAccountCard .cash-account-income-value,
body.trades-page #cashAccountCard .cash-account-settlement-balance{
  width:100%;
  min-width:0;
  justify-self:stretch;
  text-align:right !important;
  letter-spacing:normal !important;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
}

body.trades-page #cashAccountCard .cash-account-settlement-value .rolling-number-track,
body.trades-page #cashAccountCard .cash-account-settlement-value .rolling-number-char,
body.trades-page #cashAccountCard .cash-account-settlement-value .rolling-number-char-sizer,
body.trades-page #cashAccountCard .cash-account-settlement-value .rolling-number-char-layer,
body.trades-page #cashAccountCard .cash-account-income-value .rolling-number-track,
body.trades-page #cashAccountCard .cash-account-income-value .rolling-number-char,
body.trades-page #cashAccountCard .cash-account-income-value .rolling-number-char-sizer,
body.trades-page #cashAccountCard .cash-account-income-value .rolling-number-char-layer,
body.trades-page #cashAccountCard .cash-account-settlement-balance .rolling-number-track,
body.trades-page #cashAccountCard .cash-account-settlement-balance .rolling-number-char,
body.trades-page #cashAccountCard .cash-account-settlement-balance .rolling-number-char-sizer,
body.trades-page #cashAccountCard .cash-account-settlement-balance .rolling-number-char-layer{
  letter-spacing:normal !important;
  font-variant-numeric:proportional-nums lining-nums !important;
  font-feature-settings:"pnum" 1,"lnum" 1 !important;
  font-kerning:normal;
}

/* 行動版交割帳戶：放大主要財務數字，同時保留三欄完整顯示。 */
@media(max-width:700px){
  body.trades-page #cashAccountCard .cash-account-value{
    font-size:24px;
    line-height:1.15;
  }

  body.trades-page #cashAccountCard .cash-account-settlement-date{
    font-size:14px;
  }

  body.trades-page #cashAccountCard .cash-account-settlement-value,
  body.trades-page #cashAccountCard .cash-account-income-value,
  body.trades-page #cashAccountCard .cash-account-settlement-balance{
    font-size:16px;
    line-height:1.35;
  }
}

@media(max-width:390px){
  body.trades-page #cashAccountCard .cash-account-settlement-head,
  body.trades-page #cashAccountCard .cash-account-settlement-day{
    grid-template-columns:38px minmax(68px,1.05fr) minmax(46px,.75fr) minmax(72px,1.1fr);
    column-gap:5px;
  }

  body.trades-page #cashAccountCard .cash-account-settlement-date{
    font-size:13.5px;
  }

  body.trades-page #cashAccountCard .cash-account-settlement-value,
  body.trades-page #cashAccountCard .cash-account-income-value,
  body.trades-page #cashAccountCard .cash-account-settlement-balance{
    font-size:15px;
  }
}

/* 移除已由卡片標題與欄位本身充分表意的解釋性輔助文字。 */
body.trades-page #cashAccountCard .cash-account-interest,
body.allocation-page .allocation-pool-card > .allocation-card-head .tiny,
body.allocation-page .allocation-ranking-head .tiny{
  display:none !important;
}
