/* ═══════════════════════════════════════════════════════
   market-pulse.css — 市場溫度計
   topbar 比重條 + modal 完整樣式
   ═══════════════════════════════════════════════════════ */

/* ── Topbar 比重條 ── */
.mp-topbar-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 0 8px;
  height: 100%;
  border-left: 1px solid var(--border);
  transition: background .15s;
}
.mp-topbar-wrap:hover { background: var(--bg2); }

.mp-topbar-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.mp-bar-track {
  width: 80px;
  height: 5px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-shrink: 0;
}
/* topbar bar: 單一 gradient div，由 JS 動態設定 background */
.mp-bar-gradient { height: 100%; transition: background .4s ease; }
.mp-bar-divider  { position: absolute; top: 20%; bottom: 20%; width: 1px; background: rgba(255,255,255,.2); }"
.mp-bar-bull, .mp-bar-neut, .mp-bar-bear { display: none; }

.mp-pct-bull { font-size: 11px; font-weight: 700; color: var(--down); }
.mp-pct-neut { font-size: 11px; font-weight: 600; color: var(--muted); }
.mp-pct-sep  { font-size: 11px; color: var(--hint); }
.mp-pct-bear { font-size: 11px; font-weight: 700; color: var(--up); }

.mp-quality-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(38,166,154,.12);
  color: var(--up);
  border: 1px solid rgba(38,166,154,.2);
  flex-shrink: 0;
}
.mp-quality-badge.fail {
  background: rgba(239,83,80,.1);
  color: var(--down);
  border-color: rgba(239,83,80,.2);
}
.mp-topbar-loading {
  font-size: 11px;
  color: var(--hint);
  padding: 0 8px;
}

/* ── Modal 遮罩 ── */
#mpModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: rgba(0,0,0,.65);
  align-items: flex-start;
  justify-content: center;
  padding-top: 56px;
}
#mpModal.active { display: flex; }

/* ── Modal 容器 ── */
.mp-modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: 540px;
  max-width: 96vw;
  max-height: calc(100vh - 80px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Modal header ── */
.mp-modal-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mp-modal-title { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.mp-modal-date  { font-size: 11px; color: var(--muted); }
.mp-modal-close {
  background: none; border: none;
  color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 6px;
  transition: color .15s;
}
.mp-modal-close:hover { color: var(--text); }

/* ── Tab bar ── */
.mp-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mp-tab {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 12px;
  padding: 8px 14px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
  font-family: inherit;
}
.mp-tab:hover  { color: var(--text); }
.mp-tab.active { color: var(--text); border-bottom-color: var(--down); }

/* ── Modal body ── */
.mp-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.mp-modal-body::-webkit-scrollbar { width: 3px; }
.mp-modal-body::-webkit-scrollbar-thumb { background: var(--border2); }

/* ── 通用 card ── */
.mp-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
}
.mp-card-label {
  font-size: 10px; color: var(--muted);
  font-weight: 600; letter-spacing: .06em;
  margin-bottom: 8px;
}

/* ── 多空比重橫條 ── */
.mp-ratio-bar {
  height: 22px; border-radius: 5px; overflow: hidden;
  position: relative; margin-bottom: 6px;
}
.mp-ratio-gradient {
  position: absolute; inset: 0;
  transition: background .5s ease;
}
.mp-ratio-divider {
  position: absolute; top: 15%; bottom: 15%; width: 1.5px;
  background: rgba(255,255,255,.28); border-radius: 1px;
}
.mp-ratio-bull {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 700; color: #fff;
}
.mp-ratio-neut {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,.7);
}
.mp-ratio-bear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 700; color: #fff;
}
.mp-ratio-foot {
  display: flex; justify-content: space-between; font-size: 11px;
}
.mp-ratio-foot .bull { color: var(--down); font-weight: 600; }
.mp-ratio-foot .bear { color: var(--up);   font-weight: 600; }
.mp-ratio-foot .cnt  { color: var(--hint); }

