/* ────────────────────────────────────────────────────────────────────
   台股智能分析平台 — 共用樣式
   配色沿用原 stock-website：深藍黑底 + 青綠主色 + 紅綠漲跌
   ──────────────────────────────────────────────────────────────────── */
:root {
  --bg:           #0a0e1a;
  --bg-card:      #0d1221;
  --bg-card2:     #111827;
  --bg-hover:     #15203a;
  --border:       rgba(26,45,79,0.9);
  --border-soft:  rgba(26,45,79,0.5);
  --border-glow:  rgba(0,212,255,0.3);

  --cyan:         #00d4ff;
  --green:        #00ff88;
  --red:          #ff3366;
  --yellow:       #ffd700;
  --orange:       #ff8c00;
  --purple:       #a855f7;
  --amber:        #f5a623;

  --text:         #e8f0fe;
  --text2:        #7b8ab8;
  --text3:        #3d5180;

  /* 別名：stock.html 內嵌樣式使用的變數名 */
  --bg2:          #111827;
  --text1:        #e8f0fe;

  --radius:       10px;
  --radius-sm:    6px;

  --mono: 'JetBrains Mono', 'Consolas', 'Menlo', monospace;
  --sans: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
}

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: radial-gradient(rgba(0,212,255,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #5be3ff; }

/* ── Top Nav ───────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,14,26,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1600px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
}
.brand {
  font-weight: 700; font-size: 16px; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  color: var(--text2); padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; transition: all .15s;
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active {
  color: var(--cyan); background: rgba(0,212,255,0.08);
  border-color: rgba(0,212,255,0.25);
}
.nav-search {
  position: relative; min-width: 280px;
}
.nav-search input {
  width: 100%; padding: 7px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--sans); font-size: 13px;
  outline: none; transition: border .15s;
}
.nav-search input:focus { border-color: var(--cyan); }
.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); max-height: 320px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 200;
}
.search-dropdown.hidden { display: none; }
.search-item {
  padding: 8px 14px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-hover); }
.search-item .sid { color: var(--cyan); font-family: var(--mono); }
.search-item .sname { color: var(--text); }
.nav-meta {
  font-family: var(--mono); font-size: 11px; color: var(--text3);
  white-space: nowrap;
}
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 4px; vertical-align: middle; }

/* ── Page container ────────────────────────────────────────────────── */
.page {
  max-width: 1600px; margin: 0 auto;
  padding: 24px;
}

/* ── Card ──────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  letter-spacing: 0.02em;
}
.card-meta { font-family: var(--mono); font-size: 11px; color: var(--text3); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ── Page hero / KPI strip ─────────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.kpi {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}
.kpi-label { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value {
  font-family: var(--mono); font-size: 22px; font-weight: 600;
  margin-top: 6px; letter-spacing: -0.01em; color: var(--text);
}
.kpi-sub { font-size: 11px; color: var(--text3); margin-top: 4px; font-family: var(--mono); }

/* ── Table ─────────────────────────────────────────────────────────── */
.tbl-wrap { width: 100%; overflow-x: auto; }
table.tbl {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
}
.tbl thead th {
  text-align: left; font-weight: 600; color: var(--text2);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--bg-card2); position: sticky; top: 0;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
}
.tbl tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono); white-space: nowrap;
}
.tbl tbody tr:hover { background: rgba(0,212,255,0.04); cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; }
.tbl .center { text-align: center; }
.tbl .stock-id { color: var(--cyan); }
.tbl .stock-name { font-family: var(--sans); color: var(--text); }
.tbl .pos { color: var(--green); }
.tbl .neg { color: var(--red); }
.tbl .dim { color: var(--text3); }

/* ── Badge / Tag ───────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  font-family: var(--mono); border: 1px solid transparent;
}
.badge-buy    { color: var(--green); background: rgba(0,255,136,0.08); border-color: rgba(0,255,136,0.3); }
.badge-watch  { color: var(--yellow); background: rgba(255,215,0,0.08); border-color: rgba(255,215,0,0.3); }
.badge-noFund { color: var(--text3); background: rgba(125,138,184,0.08); border-color: rgba(125,138,184,0.25); }
.badge-hold   { color: var(--cyan); background: rgba(0,212,255,0.08); border-color: rgba(0,212,255,0.3); }
.badge-risk   { color: var(--orange); background: rgba(255,140,0,0.10); border-color: rgba(255,140,0,0.35); }
.badge-exit   { color: var(--red); background: rgba(255,51,102,0.10); border-color: rgba(255,51,102,0.4); }
.badge-nodata { color: var(--text3); background: transparent; border-color: var(--border); }

.score-bar {
  display: inline-block; vertical-align: middle;
  width: 60px; height: 6px; border-radius: 3px;
  background: rgba(125,138,184,0.15); margin-right: 8px;
  position: relative; overflow: hidden;
}
.score-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
}

/* ── Empty / Loading ───────────────────────────────────────────────── */
.empty {
  text-align: center; color: var(--text2);
  padding: 60px 20px; font-size: 13px;
}
.empty .ico { font-size: 32px; opacity: 0.4; margin-bottom: 12px; }

.loading-overlay {
  position: fixed; inset: 0; background: rgba(10,14,26,0.85);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  transition: opacity .3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid rgba(0,212,255,0.2);
  border-top-color: var(--cyan);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stock detail page (legacy layout) ─────────────────────────────── */
.detail-grid {
  display: grid; grid-template-columns: 1fr 360px; gap: 16px;
}
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

.stats-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px,1fr));
  gap: 0; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.stats-bar .stat-item {
  padding: 12px 14px; border-right: 1px solid var(--border-soft);
}
.stats-bar .stat-item:last-child { border-right: none; }
.stat-label { font-size: 10.5px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { display: block; margin-top: 4px; font-family: var(--mono); font-size: 15px; color: var(--text); font-weight: 600; }

.range-btns, .tab-bar { display: flex; gap: 4px; }
.range-btn, .tab-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text2); padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-family: var(--mono); cursor: pointer; transition: all .15s;
}
.range-btn:hover, .tab-btn:hover { color: var(--text); border-color: var(--cyan); }
.range-btn.active, .tab-btn.active {
  color: var(--cyan); border-color: var(--cyan); background: rgba(0,212,255,0.08);
}

.chart-area { width: 100%; }

.info-grid { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text2); font-size: 12px; }
.info-val { color: var(--text); font-family: var(--mono); font-size: 12px; }

.signals-list { display: flex; flex-direction: column; gap: 6px; }
.signal-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--bg-card2); border: 1px solid var(--border-soft);
}
.sig-icon { font-family: var(--mono); color: var(--text3); width: 18px; text-align: center; }
.sig-content { flex: 1; }
.sig-name { font-size: 12px; color: var(--text); font-weight: 600; display: block; }
.sig-desc { font-size: 11px; color: var(--text2); }
.sig-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-family: var(--mono); }
.signal-positive { color: var(--green); background: rgba(0,255,136,0.08); }
.signal-negative { color: var(--red);   background: rgba(255,51,102,0.08); }
.signal-neutral  { color: var(--text2); background: rgba(125,138,184,0.08); }

.inst-summary { display: flex; flex-direction: column; gap: 8px; }
.inst-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border-soft); }
.inst-row.inst-total-row { border-top: 1px solid var(--border); border-bottom: none; padding-top: 10px; margin-top: 4px; font-weight: 600; }
.inst-label { color: var(--text2); font-size: 12px; }
.inst-val { color: var(--text); font-family: var(--mono); font-size: 12px; }

/* ── Footer ────────────────────────────────────────────────────────── */
.footer {
  text-align: center; padding: 32px 16px;
  color: var(--text3); font-size: 11px;
  border-top: 1px solid var(--border-soft); margin-top: 40px;
}

/* ── 工具 class ────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex   { display: flex; }
.row    { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; justify-content: space-between; align-items: center; }
.right  { text-align: right; }
.mono   { font-family: var(--mono); }
.muted  { color: var(--text2); }
.dim    { color: var(--text3); }
.up     { color: var(--green); }
.down   { color: var(--red); }
.h-32   { height: 32px; }
.gap-8  { gap: 8px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }

/* 章節分隔小標 */
.section-title {
  font-size: 11px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px; padding-left: 2px;
}

/* ════════════════════════════════════════════════════════════════════
   手機 / 平板響應式修正
   breakpoints:
     768px  — 平板直向以下
     480px  — 手機
   ════════════════════════════════════════════════════════════════════ */

/* ── Nav：拆成兩行 ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-inner {
    flex-wrap: wrap;
    gap: 0;
    padding: 10px 14px 0;
  }

  /* 第一行：品牌 + 狀態 */
  .brand { flex: 1; font-size: 15px; padding-bottom: 10px; }
  .nav-meta {
    font-size: 10px;
    padding-bottom: 10px;
  }

  /* 第二行：頁面連結 — 等寬平鋪 */
  .nav-links {
    order: 3;
    flex: 0 0 100%;
    display: flex;
    border-top: 1px solid var(--border-soft);
    gap: 0;
    margin: 0 -14px;         /* 撐到容器邊緣 */
  }
  .nav-link {
    flex: 1;
    text-align: center;
    padding: 9px 4px;
    font-size: 12px;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border-soft);
  }
  .nav-link:last-child { border-right: none; }
  .nav-link.active {
    background: rgba(0,212,255,0.1);
    border-color: transparent;
  }

  /* 第三行：搜尋框 — 全寬 */
  .nav-search {
    order: 4;
    flex: 0 0 100%;
    min-width: 0;
    padding: 8px 0 10px;
  }
  .nav-search input { font-size: 14px; } /* 避免 iOS 自動放大 */
}

/* ── Page padding ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page { padding: 12px; }
}

/* ── Hero KPI strip — 2 欄 ──────────────────────────────────────── */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 17px; }
  .kpi-label { font-size: 10px; }
  .kpi-sub   { font-size: 10px; }
}
@media (max-width: 360px) {
  .hero { grid-template-columns: 1fr; }
}

/* ── Stats bar — 橫向捲動 ───────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-bar {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;      /* Firefox */
    border-radius: var(--radius);
    flex-wrap: nowrap;
  }
  .stats-bar::-webkit-scrollbar { display: none; }
  .stats-bar .stat-item {
    flex: 0 0 auto;
    min-width: 90px;
    padding: 10px 12px;
    border-right: 1px solid var(--border-soft);
    border-bottom: none;
  }
  .stat-label { font-size: 9.5px; }
  .stat-value { font-size: 13px; }
}

/* ── Card head — 允許換行 ────────────────────────────────────────── */
@media (max-width: 768px) {
  .card-head {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
  }
  .card-body { padding: 12px; }
  .card-body.tight { padding: 0; }
  .card { margin-bottom: 10px; border-radius: 8px; }
}

/* ── Tab bar / Range btn — 橫向捲動 ────────────────────────────── */
@media (max-width: 768px) {
  .tab-bar, .range-btns {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    gap: 3px;
    padding-bottom: 2px;
  }
  .tab-bar::-webkit-scrollbar,
  .range-btns::-webkit-scrollbar { display: none; }

  .tab-btn, .range-btn {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 5px 10px;
  }
}

/* ── 圖表高度在手機縮小 ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #priceChart     { height: 300px !important; }
  #indicatorChart { height: 180px !important; }
  #dataChart      { height: 200px !important; }
}

/* ── Table — 小字 + 強制橫捲 ────────────────────────────────────── */
@media (max-width: 768px) {
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  table.tbl { font-size: 11.5px; }
  .tbl thead th { padding: 8px 10px; font-size: 10px; }
  .tbl tbody td { padding: 8px 10px; }
}

/* ── 個股右欄在 1100px 以下已堆疊，手機再微調 ──────────────────── */
@media (max-width: 768px) {
  .signals-list { gap: 4px; }
  .signal-item  { padding: 7px 9px; }
  .sig-desc     { font-size: 10.5px; }
}

/* ── 持股檢查表單 — 2欄→1欄 ─────────────────────────────────────── */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}
@media (max-width: 400px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ── AI 情緒分析區塊 ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sent-grid { grid-template-columns: 1fr; }
  .sent-score-box {
    flex-direction: row;
    padding: 14px 16px;
    gap: 14px;
    justify-content: flex-start;
  }
  .sent-score-num { font-size: 36px; }
}

/* ── 上傳區 ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .upload-zone { padding: 24px 14px; }
  .upload-icon { font-size: 24px; }
}

/* ── 防止 iOS 自動縮放輸入框 ─────────────────────────────────────── */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
  .form-field input { font-size: 16px !important; }
  /* 但表格/badge 裡的 mono 文字保持小字 */
  .tbl, .badge, .mono, .kpi-value { font-size: inherit !important; }
}

/* ════════════════════════════════════════════════════════════════════
   專業分析模組：報酬與風險 / 量化健診 / 支撐壓力 / 排序表頭
   ════════════════════════════════════════════════════════════════════ */

/* ── 多期間報酬率 strip ──────────────────────────────────────────── */
.perf-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}
.perf-cell {
  background: var(--bg2); border-radius: var(--radius-sm);
  padding: 10px 12px; text-align: center;
}
.perf-cell .pc-label { font-size: 10.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; }
.perf-cell .pc-value { font-family: var(--mono); font-size: 16px; font-weight: 700; margin-top: 4px; }

/* ── 52 週位置條 ─────────────────────────────────────────────────── */
.range52 { margin-top: 16px; }
.range52-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; color: var(--text2); margin-bottom: 6px; font-family: var(--mono);
}
.range52-track {
  position: relative; height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,51,102,.55), rgba(255,215,0,.45), rgba(0,255,136,.55));
}
.range52-marker {
  position: absolute; top: -4px; width: 4px; height: 18px;
  background: #fff; border-radius: 2px; transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(255,255,255,.6);
}
.range52-sub { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text3); margin-top: 6px; font-family: var(--mono); }

