/* InvestLens — 專業財經淺色主題(台股慣例:紅漲綠跌) */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e6e9eb;
  --border-2: #eef0f3;
  --text: #232526;
  --text-2: #5b616e;
  --text-3: #9099a3;
  --navy: #16233f;
  --navy-2: #1e2f53;
  --blue: #1256dd;
  --blue-bg: #eef4ff;
  --gold: #f0b90b;
  --up: #d7263d;
  --up-bg: #fdeef0;
  --down: #1a7f4e;
  --down-bg: #eaf5ef;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: 118px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }
a { color: var(--blue); text-decoration: none; cursor: pointer; }

/* ── 深藍頂欄 ── */
.topbar { background: var(--navy); position: sticky; top: 0; z-index: 100; }
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.brand-name { font-size: 21px; font-weight: 700; color: #fff; letter-spacing: .2px; }
.brand-pro {
  font-size: 10px; font-weight: 700; color: var(--navy);
  background: var(--gold); border-radius: 3px; padding: 2px 5px; letter-spacing: .5px;
}
.search-wrap { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; }
.search-ico { position: absolute; left: 12px; color: #8b94a5; pointer-events: none; }
#searchInput {
  width: 100%; padding: 9px 14px 9px 36px;
  background: #fff; border: none; border-radius: 6px;
  color: var(--text); font-size: 14px; outline: none; font-family: inherit;
}
#searchInput::placeholder { color: #8b94a5; }
.top-nav { display: flex; gap: 4px; margin-left: auto; }
.top-nav a {
  color: #c6cddb; font-size: 14px; padding: 8px 12px; border-radius: 6px; white-space: nowrap;
}
.top-nav a:hover { color: #fff; background: var(--navy-2); }

.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; box-shadow: 0 10px 30px rgba(22,35,63,.18); z-index: 200;
}
.search-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.search-item:hover, .search-item.selected { background: var(--blue-bg); }
.search-item .si-symbol { font-weight: 700; min-width: 86px; color: var(--text); font-size: 13px; }
.search-item .si-name { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.search-item .si-exch { font-size: 11px; color: var(--text-3); background: var(--bg); padding: 2px 8px; border-radius: 3px; white-space: nowrap; }

/* ── 指數行情列 ── */
.overview-bar { background: #fff; border-bottom: 1px solid var(--border); }
.overview-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; overflow-x: auto; padding: 0 8px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.overview-inner::-webkit-scrollbar { display: none; }
.idx-tile {
  padding: 9px 16px; cursor: pointer; flex-shrink: 0;
  border-right: 1px solid var(--border-2);
  display: flex; flex-direction: column; gap: 1px;
}
.idx-tile:first-child { border-left: 1px solid var(--border-2); }
.idx-tile:hover { background: var(--bg); }
.idx-name { font-size: 12px; color: var(--text-2); }
.idx-line { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.idx-price { font-size: 14px; font-weight: 700; color: var(--text); }
.idx-chg { font-size: 12px; font-weight: 500; }

/* ── 版面 ── */
.layout {
  max-width: 1280px; width: 100%; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px;
  padding: 20px 16px; flex: 1; align-items: start;
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 16px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-2);
}
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head .head-note { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: auto; }
.card-body { padding: 16px 18px; }
.pro-badge {
  font-size: 10px; font-weight: 700; color: var(--navy);
  background: var(--gold); border-radius: 3px; padding: 1px 5px; letter-spacing: .5px;
}

/* ── 首頁 ── */
.hero { padding: 28px 24px; }
.hero h1 { font-size: 22px; margin-bottom: 10px; }
.hero p { color: var(--text-2); line-height: 1.8; max-width: 640px; }
.welcome-chips { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; background: #fff; border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; color: var(--blue); font-size: 13px; font-family: inherit;
}
.chip:hover { border-color: var(--blue); background: var(--blue-bg); }
.home-tabs { display: flex; gap: 0; padding: 0 18px; border-bottom: 1px solid var(--border-2); }
.home-tab {
  background: none; border: none; font-family: inherit; font-size: 14px;
  color: var(--text-2); padding: 11px 16px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.home-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }

/* 報價表格(首頁熱門) */
.quote-table { width: 100%; }
.qt-row {
  display: grid; grid-template-columns: minmax(0,1.6fr) 1fr 1fr 1fr; gap: 8px;
  padding: 11px 18px; border-bottom: 1px solid var(--border-2);
  align-items: center; cursor: pointer; font-variant-numeric: tabular-nums;
}
.qt-row:last-child { border-bottom: none; }
.qt-row:hover { background: var(--blue-bg); }
.qt-row.qt-head { color: var(--text-3); font-size: 12px; cursor: default; padding: 9px 18px; }
.qt-row.qt-head:hover { background: none; }
.qt-name { font-weight: 500; color: var(--blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-sym { font-size: 11px; color: var(--text-3); display: block; }
.qt-num { text-align: right; font-size: 13px; }

/* ── 側欄 ── */
.side-card { position: sticky; top: 112px; margin-bottom: 0; }
.side-tabs { display: flex; border-bottom: 1px solid var(--border-2); }
.side-tab {
  flex: 1; padding: 11px 2px; background: none; border: none;
  color: var(--text-2); font-size: 13px; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.side-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
.side-list { max-height: calc(100vh - 220px); overflow-y: auto; }
.side-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-2);
}
.side-row:last-child { border-bottom: none; }
.side-row:hover { background: var(--blue-bg); }
.side-row.active { background: var(--blue-bg); box-shadow: inset 3px 0 0 var(--blue); }
.sr-left { min-width: 0; }
.sr-name { font-weight: 500; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-symbol { font-size: 11px; color: var(--text-3); }
.sr-right { text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.sr-price { font-size: 13px; font-weight: 700; color: var(--text); }
.sr-chg { font-size: 12px; }
.side-empty { padding: 26px 14px; text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.7; }

/* ── 個股頁 ── */
.breadcrumb { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--blue); }

.quote-head { padding: 18px 20px 14px; }
.qh-top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.qh-name { font-size: 22px; font-weight: 700; line-height: 1.3; }
.qh-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.watch-btn {
  margin-left: auto; flex-shrink: 0;
  background: #fff; border: 1px solid var(--blue); border-radius: 6px;
  color: var(--blue); padding: 7px 16px; cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 500;
}
.watch-btn:hover { background: var(--blue-bg); }
.watch-btn.on { background: var(--blue); color: #fff; }
.qh-price-row { display: flex; align-items: baseline; gap: 12px; margin-top: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.qh-price { font-size: 36px; font-weight: 700; letter-spacing: -.5px; }
.qh-chg { font-size: 17px; font-weight: 700; }
.qh-cur { font-size: 12px; color: var(--text-3); }
.qh-time { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* 區塊導覽 */
.section-nav {
  display: flex; gap: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 16px; position: sticky; top: 56px; z-index: 50;
  overflow-x: auto; scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  padding: 12px 18px; color: var(--text-2); font-size: 14px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.section-nav a.active, .section-nav a:hover { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }

/* 圖表 */
.chart-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 18px 0; flex-wrap: wrap;
}
.range-btn, .ctype-btn, .fin-btn {
  background: none; border: 1px solid transparent; border-radius: 5px;
  color: var(--text-2); padding: 5px 11px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.range-btn:hover, .ctype-btn:hover, .fin-btn:hover { color: var(--blue); }
.range-btn.active, .ctype-btn.active, .fin-btn.active {
  background: var(--blue-bg); color: var(--blue); font-weight: 700;
}
.ctype-group { margin-left: auto; display: flex; gap: 2px; }
#chartBox { height: 420px; position: relative; margin: 8px 10px 10px; }
.chart-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); background: #fff; z-index: 5;
}

/* 資料總覽:雙欄 label/value 列表 */
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; padding: 6px 18px 10px; }
.dl-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border-2); font-size: 13px;
}
.dl-label { color: var(--text-2); }
.dl-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }

/* 公允價值 / 健康評分 */
.pro-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pro-cols .card { margin-bottom: 0; }
.fv-verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fv-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fv-unit { font-size: 12px; color: var(--text-3); }
.fv-badge { font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.fv-badge.undervalued { background: var(--down-bg); color: var(--down); }
.fv-badge.overvalued { background: var(--up-bg); color: var(--up); }
.fv-badge.fair { background: var(--blue-bg); color: var(--blue); }
.fv-upside { color: var(--text-2); font-size: 13px; width: 100%; }
.fv-bar-wrap { margin: 20px 0 4px; }
.fv-bar { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #1a7f4e, #b9c0c9 50%, #d7263d); opacity: .8; }
.fv-marker { position: absolute; top: -5px; width: 4px; height: 18px; border-radius: 2px; background: var(--navy); transform: translateX(-50%); }
.fv-marker.fv-fair { background: var(--blue); }
.fv-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 8px; }
.fv-models { margin-top: 14px; border-top: 1px solid var(--border-2); padding-top: 8px; }
.fv-model-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 13px; }
.fm-name { color: var(--text-2); min-width: 104px; }
.fm-note { color: var(--text-3); font-size: 11px; flex: 1; }
.fm-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.fv-model-row.excluded { opacity: .45; }
.fv-model-row.excluded .fm-value::after { content: "(未採計)"; font-size: 10px; color: var(--text-3); margin-left: 4px; font-weight: 400; }

.health-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.health-score { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.health-stars { color: var(--gold); font-size: 15px; letter-spacing: 2px; }
.health-label { color: var(--text-2); font-size: 13px; }
.dim-row { display: grid; grid-template-columns: 76px 1fr 34px; align-items: center; gap: 12px; padding: 6px 0; }
.dim-name { font-size: 13px; color: var(--text-2); }
.dim-track { height: 8px; background: var(--border-2); border-radius: 4px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 4px; background: var(--blue); }
.dim-val { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* 分析師 */
.an-reco { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.an-reco-key { font-size: 20px; font-weight: 700; }
.an-count { color: var(--text-3); font-size: 12px; }
.an-target { margin: 16px 0 4px; }
.an-range { position: relative; height: 8px; background: var(--border-2); border-radius: 4px; }
.an-range-fill { position: absolute; height: 100%; background: rgba(18,86,221,.25); border-radius: 4px; }
.an-marker { position: absolute; top: -5px; width: 4px; height: 18px; border-radius: 2px; transform: translateX(-50%); }
.an-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 8px; gap: 8px; flex-wrap: wrap; }
.an-trend { display: flex; height: 26px; border-radius: 6px; overflow: hidden; margin-top: 16px; gap: 2px; }
.an-seg { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; min-width: 0; }
.an-legend { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; font-size: 11px; }
.an-legend span::before { content: "●"; margin-right: 4px; }

/* 財報圖 */
.fin-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); padding: 10px 18px 0; }
.fin-legend .lg-rev::before { content: "●"; color: var(--blue); margin-right: 5px; }
.fin-legend .lg-earn::before { content: "●"; color: #b8791f; margin-right: 5px; }
.fin-chart-wrap { overflow-x: auto; padding: 4px 18px 14px; }
.fin-tip {
  position: fixed; pointer-events: none; z-index: 300;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 12px; box-shadow: 0 8px 24px rgba(22,35,63,.18);
}
.fin-tip .tt-title { font-weight: 700; margin-bottom: 4px; }
.fin-tip .tt-row { display: flex; justify-content: space-between; gap: 16px; color: var(--text-2); }
.fin-tip .tt-row b { color: var(--text); font-variant-numeric: tabular-nums; }

/* 公司資料 */
.profile-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  font-size: 12px; color: var(--text-2); background: var(--bg);
  border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px;
}
.profile-text { color: var(--text-2); line-height: 1.85; font-size: 13px; max-height: 132px; overflow: hidden; }
.profile-text.expanded { max-height: none; }
.profile-more { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 13px; padding: 8px 0 0; font-family: inherit; }

.err-box { padding: 48px 20px; text-align: center; color: var(--text-2); background: #fff; border: 1px solid var(--border); border-radius: 8px; }

/* ── 排行榜 ── */
.rank-types { display: flex; gap: 4px; padding: 10px 14px 0; flex-wrap: wrap; }
.rank-type {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-2); padding: 5px 13px; cursor: pointer; font-size: 12px; font-family: inherit;
}
.rank-type.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.rank-idx { color: var(--text-3); font-size: 12px; width: 20px; display: inline-block; }

/* ── 技術指標工具列 ── */
.ind-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 18px 0; border-top: 1px solid var(--border-2); margin-top: 10px;
}
.ind-label { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.ind-btn {
  background: none; border: 1px solid var(--border); border-radius: 5px;
  color: var(--text-2); padding: 4px 10px; cursor: pointer; font-size: 12px; font-family: inherit;
}
.ind-btn:hover { color: var(--blue); }
.ind-btn.active { background: var(--blue-bg); border-color: var(--blue); color: var(--blue); font-weight: 700; }
.ind-btn:disabled { opacity: .4; cursor: default; }
.ind-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; padding: 8px 18px 0; font-size: 11px; color: var(--text-2); }
.chart-legend span::before { content: "―"; font-weight: 700; margin-right: 3px; }
#subChartBox { height: 150px; position: relative; margin: 0 10px 10px; border-top: 1px dashed var(--border-2); }

/* ── 個股頁附加按鈕與迷你表單 ── */
.qh-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.act-btn {
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-2); padding: 7px 14px; cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 500;
  white-space: nowrap;
}
.act-btn:hover { border-color: var(--blue); color: var(--blue); }
.act-btn.on { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }
.mini-form {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.mini-form label { color: var(--text-2); }
.mini-form input {
  width: 96px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 5px;
  font-size: 13px; font-family: inherit; outline: none;
}
.mini-form input:focus { border-color: var(--blue); }
.mini-form .mf-save {
  background: var(--blue); border: none; color: #fff; border-radius: 5px;
  padding: 7px 16px; cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 700;
}
.mini-form .mf-del { background: none; border: none; color: var(--up); cursor: pointer; font-size: 13px; font-family: inherit; }
.mini-form .mf-hint { color: var(--text-3); font-size: 12px; width: 100%; }

/* ── 三大法人 ── */
.inst-row { display: grid; grid-template-columns: 110px 1fr 110px; align-items: center; gap: 12px; padding: 8px 0; font-size: 13px; }
.inst-name { color: var(--text-2); }
.inst-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.inst-track { position: relative; height: 12px; }
.inst-track::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--border); }
.inst-bar { position: absolute; top: 0; height: 100%; border-radius: 3px; }