/* ── 最強訊號 2欄 ── */
.mp-sig2 { display: flex; gap: 8px; }
.mp-sig-chip {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px;
}
.mp-sig-chip-label { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: .04em; margin-bottom: 3px; }
.mp-sig-chip-id    { font-size: 15px; font-weight: 700; margin-bottom: 1px; }
.mp-sig-chip-id.bull { color: var(--down); }
.mp-sig-chip-id.bear { color: var(--up); }
.mp-sig-chip-name  { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.mp-sig-chip-count { font-size: 10px; color: var(--hint); }

/* ── 趨勢小圖 ── */
.mp-trend-bars {
  display: flex; align-items: flex-end; gap: 4px; height: 44px;
}
.mp-trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mp-trend-bar { width: 100%; border-radius: 2px 2px 0 0; }
.mp-trend-date { font-size: 9px; color: var(--hint); }

/* ── 訊號分布長條 ── */
.mp-bar-chart { display: flex; flex-direction: column; gap: 5px; }
.mp-bc-row    { display: flex; align-items: center; gap: 7px; }
.mp-bc-id     { font-size: 11px; font-weight: 700; width: 34px; flex-shrink: 0; }
.mp-bc-id.bull { color: var(--down); }
.mp-bc-id.bear { color: var(--up); }
.mp-bc-track  { flex: 1; height: 10px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.mp-bc-fill   { height: 100%; border-radius: 3px; }
.mp-bc-num    { font-size: 10px; color: var(--hint); width: 42px; text-align: right; flex-shrink: 0; }

/* ── 分隔線 ── */
.mp-divider { height: 1px; background: var(--border); }

/* ── 系統自動文字分析 ── */
.mp-auto-analysis { display: flex; flex-direction: column; gap: 9px; }
.mp-aa-section {
  border-left: 2px solid var(--border2);
  padding-left: 10px;
}
.mp-aa-section.bear   { border-left-color: var(--up); }
.mp-aa-section.neutral { border-left-color: #f59e0b; }
.mp-aa-section.bull   { border-left-color: var(--down); }
.mp-aa-title {
  font-size: 10px; font-weight: 600; color: var(--muted);
  margin-bottom: 3px; text-transform: uppercase; letter-spacing: .05em;
}
.mp-aa-text  { font-size: 12px; color: var(--text); line-height: 1.7; }
.mp-aa-hl    { font-weight: 600; }
.mp-aa-hl.bull { color: var(--down); }
.mp-aa-hl.bear { color: var(--up); }
.mp-aa-hl.warn { color: #f59e0b; }

/* ── Verdict ── */
.mp-verdict {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.mp-verdict-icon  { font-size: 20px; flex-shrink: 0; }
.mp-verdict-main  { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.mp-verdict-sub   { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ── AI 分析區塊 ── */
.mp-ai-blk {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.mp-ai-hd {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
}
.mp-ai-hd-title { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; }
.mp-ai-badge {
  font-size: 10px; padding: 2px 7px; border-radius: 8px;
}
.mp-ai-badge.ok   { background: rgba(38,166,154,.12); color: var(--up);   border: 1px solid rgba(38,166,154,.2); }
.mp-ai-badge.wait { background: rgba(245,158,11,.1);  color: #f59e0b;     border: 1px solid rgba(245,158,11,.2); }
.mp-ai-badge.fail { background: rgba(239,83,80,.1);   color: var(--down); border: 1px solid rgba(239,83,80,.2); }

.mp-ai-bd { padding: 12px; }
.mp-ai-summary { font-size: 12px; color: var(--text); line-height: 1.75; margin-bottom: 9px; }

.mp-ai-3col { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-bottom: 9px; }
.mp-ai-3c   { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 8px; }
.mp-ai-3c-label { font-size: 9px; color: var(--muted); font-weight: 600; letter-spacing: .05em; margin-bottom: 3px; }
.mp-ai-3c-val   { font-size: 12px; font-weight: 600; color: var(--text); }
.mp-ai-3c-val.bear { color: var(--up); }
.mp-ai-3c-val.bull { color: var(--down); }
.mp-ai-3c-val.warn { color: #f59e0b; }

/* ── 驗算區塊 ── */
.mp-verify-blk {
  background: rgba(38,166,154,.05);
  border: 1px solid rgba(38,166,154,.15);
  border-radius: 6px; padding: 9px 10px; margin-bottom: 9px;
}
.mp-verify-title { font-size: 10px; font-weight: 600; color: var(--up); margin-bottom: 6px; letter-spacing: .05em; }
.mp-verify-row   { display: flex; align-items: flex-start; gap: 5px; font-size: 11px; margin-bottom: 3px; }
.mp-verify-icon  { width: 14px; flex-shrink: 0; padding-top: 1px; }
.mp-verify-text  { color: var(--muted); flex: 1; }
.mp-verify-result { color: var(--up); font-weight: 600; text-align: right; flex-shrink: 0; }
.mp-verify-result.warn { color: #f59e0b; }
.mp-verify-result.fail { color: var(--down); }

/* ── 展望區塊 ── */
.mp-outlook-blk {
  background: rgba(245,158,11,.05);
  border: 1px solid rgba(245,158,11,.15);
  border-radius: 6px; padding: 9px 10px;
}
.mp-outlook-title { font-size: 10px; font-weight: 600; color: #f59e0b; margin-bottom: 5px; letter-spacing: .04em; }
.mp-outlook-text  { font-size: 12px; color: var(--text); line-height: 1.7; }

/* ── Prompt / 匯入區 ── */
.mp-prompt-area {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px; padding: 9px;
  font-size: 11px; color: var(--muted);
  font-family: 'Menlo','Monaco',monospace;
  line-height: 1.6; margin-bottom: 8px;
  white-space: pre-wrap; word-break: break-all;
  max-height: 160px; overflow-y: auto;
}
.mp-btn-row { display: flex; gap: 7px; margin-bottom: 9px; }
.mp-btn-copy {
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.25);
  color: #58a6ff; border-radius: 6px;
  padding: 5px 13px; font-size: 11px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.mp-btn-copy:hover { background: rgba(59,130,246,.2); }

.mp-import-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.mp-import-ta {
  width: 100%; background: var(--bg3);
  border: 1px solid var(--border2); border-radius: 6px;
  padding: 8px; color: var(--text);
  font-size: 11px; font-family: 'Menlo','Monaco',monospace;
  resize: none; height: 72px; box-sizing: border-box;
}
.mp-import-ta:focus { outline: none; border-color: #58a6ff; }
.mp-btn-import {
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.25);
  color: #58a6ff; border-radius: 6px;
  padding: 5px 13px; font-size: 11px; font-weight: 600;
  cursor: pointer; margin-top: 6px; font-family: inherit;
}
.mp-verify-result-blk {
  margin-top: 8px; padding: 8px 10px;
  border-radius: 6px; font-size: 12px; line-height: 1.6;
}
.mp-verify-result-blk.ok   { background: rgba(38,166,154,.08); border: 1px solid rgba(38,166,154,.2); color: var(--up); }
.mp-verify-result-blk.fail { background: rgba(239,83,80,.08);  border: 1px solid rgba(239,83,80,.2);  color: var(--down); }
.mp-verify-result-blk.warn { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); color: #f59e0b; }

.mp-empty { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }
