:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(15, 23, 42, .88);
  --panel2: rgba(30, 41, 59, .78);
  --line: rgba(148, 163, 184, .22);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --blue: #38bdf8;
  --red: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
  --purple: #a855f7;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at 30% -5%, rgba(56,189,248,.18), transparent 38%), linear-gradient(180deg, #020617, #0f172a 55%, #020617);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  min-height: 100dvh;
}
.app-shell { min-height: 100dvh; max-width: 760px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.app-header { position: sticky; top: 0; z-index: 20; background: rgba(2, 6, 23, .92); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); padding: 12px 12px 8px; }
.header-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { color: var(--blue); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
h1 { font-size: 22px; margin: 0; font-weight: 800; }
.icon-btn { border: 1px solid var(--line); background: rgba(15,23,42,.92); color: var(--text); border-radius: 12px; width: 38px; height: 38px; }
.stock-picker-card, .stock-title-card, .card-panel, .chart-card {
  background: linear-gradient(160deg, rgba(30,41,59,.92), rgba(15,23,42,.92));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 30px rgba(0,0,0,.22);
}
.stock-picker-card { margin-top: 10px; padding: 10px; }
.form-label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.form-select, .form-control { background-color: rgba(2,6,23,.8)!important; color: var(--text)!important; border-color: rgba(56,189,248,.35)!important; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.tiny-hint { color: var(--muted); min-height: 18px; font-size: 12px; }
.stock-title-card { margin-top: 10px; padding: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stock-title { font-size: 20px; font-weight: 900; }
.stock-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }
.status-pill { border-radius: 999px; padding: 5px 10px; background: rgba(56,189,248,.14); border: 1px solid rgba(56,189,248,.35); color: #bae6fd; font-size: 12px; white-space: nowrap; }
.status-pill.intraday { background: rgba(250,204,21,.16); border-color: rgba(250,204,21,.35); color: #fde68a; }
.status-pill.pending { background: rgba(168,85,247,.16); border-color: rgba(168,85,247,.35); color: #e9d5ff; }
.status-pill.final { background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.35); color: #bbf7d0; }
.status-pill.stale { background: rgba(248,113,113,.16); border-color: rgba(248,113,113,.38); color: #fecaca; }
.top-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.top-tabs button { border: 1px solid var(--line); background: rgba(15,23,42,.8); color: var(--muted); border-radius: 12px; padding: 8px 4px; font-size: 13px; font-weight: 800; }
.top-tabs button.active { color: white; border-color: rgba(56,189,248,.55); background: linear-gradient(135deg, rgba(14,165,233,.72), rgba(37,99,235,.48)); }
.app-content { padding: 12px; }
.page-section { display: none; animation: fadeIn .16s ease-out; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.section-guide { border-left: 4px solid var(--blue); background: rgba(56,189,248,.08); border-radius: 12px; padding: 10px 12px; color: #cbd5e1; font-size: 13px; line-height: 1.55; margin-bottom: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.summary-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-height: 82px; }
.summary-card .label { color: var(--muted); font-size: 12px; }
.summary-card .value { font-size: 22px; font-weight: 900; margin-top: 4px; }
.summary-card .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.summary-card.limit-up { background: linear-gradient(160deg, rgba(239,68,68,.78), rgba(127,29,29,.55)); border-color: rgba(248,113,113,.8); }
.summary-card.limit-down { background: linear-gradient(160deg, rgba(34,197,94,.72), rgba(20,83,45,.55)); border-color: rgba(74,222,128,.8); }
.card-panel, .chart-card { padding: 12px; margin-top: 12px; }
.panel-title, .chart-title { font-weight: 900; color: #e2e8f0; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.mobile-chart { width: 100%; }
.chart-lg { height: 360px; }
.chart-sm { height: 210px; }
.tag-container { display: flex; flex-wrap: wrap; gap: 6px; }
.feature-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; border: 1px solid rgba(148,163,184,.25); background: rgba(148,163,184,.12); color: #cbd5e1; }
.feature-tag.bull { background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.35); color: #fecaca; }
.feature-tag.bear { background: rgba(16,185,129,.16); border-color: rgba(16,185,129,.35); color: #bbf7d0; }
.feature-tag.warn { background: rgba(250,204,21,.16); border-color: rgba(250,204,21,.38); color: #fde68a; }
.feature-tag.info { background: rgba(56,189,248,.14); border-color: rgba(56,189,248,.3); color: #bae6fd; }
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.metric { border: 1px solid var(--line); background: rgba(2,6,23,.42); border-radius: 14px; padding: 10px; }
.metric small { display: block; color: var(--muted); font-size: 11px; }
.metric strong { display: block; font-size: 17px; margin-top: 2px; }
.text-buy { color: #f87171!important; font-weight: 800; }
.text-sell { color: #4ade80!important; font-weight: 800; }
.muted-text { color: var(--muted); }
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(148,163,184,.14); }
.mobile-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 420px; }
.mobile-table th { position: sticky; top: 0; background: #0f172a; color: #93c5fd; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mobile-table td { padding: 7px 6px; border-bottom: 1px solid rgba(148,163,184,.12); white-space: nowrap; }
.mobile-table tr:last-child td { border-bottom: none; }
.chip-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.ai-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.btn-ai { background: linear-gradient(135deg, #7c3aed, #a855f7); color: white; border: 0; font-weight: 800; }
.ai-box { line-height: 1.65; font-size: 14px; }
.ai-box h1, .ai-box h2, .ai-box h3 { color: #d8b4fe; font-size: 17px; margin-top: 14px; }
.ai-box strong { color: #f0abfc; }
.history-list { display: grid; gap: 8px; }
.history-item { border: 1px solid var(--line); background: rgba(2,6,23,.42); border-radius: 14px; padding: 10px; }
.history-item .date { color: #93c5fd; font-weight: 800; }
.history-item .preview { color: #cbd5e1; font-size: 13px; margin-top: 4px; max-height: 58px; overflow: hidden; }
.toast-lite { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: rgba(15,23,42,.95); border: 1px solid rgba(56,189,248,.4); color: #e5e7eb; padding: 10px 14px; border-radius: 999px; font-size: 13px; z-index: 100; transition: transform .18s ease; max-width: calc(100vw - 24px); }
.toast-lite.show { transform: translateX(-50%) translateY(0); }
@media (min-width: 680px) { .summary-grid { grid-template-columns: repeat(4, 1fr); } .chip-grid { grid-template-columns: 1fr 1fr; gap: 0 12px; } }
@media (max-width: 380px) { h1 { font-size: 18px; } .stock-title { font-size: 17px; } .top-tabs button { font-size: 12px; padding: 7px 2px; } .summary-card .value { font-size: 18px; } .chart-lg { height: 320px; } }


/* Mobile chart interaction fix: normal swipe scrolls the page; long press enters chart inspect mode. */
.mobile-chart {
  touch-action: pan-y;
  position: relative;
  border-radius: 12px;
}
.chart-card::after {
  content: "長按圖表約 1 秒查看十字線 / 明細；一般滑動會上下捲動畫面";
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.mobile-chart.inspect-mode {
  touch-action: none;
  outline: 2px solid rgba(56,189,248,.75);
  box-shadow: 0 0 0 4px rgba(56,189,248,.12);
}
.mobile-chart.inspect-mode::before {
  content: "檢視模式";
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(56,189,248,.22);
  border: 1px solid rgba(56,189,248,.5);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}
.tag-container .feature-tag {
  margin-bottom: 2px;
}

.stock-link-v37j{cursor:pointer;text-decoration:underline;text-underline-offset:2px;}
.stock-link-v37j:hover{filter:brightness(1.25);}


/* === STOCK AI V38O MOBILE AI LOADING START === */
.ai-loading-card {
  margin: 12px 0 14px;
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid rgba(88, 181, 255, 0.35);
  background: linear-gradient(180deg, rgba(17,34,74,0.96), rgba(10,20,44,0.98));
  box-shadow: 0 10px 26px rgba(0,0,0,0.24), 0 0 0 1px rgba(56,189,248,0.06) inset;
}
.ai-loading-card.hidden { display: none; }
.ai-loading-header { display: flex; align-items: center; gap: 12px; }
.ai-money-icon-wrap {
  width: 46px; height: 46px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7c3aed, #0ea5e9 58%, #22c55e);
  box-shadow: 0 8px 22px rgba(14,165,233,0.30);
  flex-shrink: 0;
}
.ai-money-icon { font-size: 23px; animation: aiMoneyBounce 1.05s ease-in-out infinite; }
@keyframes aiMoneyBounce {
  0%, 100% { transform: translateY(0) rotate(-5deg) scale(1); }
  50% { transform: translateY(-5px) rotate(6deg) scale(1.08); }
}
.ai-loading-title-group { min-width: 0; }
.ai-loading-title { color: #fff; font-size: 18px; font-weight: 850; letter-spacing: .3px; }
.ai-loading-subtitle { margin-top: 3px; color: rgba(226,236,255,.84); font-size: 13px; line-height: 1.45; }
.ai-progress-track { margin-top: 14px; width: 100%; height: 11px; border-radius: 999px; background: rgba(255,255,255,.10); overflow: hidden; }
.ai-progress-bar {
  width: 0%; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #22d3ee, #86efac);
  transition: width .35s ease;
  position: relative;
  overflow: hidden;
}
.ai-progress-bar::after {
  content: ""; position: absolute; top: 0; left: -45%; width: 45%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.52), transparent);
  animation: aiProgressShine 1.25s linear infinite;
}
@keyframes aiProgressShine { 0% { left: -45%; } 100% { left: 105%; } }
.ai-progress-footer { margin-top: 8px; display: flex; justify-content: space-between; gap: 12px; color: #dbeafe; font-size: 13px; }
.ai-loading-tip { margin-top: 10px; color: rgba(191,219,254,.78); font-size: 12px; line-height: 1.5; }
#runAiBtn.is-loading, #runAiBtn:disabled { opacity: .72; pointer-events: none; filter: saturate(.85); }
#runAiBtn.is-loading i { animation: aiRobotPulse 1.05s ease-in-out infinite; }
@keyframes aiRobotPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) {
  .ai-money-icon, .ai-progress-bar::after, #runAiBtn.is-loading i { animation: none; }
  .ai-progress-bar { transition: none; }
}
/* === STOCK AI V38O MOBILE AI LOADING END === */

/* === v38P mobile watchlist search/add fix === */
.search-row {
  position: relative;
}
.mobile-stock-search-results {
  margin-top: 8px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(7, 15, 35, 0.98);
  box-shadow: 0 12px 28px rgba(0,0,0,0.32);
}
.mobile-stock-search-results.hidden {
  display: none;
}
.mobile-stock-search-item {
  width: 100%;
  display: block;
  padding: 10px 12px;
  text-align: left;
  color: #eaf3ff;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-size: 14px;
}
.mobile-stock-search-item:last-child {
  border-bottom: 0;
}
.mobile-stock-search-item:active,
.mobile-stock-search-item:focus {
  background: rgba(56, 189, 248, 0.18);
  outline: none;
}
.mobile-stock-search-empty {
  padding: 10px 12px;
  color: rgba(226, 232, 240, 0.78);
  font-size: 13px;
}
#addWatchBtn:disabled {
  opacity: 0.65;
  pointer-events: none;
}

/* === STOCK AI V39G AI MODEL BADGE START === */
.ai-latest-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-model-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(120, 190, 255, 0.35);
  background: rgba(70, 130, 220, 0.12);
  color: rgba(225, 240, 255, 0.88);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-all;
}
.history-model-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(120, 190, 255, 0.28);
  color: rgba(225, 240, 255, 0.78);
  font-size: 11px;
}
/* === STOCK AI V39G AI MODEL BADGE END === */


/* === STOCK AI V39W MOBILE CHIP TABLE COMPACT START ===
   三大法人 / 融資融券 / 借券表格欄位數少，手機寬度足夠，不應再強制 min-width 造成左右捲動。 */
.chip-compact-wrap {
  overflow-x: hidden !important;
  width: 100%;
}
.chip-compact-table {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: fixed;
  font-size: 11px;
}
.chip-compact-table th,
.chip-compact-table td {
  padding: 7px 3px !important;
  white-space: normal !important;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-align: right;
  line-height: 1.25;
}
.chip-compact-table th:first-child,
.chip-compact-table td:first-child {
  text-align: left;
  color: #cbd5e1;
}
.institutional-compact-table th:first-child,
.institutional-compact-table td:first-child,
.sbl-compact-table th:first-child,
.sbl-compact-table td:first-child { width: 31%; }
.margin-compact-table th:first-child,
.margin-compact-table td:first-child { width: 36%; }
.chip-compact-table th:not(:first-child),
.chip-compact-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
@media (max-width: 390px) {
  .chip-compact-table { font-size: 10.5px; }
  .chip-compact-table th, .chip-compact-table td { padding: 6px 2px !important; }
}
/* === STOCK AI V39W MOBILE CHIP TABLE COMPACT END === */


/* === STOCK AI V41B MOBILE CHIP TABLE WIDTH FIX START ===
   修正手機版三大法人 / 融資融券 / 借券表格日期欄過寬問題。
   原 v39W 為了避免水平捲動，把第一欄設為 31% / 36%；
   但日期在手機版已縮成 MM-DD，只需要 42~48px。 */
.chip-compact-wrap {
  overflow-x: hidden !important;
  width: 100% !important;
}
.chip-compact-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse;
  font-size: 11px;
}
.chip-compact-table th,
.chip-compact-table td {
  box-sizing: border-box;
  padding: 7px 4px !important;
  line-height: 1.22;
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.chip-compact-table th:first-child,
.chip-compact-table td:first-child,
.institutional-compact-table th:first-child,
.institutional-compact-table td:first-child,
.margin-compact-table th:first-child,
.margin-compact-table td:first-child,
.sbl-compact-table th:first-child,
.sbl-compact-table td:first-child {
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  text-align: left !important;
  color: #cbd5e1;
  padding-left: 2px !important;
  padding-right: 2px !important;
}
.institutional-compact-table th:not(:first-child),
.institutional-compact-table td:not(:first-child) { width: calc((100% - 46px) / 3) !important; }
.margin-compact-table th:not(:first-child),
.margin-compact-table td:not(:first-child) { width: calc((100% - 46px) / 2) !important; }
.sbl-compact-table th:not(:first-child),
.sbl-compact-table td:not(:first-child) { width: calc((100% - 46px) / 3) !important; }
@media (max-width: 390px) {
  .chip-compact-table { font-size: 10.5px; }
  .chip-compact-table th,
  .chip-compact-table td { padding: 6px 3px !important; }
  .chip-compact-table th:first-child,
  .chip-compact-table td:first-child,
  .institutional-compact-table th:first-child,
  .institutional-compact-table td:first-child,
  .margin-compact-table th:first-child,
  .margin-compact-table td:first-child,
  .sbl-compact-table th:first-child,
  .sbl-compact-table td:first-child {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
  }
  .institutional-compact-table th:not(:first-child),
  .institutional-compact-table td:not(:first-child),
  .sbl-compact-table th:not(:first-child),
  .sbl-compact-table td:not(:first-child) { width: calc((100% - 42px) / 3) !important; }
  .margin-compact-table th:not(:first-child),
  .margin-compact-table td:not(:first-child) { width: calc((100% - 42px) / 2) !important; }
}
/* === STOCK AI V41B MOBILE CHIP TABLE WIDTH FIX END === */

/* === STOCK AI V41E MOBILE CHIP TABLE EVEN WIDTH START ===
   使用者回饋：日期 5 位、其他欄位多數不超過 10 位，整張表不需要固定日期欄後再分配剩餘寬度。
   改為依欄位數平均切分螢幕寬度，避免日期欄/數字欄視覺上被拉太寬或左右不均。 */
.chip-compact-wrap {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
}
.chip-compact-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  font-size: clamp(10px, 2.75vw, 11.5px) !important;
}
.chip-compact-table th,
.chip-compact-table td {
  box-sizing: border-box !important;
  padding: 6px 2px !important;
  line-height: 1.22 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  font-variant-numeric: tabular-nums !important;
}
.chip-compact-table th:first-child,
.chip-compact-table td:first-child,
.institutional-compact-table th:first-child,
.institutional-compact-table td:first-child,
.margin-compact-table th:first-child,
.margin-compact-table td:first-child,
.sbl-compact-table th:first-child,
.sbl-compact-table td:first-child {
  min-width: 0 !important;
  max-width: none !important;
  text-align: left !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
  color: #cbd5e1;
}
.institutional-compact-table th,
.institutional-compact-table td,
.sbl-compact-table th,
.sbl-compact-table td {
  width: 25% !important;
}
.margin-compact-table th,
.margin-compact-table td {
  width: 33.3333% !important;
}
.institutional-compact-table th:not(:first-child),
.institutional-compact-table td:not(:first-child),
.margin-compact-table th:not(:first-child),
.margin-compact-table td:not(:first-child),
.sbl-compact-table th:not(:first-child),
.sbl-compact-table td:not(:first-child) {
  text-align: right !important;
}
@media (max-width: 390px) {
  .chip-compact-table { font-size: clamp(9.5px, 2.65vw, 10.5px) !important; }
  .chip-compact-table th,
  .chip-compact-table td { padding: 5px 1px !important; }
}
/* === STOCK AI V41E MOBILE CHIP TABLE EVEN WIDTH END === */


/* === STOCK AI V41T MOBILE CHIP TABLE 1/5 DATE WIDTH START ===
   使用者指定：
   1. 手機版三大法人 / 融資融券 / 借券表格寬度與螢幕同寬，不要水平 scroll bar。
   2. 日期欄固定 1/5 寬度。
   3. 其餘欄位依剩餘寬度平均切分。 */
.chip-compact-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}
.chip-compact-wrap .chip-compact-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}
.chip-compact-wrap .chip-compact-table th,
.chip-compact-wrap .chip-compact-table td {
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  padding: 6px 3px !important;
  font-size: clamp(10px, 2.7vw, 11.5px) !important;
  line-height: 1.2 !important;
  font-variant-numeric: tabular-nums !important;
}
.chip-compact-wrap .chip-compact-table th:first-child,
.chip-compact-wrap .chip-compact-table td:first-child {
  width: 20% !important;
  min-width: 20% !important;
  max-width: 20% !important;
  text-align: left !important;
  color: #cbd5e1 !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
}
.chip-compact-wrap .institutional-compact-table th:not(:first-child),
.chip-compact-wrap .institutional-compact-table td:not(:first-child),
.chip-compact-wrap .sbl-compact-table th:not(:first-child),
.chip-compact-wrap .sbl-compact-table td:not(:first-child) {
  width: 26.6667% !important;
  min-width: 26.6667% !important;
  max-width: 26.6667% !important;
  text-align: right !important;
}
.chip-compact-wrap .margin-compact-table th:not(:first-child),
.chip-compact-wrap .margin-compact-table td:not(:first-child) {
  width: 40% !important;
  min-width: 40% !important;
  max-width: 40% !important;
  text-align: right !important;
}
@media (max-width: 390px) {
  .chip-compact-wrap .chip-compact-table th,
  .chip-compact-wrap .chip-compact-table td {
    padding: 5px 2px !important;
    font-size: clamp(9.5px, 2.55vw, 10.5px) !important;
  }
}
/* === STOCK AI V41T MOBILE CHIP TABLE 1/5 DATE WIDTH END === */


/* === STOCK AI V41V MOBILE CHIP TABLE FORCE WIDTH START ===
   強制覆蓋所有舊版規則：日期欄 20%，其餘欄位平均分配；不允許水平 scrollbar。 */
#chip .card-panel,
#chip .table-wrap,
#chip .chip-compact-wrap {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
}

#chip table.mobile-table.chip-compact-table {
  box-sizing: border-box !important;
  display: table !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

#chip table.chip-compact-table col:nth-child(1) { width: 20% !important; }
#chip table.institutional-compact-table col:nth-child(2),
#chip table.institutional-compact-table col:nth-child(3),
#chip table.institutional-compact-table col:nth-child(4),
#chip table.sbl-compact-table col:nth-child(2),
#chip table.sbl-compact-table col:nth-child(3),
#chip table.sbl-compact-table col:nth-child(4) { width: 26.6667% !important; }
#chip table.margin-compact-table col:nth-child(2),
#chip table.margin-compact-table col:nth-child(3) { width: 40% !important; }

#chip table.chip-compact-table th,
#chip table.chip-compact-table td {
  box-sizing: border-box !important;
  max-width: 0 !important;
  min-width: 0 !important;
  padding: 6px 3px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  font-size: clamp(10px, 2.65vw, 11.5px) !important;
  line-height: 1.2 !important;
  font-variant-numeric: tabular-nums !important;
}

#chip table.chip-compact-table th:first-child,
#chip table.chip-compact-table td:first-child {
  width: 20% !important;
  min-width: 0 !important;
  max-width: 0 !important;
  text-align: left !important;
}

#chip table.institutional-compact-table th:not(:first-child),
#chip table.institutional-compact-table td:not(:first-child),
#chip table.sbl-compact-table th:not(:first-child),
#chip table.sbl-compact-table td:not(:first-child) {
  width: 26.6667% !important;
  text-align: right !important;
}

#chip table.margin-compact-table th:not(:first-child),
#chip table.margin-compact-table td:not(:first-child) {
  width: 40% !important;
  text-align: right !important;
}

@media (max-width: 390px) {
  #chip table.chip-compact-table th,
  #chip table.chip-compact-table td {
    padding: 5px 2px !important;
    font-size: clamp(9.5px, 2.5vw, 10.5px) !important;
  }
}
/* === STOCK AI V41V MOBILE CHIP TABLE FORCE WIDTH END === */

/* v42L: 借券表改為 5 欄：日期/借券賣出/借券賣出還券/借券賣出餘額/一般借券餘額 */
#chip table.sbl-compact-table th,
#chip table.sbl-compact-table td { width: 20% !important; min-width: 0 !important; }
