/* ─────────────────────────────────────────────────────────────
   港股投資分析系統 — 設計系統
   深色專業看盤介面；紅漲綠跌（香港／中國市場慣例）
   ───────────────────────────────────────────────────────────── */
:root {
    --bg: #0b0f16;
    --bg-2: #0e141d;
    --panel: #111823;
    --panel-2: #0d131c;
    --border: #1e2937;
    --border-soft: #172232;
    --text: #e6edf6;
    --text-2: #a9b8cc;
    --muted: #7c8ca3;
    --up: #f04438;
    --up-soft: rgba(240, 68, 56, 0.12);
    --down: #12b76a;
    --down-soft: rgba(18, 183, 106, 0.12);
    --accent: #4f8cff;
    --accent-soft: rgba(79, 140, 255, 0.12);
    --warn: #f79009;
    --gold: #f5c451;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", "Hiragino Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 啟動畫面 ── */
.boot-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: radial-gradient(circle at 50% 40%, #16233a 0%, #0b0f16 60%);
}
.boot-logo { font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.boot-logo span { color: var(--accent); }
.boot-bar { width: 190px; height: 3px; background: #1b2635; border-radius: 3px; overflow: hidden; }
.boot-bar-inner { width: 40%; height: 100%; background: var(--accent); animation: bootmove 1.1s ease-in-out infinite; }
@keyframes bootmove { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.boot-text { color: var(--muted); font-size: 12px; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 12px 16px;
    background: #3b1113;
    color: #ffd9d6;
    border-top: 1px solid #7a1f1f;
    z-index: 9999;
    font-size: 13px;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss { margin-left: 12px; color: #ffb4ae; }

/* ── 版面 ── */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    background: linear-gradient(180deg, #101826 0%, #0d131c 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 16px; letter-spacing: .3px; white-space: nowrap; }
.brand span { color: var(--accent); }
.brand small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); letter-spacing: .5px; }

.nav { display: flex; gap: 4px; }
.nav a {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 13px;
    text-decoration: none;
    border: 1px solid transparent;
}
.nav a:hover { background: #16202e; color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: #cfe0ff; border-color: rgba(79, 140, 255, .35); }

.spacer { flex: 1; }

.user-chip {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-2);
    padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--panel);
}

.content { flex: 1; padding: 14px 18px 28px; max-width: 1680px; width: 100%; margin: 0 auto; }

/* ── 表單元件 ── */
.sym-input {
    background: #0a0f17;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 14px;
    width: 150px;
    font-family: inherit;
    letter-spacing: 1px;
}
.sym-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sym-input::placeholder { color: #4d5d73; letter-spacing: 0; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s ease;
    white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #16202e; color: var(--text); border-color: #2a3a4f; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #3f7cf0; border-color: #3f7cf0; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.seg { display: inline-flex; background: #0a0f17; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
    background: transparent; border: none; color: var(--muted);
    padding: 7px 13px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent-soft); color: #cfe0ff; }

/* ── 面板 ── */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.panel {
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.panel-head {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-soft);
    min-height: 40px;
}
.panel-title { font-size: 13px; font-weight: 600; letter-spacing: .3px; display: flex; align-items: center; gap: 7px; }
.panel-title .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.panel-sub { font-size: 11px; color: var(--muted); }
.panel-body { padding: 10px 12px 12px; flex: 1; min-height: 0; }
.panel-body.flush { padding: 0; }

.p-main { grid-column: span 8; min-height: 470px; }
.p-score { grid-column: span 4; }
.p-radar { grid-column: span 4; min-height: 300px; }
.p-osc { grid-column: span 4; min-height: 300px; }
.p-tips { grid-column: span 4; }
.p-flow { grid-column: span 12; min-height: 320px; }
/* 資金流圖 + 基本面列需完整顯示，避免圖表溢出壓住下方文字 */
.p-flow .p-chart-sm { height: 200px; }
.p-chart { height: 380px; width: 100%; }
.p-chart-sm { height: 210px; width: 100%; }

/* ── 報價列 ── */
.quote-strip { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.quote-name { font-size: 15px; font-weight: 700; }
.quote-code { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.quote-price { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.quote-chg { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }

/* ── 評分卡 ── */
.score-hero { display: flex; align-items: center; gap: 14px; }
.score-ring {
    width: 92px; height: 92px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 3px solid var(--accent);
    background: radial-gradient(circle at 50% 30%, rgba(79,140,255,.18), transparent 70%);
    flex: 0 0 auto;
}
.score-ring .val { font-size: 26px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.score-ring .lbl { font-size: 10px; color: var(--muted); margin-top: 3px; }
.score-ring.grade-a { border-color: var(--up); background: radial-gradient(circle at 50% 30%, rgba(240,68,56,.2), transparent 70%); }
.score-ring.grade-b { border-color: var(--gold); background: radial-gradient(circle at 50% 30%, rgba(245,196,81,.18), transparent 70%); }
.score-ring.grade-c { border-color: var(--down); background: radial-gradient(circle at 50% 30%, rgba(18,183,106,.18), transparent 70%); }

.grade-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
    border: 1px solid currentColor;
}
.grade-badge.a { color: var(--up); background: var(--up-soft); }
.grade-badge.b { color: var(--gold); background: rgba(245,196,81,.1); }
.grade-badge.c { color: var(--down); background: var(--down-soft); }

.dim-list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.dim-row { display: grid; grid-template-columns: 78px 1fr 42px; gap: 8px; align-items: center; }
.dim-name { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.dim-track { height: 6px; background: #18222f; border-radius: 999px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2c5fb8, var(--accent)); }
.dim-fill.hi { background: linear-gradient(90deg, #a52a21, var(--up)); }
.dim-fill.mid { background: linear-gradient(90deg, #a97c14, var(--gold)); }
.dim-fill.lo { background: linear-gradient(90deg, #0d7a49, var(--down)); }
.dim-val { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

.advice {
    margin-top: 12px; padding: 10px 12px;
    background: #0c1420; border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: 6px; font-size: 12.5px; line-height: 1.65; color: var(--text-2);
}

/* ── 價位／提示 ── */
.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.plan-cell { background: #0c1420; border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 10px; }
.plan-cell .k { font-size: 11px; color: var(--muted); }
.plan-cell .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }

.signal-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 168px; overflow-y: auto; }
.signal {
    display: flex; gap: 8px; align-items: flex-start;
    font-size: 12px; line-height: 1.5; padding: 6px 8px;
    border-radius: 6px; background: #0c1420; border-left: 2px solid var(--muted);
}
.signal.bull { border-left-color: var(--up); }
.signal.bear { border-left-color: var(--down); }
.signal .tag { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: #18222f; color: var(--text-2); white-space: nowrap; }
.signal.bull .tag { background: var(--up-soft); color: var(--up); }
.signal.bear .tag { background: var(--down-soft); color: var(--down); }

/* ── 表格 ── */
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 500; font-size: 11.5px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
table.data tbody tr:hover { background: #131c29; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.clickable { cursor: pointer; }

/* ── 標籤 / 提示 ── */
.tag-pill {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
    border: 1px solid var(--border); color: var(--text-2); background: #0d1622;
}
.tag-pill.on { color: #7ee2a8; border-color: rgba(18,183,106,.4); background: rgba(18,183,106,.1); }
.tag-pill.off { color: #ffb4ae; border-color: rgba(240,68,56,.4); background: rgba(240,68,56,.1); }
.tag-pill.demo { color: var(--gold); border-color: rgba(245,196,81,.45); background: rgba(245,196,81,.1); }

.alert {
    display: flex; gap: 8px; align-items: flex-start;
    padding: 9px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.55;
    border: 1px solid rgba(247,144,9,.35); background: rgba(247,144,9,.08); color: #ffd8a8;
    margin-bottom: 12px;
}
.alert.error { border-color: rgba(240,68,56,.4); background: rgba(240,68,56,.1); color: #ffc9c4; }
.alert.info { border-color: rgba(79,140,255,.35); background: rgba(79,140,255,.08); color: #cfe0ff; }

.disclaimer {
    margin-top: 16px; padding: 10px 14px;
    border: 1px dashed #2b3a4d; border-radius: 8px;
    font-size: 11.5px; color: var(--muted); line-height: 1.6;
    background: rgba(255, 255, 255, .012);
}
.disclaimer b { color: var(--warn); }

/* ── 權重滑桿 ── */
.weights { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 12px; background: #0c1420; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 12px; }
.weight-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.weight-item input[type=range] { width: 92px; accent-color: var(--accent); }
.weight-item .wv { width: 30px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* ── 登入 ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: radial-gradient(circle at 50% 0%, #17233a 0%, #0b0f16 55%); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); font-size: 12px; margin: 0 0 20px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; background: #0a0f17; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 10px; margin-top: 6px; }
.hint { margin-top: 14px; font-size: 11px; color: var(--muted); line-height: 1.7; border-top: 1px dashed var(--border); padding-top: 12px; }

/* ── 載入 ── */
.skeleton { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; padding: 18px 4px; }
.spinner { width: 14px; height: 14px; border: 2px solid #24334a; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { color: var(--muted); font-size: 12px; text-align: center; padding: 26px 8px; }

/* ApexCharts tooltip 自訂樣式 */
.tt { padding: 8px 10px; font-size: 11.5px; min-width: 150px; }
.tt-title { font-weight: 700; margin-bottom: 5px; color: #fff; }
.tt-row { display: flex; justify-content: space-between; gap: 14px; color: #b9c6d8; line-height: 1.7; }
.tt-row b { color: #fff; font-variant-numeric: tabular-nums; }
.apexcharts-tooltip.apexcharts-theme-dark { background: #0d1420 !important; border: 1px solid #223044 !important; }

/* ── 響應式 ── */
@media (max-width: 1280px) {
    .p-main { grid-column: span 12; }
    .p-score { grid-column: span 6; }
    .p-radar, .p-osc { grid-column: span 6; }
    .p-tips { grid-column: span 12; }
}
@media (max-width: 820px) {
    .content { padding: 10px 10px 24px; }
    .p-score, .p-radar, .p-osc { grid-column: span 12; }
    .p-main { min-height: 400px; }
    .p-chart { height: 300px; }
    .topbar { padding: 8px 10px; gap: 8px; }
    .brand small { display: none; }
    .sym-input { width: 110px; }
    .quote-price { font-size: 20px; }
    .plan-grid { grid-template-columns: 1fr 1fr; }
    .nav a { padding: 5px 9px; font-size: 12px; }
    .hide-sm { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   儀表板：2 列 × 3 欄專業看盤版面（對照參考圖）
   第 1 列：K 線組合圖 / AI 綜合研判 / 個股雷達
   第 2 列：MACD 互動圖 / 智能技術警示 / 三大法人·散戶趨勢
   第 3 列：最新 5 條關鍵新聞（橫跨全寬）
   ══════════════════════════════════════════════════════════════════ */
.dash {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(0, auto);
    gap: 12px;
}

.dash-cell { min-width: 0; display: flex; flex-direction: column; }
.dash-cell > .panel { flex: 1; }
.dash-wide { grid-column: 1 / -1; }

/* 第 1 列固定高度，讓三張圖表對齊（參考圖中三格等高） */
.dash-row-1 { height: 396px; }
.dash-row-2 { height: 330px; }

.dash-row-1 > .panel > .panel-body,
.dash-row-2 > .panel > .panel-body { overflow: hidden; }

.dash-chart { flex: 1; min-height: 0; width: 100%; }

/* 圖表下方的一行統計（MA／布林／帶寬），對照參考圖底部灰字 */
.stat-bar {
    display: flex; flex-wrap: wrap; gap: 4px 14px;
    margin-top: 6px; padding-top: 7px;
    border-top: 1px solid var(--border-soft);
    font-size: 10.5px; color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.stat-bar b { color: var(--text-2); font-weight: 600; }
.stat-bar .sep { color: #2b3a4d; }

/* ── AI 綜合研判 ── */
.research-top { display: flex; gap: 14px; align-items: stretch; }
.research-score { text-align: center; flex: 0 0 auto; min-width: 86px; }
.research-score .num {
    font-size: 40px; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #ffd7a8, var(--gold));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.research-score .cap { font-size: 10px; color: var(--muted); margin-top: 4px; }

.research-metrics { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 10px; align-content: center; }
.research-metric .k { font-size: 10px; color: var(--muted); }
.research-metric .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.ratio { margin: 10px 0 4px; }
.ratio-labels { display: flex; justify-content: space-between; font-size: 10.5px; margin-bottom: 4px; }
.ratio-track { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: #18222f; }
.ratio-bull { background: linear-gradient(90deg, #b3352c, var(--up)); }
.ratio-bear { background: linear-gradient(90deg, var(--down), #0b7c46); }

.checklist { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.check-row {
    display: grid; grid-template-columns: 12px 52px 1fr auto;
    gap: 6px; align-items: center;
    font-size: 11px; padding: 2px 0;
    border-bottom: 1px dashed rgba(30, 41, 55, .6);
}
.check-row:last-child { border-bottom: none; }
.check-row .mark { font-size: 10px; text-align: center; }
.check-row .mark.ok { color: var(--up); }
.check-row .mark.bad { color: var(--down); }
.check-row .mark.mid { color: var(--gold); }
.check-row .name { color: var(--text-2); }
.check-row .note { color: var(--muted); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-row .val { font-variant-numeric: tabular-nums; font-weight: 600; }

.judge { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.judge-row { display: flex; gap: 8px; line-height: 1.5; }
.judge-row .k { color: var(--muted); flex: 0 0 62px; }
.judge-row .v { color: var(--text-2); }

.risk-note {
    margin-top: 8px; padding: 6px 9px; border-radius: 6px;
    background: rgba(247, 144, 9, .08); border: 1px solid rgba(247, 144, 9, .3);
    font-size: 10.5px; color: #ffd8a8; line-height: 1.55;
}

/* ── 評分細項（雷達圖右側） ── */
.score-detail { display: flex; flex-direction: column; gap: 5px; }
.score-detail-row {
    display: grid; grid-template-columns: 46px 1fr 54px;
    gap: 7px; align-items: center; font-size: 11px;
}
.score-detail-row .name { color: var(--text-2); }
.score-detail-row .track { height: 5px; background: #18222f; border-radius: 999px; overflow: hidden; }
.score-detail-row .fill { height: 100%; border-radius: 999px; }
.score-detail-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 10.5px; }
.score-detail-row .v b { color: var(--text); }

/* ── 智能技術警示報告 ── */
.alert-summary {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 6px; margin-bottom: 9px;
}
.alert-cell {
    text-align: center; padding: 6px 4px;
    border-radius: 7px; border: 1px solid var(--border-soft);
    background: #0c1420;
}
.alert-cell .n { font-size: 19px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.alert-cell .k { font-size: 10px; color: var(--muted); margin-top: 2px; }
.alert-cell.high .n { color: var(--down); }
.alert-cell.warn .n { color: var(--warn); }
.alert-cell.note .n { color: var(--gold); }
.alert-cell.total .n { color: var(--accent); }

.alert-list { display: flex; flex-direction: column; gap: 5px; overflow-y: auto; max-height: 190px; }
.alert-item {
    display: grid; grid-template-columns: 44px 1fr;
    gap: 7px; align-items: start;
    font-size: 11px; line-height: 1.5;
    padding: 5px 7px; border-radius: 6px;
    background: #0c1420; border-left: 2px solid var(--muted);
}
.alert-item.high { border-left-color: var(--down); }
.alert-item.warn { border-left-color: var(--warn); }
.alert-item.note { border-left-color: var(--gold); }
.alert-item .lv {
    font-size: 9.5px; padding: 1px 4px; border-radius: 3px;
    text-align: center; background: #18222f; color: var(--text-2); white-space: nowrap;
}
.alert-item.high .lv { background: var(--down-soft); color: var(--down); }
.alert-item.warn .lv { background: rgba(247,144,9,.14); color: var(--warn); }
.alert-item.note .lv { background: rgba(245,196,81,.14); color: var(--gold); }
.alert-item .dim { color: var(--muted); font-size: 10px; }

/* ── 最新關鍵新聞 ── */
.news-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; }
.news-item {
    display: flex; flex-direction: column; gap: 3px;
    padding: 8px 10px; border-radius: 8px;
    background: #0c1420; border: 1px solid var(--border-soft);
    border-left: 2px solid var(--border);
    transition: border-color .15s ease, background .15s ease;
    text-decoration: none;
}
.news-item:hover { background: #101a27; border-color: #26364a; text-decoration: none; }
.news-item.positive { border-left-color: var(--up); }
.news-item.negative { border-left-color: var(--down); }
.news-head { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); }
.news-title { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.45; }
.news-item:hover .news-title { color: #cfe0ff; }
.news-summary { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.news-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 12px; }

/* ── 籌碼動向（資金流面板右側） ── */
.chip-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 168px; }
.chip-item {
    display: flex; gap: 7px; align-items: baseline;
    font-size: 10.5px; padding: 4px 6px; border-radius: 5px; background: #0c1420;
}
.chip-item .d { color: var(--muted); flex: 0 0 42px; font-variant-numeric: tabular-nums; }
.chip-item .t { flex: 1; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-item.buy .t { color: #ffc9c4; }
.chip-item.sell .t { color: #a7ecc7; }

/* ── 選股頁：資金輸入 ── */
.capital-input {
    display: flex; align-items: center; gap: 8px;
    background: #0a0f17; border: 1px solid var(--border);
    border-radius: 8px; padding: 5px 10px;
}
.capital-input label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.capital-input input {
    background: transparent; border: none; color: var(--text);
    font-size: 14px; font-family: inherit; width: 108px;
    font-variant-numeric: tabular-nums; text-align: right;
}
.capital-input input:focus { outline: none; }
.capital-input .unit { font-size: 11px; color: var(--muted); }
.capital-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.capital-chips button {
    background: #0d1622; border: 1px solid var(--border); color: var(--muted);
    border-radius: 999px; padding: 3px 9px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.capital-chips button:hover { color: var(--text); border-color: #2a3a4f; }

.progress-line {
    display: flex; align-items: center; gap: 10px;
    font-size: 12px; color: var(--text-2);
}
.progress-track { flex: 1; height: 5px; background: #18222f; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #2c5fb8, var(--accent)); transition: width .3s ease; }

@media (max-width: 1400px) {
    .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-row-1, .dash-row-2 { height: auto; }
    .dash-row-1 > .panel, .dash-row-2 > .panel { min-height: 340px; }
}
@media (max-width: 900px) {
    .dash { grid-template-columns: 1fr; }
    .dash-row-1, .dash-row-2 { height: auto; }
    .news-list { grid-template-columns: 1fr; }
}

/* ── 選股：型態 / 信心 / 行業 篩選 ── */
.filter-label {
    font-size: 12px; font-weight: 600; color: var(--text-2);
    margin-bottom: 7px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.filter-hint { font-weight: 400; font-size: 11px; color: var(--muted); }
.filter-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.filter-group {
    flex: 0 0 44px; font-size: 11px; color: var(--muted);
    padding-top: 5px; letter-spacing: .5px;
}
.chip-toggle { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip-toggle button {
    background: #0d1622; border: 1px solid var(--border); color: var(--text-2);
    border-radius: 999px; padding: 4px 11px; font-size: 12px;
    cursor: pointer; font-family: inherit; transition: all .12s ease;
}
.chip-toggle button:hover { border-color: #2a3a4f; color: var(--text); }
.chip-toggle button.on {
    background: var(--accent-soft); border-color: var(--accent); color: #cfe0ff; font-weight: 600;
}

.filter-search {
    background: #0a0f17; border: 1px solid var(--border); border-radius: 7px;
    color: var(--text); font-size: 12px; font-family: inherit;
    padding: 5px 10px; width: 180px;
}
.filter-search:focus { outline: none; border-color: var(--accent); }
.filter-search::placeholder { color: #55637a; }

.industry-cloud {
    display: flex; gap: 6px; flex-wrap: wrap;
    max-height: 156px; overflow-y: auto;
    padding: 9px 10px; background: #0a0f17;
    border: 1px solid var(--border-soft); border-radius: 8px;
}
.industry-cloud button {
    background: #0d1622; border: 1px solid var(--border); color: var(--text-2);
    border-radius: 6px; padding: 3px 8px; font-size: 11.5px;
    cursor: pointer; font-family: inherit; transition: all .12s ease;
}
.industry-cloud button .n {
    color: var(--muted); font-size: 10px; margin-left: 3px;
    font-variant-numeric: tabular-nums;
}
.industry-cloud button:hover { border-color: #2a3a4f; color: var(--text); }
.industry-cloud button.on {
    background: var(--accent-soft); border-color: var(--accent); color: #cfe0ff; font-weight: 600;
}
.industry-cloud button.on .n { color: #9dbdf5; }

/* ── 分析頁「返回選股結果」與選股表的「剛才分析」高亮 ── */
.btn-back {
    background: var(--accent-soft);
    border-color: rgba(79, 140, 255, .45);
    color: #cfe0ff;
    font-weight: 600;
}
.btn-back:hover { background: rgba(79, 140, 255, .2); border-color: var(--accent); color: #fff; }

table.data tbody tr.row-hl { background: rgba(79, 140, 255, .1); }
table.data tbody tr.row-hl:hover { background: rgba(79, 140, 255, .16); }
table.data tbody tr.row-hl td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ── 選股風格（Preset）工具列 ── */
.style-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.style-select {
    background: #0a0f17;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    padding: 6px 10px;
    min-width: 240px;
    max-width: 360px;
    cursor: pointer;
}
.style-select:focus { outline: none; border-color: var(--accent); }
.style-select option { background: #0d1622; color: var(--text); }

.style-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.style-empty {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
    background: #0a0f17;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 11px 13px;
}
.style-empty b { color: var(--text-2); }

.style-editor {
    background: #0a0f17;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 13px 15px 15px;
}

.style-snapshot {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.65;
    background: #0d1622;
    border: 1px solid var(--border-soft);
    border-radius: 7px;
    padding: 8px 11px;
    word-break: break-word;
}

.chk {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
}
.chk input { accent-color: var(--accent); cursor: pointer; }

.chip-toggle button:disabled {
    opacity: .4;
    cursor: not-allowed;
}
