/* ============================================================
   每日國際盤趨勢儀表板
   台灣看盤慣例：紅 = 漲、綠 = 跌（與美式相反）
   ============================================================ */

:root,
html[data-theme="dark"] {
  --bg: #0d0e10;
  --card: #17181b;
  --card2: #1e2024;
  --card3: #232529;
  --border: #2a2c32;
  --text: #e9eaee;
  --muted: #9aa0ab;
  --muted2: #6f7580;
  --up: #f3506a;          /* 漲＝紅 */
  --up-bright: #ff4d5e;
  --up-dim: rgba(243, 80, 106, 0.16);
  --down: #37d67a;        /* 跌＝綠 */
  --down-bright: #2fd882;
  --down-dim: rgba(55, 214, 122, 0.14);
  --blue: #4d8dff;
  --blue-dim: rgba(77, 141, 255, 0.18);
  --orange: #ff9f43;
  --banner-bg: rgba(243, 80, 106, 0.10);
  --banner-border: rgba(243, 80, 106, 0.55);
  --pill-bg: #26282e;
  --avg-line: #ffffff;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --zebra: rgba(255, 255, 255, 0.03);
  --nav-bg: rgba(13, 14, 16, 0.88);
  --hero-bg: linear-gradient(160deg, #1a1c21 0%, #17181b 55%, #15161a 100%);
}

html[data-theme="light"] {
  --bg: #f1f2f5;
  --card: #ffffff;
  --card2: #f4f5f8;
  --card3: #eceef2;
  --border: #dcdfe6;
  --text: #1b1d22;
  --muted: #5d6470;
  --muted2: #8a8f9a;
  --up: #d92b48;
  --up-bright: #d31f3e;
  --up-dim: rgba(217, 43, 72, 0.10);
  --down: #0d9d58;
  --down-bright: #0a8c4e;
  --down-dim: rgba(13, 157, 88, 0.10);
  --blue: #2f6fe0;
  --blue-dim: rgba(47, 111, 224, 0.14);
  --orange: #d97a1a;
  --banner-bg: rgba(217, 43, 72, 0.07);
  --banner-border: rgba(217, 43, 72, 0.55);
  --pill-bg: #eceef2;
  --avg-line: #4a4f58;
  --shadow: 0 2px 10px rgba(20, 30, 60, 0.08);
  --zebra: rgba(25, 35, 65, 0.035);
  --nav-bg: rgba(241, 242, 245, 0.92);
  --hero-bg: linear-gradient(160deg, #ffffff 0%, #fafbfd 60%, #f5f6fa 100%);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  line-height: 1.45;
  font-size: 14px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 12px 40px;
}

/* ---------- 通用 ---------- */
.up   { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}

/* 標題階層：英雄區 > 章節/卡片標題（藍色側條錮點） > 注解 */
.sec-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-left: 9px;
  border-left: 3px solid var(--blue);
  line-height: 1.25;
}

.card h2.card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
  padding-left: 9px;
  border-left: 3px solid var(--blue);
  line-height: 1.25;
}

.card h2 .title-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

/* ---------- 1. 頁首 ---------- */
.site-header { padding: 4px 2px 12px; }

.header-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  align-items: flex-start;
}

.site-title {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.site-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.header-meta {
  font-size: 11px;
  color: var(--muted2);
  text-align: right;
  line-height: 1.6;
  flex: 1 1 auto;
  min-width: 200px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
}

.status-ok { color: var(--up); font-weight: 700; }

.dot-sep { color: var(--muted2); }

.theme-toggle {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--muted2); }
.theme-toggle:disabled { opacity: 0.6; cursor: wait; }

.offline-badge {
  color: #d9a514;
  background: rgba(217, 165, 20, 0.12);
  border: 1px solid rgba(217, 165, 20, 0.45);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- 快速導覽（sticky 章節 chip） ---------- */
.quick-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -12px 10px;
  padding: 8px 12px;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.quick-nav::-webkit-scrollbar { display: none; }

.quick-nav a {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.quick-nav a:hover { color: var(--text); border-color: var(--muted2); }
.quick-nav a.active {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-dim);
  font-weight: 700;
}

/* 錨點跳轉時預留 sticky 導覽高度 */
.main-grid > *, .heavy-grid > .card { scroll-margin-top: 54px; }

/* ---------- 主 grid ---------- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.main-grid > * { min-width: 0; }

@media (min-width: 1024px) {
  .main-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .span2 { grid-column: span 2; }
  .site-title { font-size: 22px; }
}

/* ---------- 0. 一眼總覽（英雄區） ---------- */
.hero-card {
  background: var(--hero-bg);
  padding: 16px 16px 14px;
}

.hero-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.hero-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted2);
  text-transform: uppercase;
}

.hero-verdict {
  font-size: 15px;
  font-weight: 900;
  padding: 3px 14px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  line-height: 1.4;
}
.hero-verdict.up   { color: var(--up); background: var(--up-dim); }
.hero-verdict.down { color: var(--down); background: var(--down-dim); }
.hero-verdict.flat { color: var(--muted); background: var(--card2); }

.hero-chips { display: flex; flex-wrap: wrap; gap: 5px; }

.hero-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.hero-chip.up   { color: var(--up); background: var(--up-dim); }
.hero-chip.down { color: var(--down); background: var(--down-dim); }
.hero-chip.flat { color: var(--muted); background: var(--card2); }

.hero-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.hs-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.hero-anchor-num {
  font-size: 40px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.5px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-anchor-num.flat { color: var(--muted); }
.hero-arrow { font-size: 22px; }
.hero-anchor-pct { font-size: 17px; font-weight: 700; }

.hero-range {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
}
.hero-range .hr-lo { color: var(--down); font-weight: 700; white-space: nowrap; }
.hero-range .hr-hi { color: var(--up); font-weight: 700; white-space: nowrap; }
.hero-range .hr-bar {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--down) 0%, var(--muted2) 50%, var(--up) 100%);
  opacity: 0.9;
  min-width: 60px;
}
.hero-range .hr-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--text);
  transform: translate(-50%, -50%);
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hero-stat {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  min-width: 0;
}
.hero-stat .hs-val {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.15;
}
.hero-stat .hs-val.flat { color: var(--muted); }
.hero-stat .hs-note {
  font-size: 10.5px;
  color: var(--muted2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 700px) {
  .hero-main { grid-template-columns: minmax(260px, 5fr) 7fr; align-items: center; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 2. 提示橫幅 ---------- */
.banner {
  border: 1px solid var(--banner-border);
  background: var(--banner-bg);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
}
.banner .banner-line1 { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.banner .banner-strong { font-weight: 700; color: var(--up); }
.banner .banner-line2 { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 3. 台指期開盤預估 ---------- */
.txf-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }

.txf-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.txf-row.adopted { background: var(--card2); border: 1px solid var(--border); }

.txf-row .txf-name { flex: 1 1 auto; }
.txf-row .txf-star { color: var(--orange); font-size: 11px; margin-left: 4px; }

.txf-row .txf-val {
  font-size: 20px;
  font-weight: 900;
  min-width: 86px;
  text-align: right;
}
.txf-row .txf-pct { min-width: 62px; text-align: right; font-weight: 700; }

.txf-anchor {
  margin-top: 8px;
  font-weight: 700;
  font-size: 14px;
}

.txf-range { margin-top: 10px; }

.txf-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}
.txf-range-labels .lo { color: var(--down); font-weight: 700; }
.txf-range-labels .hi { color: var(--up); font-weight: 700; }

.txf-slider {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--down) 0%, var(--muted2) 50%, var(--up) 100%);
  opacity: 0.9;
}
.txf-slider .mid-tick {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text);
  transform: translateX(-50%);
  border-radius: 1px;
}
.txf-slider .anchor-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--text);
  transform: translate(-50%, -50%);
}

