:root {
  /* 三主色（doc-design-system／google-slides-consulting-template）：品牌深藍、主色藍、對比青綠 */
  --brand: #4ab2a8;
  --brand-ink: #1f7f76;
  --navy: #022e9a;
  --navy-2: #0338ca;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --line: #e3e6eb;
  --line-2: #d2d7de;
  --text: #111827;
  --text-2: #4b5565;
  --muted: #8a93a3;
  /* CIS 三色：深藍（主色）、膳魔師紅（本品牌／警示）、灰（中性）；層次一律用不透明度 */
  --accent: #2167dd;
  --accent-soft: #eaf1fd;
  --navy-60: #5b8ff0; --navy-30: #c2d4f6;
  --good: #4ab2a8; --warning: #4ab2a8; --serious: #2167dd; --critical: #022e9a;
  --shadow: 0 1px 2px rgba(2,46,154,.04), 0 2px 8px rgba(2,46,154,.04);
  --r: 12px;
  --hdr: 56px; --tabs: 44px; --rail: 372px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "Roboto Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); font-weight: 400; }

/* ---------- Header ---------- */
.hdr { height: var(--hdr); background: var(--navy); color: #fff; display: flex; align-items: center; gap: 20px; padding: 0 20px; position: sticky; top: 0; z-index: 40; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.mark { background: #fff; color: var(--navy); font-weight: 700; letter-spacing: .14em; font-size: 13px; padding: 4px 9px; border-radius: 3px; }
.ttl { font-weight: 600; font-size: 15px; letter-spacing: .02em; }
.search { position: relative; flex: 1; max-width: 640px; margin: 0 auto; }
.search input { width: 100%; height: 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.08); color: #fff; padding: 0 44px 0 34px; font-size: 13.5px; }
.search input::placeholder { color: #93a3bf; }
.search input:focus { background: #fff; color: var(--text); outline: none; border-color: #fff; }
.search input:focus::placeholder { color: var(--muted); }
.search .si { position: absolute; left: 11px; top: 7px; color: #93a3bf; font-size: 16px; pointer-events: none; }
.search kbd { position: absolute; right: 10px; top: 8px; font-family: var(--mono); font-size: 11px; color: #93a3bf; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; padding: 0 5px; }
.sdrop { position: absolute; top: 42px; left: 0; right: 0; background: #fff; color: var(--text); border-radius: 10px; box-shadow: 0 16px 40px rgba(2,46,154,.22); max-height: 520px; overflow: auto; padding: 6px 0; }
.sdrop .grp { font-size: 11px; color: var(--muted); padding: 8px 14px 4px; letter-spacing: .06em; }
.sdrop a { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 14px; text-decoration: none; }
.sdrop a:hover, .sdrop a.on { background: var(--accent-soft); }
.sdrop a .tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sdrop a .mm { font-size: 11.5px; color: var(--muted); grid-column: 1 / -1; }
.sdrop mark { background: #dbe6f8; color: inherit; padding: 0 1px; }
.sdrop .all { display: block; text-align: center; color: var(--accent); border-top: 1px solid var(--line); margin-top: 4px; padding: 9px; }
.status { display: flex; align-items: center; gap: 14px; font-size: 12px; color: #b9c6dc; flex: none; }
.status .live { display: inline-flex; align-items: center; gap: 6px; }
.status .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(74,178,168,.35); }
.status .live.off i { background: var(--brand); box-shadow: 0 0 0 3px rgba(74,178,168,.35); }
.status a { color: #b9c6dc; }

/* ---------- Tabs ---------- */
.tabs { height: var(--tabs); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: stretch; gap: 4px; padding: 0 16px; position: sticky; top: var(--hdr); z-index: 35; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 0 14px; text-decoration: none; color: var(--text-2); font-weight: 500; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--navy); border-bottom-color: var(--accent); font-weight: 700; }
.badge { background: var(--brand); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 6px; line-height: 17px; font-weight: 600; }
.badge:empty { display: none; }

/* ---------- Body ---------- */
.body { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); align-items: start; }
.left { min-width: 0; padding: 0 20px 80px; }
.fbar { position: sticky; top: calc(var(--hdr) + var(--tabs)); z-index: 30; background: var(--bg); display: flex; align-items: center; gap: 12px; padding: 12px 0 10px; flex-wrap: wrap; }
.subtabs { display: inline-flex; background: #e6edf9; border-radius: 8px; padding: 3px; gap: 2px; }
.subtabs:empty { display: none; }
.subtabs button { border: 0; background: transparent; padding: 4px 14px; border-radius: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.subtabs button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(2,46,154,.12); font-weight: 600; }
.gfilters { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 2px 10px 2px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.chip .sw { margin: 0; }
.chip[aria-pressed="false"] { opacity: .45; }
.chip[aria-pressed="false"] .sw { background: var(--line-2) !important; }
.gfilters select, .ctl select, .inp { border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; padding: 4px 8px; font-size: 12.5px; height: 28px; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-content: start; }
.loading { grid-column: 1 / -1; padding: 80px; text-align: center; color: var(--muted); }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; }
.c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: 1 / -1; }

.card { background: var(--surface); border: 1px solid #e6ebf3; border-radius: var(--r); min-width: 0; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 8px 10px; padding: 11px 14px 4px; flex-wrap: wrap; min-height: 40px; }
.card-h h3 { margin: 0; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.card-h h3::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.card-h .sub { font-size: 11.5px; color: var(--muted); }
.card-h .r { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-b { padding: 4px 14px 12px; flex: 1; min-height: 0; }
.chart { width: 100%; height: 280px; }
.h200 { height: 200px; } .h240 { height: 240px; } .h320 { height: 320px; } .h360 { height: 360px; } .h420 { height: 420px; } .h480 { height: 480px; }

.kpis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid #e6ebf3; border-radius: var(--r); padding: 11px 14px 11px; position: relative; box-shadow: var(--shadow); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--accent); border-radius: var(--r) var(--r) 0 0; }
.kpi.self::before { background: var(--brand); }
.kpi .l { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.tip { position: relative; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--muted); font-size: 9.5px; font-style: normal; font-weight: 700; cursor: help; flex: none; }
.tip:hover { border-color: var(--accent); color: var(--accent); }
.tip::after { content: attr(data-tip); position: absolute; left: -10px; top: 20px; width: 250px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 400; line-height: 1.6; padding: 9px 11px; border-radius: 8px; box-shadow: 0 8px 24px rgba(2,46,154,.25); white-space: pre-line; text-align: left; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50; }
.tip:hover::after, .tip:focus::after { opacity: 1; }
.kpi { overflow: visible; }
.kpi .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.3; }
.kpi .d { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up { color: var(--brand-ink); } .down { color: var(--navy); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; border-right: 1px solid var(--line); padding: 3px 10px; font-size: 12px; color: var(--text-2); height: 26px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; padding: 0 10px; height: 28px; font-size: 12px; color: var(--text); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.dark { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.dark:hover { background: var(--navy-2); }
.ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.ctl label { display: inline-flex; align-items: center; gap: 5px; }

/* tables */
.tbl-wrap { overflow: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { background: #f3f6fd; color: var(--text-2); font-weight: 600; font-size: 12px; text-align: left; padding: 6px 9px; white-space: nowrap; position: sticky; top: 0; z-index: 1; cursor: pointer; user-select: none; }
table.t th.n, table.t td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t td { padding: 6px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: #f8fafc; }
table.t td.idx { color: var(--muted); width: 34px; }
table.t a { text-decoration: none; }
table.t a:hover { color: var(--accent); text-decoration: underline; }
.bar-cell { position: relative; text-align: right; font-variant-numeric: tabular-nums; min-width: 90px; }
.bar-cell .b { position: absolute; right: 0; top: 3px; bottom: 3px; background: var(--navy-30); border-radius: 2px; }
.bar-cell .v { position: relative; padding-right: 5px; }
.heat td.n { font-weight: 500; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 8px 0 0; font-size: 12px; color: var(--muted); }
.pager button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 5px; width: 26px; height: 24px; }
.pager button:disabled { opacity: .35; cursor: default; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; flex: none; }
.tag { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 4px; background: #eef1f5; color: var(--text-2); white-space: nowrap; line-height: 20px; }
.tag.warn { background: transparent; color: var(--brand-ink); box-shadow: inset 0 0 0 1px #95d4ce; }
.tag.neg { background: #e3e9f7; color: var(--navy); }
.tag.pos { background: #e6f5f3; color: var(--brand-ink); }
.stars { color: var(--accent); letter-spacing: -1px; white-space: nowrap; }
.lvl { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.lvl::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.lvl.critical { color: var(--navy); } .lvl.serious { color: var(--accent); } .lvl.warning { color: var(--brand); } .lvl.info { color: #9aa6bd; }
.ref { font-family: var(--mono); font-size: 10.5px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 18px; display: inline-block; }
.ref:hover { background: #dbe6f8; }
.empty { color: var(--muted); text-align: center; padding: 24px 10px; font-size: 12.5px; }
.thumb { width: 32px; height: 32px; border-radius: 5px; object-fit: cover; background: #eef1f5; display: block; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; max-width: 460px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .t { font-weight: 500; text-decoration: none; }
.feed .t:hover { color: var(--accent); }
.feed .m { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.insight { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--text-2); }
.insight b { color: var(--text); }

.brief { font-size: 13px; line-height: 1.65; }
.brief .head { font-size: 14px; font-weight: 600; line-height: 1.5; margin: 0 0 6px; color: var(--text); }
.brief h4 { font-size: 12px; color: var(--text-2); margin: 10px 0 2px; }
.brief ul, .brief ol { margin: 0; padding-left: 17px; }
.brief li { margin: 2px 0; }
.brief p { margin: 3px 0; }
.brief table { border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.brief th, .brief td { border: 1px solid var(--line); padding: 2px 6px; }
.ai-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--navy); background: #eef1f5; border-radius: 4px; padding: 0 6px; line-height: 18px; }
.skel { background: linear-gradient(90deg, #eef1f5, #f7f8fa, #eef1f5); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 5px; height: 12px; margin: 7px 0; }
@keyframes sk { to { background-position: -200% 0; } }

.mkt { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.mkt .card { padding: 10px 12px 2px; cursor: pointer; }
.mkt .card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mkt .nm { font-size: 12px; color: var(--text-2); }
.mkt .val { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mkt .chg { font-size: 11.5px; display: flex; gap: 10px; color: var(--muted); }
.mkt .chart { height: 56px; }

.flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.flow .node { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface-2); position: relative; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.flow .node b { display: block; color: var(--text); font-size: 13.5px; margin-bottom: 2px; }
.flow .node .k { font-size: 10.5px; letter-spacing: .1em; color: var(--accent); font-weight: 700; }
.flow .node:not(:last-child)::after { content: "→"; position: absolute; right: -13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.form { display: grid; gap: 10px; }
.form label { font-size: 12px; font-weight: 600; color: var(--text-2); display: block; margin-bottom: 3px; }
.form textarea, .form select { width: 100%; border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 9px; font-size: 13px; resize: vertical; background: var(--surface); }
pre.prompt { margin: 0; white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-family: var(--font); font-size: 12.5px; max-height: 440px; overflow: auto; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.checks label:hover { background: var(--surface-2); }
.checks small { display: block; color: var(--muted); font-size: 12px; }
.prog { height: 5px; background: #eef1f5; border-radius: 3px; overflow: hidden; margin: 4px 0 8px; }
.prog i { display: block; height: 100%; background: var(--good); }
.hw input, .hw select { width: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px; font-size: 12.5px; background: var(--surface); }

/* ---------- Rail ---------- */
.rail { position: sticky; top: calc(var(--hdr) + var(--tabs)); height: calc(100vh - var(--hdr) - var(--tabs)); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.rail-h { padding: 12px 16px 8px; display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); }
.rail-h b { font-size: 14px; }
.rail-h span { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.rail-sec { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.rail-sec.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 0; border-bottom: 0; }
.rail-t { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.rail-t span:last-child:not(:first-child) { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.rchart { height: 92px; }
.ai-dot { color: var(--brand); margin-right: 4px; }
.lnk { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 0 2px; }
.lnk:hover { color: var(--accent); }
#brief { max-height: 210px; overflow: auto; }
.kw { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; }
.kw a { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; font-size: 12px; text-decoration: none; padding: 2px 0; position: relative; }
.kw a .bk { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--navy-30); border-radius: 1px; }
.kw a:hover .w { color: var(--accent); }
.kw .c { color: var(--text-2); font-variant-numeric: tabular-nums; }
.kw .dl { font-size: 10.5px; min-width: 34px; text-align: right; }
.mini-seg { display: inline-flex; background: #eef1f5; border-radius: 6px; padding: 2px; gap: 1px; }
.mini-seg button { border: 0; background: transparent; font-size: 12px; padding: 2px 10px; border-radius: 5px; color: var(--text-2); }
.mini-seg button.on { background: #fff; color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px rgba(2,46,154,.1); }
.stream { list-style: none; margin: 0 -16px; padding: 0; overflow: auto; flex: 1; }
.stream li { padding: 9px 16px; border-top: 1px solid var(--line); }
.stream li:hover { background: var(--surface-2); }
.stream .t { font-size: 12.5px; font-weight: 500; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stream .t:hover { color: var(--accent); }
.stream .m { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); margin-top: 3px; flex-wrap: wrap; }
.src { font-size: 10.5px; font-weight: 600; border-radius: 3px; padding: 0 5px; line-height: 16px; }
.src.news { background: #eaf1fd; color: var(--accent); } .src.ptt { background: #dbe6f8; color: var(--navy); } .src.review { background: #e6f5f3; color: var(--brand-ink); } .src.channel { background: #eaf1fd; color: var(--navy); } .src.ops { background: #f3f6fd; color: #4a4a4a; }

/* ---------- AI chat popup ---------- */
.fab { position: fixed; right: calc(var(--rail) + 18px); bottom: 18px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; z-index: 70; box-shadow: 0 10px 28px rgba(2,46,154,.35); display: grid; place-items: center; transition: transform .15s; }
.fab:hover { transform: scale(1.05); }
.fab .fab-i { font-size: 18px; color: #95d4ce; }
.fab .fab-x { display: none; font-size: 18px; }
.fab[aria-expanded="true"] .fab-i { display: none; }
.fab[aria-expanded="true"] .fab-x { display: block; }
.fab:not([aria-expanded="true"])::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(74,178,168,.45); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { transform: scale(.95); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.chatpop { position: fixed; right: calc(var(--rail) + 18px); bottom: 74px; width: min(420px, calc(100vw - 32px)); height: min(600px, calc(100vh - 140px)); background: var(--surface); border-radius: 14px; box-shadow: 0 20px 50px rgba(2,46,154,.28); z-index: 69; display: flex; flex-direction: column; overflow: hidden; transform-origin: bottom right; animation: pop .16s ease-out; }
.chatpop[hidden] { display: none; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
.cp-h { background: var(--navy); color: #fff; padding: 12px 14px; display: flex; align-items: center; }
.cp-h b { font-size: 14.5px; display: block; }
.cp-h small { color: #9fb0cc; font-size: 11.5px; }
.cp-min { margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 6px; width: 30px; height: 26px; }
.chat { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.msg { max-width: 94%; border-radius: 10px; padding: 8px 11px; font-size: 13px; line-height: 1.65; }
.msg.u { align-self: flex-end; background: var(--navy); color: #fff; white-space: pre-wrap; }
.msg.a { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.a p { margin: 3px 0; } .msg.a ul, .msg.a ol { margin: 3px 0; padding-left: 18px; }
.msg.a table { border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.msg.a th, .msg.a td { border: 1px solid var(--line); padding: 2px 6px; }
.msg.a h4, .msg.a .head { margin: 6px 0 2px; font-size: 13px; font-weight: 600; }
.msg .srcs { border-top: 1px solid var(--line); margin-top: 7px; padding-top: 5px; font-size: 11.5px; display: grid; gap: 2px; }
.msg .srcs a { color: var(--text-2); text-decoration: none; display: flex; gap: 6px; align-items: center; }
.msg .srcs a:hover { color: var(--accent); }
.msg .meta { font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.sugg { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.sugg button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text-2); text-align: left; }
.sugg button:hover { border-color: var(--accent); color: var(--accent); }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; max-height: 120px; }
.composer button { background: var(--accent); color: #fff; border: 0; border-radius: 8px; width: 40px; height: 36px; font-size: 14px; }
.composer button:disabled { opacity: .45; }
.dots { display: inline-flex; gap: 4px; } .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bl 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bl { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(16px); opacity: 0; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 13px; transition: all .2s; z-index: 80; pointer-events: none; }
.toast.on { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1500px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1280px) {
  :root { --rail: 320px; }
  .c3, .c4, .c5, .c7, .c8 { grid-column: 1 / -1; }
  .c6 { grid-column: span 6; }
  .mkt { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .body { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .stream { max-height: 480px; }
  .fab { right: 16px; bottom: 16px; }
  .chatpop { right: 16px; bottom: 72px; }
  .c6 { grid-column: 1 / -1; }
  .flow { grid-template-columns: 1fr; }
  .flow .node:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -15px; transform: none; }
  .checks { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hdr { gap: 10px; padding: 0 12px; }
  .ttl, .status .hide-sm { display: none; }
  .search kbd { display: none; }
  .left { padding: 0 12px 40px; }
  .kpis, .mkt { grid-template-columns: 1fr 1fr; }
  .gfilters { margin-left: 0; }
  .fab { right: 16px; bottom: 16px; }
  .chatpop { right: 16px; bottom: 84px; }
}

/* ---------- 品牌下拉 ---------- */
#brandFilter { position: relative; }
.dd-btn { height: 28px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; padding: 0 10px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.dd-btn:hover { border-color: var(--accent); }
.dd-btn .caret { color: var(--muted); font-size: 10px; }
.dd-menu { position: absolute; right: 0; top: 34px; z-index: 45; background: #fff; border: 1px solid #e6ebf3; border-radius: 10px; box-shadow: 0 12px 32px rgba(2,46,154,.14); padding: 6px; min-width: 180px; }
.dd-menu[hidden] { display: none; }
.dd-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.dd-item:hover { background: var(--accent-soft); }
.dd-item input { accent-color: var(--accent); margin: 0; }
.dd-item .sw { margin: 0; }
.dd-foot { display: flex; gap: 6px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.dd-foot button { flex: 1; border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 4px 0; font-size: 12px; }

/* ---------- 來源引用 ---------- */
sup.cites { line-height: 0; margin-left: 1px; }
a.cite { display: inline-grid; place-items: center; min-width: 15px; height: 15px; padding: 0 3px; margin: 0 1px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; text-decoration: none; vertical-align: super; line-height: 1; font-family: var(--font); }
a.cite:hover { background: var(--accent); color: #fff; }
td a.cite, .feed a.cite { vertical-align: middle; background: transparent; color: var(--muted); font-size: 12px; }
td a.cite:hover, .feed a.cite:hover { color: var(--accent); background: var(--accent-soft); }
details.srclist { margin-top: 8px; font-size: 12px; color: var(--text-2); }
details.srclist summary { cursor: pointer; color: var(--muted); list-style: none; }
details.srclist summary::before { content: "▸ "; }
details.srclist[open] summary::before { content: "▾ "; }
details.srclist ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 3px; }
details.srclist li a { color: var(--text); text-decoration: none; margin-right: 6px; }
details.srclist li a:hover { color: var(--accent); }
.ai-meta { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* ---------- 章節編號（顏色＝分析線，層次用不透明度） ---------- */
.tn { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--lc); color: #fff; font-size: 11px; font-weight: 700; margin-right: 6px; flex: none; }
.tn.big { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; margin: 0; }
.tabs a .tn { opacity: .55; }
.tabs a.on .tn, .tabs a:hover .tn { opacity: 1; }

/* ---------- 節標題：問題 ＋ 結論先行 ---------- */
.sec-h { display: flex; align-items: center; gap: 14px; padding: 4px 2px 0; }
.sec-n { flex: none; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: var(--lc); background: color-mix(in srgb, var(--lc) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lc) 28%, transparent); }
.sec-h h2 { margin: 0; font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: .01em; }
.sec-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sec-meta i { font-style: normal; color: var(--line-2); }
.insight { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--lc) 7%, #fff); border: 1px solid color-mix(in srgb, var(--lc) 20%, transparent); border-left: 4px solid var(--lc); }
.ins-k { font-size: 11.5px; font-weight: 700; color: #fff; background: var(--lc); border-radius: 5px; padding: 2px 8px; margin-top: 2px; white-space: nowrap; }
.insight ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13.5px; color: var(--text); }
.insight b { color: var(--lc); }
.kpi-go { display: inline-block; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.kpi-go:hover { text-decoration: underline; }
.kpi.self .kpi-go { color: var(--brand-ink); }

/* ---------- 0 分析架構 ---------- */
.frame { display: grid; gap: 12px; padding-top: 14px; }
.lane { display: grid; grid-template-columns: 140px 1fr; border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--lc) 6%, #fff); border: 1px solid color-mix(in srgb, var(--lc) 18%, transparent); }
.lane-k { background: var(--lc); color: #fff; padding: 16px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.lane-k b { font-size: 15px; }
.lane-k span { font-size: 10.5px; letter-spacing: .14em; opacity: .75; }
.lane-b { display: flex; align-items: stretch; gap: 10px; padding: 12px; flex-wrap: wrap; }
.arr { align-self: center; color: color-mix(in srgb, var(--lc) 60%, transparent); font-size: 18px; }
.fcard { flex: 1; min-width: 200px; background: #fff; border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--text); border: 1px solid color-mix(in srgb, var(--lc) 22%, transparent); display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; transition: transform .12s, box-shadow .12s; }
.fcard:hover { transform: translateY(-2px); box-shadow: 0 8px 20px color-mix(in srgb, var(--lc) 18%, transparent); }
.fcard .tn { grid-row: span 2; width: 26px; height: 26px; font-size: 13px; }
.fcard small { color: var(--muted); font-size: 11.5px; }
.fcard em { grid-column: 1 / -1; font-style: normal; font-weight: 600; font-size: 13px; color: var(--lc); margin-top: 6px; }
.merge { text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--accent); opacity: .7; }
table.ftbl th { background: var(--navy); color: #fff; font-size: 12.5px; padding: 10px 12px; }
table.ftbl td { padding: 12px; font-size: 13px; }
table.ftbl tr { cursor: pointer; }
.line-tag { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--lc); background: color-mix(in srgb, var(--lc) 10%, transparent); border-radius: 5px; padding: 2px 8px; white-space: nowrap; }

/* ---------- 5-1 行動清單 ---------- */
.plan { border-top: 4px solid var(--lc); }
.plan .card-h h3::before { background: var(--lc); }
.plan-sig { background: color-mix(in srgb, var(--lc) 7%, #fff); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-2); }
.plan-sig ul { margin: 0; padding-left: 16px; display: grid; gap: 2px; }
.plan-sig b { color: var(--lc); }
.sig-k { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--lc); margin-bottom: 4px; }
.plan-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
@media (max-width: 1024px) { .lane { grid-template-columns: 1fr; } .arr { display: none; } }

/* ---------- 情報流收合 ---------- */
.rail-x { margin-left: 8px; border: 1px solid var(--line-2); background: #fff; color: var(--muted); border-radius: 6px; width: 24px; height: 22px; line-height: 1; font-size: 13px; }
.rail-x:hover { color: var(--accent); border-color: var(--accent); }
.rail-open { display: none; position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 36; border: 1px solid #e6ebf3; border-right: 0; background: #fff; color: var(--accent); border-radius: 10px 0 0 10px; padding: 10px 6px; box-shadow: var(--shadow); font-size: 13px; writing-mode: vertical-rl; letter-spacing: .1em; }
.rail-open span { margin-top: 6px; color: var(--text-2); font-size: 12px; }
.rail-open:hover { background: var(--accent-soft); }
body.rail-off .body { grid-template-columns: minmax(0, 1fr) 0; }
body.rail-off .rail { display: none; }
body.rail-off .rail-open { display: block; }
body.rail-off .fab { right: 18px; }
body.rail-off .chatpop { right: 18px; }
@media (max-width: 1024px) { .rail-open, .rail-x { display: none !important; } body.rail-off .rail { display: flex; } }

/* 收合 */
.fold { margin-left: auto; flex: none; width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; position: relative; }
.card-h .r + .fold { margin-left: 2px; }
.fold::before { content: ""; position: absolute; left: 8px; top: 9px; width: 5px; height: 5px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-135deg); transition: transform .15s; }
.fold:hover { background: var(--accent-soft); color: var(--accent); }
.folded .fold::before { transform: rotate(45deg); top: 6px; }
.card.folded > .card-b, .card.folded > .card-h .r, .card.folded > .card-h .sub { display: none; }
.card.folded > .card-h { cursor: pointer; padding-bottom: 11px; }
.card.folded { align-self: start; box-shadow: none; }
.card.folded > .card-h h3 { color: var(--text-2); }
.rail-t { cursor: pointer; user-select: none; }
.rail-t .fold.sm { margin-left: 4px; width: 18px; height: 18px; }
.rail-t .fold.sm::before { left: 6px; top: 7px; }
.folded .rail-t .fold.sm::before { top: 4px; }
.rail-sec.folded > :not(.rail-t) { display: none; }
.rail-sec.folded .rail-t { margin-bottom: 0; }
.card.folded > .card-h .fold { margin-left: auto; }

/* AI 等待中 */
.msg.pend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 220px; }
.pend-t { font-size: 12.5px; color: var(--text-2); }
.pend-s { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pend-bar { flex-basis: 100%; height: 3px; background: var(--accent-soft); border-radius: 3px; overflow: hidden; }
.pend-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--brand)); border-radius: 3px; transition: width .25s linear; }
.pend-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 2px 0 8px; }

.tabs a .badge { align-self: flex-start; margin: 9px 0 0 -3px; font-size: 10px; line-height: 15px; min-width: 15px; padding: 0 4px; text-align: center; background: var(--accent); }
.feed li.al { display: grid; grid-template-columns: 52px 1fr; column-gap: 6px; align-items: start; }
.feed li.al .lvl { line-height: 21px; }
.feed .al-t { font-weight: 500; line-height: 21px; }
.feed li.al .m a.cite { font-size: 11.5px; padding: 0 4px; border-radius: 4px; }

.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
table.trk tr.over td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.reg-ref .m span:last-child { color: var(--text-2); }
.kpi { min-width: 0; }
.kpi .v { overflow-wrap: anywhere; }
.kpi .l { flex-wrap: wrap; }

/* 影音觀察輪播 */
.vc-wrap { position: relative; }
.vc-row { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 2px 2px 10px; scrollbar-width: thin; }
.vc { flex: 0 0 236px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 5px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 0 10px; cursor: pointer; font: inherit; color: inherit; overflow: hidden; transition: box-shadow .15s, transform .15s; }
.vc:hover { box-shadow: 0 8px 22px rgba(15, 31, 58, .12); transform: translateY(-2px); }
.vc-th { position: relative; display: block; aspect-ratio: 16 / 9; background: #e8eef9 center / cover no-repeat; }
.vc-b, .vc-k { position: absolute; top: 8px; font-size: 11px; font-weight: 600; color: #fff; border-radius: 4px; padding: 1px 6px; }
.vc-b { left: 8px; }
.vc-k { right: 8px; background: rgba(2, 46, 154, .82); }
.vc-play { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .25); opacity: .9; }
.vc-play::after { content: ""; position: absolute; left: 15px; top: 11px; border-left: 12px solid var(--navy); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.vc:hover .vc-play { opacity: 1; }
.vc-t { padding: 0 10px; font-size: 12.5px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.vc-m, .vc-c { padding: 0 10px; font-size: 11.5px; color: var(--text-2); }
.vc-m b { color: var(--text); font-variant-numeric: tabular-nums; }
.vc-m i, .vc-c i { font-style: normal; color: var(--muted); }
.vc-m em { font-style: normal; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 4px; padding: 0 5px; }
.vc-c { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-nav { position: absolute; top: 58px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; color: var(--navy); font-size: 18px; line-height: 1; box-shadow: var(--shadow); cursor: pointer; }
.vc-nav.prev { left: -8px; } .vc-nav.next { right: -8px; }
.vc-nav:hover { background: var(--accent-soft); }
.vc-modal { position: fixed; inset: 0; z-index: 80; background: rgba(10, 20, 45, .62); display: flex; align-items: center; justify-content: center; padding: 16px; }
.vc-modal[hidden] { display: none; }
.vc-box { position: relative; width: min(920px, 100%); background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.vc-x { position: absolute; right: 8px; top: 8px; z-index: 2; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; }
.vc-player { aspect-ratio: 16 / 9; background: #000; }
.vc-player iframe { width: 100%; height: 100%; border: 0; display: block; }
.vc-info { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.vc-it { font-weight: 600; font-size: 14px; }
.vc-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.vc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.vc-stats div { background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; }
.vc-stats b { font-size: 16px; font-variant-numeric: tabular-nums; }
.vc-stats span { font-size: 11px; color: var(--text-2); }
.vc-info .btn { align-self: flex-start; }
@media (max-width: 760px) { .vc { flex-basis: 78%; } .vc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vc-nav { display: none; } }
.vc-act { display: flex; gap: 8px; flex-wrap: wrap; }

/* 收合鈕固定在卡片右上角，不因標題列換行而跑位 */
.card-h { position: relative; padding-right: 40px; }
.card-h .fold { position: absolute; right: 10px; top: 9px; margin: 0; }

/* 結論：結論（粗體）→ 依據 → 意涵 */
.insight .ins-b { flex: 1; min-width: 0; }
.insight ul { margin: 0; padding-left: 18px; }
.insight li { margin: 0 0 8px; line-height: 1.6; }
.insight li:last-child { margin-bottom: 0; }
.insight .ih { display: block; color: var(--text); font-weight: 700; font-size: 13.5px; }
.insight .iw { color: var(--text-2); font-size: 12.5px; }
.insight .is { display: block; color: var(--navy); font-size: 12.5px; font-weight: 500; }
.insight .is::before { content: "→ "; color: var(--lc, var(--accent)); font-weight: 700; }
.insight .ins-src { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line-2); font-size: 11px; color: var(--muted); }

/* 情報流：整欄上下捲動，標題列固定 */
.rail { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.rail-h { position: sticky; top: 0; z-index: 3; background: var(--surface); }
.rail-sec.grow { flex: none; display: block; padding-bottom: 12px; }
.stream { overflow: visible; max-height: none; flex: none; }
#brief { max-height: none; overflow: visible; }
.rail-date { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 6px; font-size: 11.5px; }
.brief .head { font-size: 14.5px; font-weight: 700; color: var(--navy); margin: 2px 0 4px; }
.brief .head + p { font-weight: 600; color: var(--text); margin-bottom: 6px; }
.brief h4 { display: inline-block; margin: 12px 0 4px; padding: 1px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--navy); font-size: 12px; }
.brief li b { color: var(--text); }
@media (max-width: 1024px) { .rail { overflow: visible; } }

/* 圖表篩選標籤 */
.fchip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--accent-soft); font-size: 12.5px; }
.fchip .fk { color: var(--text-2); font-size: 11.5px; }
.fchip b { color: var(--navy); }
.fchip em { font-style: normal; color: var(--muted); }
.fchip button { margin-left: auto; border: 1px solid var(--line-2); background: #fff; color: var(--text-2); border-radius: 6px; padding: 1px 8px; font-size: 12px; cursor: pointer; }
.fchip button:hover { color: var(--accent); border-color: var(--accent); }
.pick-hint { font-size: 10.5px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 6px; line-height: 18px; }
.stream li.more { text-align: center; padding: 10px 16px 14px; } .stream li.more a { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 12.5px; }

/* 結論框收合：只顯示第一點標題 */
.insight { grid-template-columns: auto 1fr auto; }
.insight .ins-tg { align-self: start; border: 1px solid color-mix(in srgb, var(--lc) 30%, transparent); background: #fff; color: var(--lc); border-radius: 6px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.insight .ins-tg:hover { background: color-mix(in srgb, var(--lc) 8%, #fff); }
.insight.collapsed { padding-top: 9px; padding-bottom: 9px; align-items: center; }
.insight.collapsed .ins-b > ul > li:not(:first-child), .insight.collapsed .iw, .insight.collapsed .is, .insight.collapsed .ins-src, .insight.collapsed sup { display: none; }
.insight.collapsed .ins-b > ul > li { margin: 0; }
.insight.collapsed .ih { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 篩選列左側的頁面標題 */
.fbar-title:empty { display: none; }
.fbar-title .sec-h { padding: 0; }
.fbar-title .sec-n { min-width: 40px; height: 40px; font-size: 13px; border-radius: 10px; }
.fbar-title .sec-h h2 { font-size: 18px; }

/* KPI 迷你趨勢 */
.kpi.has-spark { padding-right: 150px; }
.kpi-spark { position: absolute; right: 14px; top: 14px; width: 124px; display: grid; grid-template-columns: 1fr auto; row-gap: 2px; }
.kpi-spark svg { grid-column: 1 / -1; width: 124px; height: 42px; overflow: visible; }
.kpi-spark .ks-l { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.kpi-spark .ks-d { font-size: 10px; }
@media (max-width: 760px) { .kpi.has-spark { padding-right: 14px; } .kpi-spark { position: static; margin-top: 6px; } }
/* 表格列點選 */
.row-pick tbody tr { cursor: pointer; }
.row-pick tbody tr:hover td { background: var(--accent-soft); }
.row-pick tbody tr.on td { background: color-mix(in srgb, var(--accent) 12%, #fff); font-weight: 600; }
.msg hr, .brief hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

/* 低分評論原文 */
.rv-detail { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.rv-dh { font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.rv-dh a { margin-left: 6px; color: var(--accent); text-decoration: none; font-size: 12px; }
.rv-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.rv-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.rv-m { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.rv-t { font-size: 12.5px; line-height: 1.55; margin-top: 2px; }
.rv-p { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* KPI 迷你圖 v2：右半邊垂直置中 */
.kpi.has-spark { padding-right: 14px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 46%); grid-template-rows: auto auto auto auto; column-gap: 14px; align-items: center; }
.kpi.has-spark > :not(.kpi-spark) { grid-column: 1; }
.kpi.has-spark .kpi-spark { position: static; grid-column: 2; grid-row: 1 / span 4; align-self: center; width: 100%; display: block; }
.kpi-spark svg { display: block; width: 100%; height: 58px; overflow: visible; }
.kpi-spark .sv { font-size: 10.5px; font-weight: 700; fill: #2c3748; font-family: inherit; }
.kpi-spark .ks-f { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.kpi-spark .ks-f b { font-weight: 600; font-size: 10.5px; }
.kpi-spark .ks-f b.up { color: #1f8a7f; } .kpi-spark .ks-f b.down { color: var(--navy); }
@media (max-width: 760px) { .kpi.has-spark { grid-template-columns: 1fr; } .kpi.has-spark .kpi-spark { grid-column: 1; grid-row: auto; margin-top: 6px; } }
.kpi-spark svg { height: 64px; }

/* KPI 卡 v3：整張可點（不再顯示「→ 1-1 看聲量」文字）；迷你圖改為與 1-4 成本行情卡相同的細折線 */
.kpi.is-link { cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .15s; }
.kpi.is-link:hover { border-color: #c9d6ee; box-shadow: 0 4px 14px rgba(20, 40, 90, .10); transform: translateY(-1px); }
.kpi.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi.is-link::after { content: '↗'; position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: #9aa3b2; opacity: 0; transition: opacity .15s; }
.kpi.is-link:hover::after { opacity: 1; }
.kpi.has-spark .kpi-spark { height: 58px; min-width: 0; }
.kpi.has-spark { grid-template-rows: auto auto auto; }
.kpi.has-spark .kpi-spark { grid-row: 1 / span 3; }
@media (max-width: 760px) { .kpi.has-spark .kpi-spark { height: 48px; } }
/* 有迷你圖的 KPI 列：固定 3 欄（6 張＝2 列），避免 6 欄時文字被擠成直排 */
.kpis:has(.kpi.has-spark) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis:has(.kpi.has-spark) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis:has(.kpi.has-spark) { grid-template-columns: 1fr; } }
.kpi.has-spark { grid-template-columns: minmax(0, 1fr) minmax(120px, 44%); }
@media (max-width: 760px) {
  .kpi.has-spark { grid-template-columns: minmax(0, 1fr) 42%; }
  .kpi.has-spark .kpi-spark { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; height: 52px; }
}
@media (max-width: 760px) { main.left { overflow-x: clip; } }   /* 隱藏中的說明泡泡不可撐出橫向捲軸 */
/* KPI 卡加高：留白多一點、迷你圖較高，視覺更穩 */
.kpi.has-spark { min-height: 128px; padding: 16px 18px; row-gap: 4px; align-content: center; }
.kpi.has-spark .kpi-spark { height: 76px; }
.kpi.has-spark .v { font-size: 27px; line-height: 1.25; }
@media (max-width: 760px) { .kpi.has-spark { min-height: 108px; } .kpi.has-spark .kpi-spark { height: 60px; } }
/* AI 回答的模型標示 */
.msg .meta .tier { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 4px; margin-right: 6px; line-height: 17px; }
.msg .meta .tier.paid { background: #e8f0fe; color: #1a4fb5; }
.msg .meta .tier.free { background: #e6f5f3; color: #1f7a71; }
/* AI 對話框：表格不撐開對話框（只在表格內捲動）、字級縮小、長字自動換行 */
#chat { overflow-x: hidden; }
#chat .msg { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
#chat .msg table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 12px; line-height: 1.45; margin: 6px 0 10px; }
#chat .msg th, #chat .msg td { padding: 5px 7px; min-width: 52px; max-width: 140px; white-space: normal; vertical-align: top; border: 1px solid #e3e8f0; }
#chat .msg th { background: #f3f6fb; font-weight: 600; }
#chat .msg h1, #chat .msg h2, #chat .msg h3 { font-size: 14px; margin: 10px 0 4px; }
#chat .msg th, #chat .msg td { overflow-wrap: normal; word-break: keep-all; min-width: 54px; }
#chat .msg td:first-child, #chat .msg th:first-child { white-space: nowrap; }