/* ── 風險指標格 ──────────────────────────────────────────────────── */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px; margin-top: 16px;
}
.risk-cell {
  background: var(--bg2); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.risk-cell .rc-label { font-size: 10.5px; color: var(--text3); }
.risk-cell .rc-value { font-family: var(--mono); font-size: 17px; font-weight: 700; margin-top: 4px; color: var(--text); }
.risk-cell .rc-sub { font-size: 10px; color: var(--text3); margin-top: 3px; }

/* ── 量化健診評分卡 ──────────────────────────────────────────────── */
.score-overall {
  display: flex; align-items: center; gap: 16px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.score-overall .so-num {
  font-family: var(--mono); font-size: 40px; font-weight: 800; line-height: 1;
}
.score-overall .so-info .so-grade { font-size: 14px; font-weight: 700; }
.score-overall .so-info .so-desc  { font-size: 11px; color: var(--text2); margin-top: 3px; line-height: 1.5; }
.score-dims { display: flex; flex-direction: column; gap: 9px; }
.score-dim {
  display: grid; grid-template-columns: 56px 1fr 36px;
  align-items: center; gap: 10px; font-size: 12px;
}
.score-dim .sd-name { color: var(--text2); }
.score-dim .sd-track { background: var(--bg2); border-radius: 4px; height: 8px; overflow: hidden; }
.score-dim .sd-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.score-dim .sd-val { font-family: var(--mono); text-align: right; color: var(--text2); }
.score-note { font-size: 10px; color: var(--text3); margin-top: 12px; line-height: 1.6; }

/* ── 支撐與壓力階梯 ──────────────────────────────────────────────── */
.levels-list { display: flex; flex-direction: column; }
.level-row {
  display: grid; grid-template-columns: 64px 1fr 64px;
  align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px dashed var(--border-soft);
  font-size: 12px;
}
.level-row:last-child { border-bottom: none; }
.level-row .lv-tag { font-size: 11px; font-weight: 600; }
.level-row .lv-price { font-family: var(--mono); text-align: right; color: var(--text); }
.level-row .lv-dist { font-family: var(--mono); text-align: right; font-size: 11px; }
.level-row.lv-res .lv-tag { color: var(--red); }
.level-row.lv-sup .lv-tag { color: var(--green); }
.level-row.lv-piv .lv-tag { color: var(--yellow); }
.level-row.lv-ref .lv-tag { color: var(--text3); }
.level-row.lv-now {
  background: rgba(0,212,255,0.07); border-radius: var(--radius-sm);
  border-bottom: none; padding: 7px 8px; margin: 2px -8px;
}
.level-row.lv-now .lv-tag { color: var(--cyan); }
.level-row.lv-now .lv-price { color: var(--cyan); font-weight: 700; }

/* ── 可排序表頭 ──────────────────────────────────────────────────── */
.tbl thead th.sortable { cursor: pointer; user-select: none; }
.tbl thead th.sortable:hover { color: var(--cyan); }
.tbl thead th.sortable::after { content: ' ⇅'; opacity: .35; font-size: 9px; }
.tbl thead th.sortable.sort-desc::after { content: ' ▼'; opacity: 1; color: var(--cyan); }
.tbl thead th.sortable.sort-asc::after  { content: ' ▲'; opacity: 1; color: var(--cyan); }

/* ── 相對大盤統計列 ──────────────────────────────────────────────── */
.rs-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.rs-cell {
  background: var(--bg2); border-radius: var(--radius-sm); padding: 9px 12px;
}
.rs-cell .rs-label { font-size: 10px; color: var(--text3); }
.rs-cell .rs-value { font-family: var(--mono); font-size: 16px; font-weight: 700; margin-top: 3px; }
.rs-cell .rs-sub { font-size: 9.5px; color: var(--text3); margin-top: 2px; }

/* ── 月報酬熱力圖 ────────────────────────────────────────────────── */
.heat-wrap { overflow-x: auto; }
table.heat-tbl {
  width: 100%; border-collapse: separate; border-spacing: 3px;
  font-family: var(--mono); font-size: 11px;
}
.heat-tbl th {
  color: var(--text3); font-weight: 600; font-size: 10px;
  padding: 4px 2px; text-align: center;
}
.heat-tbl td {
  text-align: center; padding: 7px 2px; border-radius: 4px;
  min-width: 44px; color: var(--text);
}
.heat-tbl td.heat-year { color: var(--text2); font-weight: 600; background: var(--bg2); }
.heat-tbl td.heat-total { font-weight: 700; border: 1px solid var(--border); }
.heat-tbl td.heat-empty { background: rgba(125,138,184,0.04); color: var(--text3); }

/* ── 盤後快評（晨會摘要）────────────────────────────────────────── */
.brief-list { display: flex; flex-direction: column; gap: 10px; }
.brief-item {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 13px; line-height: 1.7; color: var(--text);
}
.brief-item .bi-tag {
  flex-shrink: 0; font-size: 11px; font-weight: 600; font-family: var(--mono);
  padding: 2px 10px; border-radius: 99px; margin-top: 2px;
  background: rgba(0,212,255,0.08); color: var(--cyan);
  border: 1px solid rgba(0,212,255,0.25); white-space: nowrap;
}
.brief-item.bi-bull .bi-tag { background: rgba(0,255,136,0.08); color: var(--green); border-color: rgba(0,255,136,0.3); }
.brief-item.bi-bear .bi-tag { background: rgba(255,51,102,0.08); color: var(--red); border-color: rgba(255,51,102,0.35); }
.brief-item.bi-warn .bi-tag { background: rgba(255,215,0,0.08); color: var(--yellow); border-color: rgba(255,215,0,0.3); }
.brief-conclusion {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg2); border-left: 3px solid var(--cyan);
  font-size: 13px; line-height: 1.7; color: var(--text);
}

/* ── 法人連買連賣徽章 ────────────────────────────────────────────── */
.streak-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-soft);
}
.streak-badge {
  font-size: 11px; font-family: var(--mono); font-weight: 600;
  padding: 3px 10px; border-radius: 99px; border: 1px solid transparent;
}
.streak-buy  { color: var(--green); background: rgba(0,255,136,0.08); border-color: rgba(0,255,136,0.3); }
.streak-sell { color: var(--red); background: rgba(255,51,102,0.08); border-color: rgba(255,51,102,0.35); }
.streak-none { color: var(--text3); background: rgba(125,138,184,0.06); border-color: var(--border); }

/* ── 手機調整 ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .perf-strip { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .perf-cell { padding: 8px; }
  .perf-cell .pc-value { font-size: 13.5px; }
  .risk-grid { grid-template-columns: repeat(2, 1fr); }
  .score-overall .so-num { font-size: 32px; }
  .rs-stats { grid-template-columns: repeat(2, 1fr); }
  #perfAnaChart { height: 240px !important; }
}
@media (max-width: 420px) {
  .perf-strip { grid-template-columns: repeat(2, 1fr); }
}