.txf-note { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ---------- 4. 多市場判讀 ---------- */
.markets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.market-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}

.market-card .m-name { font-size: 13px; color: var(--muted); margin-bottom: 6px; }

.badge {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
}
.badge.up { color: var(--up); background: var(--up-dim); }
.badge.down { color: var(--down); background: var(--down-dim); }
.badge.flat { color: var(--muted); background: var(--card2); }
.m-big.flat { color: var(--muted); }

.market-card .m-big {
  font-size: 21px;
  font-weight: 900;
  line-height: 1.2;
}

.market-card .m-sub { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------- 表格通用 ---------- */
.tbl-scroll { overflow-x: auto; }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
table.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted2);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
table.tbl td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-weight: 700; }
table.tbl th.num { text-align: right; font-weight: 500; }

/* 斑馬紋：偶數列淡底，提升橫向追視性 */
table.tbl tbody tr:nth-child(even) td { background: var(--zebra); }

/* 漲跌% 關鍵欄：數値＋迷你強度 bar */
td.pctc { min-width: 76px; }
td.pctc .pct-val { display: inline-block; }
td.pctc .pct-bar {
  display: block;
  width: 54px;
  height: 3px;
  margin: 3px 0 0 auto;
  border-radius: 2px;
  background: var(--card3);
  overflow: hidden;
}
td.pctc .pct-bar i { display: block; height: 100%; border-radius: 2px; }
td.pctc .pct-bar i.up   { background: var(--up); margin-left: auto; }
td.pctc .pct-bar i.down { background: var(--down); }

/* 區塊收合（明細可收合；標題常駐） */
.collapse-btn {
  margin-left: auto;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  align-self: center;
  transition: transform 0.15s;
}
.collapse-btn:hover { color: var(--text); border-color: var(--muted2); }
.card.collapsed .collapse-btn { transform: rotate(-90deg); }
.card.collapsed > *:not(h2) { display: none; }
.card.collapsed h2.card-title { margin-bottom: 0; }

/* 連動表「顯示全部」 ---------- */
.show-more {
  display: block;
  width: 100%;
  margin-top: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-dim);
  border: 1px dashed var(--blue);
  border-radius: 8px;
  padding: 6px 0;
  cursor: pointer;
}
.show-more:hover { filter: brightness(1.1); }

.fresh-rt { color: var(--up); font-size: 12px; }
.fresh-close { color: var(--muted2); font-size: 12px; }

/* ---------- 5.5 台美權值股 ---------- */
/* 手機單欄兩卡上下排；桌機（≥1024px）兩卡並排 */
.heavy-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.heavy-grid > .card { min-width: 0; }

@media (min-width: 1024px) {
  .heavy-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.heavy-code {
  color: var(--muted2);
  font-size: 11px;
  font-weight: 400;
  margin-left: 5px;
}

/* ---------- 6. 詳細連動個股 ---------- */
#linkedCard { position: relative; }

.linked-vertical {
  position: absolute;
  top: 64px;
  right: 3px;
  writing-mode: vertical-rl;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted2);
}

table.tbl-linked { white-space: normal; }
table.tbl-linked td.src { min-width: 96px; font-size: 13px; }
table.tbl-linked td.pct { white-space: nowrap; }

.mkt-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border-radius: 4px;
  padding: 2px 5px;
  line-height: 1.2;
}
.mkt-tag.kr { background: #c0392b; }
.mkt-tag.us { background: #2e5fb8; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  white-space: nowrap;
}
.chip .code { color: var(--muted2); font-size: 10px; }

/* ---------- 7. ADR 預估 ---------- */
.adr-sub { font-size: 12px; color: var(--muted); margin: -4px 0 8px; }

/* ---------- 8. 美股產業龍頭強弱 ---------- */
.leaders-chart { margin-top: 6px; }

.leader-row {
  display: grid;
  grid-template-columns: 118px 1fr 58px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
}
.leader-row .l-name { text-align: right; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-row .l-pct { font-weight: 700; text-align: left; }

.l-bar-area {
  position: relative;
  height: 14px;
}
.l-bar-area .l-axis {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: var(--border);
}
.l-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
}
.l-bar.up   { right: 50%; background: var(--up); }
.l-bar.down { left: 50%;  background: var(--down); }

/* ---------- 10. 個股分時看盤 ---------- */
.stock-panel { padding: 0; overflow: hidden; }

.sp-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
}
.sp-top .sp-icon {
  color: var(--muted);
  font-size: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.sp-top .sp-name { font-size: 16px; font-weight: 700; flex: 1; }
.sp-top .sp-name .sp-code { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 4px; }

.sp-switch {
  display: flex;
  gap: 6px;
  padding: 0 14px 8px;
  /* 個股數量會變多，手機上必須可橫向捲動，否則按鈕會被切掉點不到 */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.sp-switch button {
  flex: none;
  font: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
}
.sp-switch button.active {
  border-color: var(--up);
  color: var(--up);
  background: var(--up-dim);
  font-weight: 700;
}

.sp-price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 0 14px 6px;
}
.sp-price { font-size: 32px; font-weight: 900; line-height: 1.05; }
.sp-chg { font-size: 15px; font-weight: 700; }
.sp-vol { font-size: 12px; color: var(--muted); }
.sp-vol .shrink { font-weight: 700; }

.sp-attr {
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: auto;
}

.sp-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 14px 10px;
  font-size: 11px;
  color: var(--muted);
}
.sp-tag {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  background: var(--card2);
  white-space: nowrap;
}
.sp-tag.hot { border-color: var(--orange); color: var(--orange); background: transparent; }

.sp-tabs {
  display: flex;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.sp-tabs button {
  flex: 1 0 auto;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.sp-tabs button.active {
  color: var(--up);
  font-weight: 700;
  border-bottom-color: var(--up);
}
.sp-tabs.sp-subtabs button.active { color: var(--text); border-bottom-color: var(--text); }

.sp-subrow {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  overflow-x: auto;
}
.sp-subrow .seg {
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.sp-subrow .seg.active { color: var(--text); border-color: var(--muted2); font-weight: 700; }
.sp-subrow .spacer { flex: 1; }

.sp-chart-wrap { position: relative; padding: 4px 6px 0; }
#spChart { display: block; width: 100%; height: 230px; }

.sp-empty {
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted2);
  font-size: 13px;
}

.sp-ticks table.tbl { font-size: 12px; }
.sp-ticks table.tbl th, .sp-ticks table.tbl td { padding: 5px 14px; }

@media (min-width: 1024px) {
  .stock-panel-outer .stock-panel { max-width: 560px; }
}

/* ---------- 頁尾 ---------- */
.site-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--muted2);
}

/* ---------- 小螢幕微調 ---------- */
@media (max-width: 420px) {
  table.tbl { font-size: 12px; }
  table.tbl th, table.tbl td { padding: 6px 5px; }
  .hero-anchor-num { font-size: 34px; }
  .hero-stat .hs-val { font-size: 19px; }
  td.pctc .pct-bar { width: 44px; }
  /* ADR 六欄表：縮字距並允許首欄換行，避免水平溢出 */
  #adrCard table.tbl { font-size: 11px; }
  #adrCard table.tbl th, #adrCard table.tbl td { padding: 5px 3px; }
  #adrCard table.tbl td:first-child { white-space: normal; max-width: 76px; }
  .leader-row { grid-template-columns: 96px 1fr 52px; font-size: 11px; }
  .header-meta { text-align: left; }
  .sp-price { font-size: 29px; }
}

/* ============================================================
   v2 新增區塊：指揮中心 / 分數卡 / 訊號 / 來源健康 / 模式切換
   台灣慣例：紅=漲/多、綠=跌/空；燈號另以文字（偏多/偏空/中性）標示
   ============================================================ */

/* ---- 專業版徽章（單一版本，權限由後台訂閱鎖控制） ---- */
.pro-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--blue), #7c5cff);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  letter-spacing: 1px;
}

/* ---- 交易時段狀態徽章 ---- */
.state-badge {
  background: var(--pill-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---- 燈號點 ---- */
.light-dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--muted2);
  flex: 0 0 auto;
}
.light-dot.up { background: var(--up); box-shadow: 0 0 8px var(--up-dim); }
.light-dot.down { background: var(--down); box-shadow: 0 0 8px var(--down-dim); }
.light-dot.flat { background: var(--muted2); }

/* ---- 0. 今日盤勢指揮中心 ---- */
.command-card {
  background: var(--hero-bg);
  border: 1px solid var(--border);
}
.cmd-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.hero-kicker {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 700;
}
.state-pill {
  background: var(--pill-bg);
  border: 1px solid var(--border);
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.state-pill.live {
  color: var(--up);
  border-color: var(--banner-border);
  background: var(--banner-bg);
}
.cmd-time { color: var(--muted2); font-size: 12px; margin-left: auto; }

.cmd-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.cmd-score-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--card);
}
.cmd-score-block.up { border-color: var(--banner-border); }
.cmd-score-block.down { border-color: rgba(55,214,122,0.5); }
.cmd-light-row { display: flex; align-items: center; gap: 8px; }
.cmd-label { font-size: 16px; font-weight: 700; }
.cmd-label { color: var(--text); }
.cmd-score-block.up .cmd-label { color: var(--up); }
.cmd-score-block.down .cmd-label { color: var(--down); }
.cmd-total {
  font-size: 52px;
  font-weight: 900;
  line-height: 1.05;
  margin: 6px 0 2px;
  letter-spacing: -1px;
}
.cmd-total.up { color: var(--up); }
.cmd-total.down { color: var(--down); }
.cmd-total.flat { color: var(--muted); }
.cmd-total-unit { font-size: 16px; font-weight: 600; color: var(--muted2); margin-left: 6px; }
.cmd-oneliner { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.cmd-combo { font-size: 12px; color: var(--muted); margin-top: 8px; }

.conf { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.conf-bar {
  display: inline-block;
  width: 60px; height: 6px;
  background: var(--card3);
  border-radius: 4px;
  overflow: hidden;
}
.conf-bar i { display: block; height: 100%; background: var(--blue); }

.cmd-advice { display: flex; flex-direction: column; gap: 8px; }
.cmd-headline { font-size: 16px; font-weight: 700; color: var(--text); }
.cmd-action, .cmd-riskline { font-size: 13px; color: var(--text); line-height: 1.5; }
.tag-action, .tag-risk {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 5px;
  margin-right: 7px;
}
.tag-action { background: var(--blue-dim); color: var(--blue); }
.tag-risk { background: rgba(217,165,20,0.14); color: #d9a514; }
.cmd-sub-title { font-size: 11px; color: var(--muted2); font-weight: 700; margin: 4px 0 3px; }
.cmd-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text); line-height: 1.6; }
.cmd-inv .cmd-list { color: var(--down); }
.cmd-levels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kl-chip {
  font-size: 12px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}
.kl-chip.up { color: var(--up); border-color: var(--banner-border); }
.kl-chip.down { color: var(--down); border-color: rgba(55,214,122,0.4); }
.kl-chip b { font-weight: 800; }

@media (min-width: 700px) {
  .cmd-main { grid-template-columns: 260px 1fr; }
}

/* ---- 0.5 四標的分數小卡 ---- */
.score-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 700px) { .score-cards { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .score-cards { grid-template-columns: repeat(5, 1fr); } }
.score-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.score-card.up { border-top: 3px solid var(--up); }
.score-card.down { border-top: 3px solid var(--down); }
.score-card.flat { border-top: 3px solid var(--muted2); }
.sc-top { display: flex; align-items: center; justify-content: space-between; }
.sc-name { font-size: 13px; font-weight: 700; }
.sc-approx {
  font-size: 10px;
  background: var(--card3);
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 5px;
}
.sc-total { font-size: 30px; font-weight: 900; line-height: 1.15; margin: 4px 0; }
.sc-total.up { color: var(--up); }
.sc-total.down { color: var(--down); }
.sc-total.flat { color: var(--muted); }
.sc-label { font-size: 12px; font-weight: 700; }
.sc-label.up { color: var(--up); }
.sc-label.down { color: var(--down); }
.sc-label.flat { color: var(--muted); }
.sc-price { font-size: 12px; color: var(--muted); margin-top: 4px; }
.sc-price .up { color: var(--up); }
.sc-price .down { color: var(--down); }
.sc-price .flat { color: var(--muted2); }
/* VIX 恐慌指數卡（情緒指標） */
.vix-card.vix-calm { border-top: 3px solid #3fb950; }
.vix-card.vix-warn { border-top: 3px solid #d29922; }
.vix-card.vix-fear { border-top: 3px solid #a371f7; }
.sc-total.vix-calm { color: #3fb950; }
.sc-total.vix-warn { color: #d29922; }
.sc-total.vix-fear { color: #a371f7; }
.sc-label.vix-calm { color: #3fb950; }
.sc-label.vix-warn { color: #d29922; }
.sc-label.vix-fear { color: #a371f7; }
.light-dot.vix-calm { background: #3fb950; }
.light-dot.vix-warn { background: #d29922; box-shadow: 0 0 8px rgba(210,153,34,.5); }
.light-dot.vix-fear { background: #a371f7; box-shadow: 0 0 8px rgba(163,113,247,.5); }
.sc-vix-note { font-size: 10.5px; color: var(--muted2); margin-top: 5px; line-height: 1.4; }

.sc-dual {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
}
.sc-dual-item b { font-weight: 800; }
.sc-dual-item b.up { color: var(--up); }
.sc-dual-item b.down { color: var(--down); }
.sc-dual-item b.flat { color: var(--muted); }

/* ---- 0.7 訊號因子拆解 ---- */
.sig-list { display: flex; flex-direction: column; gap: 8px; }
.sig-row {
  display: grid;
  grid-template-columns: 168px 1fr 46px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.sig-name { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sig-bar-area { position: relative; height: 12px; overflow: hidden; border-radius: 3px; }
.sig-axis {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}
.sig-bar {
  position: absolute;
  top: 2px; height: 8px;
  border-radius: 3px;
}
.sig-bar.up { left: 50%; background: var(--up); }
.sig-bar.down { right: 50%; background: var(--down); }
.sig-bar.flat { left: 50%; width: 2px !important; background: var(--muted2); }
.sig-score { text-align: right; font-weight: 800; }
.sig-score.up { color: var(--up); }
.sig-score.down { color: var(--down); }
.sig-score.flat { color: var(--muted); }
.sig-text {
  grid-column: 2 / -1;
  font-size: 12px;
  color: var(--muted);
  margin-top: -2px;
}

/* ---- 來源健康列 ---- */
.source-health {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 2px 4px;
  font-size: 12px;
}
.src-label { color: var(--muted2); font-weight: 700; }
.src-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
}
.src-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted2); }
.src-chip.ok .src-dot { background: var(--down-bright); }
.src-chip.err .src-dot { background: var(--up-bright); }
.src-chip.idle .src-dot { background: var(--orange); }

/* ---- 免責聲明 ---- */
.site-footer {
  margin-top: 20px;
  padding: 16px 2px 40px;
  border-top: 1px solid var(--border);
}
.disclaimer {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  background: var(--card2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.footer-sub { font-size: 11px; color: var(--muted2); margin-top: 8px; }

/* ============================================================
   手機 375px 單欄可讀（避免文字溢出 / 斷行）
   ============================================================ */
@media (max-width: 480px) {
  .status-row { flex-wrap: wrap; row-gap: 6px; }
  .cmd-time { margin-left: 0; width: 100%; }
  .cmd-total { font-size: 44px; }
  .sc-total { font-size: 26px; }
  .score-cards { grid-template-columns: repeat(2, 1fr); }
  .sig-row { grid-template-columns: 92px 1fr 40px; font-size: 12px; }
  .sig-text { padding-left: 0; }
  .source-health { font-size: 11px; }
  .src-chip { padding: 2px 8px; }
  .cmd-headline { font-size: 15px; }
}
@media (max-width: 380px) {
  .cmd-total { font-size: 40px; }
  .cmd-label { font-size: 15px; }
  .score-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .score-card { padding: 10px 11px; }
  .sc-name { font-size: 12px; }
  .kl-chip { font-size: 11px; padding: 2px 6px; }
  .mode-switch button { padding: 3px 9px; }
}

/* ============================================================
   v3：公告欄 / 訂閱者鎖定畫面 / 遮蔽卡（locked overlay）/ 自選標的工具列
   ============================================================ */

/* ---- 公告欄 ---- */
.announce-bar {
  max-width: 1180px;
  margin: 0 auto 10px;
  padding: 8px 14px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--up);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}

/* ---- 訂閱者限定鎖定畫面（整頁） ---- */
.lock-screen {
  max-width: 480px;
  margin: 80px auto;
  padding: 0 16px;
}
.lock-screen .lock-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 28px;
  text-align: center;
}
.lock-screen .lock-icon { font-size: 40px; margin-bottom: 12px; }
.lock-screen .lock-card h2 { margin: 0 0 8px; font-size: 18px; color: var(--text); }
.lock-screen .lock-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ---- 區塊遮蔽卡（premium paywall 風格）：模糊骨架 + 置中鎖定卡 ---- */
.locked-skeleton {
  filter: blur(4px);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}
.locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.12) 100%);
}
[data-theme="light"] .locked-overlay { background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(0,0,0,0.05) 100%); }
.locked-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 26px;
  text-align: center;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.locked-icon { font-size: 26px; margin-bottom: 6px; }
.locked-overlay.connecting .locked-card { border-color: var(--accent, #58a6ff); }
.locked-overlay.connecting .locked-icon { animation: pulse-conn 1.2s ease-in-out infinite; }
@keyframes pulse-conn { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.locked-title { font-weight: 700; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.locked-body { font-size: 12.5px; color: var(--muted); line-height: 1.6; }

#commandCard, #stockPanel, #signalsCard, #adrCard, #corrCard { position: relative; }

/* 分數小卡：鎖定版（只顯示總方向文字） */
.score-cards-locked-wrap { display: contents; }
.score-card-locked { text-align: center; }
.score-card-locked .sc-label { font-size: 16px; margin: 6px 0; }
.sc-locked-hint { font-size: 11px; color: var(--muted2); margin-top: 4px; }

/* 個股分時：鎖定版簡化列表 */
.sp-locked-list { padding: 8px 4px; }
.sp-locked-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 6px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sp-locked-row:last-child { border-bottom: none; }
.sp-locked-name .sp-code { margin-left: 6px; font-size: 11px; color: var(--muted2); }

/* 模式切換鈕鎖定樣式 */
.mode-switch button.locked-btn { opacity: 0.55; cursor: not-allowed; }
.mode-switch button.locked-btn:hover { border-color: var(--border); }

/* ---- 自選標的工具列 ---- */
.watchlist-card { padding: 14px 16px; }
.wl-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.wl-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.wl-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px; color: var(--text);
}
.wl-chip-remove {
  background: none; border: none; color: var(--muted2); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 4px; border-radius: 50%;
}
.wl-chip-remove:hover { color: var(--up); background: var(--card3); }
.wl-empty-hint { font-size: 12px; color: var(--muted2); }
.wl-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wl-input {
  background: var(--card2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 6px 10px; font-size: 13px; width: 200px;
}
.wl-btn {
  background: var(--card2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}
.wl-btn:hover { border-color: var(--muted2); }
.wl-btn-primary { border-color: var(--up); color: var(--up); }
.wl-btn-ghost { color: var(--muted); }
.wl-count { font-size: 12px; color: var(--muted2); }
.wl-table .wl-code { margin-left: 6px; font-size: 11px; color: var(--muted2); }
.wl-row { cursor: pointer; }
.wl-row:hover { background: var(--card2); }
.wl-row.active { background: var(--card3); }
.wl-detail { margin-top: 12px; }
.wl-detail-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }

/* Toast 提示 */
.wl-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card3); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 8px; font-size: 13px; opacity: 0; z-index: 999;
  transition: opacity 0.25s, transform 0.25s; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.wl-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Mobile RWD：工具列可換行，不破版 ---- */
@media (max-width: 480px) {
  .wl-add-row { width: 100%; }
  .wl-input { width: 100%; flex: 1 1 100%; }
  .wl-btn, .wl-count { flex: 0 0 auto; }
  .locked-card { max-width: 90vw; padding: 14px 18px; }
}

/* ============================================================
   v4 六大模組樣式（台股紅漲綠跌；沿用既有 tokens）
   ============================================================ */
#rangeMapCard, #orderflowCard, #institutionCard, #sfRadarCard,
#optionsWallCard, #nightRelayCard { position: relative; }

.mod-meta { font-size: 12px; color: var(--muted); margin: 2px 0 10px; }
.mod-note { font-size: 11.5px; color: var(--muted2); line-height: 1.6; margin-top: 10px; }
.stale-badge, .closed-badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; border: 1px solid var(--border);
}
.stale-badge { color: var(--up); border-color: var(--up-dim); background: var(--up-dim); }
.closed-badge { color: var(--muted); background: var(--card3); }

/* 鎖卡容器（模組整卡上鎖時） */
.locked-host { position: relative; min-height: 160px; }
.locked-blur-placeholder {
  height: 160px; border-radius: 10px;
  background: repeating-linear-gradient(135deg, var(--card2) 0 12px, var(--card3) 12px 24px);
  opacity: .5; filter: blur(1px);
}

/* KV 小方格 */
.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0 8px; }
.kv {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 11px; display: flex; flex-direction: column; gap: 3px;
}
.kv span { font-size: 11.5px; color: var(--muted); }
.kv b { font-size: 16px; font-weight: 800; }
.kv b.up { color: var(--up); } .kv b.down { color: var(--down); } .kv b.flat { color: var(--text); }

/* 估算值警語條 */
.est-banner {
  font-size: 12px; font-weight: 700; color: var(--up);
  background: var(--up-dim); border: 1px solid var(--up-dim);
  border-radius: 8px; padding: 7px 11px; margin-bottom: 10px; line-height: 1.5;
}
.warn-badge {
  font-size: 12.5px; font-weight: 700; color: var(--up);
  background: var(--up-dim); border-radius: 8px; padding: 8px 11px; margin: 8px 0;
}

/* 進度條 */
.prog { height: 7px; border-radius: 4px; background: var(--card3); overflow: hidden; margin-top: 6px; }
.prog i { display: block; height: 100%; background: var(--up); }
.prog-cap { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* M2 波幅尺標 */
.range-scale { margin: 8px 0 12px; }
.range-track {
  position: relative; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, var(--down-dim), var(--card3), var(--up-dim));
}
.range-tick.base { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--muted); transform: translateX(-1px); }
.range-dot { position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%; transform: translateX(-6px); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--border); }
.range-dot.up { background: var(--up); } .range-dot.down { background: var(--down); } .range-dot.flat { background: var(--muted); }
.range-labels { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; font-weight: 700; }
.range-labels .muted { color: var(--muted); font-weight: 500; }

/* M5 力道圖 */
.of-chart { width: 100%; height: 70px; display: block; }

/* sparkline */
.spark { vertical-align: middle; }
.spark.up { color: var(--up); } .spark.down { color: var(--down); }
.spark-empty { color: var(--muted2); }
.spark-cell { text-align: center; }

/* M1 法人 */
.inst-sig { font-size: 13px; margin-bottom: 10px; }
.inst-sig .sig { font-weight: 800; }
.sig.up { color: var(--up); } .sig.down { color: var(--down); } .sig.flat { color: var(--muted); }
.inst-block { margin-bottom: 12px; }
.inst-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px;
  font-weight: 700; font-size: 13.5px; margin-bottom: 6px;
}
.inst-retail { font-size: 12px; font-weight: 700; }
.inst-retail.up { color: var(--up); } .inst-retail.down { color: var(--down); }
table.inst-tbl { font-size: 12.5px; }
table.inst-tbl td, table.inst-tbl th { padding: 6px 8px; }

/* M6 股期雷達 */
table.sf-tbl { font-size: 12.5px; }
table.sf-tbl td, table.sf-tbl th { padding: 6px 7px; }
.sf-code { color: var(--muted); font-size: 11px; margin-left: 5px; }
.sf-bd { color: var(--muted2); cursor: help; margin-left: 5px; }

/* M3 選擇權壓力牆 */
.ow-legend { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; margin: 8px 0 4px; }
.ow-legend .muted { color: var(--muted); font-weight: 500; }
.ow-wall { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; }
.ow-row { display: grid; grid-template-columns: 1fr 64px 1fr; align-items: center; gap: 4px; font-size: 11.5px; }
.ow-row.ow-ref { background: var(--card3); border-radius: 5px; }
.ow-put { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.ow-call { display: flex; align-items: center; gap: 5px; }
.ow-bar { height: 11px; border-radius: 3px; display: inline-block; min-width: 1px; }
.ow-bar.up { background: var(--up); } .ow-bar.down { background: var(--down); }
.ow-num { color: var(--muted); min-width: 40px; }
.ow-put .ow-num { text-align: right; }
.ow-strike { text-align: center; font-weight: 700; color: var(--text); }
.ow-strike.res { color: var(--up); text-shadow: 0 0 1px var(--up-dim); }
.ow-strike.sup { color: var(--down); }
.pc-spark { font-size: 12px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 8px; }

/* M4 夜盤接力儀 */
.nr-quote { margin: 6px 0 10px; }
.nr-main { display: flex; align-items: baseline; gap: 12px; }
.nr-price { font-size: 30px; font-weight: 900; }
.nr-pct { font-size: 16px; font-weight: 800; }
.nr-main.up .nr-price, .nr-main.up .nr-pct { color: var(--up); }
.nr-main.down .nr-price, .nr-main.down .nr-pct { color: var(--down); }
.nr-main.flat .nr-price { color: var(--text); }
.nr-hl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.nr-relay { font-size: 13.5px; font-weight: 700; margin: 8px 0; }
.nr-scenario { font-size: 12.5px; color: var(--text); line-height: 1.6; background: var(--card2); border-radius: 8px; padding: 9px 12px; }
.nr-tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--card3); border-radius: 5px; padding: 1px 7px; margin-right: 7px; }
.nr-locked { position: relative; min-height: 96px; margin: 8px 0; }
.nr-locked-ph { height: 96px; border-radius: 8px; background: var(--card2); opacity: .4; }
.us3-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.us3-card { background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; text-align: center; }
.us3-name { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.us3-val { font-size: 15px; font-weight: 800; }
.us3-pct { font-size: 12px; font-weight: 700; }
.us3-val.up, .us3-pct.up { color: var(--up); }
.us3-val.down, .us3-pct.down { color: var(--down); }
.us3-val.flat { color: var(--text); }

/* RWD */
@media (max-width: 640px) {
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
  .us3-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .us3-val { font-size: 13px; }
  .nr-price { font-size: 24px; }
  .ow-row { grid-template-columns: 1fr 52px 1fr; font-size: 10.5px; }
  .ow-num { min-width: 30px; font-size: 10px; }
  table.inst-tbl, table.sf-tbl { font-size: 11px; }
  table.inst-tbl td, table.inst-tbl th, table.sf-tbl td, table.sf-tbl th { padding: 5px 4px; }
}

/* ---------- 0.6 快速掃盤：關鍵價位階梯＋期權籌碼速覽 ---------- */
.qg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qg-card { min-width: 0; }
.qg-ladder { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.qg-lv {
  display: grid; grid-template-columns: 1fr 84px 64px; align-items: center;
  gap: 8px; padding: 5px 10px; border-radius: 8px;
  background: var(--panel-2, rgba(255,255,255,0.03));
  border-left: 3px solid transparent; font-size: 12.5px;
}
.qg-lv.up { border-left-color: var(--up); }
.qg-lv.down { border-left-color: var(--down); }
.qg-lv.up .qg-lv-diff { color: var(--up); }
.qg-lv.down .qg-lv-diff { color: var(--down); }
.qg-lv.now {
  background: var(--accent-dim, rgba(90,140,255,0.16));
  border: 1px solid var(--accent, #5a8cff); border-left-width: 3px;
  font-weight: 700;
}
.qg-lv-name { color: var(--text-2, #aab); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qg-lv.now .qg-lv-name { color: var(--text, #eef); }
.qg-lv-val { text-align: right; font-variant-numeric: tabular-nums; }
.qg-lv-diff { text-align: right; font-size: 11px; color: var(--text-3, #778); font-variant-numeric: tabular-nums; }
.qg-tag {
  font-style: normal; font-size: 9.5px; margin-left: 5px; padding: 1px 5px;
  border-radius: 6px; background: rgba(255, 193, 7, 0.14); color: #e6b34a;
  border: 1px solid rgba(230, 179, 74, 0.35); vertical-align: 1px;
}
.qg-chips { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.qg-row {
  display: grid; grid-template-columns: 1fr 92px minmax(0, 110px); align-items: center;
  gap: 8px; padding: 6px 10px; border-radius: 8px;
  background: var(--panel-2, rgba(255,255,255,0.03)); font-size: 12.5px;
}
.qg-row-name { color: var(--text-2, #aab); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qg-row-val { text-align: right; font-variant-numeric: tabular-nums; }
.qg-row-val.up { color: var(--up); }
.qg-row-val.down { color: var(--down); }
.qg-row-sub { text-align: right; font-size: 10.5px; color: var(--text-3, #778); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qg-note { margin-top: 8px; font-size: 10.5px; color: var(--text-3, #778); line-height: 1.5; }
@media (max-width: 900px) {
  .qg-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .qg-lv { grid-template-columns: minmax(0, 1fr) 74px 54px; font-size: 11.5px; padding: 5px 8px; }
  .qg-row { grid-template-columns: minmax(0, 1fr) 78px 82px; font-size: 11.5px; padding: 5px 8px; }
  .qg-lv-name, .qg-row-name { white-space: normal; line-height: 1.3; word-break: break-all; }
  .qg-lv-diff { font-size: 10px; }
  .qg-row-sub { font-size: 10px; }
  .qg-tag { font-size: 9px; padding: 1px 4px; margin-left: 3px; }
}

/* ---------- 首屏一眼看完：指揮中心區壓縮 ---------- */
.qg-bias {
  font-style: normal; font-size: 10.5px; font-weight: 600;
  margin-left: 8px; padding: 1px 6px; border-radius: 6px;
  background: rgba(255,255,255,0.06); vertical-align: 1px;
}
.qg-bias.up { color: var(--up); background: var(--up-dim); }
.qg-bias.down { color: var(--down); background: var(--down-dim); }

.cmd-more { margin: 6px 0 2px; }
.cmd-more summary {
  cursor: pointer; list-style: none; user-select: none;
  font-size: 11.5px; color: var(--text-3, #99a); padding: 3px 0;
}
.cmd-more summary::-webkit-details-marker { display: none; }
.cmd-more summary:hover { color: var(--text-2, #bbc); }
.cmd-more[open] summary { color: var(--text-2, #bbc); }

/* 壓縮：指揮中心卡 */
#commandCard { padding: 12px 16px; }
#commandCard .cmd-main { gap: 12px; }
#commandCard .cmd-total { font-size: 34px; line-height: 1.1; }
#commandCard .cmd-score-block { padding: 10px 12px; }
#commandCard .cmd-headline { font-size: 14.5px; margin-bottom: 4px; }
#commandCard .cmd-action, #commandCard .cmd-riskline { margin: 3px 0; font-size: 12px; }
#commandCard .cmd-levels { margin-top: 6px; }
#commandCard .cmd-oneliner { font-size: 11.5px; }
#commandCard .cmd-combo { font-size: 11px; margin-top: 4px; }

/* 壓縮：分數小卡 */
#scoreCards .score-card { padding: 8px 11px; }
#scoreCards .sc-total { font-size: 22px; margin: 2px 0; }
#scoreCards .sc-label { font-size: 11px; }
#scoreCards .sc-price, #scoreCards .sc-dual { font-size: 11px; }

/* 壓縮：快速掃盤 */
.qg-lv { padding: 3px 10px; font-size: 12px; }
.qg-row { padding: 4px 10px; font-size: 12px; }
.qg-ladder, .qg-chips { gap: 2px; margin-top: 6px; }
.qg-note { margin-top: 6px; font-size: 10px; }
.qg-card { padding: 12px 14px; }

/* 首屏再壓縮：行高與間距 */
.qg-lv { padding: 2px 10px; line-height: 1.45; }
.qg-row { padding: 3px 10px; }
#quickGlance .qg-card { padding: 10px 14px; }
#quickGlance .qg-note { margin-top: 5px; line-height: 1.4; }
.site-header { padding: 2px 2px 8px; }
.site-sub { margin-top: 1px; font-size: 11.5px; }
.quick-nav { margin-bottom: 8px; padding: 6px 12px; }
.main-grid { gap: 10px; }
#commandCard .cmd-head { margin-bottom: 6px; }

/* 波幅緣估算帶（移出階梯） */
.qg-band {
  margin-top: 6px; padding: 4px 10px; font-size: 11.5px;
  color: var(--muted); background: rgba(255,255,255,0.03);
  border: 1px dashed var(--border); border-radius: 8px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.qg-band-label { font-weight: 700; color: var(--muted2); }
.qg-band b { font-weight: 700; }
.qg-band b.up { color: var(--up); }
.qg-band b.down { color: var(--down); }

/* ---------- 全球指數地球視圖 ---------- */
.gi-map svg { display: block; width: 100%; height: auto; }
.gi-frame { fill: rgba(255,255,255,0.02); stroke: var(--border); stroke-width: 1; }
.gi-grat { stroke: rgba(255,255,255,0.05); stroke-width: 1; }
.gi-flag { font-size: 13px; }
.gi-pct { font-size: 9.5px; font-weight: 700; fill: var(--muted); }
.gi-pct.up { fill: var(--up); }
.gi-pct.down { fill: var(--down); }
.gi-dot { fill: var(--muted); }
.gi-dot.up { fill: var(--up); }
.gi-dot.down { fill: var(--down); }
.gi-dot.tw { stroke: #fff; stroke-width: 2; }
.gi-mk { cursor: default; }
.gi-land { fill: rgba(140, 170, 220, 0.30); stroke: rgba(170, 200, 245, 0.45); stroke-width: 0.8; }
.gi-fimg { width: 18px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 2px; }
.gi-fsvg { opacity: 0.95; }
.gi-ring { fill: none; stroke: #fff; stroke-width: 1.8; animation: giPulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.gi-ring2 { stroke-width: 1.2; animation-delay: 0.8s; }
.gi-live { fill: rgba(255, 200, 60, 0.22); stroke: rgba(255, 200, 60, 0.85); stroke-width: 1.2; animation: giGlow 1.4s ease-in-out infinite alternate; }
.gi-dot.on { filter: drop-shadow(0 0 4px rgba(255, 210, 80, 0.9)); }
@keyframes giGlow { from { opacity: 0.55; } to { opacity: 1; } }
.gi-legend { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.gi-st { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #555a66; margin-right: 3px; flex: none; }
.gi-st.on { background: #ffc83c; box-shadow: 0 0 6px rgba(255, 200, 60, 0.9); animation: giGlow 1.4s ease-in-out infinite alternate; }
.gi-name .gi-st { margin-right: 5px; }
.gi-rt { display: inline-block; margin-left: 4px; padding: 0 4px; font-size: 9.5px; font-weight: 800; color: #0b0d12; background: #ffc83c; border-radius: 4px; vertical-align: 1px; }
.gi-next { margin-left: 8px; padding: 1px 7px; border-radius: 8px; background: rgba(255,255,255,0.06); color: var(--muted); }
.gi-hint-m { display: none; margin-left: auto; color: var(--muted2); }
@keyframes giPulse {
  0%   { opacity: 0.95; transform: scale(0.55); }
  70%  { opacity: 0.25; transform: scale(1.25); }
  100% { opacity: 0;    transform: scale(1.45); }
}

.gi-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px 14px; margin-top: 10px; align-items: start;
}
.gi-region {
  font-size: 11px; font-weight: 800; color: var(--muted2);
  letter-spacing: 1px; padding: 2px 10px 4px;
  border-bottom: 1px solid var(--border); margin-bottom: 2px;
}
.gi-row {
  display: grid; grid-template-columns: 1fr 76px 66px 60px;
  gap: 6px; align-items: baseline; padding: 3px 10px;
  border-radius: 6px; font-size: 12px;
}
.gi-row:nth-child(even) { background: rgba(255,255,255,0.02); }
.gi-name { color: var(--text-2, #ccd); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gi-val { font-variant-numeric: tabular-nums; text-align: right; }
.gi-chg, .gi-p { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.gi-chg.up, .gi-p.up { color: var(--up); }
.gi-chg.down, .gi-p.down { color: var(--down); }
.gi-chg.flat, .gi-p.flat { color: var(--muted); }

@media (max-width: 900px) {
  .gi-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .gi-map { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 14px; }
  .gi-map svg { min-width: 720px; }
  .gi-ring { stroke-width: 2.6; }
  .gi-ring2 { stroke-width: 1.8; }
  .gi-hint-m { display: inline; }
}
@media (max-width: 480px) {
  .gi-row { grid-template-columns: 1fr 70px 56px 50px; font-size: 11px; padding: 3px 5px; }
  .gi-flag { font-size: 16px; }
  .gi-fimg { width: 15px; height: 10px; }
  .gi-name .gi-st { margin-right: 3px; }
  .gi-rt { font-size: 9px; padding: 0 3px; margin-left: 3px; }
}

/* ===== 0.0 一分鐘下單卡 ===== */
.decision-card { border: 1px solid rgba(255,255,255,0.14); background:
  linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015)); }
.dc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.dc-head .card-title { margin: 0; }
.dc-sess { font-size: 12px; padding: 2px 9px; border-radius: 9px;
  background: rgba(255,255,255,0.08); color: var(--muted); }
.dc-fresh { font-size: 11px; padding: 2px 8px; border-radius: 9px;
  background: rgba(255,255,255,0.06); color: var(--muted2); }
.dc-fresh.on { background: rgba(255,200,60,0.16); color: #ffc83c;
  box-shadow: 0 0 8px rgba(255,200,60,0.35); }

.dc-main { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: center; }
.dc-main.dc-off { opacity: 0.5; }

.dc-side { text-align: center; padding: 14px 8px; border-radius: 12px;
  background: rgba(255,255,255,0.04); }
.dc-target { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.dc-dir { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: 2px; }
.dc-dir.up { color: var(--up); } .dc-dir.down { color: var(--down); }
.dc-dir.flat { color: var(--muted); }
.dc-stars { font-size: 15px; color: #ffc83c; letter-spacing: 2px; margin-top: 2px; }

.dc-entry { font-size: 21px; font-weight: 700; margin-bottom: 12px; }
.dc-plan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 460px; }
.dc-cell { background: rgba(255,255,255,0.05); border-radius: 10px; padding: 9px 12px; }
.dc-cell span { display: block; font-size: 11px; color: var(--muted2); margin-bottom: 2px; }
.dc-cell b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dc-risk { margin-top: 10px; font-size: 13px; color: var(--muted); }
.dc-risk.warn { color: #ffc83c; }
.dc-why { margin-top: 8px; font-size: 12.5px; color: var(--muted2); line-height: 1.6; }

.dc-gate { margin-top: 14px; padding: 9px 13px; border-radius: 10px; font-size: 13.5px;
  background: rgba(255,200,60,0.10); color: #ffc83c;
  border-left: 3px solid rgba(255,200,60,0.55); }
.dc-inval { margin-top: 8px; font-size: 12px; color: var(--muted2); }
.dc-foot { margin-top: 12px; padding-top: 10px; font-size: 11px; color: var(--muted2);
  line-height: 1.6; border-top: 1px solid rgba(255,255,255,0.07); }

@media (max-width: 640px) {
  .dc-main { grid-template-columns: 1fr; gap: 14px; }
  .dc-side { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px; }
  .dc-target { margin: 0; }
  .dc-dir { font-size: 30px; }
  .dc-entry { font-size: 18px; }
  .dc-cell b { font-size: 17px; }
  .dc-plan { max-width: none; }
}

/* ===== 0.1 操盤台 ===== */
.dk-count { font-size: 12px; padding: 2px 9px; border-radius: 9px;
  background: rgba(255,255,255,0.07); color: var(--muted2); }
.dk-count.on { background: rgba(243,80,106,0.16); color: var(--up); }
.dk-wrap { overflow-x: auto; margin-top: 4px; }
.dk-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dk-table th { font-size: 11px; font-weight: 600; color: var(--muted2); text-align: left;
  padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,0.10); white-space: nowrap; }
.dk-table th.num, .dk-table td.num { text-align: right; }
.dk-table td { padding: 10px; font-size: 14.5px; border-bottom: 1px solid rgba(255,255,255,0.05);
  white-space: nowrap; }
.dk-table tr.dk-dim td { opacity: 0.42; }
.dk-name b { display: block; font-size: 15px; }
.dk-name span { display: block; font-size: 10.5px; color: var(--muted2); margin-top: 1px; }
.dk-dir { font-size: 16px; font-weight: 700; }
.dk-dir.up { color: var(--up); } .dk-dir.down { color: var(--down); }
.dk-dir.flat { color: var(--muted2); }
.dk-table td.strong { font-size: 16px; font-weight: 700; }
.dk-u { font-size: 10px; color: var(--muted2); }
.dk-fresh { font-size: 10.5px; padding: 2px 7px; border-radius: 8px;
  background: rgba(255,255,255,0.06); color: var(--muted2); }
.dk-fresh.on { background: rgba(255,200,60,0.16); color: #ffc83c; }
.dk-sub td { padding: 0 10px 9px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.dk-why { font-size: 11.5px; color: var(--muted2); }
.dk-warn { font-size: 11.5px; color: #ffc83c; margin-left: 12px; }
.dk-focus { margin-top: 12px; padding: 8px 12px; border-radius: 9px; font-size: 12.5px;
  background: rgba(255,255,255,0.045); color: var(--muted); }
@media (max-width: 720px) { .dk-table td, .dk-table th { padding: 8px 7px; font-size: 13px; } }

/* ==========================================================================
   成本／口數／健康／紀錄／回測
   注意：台股 紅=漲 綠=跌。此區的「品質警示」刻意避開紅綠，改用琥珀與紫，
   以免和漲跌色混淆。--orange = 注意，--alert = 嚴重。
   ========================================================================== */
:root {
  --alert: #c77dff;
  --alert-dim: rgba(199, 125, 255, 0.14);
  --orange-dim: rgba(255, 159, 67, 0.14);
  --good: #5ac8fa;
  --good-dim: rgba(90, 200, 250, 0.13);
}

.dk-good  { color: var(--good); }
.dk-warnv { color: var(--orange); }
.dk-bad   { color: var(--alert); }

.dk-cost {
  display: block; margin-top: 3px; color: var(--muted2);
  font-size: 11.5px; letter-spacing: .01em;
}

.dk-acct {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  margin: 8px 0 10px; padding: 8px 12px; border-radius: 8px;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px;
}
.dk-acct-def {
  padding: 2px 8px; border-radius: 999px;
  background: var(--orange-dim); color: var(--orange); font-size: 11.5px;
}

.dk-preview {
  margin: 8px 0; padding: 9px 12px; border-radius: 8px;
  background: var(--orange-dim); border: 1px solid rgba(255, 159, 67, .45);
  color: var(--orange); font-size: 12.5px; line-height: 1.6;
}
.dk-costnote {
  margin-top: 8px; color: var(--muted2); font-size: 11.5px; line-height: 1.6;
}

/* ---- 管線健康 ---- */
.ph-badge {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.ph-badge.ph-ok   { background: var(--good-dim);   color: var(--good); }
.ph-badge.ph-warn { background: var(--orange-dim); color: var(--orange); }
.ph-badge.ph-bad  { background: var(--alert-dim);  color: var(--alert); }
.ph-halt {
  padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 12px;
  background: var(--alert-dim); color: var(--alert);
}
.ph-detail { margin: 6px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.ph-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ph-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 11px; border-radius: 7px;
  background: var(--card2); border: 1px solid var(--border); font-size: 12.5px;
}
.ph-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted2); flex: none; }
.ph-list li.ph-ok   .ph-dot { background: var(--good); }
.ph-list li.ph-idle .ph-dot { background: var(--muted2); }
.ph-list li.ph-warn .ph-dot { background: var(--orange); }
.ph-list li.ph-bad  .ph-dot { background: var(--alert); }
.ph-name { min-width: 108px; font-weight: 650; }
.ph-msg  { color: var(--muted); flex: 1; }
.ph-rate { color: var(--muted2); font-variant-numeric: tabular-nums; }

/* ---- 訊號紀錄 ---- */
.jn-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 10px; font-size: 13px; }
.jn-stats b { color: var(--text); font-size: 15px; }
.jn-insuff {
  margin: 6px 0 10px; padding: 9px 12px; border-radius: 8px;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--muted); font-size: 12.5px; line-height: 1.7;
}
.jn-table td { font-size: 12.5px; }
.jn-win  { color: var(--good); font-weight: 650; }
.jn-loss { color: var(--alert); font-weight: 650; }
.jn-open { color: var(--muted2); }
.jn-flat { color: var(--muted); }

/* ---- 回測 ---- */
.bt-list { display: grid; gap: 12px; }
.bt-item { padding: 12px 14px; border-radius: 10px; background: var(--card2); border: 1px solid var(--border); }
.bt-h {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-weight: 700; font-size: 14px; margin-bottom: 9px;
}
.bt-badge { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.bt-badge.bt-ok   { background: var(--good-dim);   color: var(--good); }
.bt-badge.bt-warn { background: var(--orange-dim); color: var(--orange); }
.bt-badge.bt-bad  { background: var(--alert-dim);  color: var(--alert); }
.bt-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px; margin-bottom: 9px;
}
.bt-grid > div {
  padding: 7px 9px; border-radius: 7px; background: var(--card); border: 1px solid var(--border);
}
.bt-grid i { display: block; font-style: normal; color: var(--muted2); font-size: 11px; margin-bottom: 2px; }
.bt-grid b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.bt-grid small { display: block; color: var(--muted2); font-size: 10.5px; margin-top: 1px; }
.bt-pos { color: var(--good); }
.bt-neg { color: var(--alert); }
.bt-years { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted2); margin-bottom: 8px; }
.bt-ylabel { margin-right: 4px; }
.bt-y {
  padding: 2px 6px; border-radius: 5px; font-variant-numeric: tabular-nums;
  cursor: help; font-size: 11px;
}
.bt-y.pos { background: var(--good-dim);  color: var(--good); }
.bt-y.neg { background: var(--alert-dim); color: var(--alert); }
.bt-verdict {
  padding: 8px 11px; border-radius: 7px; font-size: 12.5px; line-height: 1.7;
  background: var(--card); border-left: 3px solid var(--border);
}
.bt-verdict.bt-ok   { border-left-color: var(--good); }
.bt-verdict.bt-warn { border-left-color: var(--orange); }
.bt-verdict.bt-bad  { border-left-color: var(--alert); }
.bt-note { margin-top: 6px; color: var(--muted2); font-size: 11.5px; line-height: 1.65; }

@media (max-width: 640px) {
  .dk-acct { gap: 8px; font-size: 11.5px; }
  .bt-grid { grid-template-columns: repeat(2, 1fr); }
  .ph-name { min-width: 90px; }
}

/* 亮色模式：加深飽和度，白底才看得清楚 */
html[data-theme="light"] {
  --alert: #8e2de2;
  --alert-dim: rgba(142, 45, 226, 0.10);
  --orange-dim: rgba(214, 122, 0, 0.12);
  --good: #0a7ea4;
  --good-dim: rgba(10, 126, 164, 0.10);
}


/* 表格內的次要說明（佔1R x%、毛 xR、/口）要和主數字分行，
   否則在窄欄位會黏成一團看不懂。 */
.dk-table .num .dk-u {
  display: block;
  margin-top: 2px;
  color: var(--muted2);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.3;
}

/* 已移出核心清單的標的說明。用中性灰藍，不用紅綠（避免和台股漲跌色衝突）。 */
.dk-excl {
  margin: 8px 14px 0;
  padding: 9px 12px;
  border-left: 3px solid var(--muted2);
  border-radius: 4px;
  background: var(--card2);
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}
.dk-excl b { color: var(--text); }
.dk-excl-d { margin-top: 3px; color: var(--muted2); font-size: 11.5px; }

/* ---------- 會員登入視窗 ---------- */
.login-modal[hidden] { display: none; }
.login-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-box {
  background: var(--card); color: var(--text);
  border: 1px solid var(--card3);
  border-radius: 14px; padding: 22px 24px;
  width: 100%; max-width: 360px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.login-box h3 { margin: 0 0 14px; font-size: 17px; }
.login-field {
  display: block; margin-bottom: 12px;
  font-size: 13px; color: var(--muted);
}
.login-field input {
  display: block; width: 100%; margin-top: 5px;
  padding: 9px 11px; font-size: 15px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--card3); border-radius: 8px;
  box-sizing: border-box;
}
.login-field input:focus { outline: 2px solid var(--up-dim); border-color: var(--up); }
.login-err {
  margin: 4px 0 8px; padding: 7px 10px;
  background: var(--up-dim); color: var(--up-bright);
  border-radius: 8px; font-size: 13px;
}
.login-actions { display: flex; gap: 10px; margin-top: 12px; }
.login-primary {
  flex: 1; padding: 9px 0; font-size: 15px; font-weight: 700;
  background: var(--up); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
}
.login-primary:disabled { opacity: 0.6; cursor: wait; }
.login-hint { margin: 12px 0 0; font-size: 12px; color: var(--muted2); line-height: 1.5; }
.login-btn.logged-in { color: var(--up-bright); }