/* ── 新聞 ── */
.news-item { display: block; padding: 11px 18px; border-bottom: 1px solid var(--border-2); }
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: var(--blue-bg); }
.news-title { color: var(--text); font-size: 14px; line-height: 1.5; }
.news-meta { color: var(--text-3); font-size: 12px; margin-top: 3px; }

/* ── 庫存(側欄) ── */
.pf-total {
  padding: 10px 14px; border-top: 2px solid var(--border);
  display: flex; justify-content: space-between; font-size: 13px; font-weight: 700;
}
.sr-sub { font-size: 11px; color: var(--text-3); }

/* ── 選股器 ── */
.scr-form {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--border-2); font-size: 13px;
}
.scr-form label { color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.scr-form input { width: 68px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; font-family: inherit; outline: none; }
.scr-form input:focus { border-color: var(--blue); }
.scr-form select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; font-family: inherit; background: #fff; color: var(--text); }
.scr-count { padding: 8px 18px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border-2); }

/* ── 財務報表 ── */
.stmt-tabs { display: flex; gap: 4px; padding: 10px 18px 0; flex-wrap: wrap; }
.stmt-wrap { overflow-x: auto; padding: 10px 18px 14px; }
.stmt-table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13px; font-variant-numeric: tabular-nums; }
.stmt-table th { text-align: right; color: var(--text-3); font-weight: 400; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.stmt-table th:first-child, .stmt-table td:first-child { text-align: left; color: var(--text-2); position: sticky; left: 0; background: #fff; }
.stmt-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--border-2); font-weight: 500; white-space: nowrap; }
.stmt-table tr.stmt-strong td { font-weight: 700; }

/* ── 分析師預估 ── */
.est-wrap { overflow-x: auto; }
.eps-hist { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.eps-cell {
  flex: 1; min-width: 120px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 12px;
}
.eps-q { color: var(--text-3); }
.eps-vals { margin-top: 4px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.eps-sur { font-size: 12px; margin-top: 2px; }

/* ── 持股結構 ── */
.holder-summary { display: flex; gap: 28px; margin-bottom: 14px; flex-wrap: wrap; }
.holder-big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.holder-cap { font-size: 12px; color: var(--text-3); }
.holder-row { display: grid; grid-template-columns: minmax(0,1fr) 120px 64px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.holder-row:last-child { border-bottom: none; }
.holder-org { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.holder-track { height: 7px; background: var(--border-2); border-radius: 4px; overflow: hidden; }
.holder-fill { height: 100%; background: var(--blue); border-radius: 4px; }
.holder-pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── 歷史價格 ── */
.hist-toolbar { display: flex; align-items: center; gap: 6px; padding: 10px 18px 0; flex-wrap: wrap; }
.hist-dl { margin-left: auto; }
.hist-wrap { max-height: 420px; overflow: auto; margin-top: 8px; }
.hist-table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 13px; font-variant-numeric: tabular-nums; }
.hist-table th { position: sticky; top: 0; background: #fff; text-align: right; color: var(--text-3); font-weight: 400; font-size: 12px; padding: 8px 14px; border-bottom: 1px solid var(--border); z-index: 2; }
.hist-table th:first-child, .hist-table td:first-child { text-align: left; }
.hist-table td { text-align: right; padding: 7px 14px; border-bottom: 1px solid var(--border-2); white-space: nowrap; }

/* ── 配息 ── */
.div-table { width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; border-collapse: collapse; }
.div-table td, .div-table th { padding: 8px 4px; border-bottom: 1px solid var(--border-2); text-align: left; }
.div-table th { color: var(--text-3); font-weight: 400; font-size: 12px; }
.div-table td:last-child, .div-table th:last-child { text-align: right; font-weight: 700; }

/* ── 比較模式 ── */
.cmp-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue-bg); color: var(--blue); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 700;
}
.cmp-chip button { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 13px; padding: 0; }

/* ── 到價提醒橫幅 ── */
.alert-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  background: var(--up); color: #fff; padding: 12px 44px 12px 16px;
  font-size: 14px; font-weight: 700; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.alert-banner .ab-close {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; font-size: 18px; cursor: pointer;
}

/* ── 頁尾 ── */
.footer { background: var(--navy); margin-top: 28px; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 24px 16px; }
.footer-brand { color: #fff; font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.footer p { color: #8b94a5; font-size: 12px; line-height: 1.8; max-width: 720px; }

/* ── 響應式 ── */
@media (max-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .main-panel, .sidebar { min-width: 0; }
  .sidebar { order: 2; }
  .side-card { position: static; }
  .side-list { max-height: 420px; }
  .pro-cols { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  html { scroll-padding-top: 150px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .brand { order: 1; }
  .top-nav { order: 2; margin-left: auto; }
  .top-nav a { padding: 6px 8px; font-size: 13px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .layout { padding: 12px 10px; gap: 12px; }
  .section-nav { top: 96px; }
  .qh-price { font-size: 30px; }
  .qh-chg { font-size: 15px; }
  .qh-name { font-size: 19px; }
  .dl-grid { grid-template-columns: 1fr; column-gap: 0; padding: 4px 16px 8px; }
  #chartBox { height: 300px; margin: 6px 4px 0; }
  #subChartBox { height: 110px; margin: 0 4px 8px; }
  .qh-actions { margin-left: 0; width: 100%; }
  .act-btn { flex: 1; padding: 7px 6px; font-size: 12px; }
  .inst-row { grid-template-columns: 90px 1fr 100px; gap: 8px; }
  .chart-toolbar { padding: 10px 12px 0; }
  .range-btn, .ctype-btn, .fin-btn { padding: 5px 8px; font-size: 12px; }
  .card-head { padding: 12px 16px; }
  .card-body { padding: 14px 16px; }
  .hero { padding: 20px 16px; }
  .hero h1 { font-size: 18px; }
  .qt-row { grid-template-columns: minmax(0,1.5fr) 1fr 1fr; padding: 10px 14px; }
  .qt-col-vol { display: none; }
  .fv-value { font-size: 22px; }
  .health-score { font-size: 28px; }
}
@media (max-width: 400px) {
  .qh-price { font-size: 26px; }
  .idx-tile { padding: 8px 12px; }
}
